@sdxc/ui 2026.11.1 → 2026.11.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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/app/app-shell-toggle.d.ts +31 -0
  3. package/dist/app/app-shell-toggle.js +43 -0
  4. package/dist/app/app-shell.d.ts +131 -0
  5. package/dist/app/app-shell.js +542 -0
  6. package/dist/app/auto-refresh.d.ts +104 -0
  7. package/dist/app/auto-refresh.js +126 -0
  8. package/dist/app/behaviors/refresh-schedule.d.ts +53 -0
  9. package/dist/app/behaviors/refresh-schedule.js +95 -0
  10. package/dist/app/behaviors/shortcuts.d.ts +175 -0
  11. package/dist/app/behaviors/shortcuts.js +401 -0
  12. package/dist/app/behaviors/toaster.d.ts +31 -2
  13. package/dist/app/behaviors/toaster.js +62 -5
  14. package/dist/app/chart.d.ts +62 -8
  15. package/dist/app/chart.js +207 -9
  16. package/dist/app/command-palette.d.ts +132 -0
  17. package/dist/app/command-palette.js +181 -0
  18. package/dist/app/danger-zone.d.ts +66 -0
  19. package/dist/app/danger-zone.js +66 -0
  20. package/dist/app/detail-sheet.d.ts +119 -0
  21. package/dist/app/detail-sheet.js +173 -0
  22. package/dist/app/drop-zone.d.ts +2 -1
  23. package/dist/app/drop-zone.js +6 -3
  24. package/dist/app/editor-layout.d.ts +69 -0
  25. package/dist/app/editor-layout.js +143 -0
  26. package/dist/app/empty.d.ts +56 -19
  27. package/dist/app/empty.js +129 -22
  28. package/dist/app/filter-bar.d.ts +169 -0
  29. package/dist/app/filter-bar.js +346 -0
  30. package/dist/app/index.d.ts +51 -0
  31. package/dist/app/index.js +51 -0
  32. package/dist/app/keyboard-help.d.ts +66 -0
  33. package/dist/app/keyboard-help.js +56 -0
  34. package/dist/app/mixins/app-shell-controls.d.ts +46 -0
  35. package/dist/app/mixins/app-shell-controls.js +131 -0
  36. package/dist/app/mixins/auto-refresh.d.ts +29 -0
  37. package/dist/app/mixins/auto-refresh.js +66 -0
  38. package/dist/app/mixins/command-palette.d.ts +56 -0
  39. package/dist/app/mixins/command-palette.js +297 -0
  40. package/dist/app/mixins/copy-permalink.d.ts +26 -0
  41. package/dist/app/mixins/copy-permalink.js +54 -0
  42. package/dist/app/mixins/detail-sheet-keys.d.ts +28 -0
  43. package/dist/app/mixins/detail-sheet-keys.js +88 -0
  44. package/dist/app/mixins/escape-link.d.ts +17 -0
  45. package/dist/app/mixins/escape-link.js +35 -0
  46. package/dist/app/mixins/keyboard-help.d.ts +38 -0
  47. package/dist/app/mixins/keyboard-help.js +51 -0
  48. package/dist/app/mixins/optimistic-toggle-sync.d.ts +80 -0
  49. package/dist/app/mixins/optimistic-toggle-sync.js +153 -0
  50. package/dist/app/mixins/range-picker-keys.d.ts +18 -0
  51. package/dist/app/mixins/range-picker-keys.js +94 -0
  52. package/dist/app/mixins/row-navigation.d.ts +85 -0
  53. package/dist/app/mixins/row-navigation.js +208 -0
  54. package/dist/app/mixins/save-bar-sync.d.ts +27 -0
  55. package/dist/app/mixins/save-bar-sync.js +106 -0
  56. package/dist/app/mixins/save-shortcut.d.ts +47 -0
  57. package/dist/app/mixins/save-shortcut.js +101 -0
  58. package/dist/app/mixins/save-status-sync.d.ts +77 -0
  59. package/dist/app/mixins/save-status-sync.js +159 -0
  60. package/dist/app/mixins/selection-bar-sync.d.ts +32 -0
  61. package/dist/app/mixins/selection-bar-sync.js +151 -0
  62. package/dist/app/mixins/split-view.d.ts +66 -0
  63. package/dist/app/mixins/split-view.js +319 -0
  64. package/dist/app/mixins/status-strip-keys.d.ts +17 -0
  65. package/dist/app/mixins/status-strip-keys.js +79 -0
  66. package/dist/app/mixins/submit-on-change.d.ts +16 -0
  67. package/dist/app/mixins/submit-on-change.js +28 -0
  68. package/dist/app/mixins/table-selection.d.ts +39 -0
  69. package/dist/app/mixins/table-selection.js +272 -0
  70. package/dist/app/mixins/toast-queue.d.ts +36 -0
  71. package/dist/app/mixins/toast-queue.js +77 -0
  72. package/dist/app/mixins/toast-stack.d.ts +20 -0
  73. package/dist/app/mixins/toast-stack.js +55 -0
  74. package/dist/app/optimistic-toggle.d.ts +48 -0
  75. package/dist/app/optimistic-toggle.js +38 -0
  76. package/dist/app/page-header.d.ts +71 -0
  77. package/dist/app/page-header.js +249 -0
  78. package/dist/app/range-picker.d.ts +102 -0
  79. package/dist/app/range-picker.js +118 -0
  80. package/dist/app/save-bar.d.ts +54 -0
  81. package/dist/app/save-bar.js +64 -0
  82. package/dist/app/save-status.d.ts +50 -0
  83. package/dist/app/save-status.js +54 -0
  84. package/dist/app/selection-bar.d.ts +101 -0
  85. package/dist/app/selection-bar.js +157 -0
  86. package/dist/app/settings-layout.d.ts +70 -0
  87. package/dist/app/settings-layout.js +112 -0
  88. package/dist/app/settings-section.d.ts +140 -0
  89. package/dist/app/settings-section.js +182 -0
  90. package/dist/app/skeleton.d.ts +47 -4
  91. package/dist/app/skeleton.js +149 -2
  92. package/dist/app/sparkline.d.ts +61 -0
  93. package/dist/app/sparkline.js +145 -0
  94. package/dist/app/split-view.d.ts +154 -0
  95. package/dist/app/split-view.js +272 -0
  96. package/dist/app/stat-card.d.ts +109 -0
  97. package/dist/app/stat-card.js +379 -0
  98. package/dist/app/status-strip.d.ts +70 -0
  99. package/dist/app/status-strip.js +155 -0
  100. package/dist/app/styles/action-row.d.ts +41 -0
  101. package/dist/app/styles/action-row.js +59 -0
  102. package/dist/app/styles/stat-delta.d.ts +29 -0
  103. package/dist/app/styles/stat-delta.js +36 -0
  104. package/dist/app/styles/toast-stack.d.ts +21 -0
  105. package/dist/app/styles/toast-stack.js +54 -0
  106. package/dist/app/table.d.ts +199 -24
  107. package/dist/app/table.js +640 -36
  108. package/dist/app/toast.d.ts +105 -5
  109. package/dist/app/toast.js +89 -17
  110. package/dist/app/toasts.d.ts +49 -0
  111. package/dist/app/toasts.js +103 -0
  112. package/dist/app/utils/app-shell-cookie.d.ts +21 -0
  113. package/dist/app/utils/app-shell-cookie.js +33 -0
  114. package/dist/app/utils/chart-marker-indices.d.ts +9 -5
  115. package/dist/app/utils/chart-marker-indices.js +9 -8
  116. package/dist/app/utils/chart-path.d.ts +14 -10
  117. package/dist/app/utils/chart-path.js +46 -18
  118. package/dist/app/utils/edited-time.d.ts +19 -0
  119. package/dist/app/utils/edited-time.js +35 -0
  120. package/dist/app/utils/key-target.d.ts +23 -0
  121. package/dist/app/utils/key-target.js +48 -0
  122. package/dist/app/utils/search-params.d.ts +69 -0
  123. package/dist/app/utils/search-params.js +132 -0
  124. package/dist/app/utils/shortcut-groups.d.ts +21 -0
  125. package/dist/app/utils/shortcut-groups.js +53 -0
  126. package/dist/app/utils/split-view-layout.d.ts +48 -0
  127. package/dist/app/utils/split-view-layout.js +71 -0
  128. package/dist/app/view-options.d.ts +99 -0
  129. package/dist/app/view-options.js +182 -0
  130. package/dist/components/banner.d.ts +61 -0
  131. package/dist/components/banner.js +101 -0
  132. package/dist/components/confirm.d.ts +54 -5
  133. package/dist/components/confirm.js +44 -5
  134. package/dist/components/group.d.ts +14 -0
  135. package/dist/components/group.js +66 -11
  136. package/dist/components/index.d.ts +5 -0
  137. package/dist/components/index.js +5 -0
  138. package/dist/components/input.js +9 -3
  139. package/dist/components/link-button.js +8 -2
  140. package/dist/components/property-list.d.ts +76 -0
  141. package/dist/components/property-list.js +175 -0
  142. package/dist/components/relative-time.d.ts +72 -0
  143. package/dist/components/relative-time.js +45 -0
  144. package/dist/components/status-dot.d.ts +62 -0
  145. package/dist/components/status-dot.js +99 -0
  146. package/dist/components/text-field.d.ts +17 -2
  147. package/dist/components/text-field.js +13 -4
  148. package/dist/components/timeline.d.ts +67 -0
  149. package/dist/components/timeline.js +159 -0
  150. package/dist/components/typeset.d.ts +2 -1
  151. package/dist/components/typeset.js +4 -1
  152. package/dist/docs/code-tabs-sync.d.ts +1 -1
  153. package/dist/docs/code-tabs-sync.js +2 -2
  154. package/dist/docs/copy-button.d.ts +1 -1
  155. package/dist/docs/copy-button.js +2 -2
  156. package/dist/docs/docs-feedback.d.ts +12 -0
  157. package/dist/docs/docs-feedback.js +4 -2
  158. package/dist/docs/docs-hub.js +4 -4
  159. package/dist/docs/docs-layout.d.ts +1 -1
  160. package/dist/docs/docs-layout.js +1 -1
  161. package/dist/docs/docs-nav-tools.d.ts +1 -1
  162. package/dist/docs/docs-nav-tools.js +2 -2
  163. package/dist/docs/docs-nav.d.ts +6 -2
  164. package/dist/docs/docs-nav.js +2 -2
  165. package/dist/docs/docs-pager.d.ts +5 -1
  166. package/dist/docs/docs-pager.js +7 -6
  167. package/dist/docs/mixins/docs-nav-tools.d.ts +2 -2
  168. package/dist/docs/mixins/docs-nav-tools.js +32 -5
  169. package/dist/docs/next-steps.js +3 -2
  170. package/dist/docs/page-actions.d.ts +1 -1
  171. package/dist/docs/page-actions.js +2 -2
  172. package/dist/docs/table-of-contents.d.ts +1 -1
  173. package/dist/docs/table-of-contents.js +2 -2
  174. package/dist/mixins/confirm-phrase.d.ts +19 -0
  175. package/dist/mixins/confirm-phrase.js +56 -0
  176. package/dist/mixins/index.d.ts +2 -0
  177. package/dist/mixins/index.js +2 -0
  178. package/dist/mixins/viewer-time.d.ts +20 -0
  179. package/dist/mixins/viewer-time.js +40 -0
  180. package/dist/styles/index.d.ts +1 -0
  181. package/dist/styles/index.js +1 -0
  182. package/dist/styles/segmented-control.d.ts +49 -0
  183. package/dist/styles/segmented-control.js +71 -0
  184. package/dist/test/table.d.ts +65 -0
  185. package/dist/test/table.js +108 -0
  186. package/dist/utils/index.d.ts +1 -0
  187. package/dist/utils/index.js +1 -0
  188. package/dist/utils/relative-time.d.ts +44 -0
  189. package/dist/utils/relative-time.js +69 -0
  190. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Pure SVG path-string builders for chart geometry: {@link linePath} for a
3
- * connected polyline through a series of points, {@link areaPath} for the
3
+ * polyline through a series of points, broken at gaps, {@link areaPath} for the
4
4
  * same line closed down to a baseline, and {@link arcPath} for a pie or
5
5
  * donut wedge. Every builder takes coordinates already scaled to pixels —
6
6
  * mapping a data value onto a pixel position is a separate concern the
@@ -13,29 +13,33 @@
13
13
  import type { Point } from "../../utils/geometry.js";
14
14
  export type { Point };
15
15
  /**
16
- * Builds the `d` attribute for a connected polyline through `points`: a
17
- * single move-to for the first point, followed by one line-to per remaining
18
- * point, in the order given. Backs a line chart's plotted series.
16
+ * Builds the `d` attribute for a polyline through `points`, in the order
17
+ * given. A `null` entry is a sample with no data: the line stops at the point
18
+ * before it and starts again with a fresh move-to at the point after it.
19
19
  *
20
- * @param points Already-scaled pixel positions to connect, in draw order.
21
- * @returns An SVG path `d` string, or an empty string when `points` is empty.
20
+ * @param points Already-scaled pixel positions to connect, in draw order; `null` breaks the line.
21
+ * @returns An SVG path `d` string, or an empty string when no point is present.
22
22
  * @example
23
23
  * linePath([{ x: 0, y: 10 }, { x: 20, y: 0 }]);
24
24
  * // "M 0,10 L 20,0"
25
+ * @example
26
+ * linePath([{ x: 0, y: 10 }, null, { x: 40, y: 5 }, { x: 60, y: 0 }]);
27
+ * // "M 0,10 M 40,5 L 60,0"
25
28
  */
26
- export declare function linePath(points: readonly Point[]): string;
29
+ export declare function linePath(points: readonly (Point | null)[]): string;
27
30
  /**
28
31
  * Builds the `d` attribute for the line {@link linePath} draws, closed into
29
32
  * a filled region down to `baselineY`, for an area chart's filled series.
33
+ * Each run between `null` entries closes on its own, leaving the gap unfilled.
30
34
  *
31
- * @param points Already-scaled pixel positions along the top edge of the area, in draw order.
35
+ * @param points Already-scaled pixel positions along the top edge of the area, in draw order; `null` breaks the area.
32
36
  * @param baselineY Pixel `y` position the area closes down (or up) to — typically the zero line or the chart's floor.
33
- * @returns An SVG path `d` string, or an empty string when `points` is empty.
37
+ * @returns An SVG path `d` string, or an empty string when no point is present.
34
38
  * @example
35
39
  * areaPath([{ x: 0, y: 10 }, { x: 20, y: 0 }], 30);
36
40
  * // "M 0,10 L 20,0 L 20,30 L 0,30 Z"
37
41
  */
38
- export declare function areaPath(points: readonly Point[], baselineY: number): string;
42
+ export declare function areaPath(points: readonly (Point | null)[], baselineY: number): string;
39
43
  /**
40
44
  * Options accepted by {@link arcPath}.
41
45
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Pure SVG path-string builders for chart geometry: {@link linePath} for a
3
- * connected polyline through a series of points, {@link areaPath} for the
3
+ * polyline through a series of points, broken at gaps, {@link areaPath} for the
4
4
  * same line closed down to a baseline, and {@link arcPath} for a pie or
5
5
  * donut wedge. Every builder takes coordinates already scaled to pixels —
6
6
  * mapping a data value onto a pixel position is a separate concern the
@@ -13,41 +13,69 @@
13
13
  import { FULL_TURN_RADIANS } from "../../utils/full-turn-radians.js";
14
14
  import { roundChannel } from "../../utils/round-precision.js";
15
15
  /**
16
- * Builds the `d` attribute for a connected polyline through `points`: a
17
- * single move-to for the first point, followed by one line-to per remaining
18
- * point, in the order given. Backs a line chart's plotted series.
16
+ * Splits `points` into the runs of consecutive positions between `null`
17
+ * entries, so a series with missing samples draws as separate pieces and
18
+ * never bridges or drops through a gap.
19
+ */
20
+ function runs(points) {
21
+ let result = [];
22
+ let current = [];
23
+ for (let point of points) {
24
+ if (point !== null) {
25
+ current.push(point);
26
+ continue;
27
+ }
28
+ if (current.length > 0)
29
+ result.push(current);
30
+ current = [];
31
+ }
32
+ if (current.length > 0)
33
+ result.push(current);
34
+ return result;
35
+ }
36
+ /** Draws one run as a move-to on its first point and a line-to through each remaining one. */
37
+ function polyline(run) {
38
+ return run.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x},${point.y}`).join(" ");
39
+ }
40
+ /**
41
+ * Builds the `d` attribute for a polyline through `points`, in the order
42
+ * given. A `null` entry is a sample with no data: the line stops at the point
43
+ * before it and starts again with a fresh move-to at the point after it.
19
44
  *
20
- * @param points Already-scaled pixel positions to connect, in draw order.
21
- * @returns An SVG path `d` string, or an empty string when `points` is empty.
45
+ * @param points Already-scaled pixel positions to connect, in draw order; `null` breaks the line.
46
+ * @returns An SVG path `d` string, or an empty string when no point is present.
22
47
  * @example
23
48
  * linePath([{ x: 0, y: 10 }, { x: 20, y: 0 }]);
24
49
  * // "M 0,10 L 20,0"
50
+ * @example
51
+ * linePath([{ x: 0, y: 10 }, null, { x: 40, y: 5 }, { x: 60, y: 0 }]);
52
+ * // "M 0,10 M 40,5 L 60,0"
25
53
  */
26
54
  export function linePath(points) {
27
- if (points.length === 0)
28
- return "";
29
- return points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x},${point.y}`).join(" ");
55
+ return runs(points).map(polyline).join(" ");
30
56
  }
31
57
  /**
32
58
  * Builds the `d` attribute for the line {@link linePath} draws, closed into
33
59
  * a filled region down to `baselineY`, for an area chart's filled series.
60
+ * Each run between `null` entries closes on its own, leaving the gap unfilled.
34
61
  *
35
- * @param points Already-scaled pixel positions along the top edge of the area, in draw order.
62
+ * @param points Already-scaled pixel positions along the top edge of the area, in draw order; `null` breaks the area.
36
63
  * @param baselineY Pixel `y` position the area closes down (or up) to — typically the zero line or the chart's floor.
37
- * @returns An SVG path `d` string, or an empty string when `points` is empty.
64
+ * @returns An SVG path `d` string, or an empty string when no point is present.
38
65
  * @example
39
66
  * areaPath([{ x: 0, y: 10 }, { x: 20, y: 0 }], 30);
40
67
  * // "M 0,10 L 20,0 L 20,30 L 0,30 Z"
41
68
  */
42
69
  export function areaPath(points, baselineY) {
43
- let first = points[0];
44
- if (first === undefined)
45
- return "";
46
- let last = points[points.length - 1] ?? first;
47
- let top = points
48
- .map((point, index) => `${index === 0 ? "M" : "L"} ${point.x},${point.y}`)
70
+ return runs(points)
71
+ .map((run) => {
72
+ let first = run[0];
73
+ let last = run.at(-1);
74
+ if (first === undefined || last === undefined)
75
+ return "";
76
+ return `${polyline(run)} L ${last.x},${baselineY} L ${first.x},${baselineY} Z`;
77
+ })
49
78
  .join(" ");
50
- return `${top} L ${last.x},${baselineY} L ${first.x},${baselineY} Z`;
51
79
  }
52
80
  /** Fallback inner radius for {@link arcPath} — a solid wedge reaching the center. */
53
81
  const DEFAULT_INNER_RADIUS = 0;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Formats when content was last edited for a save status line: relative ("2m ago")
3
+ * while recent and a date with a time once it is older, through the platform's `Intl`
4
+ * APIs so every locale reads it in its own words.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Formats how long ago `at` was: relative within `decayMs`, a date and time after.
11
+ *
12
+ * @param at When the content was edited.
13
+ * @param now The moment to measure from.
14
+ * @param decayMs Age at which the text becomes a timestamp.
15
+ * @param locale Locale to format in; the runtime's when omitted.
16
+ * @returns The time text an "Edited {time}" label embeds.
17
+ * @example formatEditedTime(updatedAt, new Date(), 86_400_000, "en") // "2m ago"
18
+ */
19
+ export declare function formatEditedTime(at: Date, now: Date, decayMs: number, locale?: string): string;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Formats when content was last edited for a save status line: relative ("2m ago")
3
+ * while recent and a date with a time once it is older, through the platform's `Intl`
4
+ * APIs so every locale reads it in its own words.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /** Units the relative edit time steps through, each with its length in seconds. */
10
+ const UNITS = [
11
+ ["hour", 3600],
12
+ ["minute", 60],
13
+ ];
14
+ /**
15
+ * Formats how long ago `at` was: relative within `decayMs`, a date and time after.
16
+ *
17
+ * @param at When the content was edited.
18
+ * @param now The moment to measure from.
19
+ * @param decayMs Age at which the text becomes a timestamp.
20
+ * @param locale Locale to format in; the runtime's when omitted.
21
+ * @returns The time text an "Edited {time}" label embeds.
22
+ * @example formatEditedTime(updatedAt, new Date(), 86_400_000, "en") // "2m ago"
23
+ */
24
+ export function formatEditedTime(at, now, decayMs, locale) {
25
+ let elapsed = now.getTime() - at.getTime();
26
+ if (elapsed >= decayMs) {
27
+ return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(at);
28
+ }
29
+ let seconds = Math.max(0, Math.round(elapsed / 1000));
30
+ let format = new Intl.RelativeTimeFormat(locale, { numeric: "auto", style: "narrow" });
31
+ let unit = UNITS.find(([, length]) => seconds >= length);
32
+ if (unit)
33
+ return format.format(-Math.floor(seconds / unit[1]), unit[0]);
34
+ return format.format(-seconds, "second");
35
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Answers whether a page-level key such as Escape or a bare letter belongs to the list
3
+ * behind it: a keystroke inside a text field, or while a dialog or popover is open, is that
4
+ * surface's key, so a list's shortcuts stand aside for it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Whether `target` is a field the reader is typing into.
11
+ *
12
+ * @param target The keystroke's target.
13
+ * @returns Whether the target is, or sits inside, a text-entry control.
14
+ */
15
+ export declare function isTextEntry(target: EventTarget | null): boolean;
16
+ /**
17
+ * Whether a keystroke is free for a list-level shortcut: unmodified, unclaimed by an earlier
18
+ * handler, outside a text field, and with no dialog or popover open to take it first.
19
+ *
20
+ * @param event The keystroke.
21
+ * @returns Whether a list shortcut may act on it.
22
+ */
23
+ export declare function isListKey(event: KeyboardEvent): boolean;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Answers whether a page-level key such as Escape or a bare letter belongs to the list
3
+ * behind it: a keystroke inside a text field, or while a dialog or popover is open, is that
4
+ * surface's key, so a list's shortcuts stand aside for it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Controls where a key is text: every editable field, and every `<input>` whose type takes
11
+ * typed text. Checkboxes and radios stay out, so Escape after ticking a row still reaches the list.
12
+ */
13
+ const TEXT_ENTRY_SELECTOR = [
14
+ "textarea",
15
+ "select",
16
+ '[contenteditable]:not([contenteditable="false"])',
17
+ '[role="textbox"]',
18
+ '[role="combobox"]',
19
+ 'input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"])',
20
+ ].join(", ");
21
+ /** Surfaces that own Escape while open: a modal, or any shown popover. */
22
+ const OPEN_OVERLAY_SELECTOR = "dialog[open], :popover-open";
23
+ /**
24
+ * Whether `target` is a field the reader is typing into.
25
+ *
26
+ * @param target The keystroke's target.
27
+ * @returns Whether the target is, or sits inside, a text-entry control.
28
+ */
29
+ export function isTextEntry(target) {
30
+ return target instanceof Element && target.closest(TEXT_ENTRY_SELECTOR) !== null;
31
+ }
32
+ /**
33
+ * Whether a keystroke is free for a list-level shortcut: unmodified, unclaimed by an earlier
34
+ * handler, outside a text field, and with no dialog or popover open to take it first.
35
+ *
36
+ * @param event The keystroke.
37
+ * @returns Whether a list shortcut may act on it.
38
+ */
39
+ export function isListKey(event) {
40
+ if (event.defaultPrevented || event.isComposing)
41
+ return false;
42
+ if (event.ctrlKey || event.metaKey || event.altKey)
43
+ return false;
44
+ if (isTextEntry(event.target))
45
+ return false;
46
+ let root = event.target instanceof Node ? event.target.ownerDocument : null;
47
+ return (root ?? document).querySelector(OPEN_OVERLAY_SELECTOR) === null;
48
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Builds the links and hidden fields a list's URL-held view needs: a link that drops one
3
+ * filter, one that clears them all, one that sets a single parameter, and the parameters a
4
+ * GET form must carry so submitting one control keeps the state every other control wrote.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Parameters that point at a position in a result set, dropped by every link here because a
11
+ * position in the old results means nothing once the query changes.
12
+ */
13
+ export declare const PAGINATION_PARAMS: readonly string[];
14
+ /**
15
+ * The link a filter chip's remove control points at: `url` without the `name` parameter, or
16
+ * without only its `value` when one is given, and back on the first page of results.
17
+ *
18
+ * @param url The page's current URL.
19
+ * @param name The filter's parameter.
20
+ * @param value The one value to drop; omitted drops every value of the parameter.
21
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
22
+ * @returns A same-origin path with the remaining query.
23
+ * @example removeFilterHref("/monitors?status=down&status=paused&page=3", "status", "down") // "/monitors?status=paused"
24
+ * @example removeFilterHref(request.url, "region") // every region value dropped
25
+ */
26
+ export declare function removeFilterHref(url: URL | string, name: string, value?: string, reset?: readonly string[]): string;
27
+ /**
28
+ * The link "Clear filters" points at: `url` without any of the `names` parameters, keeping
29
+ * the tab, sort and view parameters so clearing filters changes nothing else on the page.
30
+ *
31
+ * @param url The page's current URL.
32
+ * @param names Every filter parameter the page offers.
33
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
34
+ * @returns A same-origin path with the remaining query.
35
+ * @example clearFiltersHref("/issues?state=open&label=bug&q=crash", ["label", "q"]) // "/issues?state=open"
36
+ */
37
+ export declare function clearFiltersHref(url: URL | string, names: readonly string[], reset?: readonly string[]): string;
38
+ /**
39
+ * The link a single-choice control (a sort order, a refresh interval) points at: `url` with
40
+ * `name` set to `value` alone, or removed when `value` is `null` so the default applies.
41
+ *
42
+ * @param url The page's current URL.
43
+ * @param name The parameter to set.
44
+ * @param value Its new value; `null` removes it.
45
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
46
+ * @returns A same-origin path with the updated query.
47
+ * @example setParamHref("/monitors?status=down", "sort", "name") // "/monitors?status=down&sort=name"
48
+ */
49
+ export declare function setParamHref(url: URL | string, name: string, value: string | null, reset?: readonly string[]): string;
50
+ /**
51
+ * The parameters a GET form re-submits as hidden fields: every pair in `url` except the ones
52
+ * its own controls write and the position parameters, in their original order, so one form
53
+ * never erases what a sibling form or link put in the URL.
54
+ *
55
+ * @param url The page's current URL.
56
+ * @param owned Parameters the form's own controls write.
57
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
58
+ * @returns Name/value pairs, repeated names kept.
59
+ * @example carriedParams("/issues?state=open&label=bug&page=2", ["label"]) // [["state", "open"]]
60
+ */
61
+ export declare function carriedParams(url: URL | string, owned: readonly string[], reset?: readonly string[]): [name: string, value: string][];
62
+ /**
63
+ * Every value `url` holds for `name`, the way a repeated GET parameter arrives.
64
+ *
65
+ * @param url The page's current URL.
66
+ * @param name The parameter to read.
67
+ * @returns Its values in order; empty when absent.
68
+ */
69
+ export declare function paramValues(url: URL | string, name: string): string[];
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Builds the links and hidden fields a list's URL-held view needs: a link that drops one
3
+ * filter, one that clears them all, one that sets a single parameter, and the parameters a
4
+ * GET form must carry so submitting one control keeps the state every other control wrote.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /**
10
+ * Parameters that point at a position in a result set, dropped by every link here because a
11
+ * position in the old results means nothing once the query changes.
12
+ */
13
+ export const PAGINATION_PARAMS = ["page", "cursor"];
14
+ /**
15
+ * Origin a relative URL resolves against; only the path and query of the result are read.
16
+ */
17
+ const RELATIVE_BASE = "http://localhost";
18
+ /**
19
+ * Parses `url` whether it arrives absolute (a request URL) or as a path with a query.
20
+ *
21
+ * @param url The page's current URL.
22
+ * @returns A copy that is safe to change.
23
+ */
24
+ function toURL(url) {
25
+ return new URL(url.toString(), RELATIVE_BASE);
26
+ }
27
+ /**
28
+ * Writes `url` back as a same-origin path, so a link reads the same on any host and a hash
29
+ * pointing into the old results is dropped.
30
+ *
31
+ * @param url The changed URL.
32
+ * @returns The path, plus the query when one remains.
33
+ */
34
+ function toHref(url) {
35
+ let search = url.searchParams.toString();
36
+ return search ? `${url.pathname}?${search}` : url.pathname;
37
+ }
38
+ /**
39
+ * Deletes the position parameters in `reset` from `url` in place.
40
+ *
41
+ * @param url The URL being changed.
42
+ * @param reset Parameter names to drop.
43
+ */
44
+ function dropAll(url, reset) {
45
+ for (let name of reset)
46
+ url.searchParams.delete(name);
47
+ }
48
+ /**
49
+ * The link a filter chip's remove control points at: `url` without the `name` parameter, or
50
+ * without only its `value` when one is given, and back on the first page of results.
51
+ *
52
+ * @param url The page's current URL.
53
+ * @param name The filter's parameter.
54
+ * @param value The one value to drop; omitted drops every value of the parameter.
55
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
56
+ * @returns A same-origin path with the remaining query.
57
+ * @example removeFilterHref("/monitors?status=down&status=paused&page=3", "status", "down") // "/monitors?status=paused"
58
+ * @example removeFilterHref(request.url, "region") // every region value dropped
59
+ */
60
+ export function removeFilterHref(url, name, value, reset = PAGINATION_PARAMS) {
61
+ let next = toURL(url);
62
+ if (value === undefined)
63
+ next.searchParams.delete(name);
64
+ else
65
+ next.searchParams.delete(name, value);
66
+ dropAll(next, reset);
67
+ return toHref(next);
68
+ }
69
+ /**
70
+ * The link "Clear filters" points at: `url` without any of the `names` parameters, keeping
71
+ * the tab, sort and view parameters so clearing filters changes nothing else on the page.
72
+ *
73
+ * @param url The page's current URL.
74
+ * @param names Every filter parameter the page offers.
75
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
76
+ * @returns A same-origin path with the remaining query.
77
+ * @example clearFiltersHref("/issues?state=open&label=bug&q=crash", ["label", "q"]) // "/issues?state=open"
78
+ */
79
+ export function clearFiltersHref(url, names, reset = PAGINATION_PARAMS) {
80
+ let next = toURL(url);
81
+ for (let name of names)
82
+ next.searchParams.delete(name);
83
+ dropAll(next, reset);
84
+ return toHref(next);
85
+ }
86
+ /**
87
+ * The link a single-choice control (a sort order, a refresh interval) points at: `url` with
88
+ * `name` set to `value` alone, or removed when `value` is `null` so the default applies.
89
+ *
90
+ * @param url The page's current URL.
91
+ * @param name The parameter to set.
92
+ * @param value Its new value; `null` removes it.
93
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
94
+ * @returns A same-origin path with the updated query.
95
+ * @example setParamHref("/monitors?status=down", "sort", "name") // "/monitors?status=down&sort=name"
96
+ */
97
+ export function setParamHref(url, name, value, reset = PAGINATION_PARAMS) {
98
+ let next = toURL(url);
99
+ if (value === null)
100
+ next.searchParams.delete(name);
101
+ else
102
+ next.searchParams.set(name, value);
103
+ dropAll(next, reset);
104
+ return toHref(next);
105
+ }
106
+ /**
107
+ * The parameters a GET form re-submits as hidden fields: every pair in `url` except the ones
108
+ * its own controls write and the position parameters, in their original order, so one form
109
+ * never erases what a sibling form or link put in the URL.
110
+ *
111
+ * @param url The page's current URL.
112
+ * @param owned Parameters the form's own controls write.
113
+ * @param reset Position parameters to drop. Defaults to {@link PAGINATION_PARAMS}.
114
+ * @returns Name/value pairs, repeated names kept.
115
+ * @example carriedParams("/issues?state=open&label=bug&page=2", ["label"]) // [["state", "open"]]
116
+ */
117
+ export function carriedParams(url, owned, reset = PAGINATION_PARAMS) {
118
+ let skip = new Set([...owned, ...reset]);
119
+ return [...toURL(url).searchParams].filter(([name]) => !skip.has(name));
120
+ }
121
+ /**
122
+ * Every value `url` holds for `name`, the way a repeated GET parameter arrives.
123
+ *
124
+ * @param url The page's current URL.
125
+ * @param name The parameter to read.
126
+ * @returns Its values in order; empty when absent.
127
+ */
128
+ export function paramValues(url, name) {
129
+ return toURL(url)
130
+ .searchParams.getAll(name)
131
+ .filter((value) => value !== "");
132
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Merges the groups a keyboard help sheet is rendered with and the rows the page's shortcut
3
+ * registry holds, so a shortcut registered in the browser still reaches the sheet the server
4
+ * drew, and keys listed twice, under any label, appear once.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { Shortcuts } from "../behaviors/shortcuts.js";
10
+ import type { KeyboardHelp } from "../keyboard-help.js";
11
+ /**
12
+ * Merges the server's groups with the registry's rows, keeping the server's order and appending
13
+ * rows and groups it lacks. Keys decide what a shortcut is: a row whose every alternative is
14
+ * already listed is dropped, so the first label seen for those keys, the server's first, wins.
15
+ *
16
+ * @param groups The groups passed as props.
17
+ * @param entries The registry's rows.
18
+ * @param other The heading for rows that name no group.
19
+ * @returns The groups the sheet shows, empty groups dropped.
20
+ */
21
+ export declare function mergeShortcutGroups(groups: KeyboardHelp.Group[], entries: Shortcuts.Entry[], other: string): KeyboardHelp.Group[];
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Merges the groups a keyboard help sheet is rendered with and the rows the page's shortcut
3
+ * registry holds, so a shortcut registered in the browser still reaches the sheet the server
4
+ * drew, and keys listed twice, under any label, appear once.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { shortcutAlternatives } from "../behaviors/shortcuts.js";
10
+ /** One alternative as a comparable key, its sequence steps joined by single spaces. */
11
+ function normalizeAlternative(alternative) {
12
+ return alternative
13
+ .split(/\s+/)
14
+ .filter((step) => step !== "")
15
+ .join(" ");
16
+ }
17
+ /**
18
+ * Merges the server's groups with the registry's rows, keeping the server's order and appending
19
+ * rows and groups it lacks. Keys decide what a shortcut is: a row whose every alternative is
20
+ * already listed is dropped, so the first label seen for those keys, the server's first, wins.
21
+ *
22
+ * @param groups The groups passed as props.
23
+ * @param entries The registry's rows.
24
+ * @param other The heading for rows that name no group.
25
+ * @returns The groups the sheet shows, empty groups dropped.
26
+ */
27
+ export function mergeShortcutGroups(groups, entries, other) {
28
+ let merged = [];
29
+ let seen = new Set();
30
+ let add = (title, row) => {
31
+ let alternatives = shortcutAlternatives(row.keys).map(normalizeAlternative);
32
+ if (alternatives.every((key) => seen.has(key)))
33
+ return;
34
+ for (let key of alternatives)
35
+ seen.add(key);
36
+ let group = merged.find((candidate) => candidate.title === title);
37
+ if (group === undefined) {
38
+ group = { title, shortcuts: [] };
39
+ merged.push(group);
40
+ }
41
+ group.shortcuts.push(row);
42
+ };
43
+ for (let group of groups) {
44
+ if (!merged.some((candidate) => candidate.title === group.title)) {
45
+ merged.push({ title: group.title, shortcuts: [] });
46
+ }
47
+ for (let row of group.shortcuts)
48
+ add(group.title, row);
49
+ }
50
+ for (let entry of entries)
51
+ add(entry.group ?? other, { keys: entry.keys, label: entry.label });
52
+ return merged.filter((group) => group.shortcuts.length > 0);
53
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The split view's remembered layout: each resizable pane's share of the screen and
3
+ * which panes are collapsed, written to one cookie so the next server render draws the
4
+ * screen the way the reader left it, ahead of any script.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /** Cookie a split view stores its layout in unless it names its own. */
10
+ export declare const SPLIT_VIEW_COOKIE = "ui-split-view";
11
+ /** A split view's panes, in screen order. */
12
+ export type SplitViewPane = "sidebar" | "list" | "detail";
13
+ /** A split view's remembered layout. */
14
+ export interface SplitViewLayout {
15
+ /** The sidebar's share of the view's width, as a percentage. */
16
+ sidebar?: number;
17
+ /** The list's share of the view's width, as a percentage. */
18
+ list?: number;
19
+ /** Panes the reader collapsed: the sidebar to its rail, the list or detail out of view. */
20
+ collapsed: SplitViewPane[];
21
+ }
22
+ /**
23
+ * Writes a layout as the cookie's value: `sidebar:list:collapsed,panes`, sizes rounded to
24
+ * two decimals.
25
+ *
26
+ * @param layout The layout to store.
27
+ * @returns The cookie value.
28
+ * @example serializeSplitViewLayout({ sidebar: 18, list: 30, collapsed: ["sidebar"] }) // "18:30:sidebar"
29
+ */
30
+ export declare function serializeSplitViewLayout(layout: SplitViewLayout): string;
31
+ /**
32
+ * Reads a cookie value back into a layout, dropping any field that does not parse, so a
33
+ * tampered or stale cookie falls back to the default layout field by field.
34
+ *
35
+ * @param value The cookie's value.
36
+ * @returns The layout it stores.
37
+ */
38
+ export declare function parseSplitViewLayout(value: string): SplitViewLayout;
39
+ /**
40
+ * Reads a split view's layout from a request's `Cookie` header, for the server render
41
+ * that passes it to `SplitView` as `layout`.
42
+ *
43
+ * @param cookieHeader The request's `Cookie` header.
44
+ * @param name The cookie the view stores its layout in.
45
+ * @returns The stored layout, or `undefined` when the reader has none yet.
46
+ * @example <SplitView layout={readSplitViewLayout(request.headers.get("Cookie"))} … />
47
+ */
48
+ export declare function readSplitViewLayout(cookieHeader: string | null | undefined, name?: string): SplitViewLayout | undefined;