diff --git a/Docs/Layers/charging_station.md b/Docs/Layers/charging_station.md index 50c87bfed..5baa30aa2 100644 --- a/Docs/Layers/charging_station.md +++ b/Docs/Layers/charging_station.md @@ -283,7 +283,7 @@ attribute | type | values which are supported by this layer [](https://taginfo.openstreetmap.org/keys/fee#values) [fee](https://wiki.openstreetmap.org/wiki/Key:fee) | Multiple choice | [no](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dno) [no](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dno) [yes](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dyes) [yes](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dyes) [](https://taginfo.openstreetmap.org/keys/charge#values) [charge](https://wiki.openstreetmap.org/wiki/Key:charge) | [string](../SpecialInputElements.md#string) | [](https://taginfo.openstreetmap.org/keys/authentication:phone_call:number#values) [authentication:phone_call:number](https://wiki.openstreetmap.org/wiki/Key:authentication:phone_call:number) | [phone](../SpecialInputElements.md#phone) | -[](https://taginfo.openstreetmap.org/keys/maxstay#values) [maxstay](https://wiki.openstreetmap.org/wiki/Key:maxstay) | [string](../SpecialInputElements.md#string) | [unlimited](https://wiki.openstreetmap.org/wiki/Tag:maxstay%3Dunlimited) +[](https://taginfo.openstreetmap.org/keys/maxstay#values) [maxstay](https://wiki.openstreetmap.org/wiki/Key:maxstay) | [pfloat](../SpecialInputElements.md#pfloat) | [unlimited](https://wiki.openstreetmap.org/wiki/Tag:maxstay%3Dunlimited) [](https://taginfo.openstreetmap.org/keys/network#values) [network](https://wiki.openstreetmap.org/wiki/Key:network) | [string](../SpecialInputElements.md#string) | [AeroVironment](https://wiki.openstreetmap.org/wiki/Tag:network%3DAeroVironment) [Blink](https://wiki.openstreetmap.org/wiki/Tag:network%3DBlink) [EVgo](https://wiki.openstreetmap.org/wiki/Tag:network%3DEVgo) [Allego](https://wiki.openstreetmap.org/wiki/Tag:network%3DAllego) [Blue Corner](https://wiki.openstreetmap.org/wiki/Tag:network%3DBlue Corner) [Tesla](https://wiki.openstreetmap.org/wiki/Tag:network%3DTesla) [](https://taginfo.openstreetmap.org/keys/operator#values) [operator](https://wiki.openstreetmap.org/wiki/Key:operator) | [string](../SpecialInputElements.md#string) | [](https://taginfo.openstreetmap.org/keys/phone#values) [phone](https://wiki.openstreetmap.org/wiki/Key:phone) | [phone](../SpecialInputElements.md#phone) | diff --git a/Docs/Layers/charging_station_ebikes.md b/Docs/Layers/charging_station_ebikes.md index 1e917e74e..114656821 100644 --- a/Docs/Layers/charging_station_ebikes.md +++ b/Docs/Layers/charging_station_ebikes.md @@ -277,7 +277,7 @@ attribute | type | values which are supported by this layer [](https://taginfo.openstreetmap.org/keys/fee#values) [fee](https://wiki.openstreetmap.org/wiki/Key:fee) | Multiple choice | [no](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dno) [no](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dno) [yes](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dyes) [yes](https://wiki.openstreetmap.org/wiki/Tag:fee%3Dyes) [](https://taginfo.openstreetmap.org/keys/charge#values) [charge](https://wiki.openstreetmap.org/wiki/Key:charge) | [string](../SpecialInputElements.md#string) | [](https://taginfo.openstreetmap.org/keys/authentication:phone_call:number#values) [authentication:phone_call:number](https://wiki.openstreetmap.org/wiki/Key:authentication:phone_call:number) | [phone](../SpecialInputElements.md#phone) | -[](https://taginfo.openstreetmap.org/keys/maxstay#values) [maxstay](https://wiki.openstreetmap.org/wiki/Key:maxstay) | [string](../SpecialInputElements.md#string) | [unlimited](https://wiki.openstreetmap.org/wiki/Tag:maxstay%3Dunlimited) +[](https://taginfo.openstreetmap.org/keys/maxstay#values) [maxstay](https://wiki.openstreetmap.org/wiki/Key:maxstay) | [pfloat](../SpecialInputElements.md#pfloat) | [unlimited](https://wiki.openstreetmap.org/wiki/Tag:maxstay%3Dunlimited) [](https://taginfo.openstreetmap.org/keys/network#values) [network](https://wiki.openstreetmap.org/wiki/Key:network) | [string](../SpecialInputElements.md#string) | [AeroVironment](https://wiki.openstreetmap.org/wiki/Tag:network%3DAeroVironment) [Blink](https://wiki.openstreetmap.org/wiki/Tag:network%3DBlink) [EVgo](https://wiki.openstreetmap.org/wiki/Tag:network%3DEVgo) [Allego](https://wiki.openstreetmap.org/wiki/Tag:network%3DAllego) [Blue Corner](https://wiki.openstreetmap.org/wiki/Tag:network%3DBlue Corner) [Tesla](https://wiki.openstreetmap.org/wiki/Tag:network%3DTesla) [](https://taginfo.openstreetmap.org/keys/operator#values) [operator](https://wiki.openstreetmap.org/wiki/Key:operator) | [string](../SpecialInputElements.md#string) | [](https://taginfo.openstreetmap.org/keys/phone#values) [phone](https://wiki.openstreetmap.org/wiki/Key:phone) | [phone](../SpecialInputElements.md#phone) | diff --git a/Docs/Layers/entrance.md b/Docs/Layers/entrance.md index bb2ab2e72..a34a27dfb 100644 --- a/Docs/Layers/entrance.md +++ b/Docs/Layers/entrance.md @@ -98,7 +98,7 @@ attribute | type | values which are supported by this layer [](https://taginfo.openstreetmap.org/keys/entrance#values) [entrance](https://wiki.openstreetmap.org/wiki/Key:entrance) | Multiple choice | [](https://wiki.openstreetmap.org/wiki/Tag:entrance%3D) [main](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Dmain) [secondary](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Dsecondary) [service](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Dservice) [exit](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Dexit) [entrance](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Dentrance) [emergency](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Demergency) [home](https://wiki.openstreetmap.org/wiki/Tag:entrance%3Dhome) [](https://taginfo.openstreetmap.org/keys/door#values) [door](https://wiki.openstreetmap.org/wiki/Key:door) | Multiple choice | [hinged](https://wiki.openstreetmap.org/wiki/Tag:door%3Dhinged) [revolving](https://wiki.openstreetmap.org/wiki/Tag:door%3Drevolving) [sliding](https://wiki.openstreetmap.org/wiki/Tag:door%3Dsliding) [overhead](https://wiki.openstreetmap.org/wiki/Tag:door%3Doverhead) [no](https://wiki.openstreetmap.org/wiki/Tag:door%3Dno) [](https://taginfo.openstreetmap.org/keys/automatic_door#values) [automatic_door](https://wiki.openstreetmap.org/wiki/Key:automatic_door) | Multiple choice | [no](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dno) [motion](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dmotion) [floor](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dfloor) [button](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dbutton) [slowdown_button](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dslowdown_button) [continuous](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dcontinuous) [serviced_on_button_press](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dserviced_on_button_press) [serviced_on_request](https://wiki.openstreetmap.org/wiki/Tag:automatic_door%3Dserviced_on_request) -[](https://taginfo.openstreetmap.org/keys/width#values) [width](https://wiki.openstreetmap.org/wiki/Key:width) | [string](../SpecialInputElements.md#string) | +[](https://taginfo.openstreetmap.org/keys/width#values) [width](https://wiki.openstreetmap.org/wiki/Key:width) | [pfloat](../SpecialInputElements.md#pfloat) | [](https://taginfo.openstreetmap.org/keys/kerb:height#values) [kerb:height](https://wiki.openstreetmap.org/wiki/Key:kerb:height) | [pnat](../SpecialInputElements.md#pnat) | [0](https://wiki.openstreetmap.org/wiki/Tag:kerb:height%3D0) diff --git a/Docs/Themes/mapcomplete-changes.md b/Docs/Themes/mapcomplete-changes.md index 472e0c6a2..a8381ed0b 100644 --- a/Docs/Themes/mapcomplete-changes.md +++ b/Docs/Themes/mapcomplete-changes.md @@ -31,6 +31,7 @@ Available languages: - en + - de This document is autogenerated from [assets/themes/mapcomplete-changes/mapcomplete-changes.json](https://github.com/pietervdvn/MapComplete/blob/develop/assets/themes/mapcomplete-changes/mapcomplete-changes.json) diff --git a/Docs/URL_Parameters.md b/Docs/URL_Parameters.md index 3b7947c1a..06b6588bb 100644 --- a/Docs/URL_Parameters.md +++ b/Docs/URL_Parameters.md @@ -398,7 +398,7 @@ This documentation is defined in the source code at [InitialMapPositioning.ts](/ Used to complete the login -This documentation is defined in the source code at [ThemeViewState.ts](/src/Models/ThemeViewState.ts#L172) +This documentation is defined in the source code at [ThemeViewState.ts](/src/Models/ThemeViewState.ts#L175) No default value set diff --git a/assets/layers/charging_station/charging_station.json b/assets/layers/charging_station/charging_station.json index 354d98d27..2e9fee250 100644 --- a/assets/layers/charging_station/charging_station.json +++ b/assets/layers/charging_station/charging_station.json @@ -3330,4 +3330,4 @@ }, "neededChangesets": 10 } -} +} \ No newline at end of file diff --git a/assets/layers/cycleways_and_roads/cycleways_and_roads.json b/assets/layers/cycleways_and_roads/cycleways_and_roads.json index 44fdf260f..8c19071bf 100644 --- a/assets/layers/cycleways_and_roads/cycleways_and_roads.json +++ b/assets/layers/cycleways_and_roads/cycleways_and_roads.json @@ -822,7 +822,8 @@ "if": "incline=", "then": { "en": "There is (probably) no incline here", - "de": "Hier gibt es (wahrscheinlich) keine Steigung" + "de": "Hier gibt es (wahrscheinlich) keine Steigung", + "nl": "De straat hier is (waarschijnlijk) zonder helling" }, "hideInAnswer": true }, diff --git a/assets/layers/last_click/last_click.json b/assets/layers/last_click/last_click.json index 618ef6343..55ad5011a 100644 --- a/assets/layers/last_click/last_click.json +++ b/assets/layers/last_click/last_click.json @@ -3,12 +3,7 @@ "name": null, "description": "This 'layer' is not really a layer, but contains part of the code how the popup to 'add a new marker' is displayed", "source": "special", - "isShown": { - "or": [ - "has_presets=yes", - "has_note_layer=yes" - ] - }, + "isShown": "mouse_button=right", "title": { "mappings": [ { @@ -56,7 +51,6 @@ }, "popupInFloatover": true, "titleIcons": [], - "isShown": "mouse_button=right", "pointRendering": [ { "marker": [ diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 228db623c..3895e760b 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -27,13 +27,6 @@ "advertising": { "name": "Reclame", "presets": { - "10": { - "description": "Een stuk groot, weerbestendig textiel met opgedrukte reclameboodschap die permanent aan de muur hangt", - "title": "een spandoek" - }, - "14": { - "title": "een muurschildering" - }, "4": { "description": "Een klein uithangbord voor buurtadvertenties, meestal gericht op voetgangers", "title": "een uithangbord" @@ -50,6 +43,13 @@ }, "8": { "title": "een scherm op een muur" + }, + "10": { + "description": "Een stuk groot, weerbestendig textiel met opgedrukte reclameboodschap die permanent aan de muur hangt", + "title": "een spandoek" + }, + "14": { + "title": "een muurschildering" } }, "tagRenderings": { @@ -107,9 +107,6 @@ }, "title": { "mappings": { - "10": { - "then": "Muurschildering" - }, "3": { "then": "Aanplakzuil" }, @@ -127,6 +124,9 @@ }, "9": { "then": "Aanplakzuil" + }, + "10": { + "then": "Muurschildering" } } } @@ -208,15 +208,6 @@ "1": { "then": "Muurschildering" }, - "10": { - "then": "Azulejo (Spaanse siertegels)" - }, - "11": { - "then": "Tegelwerk" - }, - "12": { - "then": "Houtsculptuur" - }, "2": { "then": "Schilderij" }, @@ -240,6 +231,15 @@ }, "9": { "then": "Reliëf" + }, + "10": { + "then": "Azulejo (Spaanse siertegels)" + }, + "11": { + "then": "Tegelwerk" + }, + "12": { + "then": "Houtsculptuur" } }, "question": "Wat voor soort kunstwerk is dit?", @@ -1754,6 +1754,30 @@ "1": { "question": "Heeft een
Schuko stekker zonder aardingspin (CEE7/4 type F)
" }, + "2": { + "question": "Heeft een
Europese stekker met aardingspin (CEE7/4 type E)
" + }, + "3": { + "question": "Heeft een
Chademo
" + }, + "4": { + "question": "Heeft een
Type 1 met kabel (J1772)
" + }, + "5": { + "question": "Heeft een
Type 1 zonder kabel (J1772)
" + }, + "6": { + "question": "Heeft een
Type 1 CCS (ook gekend als Type 1 Combo)
" + }, + "7": { + "question": "Heeft een
Tesla Supercharger
" + }, + "8": { + "question": "Heeft een
Type 2 (mennekes)
" + }, + "9": { + "question": "Heeft een
Type 2 CCS (mennekes)
" + }, "10": { "question": "Heeft een
Type 2 met kabel (J1772)
" }, @@ -1784,35 +1808,11 @@ "19": { "question": "Heeft een
SEV 1011 T23 (Zwitserse 3-pin)
" }, - "2": { - "question": "Heeft een
Europese stekker met aardingspin (CEE7/4 type E)
" - }, "20": { "question": "Heeft een
AS3112 (Australische 3-pin)
" }, "21": { "question": "Heeft een
NEMA 5-20 (VS 3-pin)
" - }, - "3": { - "question": "Heeft een
Chademo
" - }, - "4": { - "question": "Heeft een
Type 1 met kabel (J1772)
" - }, - "5": { - "question": "Heeft een
Type 1 zonder kabel (J1772)
" - }, - "6": { - "question": "Heeft een
Type 1 CCS (ook gekend als Type 1 Combo)
" - }, - "7": { - "question": "Heeft een
Tesla Supercharger
" - }, - "8": { - "question": "Heeft een
Type 2 (mennekes)
" - }, - "9": { - "question": "Heeft een
Type 2 CCS (mennekes)
" } } } @@ -1868,6 +1868,30 @@ "1": { "then": "Schuko stekker zonder aardingspin (CEE7/4 type F)" }, + "2": { + "then": "Europese stekker met aardingspin (CEE7/4 type E)" + }, + "3": { + "then": "Europese stekker met aardingspin (CEE7/4 type E)" + }, + "4": { + "then": "Chademo" + }, + "5": { + "then": "Chademo" + }, + "6": { + "then": "Type 1 met kabel (J1772)" + }, + "7": { + "then": "Type 1 met kabel (J1772)" + }, + "8": { + "then": "Type 1 zonder kabel (J1772)" + }, + "9": { + "then": "Type 1 zonder kabel (J1772)" + }, "10": { "then": "Type 1 CCS (ook gekend als Type 1 Combo)" }, @@ -1898,9 +1922,6 @@ "19": { "then": "Type 2 met kabel (J1772)" }, - "2": { - "then": "Europese stekker met aardingspin (CEE7/4 type E)" - }, "20": { "then": "Tesla Supercharger CCS (een type2 CCS met Tesla-logo)" }, @@ -1931,9 +1952,6 @@ "29": { "then": "Bosch Active Connect met 3 pinnen aan een kabel" }, - "3": { - "then": "Europese stekker met aardingspin (CEE7/4 type E)" - }, "30": { "then": "Bosch Active Connect met 5 pinnen aan een kabel" }, @@ -1964,29 +1982,11 @@ "39": { "then": "AS3112 (Australische 3-pin)" }, - "4": { - "then": "Chademo" - }, "40": { "then": "NEMA 5-20 (VS 3-pin)" }, "41": { "then": "NEMA 5-20 (VS 3-pin)" - }, - "5": { - "then": "Chademo" - }, - "6": { - "then": "Type 1 met kabel (J1772)" - }, - "7": { - "then": "Type 1 met kabel (J1772)" - }, - "8": { - "then": "Type 1 zonder kabel (J1772)" - }, - "9": { - "then": "Type 1 zonder kabel (J1772)" } }, "question": "Welke aansluitingen zijn hier beschikbaar?" @@ -2180,6 +2180,30 @@ "1": { "2": "Europese stekker met aardingspin (CEE7/4 type E)" }, + "2": { + "2": "Chademo" + }, + "3": { + "2": "Type 1 met kabel (J1772)" + }, + "4": { + "2": "Type 1 zonder kabel (J1772)" + }, + "5": { + "2": "Type 1 CCS (ook gekend als Type 1 Combo)" + }, + "6": { + "2": "Tesla Supercharger" + }, + "7": { + "2": "Type 2 (mennekes)" + }, + "8": { + "2": "Type 2 CCS (mennekes)" + }, + "9": { + "2": "Type 2 met kabel (J1772)" + }, "10": { "2": "Tesla Supercharger CCS (een type2 CCS met Tesla-logo)" }, @@ -2210,32 +2234,8 @@ "19": { "2": "AS3112 (Australische 3-pin)" }, - "2": { - "2": "Chademo" - }, "20": { "2": "NEMA 5-20 (VS 3-pin)" - }, - "3": { - "2": "Type 1 met kabel (J1772)" - }, - "4": { - "2": "Type 1 zonder kabel (J1772)" - }, - "5": { - "2": "Type 1 CCS (ook gekend als Type 1 Combo)" - }, - "6": { - "2": "Tesla Supercharger" - }, - "7": { - "2": "Type 2 (mennekes)" - }, - "8": { - "2": "Type 2 CCS (mennekes)" - }, - "9": { - "2": "Type 2 met kabel (J1772)" } } } @@ -3001,15 +3001,6 @@ "1": { "then": "Dit fietspad is geplaveid" }, - "10": { - "then": "Dit fietspad is gemaakt van fijn grind" - }, - "11": { - "then": "Dit fietspad is gemaakt van kiezelsteentjes" - }, - "12": { - "then": "Dit fietspad is gemaakt van aarde" - }, "2": { "then": "Dit fietspad is gemaakt van asfalt" }, @@ -3033,6 +3024,15 @@ }, "9": { "then": "Dit fietspad is gemaakt van grind" + }, + "10": { + "then": "Dit fietspad is gemaakt van fijn grind" + }, + "11": { + "then": "Dit fietspad is gemaakt van kiezelsteentjes" + }, + "12": { + "then": "Dit fietspad is gemaakt van aarde" } }, "question": "Waaruit is het oppervlak van het fietspad van gemaakt?", @@ -3081,15 +3081,6 @@ "1": { "then": "Dit fietspad is geplaveid" }, - "10": { - "then": "Dit fietspad is gemaakt van fijn grind" - }, - "11": { - "then": "Dit fietspad is gemaakt van kiezelsteentjes" - }, - "12": { - "then": "Dit fietspad is gemaakt van aarde" - }, "2": { "then": "Dit fietspad is gemaakt van asfalt" }, @@ -3113,6 +3104,15 @@ }, "9": { "then": "Dit fietspad is gemaakt van grind" + }, + "10": { + "then": "Dit fietspad is gemaakt van fijn grind" + }, + "11": { + "then": "Dit fietspad is gemaakt van kiezelsteentjes" + }, + "12": { + "then": "Dit fietspad is gemaakt van aarde" } }, "question": "Waaruit is het oppervlak van de straat gemaakt?", @@ -4168,21 +4168,6 @@ "1": { "then": "Dit is een frituur" }, - "10": { - "then": "Dit is een Chinees restaurant" - }, - "11": { - "then": "Dit is een Grieks restaurant" - }, - "12": { - "then": "Dit is een Indisch restaurant" - }, - "13": { - "then": "Dit is een Turks restaurant (dat meer dan enkel kebab verkoopt)" - }, - "14": { - "then": "Dit is een Thaïs restaurant" - }, "2": { "then": "Dit is een pastazaak" }, @@ -4206,6 +4191,21 @@ }, "9": { "then": "Dit is een Frans restaurant" + }, + "10": { + "then": "Dit is een Chinees restaurant" + }, + "11": { + "then": "Dit is een Grieks restaurant" + }, + "12": { + "then": "Dit is een Indisch restaurant" + }, + "13": { + "then": "Dit is een Turks restaurant (dat meer dan enkel kebab verkoopt)" + }, + "14": { + "then": "Dit is een Thaïs restaurant" } }, "question": "Welk soort gerechten worden hier geserveerd?", @@ -5257,12 +5257,6 @@ "0": { "then": "Dit is een standbeeld" }, - "10": { - "then": "Dit is een kruis" - }, - "12": { - "then": "Dit is een historische tank, permanent in de publieke ruimte geplaatst als gedenkteken" - }, "2": { "then": "Dit is een zitbank die ook als herdenking dienst doet" }, @@ -5274,6 +5268,12 @@ }, "8": { "then": "Dit is een sculptuur" + }, + "10": { + "then": "Dit is een kruis" + }, + "12": { + "then": "Dit is een historische tank, permanent in de publieke ruimte geplaatst als gedenkteken" } } }, @@ -5425,19 +5425,6 @@ } } }, - "10": { - "options": { - "0": { - "question": "Alle Notes" - }, - "1": { - "question": "Verberg import Notes" - }, - "2": { - "question": "Toon enkel import Notes" - } - } - }, "2": { "options": { "0": { @@ -5493,6 +5480,19 @@ "question": "Toon enkel open Notes" } } + }, + "10": { + "options": { + "0": { + "question": "Alle Notes" + }, + "1": { + "question": "Verberg import Notes" + }, + "2": { + "question": "Toon enkel import Notes" + } + } } }, "name": "OpenStreetMap Notes", @@ -5770,18 +5770,6 @@ "1": { "then": "Dit is een normale parkeerplek." }, - "10": { - "then": "Deze parkeerplek is gereserveerd voor personeel." - }, - "11": { - "then": "Deze parkeerplek is gereserveerd voor taxis." - }, - "12": { - "then": "Deze parkeerplek is gereserveerd voor voertuigen met een aanhanger." - }, - "13": { - "then": "Deze parkeerplek is gereserveerd voor autodelen." - }, "2": { "then": "Dit is een gehandicaptenparkeerplaats." }, @@ -5805,6 +5793,18 @@ }, "9": { "then": "Deze parkeerplek is gereserveerd voor ouders met kinderen." + }, + "10": { + "then": "Deze parkeerplek is gereserveerd voor personeel." + }, + "11": { + "then": "Deze parkeerplek is gereserveerd voor taxis." + }, + "12": { + "then": "Deze parkeerplek is gereserveerd voor voertuigen met een aanhanger." + }, + "13": { + "then": "Deze parkeerplek is gereserveerd voor autodelen." } }, "question": "Wat voor parkeerplek is dit?" @@ -6119,9 +6119,6 @@ "0": { "then": "Dit is een schommel" }, - "11": { - "then": "Dit is een rekstok" - }, "3": { "then": "Dit is een zandbak" }, @@ -6133,6 +6130,9 @@ }, "6": { "then": "Dit is een wipwap" + }, + "11": { + "then": "Dit is een rekstok" } }, "question": "Wat voor speeltoestel is dit?" @@ -6398,21 +6398,6 @@ "1": { "then": "Munten van 2 cent worden geaccepteerd" }, - "10": { - "then": "Munten van 20 rappen worden geaccepteerd" - }, - "11": { - "then": "Munten van ½ frank worden geaccepteerd" - }, - "12": { - "then": "Munten van 1 frank worden geaccepteerd" - }, - "13": { - "then": "Munten van 2 frank worden geaccepteerd" - }, - "14": { - "then": "Munten van 5 frank worden geaccepteerd" - }, "2": { "then": "Munten van 5 cent worden geaccepteerd" }, @@ -6436,6 +6421,21 @@ }, "9": { "then": "Munten van 10 rappen worden geaccepteerd" + }, + "10": { + "then": "Munten van 20 rappen worden geaccepteerd" + }, + "11": { + "then": "Munten van ½ frank worden geaccepteerd" + }, + "12": { + "then": "Munten van 1 frank worden geaccepteerd" + }, + "13": { + "then": "Munten van 2 frank worden geaccepteerd" + }, + "14": { + "then": "Munten van 5 frank worden geaccepteerd" } }, "question": "Met welke munten kan je hier betalen?" @@ -6448,15 +6448,6 @@ "1": { "then": "Biljetten van 10 euro worden geaccepteerd" }, - "10": { - "then": "Biljetten van 100 frank worden geaccepteerd" - }, - "11": { - "then": "Biljetten van 200 frank worden geaccepteerd" - }, - "12": { - "then": "Biljetten van 1000 frank worden geaccepteerd" - }, "2": { "then": "Biljetten van 20 euro worden geaccepteerd" }, @@ -6480,6 +6471,15 @@ }, "9": { "then": "Biljetten van 50 frank worden geaccepteerd" + }, + "10": { + "then": "Biljetten van 100 frank worden geaccepteerd" + }, + "11": { + "then": "Biljetten van 200 frank worden geaccepteerd" + }, + "12": { + "then": "Biljetten van 1000 frank worden geaccepteerd" } }, "question": "Met welke bankbiljetten kan je hier betalen?" @@ -6810,6 +6810,30 @@ "1": { "question": "Recycling van batterijen" }, + "2": { + "question": "Recycling van drankpakken" + }, + "3": { + "question": "Recycling van blikken" + }, + "4": { + "question": "Recycling van kleding" + }, + "5": { + "question": "Recycling van frituurvet" + }, + "6": { + "question": "Recycling van motorolie" + }, + "7": { + "question": "Recycling van tl-buizen" + }, + "8": { + "question": "Recycling van groen afval" + }, + "9": { + "question": "Recycling van glazen flessen" + }, "10": { "question": "Recycling van glas" }, @@ -6840,9 +6864,6 @@ "19": { "question": "Recycling van restafval" }, - "2": { - "question": "Recycling van drankpakken" - }, "20": { "question": "Recycling van inktpatronen" }, @@ -6851,27 +6872,6 @@ }, "22": { "question": "Recycling van plastic verkpakkingen, metalen verkpakkingen en drankpakken (PMD)" - }, - "3": { - "question": "Recycling van blikken" - }, - "4": { - "question": "Recycling van kleding" - }, - "5": { - "question": "Recycling van frituurvet" - }, - "6": { - "question": "Recycling van motorolie" - }, - "7": { - "question": "Recycling van tl-buizen" - }, - "8": { - "question": "Recycling van groen afval" - }, - "9": { - "question": "Recycling van glazen flessen" } } }, @@ -6939,6 +6939,30 @@ "1": { "then": "Drankpakken kunnen hier gerecycled worden" }, + "2": { + "then": "Blikken kunnen hier gerecycled worden" + }, + "3": { + "then": "Kleren kunnen hier gerecycled worden" + }, + "4": { + "then": "Frituurvet kan hier gerecycled worden" + }, + "5": { + "then": "Motorolie kan hier gerecycled worden" + }, + "6": { + "then": "TL-buizen kunnen hier gerecycled worden" + }, + "7": { + "then": "Groen afval kan hier gerecycled worden" + }, + "8": { + "then": "Organisch afval kan hier gerecycled worden" + }, + "9": { + "then": "Glazen flessen kunnen hier gerecycled worden" + }, "10": { "then": "Glas kan hier gerecycled worden" }, @@ -6969,9 +6993,6 @@ "19": { "then": "Oud metaal kan hier gerecycled worden" }, - "2": { - "then": "Blikken kunnen hier gerecycled worden" - }, "20": { "then": "Schoenen kunnen hier gerecycled worden" }, @@ -6989,27 +7010,6 @@ }, "25": { "then": "Fietsen (en fietswrakken) kunnen hier gerecycled worden" - }, - "3": { - "then": "Kleren kunnen hier gerecycled worden" - }, - "4": { - "then": "Frituurvet kan hier gerecycled worden" - }, - "5": { - "then": "Motorolie kan hier gerecycled worden" - }, - "6": { - "then": "TL-buizen kunnen hier gerecycled worden" - }, - "7": { - "then": "Groen afval kan hier gerecycled worden" - }, - "8": { - "then": "Organisch afval kan hier gerecycled worden" - }, - "9": { - "then": "Glazen flessen kunnen hier gerecycled worden" } }, "question": "Wat kan hier gerecycled worden?" @@ -7735,12 +7735,6 @@ "1": { "then": "Deze lantaarn gebruikt LEDs" }, - "10": { - "then": "Deze lantaarn gebruikt hogedruknatriumlampen (oranje met wit)" - }, - "11": { - "then": "Deze lantaarn wordt verlicht met gas" - }, "2": { "then": "Deze lantaarn gebruikt gloeilampen" }, @@ -7764,6 +7758,12 @@ }, "9": { "then": "Deze lantaarn gebruikt lagedruknatriumlampen (monochroom oranje)" + }, + "10": { + "then": "Deze lantaarn gebruikt hogedruknatriumlampen (oranje met wit)" + }, + "11": { + "then": "Deze lantaarn wordt verlicht met gas" } }, "question": "Wat voor verlichting gebruikt deze lantaarn?" @@ -9010,6 +9010,30 @@ "1": { "question": "Verkoop van dranken" }, + "2": { + "question": "Verkoop van snoep" + }, + "3": { + "question": "Verkoop van eten" + }, + "4": { + "question": "Verkoop van sigaretten" + }, + "5": { + "question": "Verkoop van condooms" + }, + "6": { + "question": "Verkoop van koffie" + }, + "7": { + "question": "Verkoop van water" + }, + "8": { + "question": "Verkoop van kranten" + }, + "9": { + "question": "Verkoop van fietsbinnenbanden" + }, "10": { "question": "Verkoop van melk" }, @@ -9040,9 +9064,6 @@ "19": { "question": "Verkoop van bloemen" }, - "2": { - "question": "Verkoop van snoep" - }, "23": { "question": "Verkoop van fietslampjes" }, @@ -9057,27 +9078,6 @@ }, "27": { "question": "Verkoop van fietssloten" - }, - "3": { - "question": "Verkoop van eten" - }, - "4": { - "question": "Verkoop van sigaretten" - }, - "5": { - "question": "Verkoop van condooms" - }, - "6": { - "question": "Verkoop van koffie" - }, - "7": { - "question": "Verkoop van water" - }, - "8": { - "question": "Verkoop van kranten" - }, - "9": { - "question": "Verkoop van fietsbinnenbanden" } } } @@ -9168,6 +9168,30 @@ "1": { "then": "Snoep wordt verkocht" }, + "2": { + "then": "Eten wordt verkocht" + }, + "3": { + "then": "Sigaretten worden verkocht" + }, + "4": { + "then": "Condooms worden verkocht" + }, + "5": { + "then": "Koffie wordt verkocht" + }, + "6": { + "then": "Drinkwater wordt verkocht" + }, + "7": { + "then": "Kranten worden verkocht" + }, + "8": { + "then": "Binnenbanden voor fietsen worden verkocht" + }, + "9": { + "then": "Melk wordt verkocht" + }, "10": { "then": "Brood wordt verkocht" }, @@ -9198,9 +9222,6 @@ "19": { "then": "Parkeerkaarten worden verkocht" }, - "2": { - "then": "Eten wordt verkocht" - }, "21": { "then": "Openbaar vervoerkaartjes worden verkocht" }, @@ -9218,27 +9239,6 @@ }, "26": { "then": "Fietssloten worden verkocht" - }, - "3": { - "then": "Sigaretten worden verkocht" - }, - "4": { - "then": "Condooms worden verkocht" - }, - "5": { - "then": "Koffie wordt verkocht" - }, - "6": { - "then": "Drinkwater wordt verkocht" - }, - "7": { - "then": "Kranten worden verkocht" - }, - "8": { - "then": "Binnenbanden voor fietsen worden verkocht" - }, - "9": { - "then": "Melk wordt verkocht" } }, "question": "Wat verkoopt deze verkoopautomaat?", @@ -9540,4 +9540,4 @@ "render": "windturbine" } } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7bdf35287..fb9d51d68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mapcomplete", - "version": "0.43.2", + "version": "0.44.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mapcomplete", - "version": "0.43.2", + "version": "0.44.0", "license": "GPL-3.0-or-later", "dependencies": { "@comunica/core": "^3.0.1", @@ -7893,9 +7893,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001634", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001634.tgz", - "integrity": "sha512-fbBYXQ9q3+yp1q1gBk86tOFs4pyn/yxFm5ZNP18OXJDfA3txImOY9PhfxVggZ4vRHDqoU8NrKU81eN0OtzOgRA==", + "version": "1.0.30001636", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz", + "integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==", "dev": true, "funding": [ { @@ -25250,9 +25250,9 @@ "version": "2.0.1" }, "caniuse-lite": { - "version": "1.0.30001634", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001634.tgz", - "integrity": "sha512-fbBYXQ9q3+yp1q1gBk86tOFs4pyn/yxFm5ZNP18OXJDfA3txImOY9PhfxVggZ4vRHDqoU8NrKU81eN0OtzOgRA==", + "version": "1.0.30001636", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz", + "integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==", "dev": true }, "canonicalize": { diff --git a/scripts/generateIncludedImages.ts b/scripts/generateIncludedImages.ts index d648df9c9..6b256bc70 100644 --- a/scripts/generateIncludedImages.ts +++ b/scripts/generateIncludedImages.ts @@ -107,7 +107,7 @@ function genImages(dryrun = false) { "wikimedia-commons-white", "wikimedia_commons_white", "wikipedia", - "github" + "github", ].map((s) => s.toLowerCase()) const dir = fs.readdirSync("./assets/svg") diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index 109129264..87e2c7d73 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -10,12 +10,16 @@ import { PrevalidateTheme, ValidateLayer, ValidateThemeAndLayers, - 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" @@ -158,11 +162,11 @@ class LayerOverviewUtils extends Script { continue } if (publicLayer["builtin"] !== undefined) { - const bi : string | string[] = publicLayer["builtin"] + const bi: string | string[] = publicLayer["builtin"] if (typeof bi === "string") { publicLayerIds.push(bi) } else { - bi.forEach(id => publicLayerIds.push(id)) + bi.forEach((id) => publicLayerIds.push(id)) } continue } @@ -204,9 +208,9 @@ class LayerOverviewUtils extends Script { | LayerConfigJson | string | { - builtin - } - )[] + builtin + } + )[] }[] ) { const perId = new Map() @@ -226,7 +230,7 @@ class LayerOverviewUtils extends Script { icon: theme.icon, hideFromOverview: theme.hideFromOverview, mustHaveLanguage: theme.mustHaveLanguage, - keywords: Utils.NoNull(keywords) + keywords: Utils.NoNull(keywords), } perId.set(theme.id, data) } @@ -275,7 +279,9 @@ class LayerOverviewUtils extends Script { ) } - static asDict(trs: QuestionableTagRenderingConfigJson[]): Map { + static asDict( + trs: QuestionableTagRenderingConfigJson[] + ): Map { const d = new Map() for (const tr of trs) { d.set(tr.id, tr) @@ -283,14 +289,12 @@ class LayerOverviewUtils extends Script { return d } - getSharedTagRenderings( - doesImageExist: DoesImageExist - ): QuestionableTagRenderingConfigJson[] ; + getSharedTagRenderings(doesImageExist: DoesImageExist): QuestionableTagRenderingConfigJson[] getSharedTagRenderings( doesImageExist: DoesImageExist, bootstrapTagRenderings: Map, bootstrapTagRenderingsOrder: string[] - ): QuestionableTagRenderingConfigJson[] ; + ): QuestionableTagRenderingConfigJson[] getSharedTagRenderings( doesImageExist: DoesImageExist, bootstrapTagRenderings: Map = null, @@ -301,10 +305,10 @@ class LayerOverviewUtils extends Script { tagRenderings: bootstrapTagRenderings, tagRenderingOrder: bootstrapTagRenderingsOrder, sharedLayers: null, - publicLayers: null + publicLayers: null, }, { - addTagRenderingsToContext: true + addTagRenderingsToContext: true, } ) @@ -322,7 +326,11 @@ class LayerOverviewUtils extends Script { return sharedQuestions.tagRenderings } - return this.getSharedTagRenderings(doesImageExist, dict, sharedQuestions.tagRenderings.map(tr => tr["id"])) + return this.getSharedTagRenderings( + doesImageExist, + dict, + sharedQuestions.tagRenderings.map((tr) => tr["id"]) + ) } checkAllSvgs() { @@ -336,7 +344,7 @@ class LayerOverviewUtils extends Script { "src/assets/SocialImageBanner.svg", "src/assets/SocialImageRepo.svg", "src/assets/svg/osm-logo.svg", - "src/assets/templates/*" + "src/assets/templates/*", ] for (const path of allSvgs) { if ( @@ -361,8 +369,8 @@ class LayerOverviewUtils extends Script { if (contents.indexOf(" 0) { console.warn( "The SVG at " + - path + - " contains a `text`-tag. This is highly discouraged. Every machine viewing your theme has their own font libary, and the font you choose might not be present, resulting in a different font being rendered. Solution: open your .svg in inkscape (or another program), select the text and convert it to a path" + path + + " contains a `text`-tag. This is highly discouraged. Every machine viewing your theme has their own font libary, and the font you choose might not be present, resulting in a different font being rendered. Solution: open your .svg in inkscape (or another program), select the text and convert it to a path" ) errCount++ } @@ -425,7 +433,7 @@ class LayerOverviewUtils extends Script { writeFileSync( "./src/assets/generated/known_layers.json", JSON.stringify({ - layers: Array.from(sharedLayers.values()).filter((l) => l.id !== "favourite") + layers: Array.from(sharedLayers.values()).filter((l) => l.id !== "favourite"), }) ) } @@ -442,11 +450,11 @@ class LayerOverviewUtils extends Script { // mapcomplete-changes shows an icon for each corresponding mapcomplete-theme const iconsPerTheme = Array.from(sharedThemes.values()).map((th) => ({ if: "theme=" + th.id, - then: th.icon + then: th.icon, })) const proto: LayoutConfigJson = JSON.parse( readFileSync("./assets/themes/mapcomplete-changes/mapcomplete-changes.proto.json", { - encoding: "utf8" + encoding: "utf8", }) ) const protolayer = ( @@ -462,7 +470,7 @@ class LayerOverviewUtils extends Script { new DetectDuplicateFilters().convertStrict( { layers: ScriptUtils.getLayerFiles().map((f) => f.parsed), - themes: ScriptUtils.getThemeFiles().map((f) => f.parsed) + themes: ScriptUtils.getThemeFiles().map((f) => f.parsed), }, ConversionContext.construct([], []) ) @@ -477,7 +485,7 @@ class LayerOverviewUtils extends Script { writeFileSync( "./src/assets/generated/known_themes.json", JSON.stringify({ - themes: Array.from(sharedThemes.values()) + themes: Array.from(sharedThemes.values()), }) ) } @@ -518,8 +526,8 @@ class LayerOverviewUtils extends Script { console.log(" ---------- VALIDATING BUILTIN LAYERS ---------") const state: DesugaringContext = { tagRenderings: LayerOverviewUtils.asDict(sharedTagRenderings), - tagRenderingOrder: sharedTagRenderings.map(tr => tr.id), - sharedLayers: AllSharedLayers.getSharedLayersConfigs() + tagRenderingOrder: sharedTagRenderings.map((tr) => tr.id), + sharedLayers: AllSharedLayers.getSharedLayersConfigs(), } const sharedLayers = new Map() const prepLayer = new PrepareLayer(state) @@ -564,12 +572,12 @@ class LayerOverviewUtils extends Script { console.log( "Recompiled layers " + - recompiledLayers.join(", ") + - " and skipped " + - skippedLayers.length + - " layers. Detected " + - warningCount + - " warnings" + recompiledLayers.join(", ") + + " and skipped " + + skippedLayers.length + + " layers. Detected " + + warningCount + + " warnings" ) // We always need the calculated tags of 'usersettings', so we export them separately this.extractJavascriptCodeForLayer( @@ -591,11 +599,11 @@ class LayerOverviewUtils extends Script { private extractJavascriptCode(themeFile: LayoutConfigJson) { const allCode = [ "import {Feature} from 'geojson'", - "import { ExtraFuncType } from \"../../../Logic/ExtraFunctions\";", - "import { Utils } from \"../../../Utils\"", + 'import { ExtraFuncType } from "../../../Logic/ExtraFunctions";', + 'import { Utils } from "../../../Utils"', "export class ThemeMetaTagging {", " public static readonly themeName = " + JSON.stringify(themeFile.id), - "" + "", ] for (const layer of themeFile.layers) { const l = layer @@ -604,8 +612,8 @@ class LayerOverviewUtils extends Script { allCode.push( " public metaTaggging_for_" + - id + - "(feat: Feature, helperFunctions: Record Function>) {" + id + + "(feat: Feature, helperFunctions: Record Function>) {" ) allCode.push(" const {" + ExtraFunctions.types.join(", ") + "} = helperFunctions") for (const line of code) { @@ -616,10 +624,10 @@ class LayerOverviewUtils extends Script { if (!isStrict) { allCode.push( " Utils.AddLazyProperty(feat.properties, '" + - attributeName + - "', () => " + - expression + - " ) " + attributeName + + "', () => " + + expression + + " ) " ) } else { attributeName = attributeName.substring(0, attributeName.length - 1).trim() @@ -659,7 +667,7 @@ class LayerOverviewUtils extends Script { `/** This code is autogenerated - do not edit. Edit ./assets/layers/${l?.id}/${l?.id}.json instead */`, "export class ThemeMetaTagging {", " public static readonly themeName = " + JSON.stringify(l.id), - "" + "", ] const code = l.calculatedTags ?? [] @@ -674,10 +682,10 @@ class LayerOverviewUtils extends Script { if (!isStrict) { allCode.push( " Utils.AddLazyProperty(feat.properties, '" + - attributeName + - "', () => " + - expression + - " ) " + attributeName + + "', () => " + + expression + + " ) " ) } else { attributeName = attributeName.substring(0, attributeName.length - 2).trim() @@ -712,15 +720,13 @@ class LayerOverviewUtils extends Script { themeFiles.map((th) => th.parsed) ) - const trs = this.getSharedTagRenderings( - new DoesImageExist(licensePaths, existsSync) - ) + const trs = this.getSharedTagRenderings(new DoesImageExist(licensePaths, existsSync)) const convertState: DesugaringContext = { sharedLayers, tagRenderings: LayerOverviewUtils.asDict(trs), - tagRenderingOrder: trs.map(tr => tr.id), - publicLayers + tagRenderingOrder: trs.map((tr) => tr.id), + publicLayers, } const knownTagRenderings = new Set() convertState.tagRenderings.forEach((_, key) => knownTagRenderings.add(key)) @@ -774,7 +780,7 @@ class LayerOverviewUtils extends Script { ) try { themeFile = new PrepareTheme(convertState, { - skipDefaultLayers: true + skipDefaultLayers: true, }).convertStrict( themeFile, ConversionContext.construct([themePath], ["PrepareLayer"]) @@ -808,7 +814,7 @@ class LayerOverviewUtils extends Script { const e: string = [ `the icon for theme ${themeFile.id} is too small. Please rescale the icon at ${themeFile.icon}`, `Even though an SVG is 'infinitely scaleable', the icon should be dimensioned bigger. One of the build steps of the theme does convert the image to a PNG (to serve as PWA-icon) and having a small dimension will cause blurry images.`, - ` Width = ${width} height = ${height}; we recommend a size of at least 500px * 500px and to use a square aspect ratio.` + ` Width = ${width} height = ${height}; we recommend a size of at least 500px * 500px and to use a square aspect ratio.`, ].join("\n") err(e) } @@ -839,7 +845,7 @@ class LayerOverviewUtils extends Script { new Translation(t.description) .FirstSentence() .OnEveryLanguage((s) => parse_html(s).textContent).translations, - mustHaveLanguage: t.mustHaveLanguage?.length > 0 + mustHaveLanguage: t.mustHaveLanguage?.length > 0, } }) ) @@ -847,10 +853,10 @@ class LayerOverviewUtils extends Script { console.log( "Recompiled themes " + - recompiledThemes.join(", ") + - " and skipped " + - skippedThemes.length + - " themes" + recompiledThemes.join(", ") + + " and skipped " + + skippedThemes.length + + " themes" ) return fixed diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index ab10c1c08..9ec407e90 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -249,7 +249,7 @@ class GenerateLayouts extends Script { continue } let display = ' style="display: none"' - if(!defaultSet){ + if (!defaultSet) { display = "" defaultSet = true } diff --git a/src/Logic/Actors/InitialMapPositioning.ts b/src/Logic/Actors/InitialMapPositioning.ts index f39d8ccdd..f00279d72 100644 --- a/src/Logic/Actors/InitialMapPositioning.ts +++ b/src/Logic/Actors/InitialMapPositioning.ts @@ -55,16 +55,12 @@ export default class InitialMapPositioning { layoutToUse?.startZoom ?? 1, "The initial/current zoom level" ) - const defaultLat =layoutToUse?.startLat ?? 0 - const lat = localStorageSynced( - "lat", - defaultLat , - "The initial/current latitude" - ) + const defaultLat = layoutToUse?.startLat ?? 0 + const lat = localStorageSynced("lat", defaultLat, "The initial/current latitude") const defaultLon = layoutToUse?.startLon ?? 0 const lon = localStorageSynced( "lon", - defaultLon , + defaultLon, "The initial/current longitude of the app" ) @@ -92,16 +88,21 @@ export default class InitialMapPositioning { const [lat, lon] = osmObject.centerpoint() this.location.setData({ lon, lat }) }) - } else if (Constants.GeoIpServer && lat.data === defaultLat && lon.data === defaultLon && !Utils.runningFromConsole) { + } else if ( + Constants.GeoIpServer && + lat.data === defaultLat && + lon.data === defaultLon && + !Utils.runningFromConsole + ) { console.log("Using geoip to determine start location...") // We use geo-IP to zoom to some location - Utils.downloadJson<{ latitude: number, longitude: number }>( + Utils.downloadJson<{ latitude: number; longitude: number }>( Constants.GeoIpServer + "ip" ).then(({ longitude, latitude }) => { - if(geolocationState.currentGPSLocation.data !== undefined){ + if (geolocationState.currentGPSLocation.data !== undefined) { return // We got a geolocation by now, abort } - console.log("Setting location based on geoip", longitude, latitude) + console.log("Setting location based on geoip", longitude, latitude) this.zoom.setData(8) this.location.setData({ lon: longitude, lat: latitude }) }) diff --git a/src/Logic/DetermineLayout.ts b/src/Logic/DetermineLayout.ts index 409bea5bb..1526eacd1 100644 --- a/src/Logic/DetermineLayout.ts +++ b/src/Logic/DetermineLayout.ts @@ -163,24 +163,31 @@ export default class DetermineLayout { return dict } private static getSharedTagRenderingOrder(): string[] { - return questions.tagRenderings.map(tr => tr.id) + return questions.tagRenderings.map((tr) => tr.id) } private static prepCustomTheme(json: any, sourceUrl?: string, forceId?: string): LayoutConfig { if (json.layers === undefined && json.tagRenderings !== undefined) { // We got fed a layer instead of a theme const layerConfig = json - const icon = Utils.NoNull(layerConfig.pointRendering.flatMap( - pr => pr.marker - ).map(iconSpec => { - const icon = new TagRenderingConfig(iconSpec.icon).render.txt - if(iconSpec.color === undefined || icon.startsWith("http:") || icon.startsWith("https:")){ - return icon - } - const color = new TagRenderingConfig(iconSpec.color).render.txt - return icon+":"+color - - })).join(";") + const icon = Utils.NoNull( + layerConfig.pointRendering + .flatMap((pr) => pr.marker) + .map((iconSpec) => { + const icon = new TagRenderingConfig(iconSpec.icon) + .render.txt + if ( + iconSpec.color === undefined || + icon.startsWith("http:") || + icon.startsWith("https:") + ) { + return icon + } + const color = new TagRenderingConfig(iconSpec.color) + .render.txt + return icon + ":" + color + }) + ).join(";") json = { id: json.id, diff --git a/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts b/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts index a1504fbbf..90e0ccde3 100644 --- a/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts +++ b/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts @@ -11,14 +11,17 @@ import { FeatureSource } from "../FeatureSource" * Highly specialized feature source. * Based on a lon/lat UIEVentSource, will generate the corresponding feature with the correct properties */ -export class LastClickFeatureSource implements FeatureSource{ +export class LastClickFeatureSource implements FeatureSource { public readonly renderings: string[] private i: number = 0 private readonly hasPresets: boolean private readonly hasNoteLayer: boolean public static readonly newPointElementId = "new_point_dialog" public readonly features: Store - constructor(layout: LayoutConfig, clickSource: Store<{lon:number,lat:number,mode:"left"|"right"|"middle"}> ) { + constructor( + layout: LayoutConfig, + clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }> + ) { this.hasNoteLayer = layout.hasNoteLayer() this.hasPresets = layout.hasPresets() const allPresets: BaseUIElement[] = [] @@ -33,7 +36,7 @@ export class LastClickFeatureSource implements FeatureSource{ } const { html } = rendering.RenderIcon(tags, { noSize: true, - includeBadges: false + includeBadges: false, }) allPresets.push(html) } @@ -44,12 +47,16 @@ export class LastClickFeatureSource implements FeatureSource{ ) ) - this.features = clickSource.mapD(({lon, lat,mode}) => - [this.createFeature(lon, lat, mode)]) - + this.features = clickSource.mapD(({ lon, lat, mode }) => [ + this.createFeature(lon, lat, mode), + ]) } - public createFeature(lon: number, lat: number, mode?: "left" | "right" | "middle"): Feature { + public createFeature( + lon: number, + lat: number, + mode?: "left" | "right" | "middle" + ): Feature { const properties: OsmTags = { id: LastClickFeatureSource.newPointElementId + "_" + this.i, has_note_layer: this.hasNoteLayer ? "yes" : "no", @@ -57,7 +64,7 @@ export class LastClickFeatureSource implements FeatureSource{ renderings: this.renderings.join(""), number_of_presets: "" + this.renderings.length, first_preset: this.renderings[0], - mouse_button: mode ?? "none" + mouse_button: mode ?? "none", } this.i++ @@ -66,8 +73,8 @@ export class LastClickFeatureSource implements FeatureSource{ properties, geometry: { type: "Point", - coordinates: [lon, lat] - } + coordinates: [lon, lat], + }, } } } diff --git a/src/Logic/MetaTagging.ts b/src/Logic/MetaTagging.ts index 1b6796d27..87a783446 100644 --- a/src/Logic/MetaTagging.ts +++ b/src/Logic/MetaTagging.ts @@ -85,16 +85,19 @@ export default class MetaTagging { console.log("Binding an updater to", feature) let updateCount = 0 tags?.addCallbackD(() => { - console.log("Received an update! Re-calculating the metatags, timediff:", new Date().getTime() - lastUpdateMoment.getTime()) + console.log( + "Received an update! Re-calculating the metatags, timediff:", + new Date().getTime() - lastUpdateMoment.getTime() + ) if (feature !== state.selectedElement.data) { return true // Unregister, we are not the selected element anymore } - if (new Date().getTime() - lastUpdateMoment.getTime() < (250 + updateCount * 50)) { + if (new Date().getTime() - lastUpdateMoment.getTime() < 250 + updateCount * 50) { return } - updateCount ++ + updateCount++ lastUpdateMoment = new Date() window.requestIdleCallback(() => { this.updateCurrentSelectedElement() 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/LinkedDataLoader.ts b/src/Logic/Web/LinkedDataLoader.ts index bd98d3737..6021c3061 100644 --- a/src/Logic/Web/LinkedDataLoader.ts +++ b/src/Logic/Web/LinkedDataLoader.ts @@ -27,23 +27,23 @@ export default class LinkedDataLoader { opening_hours: { "@id": "http://schema.org/openingHoursSpecification" }, openingHours: { "@id": "http://schema.org/openingHours", "@container": "@set" }, geo: { "@id": "http://schema.org/geo" }, - alt_name: { "@id": "http://schema.org/alternateName" } + alt_name: { "@id": "http://schema.org/alternateName" }, } private static COMPACTING_CONTEXT_OH = { dayOfWeek: { "@id": "http://schema.org/dayOfWeek", "@container": "@set" }, closes: { "@id": "http://schema.org/closes", - "@type": "http://www.w3.org/2001/XMLSchema#time" + "@type": "http://www.w3.org/2001/XMLSchema#time", }, opens: { "@id": "http://schema.org/opens", - "@type": "http://www.w3.org/2001/XMLSchema#time" - } + "@type": "http://www.w3.org/2001/XMLSchema#time", + }, } private static formatters: Record<"phone" | "email" | "website", Validator> = { phone: new PhoneValidator(), email: new EmailValidator(), - website: new UrlValidator(undefined, undefined, true) + website: new UrlValidator(undefined, undefined, true), } private static ignoreKeys = [ "http://schema.org/logo", @@ -56,7 +56,7 @@ export default class LinkedDataLoader { "http://schema.org/description", "http://schema.org/hasMap", "http://schema.org/priceRange", - "http://schema.org/contactPoint" + "http://schema.org/contactPoint", ] private static shapeToPolygon(str: string): Polygon { @@ -69,8 +69,8 @@ export default class LinkedDataLoader { .trim() .split(" ") .map((n) => Number(n)) - ) - ] + ), + ], } } @@ -92,18 +92,18 @@ export default class LinkedDataLoader { const context = { lat: { "@id": "http://schema.org/latitude", - "@type": "http://www.w3.org/2001/XMLSchema#double" + "@type": "http://www.w3.org/2001/XMLSchema#double", }, lon: { "@id": "http://schema.org/longitude", - "@type": "http://www.w3.org/2001/XMLSchema#double" - } + "@type": "http://www.w3.org/2001/XMLSchema#double", + }, } const flattened = await jsonld.compact(geo, context) return { type: "Point", - coordinates: [Number(flattened.lon), Number(flattened.lat)] + coordinates: [Number(flattened.lon), Number(flattened.lat)], } } @@ -145,7 +145,7 @@ export default class LinkedDataLoader { Looking at you, C&A! view-source:https://www.c-and-a.com/stores/be-en/oost-vlaanderen/sint-niklaas/stationsstraat-100.html * */ - parts = parts.filter(p => !p.match(/.. 00:00-00:00/)) + parts = parts.filter((p) => !p.match(/.. 00:00-00:00/)) // actually the same as OSM-oh return OH.simplify(parts.join(";")) } @@ -247,18 +247,16 @@ export default class LinkedDataLoader { return await LinkedDataLoader.compact(data, options) } - let htmlContent = await Utils.download(url) const div = document.createElement("div") div.innerHTML = htmlContent - const script = Array.from(div.getElementsByTagName("script")) - .find(script => script.type === "application/ld+json") - + const script = Array.from(div.getElementsByTagName("script")).find( + (script) => script.type === "application/ld+json" + ) const snippet = JSON.parse(script.textContent) snippet["@base"] = url return await LinkedDataLoader.compact(snippet, options) - } /** @@ -309,7 +307,7 @@ export default class LinkedDataLoader { if (properties["latitude"] && properties["longitude"]) { geometry = { type: "Point", - coordinates: [Number(properties["longitude"]), Number(properties["latitude"])] + coordinates: [Number(properties["longitude"]), Number(properties["latitude"])], } delete properties["latitude"] delete properties["longitude"] @@ -321,7 +319,7 @@ export default class LinkedDataLoader { const geo: GeoJSON = { type: "Feature", properties, - geometry + geometry, } delete linkedData.geo delete properties.shape @@ -439,7 +437,7 @@ export default class LinkedDataLoader { "brede publiek", "iedereen", "bezoekers", - "iedereen - vooral bezoekers gemeentehuis of bibliotheek." + "iedereen - vooral bezoekers gemeentehuis of bibliotheek.", ].indexOf(audience.toLowerCase()) >= 0 ) { return "yes" @@ -522,7 +520,7 @@ export default class LinkedDataLoader { mv: "http://schema.mobivoc.org/", gr: "http://purl.org/goodrelations/v1#", vp: "https://data.velopark.be/openvelopark/vocabulary#", - vpt: "https://data.velopark.be/openvelopark/terms#" + vpt: "https://data.velopark.be/openvelopark/terms#", }, [url], undefined, @@ -543,7 +541,7 @@ export default class LinkedDataLoader { mv: "http://schema.mobivoc.org/", gr: "http://purl.org/goodrelations/v1#", vp: "https://data.velopark.be/openvelopark/vocabulary#", - vpt: "https://data.velopark.be/openvelopark/terms#" + vpt: "https://data.velopark.be/openvelopark/terms#", }, [url], "g", @@ -686,20 +684,20 @@ export default class LinkedDataLoader { const withProxyUrl = Constants.linkedDataProxy.replace("{url}", encodeURIComponent(url)) const optionalPaths: Record> = { "schema:interactionService": { - "schema:url": "website" + "schema:url": "website", }, "mv:operatedBy": { - "gr:legalName": "operator" + "gr:legalName": "operator", }, "schema:contactPoint": { "schema:email": "email", - "schema:telephone": "phone" + "schema:telephone": "phone", }, - "schema:dateModified": "_last_edit_timestamp" + "schema:dateModified": "_last_edit_timestamp", } if (includeExtras) { optionalPaths["schema:address"] = { - "schema:streetAddress": "addr" + "schema:streetAddress": "addr", } optionalPaths["schema:name"] = "name" optionalPaths["schema:description"] = "description" @@ -717,19 +715,19 @@ export default class LinkedDataLoader { "schema:geo": { "schema:latitude": "latitude", "schema:longitude": "longitude", - "schema:polygon": "shape" + "schema:polygon": "shape", }, "schema:priceSpecification": { "mv:freeOfCharge": "fee", - "schema:price": "charge" - } + "schema:price": "charge", + }, } const extra = [ "schema:priceSpecification [ mv:dueForTime [ mv:timeStartValue ?chargeStart; mv:timeEndValue ?chargeEnd; mv:timeUnit ?timeUnit ] ]", "vp:allows [vp:bicycleType ; vp:bicyclesAmount ?capacityCargobike; vp:bicycleType ?cargoBikeType]", "vp:allows [vp:bicycleType ; vp:bicyclesAmount ?capacityElectric; vp:bicycleType ?electricBikeType]", - "vp:allows [vp:bicycleType ; vp:bicyclesAmount ?capacityTandem; vp:bicycleType ?tandemBikeType]" + "vp:allows [vp:bicycleType ; vp:bicyclesAmount ?capacityTandem; vp:bicycleType ?tandemBikeType]", ] const unpatched = await this.fetchEntry( diff --git a/src/Logic/Web/MangroveReviews.ts b/src/Logic/Web/MangroveReviews.ts index a8d694660..c44665824 100644 --- a/src/Logic/Web/MangroveReviews.ts +++ b/src/Logic/Web/MangroveReviews.ts @@ -206,23 +206,29 @@ export default class FeatureReviews { this.subjectUri = this.ConstructSubjectUri() - this.subjectUri.addCallbackAndRunD(async (sub) => { - const reviews = await MangroveReviews.getReviews({ sub }) - console.log("Got reviews for", feature, reviews, sub) - this.addReviews(reviews.reviews, this._name.data) - }, [this._name]) + this.subjectUri.addCallbackAndRunD( + async (sub) => { + const reviews = await MangroveReviews.getReviews({ sub }) + console.log("Got reviews for", feature, reviews, sub) + this.addReviews(reviews.reviews, this._name.data) + }, + [this._name] + ) /* We also construct all subject queries _without_ encoding the name to work around a previous bug * See https://github.com/giggls/opencampsitemap/issues/30 */ - this.ConstructSubjectUri(true).mapD(async (sub) => { - try { - const reviews = await MangroveReviews.getReviews({ sub }) - console.log("Got reviews (no-encode) for", feature, reviews, sub) - this.addReviews(reviews.reviews, this._name.data) - } catch (e) { - console.log("Could not fetch reviews for partially incorrect query ", sub) - } - }, [this._name]) + this.ConstructSubjectUri(true).mapD( + async (sub) => { + try { + const reviews = await MangroveReviews.getReviews({ sub }) + console.log("Got reviews (no-encode) for", feature, reviews, sub) + this.addReviews(reviews.reviews, this._name.data) + } catch (e) { + console.log("Could not fetch reviews for partially incorrect query ", sub) + } + }, + [this._name] + ) this.average = this._reviews.map((reviews) => { if (!reviews) { return null @@ -321,7 +327,10 @@ export default class FeatureReviews { * @param reviews * @private */ - private addReviews(reviews: { payload: Review; kid: string; signature: string }[], expectedName: string) { + private addReviews( + reviews: { payload: Review; kid: string; signature: string }[], + expectedName: string + ) { const alreadyKnown = new Set(this._reviews.data.map((r) => r.rating + " " + r.opinion)) let hasNew = false @@ -333,20 +342,17 @@ export default class FeatureReviews { if (url.protocol !== "geo:") { continue } - const coordinate = <[number, number]>( - url.pathname.split(",").map((n) => Number(n)) - ) - const distance = GeoOperations.distanceBetween( - [this._lat, this._lon], - coordinate - ) + const coordinate = <[number, number]>url.pathname.split(",").map((n) => Number(n)) + const distance = GeoOperations.distanceBetween([this._lat, this._lon], coordinate) if (distance > this._uncertainty) { continue } - const nameUrl = url.searchParams.get("q") - const distanceName = Utils.levenshteinDistance(nameUrl.toLowerCase(), expectedName.toLowerCase()) / expectedName.length + const nameUrl = url.searchParams.get("q") + const distanceName = + Utils.levenshteinDistance(nameUrl.toLowerCase(), expectedName.toLowerCase()) / + expectedName.length - if(distanceName > 0.25){ + if (distanceName > 0.25) { // Then name is wildly different continue } @@ -356,7 +362,6 @@ export default class FeatureReviews { continue } - const key = review.rating + " " + review.opinion if (alreadyKnown.has(key)) { continue diff --git a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts index 5898a9b69..7d41da4d6 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts @@ -7,12 +7,12 @@ import { FirstOf, Fuse, On, - SetDefault + SetDefault, } from "./Conversion" import { LayerConfigJson } from "../Json/LayerConfigJson" import { MinimalTagRenderingConfigJson, - TagRenderingConfigJson + TagRenderingConfigJson, } from "../Json/TagRenderingConfigJson" import { Utils } from "../../../Utils" import RewritableConfigJson from "../Json/RewritableConfigJson" @@ -85,17 +85,17 @@ class ExpandFilter extends DesugaringStep { } const options = matchingTr.mappings.map((mapping) => ({ question: mapping.then, - osmTags: mapping.if + osmTags: mapping.if, })) options.unshift({ question: { - en: "All types" + en: "All types", }, - osmTags: undefined + osmTags: undefined, }) newFilters.push({ id: filter, - options + options, }) continue } @@ -134,9 +134,9 @@ class ExpandFilter extends DesugaringStep { .enter(filter) .err( "While searching for predefined filter " + - filter + - ": this filter is not found. Perhaps you meant one of: " + - suggestions + filter + + ": this filter is not found. Perhaps you meant one of: " + + suggestions ) } newFilters.push(found) @@ -149,9 +149,9 @@ class ExpandTagRendering extends Conversion< | string | TagRenderingConfigJson | { - builtin: string | string[] - override: any -}, + builtin: string | string[] + override: any + }, TagRenderingConfigJson[] > { private readonly _state: DesugaringContext @@ -340,25 +340,25 @@ class ExpandTagRendering extends Conversion< ctx.warn( `A literal rendering was detected: ${tr} Did you perhaps forgot to add a layer name as 'layername.${tr}'? ` + - Array.from(state.sharedLayers.keys()).join(", ") + Array.from(state.sharedLayers.keys()).join(", ") ) } if (this._options?.noHardcodedStrings && this._state?.sharedLayers?.size > 0) { ctx.err( "Detected an invocation to a builtin tagRendering, but this tagrendering was not found: " + - tr + - " \n Did you perhaps forget to add the layer as prefix, such as `icons." + - tr + - "`? " + tr + + " \n Did you perhaps forget to add the layer as prefix, such as `icons." + + tr + + "`? " ) } return [ { render: tr, - id: tr.replace(/[^a-zA-Z0-9]/g, "") - } + id: tr.replace(/[^a-zA-Z0-9]/g, ""), + }, ] } return lookup @@ -385,9 +385,9 @@ class ExpandTagRendering extends Conversion< } ctx.err( "An object calling a builtin can only have keys `builtin` or `override`, but a key with name `" + - key + - "` was found. This won't be picked up! The full object is: " + - JSON.stringify(tr) + key + + "` was found. This won't be picked up! The full object is: " + + JSON.stringify(tr) ) } @@ -411,19 +411,19 @@ class ExpandTagRendering extends Conversion< if (state.sharedLayers.size === 0) { ctx.warn( "BOOTSTRAPPING. Rerun generate layeroverview. While reusing tagrendering: " + - name + - ": layer " + - layerName + - " not found for now, but ignoring as this is a bootstrapping run. " + name + + ": layer " + + layerName + + " not found for now, but ignoring as this is a bootstrapping run. " ) } else { ctx.err( ": While reusing tagrendering: " + - name + - ": layer " + - layerName + - " not found. Maybe you meant one of " + - candidates.slice(0, 3).join(", ") + name + + ": layer " + + layerName + + " not found. Maybe you meant one of " + + candidates.slice(0, 3).join(", ") ) } continue @@ -435,10 +435,10 @@ class ExpandTagRendering extends Conversion< candidates = Utils.sortedByLevenshteinDistance(name, candidates, (i) => i) ctx.err( "The tagRendering with identifier " + - name + - " was not found.\n\tDid you mean one of " + - candidates.join(", ") + - "?\n(Hint: did you add a new label and are you trying to use this label at the same time? Run 'reset:layeroverview' first" + name + + " was not found.\n\tDid you mean one of " + + candidates.join(", ") + + "?\n(Hint: did you add a new label and are you trying to use this label at the same time? Run 'reset:layeroverview' first" ) continue } @@ -492,7 +492,7 @@ class DetectInline extends DesugaringStep { if (json.freeform.inline === true) { context.err( "'inline' is set, but the rendering contains a special visualisation...\n " + - spec[key] + spec[key] ) } json = JSON.parse(JSON.stringify(json)) @@ -578,20 +578,20 @@ export class AddQuestionBox extends DesugaringStep { if (blacklisted?.length > 0 && used?.length > 0) { context.err( "The {questions()}-special rendering only supports either a blacklist OR a whitelist, but not both." + - "\n Whitelisted: " + - used.join(", ") + - "\n Blacklisted: " + - blacklisted.join(", ") + "\n Whitelisted: " + + used.join(", ") + + "\n Blacklisted: " + + blacklisted.join(", ") ) } for (const usedLabel of used) { if (!allLabels.has(usedLabel)) { context.err( "This layers specifies a special question element for label `" + - usedLabel + - "`, but this label doesn't exist.\n" + - " Available labels are " + - Array.from(allLabels).join(", ") + usedLabel + + "`, but this label doesn't exist.\n" + + " Available labels are " + + Array.from(allLabels).join(", ") ) } seen.add(usedLabel) @@ -605,8 +605,8 @@ export class AddQuestionBox extends DesugaringStep { const question: QuestionableTagRenderingConfigJson = { id: "leftover-questions", render: { - "*": `{questions( ,${Array.from(seen).join(";")})}` - } + "*": `{questions( ,${Array.from(seen).join(";")})}`, + }, } json.tagRenderings.push(question) } @@ -626,11 +626,11 @@ export class AddEditingElements extends DesugaringStep { "all_tags", "qr_code", "nearby_images", - "linked_open_data" + "linked_open_data", ] private readonly _desugaring: DesugaringContext - private readonly _addedByDefaultAtTop : QuestionableTagRenderingConfigJson[] + private readonly _addedByDefaultAtTop: QuestionableTagRenderingConfigJson[] private readonly _addedByDefault: QuestionableTagRenderingConfigJson[] constructor(desugaring: DesugaringContext) { super( @@ -643,17 +643,14 @@ export class AddEditingElements extends DesugaringStep { const builtinQuestions = Array.from(this._desugaring.tagRenderings?.values() ?? []) function getAddedByDefaultIds(key: string): QuestionableTagRenderingConfigJson[] { - const addByDefault = builtinQuestions.filter(tr => tr.labels?.indexOf(key) >= 0) - const ids = new Set(addByDefault.map(tr => tr.id)) - const idsInOrder = desugaring.tagRenderingOrder?.filter(id => ids.has(id)) ?? [] - return Utils.NoNull(idsInOrder.map(id => desugaring.tagRenderings.get(id))) + const addByDefault = builtinQuestions.filter((tr) => tr.labels?.indexOf(key) >= 0) + const ids = new Set(addByDefault.map((tr) => tr.id)) + const idsInOrder = desugaring.tagRenderingOrder?.filter((id) => ids.has(id)) ?? [] + return Utils.NoNull(idsInOrder.map((id) => desugaring.tagRenderings.get(id))) } this._addedByDefaultAtTop = getAddedByDefaultIds("added_by_default_top") this._addedByDefault = getAddedByDefaultIds("added_by_default") - - - } convert(json: LayerConfigJson, _: ConversionContext): LayerConfigJson { @@ -681,7 +678,7 @@ export class AddEditingElements extends DesugaringStep { /***** ADD TO TOP ****/ - json.tagRenderings.unshift(...this._addedByDefaultAtTop.filter(tr => !allIds.has(tr.id))) + json.tagRenderings.unshift(...this._addedByDefaultAtTop.filter((tr) => !allIds.has(tr.id))) /***** ADD TO BOTTOM ****/ @@ -689,10 +686,11 @@ export class AddEditingElements extends DesugaringStep { json.tagRenderings.push(this._desugaring.tagRenderings.get("minimap")) } - if(usedSpecialFunctions.has("image_upload") && - !usedSpecialFunctions.has("nearby_images")){ + if ( + usedSpecialFunctions.has("image_upload") && + !usedSpecialFunctions.has("nearby_images") + ) { json.tagRenderings.push(this._desugaring.tagRenderings.get("nearby_images")) - } if (json.allowSplit && !usedSpecialFunctions.has("split_button")) { @@ -703,18 +701,17 @@ export class AddEditingElements extends DesugaringStep { if (json.allowMove && !usedSpecialFunctions.has("move_button")) { json.tagRenderings.push({ id: "move-button", - render: { "*": "{move_button()}" } + render: { "*": "{move_button()}" }, }) } if (json.deletion && !usedSpecialFunctions.has("delete_button")) { json.tagRenderings.push({ id: "delete-button", - render: { "*": "{delete_button()}" } + render: { "*": "{delete_button()}" }, }) } - - json.tagRenderings.push(...this._addedByDefault.filter(tr => !allIds.has(tr.id))) + json.tagRenderings.push(...this._addedByDefault.filter((tr) => !allIds.has(tr.id))) if (!usedSpecialFunctions.has("all_tags")) { const trc: QuestionableTagRenderingConfigJson = { @@ -725,9 +722,9 @@ export class AddEditingElements extends DesugaringStep { or: [ "__featureSwitchIsDebugging=true", "mapcomplete-show_tags=full", - "mapcomplete-show_debug=yes" - ] - } + "mapcomplete-show_debug=yes", + ], + }, } json.tagRenderings?.push(trc) } @@ -749,9 +746,9 @@ export class RewriteSpecial extends DesugaringStep { } private static escapeStr(v: string, context: ConversionContext): string { - if(typeof v !== "string"){ - context.err("Detected a non-string value where one expected a string: "+v) - return RewriteSpecial.escapeStr(""+v, context) + if (typeof v !== "string") { + context.err("Detected a non-string value where one expected a string: " + v) + return RewriteSpecial.escapeStr("" + v, context) } return v .replace(/,/g, "&COMMA") @@ -835,10 +832,10 @@ export class RewriteSpecial extends DesugaringStep { private static convertIfNeeded( input: | (object & { - special: { - type: string - } - }) + special: { + type: string + } + }) | any, context: ConversionContext ): any { @@ -924,7 +921,6 @@ export class RewriteSpecial extends DesugaringStep { const after = Translations.T(input.after) const clss: string = input.class !== undefined ? ":" + input.class : "" - for (const ln of Object.keys(before?.translations ?? {})) { foundLanguages.add(ln) } @@ -937,7 +933,7 @@ export class RewriteSpecial extends DesugaringStep { .map((nm) => RewriteSpecial.escapeStr(special[nm] ?? "", context)) .join(",") return { - "*": `{${type}(${args})${clss}}` + "*": `{${type}(${args})${clss}}`, } } @@ -962,7 +958,9 @@ export class RewriteSpecial extends DesugaringStep { } const beforeText = before?.textFor(ln) ?? "" const afterText = after?.textFor(ln) ?? "" - result[ln] = `${beforeText}{${type}(${args.map((a) => a).join(",")})${clss}}${afterText}` + result[ln] = `${beforeText}{${type}(${args + .map((a) => a) + .join(",")})${clss}}${afterText}` } return result } @@ -1049,7 +1047,7 @@ class ExpandIconBadges extends DesugaringStep { iconBadges.push( ...expanded.map((resolved) => ({ if: iconBadge.if, - then: resolved + then: resolved, })) ) } @@ -1186,7 +1184,7 @@ export class AddRatingBadge extends DesugaringStep { const specialVis: Exclude[] = < Exclude[] - >ValidationUtils.getAllSpecialVisualisations(json.tagRenderings).filter( + >ValidationUtils.getAllSpecialVisualisations(json.tagRenderings).filter( (rs) => typeof rs !== "string" ) const funcs = new Set(specialVis.map((rs) => rs.func.funcName)) @@ -1222,7 +1220,7 @@ export class AutoTitleIcon extends DesugaringStep { } return { id: "title_icon_auto_" + tr.id, - mappings + mappings, } } @@ -1267,8 +1265,8 @@ export class AutoTitleIcon extends DesugaringStep { .enters("titleIcons", i) .warn( "TagRendering with id " + - trId + - " does not have any icons, not generating an icon for this" + trId + + " does not have any icons, not generating an icon for this" ) continue } @@ -1292,7 +1290,7 @@ export class PrepareLayer extends Fuse { (layer) => new Concat( new ExpandTagRendering(state, layer, { - addToContext: options?.addTagRenderingsToContext ?? false + addToContext: options?.addTagRenderingsToContext ?? false, }) ) ), diff --git a/src/Models/ThemeConfig/LayerConfig.ts b/src/Models/ThemeConfig/LayerConfig.ts index 9babbb96b..3d7d1a14c 100644 --- a/src/Models/ThemeConfig/LayerConfig.ts +++ b/src/Models/ThemeConfig/LayerConfig.ts @@ -278,8 +278,7 @@ export default class LayerConfig extends WithContextLoader { ) } this.units = (json.units ?? []).flatMap((unitJson, i) => - Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`) - + Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`) ) if ( diff --git a/src/Models/ThemeConfig/PointRenderingConfig.ts b/src/Models/ThemeConfig/PointRenderingConfig.ts index 8faace7fd..f7fddf164 100644 --- a/src/Models/ThemeConfig/PointRenderingConfig.ts +++ b/src/Models/ThemeConfig/PointRenderingConfig.ts @@ -205,7 +205,7 @@ export default class PointRenderingConfig extends WithContextLoader { marker: this.marker, rotation: this.rotation, tags, - emojiHeight: iconH + emojiHeight: iconH, }).SetClass("w-full h-full") : undefined let badges = undefined diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 180149d40..2db0b6c91 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -8,7 +8,7 @@ import { Tag } from "../../Logic/Tags/Tag" import Link from "../../UI/Base/Link" import { MappingConfigJson, - QuestionableTagRenderingConfigJson + QuestionableTagRenderingConfigJson, } from "./Json/QuestionableTagRenderingConfigJson" import Validators, { ValidatorType } from "../../UI/InputElement/Validators" import { TagRenderingConfigJson } from "./Json/TagRenderingConfigJson" @@ -202,7 +202,7 @@ export default class TagRenderingConfig { ) ?? [], inline: json.freeform.inline ?? false, default: json.freeform.default, - postfixDistinguished: json.freeform.postfixDistinguished?.trim() + postfixDistinguished: json.freeform.postfixDistinguished?.trim(), } if (json.freeform["extraTags"] !== undefined) { throw `Freeform.extraTags is defined. This should probably be 'freeform.addExtraTag' (at ${context})` @@ -414,7 +414,7 @@ export default class TagRenderingConfig { iconClass, addExtraTags, searchTerms: mapping.searchTerms, - priorityIf: prioritySearch + priorityIf: prioritySearch, } if (isQuestionable) { if (hideInAnswer !== true && mp.if !== undefined && !mp.if.isUsableAsAnswer()) { @@ -515,7 +515,7 @@ export default class TagRenderingConfig { then: new TypedTranslation( this.render.replace("{" + this.freeform.key + "}", leftover).translations, this.render.context - ) + ), }) } } @@ -565,7 +565,7 @@ export default class TagRenderingConfig { return { then: this.render.PartialSubs({ [this.freeform.key]: v.trim() }), icon: this.renderIcon, - iconClass: this.renderIconClass + iconClass: this.renderIconClass, } } } @@ -620,7 +620,7 @@ export default class TagRenderingConfig { key: commonKey, values: Utils.NoNull( values.map((arr) => arr.filter((item) => item.k === commonKey)[0]?.v) - ) + ), } } @@ -635,7 +635,7 @@ export default class TagRenderingConfig { return { key, type: this.freeform.type, - values + values, } } catch (e) { console.error("Could not create FreeformValues for tagrendering", this.id) @@ -741,7 +741,7 @@ export default class TagRenderingConfig { // Either no mappings, or this is a radio-button selected freeform value const tag = new And([ new Tag(this.freeform.key, freeformValue), - ...(this.freeform.addExtraTags ?? []) + ...(this.freeform.addExtraTags ?? []), ]) const newProperties = tag.applyOn(currentProperties) if (this.invalidValues?.matchesProperties(newProperties)) { @@ -765,7 +765,7 @@ export default class TagRenderingConfig { selectedMappings.push( new And([ new Tag(this.freeform.key, freeformValue), - ...(this.freeform.addExtraTags ?? []) + ...(this.freeform.addExtraTags ?? []), ]) ) } @@ -793,12 +793,12 @@ export default class TagRenderingConfig { if (useFreeform) { return new And([ new Tag(this.freeform.key, freeformValue), - ...(this.freeform.addExtraTags ?? []) + ...(this.freeform.addExtraTags ?? []), ]) } else if (singleSelectedMapping !== undefined) { return new And([ this.mappings[singleSelectedMapping].if, - ...(this.mappings[singleSelectedMapping].addExtraTags ?? []) + ...(this.mappings[singleSelectedMapping].addExtraTags ?? []), ]) } else { console.error("TagRenderingConfig.ConstructSpecification has a weird fallback for", { @@ -806,7 +806,7 @@ export default class TagRenderingConfig { singleSelectedMapping, multiSelectedMapping, currentProperties, - useFreeform + useFreeform, }) return undefined @@ -819,7 +819,7 @@ export default class TagRenderingConfig { withRender = [ `This rendering asks information about the property `, Link.OsmWiki(this.freeform.key).AsMarkdown(), - "This is rendered with `" + this.render.txt + "`" + "This is rendered with `" + this.render.txt + "`", ] } @@ -829,14 +829,18 @@ export default class TagRenderingConfig { this.mappings.flatMap((m) => { let icon = "" if (m.icon?.indexOf(";") < 0) { - icon = "" + icon = + "" } const msgs: string[] = [ - icon + " " + - "*" + - m.then.txt + - "* corresponds with " + - m.if.asHumanString(true, false, {}) + icon + + " " + + "*" + + m.then.txt + + "* corresponds with " + + m.if.asHumanString(true, false, {}), ] if (m.hideInAnswer === true) { @@ -845,7 +849,7 @@ export default class TagRenderingConfig { if (m.ifnot !== undefined) { msgs.push( "Unselecting this answer will add " + - m.ifnot.asHumanString(true, false, {}) + m.ifnot.asHumanString(true, false, {}) ) } return msgs @@ -869,7 +873,7 @@ export default class TagRenderingConfig { if (this.labels?.length > 0) { labels = [ "This tagrendering has labels ", - ...this.labels.map((label) => "`" + label + "`") + ...this.labels.map((label) => "`" + label + "`"), ].join("\n") } @@ -882,7 +886,7 @@ export default class TagRenderingConfig { withRender.join("\n"), mappings, condition, - labels + labels, ].join("\n") } @@ -942,7 +946,7 @@ export class TagRenderingConfigUtils { const oldMappingsCloned = clone.mappings?.map((m) => ({ ...m, - priorityIf: m.priorityIf ?? TagUtils.Tag("id~*") + priorityIf: m.priorityIf ?? TagUtils.Tag("id~*"), })) ?? [] clone.mappings = [...oldMappingsCloned, ...extraMappings] return clone diff --git a/src/Models/ThemeViewState.ts b/src/Models/ThemeViewState.ts index 7801fc214..fea45494b 100644 --- a/src/Models/ThemeViewState.ts +++ b/src/Models/ThemeViewState.ts @@ -5,7 +5,7 @@ import { Store, UIEventSource } from "../Logic/UIEventSource" import { FeatureSource, IndexedFeatureSource, - WritableFeatureSource + WritableFeatureSource, } from "../Logic/FeatureSource/FeatureSource" import { OsmConnection } from "../Logic/Osm/OsmConnection" import { ExportableMap, MapProperties } from "./MapProperties" @@ -51,7 +51,7 @@ import SaveFeatureSourceToLocalStorage from "../Logic/FeatureSource/Actors/SaveF import BBoxFeatureSource from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource" import ThemeViewStateHashActor from "../Logic/Web/ThemeViewStateHashActor" import NoElementsInViewDetector, { - FeatureViewState + FeatureViewState, } from "../Logic/Actors/NoElementsInViewDetector" import FilteredLayer from "./FilteredLayer" import { PreferredRasterLayerSelector } from "../Logic/Actors/PreferredRasterLayerSelector" @@ -64,7 +64,7 @@ import { GeolocationControlState } from "../UI/BigComponents/GeolocationControl" import Zoomcontrol from "../UI/Zoomcontrol" import { SummaryTileSource, - SummaryTileSourceRewriter + SummaryTileSourceRewriter, } from "../Logic/FeatureSource/TiledFeatureSource/SummaryTileSource" import summaryLayer from "../assets/generated/layers/summary.json" import last_click_layerconfig from "../assets/generated/layers/last_click.json" @@ -165,7 +165,6 @@ export default class ThemeViewState implements SpecialVisualizationState { const initial = new InitialMapPositioning(layout, geolocationState) this.mapProperties = new MapLibreAdaptor(this.map, initial) - this.featureSwitchIsTesting = this.featureSwitches.featureSwitchIsTesting this.featureSwitchUserbadge = this.featureSwitches.featureSwitchEnableLogin @@ -176,7 +175,7 @@ export default class ThemeViewState implements SpecialVisualizationState { "oauth_token", undefined, "Used to complete the login" - ) + ), }) this.userRelatedState = new UserRelatedState( this.osmConnection, @@ -251,8 +250,8 @@ export default class ThemeViewState implements SpecialVisualizationState { bbox.asGeoJson({ zoom: this.mapProperties.zoom.data, ...this.mapProperties.location.data, - id: "current_view_" + currentViewIndex - }) + id: "current_view_" + currentViewIndex, + }), ] }) ) @@ -269,7 +268,7 @@ export default class ThemeViewState implements SpecialVisualizationState { featurePropertiesStore: this.featureProperties, osmConnection: this.osmConnection, historicalUserLocations: this.geolocation.historicalUserLocations, - featureSwitches: this.featureSwitches + featureSwitches: this.featureSwitches, }, layout?.isLeftRightSensitive() ?? false ) @@ -296,7 +295,7 @@ export default class ThemeViewState implements SpecialVisualizationState { "leftover features, such as", features[0].properties ) - } + }, } ) this.perLayer = perLayer.perLayer @@ -334,7 +333,10 @@ export default class ThemeViewState implements SpecialVisualizationState { return sorted }) - this.lastClickObject = new LastClickFeatureSource(this.layout, this.mapProperties.lastClickLocation) + this.lastClickObject = new LastClickFeatureSource( + this.layout, + this.mapProperties.lastClickLocation + ) this.osmObjectDownloader = new OsmObjectDownloader( this.osmConnection.Backend(), @@ -348,7 +350,7 @@ export default class ThemeViewState implements SpecialVisualizationState { { currentZoom: this.mapProperties.zoom, layerState: this.layerState, - bounds: this.visualFeedbackViewportBounds + bounds: this.visualFeedbackViewportBounds, } ) this.hasDataInView = new NoElementsInViewDetector(this).hasFeatureInView @@ -440,7 +442,7 @@ export default class ThemeViewState implements SpecialVisualizationState { doShowLayer, metaTags: this.userRelatedState.preferencesAsTags, selectedElement: this.selectedElement, - fetchStore: (id) => this.featureProperties.getStore(id) + fetchStore: (id) => this.featureProperties.getStore(id), }) }) return filteringFeatureSource @@ -464,7 +466,7 @@ export default class ThemeViewState implements SpecialVisualizationState { doShowLayer: flayerGps.isDisplayed, layer: flayerGps.layerDef, metaTags: this.userRelatedState.preferencesAsTags, - selectedElement: this.selectedElement + selectedElement: this.selectedElement, }) } @@ -556,7 +558,7 @@ export default class ThemeViewState implements SpecialVisualizationState { Hotkeys.RegisterHotkey( { nomod: " ", - onUp: true + onUp: true, }, docs.selectItem, () => { @@ -586,7 +588,7 @@ export default class ThemeViewState implements SpecialVisualizationState { Hotkeys.RegisterHotkey( { nomod: "" + i, - onUp: true + onUp: true, }, doc, () => this.selectClosestAtCenter(i - 1) @@ -599,7 +601,7 @@ export default class ThemeViewState implements SpecialVisualizationState { } Hotkeys.RegisterHotkey( { - nomod: "b" + nomod: "b", }, docs.openLayersPanel, () => { @@ -610,7 +612,7 @@ export default class ThemeViewState implements SpecialVisualizationState { ) Hotkeys.RegisterHotkey( { - nomod: "s" + nomod: "s", }, Translations.t.hotkeyDocumentation.openFilterPanel, () => { @@ -668,7 +670,7 @@ export default class ThemeViewState implements SpecialVisualizationState { Hotkeys.RegisterHotkey( { - shift: "T" + shift: "T", }, Translations.t.hotkeyDocumentation.translationMode, () => { @@ -700,7 +702,7 @@ export default class ThemeViewState implements SpecialVisualizationState { this.mapProperties.zoom.map((z) => Math.max(Math.floor(z), 0)), this.mapProperties, { - isActive: this.mapProperties.zoom.map((z) => z <= maxzoom) + isActive: this.mapProperties.zoom.map((z) => z <= maxzoom), } ) return new SummaryTileSourceRewriter(summaryTileSource, this.layerState.filteredLayers) @@ -715,10 +717,7 @@ export default class ThemeViewState implements SpecialVisualizationState { /** * A listing which maps the layerId onto the featureSource */ - const specialLayers: Record< - AddedByDefaultTypes | "current_view", - FeatureSource - > = { + const specialLayers: Record = { home_location: this.userRelatedState.homeLocation, gps_location: this.geolocation.currentUserLocation, gps_location_history: this.geolocation.historicalUserLocations, @@ -734,7 +733,7 @@ export default class ThemeViewState implements SpecialVisualizationState { current_view: this.currentView, favourite: this.favourites, summary: this.featureSummary, - last_click: this.lastClickObject + last_click: this.lastClickObject, } this.closestFeatures.registerSource(specialLayers.favourite, "favourite") @@ -789,7 +788,7 @@ export default class ThemeViewState implements SpecialVisualizationState { doShowLayer: flayer.isDisplayed, layer: flayer.layerDef, metaTags: this.userRelatedState.preferencesAsTags, - selectedElement: this.selectedElement + selectedElement: this.selectedElement, }) }) @@ -797,23 +796,29 @@ export default class ThemeViewState implements SpecialVisualizationState { features: specialLayers.summary, layer: new LayerConfig(summaryLayer, "summaryLayer"), // doShowLayer: this.mapProperties.zoom.map((z) => z < maxzoom), - selectedElement: this.selectedElement + selectedElement: this.selectedElement, }) - const lastClickLayerConfig = new LayerConfig(last_click_layerconfig, "last_click") + const lastClickLayerConfig = new LayerConfig( + last_click_layerconfig, + "last_click" + ) const lastClickFiltered = - lastClickLayerConfig.isShown === undefined ? specialLayers.last_click : - specialLayers.last_click.features.mapD(fs => - fs.filter( - f => { - const matches = lastClickLayerConfig.isShown.matchesProperties(f.properties) - console.log("LastClick ",f,"matches",matches) - return matches - })) + lastClickLayerConfig.isShown === undefined + ? specialLayers.last_click + : specialLayers.last_click.features.mapD((fs) => + fs.filter((f) => { + const matches = lastClickLayerConfig.isShown.matchesProperties( + f.properties + ) + console.log("LastClick ", f, "matches", matches) + return matches + }) + ) new ShowDataLayer(this.map, { features: new StaticFeatureSource(lastClickFiltered), layer: lastClickLayerConfig, - onClick: feature => { + onClick: (feature) => { console.log("Last click was clicked", feature) if (this.mapProperties.zoom.data >= Constants.minZoomLevelToAddNewPoint) { this.selectedElement.setData(feature) @@ -821,9 +826,9 @@ export default class ThemeViewState implements SpecialVisualizationState { } this.map.data.flyTo({ zoom: Constants.minZoomLevelToAddNewPoint, - center: GeoOperations.centerpointCoordinates(feature) + center: GeoOperations.centerpointCoordinates(feature), }) - } + }, }) } diff --git a/src/Models/Unit.ts b/src/Models/Unit.ts index f1666b57e..3d1435c3f 100644 --- a/src/Models/Unit.ts +++ b/src/Models/Unit.ts @@ -27,9 +27,19 @@ export class Unit { ) { this.quantity = quantity this._validator = validator - if(!inverted && ["string","text","key","icon","translation","fediverse","id"].indexOf(validator.name) >= 0){ + if ( + !inverted && + ["string", "text", "key", "icon", "translation", "fediverse", "id"].indexOf( + validator.name + ) >= 0 + ) { console.trace("Unit error") - throw "Invalid unit configuration. The validator is of a forbidden type: "+validator.name+"; set a (number) type to your freeform key or set inverted. Hint: this unit is applied onto keys: "+appliesToKeys.join("; ") + throw ( + "Invalid unit configuration. The validator is of a forbidden type: " + + validator.name + + "; set a (number) type to your freeform key or set inverted. Hint: this unit is applied onto keys: " + + appliesToKeys.join("; ") + ) } this.inverted = inverted this.appliesToKeys = new Set(appliesToKeys) diff --git a/src/UI/AllThemesGui.svelte b/src/UI/AllThemesGui.svelte index a9bc4e6d8..5ef42ad7e 100644 --- a/src/UI/AllThemesGui.svelte +++ b/src/UI/AllThemesGui.svelte @@ -84,18 +84,18 @@ - @@ -146,48 +146,47 @@ -

- -

- +

+ +

+ - - - - - - - - - + + + + + + + + + - - - - + + + + - - - - + + + + - - - - - - - - - - + + + + + + + + + diff --git a/src/UI/Base/FloatOver.svelte b/src/UI/Base/FloatOver.svelte index 90fccacf3..0b09db3b4 100644 --- a/src/UI/Base/FloatOver.svelte +++ b/src/UI/Base/FloatOver.svelte @@ -20,10 +20,18 @@ style="background-color: #00000088; z-index: 20" /> -
{ - console.log("Closing...") - dispatch("close")}}> -
{}}> +
{ + console.log("Closing...") + dispatch("close") + }} +> +
{}} + >
diff --git a/src/UI/BigComponents/Filterview.svelte b/src/UI/BigComponents/Filterview.svelte index eb55667b4..0ff711543 100644 --- a/src/UI/BigComponents/Filterview.svelte +++ b/src/UI/BigComponents/Filterview.svelte @@ -38,8 +38,6 @@ function getStateFor(option: FilterConfig): UIEventSource { return filteredLayer.appliedFilters.get(option.id) } - - {#if filteredLayer.layerDef.name} diff --git a/src/UI/BigComponents/MoreScreen.ts b/src/UI/BigComponents/MoreScreen.ts index 380948cda..5531ee056 100644 --- a/src/UI/BigComponents/MoreScreen.ts +++ b/src/UI/BigComponents/MoreScreen.ts @@ -27,9 +27,8 @@ export default class MoreScreen { if (searchTerm === "osmcha" || searchTerm === "stats") { window.location.href = Utils.OsmChaLinkFor(7) } - if (searchTerm === "studio" ) { + if (searchTerm === "studio") { window.location.href = "./studio.html" - } // Enter pressed -> search the first _official_ matchin theme and open it const publicTheme = MoreScreen.officialThemes.find( diff --git a/src/UI/BigComponents/SelectedElementView.svelte b/src/UI/BigComponents/SelectedElementView.svelte index fd30301a0..152745fe8 100644 --- a/src/UI/BigComponents/SelectedElementView.svelte +++ b/src/UI/BigComponents/SelectedElementView.svelte @@ -21,9 +21,9 @@ selectedElement.properties.id ) - function getLayer(properties: Record){ - if(properties.id === "settings"){ - return UserRelatedState.usersettingsConfig + function getLayer(properties: Record) { + if (properties.id === "settings") { + return UserRelatedState.usersettingsConfig } if (properties.id === "new_point_dialog") { return state.layout.layers.find((l) => l.id === "last_click") @@ -36,7 +36,6 @@ let layer: LayerConfig = getLayer(selectedElement.properties) - let stillMatches = tags.map( (tags) => !layer?.source?.osmTags || layer.source.osmTags?.matchesProperties(tags) ) diff --git a/src/UI/BigComponents/ThemeButton.svelte b/src/UI/BigComponents/ThemeButton.svelte index cc5f86db1..9148d9844 100644 --- a/src/UI/BigComponents/ThemeButton.svelte +++ b/src/UI/BigComponents/ThemeButton.svelte @@ -86,12 +86,12 @@ {#if theme.id !== personal.id || $unlockedPersonal} - - + + - + - + {#if selected}
- - +
diff --git a/src/UI/Comparison/ComparisonAction.svelte b/src/UI/Comparison/ComparisonAction.svelte index dc3a124d5..c549eed08 100644 --- a/src/UI/Comparison/ComparisonAction.svelte +++ b/src/UI/Comparison/ComparisonAction.svelte @@ -67,7 +67,7 @@
-
+
{#if renderingExternal} > constructor(tags: UIEventSource, externalProperties: Record) { - externalProperties = { ...externalProperties } delete externalProperties["@context"] @@ -74,7 +73,7 @@ export class ComparisonState { ) this.hasDifferencesAtStart = - this. different.data.length + this.missing.data.length + this.unknownImages.data.length > 0 - + this.different.data.length + this.missing.data.length + this.unknownImages.data.length > + 0 } } diff --git a/src/UI/Comparison/ComparisonTable.svelte b/src/UI/Comparison/ComparisonTable.svelte index 1aa70517b..9c20fb2bf 100644 --- a/src/UI/Comparison/ComparisonTable.svelte +++ b/src/UI/Comparison/ComparisonTable.svelte @@ -27,11 +27,11 @@ export let readonly = false - export let comparisonState : ComparisonState + export let comparisonState: ComparisonState let missing = comparisonState.missing let unknownImages = comparisonState.unknownImages let knownImages = comparisonState.knownImages - let different =comparisonState.different + let different = comparisonState.different const t = Translations.t.external @@ -50,27 +50,50 @@ } - {#if $unknownImages.length === 0 && $missing.length === 0 && $different.length === 0}
{:else} - {#if !readonly} - + {#if !readonly} + + {/if} + +
+ {#if $different.length > 0} + {#if !readonly} +

+ +

+ + {/if} + {#each $different as key (key)} +
+ +
+ {/each} {/if} -
- {#if $different.length > 0} - {#if !readonly} -

- -

- - {/if} - {#each $different as key (key)} -
+ {#if $missing.length > 0} + {#if !readonly} +

+ +

+ + + {/if} + {#if currentStep === "init"} + {#each $missing as key (key)} +
{/each} - {/if} - - {#if $missing.length > 0} - {#if !readonly} -

- -

- - + {#if !readonly && $missing.length > 1} + {/if} - {#if currentStep === "init"} - {#each $missing as key (key)} -
- -
- {/each} - {#if !readonly && $missing.length > 1} - - {/if} - {:else if currentStep === "applying_all"} - - {:else if currentStep === "all_applied"} -
- -
- {/if} - {/if} -
- - {#if $unknownImages.length > 0} - {#if readonly} -
-
- {#each $unknownImages as image (image)} - - {/each} -
+ {:else if currentStep === "applying_all"} + + {:else if currentStep === "all_applied"} +
+
- {:else} - {#each $unknownImages as image (image)} - - {/each} {/if} {/if} - {#if externalProperties["_last_edit_timestamp"] !== undefined} - - - +
+ + {#if $unknownImages.length > 0} + {#if readonly} +
+
+ {#each $unknownImages as image (image)} + + {/each} +
+
+ {:else} + {#each $unknownImages as image (image)} + + {/each} {/if} + {/if} + {#if externalProperties["_last_edit_timestamp"] !== undefined} + + + + {/if} {/if} diff --git a/src/UI/Comparison/ComparisonTool.svelte b/src/UI/Comparison/ComparisonTool.svelte index f72a295ca..120503b2c 100644 --- a/src/UI/Comparison/ComparisonTool.svelte +++ b/src/UI/Comparison/ComparisonTool.svelte @@ -32,17 +32,16 @@ export let collapsed: boolean const t = Translations.t.external - let comparisonState: Store = externalData.mapD(external => { + let comparisonState: Store = externalData.mapD((external) => { if (external["success"]) { return new ComparisonState(tags, external["success"]) } return undefined }) - let unknownImages = comparisonState.bindD(ct => ct.unknownImages) - let knownImages = comparisonState.bindD(ct => ct.knownImages) - let propertyKeysExternal = comparisonState.mapD(ct => ct.propertyKeysExternal) - let hasDifferencesAtStart = comparisonState.mapD(ct => ct.hasDifferencesAtStart) - + let unknownImages = comparisonState.bindD((ct) => ct.unknownImages) + let knownImages = comparisonState.bindD((ct) => ct.knownImages) + let propertyKeysExternal = comparisonState.mapD((ct) => ct.propertyKeysExternal) + let hasDifferencesAtStart = comparisonState.mapD((ct) => ct.hasDifferencesAtStart) {#if !$sourceUrl} @@ -50,7 +49,7 @@ {:else if $externalData === undefined} {:else if $externalData["error"] !== undefined} -
+
{:else if $propertyKeysExternal.length === 0 && $knownImages.size + $unknownImages.length === 0} @@ -62,7 +61,7 @@ {:else if $comparisonState !== undefined} - + - + -
+
- diff --git a/src/UI/Image/NearbyImages.svelte b/src/UI/Image/NearbyImages.svelte index 012f3296d..c6ecede29 100644 --- a/src/UI/Image/NearbyImages.svelte +++ b/src/UI/Image/NearbyImages.svelte @@ -30,7 +30,7 @@ lon, lat, allowSpherical: new UIEventSource(false), - blacklist: AllImageProviders.LoadImagesFor(tags) + blacklist: AllImageProviders.LoadImagesFor(tags), }, state.indexedFeatures ) @@ -39,7 +39,6 @@ let allDone = imagesProvider.allDone -

@@ -53,9 +52,9 @@ {:else}
{#each $images as image (image.pictureUrl)} - - - + + + {/each}
{/if} diff --git a/src/UI/Image/NearbyImagesCollapsed.svelte b/src/UI/Image/NearbyImagesCollapsed.svelte index ac40a69b0..749791b28 100644 --- a/src/UI/Image/NearbyImagesCollapsed.svelte +++ b/src/UI/Image/NearbyImagesCollapsed.svelte @@ -28,9 +28,8 @@ - - - + + + - diff --git a/src/UI/InputElement/Validators/IconValidator.ts b/src/UI/InputElement/Validators/IconValidator.ts index 27852f284..a73ea022f 100644 --- a/src/UI/InputElement/Validators/IconValidator.ts +++ b/src/UI/InputElement/Validators/IconValidator.ts @@ -16,7 +16,7 @@ export default class IconValidator extends Validator { } getFeedback(s: string, getCountry, sloppy?: boolean): Translation | undefined { - if(Utils.isEmoji(s)){ + if (Utils.isEmoji(s)) { return undefined } s = this.reformat(s) diff --git a/src/UI/Map/DynamicIcon.svelte b/src/UI/Map/DynamicIcon.svelte index 9d6ccb22e..e1987a26c 100644 --- a/src/UI/Map/DynamicIcon.svelte +++ b/src/UI/Map/DynamicIcon.svelte @@ -20,8 +20,6 @@ $: iconItem = icon.icon?.GetRenderValue($tags)?.Subs($tags)?.txt let color = icon.color?.GetRenderValue($tags)?.txt ?? "#000000" $: color = icon.color?.GetRenderValue($tags)?.txt ?? "#000000" - - {#if iconItem?.startsWith("<")} diff --git a/src/UI/Map/MapLibreAdaptor.ts b/src/UI/Map/MapLibreAdaptor.ts index 648ca7572..8aa23d974 100644 --- a/src/UI/Map/MapLibreAdaptor.ts +++ b/src/UI/Map/MapLibreAdaptor.ts @@ -39,7 +39,9 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { readonly allowMoving: UIEventSource readonly allowRotating: UIEventSource readonly allowZooming: UIEventSource - readonly lastClickLocation: Store + readonly lastClickLocation: Store< + undefined | { lon: number; lat: number; mode: "left" | "right" | "middle" } + > readonly minzoom: UIEventSource readonly maxzoom: UIEventSource readonly rotation: UIEventSource @@ -70,7 +72,7 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { this.location.setData({ ...this.location.data }) } this.zoom = state?.zoom ?? new UIEventSource(1) - this.minzoom = state?.minzoom ?? new UIEventSource(0.5)// 0.5 is the maplibre minzoom + this.minzoom = state?.minzoom ?? new UIEventSource(0.5) // 0.5 is the maplibre minzoom this.maxzoom = state?.maxzoom ?? new UIEventSource(24) this.zoom.addCallbackAndRunD((z) => { if (z < this.minzoom.data) { @@ -92,13 +94,17 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { this.rasterLayer = state?.rasterLayer ?? new UIEventSource(undefined) - const lastClickLocation = new UIEventSource<{lat:number,lon:number,mode: "left" | "right" | "middle"}>(undefined) + const lastClickLocation = new UIEventSource<{ + lat: number + lon: number + mode: "left" | "right" | "middle" + }>(undefined) this.lastClickLocation = lastClickLocation const self = this new RasterLayerHandler(this._maplibreMap, this.rasterLayer) - const clickmodes = ["left" , "middle", "right"] as const + const clickmodes = ["left", "middle", "right"] as const function handleClick(e: maplibregl.MapMouseEvent, mode?: "left" | "right" | "middle") { if (e.originalEvent["consumed"]) { // Workaround, 'ShowPointLayer' sets this flag @@ -148,8 +154,8 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { }) map._container.addEventListener("contextmenu", (e) => { - const lngLat = map.unproject([e.x, e.y]) - lastClickLocation.setData({lon: lngLat.lng, lat: lngLat.lat, mode: "right"}) + const lngLat = map.unproject([e.x, e.y]) + lastClickLocation.setData({ lon: lngLat.lng, lat: lngLat.lat, mode: "right" }) }) map.on("dblclick", (e) => { handleClick(e, "left") @@ -675,5 +681,4 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { } } } - } diff --git a/src/UI/Map/MaplibreMap.svelte b/src/UI/Map/MaplibreMap.svelte index 220c2fb43..d5121321a 100644 --- a/src/UI/Map/MaplibreMap.svelte +++ b/src/UI/Map/MaplibreMap.svelte @@ -27,7 +27,6 @@ let _map: Map onMount(() => { - const { lon, lat } = mapProperties?.location?.data ?? { lon: 0, lat: 0 } const rasterLayer: RasterLayerProperties = mapProperties?.rasterLayer?.data?.properties @@ -73,11 +72,10 @@ }) onDestroy(async () => { await Utils.waitFor(250) - try{ - - if (_map) _map.remove() - map = null - }catch (e) { + try { + if (_map) _map.remove() + map = null + } catch (e) { console.error("Could not destroy map") } }) diff --git a/src/UI/Map/Marker.svelte b/src/UI/Map/Marker.svelte index 477ad9620..c9fd47729 100644 --- a/src/UI/Map/Marker.svelte +++ b/src/UI/Map/Marker.svelte @@ -8,19 +8,21 @@ export let icons: string | { icon: string; color: string }[] let iconsParsed: { icon: string; color: string }[] - if(typeof icons === "string") { - iconsParsed = icons.split(";").map(subspec => { - if(subspec.startsWith("http://") || subspec.startsWith("https://")){ + if (typeof icons === "string") { + iconsParsed = icons.split(";").map((subspec) => { + if (subspec.startsWith("http://") || subspec.startsWith("https://")) { return { - icon: subspec, color: "black" + icon: subspec, + color: "black", } } const [icon, color] = subspec.split(":") return { - icon, color: color ?? "black" + icon, + color: color ?? "black", } }) - }else{ + } else { iconsParsed = icons } diff --git a/src/UI/Map/RasterLayerHandler.ts b/src/UI/Map/RasterLayerHandler.ts index 6cbdb636e..870b97417 100644 --- a/src/UI/Map/RasterLayerHandler.ts +++ b/src/UI/Map/RasterLayerHandler.ts @@ -97,10 +97,10 @@ class SingleBackgroundHandler { } } - private tryEnableSafe(): boolean{ + private tryEnableSafe(): boolean { try { return this.tryEnable() - }catch (e) { + } catch (e) { console.log("Error: could not enable due to error", e) return false } @@ -119,11 +119,7 @@ class SingleBackgroundHandler { console.debug("Enabling", background.id) let addLayerBeforeId = "transit_pier" // this is the first non-landuse item in the stylesheet, we add the raster layer before the roads but above the landuse if (!map.getLayer(addLayerBeforeId)) { - console.warn( - "Layer", - addLayerBeforeId, - "not found" - ) + console.warn("Layer", addLayerBeforeId, "not found") addLayerBeforeId = undefined } if (background.category === "osmbasedmap" || background.category === "map") { diff --git a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte index 096cb5a5d..dbd76bf88 100644 --- a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte +++ b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte @@ -66,7 +66,7 @@ deleteConfig.softDeletionTags, { theme: state?.layout?.id ?? "unknown", - specialMotivation: deleteReason + specialMotivation: deleteReason, }, canBeDeleted.data ) @@ -74,7 +74,7 @@ // no _delete_reason is given, which implies that this is _not_ a deletion but merely a retagging via a nonDeleteMapping actionToTake = new ChangeTagAction(featureId, selectedTags, tags.data, { theme: state?.layout?.id ?? "unkown", - changeType: "special-delete" + changeType: "special-delete", }) } @@ -87,81 +87,74 @@ {#if $canBeDeleted === false && !hasSoftDeletion} -
+
- - + +
-
{:else} - - - - - + + - {#if currentState === "confirm"} - - + {#if currentState === "confirm"} + + +
+ {#if selectedTags !== undefined} + {#if canBeDeleted && isHardDelete} + + + {:else} + + + {/if} + {/if} +
+
+ {:else if currentState === "applying"} + + {:else} + -
- {#if selectedTags !== undefined} - {#if canBeDeleted && isHardDelete} - - - {:else} - - - {/if} +
+ + +
{/if} -
-
- {:else if currentState === "applying"} - - {:else} - - -
- - -
- {/if}
- {/if} - diff --git a/src/UI/Popup/MarkAsFavourite.svelte b/src/UI/Popup/MarkAsFavourite.svelte index 52bb23f75..2d6dcbb3d 100644 --- a/src/UI/Popup/MarkAsFavourite.svelte +++ b/src/UI/Popup/MarkAsFavourite.svelte @@ -26,23 +26,22 @@ {#if $isFavourite}
- -
- - {:else} - +
+ + {:else} + {/if}
diff --git a/src/UI/Popup/MoveWizard.svelte b/src/UI/Popup/MoveWizard.svelte index a8970aa61..006015c5f 100644 --- a/src/UI/Popup/MoveWizard.svelte +++ b/src/UI/Popup/MoveWizard.svelte @@ -47,12 +47,12 @@ location: new UIEventSource({ lon, lat }), minzoom: new UIEventSource($reason.minZoom), rasterLayer: state.mapProperties.rasterLayer, - zoom: new UIEventSource($reason?.startZoom ?? 16) + zoom: new UIEventSource($reason?.startZoom ?? 16), } } let moveWizardState = new MoveWizardState(id, layer.allowMove, state) - if(moveWizardState.reasons.length === 1){ + if (moveWizardState.reasons.length === 1) { reason.setData(moveWizardState.reasons[0]) } let notAllowed = moveWizardState.moveDisallowedReason @@ -78,8 +78,8 @@ /> {:else} - - + + {/if} @@ -88,9 +88,9 @@ {#each moveWizardState.reasons as reasonSpec} @@ -133,19 +133,24 @@

{#if moveWizardState.reasons.length > 1} - {/if} -
+
{:else if currentStep === "moved"}
diff --git a/src/UI/Popup/TagRendering/SpecialTranslation.svelte b/src/UI/Popup/TagRendering/SpecialTranslation.svelte index 4271fd372..5f2a70ee4 100644 --- a/src/UI/Popup/TagRendering/SpecialTranslation.svelte +++ b/src/UI/Popup/TagRendering/SpecialTranslation.svelte @@ -49,7 +49,9 @@ function createVisualisation(specpart: Exclude): BaseUIElement { { try { - return specpart.func.constr(state, tags, specpart.args, feature, layer)?.SetClass(specpart.style) + return specpart.func + .constr(state, tags, specpart.args, feature, layer) + ?.SetClass(specpart.style) } catch (e) { console.error( "Could not construct a special visualisation with specification", diff --git a/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte b/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte index 342a9a91b..bbe8c52bb 100644 --- a/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte @@ -28,12 +28,18 @@ {#if config !== undefined && (config?.condition === undefined || config.condition.matchesProperties($tags))} -