@cueplusplus/ui 0.9.0 → 0.11.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 (330) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +197 -9
  3. package/dist/chrome/index.d.ts +2 -1
  4. package/dist/chrome/index.js +3 -2
  5. package/dist/chrome/inspector.d.ts +61 -0
  6. package/dist/chrome/inspector.js +121 -0
  7. package/dist/forms/input.d.ts +12 -0
  8. package/dist/forms/textarea.d.ts +12 -0
  9. package/dist/forms/toggle.d.ts +6 -0
  10. package/dist/index.d.ts +7 -3
  11. package/dist/index.js +8 -3
  12. package/dist/instruments/code-block.d.ts +35 -0
  13. package/dist/instruments/code-block.js +173 -0
  14. package/dist/instruments/index.d.ts +2 -1
  15. package/dist/instruments/index.js +2 -1
  16. package/dist/instruments/meter.d.ts +5 -1
  17. package/dist/layout/bento.d.ts +144 -0
  18. package/dist/layout/bento.js +266 -0
  19. package/dist/layout/index.d.ts +4 -2
  20. package/dist/layout/index.js +4 -2
  21. package/dist/layout/preview.d.ts +110 -0
  22. package/dist/layout/preview.js +459 -0
  23. package/dist/primitives/button.d.ts +12 -0
  24. package/dist/primitives/chip.d.ts +1 -1
  25. package/dist/system/index.d.ts +2 -2
  26. package/dist/system/index.js +2 -1
  27. package/dist/system/overrides.d.ts +38 -1
  28. package/dist/system/overrides.js +40 -1
  29. package/manifest/components/accordion.json +24 -6
  30. package/manifest/components/activity-graph.json +20 -5
  31. package/manifest/components/agent-card.json +37 -9
  32. package/manifest/components/agent-handoff.json +21 -5
  33. package/manifest/components/agent-mode-badge.json +22 -4
  34. package/manifest/components/agent-pile.json +38 -8
  35. package/manifest/components/agent-plan.json +9 -2
  36. package/manifest/components/agent-status.json +17 -3
  37. package/manifest/components/agent-surface.json +26 -11
  38. package/manifest/components/alert-dialog.json +29 -5
  39. package/manifest/components/animated-number.json +14 -6
  40. package/manifest/components/app-bar.json +66 -13
  41. package/manifest/components/app-shell.json +133 -31
  42. package/manifest/components/app-window-frame.json +28 -6
  43. package/manifest/components/approval-card.json +37 -7
  44. package/manifest/components/artifact-card.json +16 -4
  45. package/manifest/components/ask-box.json +99 -21
  46. package/manifest/components/audience-icon.json +1 -7
  47. package/manifest/components/autocomplete.json +80 -18
  48. package/manifest/components/avatar-group.json +13 -2
  49. package/manifest/components/avatar.json +22 -4
  50. package/manifest/components/background-inbox.json +9 -2
  51. package/manifest/components/bento.json +306 -0
  52. package/manifest/components/branch-picker.json +29 -7
  53. package/manifest/components/breadcrumb.json +13 -3
  54. package/manifest/components/button-group.json +21 -4
  55. package/manifest/components/button.json +41 -4
  56. package/manifest/components/canvas-split-body.json +4 -1
  57. package/manifest/components/canvas-split-header.json +17 -4
  58. package/manifest/components/canvas-split-line.json +4 -1
  59. package/manifest/components/canvas-split-message.json +8 -1
  60. package/manifest/components/card.json +14 -3
  61. package/manifest/components/carousel.json +54 -12
  62. package/manifest/components/catalogue-icon.json +1 -7
  63. package/manifest/components/channel-beta-icon.json +1 -7
  64. package/manifest/components/channel-matrix.json +80 -15
  65. package/manifest/components/channel-released-icon.json +1 -7
  66. package/manifest/components/chart-container.json +26 -10
  67. package/manifest/components/chart-ramp.json +13 -3
  68. package/manifest/components/chart-swatch.json +9 -2
  69. package/manifest/components/chart-tooltip-content.json +31 -7
  70. package/manifest/components/chart.json +30 -6
  71. package/manifest/components/chat-panel-composer.json +9 -2
  72. package/manifest/components/checkbox-group.json +4 -2
  73. package/manifest/components/checkbox.json +17 -4
  74. package/manifest/components/checkpoint-history.json +13 -3
  75. package/manifest/components/chip.json +35 -5
  76. package/manifest/components/clamp.json +30 -7
  77. package/manifest/components/cli-tool-icon.json +1 -7
  78. package/manifest/components/code-block.json +106 -0
  79. package/manifest/components/code-diff.json +20 -5
  80. package/manifest/components/code-runner.json +32 -6
  81. package/manifest/components/collapsible.json +16 -4
  82. package/manifest/components/color-area.json +4 -1
  83. package/manifest/components/color-field.json +13 -3
  84. package/manifest/components/color-picker.json +75 -17
  85. package/manifest/components/color-slider.json +12 -3
  86. package/manifest/components/color-swatch.json +13 -2
  87. package/manifest/components/colors-section.json +8 -4
  88. package/manifest/components/combobox.json +81 -18
  89. package/manifest/components/command-palette.json +57 -13
  90. package/manifest/components/compaction-row.json +35 -7
  91. package/manifest/components/comparison-card.json +17 -4
  92. package/manifest/components/composer-attachment-chip.json +9 -2
  93. package/manifest/components/composer-bar.json +4 -1
  94. package/manifest/components/composer-command-item.json +8 -2
  95. package/manifest/components/composer-context.json +4 -1
  96. package/manifest/components/composer-input.json +5 -1
  97. package/manifest/components/composer-menu-item.json +4 -1
  98. package/manifest/components/composer-menu.json +12 -2
  99. package/manifest/components/composer-model-item.json +8 -2
  100. package/manifest/components/composer-model-trigger.json +8 -2
  101. package/manifest/components/composer-person-item.json +8 -2
  102. package/manifest/components/composer-send.json +8 -2
  103. package/manifest/components/composer-voice-button.json +4 -1
  104. package/manifest/components/composer-voice.json +8 -2
  105. package/manifest/components/composer.json +76 -17
  106. package/manifest/components/computer-use.json +17 -4
  107. package/manifest/components/confidence-marker.json +13 -3
  108. package/manifest/components/connection-state.json +23 -4
  109. package/manifest/components/container.json +14 -2
  110. package/manifest/components/context-breakdown.json +8 -2
  111. package/manifest/components/context-menu.json +16 -4
  112. package/manifest/components/context-usage.json +16 -4
  113. package/manifest/components/conversation-search.json +22 -5
  114. package/manifest/components/copy-button.json +32 -7
  115. package/manifest/components/cost-meter.json +12 -3
  116. package/manifest/components/cue-logotype.json +17 -3
  117. package/manifest/components/cue-mark.json +17 -3
  118. package/manifest/components/cue-portal-frame.json +13 -3
  119. package/manifest/components/data-row.json +21 -7
  120. package/manifest/components/data-table-pagination.json +18 -4
  121. package/manifest/components/data-table-toolbar.json +30 -7
  122. package/manifest/components/data-tree.json +42 -9
  123. package/manifest/components/date-field.json +13 -2
  124. package/manifest/components/date-picker.json +81 -19
  125. package/manifest/components/date-range-picker.json +81 -19
  126. package/manifest/components/day-separator.json +4 -1
  127. package/manifest/components/delegation-card.json +64 -12
  128. package/manifest/components/density.json +24 -4
  129. package/manifest/components/description-list.json +8 -1
  130. package/manifest/components/diagram.json +33 -7
  131. package/manifest/components/dialog.json +29 -6
  132. package/manifest/components/disclosure.json +31 -7
  133. package/manifest/components/dmx-bar.json +16 -4
  134. package/manifest/components/dmx-strip.json +20 -5
  135. package/manifest/components/document-reference.json +21 -5
  136. package/manifest/components/draft-restore.json +18 -4
  137. package/manifest/components/drawer.json +30 -6
  138. package/manifest/components/dropdown-menu.json +55 -10
  139. package/manifest/components/edit-message.json +32 -7
  140. package/manifest/components/elements-command-palette.json +27 -6
  141. package/manifest/components/elements-data-table.json +9 -2
  142. package/manifest/components/elements-timeline.json +8 -2
  143. package/manifest/components/elicitation-form.json +31 -6
  144. package/manifest/components/empty-state-composer.json +9 -2
  145. package/manifest/components/empty-state-suggestion.json +4 -1
  146. package/manifest/components/empty-state.json +25 -5
  147. package/manifest/components/end-of-turn-summary.json +16 -4
  148. package/manifest/components/env-var-input.json +54 -12
  149. package/manifest/components/error-state.json +17 -4
  150. package/manifest/components/export-dialog.json +27 -8
  151. package/manifest/components/eyebrow.json +4 -1
  152. package/manifest/components/feedback-dialog.json +33 -7
  153. package/manifest/components/field-description.json +4 -1
  154. package/manifest/components/field-error.json +13 -3
  155. package/manifest/components/field-label.json +4 -1
  156. package/manifest/components/field.json +4 -1
  157. package/manifest/components/file-tree.json +16 -4
  158. package/manifest/components/file-upload.json +58 -13
  159. package/manifest/components/flow-graph.json +12 -3
  160. package/manifest/components/folder-icon.json +1 -7
  161. package/manifest/components/footer.json +24 -4
  162. package/manifest/components/frac.json +10 -2
  163. package/manifest/components/generation-loader.json +17 -3
  164. package/manifest/components/generative-ui.json +39 -7
  165. package/manifest/components/grid.json +56 -5
  166. package/manifest/components/group-bar.json +25 -6
  167. package/manifest/components/guardrail-notice.json +22 -5
  168. package/manifest/components/hover-card.json +45 -8
  169. package/manifest/components/icon-button.json +22 -4
  170. package/manifest/components/image-generation.json +8 -2
  171. package/manifest/components/info-tip.json +42 -7
  172. package/manifest/components/inline-citation.json +14 -3
  173. package/manifest/components/input-group.json +24 -5
  174. package/manifest/components/input.json +33 -3
  175. package/manifest/components/inspector.json +199 -0
  176. package/manifest/components/item.json +42 -8
  177. package/manifest/components/job-progress.json +25 -6
  178. package/manifest/components/launcher-bubble.json +32 -7
  179. package/manifest/components/ledger.json +87 -19
  180. package/manifest/components/link.json +16 -3
  181. package/manifest/components/live-region-announcer.json +21 -5
  182. package/manifest/components/log-viewer.json +42 -10
  183. package/manifest/components/map-answer.json +17 -4
  184. package/manifest/components/markdown-text.json +36 -5
  185. package/manifest/components/math-block.json +12 -3
  186. package/manifest/components/mcp-server-icon.json +1 -7
  187. package/manifest/components/mcp-server-panel.json +18 -4
  188. package/manifest/components/memory-chips.json +9 -2
  189. package/manifest/components/menubar.json +33 -7
  190. package/manifest/components/message-actions.json +32 -7
  191. package/manifest/components/message-attachments.json +9 -2
  192. package/manifest/components/message-branches.json +14 -3
  193. package/manifest/components/message-list.json +27 -6
  194. package/manifest/components/message-pair.json +25 -5
  195. package/manifest/components/message-queue.json +13 -3
  196. package/manifest/components/message-timing.json +8 -2
  197. package/manifest/components/message.json +41 -9
  198. package/manifest/components/meter.json +43 -7
  199. package/manifest/components/mobile-composer.json +47 -10
  200. package/manifest/components/model-picker.json +13 -3
  201. package/manifest/components/multi-select.json +78 -17
  202. package/manifest/components/musical-time-input.json +34 -8
  203. package/manifest/components/navigation-menu.json +54 -12
  204. package/manifest/components/node-card.json +42 -7
  205. package/manifest/components/node-handle.json +17 -2
  206. package/manifest/components/number-field.json +28 -6
  207. package/manifest/components/number-ticker.json +8 -2
  208. package/manifest/components/onboarding.json +18 -4
  209. package/manifest/components/otp-field.json +43 -10
  210. package/manifest/components/page-shell.json +35 -6
  211. package/manifest/components/pagination.json +21 -5
  212. package/manifest/components/panel-header.json +15 -3
  213. package/manifest/components/password-input.json +58 -8
  214. package/manifest/components/permission-grant.json +28 -5
  215. package/manifest/components/permission-scopes.json +57 -12
  216. package/manifest/components/piano-keyboard.json +38 -9
  217. package/manifest/components/plussie.json +34 -5
  218. package/manifest/components/popover.json +45 -8
  219. package/manifest/components/preset-section.json +12 -5
  220. package/manifest/components/preview.json +202 -0
  221. package/manifest/components/progress.json +25 -6
  222. package/manifest/components/prompt-library.json +27 -6
  223. package/manifest/components/queue-dock.json +36 -8
  224. package/manifest/components/quota-banner.json +25 -6
  225. package/manifest/components/quote-reply.json +29 -7
  226. package/manifest/components/radio-group.json +12 -2
  227. package/manifest/components/radio.json +17 -3
  228. package/manifest/components/rating.json +60 -13
  229. package/manifest/components/read-aloud.json +35 -8
  230. package/manifest/components/reasoning-effort.json +17 -4
  231. package/manifest/components/reasoning-panel.json +33 -8
  232. package/manifest/components/recommendation-card.json +35 -10
  233. package/manifest/components/regenerate-menu.json +22 -5
  234. package/manifest/components/replay-player.json +29 -7
  235. package/manifest/components/research-report.json +12 -3
  236. package/manifest/components/resizable.json +4 -1
  237. package/manifest/components/retrieval-chunks.json +16 -4
  238. package/manifest/components/revert-dock.json +61 -14
  239. package/manifest/components/reviewable-diff.json +23 -5
  240. package/manifest/components/risk-badge.json +18 -3
  241. package/manifest/components/row.json +17 -4
  242. package/manifest/components/schedule-card.json +25 -6
  243. package/manifest/components/score-breakdown.json +20 -5
  244. package/manifest/components/scroll-anchor.json +13 -3
  245. package/manifest/components/scroll-area.json +31 -8
  246. package/manifest/components/scrollable-tabs-list.json +12 -4
  247. package/manifest/components/scrub-input.json +84 -18
  248. package/manifest/components/seam-cell.json +19 -3
  249. package/manifest/components/seam-grid.json +12 -3
  250. package/manifest/components/search-input.json +69 -10
  251. package/manifest/components/section-header.json +36 -8
  252. package/manifest/components/segmented-control.json +50 -11
  253. package/manifest/components/select.json +74 -16
  254. package/manifest/components/separator.json +4 -1
  255. package/manifest/components/settings-panel.json +41 -9
  256. package/manifest/components/shape-section.json +8 -4
  257. package/manifest/components/shared-conversation.json +21 -5
  258. package/manifest/components/sheet.json +29 -6
  259. package/manifest/components/shimmer-label.json +4 -2
  260. package/manifest/components/sidebar.json +60 -13
  261. package/manifest/components/skill-icon.json +1 -7
  262. package/manifest/components/slider.json +22 -5
  263. package/manifest/components/sources.json +17 -4
  264. package/manifest/components/sparkline.json +17 -4
  265. package/manifest/components/speaker-identity.json +4 -1
  266. package/manifest/components/spec-sheet.json +16 -4
  267. package/manifest/components/spectrum-visualizer.json +41 -10
  268. package/manifest/components/spinner.json +12 -2
  269. package/manifest/components/stack-icon.json +1 -7
  270. package/manifest/components/stack.json +54 -7
  271. package/manifest/components/stacks-matrix-icon.json +1 -7
  272. package/manifest/components/stat.json +28 -4
  273. package/manifest/components/status-bar.json +50 -9
  274. package/manifest/components/status-dot.json +23 -4
  275. package/manifest/components/stepper.json +22 -5
  276. package/manifest/components/stopped-run.json +19 -4
  277. package/manifest/components/streaming-text.json +12 -3
  278. package/manifest/components/subagent-list.json +21 -5
  279. package/manifest/components/suggestions.json +27 -5
  280. package/manifest/components/swap-label.json +18 -4
  281. package/manifest/components/switch.json +18 -3
  282. package/manifest/components/table-scroll-region.json +4 -1
  283. package/manifest/components/table.json +54 -11
  284. package/manifest/components/tabs.json +16 -5
  285. package/manifest/components/tags-input.json +79 -17
  286. package/manifest/components/tail-status.json +37 -8
  287. package/manifest/components/terminal-block.json +25 -5
  288. package/manifest/components/terminal-frame.json +34 -8
  289. package/manifest/components/textarea.json +28 -3
  290. package/manifest/components/theme-configurator.json +47 -11
  291. package/manifest/components/theme-provider.json +79 -15
  292. package/manifest/components/thinking-indicator.json +8 -2
  293. package/manifest/components/thread-list.json +13 -3
  294. package/manifest/components/thread-search.json +22 -5
  295. package/manifest/components/threshold-rail.json +77 -14
  296. package/manifest/components/time-boundary.json +8 -2
  297. package/manifest/components/time-field.json +13 -2
  298. package/manifest/components/timeline-ruler.json +51 -12
  299. package/manifest/components/timeline.json +19 -3
  300. package/manifest/components/title-bar.json +19 -4
  301. package/manifest/components/toast.json +12 -3
  302. package/manifest/components/todo-list.json +8 -2
  303. package/manifest/components/toggle-group.json +33 -7
  304. package/manifest/components/toggle.json +33 -4
  305. package/manifest/components/token-editor.json +26 -7
  306. package/manifest/components/tool-call-card.json +83 -16
  307. package/manifest/components/tool-call.json +37 -9
  308. package/manifest/components/tool-error.json +34 -8
  309. package/manifest/components/tool-group.json +17 -4
  310. package/manifest/components/tool-timeline.json +37 -9
  311. package/manifest/components/toolbar.json +37 -8
  312. package/manifest/components/tooltip.json +41 -7
  313. package/manifest/components/trace-waterfall.json +12 -3
  314. package/manifest/components/tree-visibility-toggle.json +18 -3
  315. package/manifest/components/tree.json +52 -11
  316. package/manifest/components/turn-footer.json +36 -8
  317. package/manifest/components/two-step-button.json +46 -9
  318. package/manifest/components/typing-indicator.json +8 -1
  319. package/manifest/components/universe-grid.json +37 -10
  320. package/manifest/components/unread-divider.json +4 -1
  321. package/manifest/components/usage-chart.json +46 -9
  322. package/manifest/components/verdict-row.json +20 -5
  323. package/manifest/components/voice-conversation.json +37 -7
  324. package/manifest/components/web-preview.json +23 -5
  325. package/manifest/components/web-search.json +20 -5
  326. package/manifest/components/work-collapse.json +30 -7
  327. package/manifest/fixtures.json +111 -0
  328. package/manifest/manifest.json +354 -297
  329. package/manifest/tokens.json +2 -2
  330. package/package.json +8 -7
@@ -0,0 +1,61 @@
1
+ import * as React from "react";
2
+ //#region src/chrome/inspector.d.ts
3
+ interface InspectorRootProps extends React.ComponentPropsWithoutRef<"div"> {
4
+ /** The sections, then the footer. */
5
+ children?: React.ReactNode;
6
+ }
7
+ interface InspectorSectionProps extends React.ComponentPropsWithoutRef<"div"> {
8
+ /** The section's title — "Variants", "Stage". Drawn by a `SectionHeader` and read as the group's name. */
9
+ label: string;
10
+ /** The section's rows. */
11
+ children?: React.ReactNode;
12
+ }
13
+ interface InspectorRowProps extends React.ComponentPropsWithoutRef<"div"> {
14
+ /**
15
+ * What the control sets — "Size", "Theme". Drawn before it, and read as its
16
+ * name: a `<label>` for it when `htmlFor` is given, and otherwise laid on
17
+ * the control as `aria-label`, unless the control already names itself.
18
+ */
19
+ label: string;
20
+ /** The control's `id`, when it takes one: the label then becomes a `<label>` for it. */
21
+ htmlFor?: string;
22
+ /** The control — one element, any of the library's own. A row names a single control. */
23
+ children?: React.ReactNode;
24
+ }
25
+ interface InspectorFooterProps extends React.ComponentPropsWithoutRef<"div"> {
26
+ /** A quiet line on the left: which preset this is, or that none matches. */
27
+ note?: React.ReactNode;
28
+ /** The footer's one action, on the right — by convention a small `Button`. */
29
+ action?: React.ReactNode;
30
+ }
31
+ /**
32
+ * The shape a settings panel, a properties sidebar and a wrench menu share:
33
+ * titled sections of label-and-control rows, with a footer.
34
+ *
35
+ * Layout and nothing else — the controls are the library's own. A section is
36
+ * a group headed by a `SectionHeader`; a row is a label then its control, one
37
+ * column in a narrow container and two from 18rem; the footer holds a quiet
38
+ * note and one action.
39
+ *
40
+ * **Static markup — no hooks, no `"use client"`**, so a server page can draw
41
+ * one. Labels are strings for the same reason: a row with no `htmlFor` lays its
42
+ * label on its control as `aria-label`, rather than pointing at an id nobody
43
+ * has generated. The row itself carries no role.
44
+ *
45
+ * @example
46
+ * <Inspector.Root>
47
+ * <Inspector.Section label="Variants">
48
+ * <Inspector.Row label="Size"><SegmentedControl items={sizes} /></Inspector.Row>
49
+ * <Inspector.Row label="Label" htmlFor="label"><Input id="label" /></Inspector.Row>
50
+ * </Inspector.Section>
51
+ * <Inspector.Footer note="preset · button-hero" action={<Button size="sm">Reset</Button>} />
52
+ * </Inspector.Root>
53
+ */
54
+ declare const Inspector: {
55
+ Root: React.ForwardRefExoticComponent<InspectorRootProps & React.RefAttributes<HTMLDivElement>>;
56
+ Section: React.ForwardRefExoticComponent<InspectorSectionProps & React.RefAttributes<HTMLDivElement>>;
57
+ Row: React.ForwardRefExoticComponent<InspectorRowProps & React.RefAttributes<HTMLDivElement>>;
58
+ Footer: React.ForwardRefExoticComponent<InspectorFooterProps & React.RefAttributes<HTMLDivElement>>;
59
+ };
60
+ //#endregion
61
+ export { Inspector, InspectorFooterProps, InspectorRootProps, InspectorRowProps, InspectorSectionProps };
@@ -0,0 +1,121 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { SectionHeader } from "./section-header.js";
3
+ import * as React from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/chrome/inspector.tsx
6
+ /** A size container, so a row's two columns depend on the inspector's width and not the page's. */
7
+ const ROOT_CLASS = "@container flex min-w-0 flex-col";
8
+ const SECTION_CLASS = "flex flex-col gap-(--cue-space-3) border-t border-border px-(--cue-space-4) py-(--cue-space-3) first:border-t-0";
9
+ /** Static literals: Tailwind scans source text, not computed strings. */
10
+ const ROW_CLASS = "grid grid-cols-1 gap-(--cue-space-2) @min-[18rem]:grid-cols-[6rem_minmax(0,1fr)] @min-[18rem]:items-center";
11
+ const LABEL_CLASS = "text-(length:--cue-text-ui) text-fg-muted";
12
+ const FOOTER_CLASS = "flex items-center justify-between gap-(--cue-space-3) border-t border-border px-(--cue-space-4) py-(--cue-space-3)";
13
+ const NOTE_CLASS = "min-w-0 truncate font-mono text-(length:--cue-text-label) text-fg-subtle";
14
+ /** `ms-auto` so a lone action still sits at the end edge: `space-between` alone puts a single flex child at the start. */
15
+ const FOOTER_ACTION_CLASS = "ms-auto";
16
+ /**
17
+ * A row's words, laid on its control as the control's own name.
18
+ *
19
+ * A row with no `htmlFor` has no id to point a `<label>` at, and generating one
20
+ * would take `useId` — a hook, and with it this module's place in a server
21
+ * component. So the control is cloned with `aria-label={label}`: cloning is not
22
+ * a hook, which is why `Bento.Tile` clones its `render` link the same way. A
23
+ * control that already names itself keeps its name. Anything that is not one
24
+ * element — text, a list, a fragment — is left as it is, because an
25
+ * `aria-label` on a fragment is an attribute on nothing.
26
+ *
27
+ * The row itself carries no role. A `SegmentedControl` is already a group, and
28
+ * a row that named itself a group with the same words would be two groups with
29
+ * one name, announced twice.
30
+ */
31
+ function nameControl(control, label) {
32
+ if (!React.isValidElement(control) || control.type === React.Fragment) return control;
33
+ if (control.props["aria-label"] !== void 0 || control.props["aria-labelledby"] !== void 0) return control;
34
+ return React.cloneElement(control, { "aria-label": label });
35
+ }
36
+ /**
37
+ * The shape a settings panel, a properties sidebar and a wrench menu share:
38
+ * titled sections of label-and-control rows, with a footer.
39
+ *
40
+ * Layout and nothing else — the controls are the library's own. A section is
41
+ * a group headed by a `SectionHeader`; a row is a label then its control, one
42
+ * column in a narrow container and two from 18rem; the footer holds a quiet
43
+ * note and one action.
44
+ *
45
+ * **Static markup — no hooks, no `"use client"`**, so a server page can draw
46
+ * one. Labels are strings for the same reason: a row with no `htmlFor` lays its
47
+ * label on its control as `aria-label`, rather than pointing at an id nobody
48
+ * has generated. The row itself carries no role.
49
+ *
50
+ * @example
51
+ * <Inspector.Root>
52
+ * <Inspector.Section label="Variants">
53
+ * <Inspector.Row label="Size"><SegmentedControl items={sizes} /></Inspector.Row>
54
+ * <Inspector.Row label="Label" htmlFor="label"><Input id="label" /></Inspector.Row>
55
+ * </Inspector.Section>
56
+ * <Inspector.Footer note="preset · button-hero" action={<Button size="sm">Reset</Button>} />
57
+ * </Inspector.Root>
58
+ */
59
+ const Inspector = {
60
+ Root: React.forwardRef(function InspectorRoot({ className, children, ...elementProps }, ref) {
61
+ return /* @__PURE__ */ jsx("div", {
62
+ ...elementProps,
63
+ ref,
64
+ "data-slot": "inspector",
65
+ className: cn(ROOT_CLASS, className),
66
+ children
67
+ });
68
+ }),
69
+ Section: React.forwardRef(function InspectorSection({ label, className, children, ...elementProps }, ref) {
70
+ return /* @__PURE__ */ jsxs("div", {
71
+ ...elementProps,
72
+ ref,
73
+ role: "group",
74
+ "aria-label": label,
75
+ "data-slot": "inspector-section",
76
+ className: cn(SECTION_CLASS, className),
77
+ children: [/* @__PURE__ */ jsx(SectionHeader, { label }), children]
78
+ });
79
+ }),
80
+ Row: React.forwardRef(function InspectorRow({ label, htmlFor, className, children, ...elementProps }, ref) {
81
+ return /* @__PURE__ */ jsxs("div", {
82
+ ...elementProps,
83
+ ref,
84
+ "data-slot": "inspector-row",
85
+ className: cn(ROW_CLASS, className),
86
+ children: [htmlFor === void 0 ? /* @__PURE__ */ jsx("span", {
87
+ "data-slot": "inspector-row-label",
88
+ className: LABEL_CLASS,
89
+ children: label
90
+ }) : /* @__PURE__ */ jsx("label", {
91
+ "data-slot": "inspector-row-label",
92
+ htmlFor,
93
+ className: LABEL_CLASS,
94
+ children: label
95
+ }), /* @__PURE__ */ jsx("div", {
96
+ "data-slot": "inspector-row-control",
97
+ className: "min-w-0",
98
+ children: htmlFor === void 0 ? nameControl(children, label) : children
99
+ })]
100
+ });
101
+ }),
102
+ Footer: React.forwardRef(function InspectorFooter({ note, action, className, ...elementProps }, ref) {
103
+ return /* @__PURE__ */ jsxs("div", {
104
+ ...elementProps,
105
+ ref,
106
+ "data-slot": "inspector-footer",
107
+ className: cn(FOOTER_CLASS, className),
108
+ children: [note === void 0 ? null : /* @__PURE__ */ jsx("span", {
109
+ "data-slot": "inspector-footer-note",
110
+ className: NOTE_CLASS,
111
+ children: note
112
+ }), action === void 0 ? null : /* @__PURE__ */ jsx("span", {
113
+ "data-slot": "inspector-footer-action",
114
+ className: FOOTER_ACTION_CLASS,
115
+ children: action
116
+ })]
117
+ });
118
+ })
119
+ };
120
+ //#endregion
121
+ export { Inspector };
@@ -10,6 +10,18 @@ interface InputProps extends Omit<Input.Props, "className" | "size"> {
10
10
  * attribute (a character count), which nothing in a token-driven layout wants.
11
11
  */
12
12
  size?: FormControlSize;
13
+ /**
14
+ * Accessible name for the input, when no `FieldLabel` names it. Declared here
15
+ * rather than left to the inherited attribute so the props table carries the
16
+ * row: a bare input outside a `Field` has no other way to be named.
17
+ */
18
+ "aria-label"?: string;
19
+ /**
20
+ * An example of what goes in the field, shown while it is empty. Not a name:
21
+ * it disappears on the first keystroke, so pair it with `aria-label` or a
22
+ * `FieldLabel`. Declared for the props-table row, as `aria-label` is above.
23
+ */
24
+ placeholder?: string;
13
25
  }
14
26
  /**
15
27
  * The single-line text control.
@@ -5,6 +5,18 @@ interface TextareaProps extends React.ComponentPropsWithoutRef<"textarea"> {
5
5
  className?: string;
6
6
  /** Visible rows before the box starts scrolling. Defaults to `3`. */
7
7
  rows?: number;
8
+ /**
9
+ * Accessible name for the textarea, when no `FieldLabel` names it. Declared
10
+ * here rather than left to the inherited attribute so the props table carries
11
+ * the row: a bare textarea outside a `Field` has no other way to be named.
12
+ */
13
+ "aria-label"?: string;
14
+ /**
15
+ * An example of what goes in the box, shown while it is empty. Not a name:
16
+ * it disappears on the first keystroke, so pair it with `aria-label` or a
17
+ * `FieldLabel`. Declared for the props-table row, as `aria-label` is above.
18
+ */
19
+ placeholder?: string;
8
20
  }
9
21
  /**
10
22
  * The multi-line text control.
@@ -18,6 +18,12 @@ interface ToggleProps extends Omit<Toggle.Props, "className"> {
18
18
  icon?: React.ElementType;
19
19
  /** The label. Leave it off for an icon-only toggle — and then pass `aria-label`. */
20
20
  children?: React.ReactNode;
21
+ /**
22
+ * Accessible name. An icon-only toggle has no text to be named by, so this is
23
+ * its name; declared here rather than left to the inherited attribute so the
24
+ * props table carries the row the sentence above tells a caller to pass.
25
+ */
26
+ "aria-label"?: string;
21
27
  }
22
28
  /**
23
29
  * A two-state button: solo, mute, snap-to-grid, "show hidden".
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ import { EmptyState, EmptyStateProps } from "./chrome/empty-state.js";
18
18
  import { Eyebrow, EyebrowProps } from "./chrome/eyebrow.js";
19
19
  import { Container, ContainerProps, ContainerWidth } from "./layout/container.js";
20
20
  import { Footer, FooterProps } from "./chrome/footer.js";
21
+ import { Inspector, InspectorFooterProps, InspectorRootProps, InspectorRowProps, InspectorSectionProps } from "./chrome/inspector.js";
21
22
  import { NavigationMenu, NavigationMenuContentProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuListProps, NavigationMenuRootProps, NavigationMenuTriggerProps, NavigationMenuViewportProps } from "./chrome/navigation-menu.js";
22
23
  import { PageShell, PageShellProps, PageWidth } from "./chrome/page-shell.js";
23
24
  import { Panel, PanelHeader, PanelHeaderProps, PanelProps } from "./chrome/panel.js";
@@ -33,7 +34,7 @@ import { Tree, TreeProps, TreeVisibility, TreeVisibilityToggle, TreeVisibilityTo
33
34
  import { Toolbar, ToolbarButtonProps, ToolbarGroupProps, ToolbarRootProps, ToolbarSeparatorProps } from "./chrome/toolbar.js";
34
35
  import "./chrome/index.js";
35
36
  import { ControlVariantProps, FormControlSize, bareControlClasses, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants } from "./forms/_chassis.js";
36
- import { TokenOverrides } from "./system/overrides.js";
37
+ import { TokenOverrides, isSafeTokenValue } from "./system/overrides.js";
37
38
  import { FontFamilies, ResolvedMode, ThemeContextValue, ThemeProvider, ThemeProviderProps } from "./system/theme-provider.js";
38
39
  import { Autocomplete, AutocompleteProps } from "./forms/autocomplete.js";
39
40
  import { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps } from "./forms/button-group.js";
@@ -69,6 +70,7 @@ import { AudienceIcon, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, CliT
69
70
  import "./icons/index.js";
70
71
  import { activateRowFromClick, activateRowFromKeyDown } from "./instruments/_data-row.js";
71
72
  import { AppWindowFrame, AppWindowFrameProps } from "./instruments/app-window-frame.js";
73
+ import { CodeBlock, CodeBlockProps } from "./instruments/code-block.js";
72
74
  import { Button, ButtonProps, buttonVariants } from "./primitives/button.js";
73
75
  import { CopyButton, CopyButtonProps } from "./instruments/copy-button.js";
74
76
  import { DataRow, DataRowDisclosure, DataRowRootProps, DataRowSlotProps } from "./instruments/data-row.js";
@@ -86,14 +88,16 @@ import { TwoStepButton, TwoStepButtonProps, TwoStepTone } from "./instruments/tw
86
88
  import { UsageChart, UsageChartPoint, UsageChartProps, UsageChartTone } from "./instruments/usage-chart.js";
87
89
  import "./instruments/index.js";
88
90
  import { Accordion, AccordionHeaderProps, AccordionItemProps, AccordionPanelProps, AccordionRootProps, AccordionTriggerProps } from "./layout/accordion.js";
91
+ import { SpaceStep, Stack, StackAlign, StackJustify, StackProps } from "./layout/stack.js";
92
+ import { Bento, BentoColumns, BentoMinHeight, BentoRootProps, BentoRowSpan, BentoRows, BentoSpan, BentoTileProps } from "./layout/bento.js";
89
93
  import { Breadcrumb, BreadcrumbItem, BreadcrumbProps } from "./layout/breadcrumb.js";
90
94
  import { Card, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps } from "./layout/card.js";
91
95
  import { Collapsible, CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps, Disclosure, DisclosureProps } from "./layout/collapsible.js";
92
96
  import { DescriptionList, DescriptionListDetailProps, DescriptionListLayout, DescriptionListRootProps, DescriptionListTermProps } from "./layout/description-list.js";
93
- import { SpaceStep, Stack, StackAlign, StackJustify, StackProps } from "./layout/stack.js";
94
97
  import { Grid, GridColumns, GridProps } from "./layout/grid.js";
95
98
  import { Item, ItemProps, itemVariants } from "./layout/item.js";
96
99
  import { Pagination, PaginationEntry, PaginationProps, paginationRange } from "./layout/pagination.js";
100
+ import { Preview, PreviewAxis, PreviewProps, PreviewResizeOptions } from "./layout/preview.js";
97
101
  import { Stepper, StepperProps, StepperState, StepperStep } from "./layout/stepper.js";
98
102
  import { StatusDot, StatusDotProps, StatusTone } from "./primitives/status-dot.js";
99
103
  import { Timeline, TimelineContentProps, TimelineItemProps, TimelineMarkerProps, TimelineRootProps } from "./layout/timeline.js";
@@ -128,4 +132,4 @@ import { useDensities, useFonts, useThemes } from "./system/theme-registry.js";
128
132
  import { ControlSize, useControlHeight, useDensity } from "./system/use-density.js";
129
133
  import { useTheme } from "./system/use-theme.js";
130
134
  import { DensityEntry, DensityLevel, FontEntry, FontName, Mode, ThemeManifest, ThemeName } from "./system/index.js";
131
- export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, type AgentColorOptions, AgentPile, type AgentPileEntry, type AgentPileProps, type AgentPileSize, AlertDialog, type AlertDialogActionProps, type AlertDialogCancelProps, type AlertDialogContentProps, type AlertDialogDescriptionProps, type AlertDialogFooterProps, type AlertDialogRootProps, type AlertDialogTitleProps, type AlertDialogTriggerProps, AppBar, type AppBarActionsProps, type AppBarBrandProps, type AppBarLinkProps, type AppBarNavProps, type AppBarRegister, type AppBarRootProps, type AppBarSeparatorProps, AppShell, type AppShellAsideProps, type AppShellBarProps, type AppShellBodyProps, type AppShellContentProps, type AppShellNavTriggerProps, type AppShellRootProps, type AppShellScrollerProps, type AppShellSidebarProps, AppWindowFrame, type AppWindowFrameProps, type AskAnswer, AskBox, type AskBoxProps, type AskDanger, type AskKind, type AskOption, AudienceIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, type BarOverflow, type BrandAssetProps, type BrandSize, type BrandTone, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupOrientation, type ButtonGroupProps, type ButtonProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, CliToolIcon, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, Composer, type ComposerProps, type ComposerSubmitKey, Container, type ContainerProps, type ContainerWidth, ContextMenu, type ContextMenuContentProps, type ContextMenuRootProps, type ContextMenuTriggerProps, type ControlSize, type ControlVariantProps, CopyButton, type CopyButtonProps, CueLogotype, type CueLogotypeProps, CueMark, type CueMarkProps, CuePortalFrame, type CuePortalFrameProps, DEFAULT_STORAGE_KEY, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, DelegationCard, type DelegationCardProps, type DelegationDirection, type DelegationStatus, Density, type DensityEntry, type DensityLevel, type DensityProps, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Dialog, type DialogCloseProps, type DialogContentProps, type DialogDescriptionProps, type DialogFooterProps, type DialogRootProps, type DialogTitleProps, type DialogTriggerProps, Disclosure, type DisclosureProps, Drawer, type DrawerCloseProps, type DrawerContentProps, type DrawerDescriptionProps, type DrawerFooterProps, type DrawerRootProps, type DrawerSwipeDirection, type DrawerTitleProps, type DrawerTriggerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRootProps, type DropdownMenuSeparatorProps, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, EnvVarInput, type EnvVarInputProps, Eyebrow, type EyebrowProps, Field, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorProps, type FieldIssue, FieldLabel, type FieldLabelProps, type FieldProps, type FilePartition, type FilePartitionOptions, type FileRejectReason, type FileRejection, FileUpload, type FileUploadProps, FolderIcon, type FontEntry, type FontFamilies, type FontName, Footer, type FooterProps, type FormControlSize, Grid, type GridColumns, type GridProps, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, HoverCard, type HoverCardContentProps, type HoverCardRootProps, type HoverCardTriggerProps, IconButton, type IconButtonProps, InfoTip, type InfoTipProps, Input, InputGroup, type InputGroupProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Link, type LinkProps, McpServerIcon, Menubar, type MenubarContentProps, type MenubarMenuProps, type MenubarRootProps, type MenubarTriggerProps, Message, MessageList, type MessageListProps, type MessageProps, type MessageRole, Meter, type MeterProps, type MeterProvenance, type MeterTone, type Mode, MultiSelect, type MultiSelectProps, NavigationMenu, type NavigationMenuContentProps, type NavigationMenuItemProps, type NavigationMenuLinkProps, type NavigationMenuListProps, type NavigationMenuRootProps, type NavigationMenuTriggerProps, type NavigationMenuViewportProps, NumberField, type NumberFieldProps, OTPField, type OTPFieldProps, OVERLAY_SIDE_OFFSET, PageShell, type PageShellProps, type PageWidth, Pagination, type PaginationEntry, type PaginationProps, Panel, PanelHeader, type PanelHeaderProps, type PanelProps, PasswordInput, type PasswordInputProps, type PersistedPreferences, Plussie, type PlussieExpression, type PlussieProps, Popover, type PopoverCloseProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverRootProps, type PopoverTitleProps, type PopoverTriggerProps, type PrepaintDefaults, type PrepaintOptions, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type RatingSize, type ResolvedMode, Row, type RowProps, ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps, type ScrollEdges, ScrollableTabsList, type ScrollableTabsListProps, ScrubInput, type ScrubInputProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, SeamList, type SeamListProps, SearchInput, type SearchInputProps, SectionHeader, type SectionHeaderProps, SegmentedControl, type SegmentedControlItem, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetCloseProps, type SheetContentProps, type SheetDescriptionProps, type SheetFooterProps, type SheetRootProps, type SheetTitleProps, type SheetTriggerProps, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, Skeleton, type SkeletonProps, SkillIcon, Slider, type SliderProps, type SpaceStep, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, type StackAlign, StackIcon, type StackJustify, type StackProps, StacksMatrixIcon, Stat, type StatProps, type StatTone, StatusBar, type StatusBarGroupProps, type StatusBarItemProps, type StatusBarProminence, type StatusBarProps, type StatusBarTone, StatusDot, type StatusDotProps, type StatusTone, Stepper, type StepperProps, type StepperState, type StepperStep, Switch, type SwitchProps, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, TagsInput, type TagsInputProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, Textarea, type TextareaProps, type ThemeContextValue, type ThemeManifest, type ThemeName, ThemeProvider, type ThemeProviderProps, type ThemeRegistry, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, TitleBar, type TitleBarProps, Toast, type ToastManager, type ToastOptions, type ToastProviderProps, type ToastTone, type ToastViewportProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, type TokenOverrides, Toolbar, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarRootProps, type ToolbarSeparatorProps, Tooltip, type TooltipContentProps, type TooltipProviderProps, type TooltipRootProps, type TooltipTriggerProps, Tree, type TreeGuide, type TreeItem, type TreeProps, type TreeRow, type TreeVisibility, TreeVisibilityToggle, type TreeVisibilityToggleProps, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, type UploadFile, type UploadStatus, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
135
+ export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, type AgentColorOptions, AgentPile, type AgentPileEntry, type AgentPileProps, type AgentPileSize, AlertDialog, type AlertDialogActionProps, type AlertDialogCancelProps, type AlertDialogContentProps, type AlertDialogDescriptionProps, type AlertDialogFooterProps, type AlertDialogRootProps, type AlertDialogTitleProps, type AlertDialogTriggerProps, AppBar, type AppBarActionsProps, type AppBarBrandProps, type AppBarLinkProps, type AppBarNavProps, type AppBarRegister, type AppBarRootProps, type AppBarSeparatorProps, AppShell, type AppShellAsideProps, type AppShellBarProps, type AppShellBodyProps, type AppShellContentProps, type AppShellNavTriggerProps, type AppShellRootProps, type AppShellScrollerProps, type AppShellSidebarProps, AppWindowFrame, type AppWindowFrameProps, type AskAnswer, AskBox, type AskBoxProps, type AskDanger, type AskKind, type AskOption, AudienceIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, type BarOverflow, Bento, type BentoColumns, type BentoMinHeight, type BentoRootProps, type BentoRowSpan, type BentoRows, type BentoSpan, type BentoTileProps, type BrandAssetProps, type BrandSize, type BrandTone, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupOrientation, type ButtonGroupProps, type ButtonProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, CliToolIcon, CodeBlock, type CodeBlockProps, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, Composer, type ComposerProps, type ComposerSubmitKey, Container, type ContainerProps, type ContainerWidth, ContextMenu, type ContextMenuContentProps, type ContextMenuRootProps, type ContextMenuTriggerProps, type ControlSize, type ControlVariantProps, CopyButton, type CopyButtonProps, CueLogotype, type CueLogotypeProps, CueMark, type CueMarkProps, CuePortalFrame, type CuePortalFrameProps, DEFAULT_STORAGE_KEY, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, DelegationCard, type DelegationCardProps, type DelegationDirection, type DelegationStatus, Density, type DensityEntry, type DensityLevel, type DensityProps, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Dialog, type DialogCloseProps, type DialogContentProps, type DialogDescriptionProps, type DialogFooterProps, type DialogRootProps, type DialogTitleProps, type DialogTriggerProps, Disclosure, type DisclosureProps, Drawer, type DrawerCloseProps, type DrawerContentProps, type DrawerDescriptionProps, type DrawerFooterProps, type DrawerRootProps, type DrawerSwipeDirection, type DrawerTitleProps, type DrawerTriggerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRootProps, type DropdownMenuSeparatorProps, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, EnvVarInput, type EnvVarInputProps, Eyebrow, type EyebrowProps, Field, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorProps, type FieldIssue, FieldLabel, type FieldLabelProps, type FieldProps, type FilePartition, type FilePartitionOptions, type FileRejectReason, type FileRejection, FileUpload, type FileUploadProps, FolderIcon, type FontEntry, type FontFamilies, type FontName, Footer, type FooterProps, type FormControlSize, Grid, type GridColumns, type GridProps, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, HoverCard, type HoverCardContentProps, type HoverCardRootProps, type HoverCardTriggerProps, IconButton, type IconButtonProps, InfoTip, type InfoTipProps, Input, InputGroup, type InputGroupProps, type InputProps, Inspector, type InspectorFooterProps, type InspectorRootProps, type InspectorRowProps, type InspectorSectionProps, Item, type ItemProps, Kbd, type KbdProps, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Link, type LinkProps, McpServerIcon, Menubar, type MenubarContentProps, type MenubarMenuProps, type MenubarRootProps, type MenubarTriggerProps, Message, MessageList, type MessageListProps, type MessageProps, type MessageRole, Meter, type MeterProps, type MeterProvenance, type MeterTone, type Mode, MultiSelect, type MultiSelectProps, NavigationMenu, type NavigationMenuContentProps, type NavigationMenuItemProps, type NavigationMenuLinkProps, type NavigationMenuListProps, type NavigationMenuRootProps, type NavigationMenuTriggerProps, type NavigationMenuViewportProps, NumberField, type NumberFieldProps, OTPField, type OTPFieldProps, OVERLAY_SIDE_OFFSET, PageShell, type PageShellProps, type PageWidth, Pagination, type PaginationEntry, type PaginationProps, Panel, PanelHeader, type PanelHeaderProps, type PanelProps, PasswordInput, type PasswordInputProps, type PersistedPreferences, Plussie, type PlussieExpression, type PlussieProps, Popover, type PopoverCloseProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverRootProps, type PopoverTitleProps, type PopoverTriggerProps, type PrepaintDefaults, type PrepaintOptions, Preview, type PreviewAxis, type PreviewProps, type PreviewResizeOptions, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type RatingSize, type ResolvedMode, Row, type RowProps, ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps, type ScrollEdges, ScrollableTabsList, type ScrollableTabsListProps, ScrubInput, type ScrubInputProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, SeamList, type SeamListProps, SearchInput, type SearchInputProps, SectionHeader, type SectionHeaderProps, SegmentedControl, type SegmentedControlItem, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetCloseProps, type SheetContentProps, type SheetDescriptionProps, type SheetFooterProps, type SheetRootProps, type SheetTitleProps, type SheetTriggerProps, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, Skeleton, type SkeletonProps, SkillIcon, Slider, type SliderProps, type SpaceStep, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, type StackAlign, StackIcon, type StackJustify, type StackProps, StacksMatrixIcon, Stat, type StatProps, type StatTone, StatusBar, type StatusBarGroupProps, type StatusBarItemProps, type StatusBarProminence, type StatusBarProps, type StatusBarTone, StatusDot, type StatusDotProps, type StatusTone, Stepper, type StepperProps, type StepperState, type StepperStep, Switch, type SwitchProps, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, TagsInput, type TagsInputProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, Textarea, type TextareaProps, type ThemeContextValue, type ThemeManifest, type ThemeName, ThemeProvider, type ThemeProviderProps, type ThemeRegistry, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, TitleBar, type TitleBarProps, Toast, type ToastManager, type ToastOptions, type ToastProviderProps, type ToastTone, type ToastViewportProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, type TokenOverrides, Toolbar, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarRootProps, type ToolbarSeparatorProps, Tooltip, type TooltipContentProps, type TooltipProviderProps, type TooltipRootProps, type TooltipTriggerProps, Tree, type TreeGuide, type TreeItem, type TreeProps, type TreeRow, type TreeVisibility, TreeVisibilityToggle, type TreeVisibilityToggleProps, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, type UploadFile, type UploadStatus, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, isSafeTokenValue, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ import { Separator } from "./primitives/separator.js";
24
24
  import { AppBar } from "./chrome/app-bar.js";
25
25
  import { Sidebar, useSidebar } from "./layout/sidebar.js";
26
26
  import { Density } from "./system/density.js";
27
+ import { isSafeTokenValue } from "./system/overrides.js";
27
28
  import { DEFAULT_STORAGE_KEY, prepaintScript } from "./system/prepaint.js";
28
29
  import { useDensities, useFonts, useThemes } from "./system/theme-registry.js";
29
30
  import { ThemeProvider } from "./system/theme-provider.js";
@@ -36,12 +37,13 @@ import { EmptyState } from "./chrome/empty-state.js";
36
37
  import { Eyebrow } from "./chrome/eyebrow.js";
37
38
  import { Container } from "./layout/container.js";
38
39
  import { Footer } from "./chrome/footer.js";
40
+ import { SectionHeader } from "./chrome/section-header.js";
41
+ import { Inspector } from "./chrome/inspector.js";
39
42
  import { NavigationMenu } from "./chrome/navigation-menu.js";
40
43
  import { PageShell } from "./chrome/page-shell.js";
41
44
  import { Panel, PanelHeader } from "./chrome/panel.js";
42
45
  import { Row, SeamList, rowVariants } from "./chrome/row.js";
43
46
  import { ScrollArea } from "./chrome/scroll-area.js";
44
- import { SectionHeader } from "./chrome/section-header.js";
45
47
  import { SegmentedControl } from "./chrome/segmented-control.js";
46
48
  import { StatusBar } from "./chrome/status-bar.js";
47
49
  import { ScrollableTabsList, Tabs } from "./chrome/tabs.js";
@@ -71,6 +73,7 @@ import { AudienceIcon, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, CliT
71
73
  import { activateRowFromClick, activateRowFromKeyDown } from "./instruments/_data-row.js";
72
74
  import { AppWindowFrame } from "./instruments/app-window-frame.js";
73
75
  import { CopyButton } from "./instruments/copy-button.js";
76
+ import { CodeBlock } from "./instruments/code-block.js";
74
77
  import { DataRow } from "./instruments/data-row.js";
75
78
  import { DataTree } from "./instruments/data-tree.js";
76
79
  import { GroupBar } from "./instruments/group-bar.js";
@@ -85,14 +88,16 @@ import { TerminalFrame } from "./instruments/terminal-frame.js";
85
88
  import { TwoStepButton } from "./instruments/two-step-button.js";
86
89
  import { UsageChart } from "./instruments/usage-chart.js";
87
90
  import { Accordion } from "./layout/accordion.js";
91
+ import { Stack } from "./layout/stack.js";
92
+ import { Bento } from "./layout/bento.js";
88
93
  import { Breadcrumb } from "./layout/breadcrumb.js";
89
94
  import { Card } from "./layout/card.js";
90
95
  import { Collapsible, Disclosure } from "./layout/collapsible.js";
91
96
  import { DescriptionList } from "./layout/description-list.js";
92
- import { Stack } from "./layout/stack.js";
93
97
  import { Grid } from "./layout/grid.js";
94
98
  import { Item, itemVariants } from "./layout/item.js";
95
99
  import { Pagination, paginationRange } from "./layout/pagination.js";
100
+ import { Preview } from "./layout/preview.js";
96
101
  import { Stepper } from "./layout/stepper.js";
97
102
  import { StatusDot } from "./primitives/status-dot.js";
98
103
  import { Timeline } from "./layout/timeline.js";
@@ -113,4 +118,4 @@ import { Kbd } from "./primitives/kbd.js";
113
118
  import { Skeleton } from "./primitives/skeleton.js";
114
119
  import { useControlHeight, useDensity } from "./system/use-density.js";
115
120
  import { useTheme } from "./system/use-theme.js";
116
- export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, AgentPile, AlertDialog, AppBar, AppShell, AppWindowFrame, AskBox, AudienceIcon, Autocomplete, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, Chip, CliToolIcon, Collapsible, Combobox, CommandPalette, Composer, Container, ContextMenu, CopyButton, CueLogotype, CueMark, CuePortalFrame, DEFAULT_STORAGE_KEY, DataRow, DataTree, DelegationCard, Density, DescriptionList, Dialog, Disclosure, Drawer, DropdownMenu, EmptyState, EnvVarInput, Eyebrow, Field, FieldDescription, FieldError, FieldLabel, FileUpload, FolderIcon, Footer, Grid, GroupBar, HoverCard, IconButton, InfoTip, Input, InputGroup, Item, Kbd, Ledger, Link, McpServerIcon, Menubar, Message, MessageList, Meter, MultiSelect, NavigationMenu, NumberField, OTPField, OVERLAY_SIDE_OFFSET, PageShell, Pagination, Panel, PanelHeader, PasswordInput, Plussie, Popover, Progress, Radio, RadioGroup, Rating, Row, ScrollArea, ScrollableTabsList, ScrubInput, SeamCell, SeamGrid, SeamList, SearchInput, SectionHeader, SegmentedControl, Select, Separator, Sheet, Sidebar, Skeleton, SkillIcon, Slider, Sparkline, Spinner, Stack, StackIcon, StacksMatrixIcon, Stat, StatusBar, StatusDot, Stepper, Switch, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, TableScrollRegion, Tabs, TagsInput, TerminalFrame, Textarea, ThemeProvider, Timeline, TitleBar, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, Tree, TreeVisibilityToggle, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
121
+ export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, AgentPile, AlertDialog, AppBar, AppShell, AppWindowFrame, AskBox, AudienceIcon, Autocomplete, Avatar, AvatarGroup, Bento, Breadcrumb, Button, ButtonGroup, Card, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, Chip, CliToolIcon, CodeBlock, Collapsible, Combobox, CommandPalette, Composer, Container, ContextMenu, CopyButton, CueLogotype, CueMark, CuePortalFrame, DEFAULT_STORAGE_KEY, DataRow, DataTree, DelegationCard, Density, DescriptionList, Dialog, Disclosure, Drawer, DropdownMenu, EmptyState, EnvVarInput, Eyebrow, Field, FieldDescription, FieldError, FieldLabel, FileUpload, FolderIcon, Footer, Grid, GroupBar, HoverCard, IconButton, InfoTip, Input, InputGroup, Inspector, Item, Kbd, Ledger, Link, McpServerIcon, Menubar, Message, MessageList, Meter, MultiSelect, NavigationMenu, NumberField, OTPField, OVERLAY_SIDE_OFFSET, PageShell, Pagination, Panel, PanelHeader, PasswordInput, Plussie, Popover, Preview, Progress, Radio, RadioGroup, Rating, Row, ScrollArea, ScrollableTabsList, ScrubInput, SeamCell, SeamGrid, SeamList, SearchInput, SectionHeader, SegmentedControl, Select, Separator, Sheet, Sidebar, Skeleton, SkillIcon, Slider, Sparkline, Spinner, Stack, StackIcon, StacksMatrixIcon, Stat, StatusBar, StatusDot, Stepper, Switch, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, TableScrollRegion, Tabs, TagsInput, TerminalFrame, Textarea, ThemeProvider, Timeline, TitleBar, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, Tree, TreeVisibilityToggle, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, isSafeTokenValue, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ //#region src/instruments/code-block.d.ts
3
+ interface CodeBlockProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
4
+ /** The code. Printed verbatim, already dedented by whoever produced it; the copy button copies exactly this. */
5
+ code: string;
6
+ /** What the block is, in the caption strip: a filename, an example's title. Defaults to the language. */
7
+ label?: string;
8
+ /**
9
+ * The fence language, on the `<pre>` as `data-language`. Defaults to `"tsx"`.
10
+ * `"jsx"` turns on emphasis: tag names, attribute names and punctuation in
11
+ * three inks the theme already has. Every other value prints plain.
12
+ */
13
+ language?: string;
14
+ }
15
+ /**
16
+ * A block of code with a copy button and no syntax-highlighter palette.
17
+ *
18
+ * Every colour a token-driven site paints has to come from the token layer, and
19
+ * a highlighter theme is a second palette that would need porting to every
20
+ * preset before it could sit beside them — so there is none. What `language="jsx"`
21
+ * adds is emphasis in three inks the theme already has: tag names in `--cue-fg`,
22
+ * attribute names in `--cue-fg-muted`, punctuation in `--cue-fg-subtle`. Mono
23
+ * type, the sunken ground every input uses, and a copy button that works.
24
+ *
25
+ * No directive: the copy button is the only client code, and a server page can
26
+ * draw the rest.
27
+ *
28
+ * @example
29
+ * <CodeBlock label="install" code="pnpm add @cueplusplus/ui" language="sh" />
30
+ * @example
31
+ * <CodeBlock label="JSX" language="jsx" code={'<Button variant="primary">Take cue</Button>'} />
32
+ */
33
+ declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
34
+ //#endregion
35
+ export { CodeBlock, CodeBlockProps };
@@ -0,0 +1,173 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Panel } from "../chrome/panel.js";
3
+ import { CopyButton } from "./copy-button.js";
4
+ import * as React from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/instruments/code-block.tsx
7
+ /** The three inks, and nothing else: a highlighter theme would be a second palette. */
8
+ const INK = {
9
+ tag: "text-fg",
10
+ attr: "text-fg-muted",
11
+ punct: "text-fg-subtle"
12
+ };
13
+ /**
14
+ * The end of a `{…}` expression starting at `start`, braces balanced; the
15
+ * code's end if unclosed.
16
+ *
17
+ * A JS string literal inside the expression (`"…"`, `'…'`, `` `…` ``,
18
+ * backslash escapes honoured) is skipped whole rather than scanned for
19
+ * braces: `{"a { b"}` has a real `{` and a stray one sitting inside a string,
20
+ * and only the first is the expression's own. Treating the string as opaque
21
+ * is also what keeps `{"<b>hi</b>"}` a single span for the caller that uses
22
+ * this to find where a JSX child expression ends — the `<b>` inside never
23
+ * gets a chance to look like a tag.
24
+ */
25
+ function expressionEnd(code, start) {
26
+ let depth = 0;
27
+ let index = start;
28
+ while (index < code.length) {
29
+ const ch = code[index];
30
+ if (ch === "\"" || ch === "'" || ch === "`") {
31
+ const quote = ch;
32
+ index += 1;
33
+ while (index < code.length && code[index] !== quote) index += code[index] === "\\" ? 2 : 1;
34
+ index += 1;
35
+ continue;
36
+ }
37
+ if (ch === "{") depth += 1;
38
+ else if (ch === "}") {
39
+ depth -= 1;
40
+ if (depth === 0) return index + 1;
41
+ }
42
+ index += 1;
43
+ }
44
+ return code.length;
45
+ }
46
+ /**
47
+ * JSX, cut into the four kinds this block paints.
48
+ *
49
+ * A tag opens at `<` or `</` followed by a letter — so `a < b` is text — and
50
+ * runs to `>` or `/>`. Inside it, a name is an attribute, `=` is punctuation,
51
+ * and a quoted string or a balanced `{…}` is text. Outside a tag everything is
52
+ * text, comments included — and a `{…}` expression child (`{"<b>hi</b>"}`, the
53
+ * shape `JSON.stringify` produces) stays opaque too, found with the same
54
+ * brace-and-string-aware scan as an attribute's expression value, so a `<`
55
+ * sitting inside its string can never be mistaken for a tag opening. The
56
+ * pieces concatenate back to the input exactly, which the suite asserts and
57
+ * the copy button depends on.
58
+ */
59
+ function jsxTokens(code) {
60
+ const tokens = [];
61
+ const push = (kind, from, to) => {
62
+ if (to <= from) return;
63
+ const last = tokens.at(-1);
64
+ if (kind === "text" && last?.kind === "text") last.text += code.slice(from, to);
65
+ else tokens.push({
66
+ kind,
67
+ text: code.slice(from, to),
68
+ at: from
69
+ });
70
+ };
71
+ let index = 0;
72
+ while (index < code.length) {
73
+ const open = /^<\/?(?=[A-Za-z])/.exec(code.slice(index));
74
+ if (open === null) {
75
+ let cursor = code[index] === "{" ? expressionEnd(code, index) : index + 1;
76
+ while (cursor < code.length) {
77
+ const ch = code[cursor];
78
+ if (ch === "{") {
79
+ cursor = expressionEnd(code, cursor);
80
+ continue;
81
+ }
82
+ if (ch === "<") break;
83
+ cursor += 1;
84
+ }
85
+ push("text", index, cursor);
86
+ index = cursor;
87
+ continue;
88
+ }
89
+ push("punct", index, index + open[0].length);
90
+ index += open[0].length;
91
+ const name = /^[A-Za-z][\w.]*/.exec(code.slice(index))[0];
92
+ push("tag", index, index + name.length);
93
+ index += name.length;
94
+ while (index < code.length) {
95
+ const rest = code.slice(index);
96
+ const space = /^\s+/.exec(rest);
97
+ const close = /^\/?>/.exec(rest);
98
+ const attribute = /^[^\s=>/"{]+/.exec(rest);
99
+ if (space !== null) {
100
+ push("text", index, index + space[0].length);
101
+ index += space[0].length;
102
+ } else if (close !== null) {
103
+ push("punct", index, index + close[0].length);
104
+ index += close[0].length;
105
+ break;
106
+ } else if (rest.startsWith("=")) {
107
+ push("punct", index, index + 1);
108
+ index += 1;
109
+ } else if (rest.startsWith("\"")) {
110
+ const quote = code.indexOf("\"", index + 1);
111
+ const end = quote === -1 ? code.length : quote + 1;
112
+ push("text", index, end);
113
+ index = end;
114
+ } else if (rest.startsWith("{")) {
115
+ const end = expressionEnd(code, index);
116
+ push("text", index, end);
117
+ index = end;
118
+ } else if (attribute !== null) {
119
+ push("attr", index, index + attribute[0].length);
120
+ index += attribute[0].length;
121
+ } else {
122
+ push("text", index, index + 1);
123
+ index += 1;
124
+ }
125
+ }
126
+ }
127
+ return tokens;
128
+ }
129
+ /**
130
+ * A block of code with a copy button and no syntax-highlighter palette.
131
+ *
132
+ * Every colour a token-driven site paints has to come from the token layer, and
133
+ * a highlighter theme is a second palette that would need porting to every
134
+ * preset before it could sit beside them — so there is none. What `language="jsx"`
135
+ * adds is emphasis in three inks the theme already has: tag names in `--cue-fg`,
136
+ * attribute names in `--cue-fg-muted`, punctuation in `--cue-fg-subtle`. Mono
137
+ * type, the sunken ground every input uses, and a copy button that works.
138
+ *
139
+ * No directive: the copy button is the only client code, and a server page can
140
+ * draw the rest.
141
+ *
142
+ * @example
143
+ * <CodeBlock label="install" code="pnpm add @cueplusplus/ui" language="sh" />
144
+ * @example
145
+ * <CodeBlock label="JSX" language="jsx" code={'<Button variant="primary">Take cue</Button>'} />
146
+ */
147
+ const CodeBlock = React.forwardRef(function CodeBlock({ code, label, language = "tsx", className, ...elementProps }, ref) {
148
+ const body = language === "jsx" ? jsxTokens(code).map((token) => token.kind === "text" ? token.text : /* @__PURE__ */ jsx("span", {
149
+ "data-token": token.kind,
150
+ className: INK[token.kind],
151
+ children: token.text
152
+ }, token.at)) : code;
153
+ return /* @__PURE__ */ jsxs(Panel, {
154
+ ...elementProps,
155
+ ref,
156
+ "data-slot": "code-block",
157
+ className: cn("bg-sunken", className),
158
+ children: [/* @__PURE__ */ jsxs("div", {
159
+ className: "flex items-center justify-between gap-(--cue-space-4) border-b border-border px-(--cue-pad-row-x) py-(--cue-pad-row-y)",
160
+ children: [/* @__PURE__ */ jsx("span", {
161
+ "data-slot": "code-block-label",
162
+ className: "font-mono text-(length:--cue-text-micro) tracking-[0.15em] text-fg-subtle uppercase",
163
+ children: label ?? language
164
+ }), /* @__PURE__ */ jsx(CopyButton, { value: code })]
165
+ }), /* @__PURE__ */ jsx("pre", {
166
+ "data-language": language,
167
+ className: "overflow-x-auto p-(--cue-space-4) font-mono text-(length:--cue-text-ui) leading-relaxed text-fg",
168
+ children: /* @__PURE__ */ jsx("code", { children: body })
169
+ })]
170
+ });
171
+ });
172
+ //#endregion
173
+ export { CodeBlock };
@@ -1,5 +1,6 @@
1
1
  import { activateRowFromClick, activateRowFromKeyDown } from "./_data-row.js";
2
2
  import { AppWindowFrame, AppWindowFrameProps } from "./app-window-frame.js";
3
+ import { CodeBlock, CodeBlockProps } from "./code-block.js";
3
4
  import { CopyButton, CopyButtonProps } from "./copy-button.js";
4
5
  import { DataRow, DataRowDisclosure, DataRowRootProps, DataRowSlotProps } from "./data-row.js";
5
6
  import { DataTree, DataTreeItem, DataTreeProps, DataTreeRowState } from "./data-tree.js";
@@ -14,4 +15,4 @@ import { Table, TableCaptionProps, TableCellProps, TableGroupRowProps, TableHead
14
15
  import { TerminalFrame, TerminalFrameLine, TerminalFrameProps, TerminalLine, TerminalLineTone, TerminalScript, TerminalStep } from "./terminal-frame.js";
15
16
  import { TwoStepButton, TwoStepButtonProps, TwoStepTone } from "./two-step-button.js";
16
17
  import { UsageChart, UsageChartPoint, UsageChartProps, UsageChartTone } from "./usage-chart.js";
17
- export { AppWindowFrame, type AppWindowFrameProps, CopyButton, type CopyButtonProps, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Meter, type MeterProps, type MeterProvenance, type MeterTone, Progress, type ProgressProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, Sparkline, type SparklineProps, Stat, type StatProps, type StatTone, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown };
18
+ export { AppWindowFrame, type AppWindowFrameProps, CodeBlock, type CodeBlockProps, CopyButton, type CopyButtonProps, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Meter, type MeterProps, type MeterProvenance, type MeterTone, Progress, type ProgressProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, Sparkline, type SparklineProps, Stat, type StatProps, type StatTone, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown };
@@ -1,6 +1,7 @@
1
1
  import { activateRowFromClick, activateRowFromKeyDown } from "./_data-row.js";
2
2
  import { AppWindowFrame } from "./app-window-frame.js";
3
3
  import { CopyButton } from "./copy-button.js";
4
+ import { CodeBlock } from "./code-block.js";
4
5
  import { DataRow } from "./data-row.js";
5
6
  import { DataTree } from "./data-tree.js";
6
7
  import { GroupBar } from "./group-bar.js";
@@ -14,4 +15,4 @@ import { Table, TableScrollRegion } from "./table.js";
14
15
  import { TerminalFrame } from "./terminal-frame.js";
15
16
  import { TwoStepButton } from "./two-step-button.js";
16
17
  import { UsageChart } from "./usage-chart.js";
17
- export { AppWindowFrame, CopyButton, DataRow, DataTree, GroupBar, Ledger, Meter, Progress, SeamCell, SeamGrid, Sparkline, Stat, Table, TableScrollRegion, TerminalFrame, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown };
18
+ export { AppWindowFrame, CodeBlock, CopyButton, DataRow, DataTree, GroupBar, Ledger, Meter, Progress, SeamCell, SeamGrid, Sparkline, Stat, Table, TableScrollRegion, TerminalFrame, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown };
@@ -19,7 +19,11 @@ type MeterTone = "ok" | "busy" | "warn" | "danger";
19
19
  */
20
20
  type MeterProvenance = "vendor" | "estimated" | "unbounded" | "none";
21
21
  interface MeterProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
22
- /** How full, 0–100. Clamped; a non-finite value reads as 0. */
22
+ /**
23
+ * How full, 0–100. Clamped; a non-finite value reads as 0.
24
+ * @min 0
25
+ * @max 100
26
+ */
23
27
  percent: number;
24
28
  /** Status colour for the fill. Defaults to `"ok"`. */
25
29
  tone?: MeterTone;