@bigpixelrocket/uiok 0.2.1 → 0.2.3

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 (64) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/dist/button/TextLink.d.ts +27 -0
  3. package/dist/button/TextLink.js +15 -0
  4. package/dist/button/button.css +48 -0
  5. package/dist/button/index.d.ts +2 -1
  6. package/dist/button/index.js +2 -1
  7. package/dist/charts/Line.logic.d.ts +15 -1
  8. package/dist/charts/Line.logic.js +37 -4
  9. package/dist/charts/LineChart.d.ts +42 -2
  10. package/dist/charts/LineChart.js +41 -9
  11. package/dist/charts/Scatter.logic.js +7 -2
  12. package/dist/charts/charts.css +35 -5
  13. package/dist/charts/index.d.ts +1 -1
  14. package/dist/dialog/ConfirmDialog.d.ts +7 -1
  15. package/dist/dialog/ConfirmDialog.js +9 -4
  16. package/dist/dialog/DialogLists.d.ts +8 -1
  17. package/dist/dialog/DialogLists.js +3 -2
  18. package/dist/field/field.css +110 -2
  19. package/dist/filter/filter.css +16 -0
  20. package/dist/grid/DataGrid.d.ts +10 -2
  21. package/dist/grid/DataGrid.js +47 -13
  22. package/dist/grid/DataGrid.logic.d.ts +16 -0
  23. package/dist/grid/DataGrid.logic.js +28 -0
  24. package/dist/grid/grid.css +128 -4
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/labels/UiokLabels.d.ts +3 -0
  28. package/dist/labels/UiokLabels.js +3 -1
  29. package/dist/labels/index.d.ts +1 -0
  30. package/dist/labels/index.js +1 -0
  31. package/dist/labels/keys.js +2 -0
  32. package/dist/labels/paneTabs.d.ts +27 -0
  33. package/dist/labels/paneTabs.js +10 -0
  34. package/dist/labels/selectAll.d.ts +4 -1
  35. package/dist/labels/selectAll.js +1 -1
  36. package/dist/legend/KeyLegendStrip.d.ts +9 -1
  37. package/dist/legend/KeyLegendStrip.js +119 -5
  38. package/dist/legend/legend.css +52 -0
  39. package/dist/listing/Listing.d.ts +23 -5
  40. package/dist/listing/Listing.js +11 -8
  41. package/dist/listing/listing.css +106 -3
  42. package/dist/pane/PaneActions.d.ts +3 -1
  43. package/dist/pane/PaneActions.js +6 -5
  44. package/dist/pane/PaneTabs.d.ts +92 -0
  45. package/dist/pane/PaneTabs.js +326 -0
  46. package/dist/pane/PaneTabs.logic.d.ts +97 -0
  47. package/dist/pane/PaneTabs.logic.js +158 -0
  48. package/dist/pane/index.d.ts +5 -1
  49. package/dist/pane/index.js +5 -1
  50. package/dist/pane/panetabs.css +408 -0
  51. package/dist/pane/useTabDrag.d.ts +49 -0
  52. package/dist/pane/useTabDrag.js +306 -0
  53. package/dist/segmented/SegmentedChoice.d.ts +8 -1
  54. package/dist/segmented/SegmentedChoice.js +7 -4
  55. package/dist/styles.css +8 -0
  56. package/dist/surface/GroupSwatch.d.ts +22 -0
  57. package/dist/surface/GroupSwatch.js +15 -0
  58. package/dist/surface/Tag.d.ts +26 -0
  59. package/dist/surface/Tag.js +12 -0
  60. package/dist/surface/index.d.ts +7 -0
  61. package/dist/surface/index.js +7 -0
  62. package/dist/surface/surface.css +116 -1
  63. package/dist/themes/tokens.js +13 -1
  64. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,54 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.3] - 2026-11-22
10
+
11
+ ### Added
12
+
13
+ - `PaneTabs` (`@bigpixelrocket/uiok/pane`), the tab strip a pane hangs from: pinned, following (italic), dirty, picked, and danger-toned tabs, a mark slot and a context before the name, a pin rule, New Tab, and the strip's empty end (a double-click opens a tab). Tabs behind the front one shrink to a floor, then fold into a "+N" count with a "Folded here" menu; pinned, front, and following tabs never fold. A press brings a tab to the front and may drag it (4px slop) within its side of the pin rule, carrying any picks; Escape puts every tab back and `onReorder` gets the full order. ⌘-click and ⇧-click pick tabs (`onPick`), a middle-click closes, a double-click keeps (`onKeep`).
14
+ - Pure helpers for a host's tab state and the strip's rules: `togglePick`, `pickRun`, `pickedTabs`, `gatherTabs`, `foldOrder`, `foldsNeeded`, `tabLabelFloor`, `draggedTabOrder`.
15
+ - The `paneTabs` label group (`PaneTabsLabels`, `DEFAULT_PANE_TABS_LABELS`).
16
+ - `.pane[data-tone='danger']`: a pane's frame and its front tab's outline in `--danger`, at rest, active, and in an inactive window.
17
+ - `GroupSwatch` and `Tag` (`@bigpixelrocket/uiok/surface`, a new area): a group's colour as a filled or hollow square, and a small worded tag in a neutral, accent, ready, warning, or danger tone.
18
+ - `DataGridProps.pinnedColumns`: leading columns stay in view while the grid scrolls sideways, with a hairline at the pin edge; a column reorder never crosses it.
19
+ - The grid cell class `cell-removed`: struck out on the danger wash, for a row a save will delete.
20
+ - Field looks: `.field.value-null`, the `.field-editor` frame round a foreign editor (hover, focus, invalid, read-only, changed), and `.field-columns` with `--field-columns` for a check group in columns.
21
+ - `ListingColumn.tip`, the `info` state tone, `StateMarkProps.tip`, `RowProps.level` (an indent for a tree or a plan), the row classes `row-changed`, `row-removed`, and `drop-target`, `.row-meta.value-null`, and `.pane-message.warning`.
22
+ - `KeyLegendStripProps.overflow`: `'more'` folds the places that do not fit into a "+N" chip whose list names each folded verb with its chord and runs the one chosen. `'drop'`, the default, keeps today's behaviour.
23
+ - `TextLink` (`@bigpixelrocket/uiok/button`): a link in words, with an optional glyph, the code face, a tooltip, and a chord.
24
+ - `ConfirmDialogProps.confirmDisabled`: holds the primary off and its key inert, for a typed-name confirmation.
25
+ - `DialogStatementsProps.count` (also through `ConfirmDialog` `statements`): a host's own count words in place of the line count, or none.
26
+ - `SegmentedChoiceProps.disabled`: holds the whole choice while it cannot change.
27
+ - `RowIconActionProps.shortcut`: the chord written after the words in its tooltip.
28
+ - The invalid filter field look (an `aria-invalid="true"` input draws a danger edge and focus ring), `.overline.keep-case`, and `.notice code` in the code face.
29
+ - The `Delete` key's name and ⌦ glyph in the `keys` labels.
30
+ - `docs/tokens.md`: italic also marks a tab whose place is not fixed yet (a following tab).
31
+
32
+ ### Changed
33
+
34
+ - Every single place in `KeyLegendStrip` has a tooltip naming its verb and chord, as a paired cap's does.
35
+ - Arrow, Home, and End moves in `DataGrid` scroll the cursor's column into view sideways.
36
+
37
+ ### Fixed
38
+
39
+ - `SelectAllBar`'s default count uses thousands separators ("1,000 of 20,000 selected").
40
+ - A chosen option in a `select.field` list box (`multiple` or `size`) is no longer painted away.
41
+ - A failed `.pane-empty[role=alert]` draws its glyph in `--danger`.
42
+ - A `.notice` inside `.pane-summary` is cut with an ellipsis instead of wrapping.
43
+
44
+ ## [0.2.2] - 2026-11-20
45
+
46
+ ### Added
47
+
48
+ - `LineChart` `references` (`LineReference`: `value`, `label`, `tone`; `LineReferenceTone`: `'neutral'`, `'warning'`, `'danger'`): dashed horizontal lines across the plot under the series, in `--text-dim`, `--warning`, or `--danger`. The legend lists each after the series with a dashed swatch and its value ("Warning: 90 °C"); the read-out and hover dots leave them out, and the automatic value axis grows to show them. A reference whose value is not finite is left out.
49
+ - `LineChart` `valueMin` and `valueMax`: fix either end of the value axis exactly; an unset end still scales to the values. A non-finite end counts as unset, and a `valueMax` not above `valueMin` drops both. Lines beyond a fixed end are cut at the plot's edge, and references and dots there are not drawn; the read-out still shows the true value.
50
+ - `LineChart` `valueAxisWidth`: a fixed gutter for the value labels, so charts stacked over one time window line up.
51
+ - `LineSeries` `colour`: a CSS colour for one series' line, dots, and swatches; the other series keep their positions' `--chart-*` tokens.
52
+
53
+ ### Fixed
54
+
55
+ - A number or time axis over a narrow span far from zero (a fixed `LineChart` range, a deep `ScatterChart` zoom) no longer puts a tick outside the axis.
56
+
9
57
  ## [0.2.1] - 2026-11-16
10
58
 
11
59
  ### Added
@@ -152,7 +200,9 @@ The first published version. The package is published to npm as `@bigpixelrocket
152
200
  - `lucide-react` 1.31 or later within 1.x is a peer dependency.
153
201
  - Terminal (`@bigpixelrocket/uiok/terminal`, `docs/components/terminal.md`): `Terminal`, Ghostty's VT engine as WebAssembly drawn on a canvas, read-only without `onInput`, with a Copy and Paste menu whose chords come from `menuChords`, a visual bell, line-editing actions bound by `actionForKey`, and `TerminalScrollbackContext`. The package root does not export it, so an app without a terminal never loads its assets. Its words are the new `terminal` label group; the package now ships a `NOTICE` with the engine's, adapter's, and font's licences.
154
202
 
155
- [Unreleased]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.1...HEAD
203
+ [Unreleased]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.3...HEAD
204
+ [0.2.3]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.2...v0.2.3
205
+ [0.2.2]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.1...v0.2.2
156
206
  [0.2.1]: https://github.com/Bigpixelrocket/uiok/compare/v0.2.0...v0.2.1
157
207
  [0.2.0]: https://github.com/Bigpixelrocket/uiok/compare/v0.1.4...v0.2.0
158
208
  [0.1.4]: https://github.com/Bigpixelrocket/uiok/compare/v0.1.3...v0.1.4
@@ -0,0 +1,27 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import type { ReactElement } from 'react';
3
+ /** Props for {@link TextLink}. */
4
+ export interface TextLinkProps {
5
+ /** The link's words, which are also its accessible name: "DROP DATABASE in the manual". */
6
+ readonly children: string;
7
+ /** What it opens: the host opens the manual page, the place, or the window. */
8
+ readonly onClick: () => void;
9
+ /** A glyph before the words (a book for a manual page), at the small icon size. */
10
+ readonly icon?: LucideIcon;
11
+ /** Sets the words in the code face, for a name or value inside a sentence. */
12
+ readonly code?: boolean;
13
+ /** The tooltip, when it says more than the words (the page's address). */
14
+ readonly tip?: string;
15
+ /** The chord that opens it, as text, written after the tooltip's words. */
16
+ readonly shortcut?: string;
17
+ }
18
+ /**
19
+ * A link in words: a button that reads as a link inside a sentence, a
20
+ * section, or a status line, for a manual page or a place a sentence names.
21
+ * It wears the accent's text colour and underlines under the pointer; it
22
+ * takes the keyboard's focus with the shared ring. It is a button because
23
+ * the host decides how to open what it names (an external browser, a tab),
24
+ * so it never navigates the page itself. Styled by `.text-link` in
25
+ * `@bigpixelrocket/uiok/styles.css`.
26
+ */
27
+ export declare function TextLink({ children, onClick, icon: Icon, code, tip, shortcut }: TextLinkProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ICON_SM } from '../icon/sizes.js';
3
+ import { tooltip } from '../tooltip/Tooltip.logic.js';
4
+ /**
5
+ * A link in words: a button that reads as a link inside a sentence, a
6
+ * section, or a status line, for a manual page or a place a sentence names.
7
+ * It wears the accent's text colour and underlines under the pointer; it
8
+ * takes the keyboard's focus with the shared ring. It is a button because
9
+ * the host decides how to open what it names (an external browser, a tab),
10
+ * so it never navigates the page itself. Styled by `.text-link` in
11
+ * `@bigpixelrocket/uiok/styles.css`.
12
+ */
13
+ export function TextLink({ children, onClick, icon: Icon, code = false, tip, shortcut }) {
14
+ return (_jsxs("button", { className: code ? 'text-link code' : 'text-link', onClick: onClick, type: "button", ...(tip === undefined && shortcut === undefined ? {} : tooltip(tip ?? children, shortcut)), children: [Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), _jsx("span", { className: "text-link-words", children: children })] }));
15
+ }
@@ -261,3 +261,51 @@
261
261
  .disclosure:is(:hover, :focus-visible):not(:disabled) {
262
262
  color: var(--text);
263
263
  }
264
+
265
+ /* ---- Text link (TextLink) ----
266
+
267
+ A link in words inside running text: no bezel and no ground, the
268
+ accent's text colour, the words underlined under the pointer and while
269
+ held, and the shared focus ring. Its size and face follow the text round
270
+ it; `.code` sets the words in the code face for a name or value. A glyph
271
+ before the words takes the same colour. */
272
+ .text-link {
273
+ display: inline-flex;
274
+ align-items: baseline;
275
+ gap: var(--space-2);
276
+ max-width: 100%;
277
+ margin: 0;
278
+ padding: 0;
279
+ border: none;
280
+ border-radius: var(--radius-xs);
281
+ background: none;
282
+ color: var(--accent-text);
283
+ font: inherit;
284
+ text-align: start;
285
+ cursor: default;
286
+ }
287
+
288
+ .text-link > svg {
289
+ flex: none;
290
+ align-self: center;
291
+ }
292
+
293
+ .text-link-words {
294
+ min-width: 0;
295
+ overflow: hidden;
296
+ text-overflow: ellipsis;
297
+ text-decoration-thickness: var(--line);
298
+ text-underline-offset: var(--space-1);
299
+ }
300
+
301
+ .text-link.code .text-link-words {
302
+ font-family: var(--font-mono);
303
+ }
304
+
305
+ .text-link:is(:hover, :active):not(:disabled) .text-link-words {
306
+ text-decoration-line: underline;
307
+ }
308
+
309
+ .text-link:disabled {
310
+ color: var(--text-dim);
311
+ }
@@ -1,3 +1,4 @@
1
- /** Buttons: the text `Button` in three tiers and its icon-only sibling `IconButton`. */
1
+ /** Buttons: the text `Button` in three tiers, its icon-only sibling `IconButton`, and `TextLink`, a link in words. */
2
2
  export { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from './Button.js';
3
3
  export { IconButton, type IconButtonProps } from './IconButton.js';
4
+ export { TextLink, type TextLinkProps } from './TextLink.js';
@@ -1,3 +1,4 @@
1
- /** Buttons: the text `Button` in three tiers and its icon-only sibling `IconButton`. */
1
+ /** Buttons: the text `Button` in three tiers, its icon-only sibling `IconButton`, and `TextLink`, a link in words. */
2
2
  export { Button } from './Button.js';
3
3
  export { IconButton } from './IconButton.js';
4
+ export { TextLink } from './TextLink.js';
@@ -4,12 +4,26 @@ export interface LinePoint {
4
4
  readonly at: number;
5
5
  readonly value: number | null;
6
6
  }
7
+ /** The ends of the value axis a chart fixes; an end left out is scaled to the values. */
8
+ export interface ValueRange {
9
+ readonly min?: number;
10
+ readonly max?: number;
11
+ }
12
+ /**
13
+ * The fixed ends a chart can use: a non-finite end counts as unset, and
14
+ * both are dropped when the top is not above the bottom, so the axis
15
+ * scales to its values as if neither were given.
16
+ */
17
+ export declare function valueRange(min: number | undefined, max: number | undefined): ValueRange;
7
18
  /**
8
19
  * The value axis's domain over every value shown: from zero, or the lowest
9
20
  * value where one is below zero, to the highest, with a tenth to spare
10
21
  * above it; the unit domain when nothing is shown or every value is zero.
22
+ * An end `fixed` sets (after `valueRange`'s checks) is used exactly, with
23
+ * nothing to spare, and the other end scales as above over the values and
24
+ * the fixed end; a value beyond a fixed end does not move it.
11
25
  */
12
- export declare function valueDomain(values: readonly (number | null)[]): Domain;
26
+ export declare function valueDomain(values: readonly (number | null)[], fixed?: ValueRange): Domain;
13
27
  /**
14
28
  * A series' path through its points, each placed by `x` and `y`: a line
15
29
  * from one value to the next, broken where a value is missing, a lone
@@ -1,16 +1,39 @@
1
1
  /*
2
- * The geometry of the line chart (`LineChart.tsx`): the value axis's domain,
2
+ * The geometry of the line chart (`LineChart.tsx`): the value axis's domain
3
+ * (scaled to the values, or between the ends the chart fixes),
3
4
  * each series' path with its gaps, the point nearest a moment for the
4
5
  * hover's read-out, and where the time labels fit.
5
6
  */
7
+ /**
8
+ * The fixed ends a chart can use: a non-finite end counts as unset, and
9
+ * both are dropped when the top is not above the bottom, so the axis
10
+ * scales to its values as if neither were given.
11
+ */
12
+ export function valueRange(min, max) {
13
+ const low = min !== undefined && Number.isFinite(min) ? min : undefined;
14
+ const high = max !== undefined && Number.isFinite(max) ? max : undefined;
15
+ if (low !== undefined && high !== undefined && high <= low)
16
+ return {};
17
+ return {
18
+ ...(low === undefined ? {} : { min: low }),
19
+ ...(high === undefined ? {} : { max: high })
20
+ };
21
+ }
6
22
  /**
7
23
  * The value axis's domain over every value shown: from zero, or the lowest
8
24
  * value where one is below zero, to the highest, with a tenth to spare
9
25
  * above it; the unit domain when nothing is shown or every value is zero.
26
+ * An end `fixed` sets (after `valueRange`'s checks) is used exactly, with
27
+ * nothing to spare, and the other end scales as above over the values and
28
+ * the fixed end; a value beyond a fixed end does not move it.
10
29
  */
11
- export function valueDomain(values) {
12
- let min = 0;
13
- let max = 0;
30
+ export function valueDomain(values, fixed = {}) {
31
+ const range = valueRange(fixed.min, fixed.max);
32
+ if (range.min !== undefined && range.max !== undefined)
33
+ return { min: range.min, max: range.max };
34
+ let min = range.min ?? 0;
35
+ // The free top starts from zero, as on an axis with no fixed end, or from a fixed bottom above it.
36
+ let max = Math.max(0, range.min ?? 0);
14
37
  for (const value of values) {
15
38
  if (value === null || !Number.isFinite(value))
16
39
  continue;
@@ -19,6 +42,16 @@ export function valueDomain(values) {
19
42
  if (value > max)
20
43
  max = value;
21
44
  }
45
+ if (range.min !== undefined) {
46
+ return max > range.min
47
+ ? { min: range.min, max: max + (max - range.min) / 10 }
48
+ : { min: range.min, max: range.min + 1 };
49
+ }
50
+ if (range.max !== undefined) {
51
+ return min < range.max
52
+ ? { min: min < 0 ? min - (range.max - min) / 10 : min, max: range.max }
53
+ : { min: range.max - 1, max: range.max };
54
+ }
22
55
  if (max === min)
23
56
  return { min, max: min + 1 };
24
57
  return { min: min < 0 ? min - (max - min) / 10 : min, max: max + (max - min) / 10 };
@@ -4,12 +4,30 @@ import { type LinePoint } from './Line.logic.js';
4
4
  export interface LineSeries {
5
5
  readonly label: string;
6
6
  readonly points: readonly LinePoint[];
7
+ /**
8
+ * A CSS colour for this series' line, dots, and swatches in place of its
9
+ * position's chart token (`'var(--text)'`); the other series keep theirs.
10
+ */
11
+ readonly colour?: string;
12
+ }
13
+ /** The tone of a {@link LineReference}: `neutral` in `--text-dim`, `warning` in `--warning`, `danger` in `--danger`. */
14
+ export type LineReferenceTone = 'neutral' | 'warning' | 'danger';
15
+ /**
16
+ * A horizontal reference line across a {@link LineChart}'s plot at `value`
17
+ * (a limit, a target), dashed in its tone and listed in the legend after
18
+ * the series with its value ("Warning: 90 °C").
19
+ */
20
+ export interface LineReference {
21
+ readonly value: number;
22
+ readonly label: string;
23
+ /** Defaults to `'neutral'`. */
24
+ readonly tone?: LineReferenceTone;
7
25
  }
8
26
  /** Props for {@link LineChart}. */
9
27
  export interface LineChartProps {
10
28
  /** What the chart shows, for screen readers ("Questions"). */
11
29
  readonly label: string;
12
- /** The series, each drawn in the next chart token. */
30
+ /** The series, each drawn in the next chart token unless it names its own `colour`. */
13
31
  readonly series: readonly LineSeries[];
14
32
  /** The time axis's start, in Unix milliseconds. */
15
33
  readonly from: number;
@@ -21,6 +39,23 @@ export interface LineChartProps {
21
39
  readonly timeText: (at: number) => string;
22
40
  /** Hands over the time range a drag across the plot picked, earlier end first; without it the plot only reads out. */
23
41
  readonly onSelect?: (from: number, to: number) => void;
42
+ /** Dashed horizontal lines under the series, in the legend after them; a non-finite value is left out. */
43
+ readonly references?: readonly LineReference[];
44
+ /** The value axis's fixed bottom, used exactly; unset, it scales to the values. */
45
+ readonly valueMin?: number;
46
+ /**
47
+ * The value axis's fixed top, used exactly; unset, it scales to the
48
+ * values. A non-finite end counts as unset, and a top not above the
49
+ * bottom drops both. A line beyond a fixed end is cut at the plot's
50
+ * edge; a reference or dot beyond it is not drawn.
51
+ */
52
+ readonly valueMax?: number;
53
+ /**
54
+ * The pixels left of the plot for the value labels, in place of the
55
+ * widest label's width, so stacked charts given the same width line up;
56
+ * it should fit the widest label. Ignored unless finite and above zero.
57
+ */
58
+ readonly valueAxisWidth?: number;
24
59
  }
25
60
  /**
26
61
  * A time-series line chart drawn in SVG from the chart tokens, in light and
@@ -30,5 +65,10 @@ export interface LineChartProps {
30
65
  * value there. With `onSelect`, dragging across the plot picks the time
31
66
  * range between the press and the release and hands it over. The chart is
32
67
  * as wide as its frame and 55% as high, between 120 and 360 pixels.
68
+ *
69
+ * `references` draws dashed limits under the lines, which the value axis
70
+ * makes room for and the read-out leaves out; `valueMin` and `valueMax`
71
+ * pin the value axis's ends; `valueAxisWidth` fixes the gutter left of the
72
+ * plot so stacked charts align; a series' `colour` replaces its token.
33
73
  */
34
- export declare function LineChart({ label, series, from, to, format, timeText, onSelect }: LineChartProps): ReactElement;
74
+ export declare function LineChart({ label, series, from, to, format, timeText, onSelect, references, valueMin, valueMax, valueAxisWidth }: LineChartProps): ReactElement;
@@ -1,11 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useLayoutEffect, useRef, useState } from 'react';
2
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
3
3
  import { useLabels } from '../labels/UiokProvider.js';
4
- import { linePath, lonePoints, nearestMoment, timeTickLabels, valueDomain } from './Line.logic.js';
4
+ import { linePath, lonePoints, nearestMoment, timeTickLabels, valueDomain, valueRange } from './Line.logic.js';
5
5
  import { scaled, ticksOf, unscaled } from './Scatter.logic.js';
6
6
  import { seriesColour } from './seriesColour.js';
7
7
  /** The room the axes' ticks take around the plot. */
8
8
  const MARGIN = { top: 8, right: 10, bottom: 22, left: 52 };
9
+ /**
10
+ * How far past the plot's edges the clip of a chart with a fixed end
11
+ * reaches: half the 1.5px stroke of a series line (`charts.css`), so a
12
+ * line on a fixed end, or ending at the time axis's start or end, keeps
13
+ * its whole stroke, and one beyond a fixed end is cut there. Dots and
14
+ * reference lines are not clipped: one beyond a fixed end, or a dot
15
+ * outside the time axis, is not drawn.
16
+ */
17
+ const CLIP_SPARE = 0.75;
9
18
  /**
10
19
  * A time-series line chart drawn in SVG from the chart tokens, in light and
11
20
  * dark: a line per series over a time axis from `from` to `to` and a value
@@ -14,9 +23,15 @@ const MARGIN = { top: 8, right: 10, bottom: 22, left: 52 };
14
23
  * value there. With `onSelect`, dragging across the plot picks the time
15
24
  * range between the press and the release and hands it over. The chart is
16
25
  * as wide as its frame and 55% as high, between 120 and 360 pixels.
26
+ *
27
+ * `references` draws dashed limits under the lines, which the value axis
28
+ * makes room for and the read-out leaves out; `valueMin` and `valueMax`
29
+ * pin the value axis's ends; `valueAxisWidth` fixes the gutter left of the
30
+ * plot so stacked charts align; a series' `colour` replaces its token.
17
31
  */
18
- export function LineChart({ label, series, from, to, format, timeText, onSelect }) {
32
+ export function LineChart({ label, series, from, to, format, timeText, onSelect, references = [], valueMin, valueMax, valueAxisWidth }) {
19
33
  const labels = useLabels().charts;
34
+ const clipId = `line-clip-${useId().replace(/[^\w-]/g, '')}`;
20
35
  const frame = useRef(null);
21
36
  const svg = useRef(null);
22
37
  const [labelWidths, setLabelWidths] = useState({});
@@ -39,9 +54,18 @@ export function LineChart({ label, series, from, to, format, timeText, onSelect
39
54
  // The first layout uses a conservative estimate; SVG supplies real glyph widths
40
55
  // before paint, including locale-specific numeric separators and units.
41
56
  const widthOf = (text) => labelWidths[text] ?? Array.from(text).length * 8;
42
- const values = valueDomain(series.flatMap((entry) => entry.points.map((point) => point.value)));
57
+ const lines = references.filter((reference) => Number.isFinite(reference.value));
58
+ const fixed = valueRange(valueMin, valueMax);
59
+ // Only a fixed end can leave a value outside the plot, so only then is it cut.
60
+ const clipPath = fixed.min === undefined && fixed.max === undefined ? undefined : `url(#${clipId})`;
61
+ const values = valueDomain([
62
+ ...series.flatMap((entry) => entry.points.map((point) => point.value)),
63
+ ...lines.map((reference) => reference.value)
64
+ ], fixed);
43
65
  const valueTicks = ticksOf(values, 'number', Math.max(2, Math.floor((height - MARGIN.top - MARGIN.bottom) / 40)));
44
- const left = Math.max(MARGIN.left, ...valueTicks.map((tick) => widthOf(format(tick)) + 8));
66
+ const left = valueAxisWidth !== undefined && Number.isFinite(valueAxisWidth) && valueAxisWidth > 0
67
+ ? valueAxisWidth
68
+ : Math.max(MARGIN.left, ...valueTicks.map((tick) => widthOf(format(tick)) + 8));
45
69
  const plotWidth = Math.max(40, width - left - MARGIN.right);
46
70
  const plotHeight = Math.max(40, height - MARGIN.top - MARGIN.bottom);
47
71
  const time = { min: from, max: to > from ? to : from + 1 };
@@ -74,10 +98,18 @@ export function LineChart({ label, series, from, to, format, timeText, onSelect
74
98
  return unscaled(x, time, 0, plotWidth);
75
99
  };
76
100
  const shown = hover === null ? null : nearestMoment(moments, hover);
77
- return (_jsxs("figure", { "aria-label": label, className: "line-chart", children: [_jsxs("div", { className: "line-frame", ref: frame, children: [!drawable ? (_jsx("div", { className: "chart-empty", style: { height }, children: labels.noValue })) : (_jsxs("svg", { "aria-hidden": true, className: "line-svg", height: height, ref: svg, width: width, children: [_jsx("g", { className: "line-tick line-measure", visibility: "hidden", children: [...new Set([...timeTicks.map(timeText), ...valueTicks.map(format)])].map((text) => (_jsx("text", { children: text }, text))) }), _jsxs("g", { transform: `translate(${left} ${MARGIN.top})`, children: [timeTicks.map((tick) => (_jsx("line", { className: "line-grid", x1: px(tick), x2: px(tick), y1: 0, y2: plotHeight }, `grid${tick}`))), timeLabels.map((tick) => (_jsx("g", { className: "line-tick", children: _jsx("text", { dy: "1.1em", textAnchor: "start", x: tick.left, y: plotHeight + 4, children: tick.text }) }, `x${tick.at}`))), valueTicks.map((tick) => (_jsxs("g", { className: "line-tick", transform: `translate(0 ${py(tick)})`, children: [_jsx("line", { className: "line-grid", x1: 0, x2: plotWidth }), _jsx("text", { dy: "0.32em", textAnchor: "end", x: -6, children: format(tick) })] }, `y${tick}`))), _jsx("path", { className: "line-axes", d: `M0 0V${plotHeight}H${plotWidth}` }), series.map((entry, index) => (_jsx("path", { className: "line-series", d: linePath(entry.points.filter((point) => point.at >= time.min && point.at <= time.max), px, py), stroke: seriesColour(index) }, `${index}:${entry.label}`))), series.map((entry, index) => lonePoints(entry.points.filter((point) => point.at >= time.min && point.at <= time.max)).map((point) => (_jsx("circle", { className: "line-dot", cx: px(point.at), cy: py(point.value ?? 0), fill: seriesColour(index), r: 3 }, `lone${index}:${entry.label}:${point.at}`)))), shown !== null && (_jsx("line", { className: "line-guide", x1: px(shown), x2: px(shown), y1: 0, y2: plotHeight })), shown !== null &&
101
+ /** Whether a reference or dot at `value` is drawn: always, unless it lies beyond a fixed end. */
102
+ const onAxis = (value) => clipPath === undefined || (value >= values.min && value <= values.max);
103
+ /** Whether a dot at moment `at` and `value` is drawn: with a fixed end, only inside the plot. */
104
+ const onPlot = (at, value) => onAxis(value) && (clipPath === undefined || (at >= time.min && at <= time.max));
105
+ /** A series' colour: its own, or its position's chart token. */
106
+ const colourOf = (entry, index) => entry.colour ?? seriesColour(index);
107
+ return (_jsxs("figure", { "aria-label": label, className: "line-chart", children: [_jsxs("div", { className: "line-frame", ref: frame, children: [!drawable ? (_jsx("div", { className: "chart-empty", style: { height }, children: labels.noValue })) : (_jsxs("svg", { "aria-hidden": true, className: "line-svg", height: height, ref: svg, width: width, children: [_jsx("g", { className: "line-tick line-measure", visibility: "hidden", children: [...new Set([...timeTicks.map(timeText), ...valueTicks.map(format)])].map((text) => (_jsx("text", { children: text }, text))) }), _jsxs("g", { transform: `translate(${left} ${MARGIN.top})`, children: [clipPath !== undefined && (_jsx("defs", { children: _jsx("clipPath", { id: clipId, children: _jsx("rect", { height: plotHeight + 2 * CLIP_SPARE, width: plotWidth + 2 * CLIP_SPARE, x: -CLIP_SPARE, y: -CLIP_SPARE }) }) })), timeTicks.map((tick) => (_jsx("line", { className: "line-grid", x1: px(tick), x2: px(tick), y1: 0, y2: plotHeight }, `grid${tick}`))), timeLabels.map((tick) => (_jsx("g", { className: "line-tick", children: _jsx("text", { dy: "1.1em", textAnchor: "start", x: tick.left, y: plotHeight + 4, children: tick.text }) }, `x${tick.at}`))), valueTicks.map((tick) => (_jsxs("g", { className: "line-tick", transform: `translate(0 ${py(tick)})`, children: [_jsx("line", { className: "line-grid", x1: 0, x2: plotWidth }), _jsx("text", { dy: "0.32em", textAnchor: "end", x: -6, children: format(tick) })] }, `y${tick}`))), _jsx("path", { className: "line-axes", d: `M0 0V${plotHeight}H${plotWidth}` }), lines.map((reference, index) => onAxis(reference.value) ? (_jsx("line", { className: `line-reference line-reference-${reference.tone ?? 'neutral'}`, x1: 0, x2: plotWidth, y1: py(reference.value), y2: py(reference.value) }, `ref${index}:${reference.label}`)) : null), series.map((entry, index) => (_jsx("path", { className: "line-series", d: linePath(entry.points.filter((point) => point.at >= time.min && point.at <= time.max), px, py), clipPath: clipPath, stroke: colourOf(entry, index) }, `${index}:${entry.label}`))), series.map((entry, index) => lonePoints(entry.points.filter((point) => point.at >= time.min && point.at <= time.max))
108
+ .filter((point) => onPlot(point.at, point.value ?? 0))
109
+ .map((point) => (_jsx("circle", { className: "line-dot", cx: px(point.at), cy: py(point.value ?? 0), fill: colourOf(entry, index), r: 3 }, `lone${index}:${entry.label}:${point.at}`)))), shown !== null && (_jsx("line", { className: "line-guide", x1: px(shown), x2: px(shown), y1: 0, y2: plotHeight })), shown !== null &&
78
110
  series.map((entry, index) => {
79
111
  const value = entry.points.find((point) => point.at === shown)?.value ?? null;
80
- return value === null ? null : (_jsx("circle", { className: "line-dot", cx: px(shown), cy: py(value), fill: seriesColour(index), r: 3 }, `dot${index}:${entry.label}`));
112
+ return value === null || !onPlot(shown, value) ? null : (_jsx("circle", { className: "line-dot", cx: px(shown), cy: py(value), fill: colourOf(entry, index), r: 3 }, `dot${index}:${entry.label}`));
81
113
  }), drag !== null && (_jsx("rect", { className: "line-selection", height: plotHeight, width: Math.abs(px(drag.to) - px(drag.from)), x: Math.min(px(drag.from), px(drag.to)) })), _jsx("rect", { className: onSelect === undefined ? 'line-plot' : 'line-plot selectable', "data-testid": "line-plot", height: plotHeight, onPointerDown: (event) => {
82
114
  if (onSelect === undefined || event.button !== 0)
83
115
  return;
@@ -102,6 +134,6 @@ export function LineChart({ label, series, from, to, format, timeText, onSelect
102
134
  ? { right: width - left - px(shown) + 8 }
103
135
  : { left: left + px(shown) + 8 }, children: [_jsx("strong", { children: labels.time(timeText(shown)) }), series.map((entry, index) => {
104
136
  const value = entry.points.find((point) => point.at === shown)?.value ?? null;
105
- return (_jsxs("span", { children: [_jsx("span", { "aria-hidden": true, className: "line-swatch", style: { background: seriesColour(index) } }), labels.seriesValue(entry.label, value === null ? '---' : format(value))] }, `${index}:${entry.label}`));
106
- })] }))] }), _jsx("ul", { className: "line-legend", children: series.map((entry, index) => (_jsxs("li", { children: [_jsx("span", { "aria-hidden": true, className: "line-swatch", style: { background: seriesColour(index) } }), entry.label] }, `${index}:${entry.label}`))) })] }));
137
+ return (_jsxs("span", { children: [_jsx("span", { "aria-hidden": true, className: "line-swatch", style: { background: colourOf(entry, index) } }), labels.seriesValue(entry.label, value === null ? '---' : format(value))] }, `${index}:${entry.label}`));
138
+ })] }))] }), _jsxs("ul", { className: "line-legend", children: [series.map((entry, index) => (_jsxs("li", { children: [_jsx("span", { "aria-hidden": true, className: "line-swatch", style: { background: colourOf(entry, index) } }), entry.label] }, `${index}:${entry.label}`))), lines.map((reference, index) => (_jsxs("li", { children: [_jsx("span", { "aria-hidden": true, className: `line-swatch line-swatch-dashed line-reference-${reference.tone ?? 'neutral'}` }), labels.seriesValue(reference.label, format(reference.value))] }, `ref${index}:${reference.label}`)))] })] }));
107
139
  }
@@ -88,8 +88,13 @@ function stepTicks(domain, kind, count) {
88
88
  const at = (first + index) * step;
89
89
  if (at > domain.max)
90
90
  break;
91
- // Round away the float error a multiple of the step carries.
92
- const tick = Number(at.toPrecision(12));
91
+ // Round away the float error a multiple of the step carries, unless rounding would
92
+ // move the tick out of the domain (a narrow span far from zero).
93
+ const rounded = Number(at.toPrecision(12));
94
+ const tick = rounded < domain.min || rounded > domain.max ? at : rounded;
95
+ // A first multiple the division left a float's width below the domain is not on the axis.
96
+ if (tick < domain.min)
97
+ continue;
93
98
  if (tick !== ticks.at(-1))
94
99
  ticks.push(tick);
95
100
  }
@@ -4,8 +4,10 @@
4
4
 
5
5
  One vocabulary for every chart: caption-size type in the interface face
6
6
  with tabular figures; a 10px swatch with a 2px corner (a 10 by 3 dash for
7
- a line series); a plot with a left axis and a baseline in --border-strong
8
- and grid lines in --border-faint, never a box around it; the picked or
7
+ a line series, broken in two for a reference line); a plot with a left
8
+ axis and a baseline in --border-strong and grid lines in --border-faint,
9
+ never a box around it; a reference line dashed in its tone (--text-dim,
10
+ --warning, or --danger); the picked or
9
11
  hovered mark ringed in --text; a dragged range in the accent wash; a
10
12
  read-out in the tooltip's look; and, with nothing to draw, the plot's
11
13
  place kept with one dim line centred in it. */
@@ -151,9 +153,16 @@
151
153
  border-radius: var(--radius-xs);
152
154
  }
153
155
 
154
- /* LineChart: a frame as wide as its cell, the plot's grid and axes, a line
155
- per series in the series colours, the hover's guide with a dot on every
156
- line and the read-out, a dragged time range, and the legend under it. */
156
+ /* A reference line's swatch: the dash broken as its line is, 4px on, 2px
157
+ off, 4px on, in the tone's colour. */
158
+ .line-swatch-dashed {
159
+ background: repeating-linear-gradient(90deg, var(--line-reference) 0 4px, transparent 4px 6px);
160
+ }
161
+
162
+ /* LineChart: a frame as wide as its cell, the plot's grid and axes, dashed
163
+ reference lines under a line per series in the series colours (or the
164
+ colour a series names), the hover's guide with a dot on every line and
165
+ the read-out, a dragged time range, and the legend under it. */
157
166
  .line-chart {
158
167
  display: flex;
159
168
  flex-direction: column;
@@ -200,6 +209,27 @@
200
209
  stroke-linecap: round;
201
210
  }
202
211
 
212
+ /* A reference line (a limit, a target) and its swatch take their tone's
213
+ colour; the dash sets it apart from a series in any hue. */
214
+ .line-reference-neutral {
215
+ --line-reference: var(--text-dim);
216
+ }
217
+
218
+ .line-reference-warning {
219
+ --line-reference: var(--warning);
220
+ }
221
+
222
+ .line-reference-danger {
223
+ --line-reference: var(--danger);
224
+ }
225
+
226
+ .line-reference {
227
+ stroke: var(--line-reference);
228
+ stroke-width: 1.5;
229
+ stroke-dasharray: 4 2;
230
+ pointer-events: none;
231
+ }
232
+
203
233
  .line-guide {
204
234
  stroke: var(--text-dim);
205
235
  stroke-dasharray: 2 2;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export { svgMarkup, svgPng, tokenColour } from './Drawing.js';
8
8
  export type { LinePoint } from './Line.logic.js';
9
- export { LineChart, type LineChartProps, type LineSeries } from './LineChart.js';
9
+ export { LineChart, type LineChartProps, type LineReference, type LineReferenceTone, type LineSeries } from './LineChart.js';
10
10
  export type { PieSlice } from './Pie.logic.js';
11
11
  export { PieChart, type PieChartProps } from './PieChart.js';
12
12
  export { ResultChart, type ResultChartProps } from './ResultChart.js';
@@ -98,6 +98,12 @@ export interface ConfirmDialogProps {
98
98
  * deletes anything for good.
99
99
  */
100
100
  readonly forGood?: boolean;
101
+ /**
102
+ * Holds the confirm verb off: its slot is disabled and its key runs
103
+ * nothing, until the caller lets it go (a typed-name confirmation keeps it
104
+ * off until the name in its field matches).
105
+ */
106
+ readonly confirmDisabled?: boolean;
101
107
  /** The confirm verb, on Return (or ⌥⌘⌫ with `forGood`) and its slot. */
102
108
  readonly onConfirm: () => void;
103
109
  /** Escape, the leave slot, and a press outside. */
@@ -119,4 +125,4 @@ export interface ConfirmDialogProps {
119
125
  * describe it. Styled by the `.confirm-dialog` rules in
120
126
  * `@bigpixelrocket/uiok/styles.css`; reads the `dialog` labels.
121
127
  */
122
- export declare function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone, items, itemIcon, itemCount, groups, statements, facts, paths, children, className, forGood, onConfirm, onCancel }: ConfirmDialogProps): ReactElement;
128
+ export declare function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone, items, itemIcon, itemCount, groups, statements, facts, paths, children, className, forGood, confirmDisabled, onConfirm, onCancel }: ConfirmDialogProps): ReactElement;
@@ -21,7 +21,7 @@ const DELETE_IMMEDIATELY = { key: 'Backspace', meta: true, alt: true };
21
21
  * describe it. Styled by the `.confirm-dialog` rules in
22
22
  * `@bigpixelrocket/uiok/styles.css`; reads the `dialog` labels.
23
23
  */
24
- export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone = 'danger', items, itemIcon, itemCount, groups = [], statements, facts = [], paths, children, className, forGood = false, onConfirm, onCancel }) {
24
+ export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon, tone = 'danger', items, itemIcon, itemCount, groups = [], statements, facts = [], paths, children, className, forGood = false, confirmDisabled = false, onConfirm, onCancel }) {
25
25
  const labels = useLabels().dialog;
26
26
  const labelId = useId();
27
27
  const messageId = useId();
@@ -37,12 +37,17 @@ export function ConfirmDialog({ title, message, confirmLabel, cancelLabel, icon,
37
37
  const legend = {
38
38
  leave: { label: cancelLabel ?? labels.cancel },
39
39
  primary: forGood
40
- ? { label: confirmLabel, chord: DELETE_IMMEDIATELY, onRun: onConfirm }
41
- : { label: confirmLabel, onRun: onConfirm }
40
+ ? {
41
+ label: confirmLabel,
42
+ chord: DELETE_IMMEDIATELY,
43
+ onRun: onConfirm,
44
+ disabled: confirmDisabled
45
+ }
46
+ : { label: confirmLabel, onRun: onConfirm, disabled: confirmDisabled }
42
47
  };
43
48
  return (_jsxs(ModalDialog, { className: ['confirm-dialog', hasItems || hasStatements ? 'confirm-items' : null, className]
44
49
  .filter(Boolean)
45
- .join(' '), describedBy: describedBy, icon: icon, labelId: labelId, legend: legend, onCancel: onCancel, title: title, tone: tone === 'primary' ? 'accent' : tone, children: [hasMessage && (_jsx("p", { className: "dialog-message", id: messageId, children: message })), hasItems && (_jsxs("div", { className: "confirm-items-lists", id: itemsId, children: [list.length > 0 && _jsx(DialogItems, { count: itemCount, icon: itemIcon, items: list }), groups.map((group) => (_jsx(DialogItems, { count: group.count, icon: group.icon, items: group.items, label: group.label }, group.label)))] })), hasStatements && _jsx(DialogStatements, { label: statements.label, lines: statements.lines }), facts.length > 0 && _jsx(DialogFacts, { facts: facts, id: factsId }), children] }));
50
+ .join(' '), describedBy: describedBy, icon: icon, labelId: labelId, legend: legend, onCancel: onCancel, title: title, tone: tone === 'primary' ? 'accent' : tone, children: [hasMessage && (_jsx("p", { className: "dialog-message", id: messageId, children: message })), hasItems && (_jsxs("div", { className: "confirm-items-lists", id: itemsId, children: [list.length > 0 && _jsx(DialogItems, { count: itemCount, icon: itemIcon, items: list }), groups.map((group) => (_jsx(DialogItems, { count: group.count, icon: group.icon, items: group.items, label: group.label }, group.label)))] })), hasStatements && (_jsx(DialogStatements, { label: statements.label, lines: statements.lines, ...(statements.count === undefined ? {} : { count: statements.count }) })), facts.length > 0 && _jsx(DialogFacts, { facts: facts, id: factsId }), children] }));
46
51
  }
47
52
  /**
48
53
  * A path as an item: its last part is the name, the folder that holds it
@@ -141,6 +141,13 @@ export interface DialogStatementsProps {
141
141
  readonly lines: readonly string[];
142
142
  /** The block's id, for a dialog that names it in its description. */
143
143
  readonly id?: string;
144
+ /**
145
+ * What the heading says beside the label in place of the line count: a
146
+ * host's own count ("1–100 of 101") for a block that is one page of a
147
+ * longer batch, or `null` for none, when the label already says it.
148
+ * Omitted, the block counts its lines.
149
+ */
150
+ readonly count?: string | null;
144
151
  }
145
152
  /**
146
153
  * The statements a confirmation runs (a batch of SQL), shown in full so
@@ -154,4 +161,4 @@ export interface DialogStatementsProps {
154
161
  * statement. Styled by the `.dialog-statements` rules in
155
162
  * `@bigpixelrocket/uiok/styles.css`.
156
163
  */
157
- export declare function DialogStatements({ label, lines, id }: DialogStatementsProps): ReactElement;
164
+ export declare function DialogStatements({ label, lines, id, count }: DialogStatementsProps): ReactElement;
@@ -131,7 +131,8 @@ function breakable(text) {
131
131
  * statement. Styled by the `.dialog-statements` rules in
132
132
  * `@bigpixelrocket/uiok/styles.css`.
133
133
  */
134
- export function DialogStatements({ label, lines, id }) {
134
+ export function DialogStatements({ label, lines, id, count }) {
135
135
  const labelId = useId();
136
- return (_jsxs("div", { className: "dialog-statements-block", id: id, children: [_jsxs("div", { className: "dialog-items-head", children: [_jsx("span", { className: "dialog-label", id: labelId, children: label }), _jsx("span", { className: "dialog-items-count", children: lines.length.toLocaleString() })] }), _jsx("div", { className: "dialog-statements-frame", children: _jsx("div", { "aria-labelledby": labelId, className: "dialog-statements scroll-fade", role: "region", tabIndex: 0, children: _jsx("ol", { children: lines.map((line, index) => (_jsx("li", { className: "dialog-statement", children: _jsx("code", { dir: "ltr", children: line }) }, `${index}:${line}`))) }) }) })] }));
136
+ const shownCount = count === undefined ? lines.length.toLocaleString() : count;
137
+ return (_jsxs("div", { className: "dialog-statements-block", id: id, children: [_jsxs("div", { className: "dialog-items-head", children: [_jsx("span", { className: "dialog-label", id: labelId, children: label }), shownCount === null ? null : _jsx("span", { className: "dialog-items-count", children: shownCount })] }), _jsx("div", { className: "dialog-statements-frame", children: _jsx("div", { "aria-labelledby": labelId, className: "dialog-statements scroll-fade", role: "region", tabIndex: 0, children: _jsx("ol", { children: lines.map((line, index) => (_jsx("li", { className: "dialog-statement", children: _jsx("code", { dir: "ltr", children: line }) }, `${index}:${line}`))) }) }) })] }));
137
138
  }