From 30d00eb06dd6cdfd2d9f804c65435fd31cca49b1 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 4 Jun 2025 00:21:28 +0200 Subject: [PATCH] Chore: housekeeping, linting --- .../charging_station/charging_station.json | 278 +++++++++--------- langs/layers/nl.json | 42 ++- langs/nl.json | 6 +- langs/themes/nl.json | 89 +++++- package-lock.json | 6 +- scripts/fixQuestionHint.ts | 19 +- scripts/generateDocs.ts | 4 +- scripts/generateLayerOverview.ts | 22 +- scripts/nsiLogos.ts | 9 +- .../Sources/OverpassFeatureSource.ts | 1 - src/Logic/GeoOperations.ts | 9 +- src/Logic/ImageProviders/ImageProvider.ts | 2 +- .../ImageProviders/ImageUploadManager.ts | 9 +- src/Logic/ImageProviders/Mapillary.ts | 5 +- src/Logic/ImageProviders/Panoramax.ts | 31 +- src/Logic/Osm/Changes.ts | 4 +- src/Logic/Osm/OsmConnection.ts | 4 +- src/Logic/Osm/Overpass.ts | 1 - src/Logic/State/UserSettingsMetaTagging.ts | 48 ++- src/Logic/Web/NameSuggestionIndex.ts | 8 +- src/Logic/Web/NearbyImagesSearch.ts | 47 +-- .../Conversion/AddContextToTranslations.ts | 2 +- .../AddPrefixToTagRenderingConfig.ts | 7 +- .../ThemeConfig/Conversion/Conversion.ts | 21 +- .../Conversion/DetectMappingsWithImages.ts | 2 +- .../ThemeConfig/Conversion/ExpandFilter.ts | 4 +- .../Conversion/ExpandTagRendering.ts | 6 +- .../ThemeConfig/Conversion/FixImages.ts | 14 +- .../Conversion/LegacyJsonConvert.ts | 2 +- .../Conversion/MiscTagRenderingChecks.ts | 5 +- .../ThemeConfig/Conversion/PrepareLayer.ts | 56 ++-- .../ThemeConfig/Conversion/PrepareTheme.ts | 28 +- .../ThemeConfig/Conversion/ValidateTheme.ts | 15 +- .../ThemeConfig/Conversion/Validation.ts | 24 +- .../QuestionableTagRenderingConfigJson.ts | 6 +- src/Models/ThemeConfig/Json/UnitConfigJson.ts | 3 +- src/Models/ThemeConfig/TagRenderingConfig.ts | 32 +- src/Models/ThemeViewState/WithChangesState.ts | 17 +- .../ThemeViewState/WithUserRelatedState.ts | 6 +- src/UI/AllThemesGui.svelte | 6 +- src/UI/Base/Table.ts | 1 - src/UI/History/AggregateImages.svelte | 20 +- src/UI/History/AggregateView.svelte | 12 +- src/UI/Image/LinkableImage.svelte | 6 +- src/UI/Image/NearbyImages.svelte | 46 +-- src/UI/Image/UploadingImageCounter.svelte | 11 +- src/UI/Image/photoSphereViewerWrapper.ts | 7 +- src/UI/InspectorGUI.svelte | 2 +- src/UI/Map/ProtomapsLanguageSupport.ts | 2 +- src/UI/OpeningHours/OpeningHours.ts | 15 +- .../Visualisation/OpeningHours.svelte | 10 +- .../Visualisation/OpeningHoursHeader.svelte | 12 +- .../OpeningHoursRangeElement.svelte | 1 - .../OpeningHoursWithError.svelte | 27 +- .../RegularOpeningHoursTable.svelte | 167 ++++++----- .../Visualisation/SpecialCase.svelte | 6 +- src/UI/Popup/AutoApplyButton.svelte | 58 ++-- src/UI/Popup/AutoApplyButtonVis.ts | 32 +- src/UI/Popup/QrCode.svelte | 53 ++-- src/UI/Reviews/AllReviews.svelte | 14 +- .../SettingsVisualisations.ts | 32 +- .../UISpecialVisualisations.ts | 25 +- src/UI/SpecialVisualizations.ts | 22 +- src/UI/Studio/EditLayerState.ts | 13 +- src/UI/Test.svelte | 6 +- src/Utils.ts | 9 +- src/assets/contributors.json | 2 +- src/assets/language_in_country.json | 4 - src/assets/language_translations.json | 1 - src/assets/schemas/layerconfigmeta.json | 20 +- src/assets/schemas/layoutconfigmeta.json | 60 +++- src/assets/translators.json | 8 +- .../Conversion/PrepareLayer.spec.ts | 9 +- .../Conversion/PrepareTheme.spec.ts | 8 +- 74 files changed, 998 insertions(+), 623 deletions(-) diff --git a/assets/layers/charging_station/charging_station.json b/assets/layers/charging_station/charging_station.json index 677695add..114ba2553 100644 --- a/assets/layers/charging_station/charging_station.json +++ b/assets/layers/charging_station/charging_station.json @@ -10,16 +10,7 @@ "it": "Stazioni di ricarica", "uk": "Зарядні станції" }, - "description": { - "en": "A charging station", - "nl": "Oplaadpunten", - "ca": "Una estació de càrrega", - "cs": "Nabíjecí stanice", - "de": "Eine Ladestation", - "es": "Un punto de carga", - "fr": "Une station de recharge", - "it": "Una stazione di ricarica" - }, + "minzoom": 10, "source": { "osmTags": { "and": [ @@ -34,7 +25,6 @@ ] } }, - "minzoom": 10, "title": { "render": { "en": "Charging station", @@ -95,119 +85,17 @@ } ] }, - "pointRendering": [ - { - "location": [ - "point", - "centroid" - ], - "marker": [ - { - "icon": "pin", - "color": "#fff" - }, - { - "icon": { - "render": "./assets/themes/charging_stations/plug.svg", - "mappings": [ - { - "if": "bicycle=yes", - "then": "./assets/themes/charging_stations/bicycle.svg" - }, - { - "if": { - "or": [ - "car=yes", - "motorcar=yes" - ] - }, - "then": "./assets/themes/charging_stations/car.svg" - } - ] - } - } - ], - "iconBadges": [ - { - "if": { - "or": [ - "disused:amenity=charging_station", - "operational_status=broken" - ] - }, - "then": "close:#c22;" - }, - { - "if": { - "or": [ - "proposed:amenity=charging_station", - "planned:amenity=charging_station" - ] - }, - "then": "./assets/layers/charging_station/under_construction.svg" - }, - { - "if": { - "and": [ - "bicycle=yes", - { - "or": [ - "motorcar=yes", - "car=yes" - ] - } - ] - }, - "then": "circle:#fff;./assets/themes/charging_stations/car.svg" - } - ], - "anchor": "bottom", - "iconSize": "50,50" - } - ], - "lineRendering": [ - { - "color": "black", - "width": 2, - "fillColor": "#80808080" - } - ], - "presets": [ - { - "tags": [ - "amenity=charging_station", - "motorcar=no", - "bicycle=yes" - ], - "title": { - "en": "charging station for electrical bikes", - "nl": "oplaadpunt voor elektrische fietsen", - "ca": "Estació de càrrega de bicicletes elèctriques", - "cs": "nabíjecí stanice pro elektrokola", - "de": "Ladestation für Elektrofahrräder", - "es": "punto de carga para bicicletas eléctricas", - "it": "stazione di ricarica per biciclette elettriche", - "uk": "зарядна станція для електровелосипедів" - } - }, - { - "tags": [ - "amenity=charging_station", - "motorcar=yes", - "bicycle=no" - ], - "title": { - "en": "charging station for cars", - "nl": "oplaadstation voor elektrische auto's", - "ca": "estació de càrrega per a cotxes", - "cs": "nabíjecí stanice pro auta", - "de": "Ladestation für Autos", - "es": "punto de carga para coches", - "it": "stazione di ricarica per auto", - "uk": "зарядна станція для автомобілів" - } - } - ], + "description": { + "en": "A charging station", + "nl": "Oplaadpunten", + "ca": "Una estació de càrrega", + "cs": "Nabíjecí stanice", + "de": "Eine Ladestation", + "es": "Un punto de carga", + "fr": "Une station de recharge", + "it": "Una stazione di ricarica" + }, + "#": "no-question-hint-check", "tagRenderings": [ "images", { @@ -3511,6 +3399,119 @@ } } ], + "lineRendering": [ + { + "color": "black", + "width": 2, + "fillColor": "#80808080" + } + ], + "pointRendering": [ + { + "location": [ + "point", + "centroid" + ], + "marker": [ + { + "icon": "pin", + "color": "#fff" + }, + { + "icon": { + "render": "./assets/themes/charging_stations/plug.svg", + "mappings": [ + { + "if": "bicycle=yes", + "then": "./assets/themes/charging_stations/bicycle.svg" + }, + { + "if": { + "or": [ + "car=yes", + "motorcar=yes" + ] + }, + "then": "./assets/themes/charging_stations/car.svg" + } + ] + } + } + ], + "iconBadges": [ + { + "if": { + "or": [ + "disused:amenity=charging_station", + "operational_status=broken" + ] + }, + "then": "close:#c22;" + }, + { + "if": { + "or": [ + "proposed:amenity=charging_station", + "planned:amenity=charging_station" + ] + }, + "then": "./assets/layers/charging_station/under_construction.svg" + }, + { + "if": { + "and": [ + "bicycle=yes", + { + "or": [ + "motorcar=yes", + "car=yes" + ] + } + ] + }, + "then": "circle:#fff;./assets/themes/charging_stations/car.svg" + } + ], + "anchor": "bottom", + "iconSize": "50,50" + } + ], + "presets": [ + { + "tags": [ + "amenity=charging_station", + "motorcar=no", + "bicycle=yes" + ], + "title": { + "en": "charging station for electrical bikes", + "nl": "oplaadpunt voor elektrische fietsen", + "ca": "Estació de càrrega de bicicletes elèctriques", + "cs": "nabíjecí stanice pro elektrokola", + "de": "Ladestation für Elektrofahrräder", + "es": "punto de carga para bicicletas eléctricas", + "it": "stazione di ricarica per biciclette elettriche", + "uk": "зарядна станція для електровелосипедів" + } + }, + { + "tags": [ + "amenity=charging_station", + "motorcar=yes", + "bicycle=no" + ], + "title": { + "en": "charging station for cars", + "nl": "oplaadstation voor elektrische auto's", + "ca": "estació de càrrega per a cotxes", + "cs": "nabíjecí stanice pro auta", + "de": "Ladestation für Autos", + "es": "punto de carga para coches", + "it": "stazione di ricarica per auto", + "uk": "зарядна станція для автомобілів" + } + } + ], "filter": [ { "id": "vehicle-type", @@ -3854,19 +3855,6 @@ ] } ], - "deletion": { - "softDeletionTags": { - "and": [ - "amenity=", - "disused:amenity=charging_station" - ] - }, - "neededChangesets": 10 - }, - "allowMove": { - "enableRelocation": false, - "enableImproveAccuracy": true - }, "units": [ { "maxstay": { @@ -4061,5 +4049,17 @@ } } ], - "#": "no-question-hint-check" -} + "allowMove": { + "enableRelocation": false, + "enableImproveAccuracy": true + }, + "deletion": { + "softDeletionTags": { + "and": [ + "amenity=", + "disused:amenity=charging_station" + ] + }, + "neededChangesets": 10 + } +} \ No newline at end of file diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 6837b84b7..500333af2 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -2148,6 +2148,9 @@ }, "title": { "mappings": { + "0": { + "then": "{name}" + }, "1": { "then": "Vogelkijkhut {name}" }, @@ -6851,6 +6854,11 @@ } }, "title": { + "mappings": { + "0": { + "then": "{name}" + } + }, "render": "Natuurgebied" } }, @@ -7385,6 +7393,21 @@ "render": "Picknicktafel" } }, + "play_forest": { + "description": "Een speelbos is een vrij toegankelijke zone in een bos", + "name": "Speelbossen", + "title": { + "mappings": { + "0": { + "then": "{name}" + }, + "1": { + "then": "Speelbos {name}" + } + }, + "render": "Speelbos" + } + }, "playground": { "deletion": { "nonDeleteMappings": { @@ -9133,6 +9156,9 @@ }, "title": { "mappings": { + "0": { + "then": "{name}" + }, "1": { "then": "Voetpad" }, @@ -11382,13 +11408,25 @@ } }, "village_green": { - "description": "Een laag die dorpsgroen toont (gemeenschapsgroen, maar niet echt een park)" + "description": "Een laag die dorpsgroen toont (gemeenschapsgroen, maar niet echt een park)", + "name": "Speelweide", + "title": { + "mappings": { + "0": { + "then": "{name}" + } + }, + "render": "Speelweide" + } }, "visitor_information_centre": { "description": "Een bezoekerscentrum biedt informatie over een specifieke attractie of bezienswaardigheid waar het is gevestigd.", "name": "Bezoekerscentrum", "title": { "mappings": { + "0": { + "then": "{name:nl}" + }, "1": { "then": "{name}" } @@ -11602,4 +11640,4 @@ "render": "windturbine" } } -} +} \ No newline at end of file diff --git a/langs/nl.json b/langs/nl.json index d6b5c9ca5..c4f7699f0 100644 --- a/langs/nl.json +++ b/langs/nl.json @@ -619,8 +619,8 @@ "intro": "Kaarten over verschillende thema's waar je kan aan bijdragen", "learnMore": "Lees meer", "logIn": "Log in om andere thema's te zien waar je al in bewerkt hebt", - "title": "Welkom bij MapComplete", - "recentThemes": "Recent bekeken kaarten" + "recentThemes": "Recent bekeken kaarten", + "title": "Welkom bij MapComplete" }, "move": { "cancel": "Annuleer verplaatsing", @@ -855,4 +855,4 @@ "startsWithQ": "Een wikidata-identificator begint met Q gevolgd door een nummer" } } -} +} \ No newline at end of file diff --git a/langs/themes/nl.json b/langs/themes/nl.json index 6f49130c7..d9fee23dc 100644 --- a/langs/themes/nl.json +++ b/langs/themes/nl.json @@ -595,8 +595,37 @@ "building type": { "question": "Wat voor soort gebouw is dit?" }, + "grb-fixme": { + "mappings": { + "0": { + "then": "Geen fixme" + } + }, + "question": "Wat zegt de fixme?", + "render": "De fixme is {fixme}" + }, + "grb-housenumber": { + "mappings": { + "0": { + "then": "Geen huisnummer" + } + }, + "question": "Wat is het huisnummer?", + "render": "Het huisnummer is {addr:housenumber}" + }, + "grb-min-level": { + "question": "Hoeveel verdiepingen ontbreken?", + "render": "Dit gebouw begint maar op de {building:min_level} verdieping" + }, "grb-reference": { "render": "Werd geïmporteerd vanuit GRB, het referentienummer is {source:geometry:ref}" + }, + "grb-street": { + "question": "Wat is de straat?", + "render": "De straat is {addr:street}" + }, + "grb-unit": { + "render": "De wooneenheid-aanduiding is {addr:unit} " } } }, @@ -638,7 +667,9 @@ "render": "Link op profiel verplicht" } } - } + }, + "shortDescription": "Grb import helper tool", + "title": "GRB import helper" }, "guideposts": { "description": "Wegwijzers (ook wel handwijzer genoemd) zijn vaak te vinden langs officiële wandel-, fiets-, ski- of paardrijroutes om de richtingen naar verschillende bestemmingen aan te geven. Vaak zijn ze vernoemd naar een regio of plaats en geven ze de hoogte aan.\n\nDe positie van een wegwijzer kan door een wandelaar/fietser/renner/skiër worden gebruikt als bevestiging van de huidige positie, vooral als ze een gedrukte kaart zonder GPS-ontvanger gebruiken. ", @@ -1059,6 +1090,11 @@ }, "title": "Dierenartsen, hondenloopzones en andere huisdiervriendelijke plaatsen" }, + "play_forests": { + "description": "Een speelbos is een zone in een bos die vrij toegankelijk is voor spelende kinderen. Deze wordt in bossen van het Agentschap Natuur en bos altijd aangeduid met het overeenkomstige bord.", + "shortDescription": "Deze kaart toont speelbossen", + "title": "Speelbossen" + }, "playgrounds": { "description": "Op deze kaart vind je speeltuinen en kan je zelf meer informatie en foto's toevoegen", "shortDescription": "Een kaart met speeltuinen", @@ -1132,6 +1168,47 @@ "description": "Alles om te skiën", "title": "Skipistes en kabelbanen" }, + "speelplekken": { + "description": "

Welkom bij de Groendoener!

De Zuidrand dat is spelen, ravotten, chillen, wandelen,… in het groen. Meer dan 200 grote en kleine speelplekken liggen er in parken, in bossen en op pleintjes te wachten om ontdekt te worden. De verschillende speelplekken werden getest én goedgekeurd door kinder- en jongerenreporters uit de Zuidrand. Met leuke challenges dagen de reporters jou uit om ook op ontdekking te gaan. Klik op een speelplek op de kaart, bekijk het filmpje en ga op verkenning!

Het project groendoener kadert binnen het strategisch project Beleefbare Open Ruimte in de Antwerpse Zuidrand en is een samenwerking tussen het departement Leefmilieu van provincie Antwerpen, Sportpret vzw, een OpenStreetMap-België Consultent en Createlli vzw. Het project kwam tot stand met steun van Departement Omgeving van de Vlaamse Overheid.
", + "layers": { + "6": { + "name": "Wandelroutes van provincie Antwerpen", + "tagRenderings": { + "walk-description": { + "render": "

Korte beschrijving:

{description}" + }, + "walk-length": { + "render": "Deze wandeling is {_length:km}km lang" + }, + "walk-operator": { + "question": "Wie beheert deze wandeling en plaatst dus de signalisatiebordjes?" + }, + "walk-operator-email": { + "question": "Naar wie kan men emailen bij problemen rond signalisatie?", + "render": "Bij problemen met signalisatie kan men emailen naar {operator:email}" + }, + "walk-type": { + "mappings": { + "0": { + "then": "Dit is een internationale wandelroute" + }, + "1": { + "then": "Dit is een nationale wandelroute" + }, + "2": { + "then": "Dit is een regionale wandelroute" + }, + "3": { + "then": "Dit is een lokale wandelroute" + } + } + } + } + } + }, + "shortDescription": "Speelplekken in de Antwerpse Zuidrand", + "title": "Welkom bij de groendoener!" + }, "sport_pitches": { "description": "Een sportveld is een ingerichte plaats met infrastructuur om een sport te beoefenen", "shortDescription": "Deze kaart toont sportvelden", @@ -1250,6 +1327,10 @@ }, "title": "Straatverlichting" }, + "street_lighting_assen": { + "description": "Op deze kaart vind je alles over straatlantaarns + een dataset van Assen", + "title": "Straatverlichting - Assen" + }, "surveillance": { "description": "Op deze open kaart kan je bewakingscamera's vinden.", "shortDescription": "Bewakingscameras en dergelijke", @@ -1363,9 +1444,13 @@ "description": "Kaart met afvalbakken en recyclingfaciliteiten.", "title": "Afval" }, + "waste_assen": { + "description": "Kaart met afvalbakken en recyclingfaciliteiten + een dataset voor Assen.", + "title": "Afval - Assen" + }, "waste_basket": { "description": "Op deze kaart vind je afvalbakken bij jou in de buurt. Als er een afvalbak ontbreekt op deze kaart, kun je deze zelf toevoegen", "shortDescription": "Een kaart met vuilnisbakken", "title": "Vuilnisbakken" } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 46fc30fb9..ea8e7be3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12773,9 +12773,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001717", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001717.tgz", - "integrity": "sha512-auPpttCq6BDEG8ZAuHJIplGw6GODhjw+/11e7IjpnYCxZcW/ONgPs0KVBJ0d1bY3e2+7PRe5RCLyP+PfwVgkYw==", + "version": "1.0.30001720", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001720.tgz", + "integrity": "sha512-Ec/2yV2nNPwb4DnTANEV99ZWwm3ZWfdlfkQbWSDDt+PsXEVYwlhPH8tdMaPunYTKKmz7AnHi2oNEi1GcmKCD8g==", "dev": true, "funding": [ { diff --git a/scripts/fixQuestionHint.ts b/scripts/fixQuestionHint.ts index bd868f109..75d56600a 100644 --- a/scripts/fixQuestionHint.ts +++ b/scripts/fixQuestionHint.ts @@ -9,15 +9,10 @@ import { ConversionContext } from "../src/Models/ThemeConfig/Conversion/Conversi class ExtractQuestionHint extends DesugaringStep { constructor() { - super( - "ExtractQuestionHint", - "Tries to extract a 'questionHint' from the question", - ) + super("ExtractQuestionHint", "Tries to extract a 'questionHint' from the question") } - convert( - json: QuestionableTagRenderingConfigJson - ): QuestionableTagRenderingConfigJson { + convert(json: QuestionableTagRenderingConfigJson): QuestionableTagRenderingConfigJson { json = { ...json } if (json.question === undefined || json.questionHint !== undefined) { return json @@ -82,7 +77,8 @@ class FixQuestionHint extends Script { } contents[key] = convertor.convertStrict( tr, - ConversionContext.construct([], + ConversionContext.construct( + [], ["While automatically extracting questiondHints of " + filepath] ) ) @@ -100,9 +96,10 @@ class FixQuestionHint extends Script { } layer.tagRenderings[i] = convertor.convertStrict( tagRendering, - ConversionContext.construct([], [ - "While automatically extracting questionHints of " + filepath - ]) + ConversionContext.construct( + [], + ["While automatically extracting questionHints of " + filepath] + ) ) } } diff --git a/scripts/generateDocs.ts b/scripts/generateDocs.ts index f85da064c..15e75755d 100644 --- a/scripts/generateDocs.ts +++ b/scripts/generateDocs.ts @@ -290,7 +290,9 @@ export class GenerateDocs extends Script { } if (denomination.factorToCanonical) { - els.push(`1${denomination.canonical} = ${denomination.factorToCanonical}${defaultUnit.canonical}`) + els.push( + `1${denomination.canonical} = ${denomination.factorToCanonical}${defaultUnit.canonical}` + ) } if (denomination.useIfNoUnitGiven === true) { diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index c1949be31..a98e2cd9c 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -9,12 +9,16 @@ import { DoesImageExist, PrevalidateTheme, ValidateLayer, - ValidateThemeEnsemble + ValidateThemeEnsemble, } from "../src/Models/ThemeConfig/Conversion/Validation" import { Translation } from "../src/UI/i18n/Translation" import { PrepareLayer } from "../src/Models/ThemeConfig/Conversion/PrepareLayer" import { PrepareTheme } from "../src/Models/ThemeConfig/Conversion/PrepareTheme" -import { Conversion, DesugaringContext, DesugaringStep } from "../src/Models/ThemeConfig/Conversion/Conversion" +import { + Conversion, + DesugaringContext, + DesugaringStep, +} from "../src/Models/ThemeConfig/Conversion/Conversion" import { Utils } from "../src/Utils" import Script from "./Script" import { AllSharedLayers } from "../src/Customizations/AllSharedLayers" @@ -31,7 +35,10 @@ import { Translatable } from "../src/Models/ThemeConfig/Json/Translatable" import { ValidateThemeAndLayers } from "../src/Models/ThemeConfig/Conversion/ValidateThemeAndLayers" import { ExtractImages } from "../src/Models/ThemeConfig/Conversion/FixImages" import { TagRenderingConfigJson } from "../src/Models/ThemeConfig/Json/TagRenderingConfigJson" -import { LayerConfigDependencyGraph, LevelInfo } from "../src/Models/ThemeConfig/LayerConfigDependencyGraph" +import { + LayerConfigDependencyGraph, + LevelInfo, +} from "../src/Models/ThemeConfig/LayerConfigDependencyGraph" // This scripts scans 'src/assets/layers/*.json' for layer definition files and 'src/assets/themes/*.json' for theme definition files. // It spits out an overview of those to be used to load them @@ -768,7 +775,14 @@ class LayerOverviewUtils extends Script { const data = JSON.parse(readFileSync(path, "utf8")) results.push(data) if (data.id !== expectedId) { - throw "Wrong ID or location for file " + path + "; expected " + expectedId + " but got " + data.id + throw ( + "Wrong ID or location for file " + + path + + "; expected " + + expectedId + + " but got " + + data.id + ) } } catch (e) { throw "Could not parse layer file " + path + " due to " + e diff --git a/scripts/nsiLogos.ts b/scripts/nsiLogos.ts index 57a6683e8..22dba7bc7 100644 --- a/scripts/nsiLogos.ts +++ b/scripts/nsiLogos.ts @@ -1,5 +1,8 @@ import Script from "./Script" -import NameSuggestionIndex, { NamgeSuggestionWikidata, NSIItem } from "../src/Logic/Web/NameSuggestionIndex" +import NameSuggestionIndex, { + NamgeSuggestionWikidata, + NSIItem, +} from "../src/Logic/Web/NameSuggestionIndex" import * as nsiWD from "../node_modules/name-suggestion-index/dist/wikidata.min.json" import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs" import ScriptUtils from "./ScriptUtils" @@ -215,7 +218,7 @@ class NsiLogos extends Script { const config: LayerConfigJson = { id: "nsi_" + type, description: { - en: "Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" + en: "Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts", }, source: "special:library", pointRendering: null, @@ -393,7 +396,7 @@ class NsiLogos extends Script { download: { f: () => this.download(), doc: "Download all icons" }, generateRenderings: { f: () => this.generateRenderings(), - doc: "Generates the layer files 'nsi_brand.json' and 'nsi_operator.json' which allows to reuse the icons in renderings" + doc: "Generates the layer files 'nsi_brand.json' and 'nsi_operator.json' which allows to reuse the icons in renderings", }, prune: { f: () => NsiLogos.prune(), doc: "Remove no longer needed files" }, addExtensions: { diff --git a/src/Logic/FeatureSource/Sources/OverpassFeatureSource.ts b/src/Logic/FeatureSource/Sources/OverpassFeatureSource.ts index 85ab9d5f8..e78d09fa5 100644 --- a/src/Logic/FeatureSource/Sources/OverpassFeatureSource.ts +++ b/src/Logic/FeatureSource/Sources/OverpassFeatureSource.ts @@ -8,7 +8,6 @@ import { Utils } from "../../../Utils" import { TagsFilter } from "../../Tags/TagsFilter" import { BBox } from "../../BBox" import { OsmTags } from "../../../Models/OsmFeature" - ;("use strict") /** diff --git a/src/Logic/GeoOperations.ts b/src/Logic/GeoOperations.ts index 8981ff429..0c7e893cb 100644 --- a/src/Logic/GeoOperations.ts +++ b/src/Logic/GeoOperations.ts @@ -10,12 +10,12 @@ import { MultiPolygon, Point, Polygon, - Position + Position, } from "geojson" import { Tiles } from "../Models/TileRange" import { Utils } from "../Utils" -("use strict") +;("use strict") export class GeoOperations { private static readonly _earthRadius: number = 6378137 @@ -107,7 +107,10 @@ export class GeoOperations { * @param lonlat0 * @param lonlat1 */ - static distanceBetween(lonlat0: [number, number] | Coord | Position, lonlat1: [number, number] | Position | Coord) { + static distanceBetween( + lonlat0: [number, number] | Coord | Position, + lonlat1: [number, number] | Position | Coord + ) { return turf.distance(lonlat0, lonlat1, { units: "meters" }) } diff --git a/src/Logic/ImageProviders/ImageProvider.ts b/src/Logic/ImageProviders/ImageProvider.ts index 85c131104..99b23f01b 100644 --- a/src/Logic/ImageProviders/ImageProvider.ts +++ b/src/Logic/ImageProviders/ImageProvider.ts @@ -13,7 +13,7 @@ export interface ProvidedImage { /** * An alternative ID, used to deduplicate some images */ - alt_id?: string, + alt_id?: string date?: Date status?: string | "ready" /** diff --git a/src/Logic/ImageProviders/ImageUploadManager.ts b/src/Logic/ImageProviders/ImageUploadManager.ts index 437015b82..7cb7a64cd 100644 --- a/src/Logic/ImageProviders/ImageUploadManager.ts +++ b/src/Logic/ImageProviders/ImageUploadManager.ts @@ -98,7 +98,11 @@ export class ImageUploadManager { const tags = await ExifReader.load(file) if (tags.ProjectionType.value === "cylindrical") { - return { error: new Translation({ en: "Cylindrical images (typically created by a Panorama-app) are not supported" }) } + return { + error: new Translation({ + en: "Cylindrical images (typically created by a Panorama-app) are not supported", + }), + } } return true @@ -125,7 +129,6 @@ export class ImageUploadManager { ignoreGPS: boolean | false } ): void { - const tags: OsmTags = tagsStore.data const featureId = tags.id @@ -290,7 +293,7 @@ export class ImageUploadManager { let absoluteUrl: string try { - ({ key, value, absoluteUrl } = await this._uploader.uploadImage( + ;({ key, value, absoluteUrl } = await this._uploader.uploadImage( blob, location, author, diff --git a/src/Logic/ImageProviders/Mapillary.ts b/src/Logic/ImageProviders/Mapillary.ts index 43cdb7ae7..64b477bd6 100644 --- a/src/Logic/ImageProviders/Mapillary.ts +++ b/src/Logic/ImageProviders/Mapillary.ts @@ -196,7 +196,10 @@ export class Mapillary extends ImageProvider { try { license.date = new Date(date) } catch (e) { - console.warn("Could not parse captured_at date from mapillary image. The date is:", date) + console.warn( + "Could not parse captured_at date from mapillary image. The date is:", + date + ) } return license } diff --git a/src/Logic/ImageProviders/Panoramax.ts b/src/Logic/ImageProviders/Panoramax.ts index 15fc7c181..4bcf26742 100644 --- a/src/Logic/ImageProviders/Panoramax.ts +++ b/src/Logic/ImageProviders/Panoramax.ts @@ -28,7 +28,8 @@ export default class PanoramaxImageProvider extends ImageProvider { * const match = url.match(PanoramaxImageProvider.isDirectLink) * match[1] // => "e931ce57-4591-4dd5-aa4c-595e89c37e84" */ - public static readonly isDirectLink = /https:\/\/panoramax.mapcomplete.org\/api\/pictures\/([0-9a-f-]+)\/(hd)|(sd)|(thumb).jpg/ + public static readonly isDirectLink = + /https:\/\/panoramax.mapcomplete.org\/api\/pictures\/([0-9a-f-]+)\/(hd)|(sd)|(thumb).jpg/ public defaultKeyPrefixes: string[] = ["panoramax", "image"] public readonly name: string = "panoramax" @@ -51,7 +52,7 @@ export default class PanoramaxImageProvider extends ImageProvider { new SvelteUIElement(Panoramax_bw), p.createViewLink({ imageId: img?.id, - location + location, }), true ) @@ -65,14 +66,14 @@ export default class PanoramaxImageProvider extends ImageProvider { const p = new Panoramax(host) return p.createViewLink({ imageId: img?.id, - location + location, }) } public addKnownMeta(meta: ImageData, url?: string) { PanoramaxImageProvider.knownMeta[meta.id] = { data: Promise.resolve({ data: meta, url }), - time: new Date() + time: new Date(), } } @@ -125,7 +126,7 @@ export default class PanoramaxImageProvider extends ImageProvider { status: meta.properties["geovisio:status"], rotation: Number(meta.properties["view:azimuth"]), isSpherical: meta.properties.exif["Xmp.GPano.ProjectionType"] === "equirectangular", - date: new Date(meta.properties.datetime) + date: new Date(meta.properties.datetime), } } @@ -156,7 +157,7 @@ export default class PanoramaxImageProvider extends ImageProvider { const promise: Promise<{ data: ImageData; url: string }> = this.getInfoForUncached(id) PanoramaxImageProvider.knownMeta[id] = { time: new Date(), - data: promise + data: promise, } return await promise } @@ -215,7 +216,7 @@ export default class PanoramaxImageProvider extends ImageProvider { return { artist: meta.data.providers.at(-1).name, // We take the last provider, as that one probably contain the username of the uploader date: new Date(meta.data.properties["datetime"]), - licenseShortName: meta.data.properties["geovisio:license"] + licenseShortName: meta.data.properties["geovisio:license"], } } @@ -247,8 +248,8 @@ export default class PanoramaxImageProvider extends ImageProvider { properties: { url, northOffset, - pitchOffset - } + pitchOffset, + }, } } } @@ -263,7 +264,6 @@ export class PanoramaxUploader implements ImageUploader { this.panoramax = new AuthorizedPanoramax(url, token) } - async uploadImage( blob: File, currentGps: [number, number], @@ -287,13 +287,12 @@ export class PanoramaxUploader implements ImageUploader { throw "Unsupported image format: cylindrical images (panorama images) are currently not supported" } if (tags?.GPSLatitude?.value && tags?.GPSLongitude?.value) { - const [[latD], [latM], [latS, latSDenom]] = < [[number, number], [number, number], [number, number]] - >tags?.GPSLatitude?.value + >tags?.GPSLatitude?.value const [[lonD], [lonM], [lonS, lonSDenom]] = < [[number, number], [number, number], [number, number]] - >tags?.GPSLongitude?.value + >tags?.GPSLongitude?.value const exifLat = latD + latM / 60 + latS / (3600 * latSDenom) const exifLon = lonD + lonM / 60 + lonS / (3600 * lonSDenom) @@ -335,9 +334,7 @@ export class PanoramaxUploader implements ImageUploader { } else { datetime = exifDatetime.toISOString() } - } - } catch (e) { console.warn("Could not read EXIF-tags due to", e) } @@ -356,7 +353,7 @@ export class PanoramaxUploader implements ImageUploader { indexInSequence: sequence["stats:items"].count + 1, // stats:items is '1'-indexed, so .count is also the last index exifOverride: { Artist: author, - } + }, } if (progress) { options.onProgress = (e: ProgressEvent) => { @@ -373,7 +370,7 @@ export class PanoramaxUploader implements ImageUploader { return { key: "panoramax", value: img.id, - absoluteUrl: img.assets.hd.href + absoluteUrl: img.assets.hd.href, } } } diff --git a/src/Logic/Osm/Changes.ts b/src/Logic/Osm/Changes.ts index a547b0f52..541192c9c 100644 --- a/src/Logic/Osm/Changes.ts +++ b/src/Logic/Osm/Changes.ts @@ -54,7 +54,7 @@ export class Changes { featureSwitchIsTesting?: Store } osmConnection: OsmConnection - reportError?: ((message: string | Error | XMLHttpRequest, extramessage?: string) => void), + reportError?: (message: string | Error | XMLHttpRequest, extramessage?: string) => void featureProperties?: FeaturePropertiesStore historicalUserLocations?: FeatureSource> allElements?: IndexedFeatureSource @@ -694,7 +694,7 @@ export class Changes { "Refusing change about " + c.type + "/" + - id + + id + " as not in the objects. No internet?" ) refused.push(c) diff --git a/src/Logic/Osm/OsmConnection.ts b/src/Logic/Osm/OsmConnection.ts index d3297978f..c0c5b47f8 100644 --- a/src/Logic/Osm/OsmConnection.ts +++ b/src/Logic/Osm/OsmConnection.ts @@ -154,8 +154,8 @@ export class OsmConnection { constructor(options?: { dryRun?: Store fakeUser?: false | boolean - oauth_token?: UIEventSource, - shared_cookie?: string, + oauth_token?: UIEventSource + shared_cookie?: string // Used to keep multiple changesets open and to write to the correct changeset singlePage?: boolean attemptLogin?: boolean diff --git a/src/Logic/Osm/Overpass.ts b/src/Logic/Osm/Overpass.ts index b218ea107..7ec59a323 100644 --- a/src/Logic/Osm/Overpass.ts +++ b/src/Logic/Osm/Overpass.ts @@ -5,7 +5,6 @@ import { BBox } from "../BBox" import osmtogeojson from "osmtogeojson" import { FeatureCollection, Geometry } from "geojson" import { OsmTags } from "../../Models/OsmFeature" - ;("use strict") /** * Interfaces overpass to get all the latest data diff --git a/src/Logic/State/UserSettingsMetaTagging.ts b/src/Logic/State/UserSettingsMetaTagging.ts index 33a5ae85b..6e568c5c3 100644 --- a/src/Logic/State/UserSettingsMetaTagging.ts +++ b/src/Logic/State/UserSettingsMetaTagging.ts @@ -1,14 +1,42 @@ import { Utils } from "../../Utils" /** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */ export class ThemeMetaTagging { - public static readonly themeName = "usersettings" + public static readonly themeName = "usersettings" - public metaTaggging_for_usersettings(feat: {properties: Record}) { - Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) ) - Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' ) - Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) ) - Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) ) - Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a ) - feat.properties['__current_backgroun'] = 'initial_value' - } -} \ No newline at end of file + public metaTaggging_for_usersettings(feat: { properties: Record }) { + Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () => + feat.properties._description + .match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/) + ?.at(1) + ) + Utils.AddLazyProperty( + feat.properties, + "_d", + () => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? "" + ) + Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () => + ((feat) => { + const e = document.createElement("div") + e.innerHTML = feat.properties._d + return Array.from(e.getElementsByTagName("a")).filter( + (a) => a.href.match(/mastodon|en.osm.town/) !== null + )[0]?.href + })(feat) + ) + Utils.AddLazyProperty(feat.properties, "_mastodon_link", () => + ((feat) => { + const e = document.createElement("div") + e.innerHTML = feat.properties._d + return Array.from(e.getElementsByTagName("a")).filter( + (a) => a.getAttribute("rel")?.indexOf("me") >= 0 + )[0]?.href + })(feat) + ) + Utils.AddLazyProperty( + feat.properties, + "_mastodon_candidate", + () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a + ) + feat.properties["__current_backgroun"] = "initial_value" + } +} diff --git a/src/Logic/Web/NameSuggestionIndex.ts b/src/Logic/Web/NameSuggestionIndex.ts index 0bd828301..18ffe33d6 100644 --- a/src/Logic/Web/NameSuggestionIndex.ts +++ b/src/Logic/Web/NameSuggestionIndex.ts @@ -361,7 +361,13 @@ export default class NameSuggestionIndex { return nsi.generateMappings(key, tags, country, center, options) } - private static readonly brandPrefix = ["name", "alt_name", "operator", "brand", "official_name"] as const + private static readonly brandPrefix = [ + "name", + "alt_name", + "operator", + "brand", + "official_name", + ] as const /** * An NSI-item might have tags such as `name=X`, `alt_name=brand X`, `brand=X`, `brand:wikidata`, `shop=Y`, `service:abc=yes` diff --git a/src/Logic/Web/NearbyImagesSearch.ts b/src/Logic/Web/NearbyImagesSearch.ts index 544d21b74..7e3240409 100644 --- a/src/Logic/Web/NearbyImagesSearch.ts +++ b/src/Logic/Web/NearbyImagesSearch.ts @@ -101,7 +101,7 @@ class P4CImageFetcher implements ImageFetcher { searchRadius, { mindate: new Date().getTime() - maxAgeSeconds, - towardscenter: false + towardscenter: false, } ) } catch (e) { @@ -152,9 +152,9 @@ class ImagesInLoadedDataFetcher implements ImageFetcher { coordinates: { lng: centerpoint[0], lat: centerpoint[1] }, provider: "OpenStreetMap", details: { - isSpherical: false + isSpherical: false, }, - osmTags: { image } + osmTags: { image }, }) } }) @@ -170,7 +170,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher { public static readonly apiUrls: ReadonlyArray = [ "https://panoramax.openstreetmap.fr", "https://api.panoramax.xyz", - "https://panoramax.mapcomplete.org" + "https://panoramax.mapcomplete.org", ] constructor(url?: string, radius: number = 50) { @@ -191,7 +191,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher { provider: "panoramax", direction: imageData.properties["view:azimuth"], osmTags: { - panoramax: imageData.id + panoramax: imageData.id, }, thumbUrl: imageData.assets.thumb.href, date: new Date(imageData.properties.datetime).getTime(), @@ -200,8 +200,8 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher { detailsUrl: imageData.id, details: { isSpherical: - imageData.properties["exif"]["Xmp.GPano.ProjectionType"] === "equirectangular" - } + imageData.properties["exif"]["Xmp.GPano.ProjectionType"] === "equirectangular", + }, } } @@ -209,23 +209,26 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher { const radiusSettings = [ { place_fov_tolerance: 180, - radius: 15 + radius: 15, }, { place_fov_tolerance: 180, - radius: 25 + radius: 25, }, { place_fov_tolerance: 90, - radius: 50 - } + radius: 50, + }, ] const promises: Promise[] = [] const maxRadius = this._radius let prevRadius = 0 const nearby = this._panoramax.search({ - bbox: new BBox([[lon - 0.0001, lat - 0.0001], [lon + 0.0001, lat + 0.0001]]).toLngLatFlat() + bbox: new BBox([ + [lon - 0.0001, lat - 0.0001], + [lon + 0.0001, lat + 0.0001], + ]).toLngLatFlat(), }) promises.push(nearby) // We do a nearby search with bbox, see https://source.mapcomplete.org/MapComplete/MapComplete/issues/2384 for (const radiusSetting of radiusSettings) { @@ -233,7 +236,7 @@ class ImagesFromPanoramaxFetcher implements ImageFetcher { place: [lon, lat], place_distance: [prevRadius, Math.min(maxRadius, radiusSetting.radius)], place_fov_tolerance: radiusSetting.place_fov_tolerance, - limit: 50 + limit: 50, }) promises.push(promise) prevRadius = radiusSetting.radius @@ -277,7 +280,7 @@ class MapillaryFetcher implements ImageFetcher { boundingBox.getWest(), boundingBox.getSouth(), boundingBox.getEast(), - boundingBox.getNorth() + boundingBox.getNorth(), ].join(",") + "&access_token=" + encodeURIComponent(Constants.mapillary_client_token_v4) + @@ -323,17 +326,17 @@ class MapillaryFetcher implements ImageFetcher { coordinates: { lng: c[0], lat: c[1] }, thumbUrl: img.thumb_256_url, osmTags: { - mapillary: img.id + mapillary: img.id, }, details: { - isSpherical: this._panoramas === "only" + isSpherical: this._panoramas === "only", }, detailsUrl: Mapillary.singleton.visitUrl(img, { lon, lat }), date: img.captured_at, license: "CC-BY-SA", author: img.creator.username, - direction: img.compass_angle + direction: img.compass_angle, }) } return pics @@ -349,7 +352,7 @@ export class CombinedFetcher { Imgur.apiUrl, ...Imgur.supportingUrls, ...MapillaryFetcher.apiUrls, - ...ImagesFromPanoramaxFetcher.apiUrls + ...ImagesFromPanoramaxFetcher.apiUrls, ] constructor(radius: number, maxage: Date, indexedFeatures: IndexedFeatureSource) { @@ -361,15 +364,15 @@ export class CombinedFetcher { new MapillaryFetcher({ max_images: 25, start_captured_at: maxage, - panoramas: "only" + panoramas: "only", }), new MapillaryFetcher({ max_images: 25, start_captured_at: maxage, - panoramas: "no" + panoramas: "no", }), new P4CImageFetcher("mapillary"), - new P4CImageFetcher("wikicommons") + new P4CImageFetcher("wikicommons"), ].map((f) => new CachedFetcher(f)) } @@ -387,7 +390,7 @@ export class CombinedFetcher { const newList = [] const seenIds = new Set() - for (const p4CPicture of [...sink.data ?? [], ...pics]) { + for (const p4CPicture of [...(sink.data ?? []), ...pics]) { const id = p4CPicture.pictureUrl if (seenIds.has(id)) { continue diff --git a/src/Models/ThemeConfig/Conversion/AddContextToTranslations.ts b/src/Models/ThemeConfig/Conversion/AddContextToTranslations.ts index 0a9334d05..8c5b1de51 100644 --- a/src/Models/ThemeConfig/Conversion/AddContextToTranslations.ts +++ b/src/Models/ThemeConfig/Conversion/AddContextToTranslations.ts @@ -9,7 +9,7 @@ export class AddContextToTranslations extends DesugaringStep { constructor(prefix = "") { super( "AddContextToTranslation", - "Adds a '_context' to every object that is probably a translation", + "Adds a '_context' to every object that is probably a translation" ) this._prefix = prefix } diff --git a/src/Models/ThemeConfig/Conversion/AddPrefixToTagRenderingConfig.ts b/src/Models/ThemeConfig/Conversion/AddPrefixToTagRenderingConfig.ts index b769ce531..5feb391f7 100644 --- a/src/Models/ThemeConfig/Conversion/AddPrefixToTagRenderingConfig.ts +++ b/src/Models/ThemeConfig/Conversion/AddPrefixToTagRenderingConfig.ts @@ -2,7 +2,10 @@ import { DesugaringStep } from "./Conversion" import SpecialVisualizations from "../../../UI/SpecialVisualizations" import { Translatable } from "../Json/Translatable" import { TagConfigJson } from "../Json/TagConfigJson" -import { MappingConfigJson, QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson" +import { + MappingConfigJson, + QuestionableTagRenderingConfigJson, +} from "../Json/QuestionableTagRenderingConfigJson" export default class AddPrefixToTagRenderingConfig extends DesugaringStep { private readonly _prefix: string @@ -10,7 +13,7 @@ export default class AddPrefixToTagRenderingConfig extends DesugaringStep { throw new Error( [ "Detected one or more errors, stopping now:", - context.getAll("error").map((e) => `${e.context.path.join(".")} (in operation: ${e.context.operation.join(".")}): ${e.message}`) + context + .getAll("error") + .map( + (e) => + `${e.context.path.join( + "." + )} (in operation: ${e.context.operation.join(".")}): ${e.message}` + ), ].join("\n\t") ) } @@ -107,7 +114,10 @@ export class Bypass extends DesugaringStep { private readonly _step: DesugaringStep constructor(applyIf: (t: T) => boolean, step: DesugaringStep) { - super("Bypass(" + step.name + ")", "Applies the step on the object, if the object satisfies the predicate") + super( + "Bypass(" + step.name + ")", + "Applies the step on the object, if the object satisfies the predicate" + ) this._applyIf = applyIf this._step = step } @@ -161,10 +171,7 @@ export class On extends DesugaringStep { private readonly step: (t: T) => Conversion constructor(key: string, step: Conversion | ((t: T) => Conversion)) { - super( - `On(${key}, ${step.name})`, - "Applies " + step.name + " onto property `" + key + "`", - ) + super(`On(${key}, ${step.name})`, "Applies " + step.name + " onto property `" + key + "`") if (typeof step === "function") { this.step = step } else { @@ -264,7 +271,7 @@ export class Fuse extends DesugaringStep { "Fuse", (doc ?? "") + "This fused pipeline of the following steps: " + - steps.map((s) => s.name).join(", "), + steps.map((s) => s.name).join(", ") ) this.steps = Utils.NoNull(steps) } diff --git a/src/Models/ThemeConfig/Conversion/DetectMappingsWithImages.ts b/src/Models/ThemeConfig/Conversion/DetectMappingsWithImages.ts index 4dfe4c9e4..bdd525073 100644 --- a/src/Models/ThemeConfig/Conversion/DetectMappingsWithImages.ts +++ b/src/Models/ThemeConfig/Conversion/DetectMappingsWithImages.ts @@ -11,7 +11,7 @@ export class DetectMappingsWithImages extends DesugaringStep { constructor() { super( "PruneFilters", - "Removes all filters which are impossible, e.g. because they conflict with the base tags", + "Removes all filters which are impossible, e.g. because they conflict with the base tags" ) } @@ -117,7 +117,7 @@ export class ExpandFilter extends DesugaringStep { [ "Expands filters: replaces a shorthand by the value found in 'filters.json'.", "If the string is formatted 'layername.filtername, it will be looked up into that layer instead. Note that pruning should still be done", - ].join(" "), + ].join(" ") ) this._state = state } diff --git a/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts b/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts index b8738b2a3..d9fa5a35a 100644 --- a/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts +++ b/src/Models/ThemeConfig/Conversion/ExpandTagRendering.ts @@ -39,7 +39,11 @@ export class ExpandTagRendering extends Conversion< addToContext?: false | boolean } ) { - super("ExpandTagRendering", "Converts a tagRenderingSpec into the full tagRendering, e.g. by substituting the tagRendering by the shared-question and reusing the builtins", []) + super( + "ExpandTagRendering", + "Converts a tagRenderingSpec into the full tagRendering, e.g. by substituting the tagRendering by the shared-question and reusing the builtins", + [] + ) this._state = state this._self = self this._options = options diff --git a/src/Models/ThemeConfig/Conversion/FixImages.ts b/src/Models/ThemeConfig/Conversion/FixImages.ts index bc478b09f..b2bc3ea33 100644 --- a/src/Models/ThemeConfig/Conversion/FixImages.ts +++ b/src/Models/ThemeConfig/Conversion/FixImages.ts @@ -232,12 +232,14 @@ export class ExtractImages extends Conversion< // Split "circle:white;./assets/layers/.../something.svg" into ["circle", "./assets/layers/.../something.svg"] const allPaths = Utils.NoNull( - Utils.NoEmpty(foundImage.path?.split(";")?.map((part) => { - if (part.startsWith("http")) { - return part - } - return part.split(":")[0] - })) + Utils.NoEmpty( + foundImage.path?.split(";")?.map((part) => { + if (part.startsWith("http")) { + return part + } + return part.split(":")[0] + }) + ) ) for (const path of allPaths) { cleanedImages.push({ path, context: foundImage.context }) diff --git a/src/Models/ThemeConfig/Conversion/LegacyJsonConvert.ts b/src/Models/ThemeConfig/Conversion/LegacyJsonConvert.ts index 1a9f9ea65..db6d92361 100644 --- a/src/Models/ThemeConfig/Conversion/LegacyJsonConvert.ts +++ b/src/Models/ThemeConfig/Conversion/LegacyJsonConvert.ts @@ -12,7 +12,7 @@ export class UpdateLegacyLayer extends DesugaringStep< constructor() { super( "UpdateLegacyLayer", - "Updates various attributes from the old data format to the new to provide backwards compatibility with the formats", + "Updates various attributes from the old data format to the new to provide backwards compatibility with the formats" ) } diff --git a/src/Models/ThemeConfig/Conversion/MiscTagRenderingChecks.ts b/src/Models/ThemeConfig/Conversion/MiscTagRenderingChecks.ts index 05fbe2b2b..5fb5ffc97 100644 --- a/src/Models/ThemeConfig/Conversion/MiscTagRenderingChecks.ts +++ b/src/Models/ThemeConfig/Conversion/MiscTagRenderingChecks.ts @@ -1,7 +1,10 @@ import { DesugaringStep } from "./Conversion" import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson" import { LayerConfigJson } from "../Json/LayerConfigJson" -import { MappingConfigJson, QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson" +import { + MappingConfigJson, + QuestionableTagRenderingConfigJson, +} from "../Json/QuestionableTagRenderingConfigJson" import { ConversionContext } from "./ConversionContext" import { Translation } from "../../../UI/i18n/Translation" import Validators from "../../../UI/InputElement/Validators" diff --git a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts index 1ff54ab40..344d62e7b 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts @@ -1,6 +1,18 @@ -import { Concat, DesugaringContext, DesugaringStep, Each, FirstOf, Fuse, On, SetDefault } from "./Conversion" +import { + Concat, + DesugaringContext, + DesugaringStep, + Each, + FirstOf, + Fuse, + On, + SetDefault, +} from "./Conversion" import { LayerConfigJson } from "../Json/LayerConfigJson" -import { MinimalTagRenderingConfigJson, TagRenderingConfigJson } from "../Json/TagRenderingConfigJson" +import { + MinimalTagRenderingConfigJson, + TagRenderingConfigJson, +} from "../Json/TagRenderingConfigJson" import { Utils } from "../../../Utils" import RewritableConfigJson from "../Json/RewritableConfigJson" import SpecialVisualizations from "../../../UI/SpecialVisualizations" @@ -25,7 +37,7 @@ class AddFiltersFromTagRenderings extends DesugaringStep { constructor() { super( "AddFiltersFromTagRenderings", - 'Inspects all the tagRenderings. If some tagRenderings have the `filter` attribute set, introduce those filters. This step might introduce shorthand filter names, thus \'ExpandFilter\' should be run afterwards. Can be disabled with "#filter":"no-auto"', + 'Inspects all the tagRenderings. If some tagRenderings have the `filter` attribute set, introduce those filters. This step might introduce shorthand filter names, thus \'ExpandFilter\' should be run afterwards. Can be disabled with "#filter":"no-auto"' ) } @@ -96,7 +108,7 @@ class DetectInline extends DesugaringStep { constructor() { super( "DetectInline", - "If no 'inline' is set on the freeform key, it will be automatically added. If no special renderings are used, it'll be set to true", + "If no 'inline' is set on the freeform key, it will be automatically added. If no special renderings are used, it'll be set to true" ) } @@ -158,10 +170,7 @@ class DetectInline extends DesugaringStep { export class AddQuestionBox extends DesugaringStep { constructor() { - super( - "AddQuestionBox", - "Adds a 'questions'-object if no question element is added yet", - ) + super("AddQuestionBox", "Adds a 'questions'-object if no question element is added yet") } /** @@ -373,7 +382,7 @@ export class RewriteSpecial extends DesugaringStep { constructor() { super( "RewriteSpecial", - "Converts a 'special' translation into a regular translation which uses parameters", + "Converts a 'special' translation into a regular translation which uses parameters" ) } @@ -748,10 +757,7 @@ class PreparePointRendering extends Fuse { class SetFullNodeDatabase extends DesugaringStep { constructor() { - super( - "SetFullNodeDatabase", - "sets the fullNodeDatabase-bit if needed", - ) + super("SetFullNodeDatabase", "sets the fullNodeDatabase-bit if needed") } convert(json: LayerConfigJson, context: ConversionContext): LayerConfigJson { @@ -776,10 +782,7 @@ class ExpandMarkerRenderings extends DesugaringStep { private readonly _state: DesugaringContext constructor(state: DesugaringContext, layer: LayerConfigJson) { - super( - "ExpandMarkerRenderings", - "Expands tagRenderings in the icons, if needed", - ) + super("ExpandMarkerRenderings", "Expands tagRenderings in the icons, if needed") this._layer = layer this._state = state } @@ -811,7 +814,7 @@ class AddFavouriteBadges extends DesugaringStep { constructor() { super( "AddFavouriteBadges", - "Adds the favourite heart to the title and the rendering badges", + "Adds the favourite heart to the title and the rendering badges" ) } @@ -835,7 +838,7 @@ export class AddRatingBadge extends DesugaringStep { constructor() { super( "AddRatingBadge", - "Adds the 'rating'-element if a reviews-element is used in the tagRenderings", + "Adds the 'rating'-element if a reviews-element is used in the tagRenderings" ) } @@ -870,7 +873,7 @@ export class AutoTitleIcon extends DesugaringStep { constructor() { super( "AutoTitleIcon", - "The auto-icon creates a (non-clickable) title icon based on a tagRendering which has icons", + "The auto-icon creates a (non-clickable) title icon based on a tagRendering which has icons" ) } @@ -946,34 +949,35 @@ export class AutoTitleIcon extends DesugaringStep { } class MoveUnitConfigs extends DesugaringStep { - constructor() { - super("MoveUnitConfigs", "Looks into all the tagRenderings for a 'unitConfig', moves them to the layer level") + super( + "MoveUnitConfigs", + "Looks into all the tagRenderings for a 'unitConfig', moves them to the layer level" + ) } convert(json: LayerConfigJson, context: ConversionContext): LayerConfigJson { json = { ...json, units: [...(json.units ?? [])] } for (const tr of json.tagRenderings ?? []) { - const qtr = (tr) + const qtr = tr const unitConfig = qtr?.freeform?.unit if (!unitConfig) { continue } json.units.push({ - [qtr.freeform.key]: unitConfig + [qtr.freeform.key]: unitConfig, }) // Note: we do not delete the config - this way, if the tagRendering is imported in another layer, the unit comes along } return json } - } class DeriveSource extends DesugaringStep { constructor() { super( "DeriveSource", - "If no source is given, automatically derives the osmTags by 'or'-ing all the preset tags", + "If no source is given, automatically derives the osmTags by 'or'-ing all the preset tags" ) } diff --git a/src/Models/ThemeConfig/Conversion/PrepareTheme.ts b/src/Models/ThemeConfig/Conversion/PrepareTheme.ts index dd45c7416..e156b5f9b 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareTheme.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareTheme.ts @@ -1,4 +1,14 @@ -import { Concat, Conversion, DesugaringContext, DesugaringStep, Each, Fuse, On, Pass, SetDefault } from "./Conversion" +import { + Concat, + Conversion, + DesugaringContext, + DesugaringStep, + Each, + Fuse, + On, + Pass, + SetDefault, +} from "./Conversion" import { ThemeConfigJson } from "../Json/ThemeConfigJson" import { PrepareLayer, RewriteSpecial } from "./PrepareLayer" import { LayerConfigJson } from "../Json/LayerConfigJson" @@ -15,7 +25,11 @@ class SubstituteLayer extends Conversion { constructor(state: DesugaringContext) { super( "AddDefaultLayers", - "Adds the default layers, namely: " + Constants.added_by_default.join(", "), + "Adds the default layers, namely: " + Constants.added_by_default.join(", ") ) this._state = state } @@ -211,7 +225,7 @@ class AddContextToTranslationsInLayout extends DesugaringStep { constructor() { super( "AddContextToTranlationsInLayout", - "Adds context to translations, including the prefix 'themes:json.id'; this is to make sure terms in an 'overrides' or inline layer are linkable too", + "Adds context to translations, including the prefix 'themes:json.id'; this is to make sure terms in an 'overrides' or inline layer are linkable too" ) } @@ -229,7 +243,7 @@ class ApplyOverrideAll extends DesugaringStep { constructor() { super( "ApplyOverrideAll", - "Applies 'overrideAll' onto every 'layer'. The 'overrideAll'-field is removed afterwards", + "Applies 'overrideAll' onto every 'layer'. The 'overrideAll'-field is removed afterwards" ) } @@ -280,7 +294,7 @@ class AddDependencyLayersToTheme extends DesugaringStep { constructor(state: DesugaringContext) { super( "AddDependencyLayersToTheme", - `If a layer has a dependency on another layer, these layers are added automatically on the theme. (For example: defibrillator depends on 'walls_and_buildings' to snap onto. This layer is added automatically)`, + `If a layer has a dependency on another layer, these layers are added automatically on the theme. (For example: defibrillator depends on 'walls_and_buildings' to snap onto. This layer is added automatically)` ) this._state = state } @@ -462,7 +476,7 @@ class WarnForUnsubstitutedLayersInTheme extends DesugaringStep constructor() { super( "WarnForUnsubstitutedLayersInTheme", - "Generates a warning if a theme uses an inline layer; we recommend splitting of all layers in separate files", + "Generates a warning if a theme uses an inline layer; we recommend splitting of all layers in separate files" ) } diff --git a/src/Models/ThemeConfig/Conversion/ValidateTheme.ts b/src/Models/ThemeConfig/Conversion/ValidateTheme.ts index 8e8b47f03..bee2c9dd4 100644 --- a/src/Models/ThemeConfig/Conversion/ValidateTheme.ts +++ b/src/Models/ThemeConfig/Conversion/ValidateTheme.ts @@ -64,8 +64,9 @@ export class ValidateTheme extends DesugaringStep { if (this._isBuiltin && this._extractImages !== undefined) { // Check images: are they local, are the licenses there, is the theme icon square, ... const images = this._extractImages.convert(json, context.inOperation("ValidateTheme")) - const remoteImages = images.filter((img) => img.path.indexOf("http") == 0) - .filter(img => !img.path.startsWith(Constants.nsiLogosEndpoint)) + const remoteImages = images + .filter((img) => img.path.indexOf("http") == 0) + .filter((img) => !img.path.startsWith(Constants.nsiLogosEndpoint)) for (const remoteImage of remoteImages) { context.err( "Found a remote image: " + @@ -125,7 +126,10 @@ export class ValidateTheme extends DesugaringStep { } // Official, public themes must have a full english translation - new ValidateLanguageCompleteness("en").convert(theme, context.inOperation("ValidateLanguageCompleteness")) + new ValidateLanguageCompleteness("en").convert( + theme, + context.inOperation("ValidateLanguageCompleteness") + ) } } catch (e) { console.error(e) @@ -133,7 +137,10 @@ export class ValidateTheme extends DesugaringStep { } if (theme.id !== "personal") { - new DetectDuplicatePresets().convert(theme, context.inOperation("DectectDuplicatePrsets")) + new DetectDuplicatePresets().convert( + theme, + context.inOperation("DectectDuplicatePrsets") + ) } if (!theme.title) { diff --git a/src/Models/ThemeConfig/Conversion/Validation.ts b/src/Models/ThemeConfig/Conversion/Validation.ts index 16f4ba62a..6bc79f6f3 100644 --- a/src/Models/ThemeConfig/Conversion/Validation.ts +++ b/src/Models/ThemeConfig/Conversion/Validation.ts @@ -29,7 +29,7 @@ export class ValidateLanguageCompleteness extends DesugaringStep { constructor(...languages: string[]) { super( "ValidateLanguageCompleteness", - "Checks that the given object is fully translated in the specified languages", + "Checks that the given object is fully translated in the specified languages" ) this._languages = languages ?? ["en"] } @@ -132,7 +132,7 @@ class OverrideShadowingCheck extends DesugaringStep { constructor() { super( "OverrideShadowingCheck", - "Checks that an 'overrideAll' does not override a single override", + "Checks that an 'overrideAll' does not override a single override" ) } @@ -267,7 +267,7 @@ export class DetectConflictingAddExtraTags extends DesugaringStep does have `rel='noopener'` set", + "Given a possible set of translations, validates that does have `rel='noopener'` set" ) } @@ -657,10 +657,7 @@ export class CheckTranslation extends DesugaringStep { private readonly _allowUndefined: boolean constructor(allowUndefined: boolean = false) { - super( - "CheckTranslation", - "Checks that a translation is valid and internally consistent", - ) + super("CheckTranslation", "Checks that a translation is valid and internally consistent") this._allowUndefined = allowUndefined } @@ -1037,7 +1034,7 @@ export class DetectDuplicatePresets extends DesugaringStep { constructor() { super( "DetectDuplicatePresets", - "Detects mappings which have identical (english) names or identical mappings.", + "Detects mappings which have identical (english) names or identical mappings." ) } @@ -1101,7 +1098,10 @@ export class ValidateThemeEnsemble extends Conversion< > > { constructor() { - super("ValidateThemeEnsemble", "Validates that all themes together are logical, i.e. no duplicate ids exists within (overriden) themes") + super( + "ValidateThemeEnsemble", + "Validates that all themes together are logical, i.e. no duplicate ids exists within (overriden) themes" + ) } convert( diff --git a/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts index 50bbedff0..34f4831f8 100644 --- a/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts @@ -312,14 +312,14 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs canonical?: string inverted?: boolean - }, + } /** * question: In what range should the value be? * For example, a door width under 65cm is suspicious, under 40cm it is a mistake. */ range?: { - min?: number, - warnBelow?: number, + min?: number + warnBelow?: number warnAbove?: number max?: number } diff --git a/src/Models/ThemeConfig/Json/UnitConfigJson.ts b/src/Models/ThemeConfig/Json/UnitConfigJson.ts index 82af97da7..d7c105991 100644 --- a/src/Models/ThemeConfig/Json/UnitConfigJson.ts +++ b/src/Models/ThemeConfig/Json/UnitConfigJson.ts @@ -85,8 +85,7 @@ export default interface UnitConfigJson { * When a default input method should be used, this can be specified by setting the canonical denomination here, e.g. * `defaultInput: "cm"`. This must be a denomination which appears in the applicableUnits */ - defaultInput?: string, - + defaultInput?: string } export interface DenominationConfigJson { diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 56ab043a4..c7bf5c52d 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -5,7 +5,10 @@ import { TagUtils } from "../../Logic/Tags/TagUtils" import { And } from "../../Logic/Tags/And" import { Utils } from "../../Utils" import { Tag } from "../../Logic/Tags/Tag" -import { MappingConfigJson, QuestionableTagRenderingConfigJson } from "./Json/QuestionableTagRenderingConfigJson" +import { + MappingConfigJson, + QuestionableTagRenderingConfigJson, +} from "./Json/QuestionableTagRenderingConfigJson" import Validators, { ValidatorType } from "../../UI/InputElement/Validators" import { TagRenderingConfigJson } from "./Json/TagRenderingConfigJson" import { RegexTag } from "../../Logic/Tags/RegexTag" @@ -40,9 +43,9 @@ export interface Mapping { } export interface ValueRange { - min?: number, - max?: number, - warnBelow?: number, + min?: number + max?: number + warnBelow?: number warnAbove?: number } /*** @@ -238,7 +241,7 @@ export default class TagRenderingConfig { default: json.freeform.default, postfixDistinguished: json.freeform.postfixDistinguished?.trim(), args: json.freeform.helperArgs, - range: json.freeform.range + range: json.freeform.range, } if (json.freeform["extraTags"] !== undefined) { throw `Freeform.extraTags is defined. This should probably be 'freeform.addExtraTag' (at ${context})` @@ -804,11 +807,20 @@ export default class TagRenderingConfig { if (validator && freeformValue) { // We try to reformat; but a unit might annoy us here if (unit) { - const [valueNoUnit, denom] = unit.findDenomination(freeformValue, () => currentProperties["_country"]) - const formatted = validator.reformat(valueNoUnit, () => currentProperties["_country"]) + const [valueNoUnit, denom] = unit.findDenomination( + freeformValue, + () => currentProperties["_country"] + ) + const formatted = validator.reformat( + valueNoUnit, + () => currentProperties["_country"] + ) freeformValue = formatted + denom.canonical } else { - freeformValue = validator.reformat(freeformValue, () => currentProperties["_country"]) + freeformValue = validator.reformat( + freeformValue, + () => currentProperties["_country"] + ) } } if (freeformValue === "") { @@ -940,7 +952,9 @@ export default class TagRenderingConfig { freeform += "\n\nThe allowed input is of type " + (this.freeform.type ?? "string") if (this.freeform.range) { const r = this.freeform.range - freeform += ` and is in range ${r.min ?? "-infinty"} until ${r.max ?? "infinity"} (both inclusive).` + freeform += ` and is in range ${r.min ?? "-infinty"} until ${ + r.max ?? "infinity" + } (both inclusive).` if (r.warnAbove && r.warnBelow) { freeform += ` A warning will appear if the value is outside of ${r.warnBelow} and ${r.warnAbove}.` } else if (r.warnBelow) { diff --git a/src/Models/ThemeViewState/WithChangesState.ts b/src/Models/ThemeViewState/WithChangesState.ts index 27640295d..c53d5e065 100644 --- a/src/Models/ThemeViewState/WithChangesState.ts +++ b/src/Models/ThemeViewState/WithChangesState.ts @@ -1,7 +1,5 @@ import { Changes } from "../../Logic/Osm/Changes" -import { - NewGeometryFromChangesFeatureSource -} from "../../Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource" +import { NewGeometryFromChangesFeatureSource } from "../../Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource" import { WithLayoutSourceState } from "./WithLayoutSourceState" import ThemeConfig from "../ThemeConfig/ThemeConfig" import { Utils } from "../../Utils" @@ -20,7 +18,9 @@ import { Map as MlMap } from "maplibre-gl" import FilteringFeatureSource from "../../Logic/FeatureSource/Sources/FilteringFeatureSource" import ShowDataLayer from "../../UI/Map/ShowDataLayer" import SelectedElementTagsUpdater from "../../Logic/Actors/SelectedElementTagsUpdater" -import NoElementsInViewDetector, { FeatureViewState } from "../../Logic/Actors/NoElementsInViewDetector" +import NoElementsInViewDetector, { + FeatureViewState, +} from "../../Logic/Actors/NoElementsInViewDetector" export class WithChangesState extends WithLayoutSourceState { readonly changes: Changes @@ -43,7 +43,7 @@ export class WithChangesState extends WithLayoutSourceState { osmConnection: this.osmConnection, featureProperties: this.featureProperties, historicalUserLocations: this.historicalUserLocations, - reportError: (err, msg) => this.reportError(err, msg) + reportError: (err, msg) => this.reportError(err, msg), }, theme?.isLeftRightSensitive() ?? false ) @@ -138,21 +138,22 @@ export class WithChangesState extends WithLayoutSourceState { userid: this.osmConnection.userDetails.data?.uid, pendingChanges: this.changes.pendingChanges.data, previousChanges: this.changes.allChanges.data, - changeRewrites: Utils.MapToObj(this.changes._changesetHandler._remappings) + changeRewrites: Utils.MapToObj(this.changes._changesetHandler._remappings), } console.trace( isTesting ? ">>> _Not_ reporting error to report server as testmode is on" : ">>> Reporting error to", Constants.ErrorReportServer, - message, err + message, + err ) if (isTesting) { return } await fetch(Constants.ErrorReportServer, { method: "POST", - body: JSON.stringify(err) + body: JSON.stringify(err), }) } catch (e) { console.error("Could not upload an error report", e) diff --git a/src/Models/ThemeViewState/WithUserRelatedState.ts b/src/Models/ThemeViewState/WithUserRelatedState.ts index 319881077..d7c5a7f5b 100644 --- a/src/Models/ThemeViewState/WithUserRelatedState.ts +++ b/src/Models/ThemeViewState/WithUserRelatedState.ts @@ -41,7 +41,11 @@ export class WithUserRelatedState { this.osmConnection = new OsmConnection({ dryRun: this.featureSwitches.featureSwitchIsTesting, fakeUser: this.featureSwitches.featureSwitchFakeUser.data, - shared_cookie: QueryParameters.GetQueryParameter("shared_oauth_cookie", undefined, "Used to share a session with another device - this saves logging in at another device").data, + shared_cookie: QueryParameters.GetQueryParameter( + "shared_oauth_cookie", + undefined, + "Used to share a session with another device - this saves logging in at another device" + ).data, oauth_token: QueryParameters.GetQueryParameter( "oauth_token", undefined, diff --git a/src/UI/AllThemesGui.svelte b/src/UI/AllThemesGui.svelte index 68b466b03..11fcdfcf4 100644 --- a/src/UI/AllThemesGui.svelte +++ b/src/UI/AllThemesGui.svelte @@ -29,7 +29,11 @@ const featureSwitches = new OsmConnectionFeatureSwitches() const osmConnection = new OsmConnection({ fakeUser: featureSwitches.featureSwitchFakeUser.data, - shared_cookie: QueryParameters.GetQueryParameter("shared_oauth_cookie", undefined, "Used to share a session with another device - this saves logging in at another device").data, + shared_cookie: QueryParameters.GetQueryParameter( + "shared_oauth_cookie", + undefined, + "Used to share a session with another device - this saves logging in at another device" + ).data, oauth_token: QueryParameters.GetQueryParameter( "oauth_token", undefined, diff --git a/src/UI/Base/Table.ts b/src/UI/Base/Table.ts index 0c37065ac..0eb4c51c4 100644 --- a/src/UI/Base/Table.ts +++ b/src/UI/Base/Table.ts @@ -95,7 +95,6 @@ export default class Table extends BaseUIElement { table.appendChild(tr) } - return table } } diff --git a/src/UI/History/AggregateImages.svelte b/src/UI/History/AggregateImages.svelte index faf9cc852..0eb1387d2 100644 --- a/src/UI/History/AggregateImages.svelte +++ b/src/UI/History/AggregateImages.svelte @@ -15,13 +15,17 @@ Promise.all(features.map((f) => downloader.downloadHistory(f.properties.id))) ) let imageKeys = new Set( - [].concat(...["panoramax", "image:streetsign", "image:menu", "toilets:wheelchair:panoramax"].map((k) => { - const result: string[] = [k] - for (let i = 0; i < 10; i++) { - result.push(k + ":" + i) - } - return result - })) + [].concat( + ...["panoramax", "image:streetsign", "image:menu", "toilets:wheelchair:panoramax"].map( + (k) => { + const result: string[] = [k] + for (let i = 0; i < 10; i++) { + result.push(k + ":" + i) + } + return result + } + ) + ) ) let usernamesSet = new Set(onlyShowUsername) let allDiffs: Store< @@ -42,7 +46,7 @@ {:else if $addedImages.length === 0} No images added by this contributor {:else} -
+
{#each $addedImages as imgDiff}
diff --git a/src/UI/History/AggregateView.svelte b/src/UI/History/AggregateView.svelte index 2f1a7b615..b969758f9 100644 --- a/src/UI/History/AggregateView.svelte +++ b/src/UI/History/AggregateView.svelte @@ -44,11 +44,13 @@ if (byKey) { return byKey } - return trs.find(tr => tr.mappings.some(mapping => { - const ifTags = Or.construct(Utils.NoNull([mapping.if, mapping.alsoShowIf])) - const keys = ifTags.usedKeys() - return keys.some(k => k == key) - })) + return trs.find((tr) => + tr.mappings.some((mapping) => { + const ifTags = Or.construct(Utils.NoNull([mapping.if, mapping.alsoShowIf])) + const keys = ifTags.usedKeys() + return keys.some((k) => k == key) + }) + ) } const mergedCount: Store< diff --git a/src/UI/Image/LinkableImage.svelte b/src/UI/Image/LinkableImage.svelte index 5b01eef24..cffa1dc02 100644 --- a/src/UI/Image/LinkableImage.svelte +++ b/src/UI/Image/LinkableImage.svelte @@ -50,10 +50,10 @@ let license: LicenseInfo = { artist: image.author, license: image.license, - informationLocation: (image.detailsUrl ?? image.pictureUrl ?? image.thumbUrl), - date + informationLocation: image.detailsUrl ?? image.pictureUrl ?? image.thumbUrl, + date, } - + let providedImage: ProvidedImage = { url: image.thumbUrl ?? image.pictureUrl, url_hd: image.pictureUrl, diff --git a/src/UI/Image/NearbyImages.svelte b/src/UI/Image/NearbyImages.svelte index 29bb15c26..484b56169 100644 --- a/src/UI/Image/NearbyImages.svelte +++ b/src/UI/Image/NearbyImages.svelte @@ -149,30 +149,32 @@ }, }) - let nearbyFeatures: Store[]> = asFeatures.map((nearbyPoints) => { - return [ - { - type: "Feature", - geometry: { type: "Point", coordinates: GeoOperations.centerpointCoordinates(feature) }, - properties: { - name: layer.title?.GetRenderValue(feature.properties).Subs(feature.properties).txt, - focus: true, - }, - }, - ...nearbyPoints - .filter((p) => p.properties["spherical"] === "yes") - .map((f) => ({ - ...f, + let nearbyFeatures: Store[]> = asFeatures.map( + (nearbyPoints) => { + return [ + { + type: "Feature", + geometry: { type: "Point", coordinates: GeoOperations.centerpointCoordinates(feature) }, properties: { - name: "Nearby panorama", - pitch: "auto", - type: "scene", - gotoPanorama: f, - focus: false + name: layer.title?.GetRenderValue(feature.properties).Subs(feature.properties).txt, + focus: true, }, - })), - ] - }) + }, + ...nearbyPoints + .filter((p) => p.properties["spherical"] === "yes") + .map((f) => ({ + ...f, + properties: { + name: "Nearby panorama", + pitch: "auto", + type: "scene", + gotoPanorama: f, + focus: false, + }, + })), + ] + } + ) onDestroy( tags.addCallbackAndRunD((tags) => { diff --git a/src/UI/Image/UploadingImageCounter.svelte b/src/UI/Image/UploadingImageCounter.svelte index 006054b41..d8d56ec12 100644 --- a/src/UI/Image/UploadingImageCounter.svelte +++ b/src/UI/Image/UploadingImageCounter.svelte @@ -35,10 +35,13 @@ // We thus have to check the remappings! const remappings = state.changes._changesetHandler._remappings const remappedFeatureId = remappings.get(featureId) ?? featureId - return ids.filter((itemId) => itemId === featureId || - itemId === remappedFeatureId || - (remappings.get(itemId) ?? itemId === featureId) || - (remappings.get(itemId) ?? itemId === remappedFeatureId)).length + return ids.filter( + (itemId) => + itemId === featureId || + itemId === remappedFeatureId || + (remappings.get(itemId) ?? itemId === featureId) || + (remappings.get(itemId) ?? itemId === remappedFeatureId) + ).length }) } diff --git a/src/UI/Image/photoSphereViewerWrapper.ts b/src/UI/Image/photoSphereViewerWrapper.ts index d8068e933..bdbfb6f64 100644 --- a/src/UI/Image/photoSphereViewerWrapper.ts +++ b/src/UI/Image/photoSphereViewerWrapper.ts @@ -112,7 +112,12 @@ export class PhotoSphereViewerWrapper { } else if (!isNaN(f.properties.pitch)) { pitch = f.properties.pitch } - const distance = Math.round(GeoOperations.distanceBetween(centralImageLocation, GeoOperations.centerpointCoordinates(f))) + const distance = Math.round( + GeoOperations.distanceBetween( + centralImageLocation, + GeoOperations.centerpointCoordinates(f) + ) + ) this.viewer.addHotSpot( { type: f.properties.gotoPanorama !== undefined ? "scene" : "info", diff --git a/src/UI/InspectorGUI.svelte b/src/UI/InspectorGUI.svelte index c586a9499..8bd5c9f82 100644 --- a/src/UI/InspectorGUI.svelte +++ b/src/UI/InspectorGUI.svelte @@ -180,7 +180,7 @@
-
+

diff --git a/src/UI/Map/ProtomapsLanguageSupport.ts b/src/UI/Map/ProtomapsLanguageSupport.ts index 3f5a75b7a..cee1e13d6 100644 --- a/src/UI/Map/ProtomapsLanguageSupport.ts +++ b/src/UI/Map/ProtomapsLanguageSupport.ts @@ -3,7 +3,7 @@ import { DataDrivenPropertyValueSpecification, LayerSpecification, Map as MlMap, - SymbolLayerSpecification + SymbolLayerSpecification, } from "maplibre-gl" import Locale from "../i18n/Locale" import { Utils } from "../../Utils" diff --git a/src/UI/OpeningHours/OpeningHours.ts b/src/UI/OpeningHours/OpeningHours.ts index 2c562dba8..9f6fec739 100644 --- a/src/UI/OpeningHours/OpeningHours.ts +++ b/src/UI/OpeningHours/OpeningHours.ts @@ -968,7 +968,6 @@ changes // => [[36000,61200], ["10:00", "17:00"]] return oh } - /** * * @param changeHours number of seconds 'till the start of the day, assuming sorted @@ -978,12 +977,16 @@ changes // => [[36000,61200], ["10:00", "17:00"]] * OH.partitionOHForDistance([0, 15, 5415], ["start", "15s", "1h15s"]) // => [{changeHours: [0, 5415], changeTexts: ["start", "1h15s"]}, {changeHours: [15], changeTexts: ["15s"]}] * */ - public static partitionOHForDistance(changeHours: number[], changeHourText: string[], maxDiff = 5400): { + public static partitionOHForDistance( changeHours: number[], + changeHourText: string[], + maxDiff = 5400 + ): { + changeHours: number[] changeTexts: string[] }[] { - const partitionedHours: { changeHours: number[], changeTexts: string[] }[] = [ - { changeHours: [changeHours[0]], changeTexts: [changeHourText[0]] } + const partitionedHours: { changeHours: number[]; changeTexts: string[] }[] = [ + { changeHours: [changeHours[0]], changeTexts: [changeHourText[0]] }, ] for (let i = 1 /*skip the first one, inited ^*/; i < changeHours.length; i++) { const moment = changeHours[i] @@ -1004,13 +1007,11 @@ changes // => [[36000,61200], ["10:00", "17:00"]] // No candidate found - make a new list partitionedHours.push({ changeTexts: [text], - changeHours: [moment] + changeHours: [moment], }) } - } - return partitionedHours } } diff --git a/src/UI/OpeningHours/Visualisation/OpeningHours.svelte b/src/UI/OpeningHours/Visualisation/OpeningHours.svelte index 712fb7767..9596d231f 100644 --- a/src/UI/OpeningHours/Visualisation/OpeningHours.svelte +++ b/src/UI/OpeningHours/Visualisation/OpeningHours.svelte @@ -16,12 +16,16 @@ let applicableWeek = OH.createRangesForApplicableWeek(opening_hours_obj) let oh = opening_hours_obj - let textual: Translation = ToTextualDescription.createTextualDescriptionFor(oh, applicableWeek.ranges) - let applicableWeekRanges: { ranges: OpeningRange[][]; startingMonday: Date } = OH.createRangesForApplicableWeek(oh) + let textual: Translation = ToTextualDescription.createTextualDescriptionFor( + oh, + applicableWeek.ranges + ) + let applicableWeekRanges: { ranges: OpeningRange[][]; startingMonday: Date } = + OH.createRangesForApplicableWeek(oh) let ranges = applicableWeekRanges.ranges let lastMonday = applicableWeekRanges.startingMonday - +
{#if ranges.some((range) => range.length > 0)} diff --git a/src/UI/OpeningHours/Visualisation/OpeningHoursHeader.svelte b/src/UI/OpeningHours/Visualisation/OpeningHoursHeader.svelte index d56502c47..aedbdb01b 100644 --- a/src/UI/OpeningHours/Visualisation/OpeningHoursHeader.svelte +++ b/src/UI/OpeningHours/Visualisation/OpeningHoursHeader.svelte @@ -18,18 +18,20 @@ function calcOffset(changeMoment: number) { return (100 * (changeMoment - earliestOpen)) / availableArea } - -
+
{#each changeHours as changeMoment, i} {#if calcOffset(changeMoment) >= 0 && calcOffset(changeMoment) <= 100} -
+
+ class="font-sm relative h-3 h-fit rounded-xl border-2 border-black bg-white pl-1 pr-1" + > {changeHourText[i]}
diff --git a/src/UI/OpeningHours/Visualisation/OpeningHoursRangeElement.svelte b/src/UI/OpeningHours/Visualisation/OpeningHoursRangeElement.svelte index 3f1db4584..a257719b1 100644 --- a/src/UI/OpeningHours/Visualisation/OpeningHoursRangeElement.svelte +++ b/src/UI/OpeningHours/Visualisation/OpeningHoursRangeElement.svelte @@ -21,7 +21,6 @@ // prettier-ignore let width = (100 * (range.endDate.getTime() - range.startDate.getTime()) / 1000) / availableArea let startPercentage = (100 * startpoint) / availableArea - {#if !range.isOpen && !range.isSpecial} diff --git a/src/UI/OpeningHours/Visualisation/OpeningHoursWithError.svelte b/src/UI/OpeningHours/Visualisation/OpeningHoursWithError.svelte index e9f993470..18e7a2110 100644 --- a/src/UI/OpeningHours/Visualisation/OpeningHoursWithError.svelte +++ b/src/UI/OpeningHours/Visualisation/OpeningHoursWithError.svelte @@ -1,20 +1,19 @@ - - {#if $tags._country === undefined} diff --git a/src/UI/OpeningHours/Visualisation/RegularOpeningHoursTable.svelte b/src/UI/OpeningHours/Visualisation/RegularOpeningHoursTable.svelte index 9f6c287a3..77351216a 100644 --- a/src/UI/OpeningHours/Visualisation/RegularOpeningHoursTable.svelte +++ b/src/UI/OpeningHours/Visualisation/RegularOpeningHoursTable.svelte @@ -1,81 +1,87 @@ - -
+ +
{#each allChangeMoments as moment} -
-
+
+
- -
+
@@ -84,11 +90,15 @@ let weekdays: Translation[] = [ {#each weekdayHeaders as weekdayHeader} - + {/each} @@ -98,7 +108,7 @@ let weekdays: Translation[] = [ - - {/each} {#each weekendDayHeaders as weekdayHeader} - + {/each} diff --git a/src/UI/OpeningHours/Visualisation/SpecialCase.svelte b/src/UI/OpeningHours/Visualisation/SpecialCase.svelte index ad74b91a2..bd491ec95 100644 --- a/src/UI/OpeningHours/Visualisation/SpecialCase.svelte +++ b/src/UI/OpeningHours/Visualisation/SpecialCase.svelte @@ -1,7 +1,7 @@ {#if nextChange !== undefined} - + {:else if typeof comment === "string"}
{comment}
{:else if oh.getState()} diff --git a/src/UI/Popup/AutoApplyButton.svelte b/src/UI/Popup/AutoApplyButton.svelte index b732183c5..793c16c48 100644 --- a/src/UI/Popup/AutoApplyButton.svelte +++ b/src/UI/Popup/AutoApplyButton.svelte @@ -20,16 +20,13 @@ export let ids: Store export let state: SpecialVisualizationState export let options: { - target_layer_id: string, - targetTagRendering: string, - text: string, - icon: string, + target_layer_id: string + targetTagRendering: string + text: string + icon: string } - let buttonState: UIEventSource< - "idle" | "running" | "done" | { error: string } - > = new UIEventSource< - "idle" | "running" | "done" | { error: string } - >("idle") + let buttonState: UIEventSource<"idle" | "running" | "done" | { error: string }> = + new UIEventSource<"idle" | "running" | "done" | { error: string }>("idle") let tagRenderingConfig: TagRenderingConfig let appliedNumberOfFeatures = new UIEventSource(0) @@ -40,23 +37,22 @@ const mlmap = new UIEventSource(undefined) const mla = new MapLibreAdaptor(mlmap, { - rasterLayer: state.mapProperties.rasterLayer + rasterLayer: state.mapProperties.rasterLayer, }) mla.allowZooming.setData(false) mla.allowMoving.setData(false) - const features = ids.mapD(ids => ids.map((id) => - state.indexedFeatures.featuresById.data.get(id) - )) - + const features = ids.mapD((ids) => + ids.map((id) => state.indexedFeatures.featuresById.data.get(id)) + ) new ShowDataLayer(mlmap, { features: StaticFeatureSource.fromGeojson(features), zoomToFeatures: true, - layer: layer.layerDef + layer: layer.layerDef, }) - features.addCallbackAndRunD(f => console.log("Features are now", f)) + features.addCallbackAndRunD((f) => console.log("Features are now", f)) async function applyAllChanges() { buttonState.set("running") @@ -77,8 +73,8 @@ if (specialRenderings.length == 0) { console.warn( "AutoApply: feature " + - targetFeatureId + - " got a rendering without supported auto actions:", + targetFeatureId + + " got a rendering without supported auto actions:", rendering ) } @@ -88,12 +84,7 @@ continue } const action = specialRendering.func - await action.applyActionOn( - feature, - state, - featureTags, - specialRendering.args - ) + await action.applyActionOn(feature, state, featureTags, specialRendering.args) } appliedOn.push(targetFeatureId) if (i % 50 === 0) { @@ -117,13 +108,13 @@ } const t = Translations.t.general.add.import - {#if !state.theme.official && !state.featureSwitchIsTesting.data} -
The auto-apply button is only available in official themes (or in testing mode)
+
+ The auto-apply button is only available in official themes (or in testing mode) +
- {:else if ids === undefined} Gathering which elements support auto-apply... {:else if tagRenderingConfig === undefined} @@ -132,7 +123,6 @@
No elements found to perform action
{:else if $buttonState.error !== undefined}
-
Something went wrong
{$buttonState.error}
@@ -144,7 +134,11 @@ {:else if $buttonState === "idle"}
- @@ -156,7 +150,6 @@
diff --git a/src/UI/SpecialVisualisations/SettingsVisualisations.ts b/src/UI/SpecialVisualisations/SettingsVisualisations.ts index 26f3fea79..17f8256c9 100644 --- a/src/UI/SpecialVisualisations/SettingsVisualisations.ts +++ b/src/UI/SpecialVisualisations/SettingsVisualisations.ts @@ -151,26 +151,36 @@ export class SettingsVisualisations { }, { funcName: "qr_login", - args: [{ - name: "text", - doc: "Extra text on the side of the QR-code" - }, { - name: "textClass", - doc: "CSS class of the the side text" - }], + args: [ + { + name: "text", + doc: "Extra text on the side of the QR-code", + }, + { + name: "textClass", + doc: "CSS class of the the side text", + }, + ], docs: "A QR-code which shares the current URL and adds the login token. Anyone with this login token will have the same permissions as you currently have. Logging out from this session will also log them out", group: "settings", - constr(state: SpecialVisualizationState, tags: UIEventSource>, argument: string[], feature: Feature, layer: LayerConfig): SvelteUIElement { + constr( + state: SpecialVisualizationState, + tags: UIEventSource>, + argument: string[], + feature: Feature, + layer: LayerConfig + ): SvelteUIElement { const shared_oauth_cookie = state.osmConnection.getToken() const sideText = argument[0] const sideTextClass = argument[1] ?? "" return new SvelteUIElement(QrCode, { state, tags, - sideText, sideTextClass, - extraUrlParams: { shared_oauth_cookie } + sideText, + sideTextClass, + extraUrlParams: { shared_oauth_cookie }, }) - } + }, }, { diff --git a/src/UI/SpecialVisualisations/UISpecialVisualisations.ts b/src/UI/SpecialVisualisations/UISpecialVisualisations.ts index 4dc248b09..c488dc36c 100644 --- a/src/UI/SpecialVisualisations/UISpecialVisualisations.ts +++ b/src/UI/SpecialVisualisations/UISpecialVisualisations.ts @@ -174,13 +174,16 @@ export class UISpecialVisualisations { }, { funcName: "qr_code", - args: [{ - name: "text", - doc: "Extra text on the side of the QR-code" - }, { - name: "textClass", - doc: "CSS class of the the side text" - }], + args: [ + { + name: "text", + doc: "Extra text on the side of the QR-code", + }, + { + name: "textClass", + doc: "CSS class of the the side text", + }, + ], group: "default", docs: "Generates a QR-code to share the selected object", constr( @@ -191,7 +194,13 @@ export class UISpecialVisualisations { ): SvelteUIElement { const sideText = argument[0] const sideTextClass = argument[1] ?? "" - return new SvelteUIElement(QrCode, { state, tags, feature, sideText, sideTextClass }) + return new SvelteUIElement(QrCode, { + state, + tags, + feature, + sideText, + sideTextClass, + }) }, }, { diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index 4aac5e84d..8be9c0368 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -1,7 +1,11 @@ import { FixedUiElement } from "./Base/FixedUiElement" import BaseUIElement from "./BaseUIElement" import { default as FeatureTitle } from "./Popup/Title.svelte" -import { RenderingSpecification, SpecialVisualization, SpecialVisualizationState } from "./SpecialVisualization" +import { + RenderingSpecification, + SpecialVisualization, + SpecialVisualizationState, +} from "./SpecialVisualization" import { HistogramViz } from "./Popup/HistogramViz" import { UploadToOsmViz } from "./Popup/UploadToOsmViz" import { MultiApplyViz } from "./Popup/MultiApplyViz" @@ -35,11 +39,8 @@ import { UISpecialVisualisations } from "./SpecialVisualisations/UISpecialVisual import { SettingsVisualisations } from "./SpecialVisualisations/SettingsVisualisations" import { ReviewSpecialVisualisations } from "./SpecialVisualisations/ReviewSpecialVisualisations" import { DataImportSpecialVisualisations } from "./SpecialVisualisations/DataImportSpecialVisualisations" -import TagrenderingManipulationSpecialVisualisations - from "./SpecialVisualisations/TagrenderingManipulationSpecialVisualisations" -import { - WebAndCommunicationSpecialVisualisations -} from "./SpecialVisualisations/WebAndCommunicationSpecialVisualisations" +import TagrenderingManipulationSpecialVisualisations from "./SpecialVisualisations/TagrenderingManipulationSpecialVisualisations" +import { WebAndCommunicationSpecialVisualisations } from "./SpecialVisualisations/WebAndCommunicationSpecialVisualisations" import ClearGPSHistory from "./BigComponents/ClearGPSHistory.svelte" import AllFeaturesStatistics from "./Statistics/AllFeaturesStatistics.svelte" import OpeningHoursWithError from "./OpeningHours/Visualisation/OpeningHoursWithError.svelte" @@ -146,7 +147,9 @@ export default class SpecialVisualizations { throw ( "\n\n >>>> ERROR <<<< Unknown visualisation group type: " + viz.group + - " (used by " + viz.funcName + ")\n\n\n" + " (used by " + + viz.funcName + + ")\n\n\n" ) } helpTexts.push(groupExplanations[viz.group]) @@ -278,11 +281,12 @@ export default class SpecialVisualizations { "A normal opening hours table can be invoked with `{opening_hours_table()}`. A table for e.g. conditional access with opening hours can be `{opening_hours_table(access:conditional, no @ &LPARENS, &RPARENS)}`", constr: (state, tagSource: UIEventSource, args) => { const [key, prefix, postfix] = args - const openingHoursStore: Store = OH.CreateOhObjectStore(tagSource, key, prefix, postfix) + const openingHoursStore: Store = + OH.CreateOhObjectStore(tagSource, key, prefix, postfix) return new SvelteUIElement(OpeningHoursWithError, { tags: tagSource, key, - opening_hours_obj: openingHoursStore + opening_hours_obj: openingHoursStore, }) }, }, diff --git a/src/UI/Studio/EditLayerState.ts b/src/UI/Studio/EditLayerState.ts index 7c086960a..1b2a131c1 100644 --- a/src/UI/Studio/EditLayerState.ts +++ b/src/UI/Studio/EditLayerState.ts @@ -1,7 +1,12 @@ import { ConfigMeta } from "./configMeta" import { Store, UIEventSource } from "../../Logic/UIEventSource" import { LayerConfigJson } from "../../Models/ThemeConfig/Json/LayerConfigJson" -import { Conversion, ConversionMessage, DesugaringContext, Pipe } from "../../Models/ThemeConfig/Conversion/Conversion" +import { + Conversion, + ConversionMessage, + DesugaringContext, + Pipe, +} from "../../Models/ThemeConfig/Conversion/Conversion" import { PrepareLayer } from "../../Models/ThemeConfig/Conversion/PrepareLayer" import { PrevalidateTheme, ValidateLayer } from "../../Models/ThemeConfig/Conversion/Validation" import { AllSharedLayers } from "../../Customizations/AllSharedLayers" @@ -276,7 +281,11 @@ class ContextRewritingStep extends Conversion { step: Conversion, getTagRenderings: (t: T) => TagRenderingConfigJson[] ) { - super("ContextRewritingStep", "When validating a layer, the tagRenderings are first expanded. Some builtin tagRendering-calls (e.g. `contact`) will introduce _multiple_ tagRenderings, causing the count to be off. This class rewrites the error messages to fix this", []) + super( + "ContextRewritingStep", + "When validating a layer, the tagRenderings are first expanded. Some builtin tagRendering-calls (e.g. `contact`) will introduce _multiple_ tagRenderings, causing the count to be off. This class rewrites the error messages to fix this", + [] + ) this._state = state this._step = step this._getTagRenderings = getTagRenderings diff --git a/src/UI/Test.svelte b/src/UI/Test.svelte index 36ea1fc43..f0116c38c 100644 --- a/src/UI/Test.svelte +++ b/src/UI/Test.svelte @@ -1,6 +1,4 @@ - accept(fileList.detail)} accept="image/jpg">Select file + accept(fileList.detail)} accept="image/jpg"> + Select file + {$txt} diff --git a/src/Utils.ts b/src/Utils.ts index 775fa14a7..d65a7e6fd 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -178,7 +178,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be public static NoNull(array: undefined): undefined public static NoNull(array: ReadonlyArray): T[] public static NoNull(array: ReadonlyArray): NonNullable[] { - return []>array?.filter((o) => o !== undefined && o !== null) + return []>(array?.filter((o) => o !== undefined && o !== null)) } public static Hist(array: ReadonlyArray): Map { @@ -332,7 +332,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be * @param toKey * @constructor */ - public static DedupOnId(arr: T[], toKey?: (t: T) => string | string[]): T[] { + public static DedupOnId( + arr: T[], + toKey?: (t: T) => string | string[] + ): T[] { const uniq: T[] = [] const seen = new Set() if (toKey === undefined) { @@ -350,7 +353,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be } } else { const ksNoNull = Utils.NoNull(ks) - const hasBeenSeen = ksNoNull.some(k => seen.has(k)) + const hasBeenSeen = ksNoNull.some((k) => seen.has(k)) if (!hasBeenSeen) { uniq.push(img) } diff --git a/src/assets/contributors.json b/src/assets/contributors.json index e30f6f34f..b7633bd14 100644 --- a/src/assets/contributors.json +++ b/src/assets/contributors.json @@ -1,7 +1,7 @@ { "contributors": [ { - "commits": 9721, + "commits": 9825, "contributor": "Pieter Vander Vennet" }, { diff --git a/src/assets/language_in_country.json b/src/assets/language_in_country.json index 0cf78b0b1..40a158fe2 100644 --- a/src/assets/language_in_country.json +++ b/src/assets/language_in_country.json @@ -505,10 +505,6 @@ "ar", "ar" ], - "PT": [ - "pt", - "pt" - ], "PW": [ "en", "ja" diff --git a/src/assets/language_translations.json b/src/assets/language_translations.json index 932a148c8..837629c60 100644 --- a/src/assets/language_translations.json +++ b/src/assets/language_translations.json @@ -9862,7 +9862,6 @@ "GQ", "GW", "MZ", - "PT", "ST", "TL" ], diff --git a/src/assets/schemas/layerconfigmeta.json b/src/assets/schemas/layerconfigmeta.json index 5986dc768..78b1764cb 100644 --- a/src/assets/schemas/layerconfigmeta.json +++ b/src/assets/schemas/layerconfigmeta.json @@ -10989,6 +10989,10 @@ "if": "value=gps_track", "then": "gps_track - Meta layer showing the previous locations of the user as single line with controls, e.g. to erase, upload or download this track. Add this to your theme and override the maprendering to change the appearance of the travelled track." }, + { + "if": "value=grab_rail", + "then": "grab_rail - A grab rail is a support to help persons with reduced mobility or a motor disability. It helps them to transfer from their wheelchair onto the toilet, to stand in a shower, close a door, ... " + }, { "if": "value=grave", "then": "grave - Tombstones (and graves) indicate where a person was buried. On this map, those can be recorded and a link to Wikipedia can be made" @@ -11087,11 +11091,11 @@ }, { "if": "value=nsi_brand", - "then": "nsi_brand - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_brand - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=nsi_operator", - "then": "nsi_operator - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_operator - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=observation_tower", @@ -11341,6 +11345,10 @@ "if": "value=wayside_shrine", "then": "wayside_shrine - Shrines are religious places that are dedicated to specific deities, saints and other figures of religious importance. Typically, the contain religious depictions and people frequently leave offerings at those places. Wayside shrines are small shrines that can be found next to a road or pathway and are frequented by travellers passing by. Wayside crosses can be seen as a sub-type of a wayside shrine, typically in the form of a Christian cross at the side of the road, typically without votive offerings." }, + { + "if": "value=windpump", + "then": "windpump - undefined" + }, { "if": "value=windturbine", "then": "windturbine - Modern windmills generating electricity" @@ -11457,6 +11465,14 @@ "if": "value=artwork", "then": "artwork - An open map of statues, busts, graffitis and other artwork all over the world" }, + { + "if": "value=historic_rolling_stock", + "then": "historic_rolling_stock - Historic rolling stock (such as locomotives, railway cars and wagons) which are permanently placed at a location" + }, + { + "if": "value=historic_aircraft", + "then": "historic_aircraft - undefined" + }, { "if": "value=drinking_water", "then": "drinking_water - A layer showing drinking water fountains" diff --git a/src/assets/schemas/layoutconfigmeta.json b/src/assets/schemas/layoutconfigmeta.json index 93ce40a09..6d5ca7c46 100644 --- a/src/assets/schemas/layoutconfigmeta.json +++ b/src/assets/schemas/layoutconfigmeta.json @@ -868,6 +868,10 @@ "if": "value=gps_track", "then": "gps_track (builtin) - Meta layer showing the previous locations of the user as single line with controls, e.g. to erase, upload or download this track. Add this to your theme and override the maprendering to change the appearance of the travelled track." }, + { + "if": "value=grab_rail", + "then": "grab_rail (builtin) - A grab rail is a support to help persons with reduced mobility or a motor disability. It helps them to transfer from their wheelchair onto the toilet, to stand in a shower, close a door, ... " + }, { "if": "value=grave", "then": "grave (builtin) - Tombstones (and graves) indicate where a person was buried. On this map, those can be recorded and a link to Wikipedia can be made" @@ -966,11 +970,11 @@ }, { "if": "value=nsi_brand", - "then": "nsi_brand (builtin) - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_brand (builtin) - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=nsi_operator", - "then": "nsi_operator (builtin) - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_operator (builtin) - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=observation_tower", @@ -1220,6 +1224,10 @@ "if": "value=wayside_shrine", "then": "wayside_shrine (builtin) - Shrines are religious places that are dedicated to specific deities, saints and other figures of religious importance. Typically, the contain religious depictions and people frequently leave offerings at those places. Wayside shrines are small shrines that can be found next to a road or pathway and are frequented by travellers passing by. Wayside crosses can be seen as a sub-type of a wayside shrine, typically in the form of a Christian cross at the side of the road, typically without votive offerings." }, + { + "if": "value=windpump", + "then": "windpump (builtin) - undefined" + }, { "if": "value=windturbine", "then": "windturbine (builtin) - Modern windmills generating electricity" @@ -1336,6 +1344,14 @@ "if": "value=artwork", "then": "artwork (builtin) - An open map of statues, busts, graffitis and other artwork all over the world" }, + { + "if": "value=historic_rolling_stock", + "then": "historic_rolling_stock (builtin) - Historic rolling stock (such as locomotives, railway cars and wagons) which are permanently placed at a location" + }, + { + "if": "value=historic_aircraft", + "then": "historic_aircraft (builtin) - undefined" + }, { "if": "value=drinking_water", "then": "drinking_water (builtin) - A layer showing drinking water fountains" @@ -13641,6 +13657,10 @@ "if": "value=gps_track", "then": "gps_track - Meta layer showing the previous locations of the user as single line with controls, e.g. to erase, upload or download this track. Add this to your theme and override the maprendering to change the appearance of the travelled track." }, + { + "if": "value=grab_rail", + "then": "grab_rail - A grab rail is a support to help persons with reduced mobility or a motor disability. It helps them to transfer from their wheelchair onto the toilet, to stand in a shower, close a door, ... " + }, { "if": "value=grave", "then": "grave - Tombstones (and graves) indicate where a person was buried. On this map, those can be recorded and a link to Wikipedia can be made" @@ -13739,11 +13759,11 @@ }, { "if": "value=nsi_brand", - "then": "nsi_brand - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_brand - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=nsi_operator", - "then": "nsi_operator - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_operator - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=observation_tower", @@ -13993,6 +14013,10 @@ "if": "value=wayside_shrine", "then": "wayside_shrine - Shrines are religious places that are dedicated to specific deities, saints and other figures of religious importance. Typically, the contain religious depictions and people frequently leave offerings at those places. Wayside shrines are small shrines that can be found next to a road or pathway and are frequented by travellers passing by. Wayside crosses can be seen as a sub-type of a wayside shrine, typically in the form of a Christian cross at the side of the road, typically without votive offerings." }, + { + "if": "value=windpump", + "then": "windpump - undefined" + }, { "if": "value=windturbine", "then": "windturbine - Modern windmills generating electricity" @@ -14109,6 +14133,14 @@ "if": "value=artwork", "then": "artwork - An open map of statues, busts, graffitis and other artwork all over the world" }, + { + "if": "value=historic_rolling_stock", + "then": "historic_rolling_stock - Historic rolling stock (such as locomotives, railway cars and wagons) which are permanently placed at a location" + }, + { + "if": "value=historic_aircraft", + "then": "historic_aircraft - undefined" + }, { "if": "value=drinking_water", "then": "drinking_water - A layer showing drinking water fountains" @@ -35450,6 +35482,10 @@ "if": "value=gps_track", "then": "gps_track - Meta layer showing the previous locations of the user as single line with controls, e.g. to erase, upload or download this track. Add this to your theme and override the maprendering to change the appearance of the travelled track." }, + { + "if": "value=grab_rail", + "then": "grab_rail - A grab rail is a support to help persons with reduced mobility or a motor disability. It helps them to transfer from their wheelchair onto the toilet, to stand in a shower, close a door, ... " + }, { "if": "value=grave", "then": "grave - Tombstones (and graves) indicate where a person was buried. On this map, those can be recorded and a link to Wikipedia can be made" @@ -35548,11 +35584,11 @@ }, { "if": "value=nsi_brand", - "then": "nsi_brand - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_brand - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=nsi_operator", - "then": "nsi_operator - Exposes part of the NSI to reuse in other themes, e.g. for rendering" + "then": "nsi_operator - Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme. Generated with scripts/nsiLogos.ts" }, { "if": "value=observation_tower", @@ -35802,6 +35838,10 @@ "if": "value=wayside_shrine", "then": "wayside_shrine - Shrines are religious places that are dedicated to specific deities, saints and other figures of religious importance. Typically, the contain religious depictions and people frequently leave offerings at those places. Wayside shrines are small shrines that can be found next to a road or pathway and are frequented by travellers passing by. Wayside crosses can be seen as a sub-type of a wayside shrine, typically in the form of a Christian cross at the side of the road, typically without votive offerings." }, + { + "if": "value=windpump", + "then": "windpump - undefined" + }, { "if": "value=windturbine", "then": "windturbine - Modern windmills generating electricity" @@ -35918,6 +35958,14 @@ "if": "value=artwork", "then": "artwork - An open map of statues, busts, graffitis and other artwork all over the world" }, + { + "if": "value=historic_rolling_stock", + "then": "historic_rolling_stock - Historic rolling stock (such as locomotives, railway cars and wagons) which are permanently placed at a location" + }, + { + "if": "value=historic_aircraft", + "then": "historic_aircraft - undefined" + }, { "if": "value=drinking_water", "then": "drinking_water - A layer showing drinking water fountains" diff --git a/src/assets/translators.json b/src/assets/translators.json index 50d368008..95efc0cb0 100644 --- a/src/assets/translators.json +++ b/src/assets/translators.json @@ -144,6 +144,10 @@ "commits": 13, "contributor": "Joost" }, + { + "commits": 12, + "contributor": "Weblate Admin" + }, { "commits": 12, "contributor": "hugoalh" @@ -152,10 +156,6 @@ "commits": 12, "contributor": "Piotr Strebski" }, - { - "commits": 11, - "contributor": "Weblate Admin" - }, { "commits": 11, "contributor": "Manuel Tassi" diff --git a/test/Models/ThemeConfig/Conversion/PrepareLayer.spec.ts b/test/Models/ThemeConfig/Conversion/PrepareLayer.spec.ts index d3e564b55..7ea1d8151 100644 --- a/test/Models/ThemeConfig/Conversion/PrepareLayer.spec.ts +++ b/test/Models/ThemeConfig/Conversion/PrepareLayer.spec.ts @@ -1,9 +1,10 @@ import { LayerConfigJson } from "../../../../src/Models/ThemeConfig/Json/LayerConfigJson" import LineRenderingConfigJson from "../../../../src/Models/ThemeConfig/Json/LineRenderingConfigJson" -import { PrepareLayer, RewriteSpecial } from "../../../../src/Models/ThemeConfig/Conversion/PrepareLayer" import { - QuestionableTagRenderingConfigJson -} from "../../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson" + PrepareLayer, + RewriteSpecial, +} from "../../../../src/Models/ThemeConfig/Conversion/PrepareLayer" +import { QuestionableTagRenderingConfigJson } from "../../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson" import RewritableConfigJson from "../../../../src/Models/ThemeConfig/Json/RewritableConfigJson" import { describe, expect, it } from "vitest" @@ -103,7 +104,7 @@ describe("PrepareLayer", () => { }, ], titleIcons: [{ render: "icons.defaults", id: "iconsdefaults" }], - units: [] + units: [], } expect(result).toEqual(expected) diff --git a/test/Models/ThemeConfig/Conversion/PrepareTheme.spec.ts b/test/Models/ThemeConfig/Conversion/PrepareTheme.spec.ts index 212b6b813..1fdc42fde 100644 --- a/test/Models/ThemeConfig/Conversion/PrepareTheme.spec.ts +++ b/test/Models/ThemeConfig/Conversion/PrepareTheme.spec.ts @@ -10,9 +10,7 @@ import { Tag } from "../../../../src/Logic/Tags/Tag" import { DesugaringContext } from "../../../../src/Models/ThemeConfig/Conversion/Conversion" import { And } from "../../../../src/Logic/Tags/And" import { describe, expect, it } from "vitest" -import { - QuestionableTagRenderingConfigJson -} from "../../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson" +import { QuestionableTagRenderingConfigJson } from "../../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson" import Constants from "../../../../src/Models/Constants" import { ConversionContext } from "../../../../src/Models/ThemeConfig/Conversion/ConversionContext" import { MinimalTagRenderingConfigJson } from "../../../../src/Models/ThemeConfig/Json/TagRenderingConfigJson" @@ -155,7 +153,7 @@ describe("PrepareTheme", () => { }, ], lineRendering: [{ width: 1 }], - units: [] + units: [], } const sharedLayers = constructSharedLayers() sharedLayers.set("layer-example", testLayer) @@ -213,7 +211,7 @@ describe("PrepareTheme", () => { ], lineRendering: [{ width: 1 }], titleIcons: [], - units: [] + units: [], }) }) })
- +
+
{#each ranges[i] as range}
- +