@lostgradient/cinder 0.27.1 → 0.28.1

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 +41 -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,35 @@
1
+ import type { DesignToken, TokenGroup, TokenType } from './types.ts';
2
+ export type CorpusEntry = {
3
+ path: string;
4
+ value: unknown;
5
+ type: TokenType | undefined;
6
+ description: string | undefined;
7
+ cssProperty: string | undefined;
8
+ cssRecipe: string | undefined;
9
+ /**
10
+ * The remaining `com.lostgradient.cinder` extension fields and the DTCG
11
+ * `$deprecated` flag, carried through purely for {@link registry.ts}'s
12
+ * `buildTokenRegistry` -- CSS generation in this file never reads them.
13
+ * Kept on `CorpusEntry` itself (rather than a second, parallel tree walk)
14
+ * so the registry reuses the exact same `collectEntries` traversal that
15
+ * produces `tokens-base.css`, instead of re-deriving corpus structure.
16
+ */
17
+ public?: boolean | undefined;
18
+ category?: string | undefined;
19
+ component?: string | undefined;
20
+ deprecated?: boolean | string | undefined;
21
+ /**
22
+ * True when `value` came from `$ref` rather than `$value`. `$ref` is a
23
+ * generic JSON Pointer with no DTCG requirement that its target be a whole
24
+ * token -- unlike an ordinary bare alias `$value`, which this generator has
25
+ * always required to name a whole token (a deliberate, pre-existing
26
+ * restriction; see `resolveAlias`'s own comment). `serializeEntryValue`
27
+ * uses this flag to allow a `$ref` alone to fall through to typed
28
+ * serialization when it targets a property rather than a whole token,
29
+ * without loosening that restriction for ordinary `$value` aliases.
30
+ */
31
+ isRefAlias?: boolean | undefined;
32
+ };
33
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
34
+ export declare function cinderExtensions(token: DesignToken): Record<string, unknown> | undefined;
35
+ export declare function collectEntries(group: TokenGroup, prefix: string, inheritedType: TokenType | undefined, into: Map<string, CorpusEntry>, inheritedDeprecated?: boolean | string): void;
@@ -0,0 +1 @@
1
+ export declare const DEFERRED_COMPONENT_ALIAS_FAMILIES: Set<string>;
@@ -0,0 +1,2 @@
1
+ export declare function stylelintDisableCommentFor(value: string): string | undefined;
2
+ export declare function sanitizeComment(description: string): string;
@@ -0,0 +1,110 @@
1
+ import { type CorpusEntry } from './corpus.ts';
2
+ import type { ValueResolver } from './resolve.ts';
3
+ import type { ResolverDocument } from './types.ts';
4
+ export declare function isRootDeclaredEntry(entry: CorpusEntry): boolean;
5
+ export declare function renderBaseDeclarations(baseIndex: Map<string, CorpusEntry>, resolveReferences: ValueResolver): string;
6
+ export declare function renderOverrideDeclarations(overrides: Map<string, CorpusEntry>, baseIndex: Map<string, CorpusEntry>, resolveReferences: ValueResolver): string;
7
+ export declare function withDependentBaseAliases(overrides: Map<string, CorpusEntry>, baseIndex: Map<string, CorpusEntry>, baseResolveReferences: ValueResolver, resolveReferences: ValueResolver): Map<string, CorpusEntry>;
8
+ /**
9
+ * A token overridden in only ONE theme leaves the other theme's block with no
10
+ * declaration for it. Custom properties inherit as COMPUTED values, so a nested
11
+ * island of that other theme does not fall back to the `:root` `light-dark()`
12
+ * declaration -- the themed ancestor has already substituted its own arm, and
13
+ * the island inherits that substituted value.
14
+ *
15
+ * `--cinder-code-block-background` is the case this exists for: it is overridden
16
+ * only in `dark.tokens.json`, so a `[data-theme='light']` island inside a dark
17
+ * ancestor kept the dark `surface-inset` ground underneath github-light Shiki
18
+ * token colors -- the exact AA failure that token's own `$description` warns
19
+ * about. Redeclaring the foundation token it aliases (`--cinder-surface-inset`,
20
+ * which the light block DOES reset) cannot rescue it, because the alias was
21
+ * already resolved against the ancestor.
22
+ *
23
+ * So each scoped block carries a declaration for every path the OTHER block
24
+ * declares. The added entry is the BASE entry, rendered by
25
+ * {@link renderOverrideDeclarations} under this block's own resolver -- the same
26
+ * mechanism {@link withDependentBaseAliases} already uses for the aliases it
27
+ * pulls in, so a `cssRecipe` token re-emits its full `light-dark(...)` recipe
28
+ * (self-resetting under the block's own `color-scheme`) and a plain alias
29
+ * re-resolves against this theme.
30
+ *
31
+ * Applied symmetrically. Only dark currently has theme-exclusive overrides, but
32
+ * the asymmetry is a property of the corpus on any given day, not of the
33
+ * generator, and a light-only override added later must not reintroduce this.
34
+ */
35
+ export declare function withOppositeThemeResets(aliases: Map<string, CorpusEntry>, oppositeAliases: Map<string, CorpusEntry>, baseIndex: Map<string, CorpusEntry>): Map<string, CorpusEntry>;
36
+ export declare function withThemeDependentOverrides(overrides: Map<string, CorpusEntry>, baseIndex: Map<string, CorpusEntry>, systemResolveReferences: ValueResolver, themeResolveReferences: ValueResolver): Map<string, CorpusEntry>;
37
+ export declare function entryContainsReference(entry: CorpusEntry): boolean;
38
+ /**
39
+ * Two tokens mapping to one `cssProperty` with DIFFERENT values is not something
40
+ * `tokens:validate` can catch -- the mapping lives in vendor extension data, which
41
+ * the DTCG schema treats as free-form. Left undetected, both declarations are
42
+ * emitted, CSS silently keeps whichever lands last, and the resolved snapshots go
43
+ * on exposing both token paths, so `tokens:check` approves two artifacts that
44
+ * disagree about the same custom property.
45
+ *
46
+ * Sharing a `cssProperty` is only a conflict when the values differ. `$extends`
47
+ * inheritance legitimately produces two paths for one property -- the extending
48
+ * group inherits members verbatim, extension metadata included -- and those emit
49
+ * an identical declaration twice, which is redundant but harmless.
50
+ */
51
+ export declare function assertUniqueCssProperties(entries: Map<string, CorpusEntry>, baseIndex?: Map<string, CorpusEntry>, resolveReferences?: ValueResolver, resolveReferencesFactory?: () => ValueResolver): void;
52
+ /**
53
+ * The same conflict {@link assertUniqueCssProperties} catches for `baseIndex`,
54
+ * applied to ONE override block (a theme or motion context) in isolation.
55
+ * `$extends` can legitimately give two base paths the same `cssProperty` with
56
+ * IDENTICAL base values (assertUniqueCssProperties already lets that through) --
57
+ * but nothing stopped a theme or motion override from then explicitly
58
+ * diverging those two paths to DIFFERENT values, because the base-only guard
59
+ * ran exactly once, against `baseIndex`, and never again against an override
60
+ * block.
61
+ *
62
+ * An override token does not always restate its own `cssProperty` extension --
63
+ * it is inherited, immutable metadata; an override document typically states
64
+ * only a new `$value` -- so grouping by `entry.cssProperty` alone would skip
65
+ * most override entries as property-less. `baseIndex` supplies whichever
66
+ * `cssProperty` (and `$type`, needed for the same type-directed fingerprint
67
+ * `assertUniqueCssProperties` already keys on) an override entry left
68
+ * unstated, so the same two-paths-one-property conflict this guards against
69
+ * at the base level is caught here too.
70
+ */
71
+ export declare function assertUniqueOverrideCssProperties(overrides: Map<string, CorpusEntry>, baseIndex: Map<string, CorpusEntry>, scopeIndex: Map<string, CorpusEntry>, blockName: string, resolveReferences?: ValueResolver): void;
72
+ type OverrideScope = {
73
+ name: string;
74
+ resolveReferences: ValueResolver;
75
+ };
76
+ /** A single emitted override declaration must be valid in every scope its selector reaches. */
77
+ export declare function assertOverrideScopeConsistency(overrides: Map<string, CorpusEntry>, baseIndex: Map<string, CorpusEntry>, scopes: readonly OverrideScope[], blockName: string): void;
78
+ /**
79
+ * `tokens-base.css`'s block structure is FIXED, not derived from
80
+ * `resolver.resolutionOrder`: `:root` is always assembled from every `sets`
81
+ * entry (regardless of where it sits in `resolutionOrder`), and the theme
82
+ * override blocks (`[data-theme='dark']`/`[data-theme='light']`) are always
83
+ * emitted before the motion override blocks (the `prefers-reduced-motion`
84
+ * media block and the `data-reduced-motion='on'` override) -- see
85
+ * `buildTokensBaseCss`'s `darkDeclarations`/`lightDeclarations` vs.
86
+ * `reducedMotionDeclarations`/`forcedReducedMotionDeclarations` ordering in
87
+ * the template below.
88
+ *
89
+ * DECISION (CIN-469 finding 5): rather than deriving CSS block order from
90
+ * `resolutionOrder` at generation time -- a bigger, riskier change for a PR
91
+ * whose whole point is a no-diff, tests-and-generator-only fix -- this
92
+ * generator keeps its fixed block structure and instead REJECTS a resolver
93
+ * document whose `resolutionOrder` the fixed structure cannot faithfully
94
+ * express: every `sets` entry must precede every `modifiers` entry (so
95
+ * `:root`'s "every set, unconditionally" assembly matches what
96
+ * `resolutionOrder` actually says the base layer is), and the `theme`
97
+ * modifier must precede the `motion` modifier (so theme-before-motion block
98
+ * emission matches cascade precedence, i.e. a motion override still wins over
99
+ * a theme override for a token both touch, the same way "last non-`:root`
100
+ * block wins" already works today). `cinder.resolver.json`'s current
101
+ * `resolutionOrder` -- foundation, then theme, then motion -- already
102
+ * satisfies this, so the guard is presently a no-op; it exists so a future
103
+ * resolver edit that would silently desync `resolutionOrder` from emission
104
+ * order fails loudly at generate time instead of shipping a CSS cascade that
105
+ * disagrees with the resolver's own stated precedence. If `resolutionOrder`
106
+ * ever legitimately needs a different shape, deriving block order for real
107
+ * -- not just validating it -- is the follow-up.
108
+ */
109
+ export declare function assertResolutionOrderMatchesCssBlockStructure(resolver: ResolverDocument): void;
110
+ export {};
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The runtime's public validate / resolve / project interface.
3
+ *
4
+ * Everything here is in memory: the caller hands over a resolver and token
5
+ * documents, and receives either a result for all six contexts or
6
+ * path-addressed diagnostics. Nothing reads a file, fetches a source, or
7
+ * formats output; those stay in `scripts/`.
8
+ *
9
+ * Validation always runs first and always includes the schema stage (the
10
+ * standalone DTCG validators) before the semantic checks, so there is no way to
11
+ * reach projection or provenance with a document the schema rejects. Invalid
12
+ * types, unresolvable references, and reference cycles surface as diagnostics
13
+ * and produce no property map and no provenance. A value the CSS projection
14
+ * cannot express is a diagnostic too, never a fallback.
15
+ */
16
+ import type { AuthoringContext } from './authoring-types.ts';
17
+ import { type EvaluatedProvenance } from './evaluated-provenance.ts';
18
+ import { type PropertyMap } from './projection.ts';
19
+ /** The sources of one theme: a resolver and its token documents, keyed by relative path. */
20
+ export type ThemeSources = {
21
+ /** Identifies this input. Results echo it so a stale result can be recognized and dropped. */
22
+ revision: number | string;
23
+ resolver: unknown;
24
+ documents: Readonly<Record<string, unknown>>;
25
+ };
26
+ export type ThemeDiagnostic = {
27
+ revision: number | string;
28
+ severity: 'error';
29
+ /** Where the problem is: a document path, a token path, or `$` for the whole input. */
30
+ path: string;
31
+ reason: string;
32
+ /** The context the problem appears in, when it is specific to one. */
33
+ context?: string;
34
+ };
35
+ export type ThemeValidation = {
36
+ revision: number | string;
37
+ diagnostics: ThemeDiagnostic[];
38
+ };
39
+ /**
40
+ * The outcome of evaluating a theme. A failure carries diagnostics and nothing
41
+ * else; a success carries one property map and one provenance result per
42
+ * context, and no diagnostics.
43
+ */
44
+ export type ThemeEvaluation = {
45
+ ok: true;
46
+ revision: number | string;
47
+ contexts: AuthoringContext[];
48
+ /** Per context id, the public custom properties and their CSS values. */
49
+ properties: Record<string, PropertyMap>;
50
+ diagnostics: ThemeDiagnostic[];
51
+ provenance: EvaluatedProvenance;
52
+ } | {
53
+ ok: false;
54
+ revision: number | string;
55
+ diagnostics: ThemeDiagnostic[];
56
+ };
57
+ /**
58
+ * Validates a theme's sources: the resolver, every document against the DTCG
59
+ * schemas and then the semantic rules, and the resolved tokens of all six
60
+ * contexts. Returns diagnostics; an empty list means the sources are valid.
61
+ * Does not mutate its input.
62
+ */
63
+ export declare function validateThemeSources(sources: ThemeSources): ThemeValidation;
64
+ /**
65
+ * The result of `evaluateThemeProperties`: property maps for the requested contexts and no
66
+ * provenance.
67
+ */
68
+ export type ThemePropertiesEvaluation = {
69
+ ok: true;
70
+ revision: number | string;
71
+ contexts: AuthoringContext[];
72
+ properties: Record<string, PropertyMap>;
73
+ diagnostics: ThemeDiagnostic[];
74
+ } | {
75
+ ok: false;
76
+ revision: number | string;
77
+ diagnostics: ThemeDiagnostic[];
78
+ };
79
+ /**
80
+ * The cheap path for an edit loop. It validates every context exactly as `evaluateTheme`
81
+ * does, so an edit that is invalid in any context is still rejected, but it projects only
82
+ * `options.contexts` (default: all six) and traces no provenance. Its property maps equal
83
+ * `evaluateTheme`'s for the contexts they share.
84
+ */
85
+ export declare function evaluateThemeProperties(sources: ThemeSources, options?: {
86
+ contexts?: readonly string[];
87
+ }): ThemePropertiesEvaluation;
88
+ /**
89
+ * Evaluates a theme across `light|dark` by `default|reduced|forced-reduced-motion`:
90
+ * validates it, computes every context from source (the two forced contexts
91
+ * included), projects each to its public CSS property map, and traces the
92
+ * evaluated provenance. Does not mutate its input, and its sources must not be mutated
93
+ * afterwards: validation results are remembered by document identity.
94
+ */
95
+ export declare function evaluateTheme(sources: ThemeSources): ThemeEvaluation;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Evaluated provenance: for every token in every context, where its value and
3
+ * type come from (the shared {@link TokenContextProvenance} record), what it
4
+ * reads directly, and what reads it, directly or through other tokens.
5
+ *
6
+ * The traversal is bounded by the token set: each token is visited once per
7
+ * search, so a malformed cycle in the recipe edges (which no reference check
8
+ * covers) cannot loop. Output order is fixed: tokens sort by the position of
9
+ * their winning document in the context's layer stack, then by path; every
10
+ * dependency and dependent list sorts the same way and names each token once.
11
+ */
12
+ import { type AuthoringContext, type AuthoringLayer, type TokenContextProvenance, type TokenLocation } from './authoring-types.ts';
13
+ /** One token's provenance and edges in one context. */
14
+ export type TokenEvaluation = {
15
+ path: string;
16
+ provenance: TokenContextProvenance;
17
+ /** Tokens this one reads directly, in document/layer order then path. */
18
+ dependencies: TokenLocation[];
19
+ /** Tokens that read this one directly or transitively, in document/layer order then path. */
20
+ dependents: TokenLocation[];
21
+ };
22
+ /**
23
+ * The evaluated-provenance result. `revision` is the revision of the sources
24
+ * it was computed from, so a consumer can discard a result that no longer
25
+ * matches the current sources.
26
+ */
27
+ export type EvaluatedProvenance = {
28
+ revision: number | string;
29
+ contexts: AuthoringContext[];
30
+ /** Ordered layer stack per context id. */
31
+ layerStacks: Record<string, AuthoringLayer[]>;
32
+ /** Per context id, every token in a deterministic order. */
33
+ tokens: Record<string, TokenEvaluation[]>;
34
+ };
35
+ /** Builds the per-token records of one context from its traced provenance. */
36
+ export declare function evaluateContextProvenance(stack: readonly AuthoringLayer[], traced: ReadonlyMap<string, TokenContextProvenance>): TokenEvaluation[];
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `@lostgradient/cinder/tokens/runtime`: the pure token kernel shared by the
3
+ * generator scripts and the browser.
4
+ *
5
+ * It is a narrow, in-memory interface -- validate, evaluate (resolve and
6
+ * project), trace provenance -- plus the bundled Cinder base and the authoring
7
+ * catalogue as data. It reads no files, fetches nothing, and formats nothing.
8
+ * See `README.md` for the contract.
9
+ *
10
+ * There is deliberately no export for validating a document against the schema
11
+ * alone: every path to a result runs the schema stage and then the semantic
12
+ * rules together.
13
+ */
14
+ export { AUTHORING_CATALOGUE } from './authoring-catalogue.generated.ts';
15
+ export { buildAuthoringCatalogue } from './authoring-catalogue.ts';
16
+ export { PROFILES, profileRangeViolation, selectProfile } from './authoring-profiles.ts';
17
+ export type { ProfileSubject } from './authoring-profiles.ts';
18
+ export { traceProvenance } from './authoring-provenance.ts';
19
+ export type { ProvenanceLayerInput, TraceOptions } from './authoring-provenance.ts';
20
+ export { PALETTE_FAMILIES, UNKNOWN, authoringContextId } from './authoring-types.ts';
21
+ export type { AuthoringCatalogue, AuthoringContext, AuthoringLayer, AuthoringRecord, ContributingLayer, EffectiveType, LayerKind, PaletteFamily, PaletteMembership, ProfileDefinition, ProfileRange, ProvenanceVariant, TokenContextProvenance, TokenDisposition, TokenInputs, TokenLocation, } from './authoring-types.ts';
22
+ export { CINDER_BASE } from './base-corpus.ts';
23
+ export type { CinderBase } from './base-corpus.ts';
24
+ export { authoringContexts, authoringLayerStack } from './context-stack.ts';
25
+ export * from './contrast/index.ts';
26
+ export { evaluateTheme, evaluateThemeProperties, validateThemeSources } from './evaluate.ts';
27
+ export type { ThemeDiagnostic, ThemeEvaluation, ThemePropertiesEvaluation, ThemeSources, ThemeValidation, } from './evaluate.ts';
28
+ export { evaluateContextProvenance } from './evaluated-provenance.ts';
29
+ export type { EvaluatedProvenance, TokenEvaluation } from './evaluated-provenance.ts';
30
+ export type { PropertyMap } from './projection.ts';
31
+ export { canonicalJson, computeSourceDigest, sha256Hex } from './source-digest.ts';
32
+ export type { DigestableSource } from './source-digest.ts';
33
+ export { OVERRIDE_DOCUMENTS, applyCssOnlyOverrides, buildThemeSources, mergedContextDocument, } from './theme-sources.ts';
34
+ export type { OverrideScopeName, ThemeSourceEnvelope } from './theme-sources.ts';
35
+ export { StylesheetError, THEME_LAYER, renderThemeStylesheet } from './theme-stylesheet.ts';
36
+ export type { ContextProperties, StylesheetContext, ThemeStylesheetOptions, } from './theme-stylesheet.ts';
37
+ export { TOKEN_TYPES, TokenValidationError } from './types.ts';
38
+ export type { DesignToken, ResolverDocument, TokenDocument, TokenGroup, TokenType, ValidationIssue, } from './types.ts';