Files
WRNexusJS/packages/design-system/schema.json
T

569 lines
13 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://wrnexus.dev/schemas/design-system-v1.json",
"title": "WrNexus Design System v1 (tokens and core component recipes)",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion", "id", "name", "version", "tokens"],
"properties": {
"schemaVersion": {
"const": 1
},
"id": {
"$ref": "#/$defs/name"
},
"name": {
"type": "string",
"minLength": 1
},
"version": {
"type": "string",
"minLength": 1
},
"description": {
"type": "string"
},
"extends": {
"type": "array",
"items": {
"$ref": "#/$defs/name"
}
},
"tokens": {
"$ref": "#/$defs/tokens"
},
"defaultMode": {
"$ref": "#/$defs/name"
},
"modes": {
"$ref": "#/$defs/axis"
},
"densities": {
"$ref": "#/$defs/axis"
},
"recipes": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/recipe"
}
}
},
"$defs": {
"name": {
"type": "string",
"pattern": "^[a-zA-Z][a-zA-Z0-9_.-]*$"
},
"axis": {
"type": "object",
"propertyNames": {
"$ref": "#/$defs/name"
},
"additionalProperties": {
"$ref": "#/$defs/tokens"
}
},
"tokens": {
"type": "object",
"propertyNames": {
"$ref": "#/$defs/name"
},
"additionalProperties": {
"$ref": "#/$defs/token"
}
},
"token": {
"type": "object",
"additionalProperties": false,
"required": ["type", "value"],
"properties": {
"type": {
"enum": [
"color",
"dimension",
"number",
"fontFamily",
"duration",
"shadow",
"fontWeight",
"colorScheme"
]
},
"value": {
"oneOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 2048
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"legacy": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]*$"
},
"description": {
"type": "string"
}
}
},
"recipeStyles": {
"type": "object",
"additionalProperties": false,
"properties": {
"borderRadius": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"borderWidth": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"borderColor": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"borderStyle": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"boxShadow": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"paddingInline": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"paddingBlock": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"gap": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"minHeight": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"color": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"backgroundColor": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"backgroundImage": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"fontFamily": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"fontSize": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"fontWeight": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"letterSpacing": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"outlineColor": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"opacity": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
},
"rotate": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": {
"$ref": "#/$defs/name"
}
}
}
]
}
}
},
"recipeParts": {
"type": "object",
"propertyNames": {
"$ref": "#/$defs/name"
},
"additionalProperties": {
"$ref": "#/$defs/recipeStyles"
}
},
"recipe": {
"type": "object",
"additionalProperties": false,
"required": ["contractVersion"],
"properties": {
"contractVersion": {
"const": 1
},
"base": {
"$ref": "#/$defs/recipeParts"
},
"variants": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["when", "parts"],
"properties": {
"when": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"type": "string"
}
},
"parts": {
"$ref": "#/$defs/recipeParts"
}
}
}
},
"states": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["state", "parts"],
"properties": {
"state": {
"type": "string"
},
"parts": {
"$ref": "#/$defs/recipeParts"
}
}
}
}
}
}
},
"$comment": "Runtime validation additionally checks typed CSS values, references, inheritance, contract parts/axes/states, property constraints, and output collisions. Executable imports are unsupported."
}