@lostgradient/cinder 0.27.0 → 0.28.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.
Files changed (261) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/components.json +1 -1
  3. package/dist/_internal/code-highlighter-context.d.ts +28 -0
  4. package/dist/cli/index.js +12 -8
  5. package/dist/components/approval-card/index.js +4 -4
  6. package/dist/components/button/button.css +25 -0
  7. package/dist/components/calendar/calendar.css +14 -0
  8. package/dist/components/capability-gate/capability-gate.css +5 -0
  9. package/dist/components/checkbox/checkbox.css +19 -0
  10. package/dist/components/chip/chip.css +14 -0
  11. package/dist/components/code-block/code-block.d.svelte.ts +1 -1
  12. package/dist/components/code-block/code-block.examples.json +1 -1
  13. package/dist/components/code-block/code-block.schema.js +3 -3
  14. package/dist/components/code-block/code-block.svelte.d.ts +1 -1
  15. package/dist/components/code-block/code-block.types.d.ts +14 -12
  16. package/dist/components/code-block/index.js +2 -2
  17. package/dist/components/color-picker/color-picker.css +2 -0
  18. package/dist/components/combobox/combobox.css +9 -1
  19. package/dist/components/command-palette/command-palette.css +7 -5
  20. package/dist/components/file-upload/file-upload.css +2 -1
  21. package/dist/components/guidance-region/index.css +1 -1
  22. package/dist/components/image/image.examples.json +1 -1
  23. package/dist/components/input/input.css +20 -6
  24. package/dist/components/json-schema-editor/index.js +5 -5
  25. package/dist/components/json-schema-editor/json-view-highlighter.d.ts +14 -0
  26. package/dist/components/key-value-editor/index.css +1 -1
  27. package/dist/components/modal-region/index.css +1 -1
  28. package/dist/components/multi-select/multi-select.css +9 -0
  29. package/dist/components/pagination/pagination.css +12 -0
  30. package/dist/components/pin-input/pin-input.css +9 -1
  31. package/dist/components/radio-group/radio-group.css +16 -0
  32. package/dist/components/run-step-timeline/index.js +2 -2
  33. package/dist/components/schema-form/index.js +2 -2
  34. package/dist/components/schema-form/schema-form.css +9 -0
  35. package/dist/components/segmented-control/segmented-control.css +3 -3
  36. package/dist/components/selection-popover/selection-popover.css +7 -1
  37. package/dist/components/tag-input/tag-input.css +10 -1
  38. package/dist/components/terminal-frame/index.js +2 -2
  39. package/dist/components/terminal-frame/terminal-frame.schema.js +2 -2
  40. package/dist/components/terminal-frame/terminal-frame.types.d.ts +8 -0
  41. package/dist/components/textarea/textarea.css +1 -1
  42. package/dist/components/toggle/toggle.css +16 -0
  43. package/dist/components/tree/tree.examples.json +1 -1
  44. package/dist/components/virtual-list/index.js +2 -2
  45. package/dist/components/virtual-list/virtual-list.css +42 -9
  46. package/dist/highlighters/shiki/default.d.ts +13 -1
  47. package/dist/highlighters/shiki/default.js +2 -2
  48. package/dist/highlighters/shiki/index.d.ts +20 -12
  49. package/dist/highlighters/shiki/index.js +2 -2
  50. package/dist/index.browser.css +1 -1
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +23 -23
  53. package/dist/scripts/knowledge/index.d.ts +5 -1
  54. package/dist/server/components/approval-card/index.js +1 -1
  55. package/dist/server/components/code-block/index.js +1 -1
  56. package/dist/server/components/color-field/index.js +2 -2
  57. package/dist/server/components/color-picker/index.js +2 -2
  58. package/dist/server/components/json-schema-editor/index.js +2 -2
  59. package/dist/server/components/run-step-timeline/index.js +1 -1
  60. package/dist/server/components/terminal-frame/index.js +1 -1
  61. package/dist/server/components/virtual-list/index.js +1 -1
  62. package/dist/server/github-dark-e7nywpbe.js +3 -0
  63. package/dist/server/github-light-bqtmm1zq.js +3 -0
  64. package/dist/server/highlighters/shiki/default.js +2 -2
  65. package/dist/server/highlighters/shiki/index.js +2 -2
  66. package/dist/server/index.js +6 -6
  67. package/dist/server/{index.server-4qyyw4y5.js → index.server-043cfznf.js} +1 -1
  68. package/dist/server/{index.server-p46tn4eb.js → index.server-09tjs48p.js} +2 -2
  69. package/dist/server/index.server-0hyvdf74.js +8 -0
  70. package/dist/server/{index.server-dxgkh9tk.js → index.server-17thvpd3.js} +1 -1
  71. package/dist/server/index.server-19z6hqd6.js +4 -0
  72. package/dist/server/index.server-31020qgk.js +3 -0
  73. package/dist/server/{index.server-w3nqzde5.js → index.server-45wmvjrn.js} +3 -3
  74. package/dist/server/{index.server-3tkgm2gn.js → index.server-6mb7w5g4.js} +2 -2
  75. package/dist/server/{index.server-2vxmn7x1.js → index.server-c5yajkkc.js} +4 -4
  76. package/dist/server/index.server-e6fknxd9.js +4 -0
  77. package/dist/server/index.server-fev4kwm0.js +4 -0
  78. package/dist/server/index.server-k4vjk75r.js +4 -0
  79. package/dist/server/index.server-mjbtd1gs.js +7 -0
  80. package/dist/server/{index.server-2bfkhzzq.js → index.server-rkp4py5n.js} +2 -2
  81. package/dist/server/index.server-wdz9tsq4.js +3 -0
  82. package/dist/server/index.server-zj9909hd.js +4 -0
  83. package/dist/server/json-68twtta3.js +3 -0
  84. package/dist/server/tokens/registry.generated.js +1 -1
  85. package/dist/server/tokens/runtime/index.js +92 -0
  86. package/dist/styles/check-token-contrast-test-values.d.ts +1 -3
  87. package/dist/styles/token-contrast-test-readers.d.ts +1 -1
  88. package/dist/tokens/registry.generated.js +2 -2
  89. package/dist/tokens/resolved/dark-reduced-motion.json +104 -43
  90. package/dist/tokens/resolved/dark.json +104 -43
  91. package/dist/tokens/resolved/light-reduced-motion.json +104 -43
  92. package/dist/tokens/resolved/light.json +104 -43
  93. package/dist/tokens/runtime/authoring-catalogue.d.ts +19 -0
  94. package/dist/tokens/runtime/authoring-catalogue.generated.d.ts +8 -0
  95. package/dist/tokens/runtime/authoring-palette.d.ts +25 -0
  96. package/dist/tokens/runtime/authoring-profiles.d.ts +48 -0
  97. package/dist/tokens/runtime/authoring-provenance.d.ts +31 -0
  98. package/dist/tokens/runtime/authoring-types.d.ts +182 -0
  99. package/dist/tokens/runtime/base-corpus.d.ts +29 -0
  100. package/dist/tokens/runtime/base-corpus.generated.d.ts +8 -0
  101. package/dist/tokens/runtime/context-order.d.ts +60 -0
  102. package/dist/tokens/runtime/context-stack.d.ts +11 -0
  103. package/dist/tokens/runtime/contrast/color-difference.d.ts +16 -0
  104. package/dist/{styles/color-contrast-utilities.d.ts → tokens/runtime/contrast/color-math.d.ts} +2 -17
  105. package/dist/tokens/runtime/contrast/color-mix.d.ts +3 -0
  106. package/dist/tokens/runtime/contrast/css-color.d.ts +29 -0
  107. package/dist/tokens/runtime/contrast/index.d.ts +7 -0
  108. package/dist/tokens/runtime/contrast/measure.d.ts +45 -0
  109. package/dist/tokens/runtime/contrast/pairings.d.ts +36 -0
  110. package/dist/tokens/runtime/contrast/thresholds.d.ts +47 -0
  111. package/dist/tokens/runtime/corpus-documents.d.ts +36 -0
  112. package/dist/tokens/runtime/corpus-validation.d.ts +10 -0
  113. package/dist/tokens/runtime/corpus.d.ts +35 -0
  114. package/dist/tokens/runtime/css-configuration.d.ts +1 -0
  115. package/dist/tokens/runtime/css-stylelint.d.ts +2 -0
  116. package/dist/tokens/runtime/css-support.d.ts +110 -0
  117. package/dist/tokens/runtime/evaluate.d.ts +95 -0
  118. package/dist/tokens/runtime/evaluated-provenance.d.ts +36 -0
  119. package/dist/tokens/runtime/index.d.ts +38 -0
  120. package/dist/tokens/runtime/index.js +95 -0
  121. package/dist/tokens/runtime/package-version.generated.d.ts +9 -0
  122. package/dist/tokens/runtime/projection.d.ts +32 -0
  123. package/dist/tokens/runtime/registry.d.ts +125 -0
  124. package/dist/tokens/runtime/resolve-extends.d.ts +30 -0
  125. package/dist/tokens/runtime/resolve-references.d.ts +49 -0
  126. package/dist/tokens/runtime/resolve-shared.d.ts +34 -0
  127. package/dist/tokens/runtime/resolve.d.ts +44 -0
  128. package/dist/tokens/runtime/resolver-order.d.ts +89 -0
  129. package/dist/tokens/runtime/source-digest.d.ts +20 -0
  130. package/dist/tokens/runtime/stylesheet-skeleton.d.ts +31 -0
  131. package/dist/tokens/runtime/theme-runtime.test-support.d.ts +24 -0
  132. package/dist/tokens/runtime/theme-sources.d.ts +46 -0
  133. package/dist/tokens/runtime/theme-stylesheet.d.ts +31 -0
  134. package/dist/tokens/runtime/types.d.ts +115 -0
  135. package/dist/tokens/runtime/validate-resolver.d.ts +31 -0
  136. package/dist/tokens/runtime/validate-schema.d.ts +22 -0
  137. package/dist/tokens/runtime/validate-tokens.d.ts +25 -0
  138. package/dist/tokens/runtime/validate-values.d.ts +33 -0
  139. package/dist/tokens/runtime/validate.d.ts +3 -0
  140. package/dist/tokens/runtime/value-color-parse.d.ts +128 -0
  141. package/dist/tokens/runtime/value-color.d.ts +85 -0
  142. package/dist/tokens/runtime/value-entry.d.ts +3 -0
  143. package/dist/tokens/runtime/value-formatters.d.ts +59 -0
  144. package/dist/tokens/sets/colors.tokens.json +65 -13
  145. package/dist/tokens/sets/foundation.tokens.json +23 -0
  146. package/dist/tokens/sets/semantic.tokens.json +136 -30
  147. package/dist/utilities/highlighter.d.ts +5 -5
  148. package/dist/utilities/retrying-loader-cache.d.ts +3 -6
  149. package/package.json +15 -3
  150. package/src/_internal/code-highlighter-context.ts +41 -0
  151. package/src/components/button/button.css +25 -0
  152. package/src/components/calendar/calendar.css +14 -0
  153. package/src/components/capability-gate/capability-gate.css +5 -0
  154. package/src/components/checkbox/checkbox.css +19 -0
  155. package/src/components/chip/chip.css +14 -0
  156. package/src/components/code-block/code-block.examples.json +1 -1
  157. package/src/components/code-block/code-block.schema.json +2 -2
  158. package/src/components/code-block/code-block.schema.ts +2 -2
  159. package/src/components/code-block/code-block.svelte +15 -19
  160. package/src/components/code-block/code-block.types.ts +14 -12
  161. package/src/components/color-picker/color-picker.css +2 -0
  162. package/src/components/combobox/combobox.css +9 -1
  163. package/src/components/command-palette/command-palette.css +7 -5
  164. package/src/components/file-upload/file-upload.css +2 -1
  165. package/src/components/image/image.examples.json +1 -1
  166. package/src/components/input/input.css +20 -6
  167. package/src/components/json-schema-editor/json-view-highlighter.ts +23 -0
  168. package/src/components/json-schema-editor/json-view.svelte +2 -0
  169. package/src/components/multi-select/multi-select.css +9 -0
  170. package/src/components/pagination/pagination.css +12 -0
  171. package/src/components/pin-input/pin-input.css +9 -1
  172. package/src/components/radio-group/radio-group.css +16 -0
  173. package/src/components/schema-form/schema-form.css +9 -0
  174. package/src/components/segmented-control/segmented-control.css +3 -3
  175. package/src/components/selection-popover/selection-popover.css +7 -1
  176. package/src/components/tag-input/tag-input.css +10 -1
  177. package/src/components/terminal-frame/terminal-frame.schema.json +5 -0
  178. package/src/components/terminal-frame/terminal-frame.schema.ts +6 -0
  179. package/src/components/terminal-frame/terminal-frame.svelte +6 -2
  180. package/src/components/terminal-frame/terminal-frame.types.ts +8 -0
  181. package/src/components/textarea/textarea.css +1 -1
  182. package/src/components/toggle/toggle.css +16 -0
  183. package/src/components/tree/tree.examples.json +1 -1
  184. package/src/components/virtual-list/virtual-list.css +42 -9
  185. package/src/components/virtual-list/virtual-list.svelte +54 -20
  186. package/src/highlighters/shiki/default.ts +13 -1
  187. package/src/highlighters/shiki/index.ts +20 -12
  188. package/src/index.ts +5 -0
  189. package/src/styles/foundation.css +33 -1
  190. package/src/styles/tokens-base.css +4 -4
  191. package/src/tokens/registry.generated.json +3 -3
  192. package/src/tokens/resolved/dark-reduced-motion.json +104 -43
  193. package/src/tokens/resolved/dark.json +104 -43
  194. package/src/tokens/resolved/light-reduced-motion.json +104 -43
  195. package/src/tokens/resolved/light.json +104 -43
  196. package/src/tokens/runtime/authoring-catalogue.generated.ts +19300 -0
  197. package/src/tokens/runtime/authoring-catalogue.ts +256 -0
  198. package/src/tokens/runtime/authoring-palette.ts +100 -0
  199. package/src/tokens/runtime/authoring-profiles.ts +288 -0
  200. package/src/tokens/runtime/authoring-provenance.ts +290 -0
  201. package/src/tokens/runtime/authoring-types.ts +199 -0
  202. package/src/tokens/runtime/base-corpus.generated.ts +10 -0
  203. package/src/tokens/runtime/base-corpus.ts +78 -0
  204. package/src/tokens/runtime/context-order.ts +182 -0
  205. package/src/tokens/runtime/context-stack.ts +52 -0
  206. package/src/tokens/runtime/contrast/color-difference.ts +114 -0
  207. package/src/tokens/runtime/contrast/color-math.ts +89 -0
  208. package/src/tokens/runtime/contrast/color-mix.ts +20 -0
  209. package/src/tokens/runtime/contrast/css-color.ts +312 -0
  210. package/src/tokens/runtime/contrast/index.ts +7 -0
  211. package/src/tokens/runtime/contrast/measure.ts +185 -0
  212. package/src/tokens/runtime/contrast/pairings.ts +324 -0
  213. package/src/tokens/runtime/contrast/thresholds.ts +81 -0
  214. package/src/tokens/runtime/corpus-documents.ts +289 -0
  215. package/src/tokens/runtime/corpus-validation.ts +336 -0
  216. package/src/tokens/runtime/corpus.ts +179 -0
  217. package/src/tokens/runtime/css-configuration.ts +1 -0
  218. package/src/tokens/runtime/css-stylelint.ts +15 -0
  219. package/src/tokens/runtime/css-support.ts +407 -0
  220. package/src/tokens/runtime/evaluate.ts +262 -0
  221. package/src/tokens/runtime/evaluated-provenance.ts +116 -0
  222. package/src/tokens/runtime/format-validator.generated.d.ts +18 -0
  223. package/src/tokens/runtime/format-validator.generated.js +13029 -0
  224. package/src/tokens/runtime/index.ts +78 -0
  225. package/src/tokens/runtime/package-version.generated.ts +9 -0
  226. package/src/tokens/runtime/projection.ts +65 -0
  227. package/src/tokens/runtime/registry.ts +365 -0
  228. package/src/tokens/runtime/resolve-extends.ts +211 -0
  229. package/src/tokens/runtime/resolve-references.ts +313 -0
  230. package/src/tokens/runtime/resolve-shared.ts +186 -0
  231. package/src/tokens/runtime/resolve.ts +246 -0
  232. package/src/tokens/runtime/resolver-order.ts +326 -0
  233. package/src/tokens/runtime/resolver-validator.generated.d.ts +18 -0
  234. package/src/tokens/runtime/resolver-validator.generated.js +15492 -0
  235. package/src/tokens/runtime/source-digest.ts +49 -0
  236. package/src/tokens/runtime/stylesheet-skeleton.ts +123 -0
  237. package/src/tokens/runtime/theme-sources.ts +121 -0
  238. package/src/tokens/runtime/theme-stylesheet.ts +177 -0
  239. package/src/tokens/runtime/types.ts +140 -0
  240. package/src/tokens/runtime/validate-resolver.ts +338 -0
  241. package/src/tokens/runtime/validate-schema.ts +269 -0
  242. package/src/tokens/runtime/validate-tokens.ts +181 -0
  243. package/src/tokens/runtime/validate-values.ts +396 -0
  244. package/src/tokens/runtime/validate.ts +57 -0
  245. package/src/tokens/runtime/value-color-parse.ts +309 -0
  246. package/src/tokens/runtime/value-color.ts +217 -0
  247. package/src/tokens/runtime/value-entry.ts +52 -0
  248. package/src/tokens/runtime/value-formatters.ts +414 -0
  249. package/src/tokens/sets/colors.tokens.json +65 -13
  250. package/src/tokens/sets/foundation.tokens.json +23 -0
  251. package/src/tokens/sets/semantic.tokens.json +136 -30
  252. package/src/utilities/highlighter.ts +5 -5
  253. package/src/utilities/retrying-loader-cache.ts +3 -6
  254. package/dist/components/code-block/code-block-default-highlighter.d.ts +0 -40
  255. package/dist/server/index.server-298z43yn.js +0 -4
  256. package/dist/server/index.server-3h11wjyh.js +0 -8
  257. package/dist/server/index.server-a3aerbfr.js +0 -4
  258. package/dist/server/index.server-kge3zp6n.js +0 -4
  259. package/dist/server/index.server-syf81nwz.js +0 -6
  260. package/dist/server/index.server-zs08f5te.js +0 -3
  261. package/src/components/code-block/code-block-default-highlighter.ts +0 -63
@@ -0,0 +1,48 @@
1
+ /**
2
+ * CSS usage profiles: the numeric and structural contract each public token
3
+ * must honor, given the CSS properties it feeds.
4
+ *
5
+ * DTCG says a `number` is any number and a `dimension` any signed length. CSS
6
+ * is stricter per property (an opacity outside 0-1 is clamped, a negative
7
+ * padding is invalid, a fractional z-index is not an integer), so a theme
8
+ * editor needs the per-property limits, not the type's. A profile is that
9
+ * limit. It is looked up from an explicit ordered rule table over type,
10
+ * category, and path, never inferred from a name prefix alone, and the lookup
11
+ * fails loudly on a token no rule covers or two rules disagree about.
12
+ *
13
+ * No Node imports: TB05's value validation and the browser runtime reuse this.
14
+ */
15
+ import type { ProfileDefinition } from './authoring-types.ts';
16
+ import type { TokenType } from './types.ts';
17
+ /** DTCG 2025.10 named font weights (the `fontWeight` value schema's string enum). */
18
+ export declare const FONT_WEIGHT_KEYWORDS: string[];
19
+ export declare const PROFILES: Readonly<Record<string, ProfileDefinition>>;
20
+ /** What a rule needs to know about a token. */
21
+ export type ProfileSubject = {
22
+ path: string;
23
+ type: TokenType | undefined;
24
+ category: string | undefined;
25
+ /** A trusted `cssRecipe` governs the CSS, so the DTCG type need not match the profile. */
26
+ hasRecipe: boolean;
27
+ };
28
+ type ProfileRule = {
29
+ profile: string;
30
+ type?: TokenType;
31
+ category?: string;
32
+ path?: RegExp;
33
+ unless?: RegExp;
34
+ };
35
+ /**
36
+ * Every rule that matches must name the same profile. Rules are narrow on
37
+ * purpose: a new public token that none matches fails generation and has to be
38
+ * given a deliberate usage contract.
39
+ */
40
+ export declare const PROFILE_RULES: readonly ProfileRule[];
41
+ /**
42
+ * The usage profile for a token. Throws when no rule covers it, when rules
43
+ * disagree, or when the matched profile cannot describe the token's type.
44
+ */
45
+ export declare function selectProfile(subject: ProfileSubject, rules?: readonly ProfileRule[], profiles?: Readonly<Record<string, ProfileDefinition>>): ProfileDefinition;
46
+ /** The first reason `value` violates the profile's numeric range, or undefined when it fits. */
47
+ export declare function profileRangeViolation(profile: ProfileDefinition, value: number | string): string | undefined;
48
+ export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Per-token provenance for one ordered document stack.
3
+ *
4
+ * Given the documents one modifier context resolves, in resolution order, this
5
+ * reports for every token which layers supply it, which declaration wins, where
6
+ * its effective DTCG type is declared, and what its winning declaration reads.
7
+ * It reuses the evaluation machinery (`mergeAndExpandExtends`, `collectEntries`)
8
+ * instead of re-deriving it, so the answer is the evaluator's own: the tests
9
+ * assert it matches `resolveDocuments` for every token.
10
+ *
11
+ * No Node imports. The COR-491 runtime reuses this for an edited layer stack,
12
+ * so resetting an override is just tracing the stack without that edit.
13
+ */
14
+ import { type AuthoringLayer, type TokenContextProvenance } from './authoring-types.ts';
15
+ import type { TokenDocument } from './types.ts';
16
+ /** One layer of a stack: its identity and its raw document. */
17
+ export type ProvenanceLayerInput = AuthoringLayer & {
18
+ content: TokenDocument;
19
+ };
20
+ export type TraceOptions = {
21
+ /** Public custom property -> token path, used to name `cssRecipe` inputs. */
22
+ cssPropertyToPath?: Readonly<Record<string, string>>;
23
+ };
24
+ /**
25
+ * The merged `com.lostgradient.cinder` extension block of every token, keyed by
26
+ * path. `CorpusEntry` carries only the fields CSS generation reads; the
27
+ * catalogue also needs `nonRepresentableValue` and `scale`.
28
+ */
29
+ export declare function collectCinderExtensions(root: TokenDocument): Map<string, Record<string, unknown>>;
30
+ /** Traces every token of one ordered stack. */
31
+ export declare function traceProvenance(stack: readonly ProvenanceLayerInput[], options?: TraceOptions): Map<string, TokenContextProvenance>;
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Data model for the token authoring catalogue.
3
+ *
4
+ * This module is deliberately free of Node imports and of any import that
5
+ * reaches Node: the shapes below are the contract the browser-side token
6
+ * runtime (COR-491) consumes, so they must be movable into
7
+ * `src/tokens/runtime/` unchanged. Everything here is plain JSON-serializable
8
+ * data.
9
+ *
10
+ * The central record is {@link TokenContextProvenance}: where one token's value
11
+ * and type come from in one concrete modifier context. The catalogue stores it
12
+ * per token and per context (deduplicated into {@link ProvenanceVariant}s),
13
+ * and the runtime recomputes the same shape from an edited layer stack.
14
+ */
15
+ import type { TokenType } from './types.ts';
16
+ /** The literal rendered for source metadata the corpus does not declare. */
17
+ export declare const UNKNOWN: "unknown";
18
+ export type Unknown = typeof UNKNOWN;
19
+ /** One concrete modifier combination, e.g. `{ theme: 'dark', motion: 'reduced' }`. */
20
+ export type AuthoringContext = {
21
+ /** Deterministic id: `<theme>/<motion>`. */
22
+ id: string;
23
+ theme: string;
24
+ motion: string;
25
+ };
26
+ export declare function authoringContextId(theme: string, motion: string): string;
27
+ /** Whether a layer is a resolver set or one context of a modifier. */
28
+ export type LayerKind = 'set' | 'modifier';
29
+ /** One ordered document in a context's resolution stack. */
30
+ export type AuthoringLayer = {
31
+ /** The document id: its repository-relative source path. */
32
+ document: string;
33
+ kind: LayerKind;
34
+ /** The resolver entry that contributed it, e.g. `sets.foundation` or `theme.dark`. */
35
+ layer: string;
36
+ };
37
+ /** A token path inside one document. */
38
+ export type TokenLocation = {
39
+ document: string;
40
+ path: string;
41
+ };
42
+ /** A layer that supplies a token, plus how it supplies it. */
43
+ export type ContributingLayer = TokenLocation & AuthoringLayer & {
44
+ /** `declared` is written in the layer; `extends` arrives through a group `$extends`. */
45
+ via: 'declared' | 'extends';
46
+ };
47
+ /** The effective DTCG type and where it is declared. */
48
+ export type EffectiveType = {
49
+ type: TokenType | Unknown;
50
+ /** `local` is typed on the token itself; `inherited` comes from an ancestor group. */
51
+ origin: 'local' | 'inherited' | Unknown;
52
+ /** The node that declares the type: the token (local) or the group (inherited). */
53
+ declaredAt: TokenLocation | Unknown;
54
+ };
55
+ /** The direct inputs of the winning declaration. */
56
+ export type TokenInputs = {
57
+ /** Token paths named by `{a.b}` references inside `$value`, in first-use order. */
58
+ aliases: string[];
59
+ /** Token paths named by a whole-token `$ref` pointer. */
60
+ refs: string[];
61
+ /** Groups the token's ancestors extend: `group` extends `target`. */
62
+ extends: Array<{
63
+ group: string;
64
+ target: string;
65
+ }>;
66
+ /** Public custom properties a trusted `cssRecipe` reads through `var()`. */
67
+ recipes: Array<{
68
+ cssProperty: string;
69
+ path: string;
70
+ }>;
71
+ };
72
+ /** Provenance of one token in one concrete context. The TB02 runtime reuses this shape. */
73
+ export type TokenContextProvenance = {
74
+ /** The winning declaration (the last contributing layer). */
75
+ winner: TokenLocation;
76
+ /** Every layer that supplies the token, lowest precedence first. */
77
+ layers: ContributingLayer[];
78
+ effectiveType: EffectiveType;
79
+ inputs: TokenInputs;
80
+ };
81
+ /** One provenance record shared by every context in `contexts`. */
82
+ export type ProvenanceVariant = {
83
+ contexts: string[];
84
+ provenance: TokenContextProvenance;
85
+ };
86
+ /** How a token may be edited, exported as CSS, and exported as portable DTCG. */
87
+ export type TokenDisposition = {
88
+ /**
89
+ * `supported` edits the DTCG `$value`; `recipe` edits a trusted `cssRecipe`
90
+ * that governs the CSS; `css-only` has no DTCG-editable value at all.
91
+ */
92
+ edit: 'supported' | 'recipe' | 'css-only';
93
+ /** Every public token is emitted into `tokens-base.css`. */
94
+ cssExport: 'supported';
95
+ /**
96
+ * `complete` exports the whole token; `subset` exports the DTCG value but not
97
+ * the CSS recipe that governs the emitted CSS; `none` exports nothing,
98
+ * because the token has no faithful portable value.
99
+ */
100
+ dtcgExport: 'complete' | 'subset' | 'none';
101
+ cssSerialization: 'typed-value' | 'trusted-recipe' | 'mixed';
102
+ /** The real CSS value, present only for `css-only` tokens. Never a placeholder. */
103
+ cssValue?: string;
104
+ /** Why a token is not fully portable. */
105
+ reason?: string;
106
+ };
107
+ /** The numeric part a usage profile constrains. */
108
+ export type ProfileNumericPart = 'number' | 'dimension.value' | 'duration.value' | 'fontWeight';
109
+ /** A machine-readable numeric constraint. All bounds are inclusive unless stated. */
110
+ export type ProfileRange = {
111
+ part: ProfileNumericPart;
112
+ finite: true;
113
+ min?: number;
114
+ max?: number;
115
+ /** When true the `min` bound itself is rejected (`> min`). */
116
+ minExclusive?: boolean;
117
+ integer?: boolean;
118
+ };
119
+ /** A CSS usage contract: what a token may legally be, given the properties it feeds. */
120
+ export type ProfileDefinition = {
121
+ id: string;
122
+ description: string;
123
+ /** DTCG types a token with this profile may have (a trusted `cssRecipe` may override). */
124
+ types: TokenType[];
125
+ /** The CSS properties the token is consumed by. */
126
+ cssUsage: string[];
127
+ /** Absent for non-numeric profiles. */
128
+ range?: ProfileRange;
129
+ /** Named values accepted in place of a number (font weights). */
130
+ keywords?: string[];
131
+ };
132
+ /** The palette families a color token may belong to. */
133
+ export declare const PALETTE_FAMILIES: readonly ["accent", "neutral", "success", "warning", "danger", "info"];
134
+ export type PaletteFamily = (typeof PALETTE_FAMILIES)[number];
135
+ /** A color token's declared membership of one palette family. */
136
+ export type PaletteMembership = {
137
+ family: PaletteFamily;
138
+ /** The role the token plays inside the family, unique within the family. */
139
+ role: string;
140
+ /** True for the single token that holds the family's seed-matching color. */
141
+ anchor: boolean;
142
+ };
143
+ /** One generated record per public registry entry. */
144
+ export type AuthoringRecord = {
145
+ path: string;
146
+ cssProperty: string;
147
+ /** The literal `unknown` when the corpus declares none. */
148
+ category: string;
149
+ component: string | null;
150
+ /** The literal `unknown` when the corpus declares none. */
151
+ description: string;
152
+ themeAware: boolean;
153
+ deprecated: boolean | string;
154
+ /** The usage profile id (see `authoring-profiles.ts`). */
155
+ profile: string;
156
+ /** The scale this token is a member of, when the corpus marks one. */
157
+ scale?: string;
158
+ /**
159
+ * Palette membership of a color token, from the explicit `palette` extension in source (never
160
+ * inferred from the token name). A color token that declares none reports `unknown`.
161
+ */
162
+ palette?: PaletteMembership | {
163
+ family: Unknown;
164
+ role: Unknown;
165
+ anchor: Unknown;
166
+ };
167
+ disposition: TokenDisposition;
168
+ variants: ProvenanceVariant[];
169
+ };
170
+ /** The generated artifact. */
171
+ export type AuthoringCatalogue = {
172
+ version: 1;
173
+ dtcgVersion: '2025.10';
174
+ contexts: AuthoringContext[];
175
+ /** Ordered layer stack per context id. */
176
+ layerStacks: Record<string, AuthoringLayer[]>;
177
+ /** Profile definitions referenced by `AuthoringRecord.profile`. */
178
+ profiles: Record<string, ProfileDefinition>;
179
+ /** Scale name -> member token paths, in group order. */
180
+ scales: Record<string, string[]>;
181
+ records: AuthoringRecord[];
182
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The immutable Cinder token base, as data.
3
+ *
4
+ * A theme is a set of overrides on this base, so a consumer that evaluates or
5
+ * saves a theme needs the base it was written against. This exports the
6
+ * resolver and every bundled token document keyed by relative path (the same
7
+ * keys the resolver's `$ref`s use), the package version, and a digest of the
8
+ * sources so a saved theme can detect that the base has since changed.
9
+ *
10
+ * The documents are the package's own source files, imported as JSON: one copy,
11
+ * no generated duplicate. The version and digest are generated by
12
+ * `tokens:generate` and checked by `tokens:check`; the runtime test recomputes
13
+ * the digest from these documents and fails if they disagree.
14
+ */
15
+ import type { ResolverDocument, TokenDocument } from './types.ts';
16
+ /** The bundled Cinder base: what a theme's overrides are applied to. */
17
+ export type CinderBase = {
18
+ /**
19
+ * The `@lostgradient/cinder` version these sources ship in: `workspace` in the
20
+ * monorepo, and the published version in a mirrored package.
21
+ */
22
+ packageVersion: string;
23
+ /** `sha256:<hex>` over the canonical form of `{ resolver, documents }`. */
24
+ sourceDigest: string;
25
+ resolver: ResolverDocument;
26
+ /** Token documents keyed by the relative path the resolver references. */
27
+ documents: Readonly<Record<string, TokenDocument>>;
28
+ };
29
+ export declare const CINDER_BASE: CinderBase;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GENERATED FILE. Do not edit by hand.
3
+ *
4
+ * The source digest of the bundled Cinder token base: a digest of the resolver
5
+ * and documents only, so nothing that changes at publish time can alter it.
6
+ * Regenerate: bun run --filter=@lostgradient/cinder tokens:generate
7
+ */
8
+ export declare const BASE_SOURCE_DIGEST = "sha256:35fb1c57b3c88ef6a75177972511a54deeda735c903b0bf71d63929200d37a28";
@@ -0,0 +1,60 @@
1
+ import { type CorpusEntry } from './corpus.ts';
2
+ import type { ResolverDocument, ResolverReference, TokenDocument } from './types.ts';
3
+ export type ResolvedContextCombo = {
4
+ name: string;
5
+ theme: string;
6
+ motion: string;
7
+ };
8
+ export declare const RESOLVED_CONTEXT_COMBOS: readonly ResolvedContextCombo[];
9
+ /**
10
+ * The token documents one modifier-value combination contributes, in
11
+ * `resolver.resolutionOrder` order rather than a hardcoded [sets, theme,
12
+ * motion] order. Mirrors `validate-corpus.ts`'s own per-combination assembly
13
+ * (`parseResolutionOrder` / `sourcesForEntry`) so the resolved snapshots and
14
+ * the validator agree on ordering even if the resolver ever reorders or adds
15
+ * a set/modifier -- `mergeDocuments` keeps only the LAST occurrence of a
16
+ * colliding token path, so document order determines the resolved value.
17
+ */
18
+ export declare function documentsForResolutionOrder(resolver: ResolverDocument, documentsByPath: Map<string, TokenDocument>, modifierValues: Record<string, string>): TokenDocument[];
19
+ /**
20
+ * The full modifier-value map for one `RESOLVED_CONTEXT_COMBO`: the combo's own named
21
+ * modifiers (`theme`/`motion`), plus a value for every OTHER modifier the resolver declares.
22
+ * `RESOLVED_CONTEXT_COMBOS` is deliberately not generalized to every modifier combination --
23
+ * the set of published resolved contexts is a packaging decision (CIN-31), and the four named
24
+ * snapshots stay an explicit list.
25
+ */
26
+ export declare function modifierValuesForCombo(resolver: ResolverDocument, combo: ResolvedContextCombo): Record<string, string>;
27
+ /**
28
+ * The full modifier-value map for building ONE override context in isolation -- e.g. the "dark"
29
+ * theme block or the "reduced" motion block in `tokens-base.css`, each of which varies a single
30
+ * modifier while every other modifier stays at its own declared default. This is the same
31
+ * default-fill `modifierValuesForCombo` applies for the resolved-context snapshots, so an
32
+ * override block's composed document scope and a snapshot's agree on what "the rest of the
33
+ * corpus" means whenever a block only varies one axis.
34
+ */
35
+ export declare function modifierValuesForContext(resolver: ResolverDocument, modifierName: string, contextName: string): Record<string, string>;
36
+ export declare function scopeIndexFromDocuments(documents: readonly TokenDocument[]): Map<string, CorpusEntry>;
37
+ /**
38
+ * The tokens an override context (a theme or motion modifier) defines, each as
39
+ * that context evaluates it.
40
+ *
41
+ * Membership -- which tokens the context overrides, and in what order -- comes
42
+ * from the context's own documents. Each token's content comes from the same
43
+ * evaluation the runtime projects (`scopeIndexFromDocuments` over the whole
44
+ * ordered scope), so a type, `$extends` member, or other metadata the override
45
+ * document inherits from an earlier layer is resolved once, here, and the
46
+ * stylesheet generator and the browser cannot disagree about it. An override
47
+ * document therefore need not restate a group `$type` its base already declares.
48
+ */
49
+ export declare function overrideEntries(ownDocuments: readonly TokenDocument[], scopeDocuments: readonly TokenDocument[]): Map<string, CorpusEntry>;
50
+ export declare function documentsForSystemMotionScope(resolver: ResolverDocument, documentsByPath: Map<string, TokenDocument>, motion: string): TokenDocument[];
51
+ /**
52
+ * `documentsByPath` is keyed by the normalized relative path `loadTokenDocuments`
53
+ * reports (see `load.ts`'s `Glob` scan), but a resolver `$ref` is a URI reference
54
+ * that may spell the same file differently (`./sets/x.tokens.json`, a percent-escaped
55
+ * path). `normalizeSourcePath` -- reused from `validate-corpus.ts`, which faces the
56
+ * identical lookup and already normalizes before comparing -- collapses both to the
57
+ * same key, so a schema-valid ref that validation accepts also resolves here.
58
+ */
59
+ export declare function requireDocument(documentsByPath: Map<string, TokenDocument>, ref: string): TokenDocument;
60
+ export declare function refsFor(documentsByPath: Map<string, TokenDocument>, refs: readonly ResolverReference[]): TokenDocument[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The six concrete evaluation contexts of the Cinder profile (`light|dark` by
3
+ * `default|reduced|forced-reduced-motion`) and the ordered document stack each
4
+ * one resolves. Shared by the authoring catalogue and by runtime evaluation so
5
+ * both walk exactly the same layers.
6
+ */
7
+ import type { ProvenanceLayerInput } from './authoring-provenance.ts';
8
+ import { type AuthoringContext } from './authoring-types.ts';
9
+ import type { ResolverDocument, TokenDocument } from './types.ts';
10
+ export declare function authoringContexts(resolver: ResolverDocument): Array<AuthoringContext & Record<string, string>>;
11
+ export declare function authoringLayerStack(resolver: ResolverDocument, documentsByPath: Map<string, TokenDocument>, context: AuthoringContext): ProvenanceLayerInput[];
@@ -0,0 +1,16 @@
1
+ import { type Lab, type OklchColor } from './color-math.ts';
2
+ /** CIE L*a*b* (D65) of an OKLCH color, computed on its clamped sRGB output. */
3
+ export declare function toCieLab(color: OklchColor): Lab;
4
+ /** CIEDE2000 color difference between two CIE Lab triples. */
5
+ export declare function ciede2000(lab1: Lab, lab2: Lab): number;
6
+ /**
7
+ * Brettel-1997-style dichromacy simulation matrices applied in linear sRGB. Used only
8
+ * for the non-blocking CVD diagnostic, never for a hard assertion.
9
+ */
10
+ declare const CVD_MATRICES: {
11
+ protan: [[number, number, number], [number, number, number], [number, number, number]];
12
+ deutan: [[number, number, number], [number, number, number], [number, number, number]];
13
+ tritan: [[number, number, number], [number, number, number], [number, number, number]];
14
+ };
15
+ export declare function simulateCvd(color: OklchColor, type: keyof typeof CVD_MATRICES): Lab;
16
+ export {};
@@ -11,8 +11,6 @@ export declare function oklchToLinearSrgb(l: number, c: number, hDeg: number): R
11
11
  export declare function isInSrgbGamut(color: OklchColor): boolean;
12
12
  /** Clamp each channel of a linear-sRGB triple into [0,1], preserving the tuple type. */
13
13
  export declare function clampRgb([r, g, b]: Rgb): Rgb;
14
- export declare function mixOklch(base: OklchColor, target: OklchColor, targetPercent: number): OklchColor;
15
- export declare function deriveStatusTier(base: OklchColor, target: OklchColor): OklchColor;
16
14
  /** The sRGB transfer function and its inverse, used to move between the two spaces below. */
17
15
  export declare function encodeSrgb(channel: number): number;
18
16
  export declare function decodeSrgb(channel: number): number;
@@ -40,20 +38,7 @@ export declare function decodeSrgb(channel: number): number;
40
38
  export declare function compositeOver(foreground: Rgb, background: Rgb, opacity: number): Rgb;
41
39
  /** WCAG relative luminance of an OKLCH color (computed on its clamped sRGB output). */
42
40
  export declare function wcagLuminance(color: OklchColor): number;
41
+ /** WCAG relative luminance of a linear-sRGB triple, unrounded. */
42
+ export declare function relativeLuminance([r, g, b]: Rgb): number;
43
43
  /** WCAG contrast ratio between two relative luminances. */
44
44
  export declare function contrastRatio(luminanceA: number, luminanceB: number): number;
45
- /** CIE L*a*b* (D65) of an OKLCH color, computed on its clamped sRGB output. */
46
- export declare function toCieLab(color: OklchColor): Lab;
47
- /** CIEDE2000 color difference between two CIE Lab triples. */
48
- export declare function ciede2000(lab1: Lab, lab2: Lab): number;
49
- /**
50
- * Brettel-1997-style dichromacy simulation matrices applied in linear sRGB. Used only
51
- * for the non-blocking CVD diagnostic, never for a hard assertion.
52
- */
53
- declare const CVD_MATRICES: {
54
- protan: [[number, number, number], [number, number, number], [number, number, number]];
55
- deutan: [[number, number, number], [number, number, number], [number, number, number]];
56
- tritan: [[number, number, number], [number, number, number], [number, number, number]];
57
- };
58
- export declare function simulateCvd(color: OklchColor, type: keyof typeof CVD_MATRICES): Lab;
59
- export {};
@@ -0,0 +1,3 @@
1
+ import type { OklchColor } from './color-math.ts';
2
+ export declare function mixOklch(base: OklchColor, target: OklchColor, targetPercent: number): OklchColor;
3
+ export declare function deriveStatusTier(base: OklchColor, target: OklchColor): OklchColor;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A deliberately small evaluator for the CSS color syntax the token projection emits:
3
+ * literals (`oklch()`, hex, `rgb()`, `transparent`), `var()` aliases resolved through the same
4
+ * property map, `light-dark()`, `color-mix(in oklch, ...)` and relative `oklch(from ...)`.
5
+ *
6
+ * Anything else (another interpolation space, a gradient, an image, an unsupported function) is
7
+ * returned as a typed failure so the caller reports Needs review. It never guesses a color.
8
+ */
9
+ export type CssColorFailureCode = 'missing-property' | 'unsupported-syntax' | 'gradient-or-image' | 'reference-cycle';
10
+ export type CssColor = {
11
+ l: number;
12
+ c: number;
13
+ h: number | undefined;
14
+ alpha: number;
15
+ };
16
+ export type CssColorResult = {
17
+ ok: true;
18
+ color: CssColor;
19
+ } | {
20
+ ok: false;
21
+ code: CssColorFailureCode;
22
+ reason: string;
23
+ };
24
+ export type CssColorOptions = {
25
+ /** Selects the arm of `light-dark()`. */
26
+ theme: 'light' | 'dark';
27
+ };
28
+ /** Evaluate one CSS color value against a context's property map. */
29
+ export declare function evaluateCssColor(value: string, properties: Readonly<Record<string, string>>, options: CssColorOptions): CssColorResult;
@@ -0,0 +1,7 @@
1
+ export * from './color-difference.ts';
2
+ export * from './color-math.ts';
3
+ export * from './color-mix.ts';
4
+ export * from './css-color.ts';
5
+ export * from './measure.ts';
6
+ export * from './pairings.ts';
7
+ export * from './thresholds.ts';
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Measures one pairing against one context's property map.
3
+ *
4
+ * Colors come from the CSS the projection emits, evaluated by `css-color.ts`. A translucent
5
+ * foreground is composited over its background, and a translucent background over its
6
+ * declared backdrop, in gamma-encoded sRGB the way the browser paints. A value that cannot be
7
+ * evaluated, a translucent background with no known backdrop, or a gradient or image is
8
+ * reported as `needs-review`, never as a ratio.
9
+ */
10
+ import { type CssColorFailureCode, type CssColorOptions } from './css-color.ts';
11
+ import type { ContrastPairing } from './pairings.ts';
12
+ export type NeedsReviewCode = CssColorFailureCode | 'unknown-background' | 'invalid-opacity' | 'unknown-opacity';
13
+ export type StackLayer = {
14
+ role: 'foreground' | 'background' | 'backdrop';
15
+ property: string;
16
+ /** The CSS value as the context's property map holds it. */
17
+ value: string;
18
+ /** Gamma-encoded sRGB after clamping, with the alpha the layer carried. */
19
+ rgb: {
20
+ r: number;
21
+ g: number;
22
+ b: number;
23
+ alpha: number;
24
+ };
25
+ /** True when the color is outside the sRGB gamut and was clamped to measure it. */
26
+ clamped: boolean;
27
+ };
28
+ export type PairingMeasurement = {
29
+ status: 'measured';
30
+ /** The unrounded WCAG contrast ratio. */
31
+ ratio: number;
32
+ stack: StackLayer[];
33
+ /** True when any layer was clamped into sRGB to be measured. */
34
+ clamped: boolean;
35
+ /** The foreground as painted over the ground, and the opaque ground, in gamma sRGB. */
36
+ ink: StackLayer['rgb'];
37
+ ground: StackLayer['rgb'];
38
+ } | {
39
+ status: 'needs-review';
40
+ code: NeedsReviewCode;
41
+ reason: string;
42
+ /** The CSS property whose value could not be measured. */
43
+ property: string;
44
+ };
45
+ export declare function measurePairing(pairing: ContrastPairing, properties: Readonly<Record<string, string>>, options: CssColorOptions): PairingMeasurement;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The token pairing table: which foreground token is painted on which background token, how
3
+ * the pairing is classified, and which rule scope owns its threshold.
4
+ *
5
+ * It is declarative data. The Cinder contrast suites and the theme builder's accessibility
6
+ * engine both read it, so a pairing is added in one place. A pairing names CSS custom
7
+ * properties because that is what a context's property map is keyed by; the registry maps them
8
+ * to token paths.
9
+ */
10
+ import { type ContrastClassification } from './thresholds.ts';
11
+ /** `wcag` pairings set a normative threshold; `cinder-advisory` ones are Cinder's stricter floors. */
12
+ export type PairingScope = 'wcag' | 'cinder-advisory';
13
+ export type PairingGroup = 'text' | 'accent' | 'status' | 'severity' | 'terminal' | 'focus' | 'control-border' | 'chart' | 'decorative-border' | 'polarity' | 'disabled';
14
+ export type ContrastPairing = {
15
+ /** Stable across releases; findings key on it. */
16
+ id: string;
17
+ group: PairingGroup;
18
+ classification: ContrastClassification;
19
+ scope: PairingScope;
20
+ /** WCAG success criterion the pairing is evidence for, when it has one. */
21
+ criterion: '1.4.3' | '1.4.11' | null;
22
+ foreground: string;
23
+ background: string;
24
+ /** What a translucent background is painted over. Required when `background` has alpha. */
25
+ backdrop?: string;
26
+ /** A number property multiplying the foreground's alpha (the disabled opacity). */
27
+ opacity?: string;
28
+ /** Cinder's floor for an advisory pairing. WCAG pairings take theirs from the classification. */
29
+ advisoryFloor?: number;
30
+ description: string;
31
+ };
32
+ export declare const SURFACE_PROPERTIES: readonly ["--cinder-surface-canvas", "--cinder-surface", "--cinder-surface-raised", "--cinder-surface-inset"];
33
+ export declare const STATUSES: readonly ["info", "success", "warning", "danger"];
34
+ export declare const ANSI_COLORS: readonly ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "bright-black", "bright-red", "bright-green", "bright-yellow", "bright-blue", "bright-magenta", "bright-cyan", "bright-white"];
35
+ export declare const CHART_SERIES_COUNT = 8;
36
+ export declare const CONTRAST_PAIRINGS: readonly ContrastPairing[];
@@ -0,0 +1,47 @@
1
+ /**
2
+ * WCAG 2.2 AA contrast thresholds and the Cinder floors that sit beside them.
3
+ *
4
+ * Every comparison here is on the unrounded ratio: 4.499 does not meet 4.5 and 2.999 does not
5
+ * meet 3. Nothing rounds before comparing.
6
+ */
7
+ /** WCAG 1.4.3: body text. */
8
+ export declare const AA_TEXT = 4.5;
9
+ /** WCAG 1.4.3 for large text, and 1.4.11 for meaningful non-text contrast. */
10
+ export declare const NON_TEXT = 3;
11
+ /** The large-text threshold, named for what it applies to. */
12
+ export declare const AA_LARGE_TEXT = 3;
13
+ /** Large text is at least 24 CSS px, or at least 18.6667 CSS px (14pt) and bold. */
14
+ export declare const LARGE_TEXT_PX = 24;
15
+ export declare const LARGE_BOLD_TEXT_PX = 18.6667;
16
+ export declare const BOLD_FONT_WEIGHT = 700;
17
+ /**
18
+ * Cinder's own floors for decorative separators. They are stricter than WCAG asks for (WCAG
19
+ * exempts a purely decorative separator), so they are advisory: visible, never able to change
20
+ * pass or fail.
21
+ */
22
+ export declare const DECORATIVE_BORDER = 1.4;
23
+ export declare const FAINT_BORDER = 1.1;
24
+ /** Border tiers must read within this fraction of the larger ratio across the legal surfaces. */
25
+ export declare const BORDER_TIER_MAX_SPREAD = 0.15;
26
+ /** Chart series: the minimum pairwise CIEDE2000 distance and CIE L* separation. */
27
+ export declare const CHART_MIN_DELTA_E = 12;
28
+ export declare const CHART_MIN_DELTA_L = 4;
29
+ export declare const CHART_MIN_CHROMA = 0.06;
30
+ export declare const CONTRAST_CLASSIFICATIONS: readonly ["text", "large-text", "non-text-indicator", "decorative-separator", "disabled"];
31
+ export type ContrastClassification = (typeof CONTRAST_CLASSIFICATIONS)[number];
32
+ /** The rendered size of a piece of text, in CSS px and a numeric font weight. */
33
+ export type RenderedTextSize = {
34
+ fontSizePx: number;
35
+ fontWeight: number;
36
+ };
37
+ /** WCAG's large-text definition. An unknown size is never large. */
38
+ export declare function isLargeText(size: RenderedTextSize | undefined): boolean;
39
+ /** The text classification a rendered size earns: only a known large size earns the 3:1 floor. */
40
+ export declare function classifyText(size: RenderedTextSize | undefined): 'text' | 'large-text';
41
+ /**
42
+ * The normative WCAG minimum for a classification, or `null` when WCAG sets none (a purely
43
+ * decorative separator and an inactive component are exempt from contrast requirements).
44
+ */
45
+ export declare function requiredContrast(classification: ContrastClassification): number | null;
46
+ /** Whether a measured ratio meets a required one. Both stay unrounded. */
47
+ export declare function meetsContrast(measured: number, required: number): boolean;
@@ -0,0 +1,36 @@
1
+ import { type ResolverDocument, type TokenDocument } from './types.ts';
2
+ /**
3
+ * Expands a set's `sources` into plain token-document `$ref`s only, recursing
4
+ * through any resolver-internal `#/sets/<name>` entries (a set's own sources
5
+ * may themselves reference further sets) before any of those entries reach
6
+ * the file-existence check, `referencedPaths`, or a document-loading
7
+ * consumer (`sourcesForEntry`'s other callers -- `generate.ts`, `registry.ts`
8
+ * -- resolve source `$ref`s straight into `documentsByPath` lookups with no
9
+ * expansion of their own, so an unexpanded internal ref there is a
10
+ * non-null-assertion crash, not a validation error). `visiting` guards
11
+ * against a cycle between sets; per the vendored resolver schema's own
12
+ * stated prohibition (`set.json`'s `referenceObjectForSets` pattern), a set
13
+ * may not reference a modifier, which is rejected here with a named path and
14
+ * reason rather than falling through to a misleading "source does not
15
+ * exist".
16
+ */
17
+ export declare function orderedTokenValidationContexts(resolver: ResolverDocument, documentsByPath: Map<string, unknown>): Map<string, unknown[][]>;
18
+ export declare function validateLoadedTokenDocuments(resolver: ResolverDocument, loaded: Array<{
19
+ path: string;
20
+ document: unknown;
21
+ }>): Array<{
22
+ path: string;
23
+ document: TokenDocument;
24
+ }>;
25
+ export declare function assertValidLoadedDocument(document: unknown, path: string, contexts: readonly unknown[][], sourceByDocument: ReadonlyMap<object, string>): asserts document is TokenDocument;
26
+ /**
27
+ * Validates a whole corpus in memory: the resolver, every token document
28
+ * (schema first, then semantic checks), the set and modifier expansion order,
29
+ * modifier token paths, and every concrete modifier-value combination's
30
+ * resolved tokens. Throws a `TokenValidationError` addressed by path. The
31
+ * caller supplies documents; this reads nothing.
32
+ */
33
+ export declare function validateCorpus(resolver: ResolverDocument, loaded: Array<{
34
+ path: string;
35
+ document: unknown;
36
+ }>): Map<string, TokenDocument>;
@@ -0,0 +1,10 @@
1
+ import { type ResolverDocument, type TokenDocument } from './types.ts';
2
+ export declare function validateModifierSetExpansionOrder(resolver: ResolverDocument, documentsByPath?: Map<string, TokenDocument>): void;
3
+ export declare function collectDeclaredTokenPaths(value: unknown, prefix: string, paths: Set<string>): void;
4
+ export declare function collectSemanticGroupMetadataPaths(value: unknown, prefix: string, paths: Set<string>): void;
5
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
6
+ export declare function canonicalizeJson(value: unknown): unknown;
7
+ export declare function mergeMetadataValue(base: unknown, override: unknown): unknown;
8
+ export declare function semanticGroupMetadataByPath(value: unknown): Map<string, Record<string, unknown>>;
9
+ /** Validates modifier declarations against the token paths contributed by ordered base sets. */
10
+ export declare function validateModifierTokenPaths(resolver: ResolverDocument, documentsByPath: Map<string, TokenDocument>): void;