diff --git a/app/Schema/Config/Config.schema.json b/app/Schema/Config/Config.schema.json deleted file mode 100644 index d37afadd..00000000 --- a/app/Schema/Config/Config.schema.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema", - "$id": "Schema/Config/Config.l10n.schema.json", - "$ref": "#/definitions/Config", - "definitions": { - "Config": { - "title": "RawConfig", - "type": "object", - "properties": { - "herolistSortOrder": { - "enum": ["name", "datemodified", "dateModified"] - }, - "herolistVisibilityFilter": { - "enum": ["all", "own", "shared"] - }, - "racesSortOrder": { - "enum": ["name", "cost"] - }, - "racesValueVisibility": { - "type": "boolean" - }, - "culturesSortOrder": { - "enum": ["name", "cost"] - }, - "culturesVisibilityFilter": { - "enum": ["all", "common"] - }, - "culturesValueVisibility": { - "type": "boolean" - }, - "professionsSortOrder": { - "enum": ["name", "cost"] - }, - "professionsVisibilityFilter": { - "enum": ["all", "common"] - }, - "professionsFromExpansionsVisibility": { - "type": "boolean" - }, - "professionsGroupVisibilityFilter": { - "enum": [0, 1, 2, 3] - }, - "advantagesDisadvantagesCultureRatingVisibility": { - "type": "boolean" - }, - "talentsSortOrder": { - "enum": ["name", "group", "ic"] - }, - "talentsCultureRatingVisibility": { - "type": "boolean" - }, - "combatTechniquesSortOrder": { - "enum": ["name", "group", "ic"] - }, - "specialAbilitiesSortOrder": { - "enum": ["name", "group", "groupname"] - }, - "spellsSortOrder": { - "enum": ["name", "group", "property", "ic"] - }, - "spellsUnfamiliarVisibility": { - "type": "boolean" - }, - "liturgiesSortOrder": { - "enum": ["name", "group", "ic"] - }, - "equipmentSortOrder": { - "enum": ["name", "groupname", "where", "weight"] - }, - "equipmentGroupVisibilityFilter": { - "type": "integer" - }, - "sheetCheckAttributeValueVisibility": { - "type": "boolean" - }, - "sheetUseParchment": { - "type": "boolean" - }, - "sheetZoomFactor": { - "type": "number" - }, - "enableActiveItemHints": { - "type": "boolean" - }, - "locale": { - "type": "string" - }, - "fallbackLocale": { - "type": "string" - }, - "theme": { - "enum": ["light", "dark"] - }, - "enableEditingHeroAfterCreationPhase": { - "type": "boolean" - }, - "meleeItemTemplatesCombatTechniqueFilter": { - "type": "string" - }, - "rangedItemTemplatesCombatTechniqueFilter": { - "type": "string" - }, - "enableAnimations": { - "type": "boolean" - } - }, - "required": [ - "herolistSortOrder", - "herolistVisibilityFilter", - "racesSortOrder", - "culturesSortOrder", - "culturesVisibilityFilter", - "professionsSortOrder", - "professionsVisibilityFilter", - "professionsGroupVisibilityFilter", - "advantagesDisadvantagesCultureRatingVisibility", - "talentsSortOrder", - "talentsCultureRatingVisibility", - "combatTechniquesSortOrder", - "specialAbilitiesSortOrder", - "spellsSortOrder", - "spellsUnfamiliarVisibility", - "liturgiesSortOrder", - "equipmentSortOrder", - "equipmentGroupVisibilityFilter", - "enableActiveItemHints" - ], - "additionalProperties": false - } - } -} diff --git a/otjsmd.config.js b/otjsmd.config.js new file mode 100644 index 00000000..1dc6c1a3 --- /dev/null +++ b/otjsmd.config.js @@ -0,0 +1,16 @@ +// @ts-check +import { join } from "node:path" +import { jsonSchema } from "optolith-tsjsonschemamd/renderers" + +/** @type {import("optolith-tsjsonschemamd").GeneratorOptions} */ +export default { + sourceDir: join("src", "shared", "schema"), + outputs: [ + { + targetDir: join("src", "assets", "schema"), + renderer: jsonSchema({ spec: "Draft_07" }), + } + ], + clean: true, + verbose: false +} diff --git a/src/assets/schema/config.schema.json b/src/assets/schema/config.schema.json new file mode 100644 index 00000000..14474599 --- /dev/null +++ b/src/assets/schema/config.schema.json @@ -0,0 +1,272 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema", + "$id": "/config.schema.json", + "$ref": "#/definitions/Config", + "definitions": { + "Config": { + "description": "The user-configurable app-wide settings.", + "type": "object", + "properties": { + "locale": { + "type": "string" + }, + "fallbackLocale": { + "type": "string" + }, + "herolistSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "datemodified" + }, + { + "const": "dateModified" + } + ] + }, + "herolistVisibilityFilter": { + "oneOf": [ + { + "const": "all" + }, + { + "const": "own" + }, + { + "const": "shared" + } + ] + }, + "racesSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "cost" + } + ] + }, + "racesValueVisibility": { + "type": "boolean" + }, + "culturesSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "cost" + } + ] + }, + "culturesVisibilityFilter": { + "oneOf": [ + { + "const": "all" + }, + { + "const": "common" + } + ] + }, + "culturesValueVisibility": { + "type": "boolean" + }, + "professionsSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "cost" + } + ] + }, + "professionsVisibilityFilter": { + "oneOf": [ + { + "const": "all" + }, + { + "const": "common" + } + ] + }, + "professionsGroupVisibilityFilter": { + "oneOf": [ + { + "const": 0 + }, + { + "const": 1 + }, + { + "const": 2 + }, + { + "const": 3 + } + ] + }, + "professionsFromExpansionsVisibility": { + "type": "boolean" + }, + "advantagesDisadvantagesCultureRatingVisibility": { + "type": "boolean" + }, + "talentsSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "group" + }, + { + "const": "ic" + } + ] + }, + "talentsCultureRatingVisibility": { + "type": "boolean" + }, + "combatTechniquesSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "group" + }, + { + "const": "ic" + } + ] + }, + "specialAbilitiesSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "group" + }, + { + "const": "groupname" + } + ] + }, + "spellsSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "group" + }, + { + "const": "property" + }, + { + "const": "ic" + } + ] + }, + "spellsUnfamiliarVisibility": { + "type": "boolean" + }, + "liturgiesSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "group" + }, + { + "const": "ic" + } + ] + }, + "equipmentSortOrder": { + "oneOf": [ + { + "const": "name" + }, + { + "const": "groupname" + }, + { + "const": "where" + }, + { + "const": "weight" + } + ] + }, + "equipmentGroupVisibilityFilter": { + "type": "number" + }, + "sheetCheckAttributeValueVisibility": { + "type": "boolean" + }, + "sheetUseParchment": { + "type": "boolean" + }, + "sheetZoomFactor": { + "type": "number" + }, + "enableActiveItemHints": { + "type": "boolean" + }, + "theme": { + "oneOf": [ + { + "const": "light" + }, + { + "const": "dark" + } + ] + }, + "enableEditingHeroAfterCreationPhase": { + "type": "boolean" + }, + "meleeItemTemplatesCombatTechniqueFilter": { + "type": "string" + }, + "rangedItemTemplatesCombatTechniqueFilter": { + "type": "string" + }, + "enableAnimations": { + "type": "boolean" + } + }, + "required": [ + "herolistSortOrder", + "herolistVisibilityFilter", + "racesSortOrder", + "culturesSortOrder", + "culturesVisibilityFilter", + "professionsSortOrder", + "professionsVisibilityFilter", + "professionsGroupVisibilityFilter", + "advantagesDisadvantagesCultureRatingVisibility", + "talentsSortOrder", + "talentsCultureRatingVisibility", + "combatTechniquesSortOrder", + "specialAbilitiesSortOrder", + "spellsSortOrder", + "spellsUnfamiliarVisibility", + "liturgiesSortOrder", + "equipmentSortOrder", + "equipmentGroupVisibilityFilter", + "enableActiveItemHints" + ], + "additionalProperties": false + } + } +} diff --git a/app/Schema/Config/Config.d.ts b/src/shared/schema/config.d.ts similarity index 93% rename from app/Schema/Config/Config.d.ts rename to src/shared/schema/config.d.ts index 35f7116c..780e02ae 100644 --- a/app/Schema/Config/Config.d.ts +++ b/src/shared/schema/config.d.ts @@ -1,4 +1,13 @@ -export interface RawConfig { +/** + * @main Config + */ + +/** + * The user-configurable app-wide settings. + */ +export type Config = { + locale?: string + fallbackLocale?: string herolistSortOrder: "name" | "datemodified" | "dateModified" herolistVisibilityFilter: "all" | "own" | "shared" racesSortOrder: "name" | "cost" @@ -24,8 +33,6 @@ export interface RawConfig { sheetUseParchment?: boolean sheetZoomFactor?: number enableActiveItemHints: boolean - locale?: string - fallbackLocale?: string theme?: "light" | "dark" enableEditingHeroAfterCreationPhase?: boolean meleeItemTemplatesCombatTechniqueFilter?: string