forked from MapComplete/MapComplete
Chore: remove all unused imports, port 'allTags' to proper svelte
This commit is contained in:
parent
f7b555b9b6
commit
d09f89dc2a
38 changed files with 216 additions and 227 deletions
|
@ -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<number>
|
||||
|
|
|
@ -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<string>
|
||||
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<number | string>
|
||||
) => undefined | ReadonlyArray<number | string>
|
||||
): 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] = <ConversionMessage>{ ...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<number | string>
|
||||
) => undefined | ReadonlyArray<number | string>
|
||||
): 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] = <ConversionMessage>{ ...m, context: rewrittenContext }
|
||||
}
|
||||
}
|
||||
|
||||
public enter(key: string | number | (string | number)[]) {
|
||||
if (!Array.isArray(key)) {
|
||||
if (typeof key === "number" && key < 0) {
|
||||
|
|
|
@ -832,7 +832,6 @@ class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJson> {
|
|||
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<LayerConfigJson> {
|
|||
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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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[] {
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue