Merge branch 'master' into develop
This commit is contained in:
commit
176a7d655b
2 changed files with 20 additions and 24 deletions
|
@ -59,6 +59,21 @@ export default class DetermineTheme {
|
||||||
return layoutConfig
|
return layoutConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static createConversionContext(): DesugaringContext {
|
||||||
|
const knownLayersDict = new Map<string, LayerConfigJson>()
|
||||||
|
for (const key in known_layers["layers"]) {
|
||||||
|
const layer = known_layers["layers"][key]
|
||||||
|
knownLayersDict.set(layer.id, <LayerConfigJson>layer)
|
||||||
|
}
|
||||||
|
const convertState: DesugaringContext = {
|
||||||
|
tagRenderings: DetermineTheme.getSharedTagRenderings(),
|
||||||
|
tagRenderingOrder: DetermineTheme.getSharedTagRenderingOrder(),
|
||||||
|
sharedLayers: knownLayersDict,
|
||||||
|
publicLayers: new Set<string>()
|
||||||
|
}
|
||||||
|
return convertState
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the correct layout for this website
|
* Gets the correct layout for this website
|
||||||
*/
|
*/
|
||||||
|
@ -107,7 +122,8 @@ export default class DetermineTheme {
|
||||||
"./assets/generated/themes/" + id + ".json",
|
"./assets/generated/themes/" + id + ".json",
|
||||||
1000 * 60 * 60 * 60
|
1000 * 60 * 60 * 60
|
||||||
)
|
)
|
||||||
return new ThemeConfig(config, true)
|
const withDefault = new PrepareTheme(this.createConversionContext()).convertStrict(config)
|
||||||
|
return new ThemeConfig(withDefault, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getSharedTagRenderings(): Map<string, QuestionableTagRenderingConfigJson> {
|
private static getSharedTagRenderings(): Map<string, QuestionableTagRenderingConfigJson> {
|
||||||
|
@ -163,22 +179,12 @@ export default class DetermineTheme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const knownLayersDict = new Map<string, LayerConfigJson>()
|
|
||||||
for (const key in known_layers["layers"]) {
|
|
||||||
const layer = known_layers["layers"][key]
|
|
||||||
knownLayersDict.set(layer.id, <LayerConfigJson>layer)
|
|
||||||
}
|
|
||||||
const convertState: DesugaringContext = {
|
|
||||||
tagRenderings: DetermineTheme.getSharedTagRenderings(),
|
|
||||||
tagRenderingOrder: DetermineTheme.getSharedTagRenderingOrder(),
|
|
||||||
sharedLayers: knownLayersDict,
|
|
||||||
publicLayers: new Set<string>(),
|
|
||||||
}
|
|
||||||
json = new FixLegacyTheme().convertStrict(json)
|
json = new FixLegacyTheme().convertStrict(json)
|
||||||
const raw = json
|
const raw = json
|
||||||
|
|
||||||
json = new FixImages(DetermineTheme._knownImages).convertStrict(json)
|
json = new FixImages(DetermineTheme._knownImages).convertStrict(json)
|
||||||
json.enableNoteImports = json.enableNoteImports ?? false
|
json.enableNoteImports = json.enableNoteImports ?? false
|
||||||
|
const convertState = this.createConversionContext()
|
||||||
json = new PrepareTheme(convertState).convertStrict(json)
|
json = new PrepareTheme(convertState).convertStrict(json)
|
||||||
console.log("The layoutconfig is ", json)
|
console.log("The layoutconfig is ", json)
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,4 @@
|
||||||
import {
|
import { Concat, Conversion, DesugaringContext, DesugaringStep, Each, Fuse, On, Pass, SetDefault } from "./Conversion"
|
||||||
Concat,
|
|
||||||
Conversion,
|
|
||||||
DesugaringContext,
|
|
||||||
DesugaringStep,
|
|
||||||
Each,
|
|
||||||
Fuse,
|
|
||||||
On,
|
|
||||||
Pass,
|
|
||||||
SetDefault,
|
|
||||||
} from "./Conversion"
|
|
||||||
import { ThemeConfigJson } from "../Json/ThemeConfigJson"
|
import { ThemeConfigJson } from "../Json/ThemeConfigJson"
|
||||||
import { PrepareLayer } from "./PrepareLayer"
|
import { PrepareLayer } from "./PrepareLayer"
|
||||||
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
||||||
|
@ -175,7 +165,7 @@ class SubstituteLayer extends Conversion<string | LayerConfigJson, LayerConfigJs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddDefaultLayers extends DesugaringStep<ThemeConfigJson> {
|
export class AddDefaultLayers extends DesugaringStep<ThemeConfigJson> {
|
||||||
private readonly _state: DesugaringContext
|
private readonly _state: DesugaringContext
|
||||||
|
|
||||||
constructor(state: DesugaringContext) {
|
constructor(state: DesugaringContext) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue