@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
@@ -147,8 +147,12 @@ export declare namespace Chart {
147
147
  interface LinePoint {
148
148
  /** Horizontal data value, mapped across the ancestor {@link Chart}'s `xDomain`. */
149
149
  x: number;
150
- /** Vertical data value, mapped across the ancestor {@link Chart}'s `yDomain`. */
151
- y: number;
150
+ /**
151
+ * Vertical data value, mapped across the ancestor {@link Chart}'s `yDomain`. `null` records
152
+ * a sample with no data: the line breaks around it and it gets no marker, while every other
153
+ * point keeps its `x` position, so series sharing an `xDomain` stay aligned.
154
+ */
155
+ y: number | null;
152
156
  /**
153
157
  * Accessible name and hover tooltip text for this point, read by the
154
158
  * native `<title>` nested in its marker when the point falls among the
@@ -164,12 +168,17 @@ export declare namespace Chart {
164
168
  interface LineProps extends Omit<TagProps<"g">, "children" | "points"> {
165
169
  /**
166
170
  * The series' data points, in draw order along `x`. The plotted path
167
- * connects every point given here; the accessible markers render on
168
- * only a representative spread of them, chosen through `markerCount`.
171
+ * connects every point with data, breaking at each `null` one; the accessible
172
+ * markers render on a representative spread of them, chosen through `markerCount`.
169
173
  */
170
174
  points: readonly LinePoint[];
171
175
  /** Categorical color. Defaults to {@link DEFAULT_LINE_COLOR}. */
172
176
  color?: Color;
177
+ /**
178
+ * Draws the series as the comparison period, dashed and muted behind the current one,
179
+ * in `--ui-chart-comparison-color` with `--ui-chart-comparison-dash`; `color` is unused.
180
+ */
181
+ comparison?: boolean;
173
182
  /**
174
183
  * Approximate number of accessible, hoverable markers placed along
175
184
  * `points`. Each marker snaps to the point closest to one of this many
@@ -197,8 +206,11 @@ export declare namespace Chart {
197
206
  interface AreaPoint {
198
207
  /** Horizontal data value, mapped across the ancestor {@link Chart}'s `xDomain`. */
199
208
  x: number;
200
- /** Vertical data value, mapped across the ancestor {@link Chart}'s `yDomain`. */
201
- y: number;
209
+ /**
210
+ * Vertical data value, mapped across the ancestor {@link Chart}'s `yDomain`. `null` records
211
+ * a sample with no data: the filled region breaks around it and it gets no marker.
212
+ */
213
+ y: number | null;
202
214
  /**
203
215
  * Accessible name and hover tooltip text for this point, read by the
204
216
  * native `<title>` nested in its marker when the point falls among the
@@ -340,12 +352,52 @@ export declare namespace Chart {
340
352
  interface ValueProps extends TagProps<"span"> {
341
353
  }
342
354
  }
355
+ /** Semantic role a {@link Chart.Threshold} or {@link Chart.Band} is drawn in. */
356
+ type Tone = "brand" | "neutral" | "success" | "warning" | "danger";
357
+ /** Props accepted by {@link Chart.Threshold}. */
358
+ interface ThresholdProps extends Omit<TagProps<"g">, "children"> {
359
+ /** The value the line marks, mapped across the ancestor {@link Chart}'s `yDomain`. */
360
+ y: number;
361
+ /** Text set at the line's end ("SLO 300 ms"), also its accessible name. */
362
+ label?: string;
363
+ /** @default "danger" */
364
+ tone?: Tone;
365
+ }
366
+ /** Props accepted by {@link Chart.Band}. */
367
+ interface BandProps extends Omit<TagProps<"g">, "children"> {
368
+ /** Where the range starts, mapped across the ancestor {@link Chart}'s `xDomain`. */
369
+ from: number;
370
+ /** Where the range ends, on the same scale as `from`. */
371
+ to: number;
372
+ /**
373
+ * Text set in a tag at the band's top start ("Incident #42", "Deploy"), also its accessible
374
+ * name. The tag renders at the same size however wide the chart is drawn.
375
+ */
376
+ label?: string;
377
+ /**
378
+ * `"hatched"` draws the range with the hatch {@link Chart.Bar} uses for a `null` value, so a
379
+ * stretch with no data (an outage window nothing was recorded for) reads as unknown.
380
+ *
381
+ * @default "fill"
382
+ */
383
+ variant?: "fill" | "hatched";
384
+ /**
385
+ * Colour of the edge rules, the label tag and, for `variant="fill"`, the shading.
386
+ *
387
+ * @default "danger" ("neutral" when `variant` is "hatched")
388
+ */
389
+ tone?: Tone;
390
+ }
343
391
  /**
344
392
  * A single series' plotted value at one {@link Chart.BarRow}'s category.
345
393
  */
346
394
  interface BarValue {
347
- /** Numeric magnitude this bar represents, mapped across {@link Chart.BarProps.domain}. */
348
- value: number;
395
+ /**
396
+ * Numeric magnitude this bar represents, mapped across {@link Chart.BarProps.domain}.
397
+ * `null` records a period with no data, drawn as a full-height hatched bar so it never
398
+ * reads as zero.
399
+ */
400
+ value: number | null;
349
401
  /**
350
402
  * Accessible name and hover tooltip text for this bar, read by the
351
403
  * native `<title>` nested inside it — typically a formatted description of
@@ -454,6 +506,8 @@ export declare namespace Chart {
454
506
  var Legend: typeof ChartLegend;
455
507
  var Line: (handle: Handle<Chart.LineProps>) => () => import("remix/component").RemixElement;
456
508
  var Area: (handle: Handle<Chart.AreaProps>) => () => import("remix/component").RemixElement;
509
+ var Threshold: (handle: Handle<Chart.ThresholdProps>) => () => import("remix/component").RemixElement;
510
+ var Band: (handle: Handle<Chart.BandProps>) => () => import("remix/component").RemixElement;
457
511
  var Pie: (handle: Handle<Chart.PieProps>) => () => import("remix/component").RemixElement;
458
512
  var Bar: (handle: Handle<Chart.BarProps>) => () => import("remix/component").RemixElement;
459
513
  }
package/dist/app/chart.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
2
2
  import { visuallyHidden } from "@sdxc/u/a11y";
3
3
  import { bg, fg, fill, fillOpacity, outline, stroke, strokeLinecap, strokeLinejoin, strokeWidth, vectorEffect, } from "@sdxc/u/color";
4
4
  import { opacity, rounded, shadow, transition, transitionDuration } from "@sdxc/u/effects";
@@ -169,17 +169,39 @@ export function Chart(handle) {
169
169
  return () => {
170
170
  let { width, height, xDomain, yDomain, mix, ...rest } = handle.props;
171
171
  handle.context.set({ width, height, xDomain, yDomain });
172
- return (_jsx("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", ...rest, mix: mergeMix([legendToggle(), block(), is("full"), bs("auto")], mix) }));
172
+ return (_jsx("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", ...rest, mix: mergeMix([
173
+ legendToggle(),
174
+ block(),
175
+ is("full"),
176
+ bs("auto"),
177
+ raw({ container: "ui-chart / inline-size", aspectRatio: `${width} / ${height}` }),
178
+ ], mix) }));
173
179
  };
174
180
  }
175
181
  Chart.Legend = ChartLegend;
182
+ /**
183
+ * Maps a series' data points onto pixels, keeping a `null` slot for every point with no data
184
+ * so the path builders break the series there and the markers skip it.
185
+ */
186
+ function scalePoints(points, x, y) {
187
+ return points.map((point) => (point.y === null ? null : { x: x(point.x), y: y(point.y) }));
188
+ }
189
+ /**
190
+ * The hatch every no-data mark fills with — a {@link Chart.Bar} with a `null` value and a
191
+ * hatched {@link Chart.Band} — so "unknown" reads the same wherever a chart shows it.
192
+ *
193
+ * @param id The pattern's id, unique on the page, which the hatched shape fills with as `url(#id)`.
194
+ */
195
+ function renderNoDataPattern(id) {
196
+ return (_jsx("defs", { children: _jsx("pattern", { id: id, width: 6, height: 6, patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)", children: _jsx("line", { x1: 0, y1: 0, x2: 0, y2: 6, mix: [stroke("var(--ui-neutral-border, GrayText)"), strokeWidth("2")] }) }) }));
197
+ }
176
198
  /**
177
199
  * Renders one series' representative point markers: a small focusable
178
200
  * `<circle>` at each of `markerIndices`' scaled positions, nested with a
179
201
  * `<title>` carrying that point's own `label`.
180
202
  *
181
203
  * @param points The series' original data points, read for each marker's label.
182
- * @param scaledPoints Each point's already-scaled pixel position, in the same order as `points`.
204
+ * @param scaledPoints Each point's already-scaled pixel position, in the same order as `points`; `null` for a point with no data, which gets no marker.
183
205
  * @param markerIndices Which of `points`' indices to render a marker for.
184
206
  * @param markerMix Additional mixin(s) layered after each marker's own built-in styling.
185
207
  * @returns The rendered `<circle>` markers.
@@ -188,7 +210,7 @@ function renderChartMarkers(points, scaledPoints, markerIndices, markerMix) {
188
210
  return markerIndices.map((index) => {
189
211
  let point = points[index];
190
212
  let position = scaledPoints[index];
191
- if (point === undefined || position === undefined)
213
+ if (point === undefined || position === undefined || position === null)
192
214
  return null;
193
215
  return (_jsx("circle", { cx: position.x, cy: position.y, tabIndex: 0, role: "img", mix: [
194
216
  focusVisible(outline({ color: "brand.ring", offset: 2 })),
@@ -220,22 +242,35 @@ function renderChartMarkers(points, scaledPoints, markerIndices, markerMix) {
220
242
  */
221
243
  Chart.Line = function ChartLine(handle) {
222
244
  return () => {
223
- let { points, color, markerCount, parts, mix, ...rest } = handle.props;
245
+ let { points, color, comparison, markerCount, parts, mix, ...rest } = handle.props;
224
246
  let context = handle.context.get(Chart);
225
247
  let resolvedColor = color ?? DEFAULT_LINE_COLOR;
226
248
  let resolvedMarkerCount = markerCount ?? DEFAULT_MARKER_COUNT;
227
249
  let x = linearScale(context.xDomain, [0, context.width]);
228
250
  let y = linearScale(context.yDomain, [context.height, 0]);
229
- let scaledPoints = points.map((point) => ({ x: x(point.x), y: y(point.y) }));
251
+ let scaledPoints = scalePoints(points, x, y);
230
252
  let d = linePath(scaledPoints);
231
253
  let markerIndices = computeMarkerIndices(points, context.xDomain, resolvedMarkerCount);
232
- return (_jsxs("g", { "data-color": String(resolvedColor), ...rest, mix: mergeMix(chartPalette("color"), mix), children: [_jsx("path", { d: d, mix: [
254
+ return (_jsxs("g", { "data-color": comparison ? undefined : String(resolvedColor), "data-comparison": comparison ? "" : undefined, ...rest, mix: mergeMix([
255
+ chartPalette("color"),
256
+ comparison
257
+ ? raw({
258
+ color: "var(--ui-chart-comparison-color, var(--ui-neutral-fg-muted, GrayText))",
259
+ })
260
+ : undefined,
261
+ ], mix), children: [_jsx("path", { d: d, mix: [
233
262
  attrs({ "aria-hidden": DEFAULT_PATH_ARIA_HIDDEN }),
234
263
  fill("none"),
235
264
  stroke("currentColor"),
236
265
  strokeWidth("var(--ui-chart-line-width, 2px)"),
237
266
  strokeLinejoin("round"),
238
267
  strokeLinecap("round"),
268
+ comparison
269
+ ? raw({
270
+ strokeDasharray: "var(--ui-chart-comparison-dash, 4 4)",
271
+ vectorEffect: "non-scaling-stroke",
272
+ })
273
+ : undefined,
239
274
  parts?.path,
240
275
  ] }), renderChartMarkers(points, scaledPoints, markerIndices, parts?.marker)] }));
241
276
  };
@@ -380,7 +415,7 @@ Chart.Area = function ChartArea(handle) {
380
415
  let resolvedMarkerCount = markerCount ?? DEFAULT_MARKER_COUNT;
381
416
  let x = linearScale(context.xDomain, [0, context.width]);
382
417
  let y = linearScale(context.yDomain, [context.height, 0]);
383
- let scaledPoints = points.map((point) => ({ x: x(point.x), y: y(point.y) }));
418
+ let scaledPoints = scalePoints(points, x, y);
384
419
  let d = areaPath(scaledPoints, y(resolvedBaseline));
385
420
  let markerIndices = computeMarkerIndices(points, context.xDomain, resolvedMarkerCount);
386
421
  return (_jsxs("g", { "data-color": String(resolvedColor), ...rest, mix: mergeMix(chartPalette("color"), mix), children: [_jsx("path", { d: d, mix: [
@@ -395,6 +430,157 @@ Chart.Area = function ChartArea(handle) {
395
430
  ] }), renderChartMarkers(points, scaledPoints, markerIndices, parts?.marker)] }));
396
431
  };
397
432
  };
433
+ /**
434
+ * Stroke and fill colour for each {@link Chart.Tone}, read through `currentColor` by a
435
+ * threshold's line and label and a band's fill and label, which let the pointer through to
436
+ * the series beneath.
437
+ */
438
+ function toneColor() {
439
+ return raw({
440
+ pointerEvents: "none",
441
+ color: "var(--ui-danger-fg)",
442
+ '&[data-tone="brand"]': { color: "var(--ui-brand-fg)" },
443
+ '&[data-tone="neutral"]': { color: "var(--ui-neutral-fg-muted)" },
444
+ '&[data-tone="success"]': { color: "var(--ui-success-fg)" },
445
+ '&[data-tone="warning"]': { color: "var(--ui-warning-fg)" },
446
+ });
447
+ }
448
+ /**
449
+ * Marks a value the series should stay under or over: a dashed line across the plot at `y`,
450
+ * with `label` set at its end. Render it inside {@link Chart}, after the series it judges.
451
+ *
452
+ * @param handle Runtime handle carrying the host `<g>`'s props.
453
+ * @returns The render function producing the threshold's markup.
454
+ * @example
455
+ * <Chart.Threshold y={300} label={t("chart.slo", { ms: 300 })} tone="warning" />
456
+ */
457
+ Chart.Threshold = function ChartThreshold(handle) {
458
+ return () => {
459
+ let { y: value, label, tone, mix, ...rest } = handle.props;
460
+ let context = handle.context.get(Chart);
461
+ let y = linearScale(context.yDomain, [context.height, 0])(value);
462
+ return (_jsxs("g", { "data-slot": "chart-threshold", "data-tone": tone ?? "danger", role: label ? "img" : undefined, "aria-label": label, "aria-hidden": label ? undefined : "true", ...rest, mix: mergeMix(toneColor(), mix), children: [_jsx("line", { x1: 0, x2: context.width, y1: y, y2: y, mix: [
463
+ stroke("currentColor"),
464
+ strokeWidth("var(--ui-chart-threshold-width, 1px)"),
465
+ vectorEffect("non-scaling-stroke"),
466
+ raw({ strokeDasharray: "var(--ui-chart-threshold-dash, 6 4)" }),
467
+ ] }), label ? (_jsx("text", { "aria-hidden": "true", x: context.width - 4, y: y - 4, "text-anchor": "end", mix: [fill("currentColor"), raw({ fontSize: "var(--ui-chart-annotation-size, 11px)" })], children: label })) : null] }));
468
+ };
469
+ };
470
+ /**
471
+ * Shading for a `variant="fill"` band: the tone at `--ui-chart-band-opacity` in a light colour
472
+ * scheme and `--ui-chart-band-opacity-dark` in a dark one, light enough that the series over
473
+ * it keep their full contrast.
474
+ */
475
+ const BAND_FILL = [
476
+ "light-dark(",
477
+ "color-mix(in srgb, currentColor calc(var(--ui-chart-band-opacity, 0.08) * 100%), transparent),",
478
+ "color-mix(in srgb, currentColor calc(var(--ui-chart-band-opacity-dark, 0.12) * 100%), transparent)",
479
+ ")",
480
+ ].join(" ");
481
+ /**
482
+ * The band label's font size in the chart's own units: the annotation size divided by how much
483
+ * the chart root draws its coordinate space scaled (its container width over `width`), so the
484
+ * label renders at the annotation size whatever width the chart is drawn at.
485
+ */
486
+ function bandLabelSize(width) {
487
+ return `calc(var(--ui-chart-annotation-size, 11px) / tan(atan2(100cqi, ${width}px)))`;
488
+ }
489
+ /**
490
+ * The background and ink of a band's label tag for each {@link Chart.Tone}, published on the
491
+ * band for its tag to read: the tone's tint deepened with a little of the tone, so the tag
492
+ * stands out from the band, under the tone's emphasis text at 4.5:1 or more in either scheme.
493
+ */
494
+ function bandLabelTone() {
495
+ let tones = [
496
+ ["brand", "--ui-brand-fg"],
497
+ ["neutral", "--ui-neutral-fg-muted"],
498
+ ["success", "--ui-success-fg"],
499
+ ["warning", "--ui-warning-fg"],
500
+ ];
501
+ return raw({
502
+ "--chart-band-label-bg": "color-mix(in srgb, var(--ui-danger-fg) 16%, var(--ui-danger-bg-tint))",
503
+ "--chart-band-label-fg": "var(--ui-danger-fg-emphasis)",
504
+ ...Object.fromEntries(tones.map(([tone, ink]) => [
505
+ `&[data-tone="${tone}"]`,
506
+ {
507
+ "--chart-band-label-bg": `color-mix(in srgb, var(${ink}) 16%, var(--ui-${tone}-bg-tint))`,
508
+ "--chart-band-label-fg": `var(--ui-${tone}-fg-emphasis)`,
509
+ },
510
+ ])),
511
+ });
512
+ }
513
+ /**
514
+ * A band's label tag: the label set over a tint filling exactly its text box, which a filter
515
+ * paints behind the glyphs so the tag fits the label at any length. An en space on each side
516
+ * widens that box into the tag's padding.
517
+ *
518
+ * @param id The tint filter's id, unique on the page.
519
+ * @param label The text the tag shows.
520
+ * @param x The band edge the tag is tied to, in the chart's coordinate space.
521
+ * @param width The chart's coordinate width, which the tag's size is counter-scaled against.
522
+ * @param anchor `"end"` sets the tag's end at `x`, extending back toward the band's start.
523
+ */
524
+ function renderBandLabel(id, label, x, width, anchor) {
525
+ return (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsxs("filter", { id: id, x: 0, y: 0, width: 1, height: 1, children: [_jsx("feFlood", { mix: raw({ floodColor: "var(--chart-band-label-bg, Canvas)" }) }), _jsxs("feMerge", { children: [_jsx("feMergeNode", {}), _jsx("feMergeNode", { in: "SourceGraphic" })] })] }) }), _jsx("text", { "data-slot": "chart-band-label", "aria-hidden": "true", x: x, y: 0, dx: anchor === "end" ? "-0.25em" : "0.25em", dy: "1.4em", "text-anchor": anchor, filter: `url(#${id})`, mix: [
526
+ fill("var(--chart-band-label-fg, CanvasText)"),
527
+ weight("medium"),
528
+ raw({ fontSize: bandLabelSize(width), whiteSpace: "pre" }),
529
+ ], children: `\u2002${label}\u2002` })] }));
530
+ }
531
+ /**
532
+ * Ties a band's label tag to the band edge with the most plot beside it: the start for a band
533
+ * starting in the plot's first half, else the band's end, so a band near the end of the axis
534
+ * keeps its tag inside the plot at any rendered width up to a tag half the plot wide.
535
+ *
536
+ * @param start The band's start in the chart's coordinate space.
537
+ * @param end The band's end in the chart's coordinate space.
538
+ */
539
+ function renderBandLabelAt(id, label, start, end, width) {
540
+ if (start <= width / 2)
541
+ return renderBandLabel(id, label, Math.max(start, 0), width, "start");
542
+ return renderBandLabel(id, label, Math.min(end, width), width, "end");
543
+ }
544
+ /**
545
+ * A dashed rule across the plot's full height marking one edge of a band.
546
+ *
547
+ * @param edge Which edge the rule marks, written to `data-edge`.
548
+ * @param x The edge's position in the chart's coordinate space.
549
+ * @param height The plot's height, which the rule spans.
550
+ */
551
+ function renderBandEdge(edge, x, height) {
552
+ return (_jsx("line", { "data-slot": "chart-band-edge", "data-edge": edge, x1: x, x2: x, y1: 0, y2: height, mix: [
553
+ stroke("currentColor"),
554
+ strokeWidth("var(--ui-chart-band-edge-width, 1px)"),
555
+ vectorEffect("non-scaling-stroke"),
556
+ raw({ strokeDasharray: "var(--ui-chart-band-edge-dash, 4 3)" }),
557
+ ] }));
558
+ }
559
+ /**
560
+ * Marks a stretch of the x axis (an incident, a deploy, or hatched, a gap with no data): a light
561
+ * shade, dashed edge rules, `label` tagged at its top start, or top end once it starts past the
562
+ * plot's middle. A range running to the end of `xDomain` has no end rule. Render it before the series.
563
+ *
564
+ * @param handle Runtime handle carrying the host `<g>`'s props.
565
+ * @returns The render function producing the band's markup.
566
+ * @example
567
+ * <Chart.Band from={incident.start} to={incident.end} label={t("chart.incident", { id: 42 })} />
568
+ * @example
569
+ * <Chart.Band from={outage.start} to={outage.end} label={t("chart.noData")} variant="hatched" />
570
+ */
571
+ Chart.Band = function ChartBand(handle) {
572
+ return () => {
573
+ let { from, to, label, variant, tone, mix, ...rest } = handle.props;
574
+ let context = handle.context.get(Chart);
575
+ let x = linearScale(context.xDomain, [0, context.width]);
576
+ let start = Math.min(x(from), x(to));
577
+ let end = Math.max(x(from), x(to));
578
+ let hatched = variant === "hatched";
579
+ let hatchId = `${handle.id}-no-data`;
580
+ let resolvedTone = tone ?? (hatched ? "neutral" : "danger");
581
+ return (_jsxs("g", { "data-slot": "chart-band", "data-variant": hatched ? "hatched" : undefined, "data-tone": resolvedTone, role: label ? "img" : undefined, "aria-label": label, "aria-hidden": label ? undefined : "true", ...rest, mix: mergeMix([toneColor(), bandLabelTone()], mix), children: [hatched ? renderNoDataPattern(hatchId) : null, _jsx("rect", { x: start, y: 0, width: Math.max(end - start, 1), height: context.height, fill: hatched ? `url(#${hatchId})` : undefined, mix: hatched ? undefined : raw({ fill: BAND_FILL }) }), start > 0 ? renderBandEdge("start", start, context.height) : null, end < context.width ? renderBandEdge("end", end, context.height) : null, label ? renderBandLabelAt(`${handle.id}-label`, label, start, end, context.width) : null] }));
582
+ };
583
+ };
398
584
  /**
399
585
  * Renders a pie or donut chart: an independent `<svg>` root, since a
400
586
  * circular layout shares no domain with a Cartesian {@link Chart}. A paired
@@ -516,7 +702,9 @@ Chart.Bar = function ChartBar(handle) {
516
702
  let y = linearScale(domain, [height, 0]);
517
703
  let baselineY = y(0);
518
704
  let gridlineValues = ticks(domain, resolvedTickCount);
519
- return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", ...rest, mix: mergeMix([chartPalette("fill", " "), legendToggle(), block(), is("full"), bs("auto")], mix), children: [_jsx("g", { mix: [attrs({ "aria-hidden": DEFAULT_PATH_ARIA_HIDDEN })], children: gridlineValues.map((value) => (_jsx("line", { x1: 0, x2: width, y1: y(value), y2: y(value), mix: [
705
+ let hatchId = `${handle.id}-no-data`;
706
+ let hasEmpty = data.some((row) => series.some((key) => row.values[key]?.value === null));
707
+ return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", ...rest, mix: mergeMix([chartPalette("fill", " "), legendToggle(), block(), is("full"), bs("auto")], mix), children: [hasEmpty ? renderNoDataPattern(hatchId) : null, _jsx("g", { mix: [attrs({ "aria-hidden": DEFAULT_PATH_ARIA_HIDDEN })], children: gridlineValues.map((value) => (_jsx("line", { x1: 0, x2: width, y1: y(value), y2: y(value), mix: [
520
708
  stroke("var(--ui-neutral-border)"),
521
709
  strokeWidth("1"),
522
710
  vectorEffect("non-scaling-stroke"),
@@ -530,6 +718,16 @@ Chart.Bar = function ChartBar(handle) {
530
718
  if (entry === undefined)
531
719
  return null;
532
720
  let barX = categoryX + (inner.position(key) ?? 0);
721
+ if (entry.value === null) {
722
+ return (_jsx("rect", { x: barX, y: 0, width: inner.bandwidth, height: height, fill: `url(#${hatchId})`, "data-empty": "", "data-series-index": String(index), tabIndex: 0, role: "img", mix: [
723
+ stroke("var(--ui-neutral-border, GrayText)"),
724
+ strokeWidth("1"),
725
+ vectorEffect("non-scaling-stroke"),
726
+ focusVisible(outline({ color: "brand.ring", offset: 2 })),
727
+ cursor("default"),
728
+ parts?.bar,
729
+ ], children: _jsx("title", { children: entry.label }) }, `${row.category}:${key}`));
730
+ }
533
731
  let barValueY = y(entry.value);
534
732
  let rectY = Math.min(baselineY, barValueY);
535
733
  let rectHeight = Math.abs(barValueY - baselineY);
@@ -0,0 +1,132 @@
1
+ /**
2
+ * The app's ⌘K command palette: a modal dialog the server fills with commands that act (links,
3
+ * buttons that submit a form or invoke a command, pages of further commands) and a small island
4
+ * that filters them by title and keywords, moves the active row, and remembers recent picks.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
10
+ import { Button } from "../components/button.js";
11
+ import type { PaletteController } from "./mixins/command-palette.js";
12
+ /**
13
+ * Types for {@link CommandPalette} and its parts.
14
+ */
15
+ export declare namespace CommandPalette {
16
+ /** Every string the palette shows or announces. */
17
+ interface Labels {
18
+ /** The dialog's accessible name, e.g. "Command menu". */
19
+ title: string;
20
+ /** The help-sheet label of the key that opens it, e.g. "Open command menu". */
21
+ open: string;
22
+ /** Names the scope being searched, e.g. "Search monitors or run a command…". */
23
+ placeholder: string;
24
+ /** Heading over the recent commands shown before typing. */
25
+ recent: string;
26
+ /** Leads the no-results message, which quotes the query after it. */
27
+ noResults: string;
28
+ /** A recovery step under the no-results message. */
29
+ noResultsHint?: string;
30
+ /** The announced result count, with `{count}` replaced, e.g. "{count} results". */
31
+ results: string;
32
+ /** Names the control that goes back from a nested page. */
33
+ back: string;
34
+ /** Names the Esc control that closes the palette. */
35
+ close: string;
36
+ }
37
+ /** Props for {@link CommandPalette}. */
38
+ interface Props extends Omit<TagProps<"dialog">, "children"> {
39
+ /** The dialog's `id`, which a trigger's `commandfor` names. */
40
+ id: string;
41
+ labels: Labels;
42
+ /** The combo that toggles the palette from anywhere on the page. @default "mod+k" */
43
+ shortcut?: string;
44
+ /** Ids of commands to offer under Recent before anything is typed, most recent first. */
45
+ recent?: string[];
46
+ /** A `localStorage` key under which the palette remembers the commands run from it. */
47
+ remember?: string;
48
+ /** {@link CommandPalette.Group}s, loose {@link CommandPalette.Item}s and {@link CommandPalette.Page}s. */
49
+ children: RemixNode;
50
+ }
51
+ /** Props for {@link CommandPalette.Group}. */
52
+ interface GroupProps extends TagProps<"div"> {
53
+ /** Title Case heading, e.g. "Navigation". */
54
+ heading: string;
55
+ children: RemixNode;
56
+ }
57
+ /** Props for {@link CommandPalette.Item}. */
58
+ interface ItemProps {
59
+ /** A document-unique id, which `recent` and the remembered list name. */
60
+ id: string;
61
+ /** Title Case verb and noun, e.g. "Create Monitor". */
62
+ title: string;
63
+ /** Other words that find it, e.g. aliases and the old name. */
64
+ keywords?: string[];
65
+ /** A short muted line after the title. */
66
+ description?: string;
67
+ /** A combo or sequence the item shows as a hint and binds on the page, e.g. `"g m"`. */
68
+ shortcut?: string;
69
+ icon?: RemixNode;
70
+ /** Makes the item a link. */
71
+ href?: string;
72
+ /** The `id` of a form the item submits. */
73
+ form?: string;
74
+ formaction?: string;
75
+ formmethod?: "get" | "post";
76
+ /** The submitted button's name and value. */
77
+ name?: string;
78
+ value?: string;
79
+ /** An Invoker Command the item sends, e.g. `"--copy-account-id"`, to {@link ItemProps.commandfor}. */
80
+ command?: string;
81
+ commandfor?: string;
82
+ /** The {@link CommandPalette.Page} the item opens. */
83
+ page?: string;
84
+ mix?: TagProps<"div">["mix"];
85
+ }
86
+ /** Props for {@link CommandPalette.Page}. */
87
+ interface PageProps {
88
+ /** The id items open it by. */
89
+ id: string;
90
+ /** Shown beside the search field while the page is open. */
91
+ title: string;
92
+ /** Replaces the root placeholder while the page is open. */
93
+ placeholder?: string;
94
+ children: RemixNode;
95
+ }
96
+ /** Props for {@link CommandPalette.Trigger}. */
97
+ interface TriggerProps extends Omit<Button.Props, "commandfor" | "command"> {
98
+ /** The palette's `id`. */
99
+ for: string;
100
+ /** The combo the trigger advertises. @default "mod+k" */
101
+ shortcut?: string;
102
+ children: RemixNode;
103
+ }
104
+ /** Props for {@link CommandPaletteController}; plain data, since they cross into the browser. */
105
+ type ControllerProps = PaletteController.Options;
106
+ }
107
+ /**
108
+ * Renders the palette: a modal dialog 640px wide, 15% from the top, full width less a gutter on
109
+ * a phone. Without JavaScript a trigger still opens it and every command stays a working link
110
+ * or button; the island adds filtering, arrow keys, pages and the ⌘K binding.
111
+ *
112
+ * @param handle Runtime handle carrying the palette's props.
113
+ * @returns The render function producing the palette.
114
+ * @example
115
+ * <CommandPalette id="palette" labels={labels} recent={["go-monitors"]}>
116
+ * <CommandPalette.Group heading="Navigation">
117
+ * <CommandPalette.Item id="go-monitors" title="Go to Monitors" href="/monitors" shortcut="g m" />
118
+ * </CommandPalette.Group>
119
+ * </CommandPalette>
120
+ */
121
+ export declare function CommandPalette(handle: Handle<CommandPalette.Props>): () => import("remix/component").RemixElement;
122
+ export declare namespace CommandPalette {
123
+ var Group: (handle: Handle<CommandPalette.GroupProps>) => () => import("remix/component").RemixElement;
124
+ var Item: (handle: Handle<CommandPalette.ItemProps>) => () => import("remix/component").RemixElement;
125
+ var Page: (handle: Handle<CommandPalette.PageProps>) => () => import("remix/component").RemixElement;
126
+ var Trigger: (handle: Handle<CommandPalette.TriggerProps>) => () => import("remix/component").RemixElement;
127
+ }
128
+ /**
129
+ * The palette's island: renders nothing visible, and wires the dialog it sits in once loaded.
130
+ * `CommandPalette` places it; load `@sdxc/ui/app/command-palette` in the browser entry.
131
+ */
132
+ export declare const CommandPaletteController: EntryComponent<CommandPalette.ControllerProps>;