forked from MapComplete/MapComplete
Improvements to studio and layer handling
This commit is contained in:
parent
d6a55a5ee9
commit
d91ccbe624
6 changed files with 20 additions and 4 deletions
|
@ -78,9 +78,10 @@
|
||||||
"generate:charging-stations": "cd ./assets/layers/charging_station && vite-node csvToJson.ts && cd -",
|
"generate:charging-stations": "cd ./assets/layers/charging_station && vite-node csvToJson.ts && cd -",
|
||||||
"prepare-deploy": "npm run generate:service-worker && ./scripts/prepare-build.sh && npm run build",
|
"prepare-deploy": "npm run generate:service-worker && ./scripts/prepare-build.sh && npm run build",
|
||||||
"build": "./scripts/build.sh",
|
"build": "./scripts/build.sh",
|
||||||
"lint": "npm run lint:prettier && npm run lint:eslint",
|
"lint": "npm run lint:prettier && npm run lint:eslint && npm run lint:themes",
|
||||||
"lint:eslint": "eslint ./src",
|
"lint:eslint": "eslint ./src",
|
||||||
"lint:prettier": "prettier --check '**/*.ts' '**/*.svelte'",
|
"lint:prettier": "prettier --check '**/*.ts' '**/*.svelte'",
|
||||||
|
"lint:themes": "vite-node scripts/lint.ts",
|
||||||
"format": "prettier --write '**/*.ts' '**/*.svelte'",
|
"format": "prettier --write '**/*.ts' '**/*.svelte'",
|
||||||
"clean:tests": "find . -type f -name \"*.doctest.ts\" | xargs -r rm",
|
"clean:tests": "find . -type f -name \"*.doctest.ts\" | xargs -r rm",
|
||||||
"clean": "rm -rf .cache/ && (find *.html | grep -v \"^\\(404\\|index\\|land\\|privacy\\|test\\|studio\\|theme\\|style_test\\|statistics\\|leaderboard\\).html\" | xargs -r rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs -r rm)",
|
"clean": "rm -rf .cache/ && (find *.html | grep -v \"^\\(404\\|index\\|land\\|privacy\\|test\\|studio\\|theme\\|style_test\\|statistics\\|leaderboard\\).html\" | xargs -r rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs -r rm)",
|
||||||
|
|
|
@ -95,6 +95,9 @@ class SubstituteLayer extends Conversion<string | LayerConfigJson, LayerConfigJs
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json["hideTagRenderingsWithLabels"]) {
|
if (json["hideTagRenderingsWithLabels"]) {
|
||||||
|
if(typeof json["hideTagRenderingsWithLabels"] === "string"){
|
||||||
|
throw "At "+context+".hideTagRenderingsWithLabels should be a list containing strings, you specified a string"
|
||||||
|
}
|
||||||
const hideLabels: Set<string> = new Set(json["hideTagRenderingsWithLabels"])
|
const hideLabels: Set<string> = new Set(json["hideTagRenderingsWithLabels"])
|
||||||
// These labels caused at least one deletion
|
// These labels caused at least one deletion
|
||||||
const usedLabels: Set<string> = new Set<string>()
|
const usedLabels: Set<string> = new Set<string>()
|
||||||
|
|
|
@ -177,6 +177,9 @@ export class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
||||||
if (!json.title) {
|
if (!json.title) {
|
||||||
context.enter("title").err(`The theme ${json.id} does not have a title defined.`)
|
context.enter("title").err(`The theme ${json.id} does not have a title defined.`)
|
||||||
}
|
}
|
||||||
|
if(!json.icon){
|
||||||
|
context.enter("icon").err("A theme should have an icon")
|
||||||
|
}
|
||||||
if (this._isBuiltin && this._extractImages !== undefined) {
|
if (this._isBuiltin && this._extractImages !== undefined) {
|
||||||
// Check images: are they local, are the licenses there, is the theme icon square, ...
|
// Check images: are they local, are the licenses there, is the theme icon square, ...
|
||||||
const images = this._extractImages.convert(json, context.inOperation("ValidateTheme"))
|
const images = this._extractImages.convert(json, context.inOperation("ValidateTheme"))
|
||||||
|
@ -243,7 +246,8 @@ export class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
||||||
new ValidateLanguageCompleteness("en").convert(theme, context)
|
new ValidateLanguageCompleteness("en").convert(theme, context)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context.err(e)
|
console.error(e)
|
||||||
|
context.err("Could not validate the theme due to: " + e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme.id !== "personal") {
|
if (theme.id !== "personal") {
|
||||||
|
@ -411,7 +415,7 @@ export class DetectConflictingAddExtraTags extends DesugaringStep<TagRenderingCo
|
||||||
|
|
||||||
return json
|
return json
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context.err(e)
|
context.err("Could not check for conflicting extra tags due to: " + e)
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,8 +106,12 @@ export interface MappingConfigJson {
|
||||||
hideInAnswer?: boolean | TagConfigJson
|
hideInAnswer?: boolean | TagConfigJson
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* question: In what other cases should this item be rendered?
|
||||||
|
*
|
||||||
* Also show this 'then'-option if the feature matches these tags.
|
* Also show this 'then'-option if the feature matches these tags.
|
||||||
* Ideal for outdated tags.
|
* Ideal for outdated tags or default assumptions. The tags from this options will <b>not</b> be set if the option is chosen!
|
||||||
|
*
|
||||||
|
* ifunset: No other cases when this text is shown
|
||||||
*/
|
*/
|
||||||
alsoShowIf?: TagConfigJson
|
alsoShowIf?: TagConfigJson
|
||||||
|
|
||||||
|
|
|
@ -172,6 +172,7 @@ export abstract class EditJsonState<T> {
|
||||||
|
|
||||||
public setValueAt(path: ReadonlyArray<string | number>, v: any) {
|
public setValueAt(path: ReadonlyArray<string | number>, v: any) {
|
||||||
let entry = this.configuration.data
|
let entry = this.configuration.data
|
||||||
|
console.trace("Setting value at", path,"to",v)
|
||||||
const isUndefined =
|
const isUndefined =
|
||||||
v === undefined ||
|
v === undefined ||
|
||||||
v === null ||
|
v === null ||
|
||||||
|
|
|
@ -147,6 +147,9 @@
|
||||||
return { ...<object>v }
|
return { ...<object>v }
|
||||||
}
|
}
|
||||||
if (schema.type === "boolean") {
|
if (schema.type === "boolean") {
|
||||||
|
if(v === null || v === undefined){
|
||||||
|
return v
|
||||||
|
}
|
||||||
return v === "true" || v === "yes" || v === "1"
|
return v === "true" || v === "yes" || v === "1"
|
||||||
}
|
}
|
||||||
if (mightBeBoolean(schema.type)) {
|
if (mightBeBoolean(schema.type)) {
|
||||||
|
|
Loading…
Reference in a new issue