From d09f89dc2a03d223ac3657c2e4552c9aef9c43bc Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 22 Jan 2024 03:42:00 +0100 Subject: [PATCH] Chore: remove all unused imports, port 'allTags' to proper svelte --- assets/layers/charging_station/csvToJson.ts | 111 +++++++------- scripts/generateTaginfoProjectFiles.ts | 1 - src/Logic/Web/TagInfo.ts | 4 +- src/Models/MapProperties.ts | 3 +- .../Conversion/ConversionContext.ts | 54 ++++--- .../ThemeConfig/Conversion/Validation.ts | 8 +- .../ThemeConfig/Conversion/ValidationUtils.ts | 1 - .../ThemeConfig/DependencyCalculator.ts | 1 - src/Models/ThemeConfig/TagRenderingConfig.ts | 1 - src/Models/Unit.ts | 3 +- src/UI/AllThemesGui.svelte | 1 - src/UI/Base/LinkToWeblate.ts | 1 - src/UI/Base/Loading.svelte | 4 +- src/UI/Base/SubtleButton.ts | 2 +- src/UI/BigComponents/IndexText.ts | 11 -- src/UI/BigComponents/ReverseGeocoding.svelte | 5 +- src/UI/BigComponents/Summary.svelte | 1 - src/UI/Favourites/FavouriteSummary.svelte | 3 +- src/UI/Favourites/Favourites.svelte | 6 +- src/UI/Image/ImagePreview.svelte | 6 +- .../Helpers/DirectionInput.svelte | 5 +- .../InputElement/Validators/TagValidator.ts | 4 +- src/UI/OpeningHours/NextChangeViz.svelte | 7 +- src/UI/PlantNet/PlantNet.svelte | 4 +- src/UI/Popup/AddNewPoint/PresetList.svelte | 6 +- src/UI/Popup/AllTagsPanel.svelte | 141 +++++++++++------- src/UI/Popup/DeleteFlow/DeleteWizard.svelte | 3 +- src/UI/Popup/HistogramViz.ts | 1 - src/UI/Popup/ImportButtons/ImportFlow.ts | 1 - src/UI/Popup/MinimapViz.ts | 3 +- src/UI/Popup/MoveWizardState.ts | 1 - src/UI/Popup/Notes/CloseNoteButton.ts | 1 - src/UI/Reviews/AllReviews.svelte | 3 - src/UI/Reviews/StarElement.svelte | 2 +- src/UI/SpecialVisualizations.ts | 9 +- src/UI/Studio/MappingInput.svelte | 6 +- .../Studio/TagRenderingFreeformInput.svelte | 1 - src/UI/Zoomcontrol.ts | 18 +-- 38 files changed, 216 insertions(+), 227 deletions(-) delete mode 100644 src/UI/BigComponents/IndexText.ts diff --git a/assets/layers/charging_station/csvToJson.ts b/assets/layers/charging_station/csvToJson.ts index 03df8f6b7..174fa2585 100644 --- a/assets/layers/charging_station/csvToJson.ts +++ b/assets/layers/charging_station/csvToJson.ts @@ -1,17 +1,14 @@ -import { readFileSync, writeFileSync } from "fs"; -import { Utils } from "../../../src/Utils"; -import ScriptUtils from "../../../scripts/ScriptUtils"; -import { LayerConfigJson } from "../../../src/Models/ThemeConfig/Json/LayerConfigJson"; -import FilterConfigJson from "../../../src/Models/ThemeConfig/Json/FilterConfigJson"; -import { - QuestionableTagRenderingConfigJson -} from "../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"; -import RewritableConfigJson from "../../../src/Models/ThemeConfig/Json/RewritableConfigJson"; -import { TagRenderingConfigJson } from "../../../src/Models/ThemeConfig/Json/TagRenderingConfigJson"; +import { readFileSync, writeFileSync } from "fs" +import { Utils } from "../../../src/Utils" +import ScriptUtils from "../../../scripts/ScriptUtils" +import { LayerConfigJson } from "../../../src/Models/ThemeConfig/Json/LayerConfigJson" +import FilterConfigJson from "../../../src/Models/ThemeConfig/Json/FilterConfigJson" +import RewritableConfigJson from "../../../src/Models/ThemeConfig/Json/RewritableConfigJson" +import { TagRenderingConfigJson } from "../../../src/Models/ThemeConfig/Json/TagRenderingConfigJson" function colonSplit(value: string): string[] { - return value.split(";").map(v => v.replace(/"/g, '').trim()).filter(s => s !== ""); + return value.split(";").map(v => v.replace(/"/g, "").trim()).filter(s => s !== "") } function loadCsv(file): { @@ -34,14 +31,14 @@ function loadCsv(file): { return Utils.NoNull(entries.map(entry => { const values = entry.split(",").map(str => str.trim()) if (values[0] === undefined || values[0] === "") { - return undefined; + return undefined } const v = {} const colonSeperated = ["commonVoltages", "commonOutputs", "commonCurrents", "countryWhiteList", "countryBlackList", "associatedVehicleTypes", "neverAssociatedWith"] const descriptionTranslations = new Map() for (let j = 0; j < header.length; j++) { - const key = header[j]; + const key = header[j] if (key.startsWith("description")) { const language = key.substring("description:".length) descriptionTranslations.set(language, values[j]) @@ -54,10 +51,10 @@ function loadCsv(file): { } } v["description"] = descriptionTranslations - if(v["id"] === ""){ - v["id"] = v["key"] + if (v["id"] === "") { + v["id"] = v["key"] } - return v; + return v })) } @@ -70,9 +67,9 @@ function run(file, protojson) { { question: { en: "All connectors", - nl: "Alle types" - } - } + nl: "Alle types", + }, + }, ] const entries = loadCsv(file) @@ -82,7 +79,7 @@ function run(file, protojson) { { // Add the entities to the 'rewrite-able part' - let specificQuestions: RewritableConfigJson = proto.tagRenderings.find(tr => tr["rewrite"] !== undefined && !(tr["rewrite"]["into"]?.length > 0)); + let specificQuestions: RewritableConfigJson = proto.tagRenderings.find(tr => tr["rewrite"] !== undefined && !(tr["rewrite"]["into"]?.length > 0)) specificQuestions.rewrite.into = entries.map(e => [ e.id, e.key, @@ -90,24 +87,24 @@ function run(file, protojson) { e.image, e.commonVoltages, e.commonCurrents, - e.commonOutputs - ]); + e.commonOutputs, + ]) } for (let i = 0; i < entries.length; i++) { - const e = entries[i]; + const e = entries[i] const txt = { en: e.description.get("en"), - nl: e.description.get("nl") + nl: e.description.get("nl"), } const json = { if: `${e.key}=1`, ifnot: `${e.key}=`, then: txt, - icon:{ - path:"./assets/layers/charging_station/" + e.image, - class:"medium" - } + icon: { + path: "./assets/layers/charging_station/" + e.image, + class: "medium", + }, } if (e.countryWhiteList.length > 0 && e.countryBlackList.length > 0) { @@ -116,32 +113,32 @@ function run(file, protojson) { if (e.countryWhiteList.length > 0) { // This is a 'hideInAnswer', thus _reverse_ logic! const countries = e.countryWhiteList.map(country => "_country!=" + country) //HideInAnswer if it is in the wrong country - json["hideInAnswer"] = {and: countries} // Should be and, as we want to hide if it does not match any of the countries + json["hideInAnswer"] = { and: countries } // Should be and, as we want to hide if it does not match any of the countries } else if (e.countryBlackList.length > 0) { const countries = e.countryBlackList.map(country => "_country=" + country) //HideInAnswer if it is in the wrong country - json["hideInAnswer"] = {or: countries} + json["hideInAnswer"] = { or: countries } } if (e.associatedVehicleTypes?.length > 0 && e.associatedVehicleTypes.indexOf("*") < 0 && e.neverAssociatedWith?.length > 0) { // This plug only occurs if some vehicle specific vehicle type is present. // IF all of the needed vehicle types are explicitly NO, then we hide this type as well - let associatedWith = {and: [].concat(...e.associatedVehicleTypes.map(neededVehicle => [neededVehicle + "=no"]))} + let associatedWith = { and: [].concat(...e.associatedVehicleTypes.map(neededVehicle => [neededVehicle + "=no"])) } // We also hide if: // - One of the neverAssociatedVehiclesTYpes is set to 'yes' AND none of the associated types are set/yes let neverAssociatedIsSet = { and: [{ - or: e.neverAssociatedWith.map(vehicleType => vehicleType + "=yes") + or: e.neverAssociatedWith.map(vehicleType => vehicleType + "=yes"), }, - ...e.associatedVehicleTypes.map(associated => associated + "!=yes") - ] + ...e.associatedVehicleTypes.map(associated => associated + "!=yes"), + ], } let conditions = [associatedWith, neverAssociatedIsSet] if (json["hideInAnswer"] !== undefined) { conditions.push(json["hideInAnswer"]) } - json["hideInAnswer"] = {or: conditions} + json["hideInAnswer"] = { or: conditions } } @@ -151,14 +148,14 @@ function run(file, protojson) { // We add a second time for any amount to trigger a visualisation; but this is not an answer option const no_ask_json = { if: { - and:Utils.NoEmpty( [`${e.key}~*`, `${e.key}!=1`, ...e.extraVisualisationCondition.split(";")]) + and: Utils.NoEmpty([`${e.key}~*`, `${e.key}!=1`, ...e.extraVisualisationCondition.split(";")]), }, then: txt, hideInAnswer: true, - icon:{ + icon: { path: `./assets/layers/charging_station/${e.image}`, - class:"medium" - } + class: "medium", + }, } overview_question_answers.push(no_ask_json) @@ -168,9 +165,9 @@ function run(file, protojson) { filterOptions.push({ question: { en: `Has a ${descrWithImage_en} connector`, - nl: `Heeft een ${descrWithImage_nl}` + nl: `Heeft een ${descrWithImage_nl}`, }, - osmTags: `${e.key}~*` + osmTags: `${e.key}~*`, }) } @@ -178,25 +175,25 @@ function run(file, protojson) { "id": "Available_charging_stations (generated)", "question": { "en": "Which charging connections are available here?", - "nl": "Welke aansluitingen zijn hier beschikbaar?" + "nl": "Welke aansluitingen zijn hier beschikbaar?", }, "multiAnswer": true, - "mappings": overview_question_answers + "mappings": overview_question_answers, } const insertQuestionsAt = proto.tagRenderings.findIndex(tr => tr["id"] === "$$$") proto.tagRenderings.splice(insertQuestionsAt, 1, toggles) - if(typeof proto.filter === "string"){ + if (typeof proto.filter === "string") { throw "Filters of a the protojson should be a list of FilterConfigJsons" } - proto.filter = proto.filter; + proto.filter = proto.filter proto.tagRenderings.forEach(tr => { if (typeof tr === "string") { - return; + return } - if(tr["rewrite"]){ + if (tr["rewrite"]) { return } if (tr["id"] === undefined || typeof tr["id"] !== "string") { @@ -207,18 +204,18 @@ function run(file, protojson) { proto.filter.push({ id: "connection_type", - options: filterOptions + options: filterOptions, }) const importedUnits = {} for (const entry of entries) { - importedUnits[entry.key+":voltage"] = "voltage" - importedUnits[entry.key+":current"] = "current" - importedUnits[entry.key+":output"] = { quantity: "power", "denominations":["mW","kW"] } + importedUnits[entry.key + ":voltage"] = "voltage" + importedUnits[entry.key + ":current"] = "current" + importedUnits[entry.key + ":output"] = { quantity: "power", "denominations": ["mW", "kW"] } } - const extraUnits = [importedUnits - ]; + const extraUnits = [importedUnits, + ] if (proto["units"] == undefined) { proto["units"] = [] @@ -234,10 +231,10 @@ async function queryTagInfo(file, type, clean: ((s: string) => string)) { const result = value.data const counts = new Map() for (const r of result) { - let key = r.value; + let key = r.value key = clean(key) - key.trim(); - if (key.indexOf('-') >= 0) { + key.trim() + if (key.indexOf("-") >= 0) { continue } if (r.fraction < 0.05) { @@ -276,7 +273,7 @@ function mergeTranslations(origPath, newConfig: LayerConfigJson) { } const applicable = newRenderings.filter(r => r["id"] === oldRenderingName)[0] if (applicable === undefined) { - continue; + continue } // @ts-ignore Utils.Merge(oldRendering, applicable) diff --git a/scripts/generateTaginfoProjectFiles.ts b/scripts/generateTaginfoProjectFiles.ts index 0b65be1e0..e5ebe8882 100644 --- a/scripts/generateTaginfoProjectFiles.ts +++ b/scripts/generateTaginfoProjectFiles.ts @@ -5,7 +5,6 @@ import { readFileSync, writeFileSync } from "fs" import LayoutConfig from "../src/Models/ThemeConfig/LayoutConfig" import LayerConfig from "../src/Models/ThemeConfig/LayerConfig" import { Utils } from "../src/Utils" -import TagRenderingConfig from "../src/Models/ThemeConfig/TagRenderingConfig" /** * Generates all the files in "Docs/TagInfo". These are picked up by the taginfo project, showing a link to the mapcomplete theme if the key is used diff --git a/src/Logic/Web/TagInfo.ts b/src/Logic/Web/TagInfo.ts index 77250ae97..dfc6fb957 100644 --- a/src/Logic/Web/TagInfo.ts +++ b/src/Logic/Web/TagInfo.ts @@ -1,4 +1,3 @@ -import exp from "constants" import { Utils } from "../../Utils" export interface TagInfoStats { @@ -16,9 +15,8 @@ export interface TagInfoStats { } export default class TagInfo { - private readonly _backend: string - public static readonly global = new TagInfo() + private readonly _backend: string constructor(backend = "https://taginfo.openstreetmap.org/") { this._backend = backend diff --git a/src/Models/MapProperties.ts b/src/Models/MapProperties.ts index 73ec1b413..2492c1b50 100644 --- a/src/Models/MapProperties.ts +++ b/src/Models/MapProperties.ts @@ -1,11 +1,12 @@ import { Store, UIEventSource } from "../Logic/UIEventSource" import { BBox } from "../Logic/BBox" import { RasterLayerPolygon } from "./RasterLayers" -import { B } from "vitest/dist/types-aac763a5" + export interface KeyNavigationEvent { date: Date key: "north" | "east" | "south" | "west" | "in" | "out" | "islocked" | "locked" | "unlocked" } + export interface MapProperties { readonly location: UIEventSource<{ lon: number; lat: number }> readonly zoom: UIEventSource diff --git a/src/Models/ThemeConfig/Conversion/ConversionContext.ts b/src/Models/ThemeConfig/Conversion/ConversionContext.ts index db4bed4fd..f0b567c74 100644 --- a/src/Models/ThemeConfig/Conversion/ConversionContext.ts +++ b/src/Models/ThemeConfig/Conversion/ConversionContext.ts @@ -1,7 +1,7 @@ import { ConversionMessage, ConversionMsgLevel } from "./Conversion" -import { Context } from "maplibre-gl" export class ConversionContext { + private static reported = false /** * The path within the data structure where we are currently operating */ @@ -11,7 +11,6 @@ export class ConversionContext { */ readonly operation: ReadonlyArray readonly messages: ConversionMessage[] - private _hasErrors: boolean = false private constructor( @@ -33,7 +32,6 @@ export class ConversionContext { } } } - private static reported = false public static construct(path: (string | number)[], operation: string[]) { return new ConversionContext([], [...path], [...operation]) @@ -43,31 +41,6 @@ export class ConversionContext { return new ConversionContext([], msg ? [msg] : [], ["test"]) } - /** - * Does an inline edit of the messages for which a new path is defined - * This is a slight hack - * @param rewritePath - */ - public rewriteMessages( - rewritePath: ( - p: ReadonlyArray - ) => undefined | ReadonlyArray - ): void { - for (let i = 0; i < this.messages.length; i++) { - const m = this.messages[i] - const newPath = rewritePath(m.context.path) - if (!newPath) { - continue - } - const rewrittenContext = new ConversionContext( - this.messages, - newPath, - m.context.operation - ) - this.messages[i] = { ...m, context: rewrittenContext } - } - } - static print(msg: ConversionMessage) { const noString = msg.context.path.filter( (p) => typeof p !== "string" && typeof p !== "number" @@ -102,6 +75,31 @@ export class ConversionContext { return "\x1b[31m" + s + "\x1b[0m" } + /** + * Does an inline edit of the messages for which a new path is defined + * This is a slight hack + * @param rewritePath + */ + public rewriteMessages( + rewritePath: ( + p: ReadonlyArray + ) => undefined | ReadonlyArray + ): void { + for (let i = 0; i < this.messages.length; i++) { + const m = this.messages[i] + const newPath = rewritePath(m.context.path) + if (!newPath) { + continue + } + const rewrittenContext = new ConversionContext( + this.messages, + newPath, + m.context.operation + ) + this.messages[i] = { ...m, context: rewrittenContext } + } + } + public enter(key: string | number | (string | number)[]) { if (!Array.isArray(key)) { if (typeof key === "number" && key < 0) { diff --git a/src/Models/ThemeConfig/Conversion/Validation.ts b/src/Models/ThemeConfig/Conversion/Validation.ts index 2adf0f023..51da86e2f 100644 --- a/src/Models/ThemeConfig/Conversion/Validation.ts +++ b/src/Models/ThemeConfig/Conversion/Validation.ts @@ -832,7 +832,6 @@ class MiscTagRenderingChecks extends DesugaringStep { json: TagRenderingConfigJson | QuestionableTagRenderingConfigJson, context: ConversionContext ): TagRenderingConfigJson { - console.log(">>> Validating TR", context.path.join("."), json) if (json["special"] !== undefined) { context.err( 'Detected `special` on the top level. Did you mean `{"render":{ "special": ... }}`' @@ -1043,7 +1042,12 @@ export class PrevalidateLayer extends DesugaringStep { private readonly _studioValidations: boolean private readonly _validatePointRendering = new ValidatePointRendering() - constructor(path: string, isBuiltin, doesImageExist, studioValidations) { + constructor( + path: string, + isBuiltin: boolean, + doesImageExist: DoesImageExist, + studioValidations: boolean + ) { super("Runs various checks against common mistakes for a layer", [], "PrevalidateLayer") this._path = path this._isBuiltin = isBuiltin diff --git a/src/Models/ThemeConfig/Conversion/ValidationUtils.ts b/src/Models/ThemeConfig/Conversion/ValidationUtils.ts index f82a3577b..96b1396fe 100644 --- a/src/Models/ThemeConfig/Conversion/ValidationUtils.ts +++ b/src/Models/ThemeConfig/Conversion/ValidationUtils.ts @@ -3,7 +3,6 @@ import { Utils } from "../../../Utils" import SpecialVisualizations from "../../../UI/SpecialVisualizations" import { RenderingSpecification, SpecialVisualization } from "../../../UI/SpecialVisualization" import { QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson" -import { render } from "sass" export default class ValidationUtils { public static getAllSpecialVisualisations( diff --git a/src/Models/ThemeConfig/DependencyCalculator.ts b/src/Models/ThemeConfig/DependencyCalculator.ts index dbeeb6a71..41f0e3050 100644 --- a/src/Models/ThemeConfig/DependencyCalculator.ts +++ b/src/Models/ThemeConfig/DependencyCalculator.ts @@ -3,7 +3,6 @@ import { ExtraFuncParams, ExtraFunctions } from "../../Logic/ExtraFunctions" import LayerConfig from "./LayerConfig" import { SpecialVisualization } from "../../UI/SpecialVisualization" import SpecialVisualizations from "../../UI/SpecialVisualizations" -import { Exception } from "sass" export default class DependencyCalculator { public static GetTagRenderingDependencies(tr: TagRenderingConfig): string[] { diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 67e3cd808..120bc064b 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -17,7 +17,6 @@ import { import { FixedUiElement } from "../../UI/Base/FixedUiElement" import Validators, { ValidatorType } from "../../UI/InputElement/Validators" import { TagRenderingConfigJson } from "./Json/TagRenderingConfigJson" -import Constants from "../Constants" import { RegexTag } from "../../Logic/Tags/RegexTag" export interface Icon {} diff --git a/src/Models/Unit.ts b/src/Models/Unit.ts index 67613500d..06e09446c 100644 --- a/src/Models/Unit.ts +++ b/src/Models/Unit.ts @@ -1,6 +1,4 @@ import BaseUIElement from "../UI/BaseUIElement" -import { FixedUiElement } from "../UI/Base/FixedUiElement" -import Combine from "../UI/Base/Combine" import { Denomination } from "./Denomination" import UnitConfigJson from "./ThemeConfig/Json/UnitConfigJson" import unit from "../../assets/layers/unit/unit.json" @@ -198,6 +196,7 @@ export class Unit { const loaded = this.getFromLibrary(toLoad.quantity, ctx) const quantity = toLoad.quantity + function fetchDenom(d: string): Denomination { const found = loaded.denominations.find( (denom) => denom.canonical.toLowerCase() === d diff --git a/src/UI/AllThemesGui.svelte b/src/UI/AllThemesGui.svelte index 6a8e86c65..5aef762c7 100644 --- a/src/UI/AllThemesGui.svelte +++ b/src/UI/AllThemesGui.svelte @@ -19,7 +19,6 @@ import { LayoutInformation } from "../Models/ThemeConfig/LayoutConfig" import * as themeOverview from "../assets/generated/theme_overview.json" import UnofficialThemeList from "./BigComponents/UnofficialThemeList.svelte" - import Eye from "@babeard/svelte-heroicons/mini/Eye" const featureSwitches = new OsmConnectionFeatureSwitches() const osmConnection = new OsmConnection({ diff --git a/src/UI/Base/LinkToWeblate.ts b/src/UI/Base/LinkToWeblate.ts index 0672c0903..2765f61db 100644 --- a/src/UI/Base/LinkToWeblate.ts +++ b/src/UI/Base/LinkToWeblate.ts @@ -1,7 +1,6 @@ import { VariableUiElement } from "./VariableUIElement" import Locale from "../i18n/Locale" import Link from "./Link" -import Svg from "../../Svg" import SvelteUIElement from "./SvelteUIElement" import Translate from "../../assets/svg/Translate.svelte" diff --git a/src/UI/Base/Loading.svelte b/src/UI/Base/Loading.svelte index 57cdd2adc..e76881db0 100644 --- a/src/UI/Base/Loading.svelte +++ b/src/UI/Base/Loading.svelte @@ -1,6 +1,4 @@ diff --git a/src/UI/Image/ImagePreview.svelte b/src/UI/Image/ImagePreview.svelte index afa457f73..bf966cfcf 100644 --- a/src/UI/Image/ImagePreview.svelte +++ b/src/UI/Image/ImagePreview.svelte @@ -6,15 +6,15 @@ import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider" import { UIEventSource } from "../../Logic/UIEventSource" import Zoomcontrol from "../Zoomcontrol" - import { onDestroy, onMount } from "svelte" + import { onDestroy } from "svelte" export let image: ProvidedImage let panzoomInstance = undefined let panzoomEl: HTMLElement export let isLoaded: UIEventSource = undefined - + onDestroy(Zoomcontrol.createLock()) - + $: { if (panzoomEl) { panzoomInstance = panzoom(panzoomEl, { diff --git a/src/UI/InputElement/Helpers/DirectionInput.svelte b/src/UI/InputElement/Helpers/DirectionInput.svelte index de92ee080..c9660da9c 100644 --- a/src/UI/InputElement/Helpers/DirectionInput.svelte +++ b/src/UI/InputElement/Helpers/DirectionInput.svelte @@ -4,8 +4,6 @@ import { Map as MlMap } from "maplibre-gl" import { MapLibreAdaptor } from "../../Map/MapLibreAdaptor" import MaplibreMap from "../../Map/MaplibreMap.svelte" - import ToSvelte from "../../Base/ToSvelte.svelte" - import Svg from "../../../Svg.js" import Direction_stroke from "../../../assets/svg/Direction_stroke.svelte" /** @@ -28,6 +26,7 @@ }) let mainElem: HTMLElement + function onPosChange(x: number, y: number) { const rect = mainElem.getBoundingClientRect() const dx = -(rect.left + rect.right) / 2 + x @@ -64,7 +63,7 @@ on:touchstart={(e) => onPosChange(e.touches[0].clientX, e.touches[0].clientY)} >
- +
diff --git a/src/UI/InputElement/Validators/TagValidator.ts b/src/UI/InputElement/Validators/TagValidator.ts index d95c0df5b..8c69dd71d 100644 --- a/src/UI/InputElement/Validators/TagValidator.ts +++ b/src/UI/InputElement/Validators/TagValidator.ts @@ -1,14 +1,12 @@ import { Validator } from "../Validator" import { Translation } from "../../i18n/Translation" -import Translations from "../../i18n/Translations" -import TagKeyValidator from "./TagKeyValidator" -import SimpleTagValidator from "./SimpleTagValidator" /** * Checks that the input conforms a JSON-encoded tag expression or a simpleTag`key=value`, */ export default class TagValidator extends Validator { public readonly isMeta = true + constructor() { super("tag", "A simple tag of the format `key=value` OR a tagExpression") } diff --git a/src/UI/OpeningHours/NextChangeViz.svelte b/src/UI/OpeningHours/NextChangeViz.svelte index 93ba25346..3368aea98 100644 --- a/src/UI/OpeningHours/NextChangeViz.svelte +++ b/src/UI/OpeningHours/NextChangeViz.svelte @@ -10,7 +10,6 @@ import { Utils } from "../../Utils" import Circle from "../../assets/svg/Circle.svelte" import Ring from "../../assets/svg/Ring.svelte" - import { twMerge } from "tailwind-merge" export let state: SpecialVisualizationState export let tags: Store> @@ -21,7 +20,7 @@ tags, keyToUse, prefix, - postfix + postfix, ) let currentState = oh.mapD((oh) => (typeof oh === "string" ? undefined : oh.getState())) @@ -30,12 +29,12 @@ let nextChange = oh .mapD( (oh) => (typeof oh === "string" ? undefined : oh.getNextChange(new Date(), tomorrow)), - [Stores.Chronic(5 * 60 * 1000)] + [Stores.Chronic(5 * 60 * 1000)], ) .mapD((date) => Utils.TwoDigits(date.getHours()) + ":" + Utils.TwoDigits(date.getMinutes())) let size = nextChange.map((change) => - change === undefined ? "absolute h-7 w-7" : "absolute h-5 w-5 top-0 left-1/4" + change === undefined ? "absolute h-7 w-7" : "absolute h-5 w-5 top-0 left-1/4", ) diff --git a/src/UI/PlantNet/PlantNet.svelte b/src/UI/PlantNet/PlantNet.svelte index 34bcdc871..a78617518 100644 --- a/src/UI/PlantNet/PlantNet.svelte +++ b/src/UI/PlantNet/PlantNet.svelte @@ -10,8 +10,6 @@ import NextButton from "../Base/NextButton.svelte" import WikipediaPanel from "../Wikipedia/WikipediaPanel.svelte" import { createEventDispatcher } from "svelte" - import ToSvelte from "../Base/ToSvelte.svelte" - import Svg from "../../Svg" import Plantnet_logo from "../../assets/svg/Plantnet_logo.svelte" /** @@ -28,7 +26,7 @@ const dispatch = createEventDispatcher<{ selected: string }>() let collapsedMode = true let options: UIEventSource = new UIEventSource( - undefined + undefined, ) let error: string = undefined diff --git a/src/UI/Popup/AddNewPoint/PresetList.svelte b/src/UI/Popup/AddNewPoint/PresetList.svelte index bd248b9e5..96d2a25b6 100644 --- a/src/UI/Popup/AddNewPoint/PresetList.svelte +++ b/src/UI/Popup/AddNewPoint/PresetList.svelte @@ -9,9 +9,7 @@ import { ImmutableStore } from "../../../Logic/UIEventSource" import { TagUtils } from "../../../Logic/Tags/TagUtils" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" - import FromHtml from "../../Base/FromHtml.svelte" import NextButton from "../../Base/NextButton.svelte" - import { UIElement } from "../../UIElement" import ToSvelte from "../../Base/ToSvelte.svelte" import BaseUIElement from "../../BaseUIElement" @@ -37,7 +35,7 @@ "Not showing presets for layer", flayer.layerDef.id, "as not displayed and featureSwitchFilter.data is set", - state.featureSwitches.featureSwitchFilter.data + state.featureSwitches.featureSwitchFilter.data, ) // ...and we cannot enable the layer control -> we skip, as these presets can never be shown anyway continue @@ -66,7 +64,7 @@ tags, text: Translations.t.general.add.addNew.Subs( { category: preset.title }, - preset.title["context"] + preset.title["context"], ), } presets.push(simplified) diff --git a/src/UI/Popup/AllTagsPanel.svelte b/src/UI/Popup/AllTagsPanel.svelte index 22ab0a769..e8cf74526 100644 --- a/src/UI/Popup/AllTagsPanel.svelte +++ b/src/UI/Popup/AllTagsPanel.svelte @@ -1,67 +1,96 @@
- + + + + + + + + + {#each $tagKeys as key} + {#if !allCalculatedTags.has(key)} + + + + + {/if} + {/each} + + + + {#if calculatedTags.length === 0} + + + + {/if} + {#each calculatedTags as key} + + + + + {/each} + + + + + {#each metaKeys as key} + + + + + {/each} +
KeyValue
Normal tags
{key} + {#if $tags[key] === undefined} + undefined + {:else if $tags[key] === ""} + Empty string + {:else} + {$tags[key]} + {/if} +
Calculated tags
This layer does not use calculated tags
{key} + {#if $tags[key] === undefined} + undefined + {:else if $tags[key] === ""} + Empty string + {:else if $tags[key] !== "string"} + {$tags[key]} + {typeof $tags[key]} + {:else} + {$tags[key]} + {/if} +
Metatags tags
{key} + {#if $knownValues.indexOf(key) < 0 } + + {:else if !$tags[key] === undefined} + Undefined + {:else if $tags[key] === ""} + Empty string + {:else} + {$tags[key]} + {/if} +
diff --git a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte index 566e6da47..d1121b35d 100644 --- a/src/UI/Popup/DeleteFlow/DeleteWizard.svelte +++ b/src/UI/Popup/DeleteFlow/DeleteWizard.svelte @@ -11,7 +11,6 @@ import { UIEventSource } from "../../../Logic/UIEventSource" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" import { TagsFilter } from "../../../Logic/Tags/TagsFilter" - import { XCircleIcon } from "@rgossiaux/svelte-heroicons/solid" import { TagUtils } from "../../../Logic/Tags/TagUtils" import OsmChangeAction from "../../../Logic/Osm/Actions/OsmChangeAction" import DeleteAction from "../../../Logic/Osm/Actions/DeleteAction" @@ -66,7 +65,7 @@ theme: state?.layout?.id ?? "unknown", specialMotivation: deleteReason, }, - canBeDeleted.data + canBeDeleted.data, ) } else { // no _delete_reason is given, which implies that this is _not_ a deletion but merely a retagging via a nonDeleteMapping diff --git a/src/UI/Popup/HistogramViz.ts b/src/UI/Popup/HistogramViz.ts index 94b0f2b89..59d9bc820 100644 --- a/src/UI/Popup/HistogramViz.ts +++ b/src/UI/Popup/HistogramViz.ts @@ -2,7 +2,6 @@ import { Store, UIEventSource } from "../../Logic/UIEventSource" import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization" import Histogram from "../BigComponents/Histogram" import { Feature } from "geojson" -import Constants from "../../Models/Constants" export class HistogramViz implements SpecialVisualization { funcName = "histogram" diff --git a/src/UI/Popup/ImportButtons/ImportFlow.ts b/src/UI/Popup/ImportButtons/ImportFlow.ts index 50943d8af..601791326 100644 --- a/src/UI/Popup/ImportButtons/ImportFlow.ts +++ b/src/UI/Popup/ImportButtons/ImportFlow.ts @@ -6,7 +6,6 @@ import TagApplyButton from "../TagApplyButton" import { PointImportFlowArguments } from "./PointImportFlowState" import { Translation } from "../../i18n/Translation" import Translations from "../../i18n/Translations" -import { OsmConnection } from "../../../Logic/Osm/OsmConnection" import FilteredLayer from "../../../Models/FilteredLayer" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" import { LayerConfigJson } from "../../../Models/ThemeConfig/Json/LayerConfigJson" diff --git a/src/UI/Popup/MinimapViz.ts b/src/UI/Popup/MinimapViz.ts index 444d0d49a..da0f0fed6 100644 --- a/src/UI/Popup/MinimapViz.ts +++ b/src/UI/Popup/MinimapViz.ts @@ -6,7 +6,6 @@ import { MapLibreAdaptor } from "../Map/MapLibreAdaptor" import SvelteUIElement from "../Base/SvelteUIElement" import MaplibreMap from "../Map/MaplibreMap.svelte" import ShowDataLayer from "../Map/ShowDataLayer" -import LayerConfig from "../../Models/ThemeConfig/LayerConfig" import { GeoOperations } from "../../Logic/GeoOperations" import { BBox } from "../../Logic/BBox" @@ -32,7 +31,7 @@ export class MinimapViz implements SpecialVisualization { state: SpecialVisualizationState, tagSource: UIEventSource>, args: string[], - feature: Feature, + feature: Feature ) { if (state === undefined || feature === undefined) { return undefined diff --git a/src/UI/Popup/MoveWizardState.ts b/src/UI/Popup/MoveWizardState.ts index a4faa6085..e4ff3d7d2 100644 --- a/src/UI/Popup/MoveWizardState.ts +++ b/src/UI/Popup/MoveWizardState.ts @@ -10,7 +10,6 @@ import { Tag } from "../../Logic/Tags/Tag" import { SpecialVisualizationState } from "../SpecialVisualization" import { Feature, Point } from "geojson" import SvelteUIElement from "../Base/SvelteUIElement" -import Confirm from "../../assets/svg/Confirm.svelte" import Relocation from "../../assets/svg/Relocation.svelte" import Location from "../../assets/svg/Location.svelte" diff --git a/src/UI/Popup/Notes/CloseNoteButton.ts b/src/UI/Popup/Notes/CloseNoteButton.ts index 611169acb..c1cb7db97 100644 --- a/src/UI/Popup/Notes/CloseNoteButton.ts +++ b/src/UI/Popup/Notes/CloseNoteButton.ts @@ -1,7 +1,6 @@ import BaseUIElement from "../../BaseUIElement" import Translations from "../../i18n/Translations" import { Utils } from "../../../Utils" -import Svg from "../../../Svg" import Img from "../../Base/Img" import { SubtleButton } from "../../Base/SubtleButton" import Toggle from "../../Input/Toggle" diff --git a/src/UI/Reviews/AllReviews.svelte b/src/UI/Reviews/AllReviews.svelte index 8617996f1..2d8172210 100644 --- a/src/UI/Reviews/AllReviews.svelte +++ b/src/UI/Reviews/AllReviews.svelte @@ -3,15 +3,12 @@ import SingleReview from "./SingleReview.svelte" import { Utils } from "../../Utils" import StarsBar from "./StarsBar.svelte" - import ReviewForm from "./ReviewForm.svelte" import Translations from "../i18n/Translations" import Tr from "../Base/Tr.svelte" import type { SpecialVisualizationState } from "../SpecialVisualization" import { UIEventSource } from "../../Logic/UIEventSource" import type { Feature } from "geojson" import LayerConfig from "../../Models/ThemeConfig/LayerConfig" - import ToSvelte from "../Base/ToSvelte.svelte" - import Svg from "../../Svg" import Mangrove_logo from "../../assets/svg/Mangrove_logo.svelte" /** diff --git a/src/UI/Reviews/StarElement.svelte b/src/UI/Reviews/StarElement.svelte index 8be2a8b74..42ef156b8 100644 --- a/src/UI/Reviews/StarElement.svelte +++ b/src/UI/Reviews/StarElement.svelte @@ -3,7 +3,7 @@ import Star from "../../assets/svg/Star.svelte" import Star_half from "../../assets/svg/Star_half.svelte" import Star_outline from "../../assets/svg/Star_outline.svelte" - import { ariaLabel, ariaLabelStore } from "../../Utils/ariaLabel" + import { ariaLabel } from "../../Utils/ariaLabel" import Translations from "../i18n/Translations" export let score: number diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts index 1d276361c..1f7339e9d 100644 --- a/src/UI/SpecialVisualizations.ts +++ b/src/UI/SpecialVisualizations.ts @@ -654,8 +654,13 @@ export default class SpecialVisualizations { funcName: "all_tags", docs: "Prints all key-value pairs of the object - used for debugging", args: [], - constr: (state, tags: UIEventSource) => - new SvelteUIElement(AllTagsPanel, { tags, state }), + constr: ( + state, + tags: UIEventSource>, + _, + __, + layer: LayerConfig + ) => new SvelteUIElement(AllTagsPanel, { tags, layer }), }, { funcName: "image_carousel", diff --git a/src/UI/Studio/MappingInput.svelte b/src/UI/Studio/MappingInput.svelte index d210811d4..c8f6f550b 100644 --- a/src/UI/Studio/MappingInput.svelte +++ b/src/UI/Studio/MappingInput.svelte @@ -9,8 +9,6 @@ import type { ConfigMeta } from "./configMeta" import configs from "../../assets/schemas/questionabletagrenderingconfigmeta.json" import { Utils } from "../../Utils" - import ToSvelte from "../Base/ToSvelte.svelte" - import { VariableUiElement } from "../Base/VariableUIElement" import { ExclamationTriangle } from "@babeard/svelte-heroicons/solid/ExclamationTriangle" export let state: EditLayerState @@ -32,7 +30,7 @@ let thenText: UIEventSource> = state.getStoreFor([...path, "then"]) let thenTextEn = thenText.mapD((translation) => - typeof translation === "string" ? translation : translation["en"] + typeof translation === "string" ? translation : translation["en"], ) let editMode = Object.keys($thenText ?? {})?.length === 0 @@ -74,7 +72,7 @@ {#if $messages.length > 0}
- + {$messages.length} errors
{/if} diff --git a/src/UI/Studio/TagRenderingFreeformInput.svelte b/src/UI/Studio/TagRenderingFreeformInput.svelte index bcb8cd4be..c7cd06098 100644 --- a/src/UI/Studio/TagRenderingFreeformInput.svelte +++ b/src/UI/Studio/TagRenderingFreeformInput.svelte @@ -1,5 +1,4 @@