@zonsh/ui 0.2.0 → 0.5.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 (200) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +19 -13
  3. package/dist/components/accordion.js +1 -1
  4. package/dist/components/alert-dialog.js +1 -1
  5. package/dist/components/ascii-field.d.ts +1 -1
  6. package/dist/components/ascii-field.js +2 -1
  7. package/dist/components/bottom-nav.d.ts +86 -0
  8. package/dist/components/bottom-nav.js +175 -0
  9. package/dist/components/breadcrumb.d.ts +9 -0
  10. package/dist/components/breadcrumb.js +6 -1
  11. package/dist/components/button-group.d.ts +1 -1
  12. package/dist/components/button-group.js +2 -2
  13. package/dist/components/button.js +1 -1
  14. package/dist/components/calendar.d.ts +1 -1
  15. package/dist/components/calendar.js +18 -3
  16. package/dist/components/carousel.d.ts +22 -3
  17. package/dist/components/carousel.js +25 -7
  18. package/dist/components/chart.d.ts +20 -0
  19. package/dist/components/chart.js +52 -3
  20. package/dist/components/code-block.d.ts +20 -10
  21. package/dist/components/code-block.js +54 -12
  22. package/dist/components/collapsible.js +3 -3
  23. package/dist/components/color-picker.d.ts +30 -8
  24. package/dist/components/color-picker.js +48 -27
  25. package/dist/components/combobox.d.ts +21 -3
  26. package/dist/components/combobox.js +79 -7
  27. package/dist/components/command.d.ts +23 -3
  28. package/dist/components/command.js +63 -18
  29. package/dist/components/conversation.d.ts +10 -1
  30. package/dist/components/conversation.js +24 -7
  31. package/dist/components/copy-button.d.ts +15 -6
  32. package/dist/components/copy-button.js +27 -10
  33. package/dist/components/data-table.d.ts +66 -6
  34. package/dist/components/data-table.js +376 -23
  35. package/dist/components/date-picker.d.ts +73 -4
  36. package/dist/components/date-picker.js +138 -7
  37. package/dist/components/dialog.d.ts +10 -1
  38. package/dist/components/dialog.js +6 -3
  39. package/dist/components/drawer.d.ts +10 -1
  40. package/dist/components/drawer.js +6 -3
  41. package/dist/components/feature-list.js +2 -2
  42. package/dist/components/field.d.ts +27 -8
  43. package/dist/components/field.js +49 -4
  44. package/dist/components/file-drop.d.ts +26 -4
  45. package/dist/components/file-drop.js +125 -64
  46. package/dist/components/filter-bar.d.ts +50 -3
  47. package/dist/components/filter-bar.js +71 -33
  48. package/dist/components/form.d.ts +4 -2
  49. package/dist/components/form.js +24 -2
  50. package/dist/components/graph.d.ts +41 -0
  51. package/dist/components/graph.js +106 -50
  52. package/dist/components/illustration.js +51 -4
  53. package/dist/components/input-group.d.ts +18 -7
  54. package/dist/components/input-group.js +41 -19
  55. package/dist/components/input.d.ts +2 -2
  56. package/dist/components/input.js +3 -3
  57. package/dist/components/kbd.d.ts +17 -0
  58. package/dist/components/kbd.js +8 -1
  59. package/dist/components/layout.d.ts +2 -1
  60. package/dist/components/layout.js +55 -11
  61. package/dist/components/lightbox.d.ts +100 -0
  62. package/dist/components/lightbox.js +457 -0
  63. package/dist/components/locale.d.ts +44 -0
  64. package/dist/components/locale.js +37 -0
  65. package/dist/components/logo.js +1 -1
  66. package/dist/components/menu.js +3 -1
  67. package/dist/components/menubar.js +60 -13
  68. package/dist/components/message.d.ts +3 -3
  69. package/dist/components/message.js +12 -8
  70. package/dist/components/meter.js +3 -1
  71. package/dist/components/money-input.d.ts +80 -0
  72. package/dist/components/money-input.js +253 -0
  73. package/dist/components/navigation-menu.js +4 -2
  74. package/dist/components/number-field.d.ts +21 -2
  75. package/dist/components/number-field.js +53 -28
  76. package/dist/components/otp-field.d.ts +14 -1
  77. package/dist/components/otp-field.js +10 -2
  78. package/dist/components/pagination.d.ts +13 -7
  79. package/dist/components/pagination.js +18 -7
  80. package/dist/components/pdf-viewer.d.ts +67 -2
  81. package/dist/components/pdf-viewer.js +88 -21
  82. package/dist/components/phone-input.d.ts +79 -0
  83. package/dist/components/phone-input.js +282 -0
  84. package/dist/components/popover.js +1 -1
  85. package/dist/components/progress.js +3 -1
  86. package/dist/components/prompt-input.d.ts +34 -9
  87. package/dist/components/prompt-input.js +37 -17
  88. package/dist/components/radio-group.js +7 -2
  89. package/dist/components/rating.d.ts +73 -0
  90. package/dist/components/rating.js +124 -0
  91. package/dist/components/reasoning.d.ts +16 -1
  92. package/dist/components/reasoning.js +10 -7
  93. package/dist/components/resizable.d.ts +10 -1
  94. package/dist/components/resizable.js +4 -1
  95. package/dist/components/response.d.ts +17 -5
  96. package/dist/components/response.js +58 -18
  97. package/dist/components/scroll-area.d.ts +1 -1
  98. package/dist/components/select.js +14 -3
  99. package/dist/components/separator.js +1 -1
  100. package/dist/components/sidebar.d.ts +20 -4
  101. package/dist/components/sidebar.js +70 -35
  102. package/dist/components/site-header.d.ts +46 -12
  103. package/dist/components/site-header.js +78 -19
  104. package/dist/components/skeleton.d.ts +1 -1
  105. package/dist/components/skeleton.js +1 -1
  106. package/dist/components/slider.js +3 -1
  107. package/dist/components/sortable.d.ts +178 -0
  108. package/dist/components/sortable.js +1282 -0
  109. package/dist/components/sources.d.ts +17 -2
  110. package/dist/components/sources.js +11 -4
  111. package/dist/components/spinner.d.ts +13 -1
  112. package/dist/components/spinner.js +5 -2
  113. package/dist/components/stat.d.ts +91 -0
  114. package/dist/components/stat.js +141 -0
  115. package/dist/components/stepper.d.ts +71 -0
  116. package/dist/components/stepper.js +101 -0
  117. package/dist/components/switch.d.ts +2 -2
  118. package/dist/components/switch.js +2 -2
  119. package/dist/components/table.d.ts +13 -3
  120. package/dist/components/table.js +231 -41
  121. package/dist/components/tabs.js +8 -4
  122. package/dist/components/tags-input.d.ts +18 -2
  123. package/dist/components/tags-input.js +66 -34
  124. package/dist/components/theme.d.ts +16 -2
  125. package/dist/components/theme.js +34 -8
  126. package/dist/components/time-field.d.ts +24 -4
  127. package/dist/components/time-field.js +32 -9
  128. package/dist/components/timeline.d.ts +18 -2
  129. package/dist/components/timeline.js +13 -4
  130. package/dist/components/tippy.d.ts +48 -0
  131. package/dist/components/tippy.js +648 -0
  132. package/dist/components/toast.d.ts +18 -2
  133. package/dist/components/toast.js +12 -3
  134. package/dist/components/toggle-group.js +1 -0
  135. package/dist/components/tool-call.d.ts +19 -8
  136. package/dist/components/tool-call.js +23 -7
  137. package/dist/components/toolbar.d.ts +1 -1
  138. package/dist/components/toolbar.js +10 -2
  139. package/dist/components/tooltip.d.ts +4 -2
  140. package/dist/components/tooltip.js +10 -4
  141. package/dist/components/tour.d.ts +127 -0
  142. package/dist/components/tour.js +673 -0
  143. package/dist/components/tree.js +45 -9
  144. package/dist/components/video-player.d.ts +10 -2
  145. package/dist/components/video-player.js +134 -38
  146. package/dist/illustration.d.ts +2 -0
  147. package/dist/illustration.js +7 -0
  148. package/dist/index.d.ts +11 -3
  149. package/dist/index.js +11 -3
  150. package/dist/lib/code-highlight.d.ts +3 -16
  151. package/dist/lib/code-highlight.js +160 -10
  152. package/dist/lib/code-theme.js +3 -3
  153. package/dist/lib/digit-roll.js +8 -8
  154. package/dist/lib/field-errors.d.ts +28 -0
  155. package/dist/lib/field-errors.js +24 -0
  156. package/dist/lib/field-value.d.ts +13 -0
  157. package/dist/lib/field-value.js +44 -0
  158. package/dist/lib/glide.d.ts +5 -4
  159. package/dist/lib/glide.js +5 -4
  160. package/dist/lib/graph-layout.js +11 -2
  161. package/dist/lib/money.d.ts +73 -0
  162. package/dist/lib/money.js +343 -0
  163. package/dist/lib/phone-countries.d.ts +1 -0
  164. package/dist/lib/phone-countries.js +281 -0
  165. package/dist/lib/phone.d.ts +90 -0
  166. package/dist/lib/phone.js +286 -0
  167. package/dist/lib/platform.d.ts +8 -3
  168. package/dist/lib/platform.js +13 -6
  169. package/dist/lib/row-index.d.ts +15 -0
  170. package/dist/lib/row-index.js +136 -0
  171. package/dist/lib/table-fit.d.ts +3 -2
  172. package/dist/lib/table-fit.js +52 -23
  173. package/dist/lib/theme-script.d.ts +15 -2
  174. package/dist/lib/theme-script.js +23 -3
  175. package/dist/lib/tippy/pixels.d.ts +47 -0
  176. package/dist/lib/tippy/pixels.js +187 -0
  177. package/dist/lib/tippy/sprite.d.ts +86 -0
  178. package/dist/lib/tippy/sprite.js +753 -0
  179. package/dist/messages/de.d.ts +12 -0
  180. package/dist/messages/de.js +326 -0
  181. package/dist/styles/expressive.css +60 -26
  182. package/dist/styles/index.css +11 -2
  183. package/dist/styles/material.css +47 -23
  184. package/dist/styles/parts/ai.css +4 -2
  185. package/dist/styles/parts/controls.css +85 -32
  186. package/dist/styles/parts/data.css +33 -5
  187. package/dist/styles/parts/feedback.css +110 -13
  188. package/dist/styles/parts/foundations.css +1 -1
  189. package/dist/styles/parts/navigation.css +230 -5
  190. package/dist/styles/parts/overlays.css +98 -11
  191. package/dist/styles/parts/pdf.css +13 -7
  192. package/dist/styles/tokens.css +28 -4
  193. package/dist/vite.d.ts +0 -50
  194. package/dist/vite.js +0 -100
  195. package/package.json +28 -33
  196. package/dist/components/code-highlight.d.ts +0 -13
  197. package/dist/components/code-highlight.js +0 -107
  198. package/dist/components/whiteboard.d.ts +0 -80
  199. package/dist/components/whiteboard.js +0 -389
  200. package/dist/styles/parts/whiteboard.css +0 -855
@@ -1,18 +1,40 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Form as BaseForm } from "@base-ui/react/form";
4
+ import * as React from "react";
4
5
  import { cn, sx } from "../lib/cn.js";
6
+ import { LibraryErrorsContext } from "../lib/field-errors.js";
5
7
  /**
6
8
  * Form — a native `<form>` that collects `Field` validation and shows server errors.
7
9
  *
8
10
  * Fields stack with 20px between them. Pass `errors` (keyed by each `Field`'s `name`) to show
9
11
  * errors returned by the server, and use `onFormSubmit` to receive the values as an object.
10
12
  * End the form with `FormActions`, which puts the submit button on the right.
13
+ * With React Hook Form or TanStack Form, pass the library's submit handler to `onSubmit` and each
14
+ * field's error to `Field error`: the library validates every submit, the Form lays it out.
11
15
  * The rule people break: validating only on the server — add `required`, `type` and
12
16
  * `pattern` to the controls so people see what is wrong before they submit.
13
17
  */
14
- export function Form({ className, ...props }) {
15
- return (_jsx(BaseForm, { "data-slot": "form", className: sx("flex flex-col gap-5", className), ...props }));
18
+ export function Form({ className, onSubmit, onSubmitCapture, ...props }) {
19
+ /*
20
+ * Base UI stops a submit while a field is marked invalid, before `onSubmit` runs. A field marked
21
+ * by a library (`Field error`) could then stay so: the library never sees the submit that would
22
+ * check it again (React Hook Form checks an error that depends on another field only then). While
23
+ * any field shows such an error, the submit goes to `onSubmit` first, and the library decides.
24
+ */
25
+ const [libraryErrors] = React.useState(() => new Set());
26
+ const handled = React.useRef(false);
27
+ return (_jsx(LibraryErrorsContext.Provider, { value: libraryErrors, children: _jsx(BaseForm, { "data-slot": "form", className: sx("flex flex-col gap-5", className), onSubmitCapture: (event) => {
28
+ onSubmitCapture?.(event);
29
+ handled.current = !!onSubmit && libraryErrors.size > 0;
30
+ if (handled.current)
31
+ onSubmit?.(event);
32
+ }, onSubmit: (event) => {
33
+ if (handled.current)
34
+ handled.current = false;
35
+ else
36
+ onSubmit?.(event);
37
+ }, ...props }) }));
16
38
  }
17
39
  const actionAlign = {
18
40
  /** Actions on the right, the primary last. The default. */
@@ -59,6 +59,45 @@ export interface GraphValue {
59
59
  }
60
60
  /** `flow`: layered along `direction`. `tree`: tiers from the root. `network`: forces. `none`: as positioned. */
61
61
  export type GraphLayout = "flow" | "tree" | "network" | "none";
62
+ export interface GraphMessages {
63
+ /** The text field that renames a node, or a connection. */
64
+ nodeLabel: string;
65
+ edgeLabel: string;
66
+ /** What a new node of each kind is called until it is renamed. */
67
+ newNode: (kind: GraphNodeKind) => string;
68
+ /** A kind of node in the canvas menu's "Add here" list. */
69
+ kind: (kind: GraphNodeKind) => string;
70
+ addHere: string;
71
+ tidy: string;
72
+ fit: string;
73
+ zoomIn: string;
74
+ zoomOut: string;
75
+ addNode: string;
76
+ rename: string;
77
+ delete: string;
78
+ renameLabel: string;
79
+ addLabel: string;
80
+ reverse: string;
81
+ removeConnection: string;
82
+ /** The keys the menu shows beside Rename and Delete. */
83
+ enterKey: string;
84
+ deleteKey: string;
85
+ /** A connection as text, for screen readers: "Review to Ship: approved". */
86
+ connection: (from: string, to: string, directed: boolean) => string;
87
+ /** The controls' toolbar and the minimap. */
88
+ controls: string;
89
+ minimap: string;
90
+ /** What React Flow tells a screen reader on a focused node, edge or handle, and after a move. */
91
+ nodeHelp: string;
92
+ edgeHelp: string;
93
+ handle: string;
94
+ moved: (direction: string, x: number, y: number) => string;
95
+ }
96
+ declare module "./locale" {
97
+ interface Messages {
98
+ graph: GraphMessages;
99
+ }
100
+ }
62
101
  export interface GraphProps extends Omit<React.ComponentProps<"div">, "onChange" | "onSelect" | "children"> {
63
102
  nodes: GraphNode[];
64
103
  edges: GraphEdge[];
@@ -89,6 +128,8 @@ export interface GraphProps extends Omit<React.ComponentProps<"div">, "onChange"
89
128
  background?: "dots" | "lines" | "none";
90
129
  /** `region` (default): a square surface; `card`: the 20px object. */
91
130
  variant?: "region" | "card";
131
+ /** The editor's and the controls' words; a LocaleProvider sets them for every Graph. */
132
+ labels?: Partial<GraphMessages>;
92
133
  }
93
134
  /**
94
135
  * Graph — things and how they connect, on a canvas that pans and zooms: a flow of steps (BPMN
@@ -7,9 +7,64 @@ import { cn } from "../lib/cn.js";
7
7
  import { cssDuration } from "../lib/motion.js";
8
8
  import { LANE_HEADER, lanes, layered, network, dragSimulation, } from "../lib/graph-layout.js";
9
9
  import { Avatar } from "./avatar.js";
10
+ import { useMessages } from "./locale.js";
10
11
  import { ContextMenu, ContextMenuContent, ContextMenuGroup, ContextMenuGroupLabel, ContextMenuItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, } from "./context-menu.js";
11
12
  import { Toolbar, ToolbarButton, ToolbarGroup, ToolbarSeparator } from "./toolbar.js";
12
13
  import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
14
+ /** Networks of up to this many nodes settle live around a dragged node. */
15
+ const LIVE_DRAG_MAX = 300;
16
+ /** One d3-force tick: the simulation is tuned for one per frame at 60Hz. */
17
+ const TICK_MS = 1000 / 60;
18
+ const newNodes = {
19
+ task: "New step",
20
+ start: "Start",
21
+ end: "End",
22
+ event: "Event",
23
+ gateway: "Decide?",
24
+ note: "A note",
25
+ person: "New person",
26
+ entity: "New node",
27
+ group: "Group",
28
+ };
29
+ const kindNames = {
30
+ task: "Step",
31
+ start: "Start",
32
+ end: "End",
33
+ event: "Event",
34
+ gateway: "Decision",
35
+ note: "Note",
36
+ person: "Person",
37
+ entity: "Node",
38
+ group: "Group",
39
+ };
40
+ const defaultMessages = {
41
+ nodeLabel: "Node label",
42
+ edgeLabel: "Edge label",
43
+ newNode: (kind) => newNodes[kind],
44
+ kind: (kind) => kindNames[kind],
45
+ addHere: "Add here",
46
+ tidy: "Tidy up",
47
+ fit: "Fit to view",
48
+ zoomIn: "Zoom in",
49
+ zoomOut: "Zoom out",
50
+ addNode: "Add a node",
51
+ rename: "Rename",
52
+ delete: "Delete",
53
+ renameLabel: "Rename label",
54
+ addLabel: "Add a label",
55
+ reverse: "Reverse direction",
56
+ removeConnection: "Remove connection",
57
+ enterKey: "Enter",
58
+ deleteKey: "Del",
59
+ connection: (from, to, directed) => `${from} ${directed ? "to" : "and"} ${to}`,
60
+ controls: "Graph",
61
+ minimap: "Map of the graph",
62
+ // React Flow's own words.
63
+ nodeHelp: "Press enter or space to select a node. Press delete to remove it and escape to cancel.",
64
+ edgeHelp: "Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.",
65
+ handle: "Handle",
66
+ moved: (direction, x, y) => `Moved selected node ${direction}. New position, x: ${x}, y: ${y}`,
67
+ };
13
68
  const GraphContext = React.createContext(null);
14
69
  const useGraph = () => React.useContext(GraphContext);
15
70
  const clamp = (v, min, max) => Math.min(max, Math.max(min, v));
@@ -169,7 +224,7 @@ function Handles() {
169
224
  }
170
225
  /** A label that turns into a field while it is being renamed. */
171
226
  function Label({ kind, id, value, className, }) {
172
- const { editing, setEditing, rename } = useGraph();
227
+ const { editing, setEditing, rename, text } = useGraph();
173
228
  const active = editing?.kind === kind && editing.id === id;
174
229
  const [draft, setDraft] = React.useState(value);
175
230
  React.useEffect(() => setDraft(value), [value, active]);
@@ -182,7 +237,7 @@ function Label({ kind, id, value, className, }) {
182
237
  };
183
238
  return (_jsx("input", {
184
239
  // nodrag / nopan: typing and selecting text never moves the canvas.
185
- className: cn("nodrag nopan min-w-0 border-0 bg-transparent p-0 text-inherit outline-none", className), "aria-label": kind === "node" ? "Node label" : "Edge label", autoFocus: true, value: draft, size: Math.max(4, draft.length), onChange: (event) => setDraft(event.currentTarget.value), onFocus: (event) => event.currentTarget.select(), onBlur: () => done(true), onKeyDown: (event) => {
240
+ className: cn("nodrag nopan min-w-0 border-0 bg-transparent p-0 text-inherit outline-none", className), "aria-label": kind === "node" ? text.nodeLabel : text.edgeLabel, autoFocus: true, value: draft, size: Math.max(4, draft.length), onChange: (event) => setDraft(event.currentTarget.value), onFocus: (event) => event.currentTarget.select(), onBlur: () => done(true), onKeyDown: (event) => {
186
241
  event.stopPropagation();
187
242
  if (event.key === "Enter")
188
243
  done(true);
@@ -352,42 +407,12 @@ function EdgeView(props) {
352
407
  return (_jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, path: path, markerEnd: marker, interactionWidth: 18, "data-kind": kind, className: "zon-graph-edge", "data-dim": data?.dim ? "" : undefined,
353
408
  "data-lit": data?.lit || props.selected ? "" : undefined }), (edge.label || (editing?.kind === "edge" && editing.id === id)) && (_jsx(EdgeLabelRenderer, { children: _jsx("div", { "data-slot": "graph-edge-label", "data-edge": id, "data-dim": data?.dim ? "" : undefined, "data-lit": data?.lit || props.selected ? "" : undefined, className: "nodrag nopan pointer-events-auto absolute", style: { transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` }, children: _jsx(Label, { kind: "edge", id: id, value: edge.label ?? "" }) }) }))] }));
354
409
  }
355
- /** What a new node of each kind is called until it is renamed. */
356
- const fresh = {
357
- task: "New step",
358
- start: "Start",
359
- end: "End",
360
- event: "Event",
361
- gateway: "Decide?",
362
- note: "A note",
363
- person: "New person",
364
- entity: "New node",
365
- group: "Group",
366
- };
367
410
  /** What the canvas menu offers to add, by layout. */
368
411
  const addable = {
369
- flow: [
370
- { kind: "task", label: "Step" },
371
- { kind: "gateway", label: "Decision" },
372
- { kind: "event", label: "Event" },
373
- { kind: "start", label: "Start" },
374
- { kind: "end", label: "End" },
375
- { kind: "note", label: "Note" },
376
- ],
377
- tree: [
378
- { kind: "person", label: "Person" },
379
- { kind: "task", label: "Step" },
380
- ],
381
- network: [
382
- { kind: "entity", label: "Node" },
383
- { kind: "person", label: "Person" },
384
- ],
385
- none: [
386
- { kind: "task", label: "Step" },
387
- { kind: "entity", label: "Node" },
388
- { kind: "person", label: "Person" },
389
- { kind: "note", label: "Note" },
390
- ],
412
+ flow: ["task", "gateway", "event", "start", "end", "note"],
413
+ tree: ["person", "task"],
414
+ network: ["entity", "person"],
415
+ none: ["task", "entity", "person", "note"],
391
416
  };
392
417
  const nodeTypes = { zon: NodeView, "zon-group": GroupView };
393
418
  const edgeTypes = { zon: EdgeView };
@@ -406,7 +431,17 @@ const edgeTypes = { zon: EdgeView };
406
431
  export function Graph(props) {
407
432
  return (_jsx(ReactFlowProvider, { children: _jsx(GraphCanvas, { ...props }) }));
408
433
  }
409
- function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", direction: directionProp, editable = false, onChange, onSelect, newNodeKind, minimap = false, controls = true, background = "dots", variant = "region", className, ...props }) {
434
+ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", direction: directionProp, editable = false, onChange, onSelect, newNodeKind, minimap = false, controls = true, background = "dots", variant = "region", labels, className, ...props }) {
435
+ const text = useMessages("graph", defaultMessages, labels);
436
+ const textRef = React.useRef(text);
437
+ textRef.current = text;
438
+ const ariaLabelConfig = React.useMemo(() => ({
439
+ "node.a11yDescription.default": text.nodeHelp,
440
+ "edge.a11yDescription.default": text.edgeHelp,
441
+ "node.a11yDescription.ariaLiveMessage": ({ direction, x, y, }) => text.moved(direction, x, y),
442
+ "handle.ariaLabel": text.handle,
443
+ "minimap.ariaLabel": text.minimap,
444
+ }), [text]);
410
445
  const direction = directionProp ?? (layout === "tree" ? "down" : "right");
411
446
  const flow = useReactFlow();
412
447
  const markers = React.useId().replace(/[^a-zA-Z0-9]/g, "");
@@ -534,7 +569,11 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
534
569
  const addNode = React.useCallback((at, as) => {
535
570
  const s = latest.current;
536
571
  const kind = as ?? newNodeKind ?? (layout === "network" ? "entity" : "task");
537
- const node = { id: `n${Date.now().toString(36)}`, label: fresh[kind], kind };
572
+ const node = {
573
+ id: `n${Date.now().toString(36)}`,
574
+ label: textRef.current.newNode(kind),
575
+ kind,
576
+ };
538
577
  const size = sizeOf(node, layout);
539
578
  // Without a point, the middle of what is in view.
540
579
  const box = frame.current?.getBoundingClientRect();
@@ -572,9 +611,10 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
572
611
  const value = toValue(from.nodes, from.edges);
573
612
  const next = build({ nodes: value.nodes.map(({ position: _p, size: _s, ...n }) => n), edges: value.edges }, layout, direction);
574
613
  const el = frame.current;
575
- const duration = el ? cssDuration(el) * 3 : 0;
614
+ // Twice --duration: a move the interface makes on its own, ended within 300ms.
615
+ const duration = el ? cssDuration(el) * 2 : 0;
576
616
  // Without motion (reduced motion) the camera jumps too.
577
- const fit = () => requestAnimationFrame(() => void flow.fitView({ padding: 0.18, maxZoom: 1.15, duration: duration ? 280 : 0 }));
617
+ const fit = () => requestAnimationFrame(() => void flow.fitView({ padding: 0.18, maxZoom: 1.15, duration }));
578
618
  if (!el || !duration) {
579
619
  setState(next);
580
620
  emit(next);
@@ -588,7 +628,8 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
588
628
  const camera1 = pane
589
629
  ? getViewportForBounds(boxAround(next.nodes.filter((n) => !n.parentId)), pane.clientWidth, pane.clientHeight, 0.2, 1.15, 0.18)
590
630
  : null;
591
- const ease = getComputedStyle(el).getPropertyValue("--ease").trim() || "ease-out";
631
+ // The interface moves the nodes from A to B on its own: ease in and out.
632
+ const ease = getComputedStyle(el).getPropertyValue("--ease-move").trim() || "ease-in-out";
592
633
  // No keyframes: the animation only keeps the clock; its progress places the nodes.
593
634
  const clock = el.animate([], { duration, easing: ease });
594
635
  let raf = 0;
@@ -641,7 +682,9 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
641
682
  const reduce = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
642
683
  const onNodeDragStart = React.useCallback((_, node) => {
643
684
  tidying.current?.stop();
644
- if (layout !== "network" || reduce())
685
+ // A network of hundreds of nodes moves only the node dragged: settling it live would take
686
+ // longer than a frame at every frame.
687
+ if (layout !== "network" || reduce() || latest.current.nodes.length > LIVE_DRAG_MAX)
645
688
  return;
646
689
  // A drag that starts while the last one settles takes over from it: one simulation at a time.
647
690
  physics.current?.stop();
@@ -660,8 +703,21 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
660
703
  const sizes = new Map(s.nodes.map((n) => [n.id, { w: n.width ?? 0, h: n.height ?? 0 }]));
661
704
  const byId = new Map(sim.map((d) => [d.id, d]));
662
705
  const held = new Set([node.id]);
663
- const step = () => {
664
- simulation.tick();
706
+ // d3-force is tuned for one tick per 60Hz frame: tick by the time that has passed, so a
707
+ // 120Hz screen does not settle twice as fast and a dropped frame does not stall it.
708
+ let last = 0;
709
+ let owed = 0;
710
+ const step = (now) => {
711
+ owed += last ? Math.min(now - last, 50) / TICK_MS : 1;
712
+ last = now;
713
+ // One to three ticks a frame; time beyond that (a long stall) is dropped, not caught up.
714
+ const ticks = Math.min(3, Math.floor(owed));
715
+ owed = ticks === 3 ? 0 : owed - ticks;
716
+ if (!ticks) {
717
+ frame = requestAnimationFrame(step);
718
+ return;
719
+ }
720
+ simulation.tick(ticks);
665
721
  setState((prev) => {
666
722
  const next = {
667
723
  ...prev,
@@ -721,7 +777,7 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
721
777
  setSelected(nodes.filter((n) => n.type !== "zon-group").map((n) => n.id));
722
778
  onSelect?.({ nodes: nodes.map((n) => n.id), edges: edges.map((e) => e.id) });
723
779
  }, [onSelect]);
724
- const context = React.useMemo(() => ({ layout, direction, editable, markers, editing, setEditing, rename }), [layout, direction, editable, markers, editing, rename]);
780
+ const context = React.useMemo(() => ({ text, layout, direction, editable, markers, editing, setEditing, rename }), [text, layout, direction, editable, markers, editing, rename]);
725
781
  /* The context menu: what was right-clicked. */
726
782
  const [target, setTarget] = React.useState(null);
727
783
  const pick = (event) => {
@@ -766,8 +822,8 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
766
822
  };
767
823
  const targetEdge = target?.type === "edge" ? state.edges.find((e) => e.id === target.id) : undefined;
768
824
  const stepped = layout === "flow" || layout === "tree";
769
- const labels = React.useMemo(() => new Map(state.nodes.map((n) => [n.id, n.data.node.label])), [state.nodes]);
770
- const canvas = (_jsxs(ReactFlow, { nodes: shown.nodes, edges: shown.edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: editable ? onConnect : undefined, onConnectEnd: editable ? onConnectEnd : undefined, onNodeMouseEnter: (_, n) => n.type !== "zon-group" && setHovered(n.id), onNodeMouseLeave: () => setHovered(null), onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionChange: onSelectionChange, nodesConnectable: editable, edgesReconnectable: false, deleteKeyCode: editable ? ["Backspace", "Delete"] : null, connectionLineType: stepped ? ConnectionLineType.SmoothStep : ConnectionLineType.Straight, fitView: true, fitViewOptions: { padding: 0.18, maxZoom: 1.15 }, minZoom: 0.2, maxZoom: 2, proOptions: { hideAttribution: true }, "aria-describedby": describedBy, children: [background !== "none" && (_jsx(Background, { variant: background === "lines" ? BackgroundVariant.Lines : BackgroundVariant.Dots, gap: background === "lines" ? 32 : 20, size: 1 })), minimap && (_jsx(MiniMap, { position: "bottom-right", style: { width: 152, height: 100 }, pannable: true, zoomable: true, nodeBorderRadius: 4, ariaLabel: "Map of the graph" })), controls && (_jsx(Panel, { position: "bottom-left", children: _jsx(GraphControls, { editable: editable, tidy: layout === "none" ? undefined : tidy, add: () => addNode() }) }))] }));
825
+ const nodeLabels = React.useMemo(() => new Map(state.nodes.map((n) => [n.id, n.data.node.label])), [state.nodes]);
826
+ const canvas = (_jsxs(ReactFlow, { nodes: shown.nodes, edges: shown.edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: editable ? onConnect : undefined, onConnectEnd: editable ? onConnectEnd : undefined, onNodeMouseEnter: (_, n) => n.type !== "zon-group" && setHovered(n.id), onNodeMouseLeave: () => setHovered(null), onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionChange: onSelectionChange, nodesConnectable: editable, edgesReconnectable: false, deleteKeyCode: editable ? ["Backspace", "Delete"] : null, connectionLineType: stepped ? ConnectionLineType.SmoothStep : ConnectionLineType.Straight, fitView: true, fitViewOptions: { padding: 0.18, maxZoom: 1.15 }, minZoom: 0.2, maxZoom: 2, proOptions: { hideAttribution: true }, ariaLabelConfig: ariaLabelConfig, "aria-describedby": describedBy, children: [background !== "none" && (_jsx(Background, { variant: background === "lines" ? BackgroundVariant.Lines : BackgroundVariant.Dots, gap: background === "lines" ? 32 : 20, size: 1 })), minimap && (_jsx(MiniMap, { position: "bottom-right", style: { width: 152, height: 100 }, pannable: true, zoomable: true, nodeBorderRadius: 4, ariaLabel: text.minimap })), controls && (_jsx(Panel, { position: "bottom-left", children: _jsx(GraphControls, { text: text, editable: editable, tidy: layout === "none" ? undefined : tidy, add: () => addNode() }) }))] }));
771
827
  return (_jsx(GraphContext.Provider, { value: context, children: _jsxs("div", { ref: frame, "data-slot": "graph", "data-layout": layout, "data-editable": editable ? "" : undefined, className: cn("relative h-[min(40rem,80svh)] w-full overflow-hidden", variant === "card" ? "surface-card [--card-padding:0]" : "surface-container", className), onKeyDown: (event) => {
772
828
  // Editable: Enter on a focused node opens its label.
773
829
  const node = event.target.closest(".react-flow__node");
@@ -775,12 +831,12 @@ function GraphCanvas({ nodes: nodesProp, edges: edgesProp, layout = "flow", dire
775
831
  return;
776
832
  event.preventDefault();
777
833
  setEditing({ kind: "node", id: node.dataset.id });
778
- }, ...props, children: [_jsx("svg", { "aria-hidden": true, className: "absolute size-0", children: _jsx("defs", { children: ["rest", "lit"].map((tone) => (_jsx("marker", { id: `${markers}-${tone}`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "7", markerHeight: "7", orient: "auto-start-reverse", children: _jsx("path", { d: "M1 1.5 L9 5 L1 8.5 Z", "data-tone": tone, className: "zon-graph-arrow" }) }, tone))) }) }), editable ? (_jsxs(ContextMenu, { children: [_jsx(ContextMenuTrigger, { className: "absolute inset-0", onContextMenuCapture: pick, children: canvas }), _jsxs(ContextMenuContent, { children: [target?.type === "pane" && (_jsxs(_Fragment, { children: [_jsxs(ContextMenuGroup, { children: [_jsx(ContextMenuGroupLabel, { children: "Add here" }), addable[layout].map((a) => (_jsxs(ContextMenuItem, { onClick: () => addNode(target.at, a.kind), children: [_jsx(PlusIcon, {}), a.label] }, a.kind)))] }), _jsx(ContextMenuSeparator, {}), layout !== "none" && (_jsxs(ContextMenuItem, { onClick: tidy, children: [_jsx(WandSparklesIcon, {}), "Tidy up"] })), _jsxs(ContextMenuItem, { onClick: () => void flow.fitView({ padding: 0.18, maxZoom: 1.15, duration: 280 }), children: [_jsx(MaximizeIcon, {}), "Fit to view"] })] })), (target?.type === "node" || target?.type === "group") && (_jsxs(_Fragment, { children: [_jsxs(ContextMenuItem, { onClick: () => setEditing({ kind: "node", id: target.id }), children: [_jsx(PencilIcon, {}), "Rename", _jsx(ContextMenuShortcut, { children: "Enter" })] }), target.type === "node" && (_jsxs(_Fragment, { children: [_jsx(ContextMenuSeparator, {}), _jsxs(ContextMenuItem, { variant: "destructive", onClick: () => removeNode(target.id), children: [_jsx(Trash2Icon, {}), "Delete", _jsx(ContextMenuShortcut, { children: "Del" })] })] }))] })), target?.type === "edge" && (_jsxs(_Fragment, { children: [_jsxs(ContextMenuItem, { onClick: () => setEditing({ kind: "edge", id: target.id }), children: [_jsx(PencilIcon, {}), targetEdge?.data?.edge.label ? "Rename label" : "Add a label"] }), targetEdge && isDirected(targetEdge.data.edge, layout) && (_jsxs(ContextMenuItem, { onClick: () => reverse(target.id), children: [_jsx(ArrowLeftRightIcon, {}), "Reverse direction"] })), _jsx(ContextMenuSeparator, {}), _jsxs(ContextMenuItem, { variant: "destructive", onClick: () => removeEdge(target.id), children: [_jsx(Trash2Icon, {}), "Remove connection", _jsx(ContextMenuShortcut, { children: "Del" })] })] }))] })] })) : (canvas), _jsx("ul", { id: describedBy, className: "sr-only", children: state.edges.map((e) => (_jsxs("li", { children: [labels.get(e.source), " ", isDirected(e.data.edge, layout) ? "to" : "and", " ", labels.get(e.target), e.data.edge.label ? `: ${e.data.edge.label}` : ""] }, e.id))) })] }) }));
834
+ }, ...props, children: [_jsx("svg", { "aria-hidden": true, className: "absolute size-0", children: _jsx("defs", { children: ["rest", "lit"].map((tone) => (_jsx("marker", { id: `${markers}-${tone}`, viewBox: "0 0 10 10", refX: "9", refY: "5", markerWidth: "7", markerHeight: "7", orient: "auto-start-reverse", children: _jsx("path", { d: "M1 1.5 L9 5 L1 8.5 Z", "data-tone": tone, className: "zon-graph-arrow" }) }, tone))) }) }), editable ? (_jsxs(ContextMenu, { children: [_jsx(ContextMenuTrigger, { className: "absolute inset-0", onContextMenuCapture: pick, children: canvas }), _jsxs(ContextMenuContent, { children: [target?.type === "pane" && (_jsxs(_Fragment, { children: [_jsxs(ContextMenuGroup, { children: [_jsx(ContextMenuGroupLabel, { children: text.addHere }), addable[layout].map((kind) => (_jsxs(ContextMenuItem, { onClick: () => addNode(target.at, kind), children: [_jsx(PlusIcon, {}), text.kind(kind)] }, kind)))] }), _jsx(ContextMenuSeparator, {}), layout !== "none" && (_jsxs(ContextMenuItem, { onClick: tidy, children: [_jsx(WandSparklesIcon, {}), text.tidy] })), _jsxs(ContextMenuItem, { onClick: () => void flow.fitView({ padding: 0.18, maxZoom: 1.15, duration: cssDuration() * 2 }), children: [_jsx(MaximizeIcon, {}), text.fit] })] })), (target?.type === "node" || target?.type === "group") && (_jsxs(_Fragment, { children: [_jsxs(ContextMenuItem, { onClick: () => setEditing({ kind: "node", id: target.id }), children: [_jsx(PencilIcon, {}), text.rename, _jsx(ContextMenuShortcut, { children: text.enterKey })] }), target.type === "node" && (_jsxs(_Fragment, { children: [_jsx(ContextMenuSeparator, {}), _jsxs(ContextMenuItem, { variant: "destructive", onClick: () => removeNode(target.id), children: [_jsx(Trash2Icon, {}), text.delete, _jsx(ContextMenuShortcut, { children: text.deleteKey })] })] }))] })), target?.type === "edge" && (_jsxs(_Fragment, { children: [_jsxs(ContextMenuItem, { onClick: () => setEditing({ kind: "edge", id: target.id }), children: [_jsx(PencilIcon, {}), targetEdge?.data?.edge.label ? text.renameLabel : text.addLabel] }), targetEdge && isDirected(targetEdge.data.edge, layout) && (_jsxs(ContextMenuItem, { onClick: () => reverse(target.id), children: [_jsx(ArrowLeftRightIcon, {}), text.reverse] })), _jsx(ContextMenuSeparator, {}), _jsxs(ContextMenuItem, { variant: "destructive", onClick: () => removeEdge(target.id), children: [_jsx(Trash2Icon, {}), text.removeConnection, _jsx(ContextMenuShortcut, { children: text.deleteKey })] })] }))] })] })) : (canvas), _jsx("ul", { id: describedBy, className: "sr-only", children: state.edges.map((e) => (_jsxs("li", { children: [text.connection(nodeLabels.get(e.source) ?? e.source, nodeLabels.get(e.target) ?? e.target, isDirected(e.data.edge, layout)), e.data.edge.label ? `: ${e.data.edge.label}` : ""] }, e.id))) })] }) }));
779
835
  }
780
836
  function ControlButton({ label, onClick, children, }) {
781
837
  return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(ToolbarButton, { "aria-label": label, onClick: onClick }), children: children }), _jsx(TooltipContent, { side: "top", children: label })] }));
782
838
  }
783
- function GraphControls({ editable, tidy, add }) {
839
+ function GraphControls({ text, editable, tidy, add, }) {
784
840
  const flow = useReactFlow();
785
- return (_jsxs(Toolbar, { "aria-label": "Graph", "data-slot": "graph-controls", children: [_jsxs(ToolbarGroup, { children: [_jsx(ControlButton, { label: "Zoom in", onClick: () => void flow.zoomIn({ duration: 200 }), children: _jsx(PlusIcon, {}) }), _jsx(ControlButton, { label: "Zoom out", onClick: () => void flow.zoomOut({ duration: 200 }), children: _jsx(MinusIcon, {}) }), _jsx(ControlButton, { label: "Fit to view", onClick: () => void flow.fitView({ padding: 0.18, maxZoom: 1.15, duration: 280 }), children: _jsx(MaximizeIcon, {}) })] }), (editable || tidy) && _jsx(ToolbarSeparator, {}), _jsxs(ToolbarGroup, { children: [editable && (_jsx(ControlButton, { label: "Add a node", onClick: add, children: _jsx(CircleDotIcon, {}) })), tidy && (_jsx(ControlButton, { label: "Tidy up", onClick: tidy, children: _jsx(WandSparklesIcon, {}) }))] })] }));
841
+ return (_jsxs(Toolbar, { "aria-label": text.controls, "data-slot": "graph-controls", children: [_jsxs(ToolbarGroup, { children: [_jsx(ControlButton, { label: text.zoomIn, onClick: () => void flow.zoomIn({ duration: cssDuration() * 2 }), children: _jsx(PlusIcon, {}) }), _jsx(ControlButton, { label: text.zoomOut, onClick: () => void flow.zoomOut({ duration: cssDuration() * 2 }), children: _jsx(MinusIcon, {}) }), _jsx(ControlButton, { label: text.fit, onClick: () => void flow.fitView({ padding: 0.18, maxZoom: 1.15, duration: cssDuration() * 2 }), children: _jsx(MaximizeIcon, {}) })] }), (editable || tidy) && _jsx(ToolbarSeparator, {}), _jsxs(ToolbarGroup, { children: [editable && (_jsx(ControlButton, { label: text.addNode, onClick: add, children: _jsx(CircleDotIcon, {}) })), tidy && (_jsx(ControlButton, { label: text.tidy, onClick: tidy, children: _jsx(WandSparklesIcon, {}) }))] })] }));
786
842
  }
@@ -114,20 +114,67 @@ function EditorialImage({ entry, priority, title, className, style, }) {
114
114
  function CornerMark({ className }) {
115
115
  return (_jsx("svg", { "aria-hidden": true, focusable: "false", viewBox: "0 0 13 13", className: cn("pointer-events-none absolute z-3 size-[13px] text-(--sheet-mark)", className), children: _jsx("path", { d: "M6.5 0v13M0 6.5h13", stroke: "currentColor", strokeWidth: "1", shapeRendering: "crispEdges" }) }));
116
116
  }
117
+ const sheetLights = new WeakMap();
118
+ /**
119
+ * One frame of a sheet's light: read the pointer against the sheet once, however many moves came
120
+ * in, and close most of the way to it by the time since the last frame — the same at any refresh
121
+ * rate. It eases after the pointer like a light, rather than sticking to it like a cursor, and
122
+ * stops once it is there.
123
+ */
124
+ function stepLight(el, now) {
125
+ const l = sheetLights.get(el);
126
+ if (!l)
127
+ return;
128
+ const rect = el.getBoundingClientRect();
129
+ const tx = rect.width ? ((l.cx - rect.left) / rect.width) * 100 : 0;
130
+ const ty = rect.height ? ((l.cy - rect.top) / rect.height) * 100 : 0;
131
+ if (!l.placed) {
132
+ l.placed = true;
133
+ l.x = tx;
134
+ l.y = ty;
135
+ }
136
+ const dt = l.last ? Math.min(64, now - l.last) : 16;
137
+ l.last = now;
138
+ const k = 1 - Math.exp(-dt / 70);
139
+ l.x += (tx - l.x) * k;
140
+ l.y += (ty - l.y) * k;
141
+ const done = Math.abs(tx - l.x) < 0.05 && Math.abs(ty - l.y) < 0.05;
142
+ if (done) {
143
+ l.x = tx;
144
+ l.y = ty;
145
+ }
146
+ el.style.setProperty("--lx", `${l.x.toFixed(2)}%`);
147
+ el.style.setProperty("--ly", `${l.y.toFixed(2)}%`);
148
+ if (done) {
149
+ l.frame = 0;
150
+ l.last = 0;
151
+ }
152
+ else
153
+ l.frame = requestAnimationFrame((t) => stepLight(el, t));
154
+ }
117
155
  function setLight(event, lit) {
118
156
  const el = event.currentTarget;
119
157
  if (event.pointerType !== "mouse" && event.pointerType !== "pen")
120
158
  return;
121
159
  if (window.matchMedia("(prefers-reduced-motion: reduce)").matches)
122
160
  return;
161
+ let l = sheetLights.get(el);
162
+ if (!l)
163
+ sheetLights.set(el, (l = { x: 0, y: 0, cx: 0, cy: 0, last: 0, frame: 0, placed: false }));
123
164
  if (!lit) {
165
+ // The light fades out where it is; the next entry places it afresh.
166
+ cancelAnimationFrame(l.frame);
167
+ l.frame = 0;
168
+ l.last = 0;
169
+ l.placed = false;
124
170
  el.dataset.lit = "false";
125
171
  return;
126
172
  }
127
- const rect = el.getBoundingClientRect();
128
- el.style.setProperty("--lx", `${(((event.clientX - rect.left) / rect.width) * 100).toFixed(2)}%`);
129
- el.style.setProperty("--ly", `${(((event.clientY - rect.top) / rect.height) * 100).toFixed(2)}%`);
173
+ l.cx = event.clientX;
174
+ l.cy = event.clientY;
130
175
  el.dataset.lit = "true";
176
+ if (!l.frame)
177
+ l.frame = requestAnimationFrame((t) => stepLight(el, t));
131
178
  }
132
179
  /**
133
180
  * SpecSheet — the frame of the `sheet/…` entries, for your own sheets and walls: a square-cornered
@@ -150,7 +197,7 @@ export function SpecSheet({ tone = "night", index, eyebrow, titleBlock, marks =
150
197
  onPointerLeave?.(event);
151
198
  }, ...props, children: [hasCaption ? (_jsxs("figcaption", { "data-slot": "spec-sheet-caption", className: cn("absolute inset-x-0 top-0 z-3 flex items-start justify-between gap-4 pt-3.5 font-mono text-[10px] leading-[1.4] tracking-[0.14em] text-(--sheet-caption) uppercase sm:pt-4",
152
199
  // Clear the corner crosshairs when they are shown.
153
- marks ? "px-9" : "px-4 sm:px-5"), children: [_jsx("span", { "data-slot": "spec-sheet-index", className: "tabular-nums", children: index }), eyebrow != null ? (_jsx("span", { "data-slot": "spec-sheet-eyebrow", className: "text-right", children: eyebrow })) : null] })) : null, _jsx("div", { "data-slot": "spec-sheet-drawing", className: cn("absolute inset-0 z-1 grid grid-cols-[minmax(0,1fr)] grid-rows-[minmax(0,1fr)] place-items-center p-[max(2.75rem,9%)]", drawingClassName), children: children }), showGrain ? _jsx("div", { "aria-hidden": true, "data-still": "", className: "grain z-2" }) : null, lit ? _jsx("div", { "aria-hidden": true, "data-slot": "spec-sheet-light" }) : null, marks ? (_jsxs(_Fragment, { children: [_jsx(CornerMark, { className: "top-2.5 left-2.5" }), _jsx(CornerMark, { className: "top-2.5 right-2.5" }), _jsx(CornerMark, { className: "bottom-2.5 left-2.5" }), _jsx(CornerMark, { className: "right-2.5 bottom-2.5" })] })) : null, titleBlock?.length ? (_jsx("dl", { "data-slot": "spec-sheet-title-block", className: cn("absolute z-3 m-0 grid grid-cols-2 border-t border-l border-(--sheet-rule) font-mono leading-none", marks ? "right-7 bottom-7" : "right-3 bottom-3 sm:right-4 sm:bottom-4"), children: titleBlock.map((entry, i) => (_jsxs("div", { className: "flex min-w-[64px] flex-col gap-1 border-r border-b border-(--sheet-rule) px-2 py-1.5 last:odd:col-span-2", children: [_jsx("dt", { className: "text-[9px] tracking-[0.14em] text-(--sheet-caption) uppercase", children: entry.label }), _jsx("dd", { className: "m-0 text-[10px] text-foreground tabular-nums", children: entry.value })] }, i))) })) : null] }));
200
+ marks ? "px-9" : "px-4 sm:px-5"), children: [_jsx("span", { "data-slot": "spec-sheet-index", className: "tabular-nums", children: index }), eyebrow != null ? (_jsx("span", { "data-slot": "spec-sheet-eyebrow", className: "text-end", children: eyebrow })) : null] })) : null, _jsx("div", { "data-slot": "spec-sheet-drawing", className: cn("absolute inset-0 z-1 grid grid-cols-[minmax(0,1fr)] grid-rows-[minmax(0,1fr)] place-items-center p-[max(2.75rem,9%)]", drawingClassName), children: children }), showGrain ? _jsx("div", { "aria-hidden": true, "data-still": "", className: "grain z-2" }) : null, lit ? _jsx("div", { "aria-hidden": true, "data-slot": "spec-sheet-light" }) : null, marks ? (_jsxs(_Fragment, { children: [_jsx(CornerMark, { className: "top-2.5 left-2.5" }), _jsx(CornerMark, { className: "top-2.5 right-2.5" }), _jsx(CornerMark, { className: "bottom-2.5 left-2.5" }), _jsx(CornerMark, { className: "right-2.5 bottom-2.5" })] })) : null, titleBlock?.length ? (_jsx("dl", { "data-slot": "spec-sheet-title-block", className: cn("absolute z-3 m-0 grid grid-cols-2 border-t border-l border-(--sheet-rule) font-mono leading-none", marks ? "right-7 bottom-7" : "right-3 bottom-3 sm:right-4 sm:bottom-4"), children: titleBlock.map((entry, i) => (_jsxs("div", { className: "flex min-w-[64px] flex-col gap-1 border-r border-b border-(--sheet-rule) px-2 py-1.5 last:odd:col-span-2", children: [_jsx("dt", { className: "text-[9px] tracking-[0.14em] text-(--sheet-caption) uppercase", children: entry.label }), _jsx("dd", { className: "m-0 text-[10px] text-foreground tabular-nums", children: entry.value })] }, i))) })) : null] }));
154
201
  }
155
202
  /**
156
203
  * SpecSheetGrid — the light-table wall: a 12-column bento of `SpecSheet` tiles with square
@@ -2,8 +2,19 @@ import { Button as BaseButton } from "@base-ui/react/button";
2
2
  import { Field as BaseField } from "@base-ui/react/field";
3
3
  import { Input as BaseInput } from "@base-ui/react/input";
4
4
  import * as React from "react";
5
+ export interface InputGroupMessages {
6
+ /** InputGroupPasswordToggle's name, whether the password is shown or not. */
7
+ showPassword: string;
8
+ /** InputGroupClearButton's name. */
9
+ clear: string;
10
+ }
11
+ declare module "./locale" {
12
+ interface Messages {
13
+ inputGroup: InputGroupMessages;
14
+ }
15
+ }
5
16
  declare const groupSizes: {
6
- readonly sm: "min-h-(--control-h-sm) text-[13px]";
17
+ readonly sm: "min-h-(--control-h-sm) text-[13px] pointer-coarse:text-base";
7
18
  readonly default: "min-h-(--control-h) text-base sm:text-[15px]";
8
19
  };
9
20
  export interface InputGroupProps extends React.ComponentProps<"div"> {
@@ -64,10 +75,10 @@ declare const buttonVariants: {
64
75
  };
65
76
  declare const buttonSizes: {
66
77
  /** 24px — fits the dense group, or a quiet action in the default one. */
67
- readonly sm: "min-h-(--control-inset-sm) gap-1 rounded-(--input-group-button-radius) px-2 text-xs";
78
+ readonly sm: "min-h-(--control-inset-sm) gap-1 rounded-(--input-group-button-radius) px-2 text-xs leading-none";
68
79
  /** 30px — fits the 38px group with a 3px inset, like a segment. */
69
- readonly default: "min-h-(--control-inset) gap-1.5 rounded-(--input-group-button-radius) px-2.5 text-[13px]";
70
- readonly "icon-sm": "size-(--control-inset-sm) rounded-full p-0 [&_svg:not([class*='size-'])]:size-3.5";
80
+ readonly default: "min-h-(--control-inset) gap-1.5 rounded-(--input-group-button-radius) px-2.5 text-[13px] leading-none";
81
+ readonly "icon-sm": "size-(--control-inset-sm) rounded-full p-0 [&_svg:not([class*='size-'])]:size-[min(14px,calc(var(--control-inset-sm)-4px))]";
71
82
  readonly icon: "size-(--control-inset) rounded-full p-0";
72
83
  };
73
84
  export interface InputGroupButtonProps extends BaseButton.Props {
@@ -90,7 +101,7 @@ export interface InputGroupPasswordToggleProps extends Omit<InputGroupButtonProp
90
101
  onVisibleChange: (visible: boolean) => void;
91
102
  /**
92
103
  * The button's name, the same whether the password is shown or not: `aria-pressed` says which.
93
- * Default "Show password".
104
+ * Default "Show password", or `messages.inputGroup.showPassword` from a LocaleProvider.
94
105
  */
95
106
  label?: string;
96
107
  /** @deprecated A toggle keeps one name: use `label`. Only `show` is read, as that name. */
@@ -114,14 +125,14 @@ export interface InputGroupClearButtonProps extends Omit<InputGroupButtonProps,
114
125
  * its change event, for an uncontrolled input.
115
126
  */
116
127
  onClear?: () => void;
117
- /** The button's name. Default "Clear". Say what it clears: "Clear search". */
128
+ /** The button's name. Default "Clear" (`messages.inputGroup.clear`). Say what it clears: "Clear search". */
118
129
  label?: string;
119
130
  }
120
131
  /**
121
132
  * InputGroupClearButton — empties the field it sits in, smoothly: the text is erased right to
122
133
  * left behind a soft edge, as if typed away, then the value clears and focus returns to the
123
134
  * field. The button fades out while the field is empty and back in when there is text, instead of
124
- * popping in and out. Reduced motion clears at once.
135
+ * popping in and out. The keyboard (Enter, Space) and reduced motion clear at once.
125
136
  */
126
137
  export declare function InputGroupClearButton({ onClear, label, ref, className, ...props }: InputGroupClearButtonProps): React.JSX.Element;
127
138
  export {};