theme: mark shade and textSelection colors as deprecated

This commit is contained in:
Abdullah Atta
2023-09-05 11:39:38 +05:00
committed by Abdullah Atta
parent 577a976e01
commit d256d435e4
3 changed files with 44 additions and 4 deletions

View File

@@ -34,8 +34,6 @@ const generator = tsj.createGenerator({
const schema = generator.createSchema("ThemeDefinition"); const schema = generator.createSchema("ThemeDefinition");
removeProperty("ThemeDefinition", "codeBlockCSS"); removeProperty("ThemeDefinition", "codeBlockCSS");
removeProperty("Colors", "shade");
removeProperty("PartialOrFullColors<false>", "shade");
addProperty( addProperty(
"ThemeDefinition", "ThemeDefinition",
"$schema", "$schema",
@@ -46,14 +44,21 @@ addProperty(
}, },
true true
); );
makePropertyOptional("Colors", "shade");
makePropertyOptional("PartialOrFullColors<false>", "shade");
makePropertyOptional("Colors", "textSelection");
makePropertyOptional("PartialOrFullColors<false>", "textSelection");
await writeFile(`v1.schema.json`, JSON.stringify(schema, undefined, 2)); await writeFile(`v1.schema.json`, JSON.stringify(schema, undefined, 2));
function removeProperty(definition, propertyName) { function removeProperty(definition, propertyName) {
delete schema.definitions[definition].properties[propertyName]; delete schema.definitions[definition].properties[propertyName];
const required = schema.definitions[definition].required; makePropertyOptional(definition, propertyName);
}
function makePropertyOptional(definition, propertyName) {
const required = schema.definitions[definition].required;
if (required && required.includes(propertyName)) { if (required && required.includes(propertyName)) {
required.splice(required.indexOf("shade"), 1); required.splice(required.indexOf(propertyName), 1);
} }
} }

View File

@@ -226,7 +226,18 @@ export type Colors = {
*/ */
backdrop: string; backdrop: string;
/**
* Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)
* @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$
* @deprecated true
*/
shade: string; shade: string;
/**
* Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)
* @pattern ^#(?:(?:[\da-fA-F]{3}){1,2}|(?:[\da-fA-F]{4}){1,2})$
* @deprecated true
*/
textSelection: string;
}; };
export type VariantsWithStaticColors<TRequired extends boolean = false> = export type VariantsWithStaticColors<TRequired extends boolean = false> =

View File

@@ -255,6 +255,18 @@
"type": "string", "type": "string",
"description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)", "description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)",
"pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$" "pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$"
},
"shade": {
"type": "string",
"description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)",
"pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$",
"deprecated": true
},
"textSelection": {
"type": "string",
"description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)",
"pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$",
"deprecated": true
} }
}, },
"required": [ "required": [
@@ -353,6 +365,18 @@
"type": "string", "type": "string",
"description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)", "description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)",
"pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$" "pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$"
},
"shade": {
"type": "string",
"description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)",
"pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$",
"deprecated": true
},
"textSelection": {
"type": "string",
"description": "Hex RGB & ARGB values both are supported. (e.g. #dbdbdb99)",
"pattern": "^#(?:(?:[\\da-fA-F]{3}){1,2}|(?:[\\da-fA-F]{4}){1,2})$",
"deprecated": true
} }
}, },
"additionalProperties": false "additionalProperties": false