diff --git a/assets/layers/questions/questions.json b/assets/layers/questions/questions.json index d5d4551f7..5e979b128 100644 --- a/assets/layers/questions/questions.json +++ b/assets/layers/questions/questions.json @@ -175,13 +175,23 @@ "cs": "Jaké je telefonní číslo {title()}?" }, "render": { - "*": "{phone}" + "special": { + "type": "link", + "href": "tel:{phone}", + "text": "{phone}" + } }, "icon": "./assets/layers/questions/phone.svg", "mappings": [ { "if": "contact:phone~*", - "then": "{contact:phone}", + "then":{ + "special": { + "type": "link", + "href": "tel:{contact:phone}", + "text": "{contact:phone}" + } + }, "hideInAnswer": true, "icon": "./assets/layers/questions/phone.svg" } diff --git a/src/UI/Base/DynLink.svelte b/src/UI/Base/DynLink.svelte index 9337a5ff6..91deac7e9 100644 --- a/src/UI/Base/DynLink.svelte +++ b/src/UI/Base/DynLink.svelte @@ -1,6 +1,7 @@ + import { Utils } from "../../Utils" + export let text: string export let href: string + + export let classnames: string = undefined export let download: string = undefined export let ariaLabel: string = undefined @@ -9,7 +13,7 @@ >, - args: string[], - feature: Feature, - layer: LayerConfig + args: string[] ): SvelteUIElement { const { text, icon, idkey, comment, minZoom, zoomButton } = Utils.ParseVisArgs( this.args, @@ -271,7 +269,7 @@ class CloseNoteViz implements SpecialVisualization { message: comment, text: Translations.T(text), minzoom: minZoom, - zoomMoreMessage: zoomButton, + zoomMoreMessage: zoomButton }) } } @@ -287,12 +285,12 @@ export class QuestionViz implements SpecialVisualization { args = [ { name: "labels", - doc: "One or more ';'-separated labels. If these are given, only questions with these labels will be given. Use `unlabeled` for all questions that don't have an explicit label. If none given, all questions will be shown", + doc: "One or more ';'-separated labels. If these are given, only questions with these labels will be given. Use `unlabeled` for all questions that don't have an explicit label. If none given, all questions will be shown" }, { name: "blacklisted-labels", - doc: "One or more ';'-separated labels of questions which should _not_ be included", - }, + doc: "One or more ';'-separated labels of questions which should _not_ be included" + } ] svelteBased = true @@ -317,7 +315,7 @@ export class QuestionViz implements SpecialVisualization { selectedElement: feature, state, onlyForLabels: labels, - notForLabels: blacklist, + notForLabels: blacklist }).SetClass("w-full") } } @@ -353,18 +351,18 @@ export default class SpecialVisualizations { viz.docs, viz.args.length > 0 ? MarkdownUtils.table( - ["name", "default", "description"], - viz.args.map((arg) => { - let defaultArg = arg.defaultValue ?? "_undefined_" - if (defaultArg == "") { - defaultArg = "_empty string_" - } - return [arg.name, defaultArg, arg.doc] - }) - ) + ["name", "default", "description"], + viz.args.map((arg) => { + let defaultArg = arg.defaultValue ?? "_undefined_" + if (defaultArg == "") { + defaultArg = "_empty string_" + } + return [arg.name, defaultArg, arg.doc] + }) + ) : undefined, "#### Example usage of " + viz.funcName, - "" + example + "", + "" + example + "" ].join("\n\n") } @@ -400,24 +398,24 @@ export default class SpecialVisualizations { argname: "some_arg", message: { en: "some other really long message", - nl: "een boodschap in een andere taal", + nl: "een boodschap in een andere taal" }, - other_arg_name: "more args", + other_arg_name: "more args" }, before: { en: "Some text to prefix before the special element (e.g. a title)", - nl: "Een tekst om voor het element te zetten (bv. een titel)", + nl: "Een tekst om voor het element te zetten (bv. een titel)" }, after: { - en: "Some text to put after the element, e.g. a footer", - }, - }, + en: "Some text to put after the element, e.g. a footer" + } + } }, null, " " ) ).SetClass("code"), - 'In other words: use `{ "before": ..., "after": ..., "special": {"type": ..., "argname": ...argvalue...}`. The args are in the `special` block; an argvalue can be a string, a translation or another value. (Refer to class `RewriteSpecial` in case of problems)', + "In other words: use `{ \"before\": ..., \"after\": ..., \"special\": {\"type\": ..., \"argname\": ...argvalue...}`. The args are in the `special` block; an argvalue can be a string, a translation or another value. (Refer to class `RewriteSpecial` in case of problems)" ]) .SetClass("flex flex-col") .AsMarkdown() @@ -437,9 +435,9 @@ export default class SpecialVisualizations { const [lon, lat] = GeoOperations.centerpointCoordinates(feature) return new SvelteUIElement(AddNewPoint, { state, - coordinate: { lon, lat }, + coordinate: { lon, lat } }).SetClass("w-full h-full overflow-auto") - }, + } }, { funcName: "language_picker", @@ -456,11 +454,11 @@ export default class SpecialVisualizations { availableLanguages: languages, preferredLanguages: state.osmConnection.userDetails.map( (ud) => ud.languages - ), + ) }) }) ) - }, + } }, { funcName: "logout", @@ -470,7 +468,7 @@ export default class SpecialVisualizations { constr(state: SpecialVisualizationState): BaseUIElement { return new SvelteUIElement(LogoutButton, { osmConnection: state.osmConnection }) - }, + } }, new HistogramViz(), new StealViz(), @@ -482,13 +480,13 @@ export default class SpecialVisualizations { { doc: "The (maximum) zoomlevel: the target zoomlevel after fitting the entire feature. The minimap will fit the entire feature, then zoom out to this zoom level. The higher, the more zoomed in with 1 being the entire world and 19 being really close", name: "zoomlevel", - defaultValue: "18", + defaultValue: "18" }, { doc: "(Matches all resting arguments) This argument should be the key of a property of the feature. The corresponding value is interpreted as either the id or the a list of ID's. The features with these ID's will be shown on this minimap. (Note: if the key is 'id', list interpration is disabled)", name: "idKey", - defaultValue: "id", - }, + defaultValue: "id" + } ], example: "`{minimap()}`, `{minimap(17, id, _list_of_embedded_feature_ids_calculated_by_calculated_tag):height:10rem; border: 2px solid black}`", @@ -500,7 +498,7 @@ export default class SpecialVisualizations { feature: Feature ): SvelteUIElement { return new SvelteUIElement(MinimapViz, { state, args, feature, tagSource }) - }, + } }, { funcName: "split_button", @@ -521,7 +519,7 @@ export default class SpecialVisualizations { return undefined }) ) - }, + } }, { funcName: "move_button", @@ -542,9 +540,9 @@ export default class SpecialVisualizations { return new SvelteUIElement(MoveWizard, { state, featureToMove: feature, - layer, + layer }) - }, + } }, { funcName: "delete_button", @@ -566,9 +564,9 @@ export default class SpecialVisualizations { deleteConfig: layer.deletion, state, feature, - layer, + layer }).SetClass("p-0 m-0") - }, + } }, new ShareLinkViz(), new ExportAsGpxViz(), @@ -589,9 +587,9 @@ export default class SpecialVisualizations { const [lon, lat] = GeoOperations.centerpointCoordinates(feature) return new SvelteUIElement(CreateNewNote, { state, - coordinate: new UIEventSource({ lon, lat }), + coordinate: new UIEventSource({ lon, lat }) }) - }, + } }, new CloseNoteViz(), new PlantNetDetectionViz(), @@ -610,8 +608,8 @@ export default class SpecialVisualizations { { name: "keyToShowWikipediaFor", doc: "Use the wikidata entry from this key to show the wikipedia article for. Multiple keys can be given (separated by ';'), in which case the first matching value is used", - defaultValue: "wikidata;wikipedia", - }, + defaultValue: "wikidata;wikipedia" + } ], needsUrls: [...Wikidata.neededUrls, ...Wikipedia.neededUrls], @@ -624,9 +622,9 @@ export default class SpecialVisualizations { return tags[key]?.split(";")?.map((id) => id.trim()) ?? [] }) return new SvelteUIElement(WikipediaPanel, { - wikiIds, + wikiIds }) - }, + } }, { funcName: "wikidata_label", @@ -635,8 +633,8 @@ export default class SpecialVisualizations { { name: "keyToShowWikidataFor", doc: "Use the wikidata entry from this key to show the label", - defaultValue: "wikidata", - }, + defaultValue: "wikidata" + } ], needsUrls: Wikidata.neededUrls, example: @@ -660,7 +658,7 @@ export default class SpecialVisualizations { }) ) }) - ), + ) }, new MapillaryLinkVis(), new LanguageElement(), @@ -674,7 +672,7 @@ export default class SpecialVisualizations { _, __, layer: LayerConfig - ) => new SvelteUIElement(AllTagsPanel, { tags, layer }), + ) => new SvelteUIElement(AllTagsPanel, { tags, layer }) }, { funcName: "image_carousel", @@ -683,8 +681,8 @@ export default class SpecialVisualizations { { name: "image_key", defaultValue: AllImageProviders.defaultKeys.join(","), - doc: "The keys given to the images, e.g. if image is given, the first picture URL will be added as image, the second as image:0, the third as image:1, etc... Multiple values are allowed if ';'-separated ", - }, + doc: "The keys given to the images, e.g. if image is given, the first picture URL will be added as image, the second as image:0, the third as image:1, etc... Multiple values are allowed if ';'-separated " + } ], needsUrls: AllImageProviders.apiUrls, constr: (state, tags, args) => { @@ -697,7 +695,7 @@ export default class SpecialVisualizations { tags, state ) - }, + } }, { funcName: "image_upload", @@ -707,13 +705,13 @@ export default class SpecialVisualizations { { name: "image-key", doc: "Image tag to add the URL to (or image-tag:0, image-tag:1 when multiple images are added)", - required: false, + required: false }, { name: "label", doc: "The text to show on the button", - required: false, - }, + required: false + } ], constr: (state, tags, args) => { const targetKey = args[0] === "" ? undefined : args[0] @@ -722,9 +720,9 @@ export default class SpecialVisualizations { tags, targetKey, labelText: args[1], - image: args[2], + image: args[2] }) - }, + } }, { funcName: "rating", @@ -734,12 +732,12 @@ export default class SpecialVisualizations { { name: "subjectKey", defaultValue: "name", - doc: "The key to use to determine the subject. If the value is specified, the subject will be tags[subjectKey] and will use this to filter the reviews.", + doc: "The key to use to determine the subject. If the value is specified, the subject will be tags[subjectKey] and will use this to filter the reviews." }, { name: "fallback", - doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value", - }, + doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value" + } ], constr: (state, tags, args, feature) => { const nameKey = args[0] ?? "name" @@ -750,14 +748,14 @@ export default class SpecialVisualizations { state.userRelatedState.mangroveIdentity, { nameKey: nameKey, - fallbackName, + fallbackName }, state.featureSwitchIsTesting ) return new SvelteUIElement(StarsBarIcon, { - score: reviews.average, + score: reviews.average }) - }, + } }, { @@ -768,12 +766,12 @@ export default class SpecialVisualizations { { name: "subjectKey", defaultValue: "name", - doc: "The key to use to determine the subject. If specified, the subject will be tags[subjectKey]", + doc: "The key to use to determine the subject. If specified, the subject will be tags[subjectKey]" }, { name: "fallback", - doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value", - }, + doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value" + } ], constr: (state, tags, args, feature, layer) => { const nameKey = args[0] ?? "name" @@ -784,12 +782,12 @@ export default class SpecialVisualizations { state.userRelatedState?.mangroveIdentity, { nameKey: nameKey, - fallbackName, + fallbackName }, state.featureSwitchIsTesting ) return new SvelteUIElement(ReviewForm, { reviews, state, tags, feature, layer }) - }, + } }, { funcName: "list_reviews", @@ -799,12 +797,12 @@ export default class SpecialVisualizations { { name: "subjectKey", defaultValue: "name", - doc: "The key to use to determine the subject. If specified, the subject will be tags[subjectKey]", + doc: "The key to use to determine the subject. If specified, the subject will be tags[subjectKey]" }, { name: "fallback", - doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value", - }, + doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value" + } ], constr: (state, tags, args, feature, layer) => { const nameKey = args[0] ?? "name" @@ -815,12 +813,12 @@ export default class SpecialVisualizations { state.userRelatedState?.mangroveIdentity, { nameKey: nameKey, - fallbackName, + fallbackName }, state.featureSwitchIsTesting ) return new SvelteUIElement(AllReviews, { reviews, state, tags, feature, layer }) - }, + } }, { funcName: "reviews", @@ -831,12 +829,12 @@ export default class SpecialVisualizations { { name: "subjectKey", defaultValue: "name", - doc: "The key to use to determine the subject. If specified, the subject will be tags[subjectKey]", + doc: "The key to use to determine the subject. If specified, the subject will be tags[subjectKey]" }, { name: "fallback", - doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value", - }, + doc: "The identifier to use, if tags[subjectKey] as specified above is not available. This is effectively a fallback value" + } ], constr( state: SpecialVisualizationState, @@ -859,9 +857,9 @@ export default class SpecialVisualizations { args, feature, layer - ), + ) ]) - }, + } }, { funcName: "import_mangrove_key", @@ -869,8 +867,8 @@ export default class SpecialVisualizations { args: [ { name: "text", - doc: "The text that is shown on the button", - }, + doc: "The text that is shown on the button" + } ], needsUrls: [], constr( @@ -880,7 +878,7 @@ export default class SpecialVisualizations { ): BaseUIElement { const [text] = argument return new SvelteUIElement(ImportReviewIdentity, { state, text }) - }, + } }, { funcName: "opening_hours_table", @@ -889,18 +887,18 @@ export default class SpecialVisualizations { { name: "key", defaultValue: "opening_hours", - doc: "The tagkey from which the table is constructed.", + doc: "The tagkey from which the table is constructed." }, { name: "prefix", defaultValue: "", - doc: "Remove this string from the start of the value before parsing. __Note: use `&LPARENs` to indicate `(` if needed__", + doc: "Remove this string from the start of the value before parsing. __Note: use `&LPARENs` to indicate `(` if needed__" }, { name: "postfix", defaultValue: "", - doc: "Remove this string from the end of the value before parsing. __Note: use `&RPARENs` to indicate `)` if needed__", - }, + doc: "Remove this string from the end of the value before parsing. __Note: use `&RPARENs` to indicate `)` if needed__" + } ], needsUrls: [Constants.countryCoderEndpoint], example: @@ -908,7 +906,7 @@ export default class SpecialVisualizations { constr: (state, tagSource: UIEventSource, args) => { const [key, prefix, postfix] = args return new OpeningHoursVisualization(tagSource, key, prefix, postfix) - }, + } }, { funcName: "opening_hours_state", @@ -917,18 +915,18 @@ export default class SpecialVisualizations { { name: "key", defaultValue: "opening_hours", - doc: "The tagkey from which the opening hours are read.", + doc: "The tagkey from which the opening hours are read." }, { name: "prefix", defaultValue: "", - doc: "Remove this string from the start of the value before parsing. __Note: use `&LPARENs` to indicate `(` if needed__", + doc: "Remove this string from the start of the value before parsing. __Note: use `&LPARENs` to indicate `(` if needed__" }, { name: "postfix", defaultValue: "", - doc: "Remove this string from the end of the value before parsing. __Note: use `&RPARENs` to indicate `)` if needed__", - }, + doc: "Remove this string from the end of the value before parsing. __Note: use `&RPARENs` to indicate `)` if needed__" + } ], constr( state: SpecialVisualizationState, @@ -943,9 +941,9 @@ export default class SpecialVisualizations { keyToUse, tags, prefix, - postfix, + postfix }) - }, + } }, { funcName: "canonical", @@ -957,8 +955,8 @@ export default class SpecialVisualizations { { name: "key", doc: "The key of the tag to give the canonical text for", - required: true, - }, + required: true + } ], constr: (state, tagSource, args) => { const key = args[0] @@ -982,7 +980,7 @@ export default class SpecialVisualizations { return unit.asHumanLongValue(value, getCountry) }) ) - }, + } }, { funcName: "export_as_geojson", @@ -996,7 +994,7 @@ export default class SpecialVisualizations { new SvelteUIElement(ArrowDownTray), new Combine([ t.downloadFeatureAsGeojson.SetClass("font-bold text-lg"), - t.downloadGeoJsonHelper.SetClass("subtle"), + t.downloadGeoJsonHelper.SetClass("subtle") ]).SetClass("flex flex-col") ) .onClick(() => { @@ -1009,12 +1007,12 @@ export default class SpecialVisualizations { data, title + "_mapcomplete_export.geojson", { - mimetype: "application/vnd.geo+json", + mimetype: "application/vnd.geo+json" } ) }) .SetClass("w-full") - }, + } }, { funcName: "open_in_iD", @@ -1024,9 +1022,9 @@ export default class SpecialVisualizations { constr: (state, feature) => { return new SvelteUIElement(OpenIdEditor, { mapProperties: state.mapProperties, - objectId: feature.data.id, + objectId: feature.data.id }) - }, + } }, { funcName: "open_in_josm", @@ -1036,7 +1034,7 @@ export default class SpecialVisualizations { constr: (state) => { return new SvelteUIElement(OpenJosm, { state }) - }, + } }, { funcName: "clear_location_history", @@ -1051,7 +1049,7 @@ export default class SpecialVisualizations { state.historicalUserLocations.features.setData([]) state.selectedElement.setData(undefined) }) - }, + } }, { funcName: "visualize_note_comments", @@ -1060,13 +1058,13 @@ export default class SpecialVisualizations { { name: "commentsKey", doc: "The property name of the comments, which should be stringified json", - defaultValue: "comments", + defaultValue: "comments" }, { name: "start", doc: "Drop the first 'start' comments", - defaultValue: "0", - }, + defaultValue: "0" + } ], needsUrls: [Constants.osmAuthConfig.url], constr: (state, tags, args) => @@ -1088,7 +1086,7 @@ export default class SpecialVisualizations { ) ).SetClass("flex flex-col") }) - ), + ) }, { funcName: "add_image_to_note", @@ -1097,8 +1095,8 @@ export default class SpecialVisualizations { { name: "Id-key", doc: "The property name where the ID of the note to close can be found", - defaultValue: "id", - }, + defaultValue: "id" + } ], needsUrls: [Imgur.apiUrl], @@ -1107,7 +1105,7 @@ export default class SpecialVisualizations { tags = state.featureProperties.getStore(id) console.log("Id is", id) return new SvelteUIElement(UploadImage, { state, tags }) - }, + } }, { funcName: "title", @@ -1137,12 +1135,12 @@ export default class SpecialVisualizations { tags: tagsSource, state, feature, - layer, + layer }) .SetClass("px-1") .setSpan() }) - ), + ) }, { funcName: "maproulette_task", @@ -1186,7 +1184,7 @@ export default class SpecialVisualizations { }) ) }, - docs: "Fetches the metadata of MapRoulette campaign that this task is part of and shows those details (namely `title`, `description` and `instruction`).\n\nThis reads the property `mr_challengeId` to detect the parent campaign.", + docs: "Fetches the metadata of MapRoulette campaign that this task is part of and shows those details (namely `title`, `description` and `instruction`).\n\nThis reads the property `mr_challengeId` to detect the parent campaign." }, { funcName: "maproulette_set_status", @@ -1197,15 +1195,15 @@ export default class SpecialVisualizations { "\n" + "```json\n" + "{\n" + - ' "id": "mark_duplicate",\n' + - ' "render": {\n' + - ' "special": {\n' + - ' "type": "maproulette_set_status",\n' + - ' "message": {\n' + - ' "en": "Mark as not found or false positive"\n' + + " \"id\": \"mark_duplicate\",\n" + + " \"render\": {\n" + + " \"special\": {\n" + + " \"type\": \"maproulette_set_status\",\n" + + " \"message\": {\n" + + " \"en\": \"Mark as not found or false positive\"\n" + " },\n" + - ' "status": "2",\n' + - ' "image": "close"\n' + + " \"status\": \"2\",\n" + + " \"image\": \"close\"\n" + " }\n" + " }\n" + "}\n" + @@ -1213,32 +1211,32 @@ export default class SpecialVisualizations { args: [ { name: "message", - doc: "A message to show to the user", + doc: "A message to show to the user" }, { name: "image", doc: "Image to show", - defaultValue: "confirm", + defaultValue: "confirm" }, { name: "message_confirm", - doc: "What to show when the task is closed, either by the user or was already closed.", + doc: "What to show when the task is closed, either by the user or was already closed." }, { name: "status", doc: "A statuscode to apply when the button is clicked. 1 = `close`, 2 = `false_positive`, 3 = `skip`, 4 = `deleted`, 5 = `already fixed` (on the map, e.g. for duplicates), 6 = `too hard`", - defaultValue: "1", + defaultValue: "1" }, { name: "maproulette_id", doc: "The property name containing the maproulette id", - defaultValue: "mr_taskId", + defaultValue: "mr_taskId" }, { name: "ask_feedback", doc: "If not an empty string, this will be used as question to ask some additional feedback. A text field will be added", - defaultValue: "", - }, + defaultValue: "" + } ], constr: (state, tagsSource, args) => { @@ -1248,7 +1246,7 @@ export default class SpecialVisualizations { message_closed, statusToSet, maproulette_id_key, - askFeedback, + askFeedback ] = args if (image === "") { image = "confirm" @@ -1265,9 +1263,9 @@ export default class SpecialVisualizations { message_closed, statusToSet, maproulette_id_key, - askFeedback, + askFeedback }) - }, + } }, { funcName: "statistics", @@ -1294,7 +1292,7 @@ export default class SpecialVisualizations { [state.mapProperties.bounds] ) ) - }, + } }, { funcName: "send_email", @@ -1303,29 +1301,29 @@ export default class SpecialVisualizations { { name: "to", doc: "Who to send the email to?", - required: true, + required: true }, { name: "subject", doc: "The subject of the email", - required: true, + required: true }, { name: "body", doc: "The text in the email", - required: true, + required: true }, { name: "button_text", doc: "The text shown on the button in the UI", - required: true, - }, + required: true + } ], constr(__, tags, args) { return new SvelteUIElement(SendEmail, { args, tags }) - }, + } }, { funcName: "link", @@ -1334,36 +1332,36 @@ export default class SpecialVisualizations { { name: "text", doc: "Text to be shown", - required: true, + required: true }, { name: "href", doc: "The URL to link to. Note that this will be URI-encoded before ", - required: true, + required: true }, { name: "class", - doc: "CSS-classes to add to the element", + doc: "CSS-classes to add to the element" }, { name: "download", - doc: "Expects a string which denotes the filename to download the contents of `href` into. If set, this link will act as a download-button.", + doc: "Expects a string which denotes the filename to download the contents of `href` into. If set, this link will act as a download-button." }, { name: "arialabel", - doc: "If set, this text will be used as aria-label", + doc: "If set, this text will be used as aria-label" }, { name: "icon", - doc: "If set, show this icon next to the link. You might want to combine this with `class: button`", - }, + doc: "If set, show this icon next to the link. You might want to combine this with `class: button`" + } ], constr( state: SpecialVisualizationState, tagSource: UIEventSource>, args: string[] - ): BaseUIElement { + ): SvelteUIElement { let [text, href, classnames, download, ariaLabel, icon] = args if (download === "") { download = undefined @@ -1371,11 +1369,7 @@ export default class SpecialVisualizations { const newTab = download === undefined && !href.startsWith("#") const textStore = tagSource.map((tags) => Utils.SubstituteKeys(text, tags)) const hrefStore = tagSource.map( - (tags) => - Utils.SubstituteKeys(href, tags).replaceAll( - / /g, - "%20" - ) /* Chromium based browsers eat the spaces */ + (tags) => Utils.SubstituteKeys(href, tags) ) return new SvelteUIElement(DynLink, { text: textStore, @@ -1384,9 +1378,9 @@ export default class SpecialVisualizations { download: tagSource.map((tags) => Utils.SubstituteKeys(download, tags)), ariaLabel: tagSource.map((tags) => Utils.SubstituteKeys(ariaLabel, tags)), newTab: new ImmutableStore(newTab), - icon: tagSource.map((tags) => Utils.SubstituteKeys(icon, tags)), + icon: tagSource.map((tags) => Utils.SubstituteKeys(icon, tags)) }).setSpan() - }, + } }, { funcName: "multi", @@ -1400,10 +1394,10 @@ export default class SpecialVisualizations { type: "multi", key: "_doors_from_building_properties", tagrendering: { - en: "The building containing this feature has a door of width {entrance:width}", - }, - }, - }, + en: "The building containing this feature has a door of width {entrance:width}" + } + } + } }, null, " " @@ -1413,17 +1407,17 @@ export default class SpecialVisualizations { { name: "key", doc: "The property to read and to interpret as a list of properties", - required: true, + required: true }, { name: "tagrendering", doc: "An entire tagRenderingConfig", - required: true, + required: true }, { name: "classes", - doc: "CSS-classes to apply on every individual item. Seperated by `space`", - }, + doc: "CSS-classes to apply on every individual item. Seperated by `space`" + } ], constr( state: SpecialVisualizationState, @@ -1459,14 +1453,14 @@ export default class SpecialVisualizations { tags: new ImmutableStore(property), state, feature, - layer, + layer }).SetClass(classes) elements.push(subsTr) } return elements }) ) - }, + } }, { funcName: "translated", @@ -1476,8 +1470,8 @@ export default class SpecialVisualizations { { name: "key", doc: "The attribute to interpret as json", - defaultValue: "value", - }, + defaultValue: "value" + } ], constr( state: SpecialVisualizationState, @@ -1498,7 +1492,7 @@ export default class SpecialVisualizations { } }) ) - }, + } }, { funcName: "fediverse_link", @@ -1507,8 +1501,8 @@ export default class SpecialVisualizations { { name: "key", doc: "The attribute-name containing the link", - required: true, - }, + required: true + } ], constr( @@ -1532,13 +1526,13 @@ export default class SpecialVisualizations { const normalLink = new SvelteUIElement(Link, { text: fediAccount, href: "https://" + host + "/@" + username, - newTab: true, + newTab: true }) const loggedInContributorMastodon = state.userRelatedState?.preferencesAsTags?.data?.[ "_mastodon_link" - ] + ] console.log( "LoggedinContributorMastodon", loggedInContributorMastodon @@ -1554,12 +1548,12 @@ export default class SpecialVisualizations { new SvelteUIElement(Link, { href: homeHost + "/" + fediAccount, text: Translations.t.validation.fediverse.onYourServer, - newTab: true, - }).SetClass("button"), + newTab: true + }).SetClass("button") ]) }) ) - }, + } }, { funcName: "braced", @@ -1569,8 +1563,8 @@ export default class SpecialVisualizations { { name: "text", required: true, - doc: "The value to show", - }, + doc: "The value to show" + } ], constr( state: SpecialVisualizationState, @@ -1580,7 +1574,7 @@ export default class SpecialVisualizations { layer: LayerConfig ): BaseUIElement { return new FixedUiElement("{" + args[0] + "}") - }, + } }, { funcName: "tags", @@ -1590,8 +1584,8 @@ export default class SpecialVisualizations { { name: "key", defaultValue: "value", - doc: "The key to look for the tags", - }, + doc: "The key to look for the tags" + } ], constr( state: SpecialVisualizationState, @@ -1616,14 +1610,14 @@ export default class SpecialVisualizations { } catch (e) { return new FixedUiElement( "Could not parse this tag: " + - JSON.stringify(value) + - " due to " + - e + JSON.stringify(value) + + " due to " + + e ).SetClass("alert") } }) ) - }, + } }, { funcName: "giggity", @@ -1631,8 +1625,8 @@ export default class SpecialVisualizations { { name: "giggityUrl", required: true, - doc: "The URL of the giggity-XML", - }, + doc: "The URL of the giggity-XML" + } ], docs: "Shows events that are happening based on a Giggity URL", needsUrls: (args) => args[0], @@ -1646,7 +1640,7 @@ export default class SpecialVisualizations { ): BaseUIElement { const giggityUrl = argument[0] return new SvelteUIElement(Giggity, { tags: tagSource, state, giggityUrl }) - }, + } }, { funcName: "gps_all_tags", @@ -1669,10 +1663,10 @@ export default class SpecialVisualizations { new SvelteUIElement(OrientationDebugPanel, {}), new SvelteUIElement(AllTagsPanel, { state, - tags, - }), + tags + }) ]) - }, + } }, { funcName: "favourite_status", @@ -1691,9 +1685,9 @@ export default class SpecialVisualizations { tags: tagSource, state, layer, - feature, + feature }) - }, + } }, { funcName: "favourite_icon", @@ -1711,9 +1705,9 @@ export default class SpecialVisualizations { tags: tagSource, state, layer, - feature, + feature }).SetClass("w-full h-full") - }, + } }, { funcName: "direction_indicator", @@ -1728,7 +1722,7 @@ export default class SpecialVisualizations { layer: LayerConfig ): BaseUIElement { return new SvelteUIElement(DirectionIndicator, { state, feature }) - }, + } }, { funcName: "qr_code", @@ -1741,7 +1735,7 @@ export default class SpecialVisualizations { feature: Feature ): SvelteUIElement { return new SvelteUIElement(QrCode, { state, tags, feature }) - }, + } }, { funcName: "direction_absolute", @@ -1750,8 +1744,8 @@ export default class SpecialVisualizations { { name: "key", doc: "The attribute containing the degrees", - defaultValue: "_direction:centerpoint", - }, + defaultValue: "_direction:centerpoint" + } ], constr( @@ -1774,7 +1768,7 @@ export default class SpecialVisualizations { return Translations.t.general.visualFeedback.directionsAbsolute[dir] }) ) - }, + } }, { funcName: "compare_data", @@ -1783,18 +1777,18 @@ export default class SpecialVisualizations { { name: "url", required: true, - doc: "The attribute containing the url where to fetch more data", + doc: "The attribute containing the url where to fetch more data" }, { name: "host", required: true, - doc: "The domain name(s) where data might be fetched from - this is needed to set the CSP. A domain must include 'https', e.g. 'https://example.com'. For multiple domains, separate them with ';'. If you don't know the possible domains, use '*'. ", + doc: "The domain name(s) where data might be fetched from - this is needed to set the CSP. A domain must include 'https', e.g. 'https://example.com'. For multiple domains, separate them with ';'. If you don't know the possible domains, use '*'. " }, { name: "readonly", required: false, - doc: "If 'yes', will not show 'apply'-buttons", - }, + doc: "If 'yes', will not show 'apply'-buttons" + } ], docs: "Gives an interactive element which shows a tag comparison between the OSM-object and the upstream object. This allows to copy some or all tags into OSM", constr( @@ -1814,9 +1808,9 @@ export default class SpecialVisualizations { layer, feature, readonly, - externalData, + externalData }) - }, + } }, { funcName: "login_button", @@ -1835,7 +1829,7 @@ export default class SpecialVisualizations { new SvelteUIElement(LoginButton, { osmConnection: state.osmConnection }), state.osmConnection.isLoggedIn ) - }, + } }, { funcName: "linked_data_from_website", @@ -1844,26 +1838,26 @@ export default class SpecialVisualizations { { name: "key", defaultValue: "website", - doc: "Attempt to load ld+json from the specified URL. This can be in an embedded