forked from MapComplete/MapComplete
Refactoring: split 'Utils' into multiple files; fix some stray uppercase-method names
This commit is contained in:
parent
81be4db044
commit
3ec89826e4
97 changed files with 884 additions and 921 deletions
|
|
@ -1,14 +1,4 @@
|
|||
import {
|
||||
Concat,
|
||||
Conversion,
|
||||
DesugaringContext,
|
||||
DesugaringStep,
|
||||
Each,
|
||||
Fuse,
|
||||
On,
|
||||
Pass,
|
||||
SetDefault,
|
||||
} from "./Conversion"
|
||||
import { Concat, Conversion, DesugaringContext, DesugaringStep, Each, Fuse, On, Pass, SetDefault } from "./Conversion"
|
||||
import { ThemeConfigJson } from "../Json/ThemeConfigJson"
|
||||
import { OrderLayer, PrepareLayer, RewriteSpecial } from "./PrepareLayer"
|
||||
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
||||
|
|
@ -22,6 +12,7 @@ import ValidationUtils from "./ValidationUtils"
|
|||
import { ConversionContext } from "./ConversionContext"
|
||||
import { ConfigMeta } from "../../../UI/Studio/configMeta"
|
||||
import themeconfig from "../../../assets/schemas/layoutconfigmeta.json"
|
||||
import { Lists } from "../../../Utils/Lists"
|
||||
|
||||
class SubstituteLayer extends Conversion<string | LayerConfigJson, LayerConfigJson[]> {
|
||||
private readonly _state: DesugaringContext
|
||||
|
|
@ -198,7 +189,7 @@ export class AddDefaultLayers extends DesugaringStep<ThemeConfigJson> {
|
|||
|
||||
convert(json: ThemeConfigJson, context: ConversionContext): ThemeConfigJson {
|
||||
const state = this._state
|
||||
json.layers = Utils.NoNull([...(json.layers ?? [])])
|
||||
json.layers = Lists.noNull([...(json.layers ?? [])])
|
||||
const alreadyLoaded = new Set(json.layers.map((l) => l["id"]))
|
||||
|
||||
for (const layerName of Constants.added_by_default) {
|
||||
|
|
@ -612,9 +603,7 @@ class PostvalidateTheme extends DesugaringStep<ThemeConfigJson> {
|
|||
}
|
||||
}
|
||||
export class OrderTheme extends Fuse<ThemeConfigJson> {
|
||||
private static readonly themeAttributesOrder: ReadonlyArray<string> = Utils.Dedup(
|
||||
(<ConfigMeta[]>themeconfig).filter((c) => c.path.length === 1).map((c) => c.path[0])
|
||||
)
|
||||
private static readonly themeAttributesOrder: ReadonlyArray<string> = Lists.dedup((<ConfigMeta[]>themeconfig).filter((c) => c.path.length === 1).map((c) => c.path[0]))
|
||||
|
||||
constructor() {
|
||||
super("Reorders the layer to the default order",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue