@lostgradient/cinder 0.27.1 → 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 +35 -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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @lostgradient/cinder
2
2
 
3
+ ## 0.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1611](https://github.com/stevekinney/cinder/pull/1611) [`baba4cf`](https://github.com/stevekinney/cinder/commit/baba4cf10e6e6dea4c58e8485575a3e12d069f86) Thanks [@lost-gradient-mirror-sync](https://github.com/apps/lost-gradient-mirror-sync)! - `CodeBlock` no longer bundles Shiki's full grammar and theme registries. It used to fall back to a lazily imported default highlighter, and that `import()` made every consumer's bundler emit all of Shiki's grammars and themes, even when the consumer passed its own `highlighter`. `CodeBlock` now imports no highlighter: it highlights with its `highlighter` prop, then with a highlighter an ancestor publishes through the new `setCodeHighlighterContext(highlighter)`, and otherwise renders unhighlighted.
8
+
9
+ To keep automatic highlighting of every language Shiki ships, publish the full-registry highlighter, now exported as `fullShikiHighlighter`, near your application's root with `setCodeHighlighterContext(fullShikiHighlighter())`. An application that knows its languages should build a `shikiHighlighter` with explicit `languageLoaders` and `themeLoaders` instead, so its bundle carries only those grammars and themes. `ApprovalCard` and `RunStepTimeline` highlight through the context highlighter; the JSON Schema editor's JSON view highlights with its own JSON-only highlighter.
10
+
11
+ - [#1615](https://github.com/stevekinney/cinder/pull/1615) [`2c0babf`](https://github.com/stevekinney/cinder/commit/2c0babf725e38b8bf35ba1b7fa3e6559834b1f88) Thanks [@lost-gradient-mirror-sync](https://github.com/apps/lost-gradient-mirror-sync)! - Add the `@lostgradient/cinder/tokens/runtime` subpath. It holds the pure token kernel that the Cinder generator and the theme builder share, so generated CSS and in-browser evaluation can no longer drift apart. It runs in memory and fetches nothing.
12
+
13
+ - `evaluateTheme` and `evaluateThemeProperties` validate a DTCG 2025.10 theme and evaluate all six light/dark and motion contexts. They return one public `--cinder-*` property map per context, revision-tagged diagnostics, and evaluated provenance (winning source, effective type origin, dependencies and dependents). `validateThemeSources` runs the same validation without evaluating.
14
+ - Browser validation uses standalone, eval-free DTCG schema validators.
15
+ - `CINDER_BASE` carries the shipped resolver and documents, the package version and a source digest. `AUTHORING_CATALOGUE` describes every public token's usage profile and its edit, CSS-export and DTCG-portability disposition.
16
+ - A WCAG contrast module (relative luminance, alpha compositing and the token pairing table) lets builder checks reuse Cinder's own contrast rules.
17
+ - `renderThemeStylesheet` emits a deployment stylesheet in a `cinder-theme` layer.
18
+
19
+ Other changes:
20
+
21
+ - The resolved token JSON now carries value-neutral `com.lostgradient.cinder` metadata: `scale` membership on the spacing and radius members, and `palette` family, role and anchor on color roles. No token value changes, and `tokens-base.css` is unchanged.
22
+ - Colors authored in Display P3 and other CSS Color 4 spaces now serialize as `color(<space> …)` instead of failing.
23
+ - `evaluateTheme` no longer crashes on a layer that `$extends` a group it also restates.
24
+ - `StylesheetError` now reports `name` as `'StylesheetError'`.
25
+ - The color picker's copy-format buttons now meet the 24 px minimum target size (WCAG 2.5.8).
26
+
27
+ ### Patch Changes
28
+
29
+ - [#1615](https://github.com/stevekinney/cinder/pull/1615) [`2c0babf`](https://github.com/stevekinney/cinder/commit/2c0babf725e38b8bf35ba1b7fa3e6559834b1f88) Thanks [@lost-gradient-mirror-sync](https://github.com/apps/lost-gradient-mirror-sync)! - `VirtualList` with `stickyItems` no longer scrolls itself back a row, and no longer fights a scroll it did not make after an arrow key.
30
+
31
+ When the active sticky row's index left the rendered window, the row pinned and left flow, and the browser's native scroll anchoring pulled the scroll offset back by the row's size. A keyboard step that had just landed was undone, so a held arrow key dropped rows. A list that scrolls its own container now sets `overflow-anchor: none`, not only under `dynamicSize`, because it positions its rows from that container's scroll offset itself. A `windowScroll` list with `stickyItems` opts out of the page's anchoring for the same reason, as a `dynamicSize` list already did. A `windowScroll` list without sticky rows leaves the page's anchoring as it was.
32
+
33
+ A keyboard workaround for that jump is gone as well. It re-issued an arrow press whenever the position settled back where the press began, so a consumer setting `scrollTop`, or a fragment link, that returned the list to that offset within a few frames was overwritten. An instant write to fixed-height rows (no `smoothScroll`, or reduced motion) also no longer keeps its destination pending once it lands, so a press right after another scroll steps from the live position instead of a stale row.
34
+
35
+ - Updated dependencies [[`2c0babf`](https://github.com/stevekinney/cinder/commit/2c0babf725e38b8bf35ba1b7fa3e6559834b1f88)]:
36
+ - @lostgradient/markdown@0.6.2
37
+
3
38
  ## 0.27.1
4
39
 
5
40
  ### Patch Changes
package/components.json CHANGED
@@ -1075,7 +1075,7 @@
1075
1075
  "exportName": "CodeBlock",
1076
1076
  "category": "data-display",
1077
1077
  "status": "stable",
1078
- "purpose": "Block container for multi-line source code with automatic syntax highlighting and a copy-to-clipboard control.",
1078
+ "purpose": "Block container for multi-line source code with optional syntax highlighting and a copy-to-clipboard control.",
1079
1079
  "tags": ["code", "snippet"],
1080
1080
  "useWhen": [
1081
1081
  "Displaying a multi-line code sample or terminal transcript inside documentation or chat.",
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The code-highlighter context. An application publishes one highlighter near
3
+ * its root, and every descendant `<CodeBlock>` without its own `highlighter`
4
+ * prop highlights with it.
5
+ *
6
+ * `<CodeBlock>` imports no highlighter of its own. A default reachable from
7
+ * the component, even behind a lazy `import()`, makes a consumer's bundler emit
8
+ * every grammar and theme that highlighter can load, whether or not any block
9
+ * ever uses them. Resolving the highlighter from a prop or from this context
10
+ * keeps the choice, and its bundle cost, with the application.
11
+ */
12
+ import type { Highlighter } from '../utilities/highlighter.ts';
13
+ /**
14
+ * Publish `highlighter` for every descendant `<CodeBlock>` that has no
15
+ * `highlighter` prop. Call it during component initialization, like any
16
+ * Svelte context setter. A nearer call replaces it for that subtree.
17
+ *
18
+ * @security Every block that falls back to this highlighter renders its
19
+ * output verbatim through `{@html}`, exactly as for the `highlighter` prop:
20
+ * the highlighter must escape the code it is given.
21
+ */
22
+ export declare function setCodeHighlighterContext(highlighter: Highlighter): void;
23
+ /**
24
+ * Read the nearest published highlighter, or `undefined` when no ancestor
25
+ * published one. A missing provider is a supported state: the block renders
26
+ * its escaped plain fallback.
27
+ */
28
+ export declare const getCodeHighlighterContext: () => Highlighter | undefined;
package/dist/cli/index.js CHANGED
@@ -627,22 +627,26 @@ async function runParsedCommand(parsed) {
627
627
  ]);
628
628
  }
629
629
  }
630
- function reportCliError(error, isJson) {
630
+ var processWriters = {
631
+ stdout: (text) => process.stdout.write(text),
632
+ stderr: (text) => process.stderr.write(text)
633
+ };
634
+ function reportCliError(error, isJson, writers) {
631
635
  const code = error instanceof CinderKnowledgeError ? error.code : "UNEXPECTED_ERROR";
632
636
  const message = error instanceof Error ? error.message : String(error);
633
637
  const suggestions = error instanceof CinderKnowledgeError ? error.suggestions : [];
634
638
  if (isJson) {
635
- process.stdout.write(`${jsonError(code, message, suggestions)}
639
+ writers.stdout(`${jsonError(code, message, suggestions)}
636
640
  `);
637
641
  } else {
638
- process.stderr.write(`${message}
642
+ writers.stderr(`${message}
639
643
  `);
640
644
  if (suggestions.length > 0)
641
- process.stderr.write(`Suggestions: ${suggestions.join(", ")}
645
+ writers.stderr(`Suggestions: ${suggestions.join(", ")}
642
646
  `);
643
647
  }
644
648
  }
645
- async function runCli(argv = process.argv.slice(2)) {
649
+ async function runCli(argv = process.argv.slice(2), writers = processWriters) {
646
650
  let parsed;
647
651
  try {
648
652
  parsed = parseCommand(argv);
@@ -655,12 +659,12 @@ async function runCli(argv = process.argv.slice(2)) {
655
659
  }
656
660
  output = jsonEnvelope(result.package, result.command, result.data);
657
661
  }
658
- process.stdout.write(`${output}
662
+ writers.stdout(`${output}
659
663
  `);
660
664
  }
661
665
  return 0;
662
666
  } catch (error) {
663
- reportCliError(error, argv.includes("--json"));
667
+ reportCliError(error, argv.includes("--json"), writers);
664
668
  return 1;
665
669
  }
666
670
  }
@@ -683,4 +687,4 @@ export {
683
687
  runCli
684
688
  };
685
689
 
686
- //# debugId=BA054D51475EF57264756E2164756E21
690
+ //# debugId=19C31FD442DF300F64756E2164756E21