@monospaced/set-tokens 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@monospaced/set-tokens",
3
+ "version": "0.0.0",
4
+ "description": "Set tokens as data: DTCG-shaped JSON artifacts and JSON Schema. For docs sites, MCP, agents, and downstream tooling.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/monospaced/set.git",
8
+ "directory": "packages/tokens"
9
+ },
10
+ "type": "module",
11
+ "files": [
12
+ "dist",
13
+ "schemas",
14
+ "README.md"
15
+ ],
16
+ "exports": {
17
+ "./base": "./dist/set.base.tokens.json",
18
+ "./mnsp": "./dist/set.mnsp.tokens.json",
19
+ "./wrfr": "./dist/set.wrfr.tokens.json",
20
+ "./schemas/v1": "./schemas/tokens.v1.json"
21
+ },
22
+ "devDependencies": {
23
+ "ajv": "^8.20.0",
24
+ "@monospaced/set-system": "0.0.0"
25
+ },
26
+ "scripts": {
27
+ "validate": "node scripts/validate.mjs",
28
+ "verify": "node scripts/verify.mjs"
29
+ }
30
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Set tokens output (v1)",
4
+ "description": "Consumer-facing JSON artifact emitted by the Set token pipeline. Token-centric and DTCG-faithful at the value level; organises per-context variation as overlay maps keyed by the modifier axis (or by partial-tuple for multi-axis tokens). DTCG-defined fields keep the `$` prefix as the spec reserves it; Set-defined fields are bare-named.",
5
+ "type": "object",
6
+ "required": ["namespace", "modifierOrder", "defaultContext", "tokens"],
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "description": "Optional schema URI for editor tooling."
11
+ },
12
+ "namespace": {
13
+ "type": "string",
14
+ "description": "Token namespace prefix used by the system (e.g. \"set\")."
15
+ },
16
+ "brand": {
17
+ "type": ["string", "null"],
18
+ "description": "Brand key, or null for the unbranded base set."
19
+ },
20
+ "modifierOrder": {
21
+ "type": "array",
22
+ "description": "Modifier axis names in the resolution order. Drives how `defaultContext` and any multi-axis `byContext` keys are interpreted.",
23
+ "items": { "type": "string" }
24
+ },
25
+ "defaultContext": {
26
+ "type": "object",
27
+ "description": "The modifier values that the top-level `$value` of every token corresponds to.",
28
+ "additionalProperties": { "type": "string" }
29
+ },
30
+ "tokens": {
31
+ "type": "object",
32
+ "description": "Map of dotted token path → token entry. Includes both private (primitive) and public (semantic) layer tokens; filter by `layer` if needed. The dotted key is the token path — split on `.` to recover segments (DTCG forbids `.` in token names).",
33
+ "additionalProperties": { "$ref": "#/$defs/Token" }
34
+ }
35
+ },
36
+ "$defs": {
37
+ "Token": {
38
+ "type": "object",
39
+ "required": ["layer"],
40
+ "properties": {
41
+ "layer": {
42
+ "type": "string",
43
+ "description": "Token layer — typically \"primitive\" (private) or \"semantic\" (public)."
44
+ },
45
+ "$type": {
46
+ "type": "string",
47
+ "description": "DTCG token type (color, dimension, fontFamily, …)."
48
+ },
49
+ "$description": {
50
+ "type": "string",
51
+ "description": "DTCG human-readable description."
52
+ },
53
+ "$value": {
54
+ "description": "Default-context value. Shape depends on `$type` per DTCG."
55
+ },
56
+ "$extensions": {
57
+ "type": "object",
58
+ "description": "Third-party DTCG extensions. Set-internal `co.monospaced.set.*` namespaces are stripped before emission."
59
+ },
60
+ "varyingModifiers": {
61
+ "type": "array",
62
+ "description": "Modifier axes the token's value actually depends on. Absent when the token is constant across all contexts.",
63
+ "items": { "type": "string" }
64
+ },
65
+ "byContext": {
66
+ "type": "object",
67
+ "description": "Multi-axis overlay map. Keys are partial tuples mentioning only varying axes (e.g. \"theme=darkDefault,forcedColors=on\"). Only present when `varyingModifiers` has 2+ entries.",
68
+ "additionalProperties": { "$ref": "#/$defs/Overlay" }
69
+ }
70
+ },
71
+ "patternProperties": {
72
+ "^by[A-Z][A-Za-z0-9]*$": {
73
+ "description": "Single-axis overlay map (e.g. `byTheme`, `bySize`). Keys are values of the varying axis. Only non-default values are listed (the default lives at top-level `$value`). Field name is `by` + capitalized axis name from `modifierOrder`.",
74
+ "type": "object",
75
+ "additionalProperties": { "$ref": "#/$defs/Overlay" }
76
+ }
77
+ }
78
+ },
79
+ "Overlay": {
80
+ "type": "object",
81
+ "required": ["$value"],
82
+ "properties": {
83
+ "$value": {
84
+ "description": "Override value for this context. Same DTCG shape as the token's default `$value`."
85
+ },
86
+ "$extensions": { "type": "object" }
87
+ }
88
+ }
89
+ }
90
+ }