dssoca 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +3 -3
  2. package/dist/chart-nav.d.ts +13 -0
  3. package/dist/chart-nav.js +35 -0
  4. package/dist/components/Accordion.svelte +7 -2
  5. package/dist/components/Badge.svelte +12 -7
  6. package/dist/components/Badge.svelte.d.ts +2 -1
  7. package/dist/components/BoxPlot.svelte +33 -7
  8. package/dist/components/BumpChart.svelte +68 -26
  9. package/dist/components/Button.svelte +23 -1
  10. package/dist/components/Button.svelte.d.ts +5 -1
  11. package/dist/components/Card.svelte +32 -14
  12. package/dist/components/Card.svelte.d.ts +4 -1
  13. package/dist/components/Chart.svelte +169 -32
  14. package/dist/components/Chart.svelte.d.ts +13 -1
  15. package/dist/components/DateField.svelte +1 -1
  16. package/dist/components/FileDrop.svelte +81 -14
  17. package/dist/components/FileDrop.svelte.d.ts +6 -0
  18. package/dist/components/Heatmap.svelte +128 -50
  19. package/dist/components/Heatmap.svelte.d.ts +2 -1
  20. package/dist/components/Icon.svelte +12 -3
  21. package/dist/components/Icon.svelte.d.ts +4 -0
  22. package/dist/components/Input.svelte +3 -3
  23. package/dist/components/Link.svelte +25 -14
  24. package/dist/components/LogStream.svelte +34 -9
  25. package/dist/components/Menu.svelte +12 -8
  26. package/dist/components/Menu.svelte.d.ts +2 -2
  27. package/dist/components/MetricTile.svelte +11 -1
  28. package/dist/components/MetricTile.svelte.d.ts +6 -0
  29. package/dist/components/Modal.svelte +47 -7
  30. package/dist/components/Modal.svelte.d.ts +11 -3
  31. package/dist/components/NumberField.svelte +33 -10
  32. package/dist/components/Pagination.svelte +7 -4
  33. package/dist/components/ScatterPlot.svelte +44 -7
  34. package/dist/components/SearchPalette.svelte +99 -23
  35. package/dist/components/SearchPalette.svelte.d.ts +5 -0
  36. package/dist/components/SegmentedControl.svelte +14 -5
  37. package/dist/components/Select.svelte +3 -4
  38. package/dist/components/ServiceCard.svelte +105 -68
  39. package/dist/components/ServiceCard.svelte.d.ts +8 -3
  40. package/dist/components/ShortcutsHelp.svelte +1 -1
  41. package/dist/components/Sidebar.svelte +41 -58
  42. package/dist/components/Switch.svelte +4 -8
  43. package/dist/components/Table.svelte +20 -13
  44. package/dist/components/Table.svelte.d.ts +6 -2
  45. package/dist/components/Textarea.svelte +1 -1
  46. package/dist/components/TierList.svelte +9 -13
  47. package/dist/components/Toaster.svelte +143 -21
  48. package/dist/components/Tooltip.svelte +101 -13
  49. package/dist/components/Tooltip.svelte.d.ts +1 -1
  50. package/dist/components/Topbar.svelte +21 -16
  51. package/dist/icons.d.ts +19 -2
  52. package/dist/icons.js +42 -3
  53. package/dist/index.d.ts +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/tierlist-core.d.ts +15 -5
  56. package/dist/tierlist-core.js +30 -7
  57. package/dist/vanilla/accordion.js +7 -3
  58. package/dist/vanilla/fields.js +19 -6
  59. package/dist/vanilla/index.d.ts +1 -1
  60. package/dist/vanilla/index.js +4 -4
  61. package/dist/vanilla/menu.js +12 -1
  62. package/dist/vanilla/modal.d.ts +4 -0
  63. package/dist/vanilla/modal.js +57 -2
  64. package/dist/vanilla/segmented.js +13 -4
  65. package/dist/vanilla/tierlist.js +7 -11
  66. package/dist/vanilla/toast.d.ts +11 -3
  67. package/dist/vanilla/toast.js +124 -10
  68. package/dist/vanilla/tooltip.d.ts +5 -1
  69. package/dist/vanilla/tooltip.js +57 -10
  70. package/dist/vanilla.css +326 -118
  71. package/package.json +1 -1
@@ -2,6 +2,7 @@
2
2
  import { scaleLinear } from 'd3-scale'
3
3
  import { extent } from 'd3-array'
4
4
  import { resolveComponentSize, type Size } from '../config.js'
5
+ import { chartNavStep } from '../chart-nav.js'
5
6
 
6
7
  interface Props {
7
8
  /** Row labels, top→bottom. */
@@ -14,7 +15,8 @@
14
15
  domain?: [number, number]
15
16
  /** Format a cell value for its text + tooltip. */
16
17
  valueFormat?: (v: number) => string
17
- /** Render the value text inside each cell. Default true. */
18
+ /** Render the value text inside each cell. Default true. When false, a min→max legend is
19
+ * drawn instead so intensity is not the only cue. */
18
20
  showValues?: boolean
19
21
  /** X axis caption (drawn under the column headers). */
20
22
  xLabel?: string
@@ -88,11 +90,13 @@
88
90
  // Opacity on the primary token encodes intensity.
89
91
  const opacityScale = $derived(scaleLinear().domain(dom).range([0.12, 1]).clamp(true))
90
92
 
91
- const cells = $derived.by(() =>
92
- cleanRows.flatMap((row, r) =>
93
+ // Grid rows of cells; `i` is the row-major index used by the roving tabindex.
94
+ const gridRows = $derived.by(() =>
95
+ cleanRows.map((row, r) =>
93
96
  cleanCols.map((col, c) => {
94
97
  const v = valueAt(r, c)
95
98
  return {
99
+ i: r * cleanCols.length + c,
96
100
  r,
97
101
  c,
98
102
  row,
@@ -105,6 +109,29 @@
105
109
  }),
106
110
  ),
107
111
  )
112
+ const cellCount = $derived(cleanRows.length * cleanCols.length)
113
+
114
+ // Legend swatches (shown when values are not printed in the cells).
115
+ const LEGEND_STEPS = 5
116
+ const legendStops = $derived(
117
+ Array.from({ length: LEGEND_STEPS }, (_, k) =>
118
+ opacityScale(dom[0] + ((dom[1] - dom[0]) * k) / (LEGEND_STEPS - 1)),
119
+ ),
120
+ )
121
+
122
+ // Roving tabindex: the whole grid is one tab stop (DS-0161 / chart-nav.ts).
123
+ let focusIndex = $state(0)
124
+ const tabStop = $derived(Math.min(focusIndex, Math.max(0, cellCount - 1)))
125
+ let gridEl = $state<SVGGElement | null>(null)
126
+
127
+ function onCellKeydown(e: KeyboardEvent, i: number) {
128
+ // SVG geometry does not mirror in RTL, so Left/Right stay physical.
129
+ const next = chartNavStep(e.key, i, cellCount, cleanCols.length)
130
+ if (next === null) return
131
+ e.preventDefault()
132
+ focusIndex = next
133
+ gridEl?.querySelector<SVGElement>(`[data-index="${next}"]`)?.focus()
134
+ }
108
135
 
109
136
  const autoSummary = $derived.by(() => {
110
137
  if (isEmpty) return 'No data'
@@ -123,11 +150,18 @@
123
150
  function hide() {
124
151
  active = null
125
152
  }
126
- function cellLabel(row: string, col: string, value: number): string {
127
- return `${row} vs ${col}: ${fmt(value)}`
153
+ function cellLabel(row: string, col: string, value: number | null): string {
154
+ return `${row} vs ${col}: ${value === null ? 'no value' : fmt(value)}`
128
155
  }
129
156
  </script>
130
157
 
158
+ <!-- Escape dismisses the tooltip wherever focus is, incl. one opened by hover (WCAG 1.4.13). -->
159
+ <svelte:window
160
+ onkeydown={(e) => {
161
+ if (active && e.key === 'Escape') hide()
162
+ }}
163
+ />
164
+
131
165
  <div class="ss-heatmap" data-size-variant={resolvedSize} role="group" aria-label={srText}>
132
166
  {#if isEmpty}
133
167
  <span class="empty" aria-hidden="true">—</span>
@@ -143,7 +177,7 @@
143
177
  role="presentation"
144
178
  >
145
179
  <!-- column headers -->
146
- {#each cleanCols as col, c}
180
+ {#each cleanCols as col, c (c)}
147
181
  <text
148
182
  class="header col"
149
183
  x={headLeft + c * cellSize + cellSize / 2}
@@ -153,7 +187,7 @@
153
187
  {/each}
154
188
 
155
189
  <!-- row headers -->
156
- {#each cleanRows as row, r}
190
+ {#each cleanRows as row, r (r)}
157
191
  <text
158
192
  class="header row"
159
193
  x={headLeft - 8}
@@ -163,46 +197,51 @@
163
197
  >
164
198
  {/each}
165
199
 
166
- <!-- cells -->
167
- {#each cells as cell}
168
- {#if cell.value === null}
169
- <rect
170
- class="cell cell-empty"
171
- x={cell.x}
172
- y={cell.y}
173
- width={cellSize}
174
- height={cellSize}
175
- aria-hidden="true"
176
- />
177
- {:else}
178
- <rect
179
- class="cell"
180
- x={cell.x}
181
- y={cell.y}
182
- width={cellSize}
183
- height={cellSize}
184
- fill="var(--ss-primary)"
185
- fill-opacity={cell.opacity}
186
- tabindex="0"
187
- role="button"
188
- aria-label={cellLabel(cell.row, cell.col, cell.value)}
189
- onfocus={() => show(cell.row, cell.col, cell.value!, cell.x + cellSize / 2, cell.y)}
190
- onblur={hide}
191
- onmouseenter={() =>
192
- show(cell.row, cell.col, cell.value!, cell.x + cellSize / 2, cell.y)}
193
- onmouseleave={hide}
194
- />
195
- {#if showValues}
196
- <text
197
- class="cell-text"
198
- x={cell.x + cellSize / 2}
199
- y={cell.y + cellSize / 2}
200
- dy="0.32em"
201
- text-anchor="middle">{fmt(cell.value)}</text
202
- >
203
- {/if}
204
- {/if}
205
- {/each}
200
+ <!-- cells: role=grid > row > gridcell, one tab stop with arrow-key navigation -->
201
+ <g role="grid" bind:this={gridEl}>
202
+ {#each gridRows as cells, r (r)}
203
+ <g role="row">
204
+ {#each cells as cell (cell.i)}
205
+ <rect
206
+ class="cell"
207
+ class:cell-empty={cell.value === null}
208
+ x={cell.x}
209
+ y={cell.y}
210
+ width={cellSize}
211
+ height={cellSize}
212
+ fill={cell.value === null ? undefined : 'var(--ss-primary)'}
213
+ fill-opacity={cell.value === null ? undefined : cell.opacity}
214
+ role="gridcell"
215
+ tabindex={cell.i === tabStop ? 0 : -1}
216
+ data-index={cell.i}
217
+ aria-label={cellLabel(cell.row, cell.col, cell.value)}
218
+ onfocus={() => {
219
+ focusIndex = cell.i
220
+ if (cell.value !== null)
221
+ show(cell.row, cell.col, cell.value, cell.x + cellSize / 2, cell.y)
222
+ }}
223
+ onblur={hide}
224
+ onkeydown={(e) => onCellKeydown(e, cell.i)}
225
+ onmouseenter={() => {
226
+ if (cell.value !== null)
227
+ show(cell.row, cell.col, cell.value, cell.x + cellSize / 2, cell.y)
228
+ }}
229
+ onmouseleave={hide}
230
+ />
231
+ {#if showValues && cell.value !== null}
232
+ <text
233
+ class="cell-text"
234
+ x={cell.x + cellSize / 2}
235
+ y={cell.y + cellSize / 2}
236
+ dy="0.32em"
237
+ text-anchor="middle"
238
+ aria-hidden="true">{fmt(cell.value)}</text
239
+ >
240
+ {/if}
241
+ {/each}
242
+ </g>
243
+ {/each}
244
+ </g>
206
245
 
207
246
  <!-- axis captions -->
208
247
  {#if xLabel}
@@ -222,7 +261,7 @@
222
261
  {#if tooltip && active}
223
262
  <div
224
263
  class="tooltip"
225
- role="status"
264
+ aria-hidden="true"
226
265
  style="left:{(active.cx / width) * 100}%;top:{(active.cy / height) * 100}%"
227
266
  >
228
267
  <span class="t-label">{active.row} · {active.col}</span>
@@ -230,10 +269,23 @@
230
269
  </div>
231
270
  {/if}
232
271
  </div>
272
+ {#if !showValues}
273
+ <!-- Visual-only scale key: every cell's aria-label already carries its value. -->
274
+ <div class="legend" aria-hidden="true">
275
+ <span class="legend-val">{fmt(dom[0])}</span>
276
+ <span class="legend-ramp" aria-hidden="true">
277
+ {#each legendStops as o, k (k)}
278
+ <span class="legend-step" style="opacity:{o}"></span>
279
+ {/each}
280
+ </span>
281
+ <span class="legend-val">{fmt(dom[1])}</span>
282
+ </div>
283
+ {/if}
233
284
  {/if}
234
285
  </div>
235
286
 
236
- <style>.ss-heatmap {
287
+ <style>@charset "UTF-8";
288
+ .ss-heatmap {
237
289
  display: inline-flex;
238
290
  flex-direction: column;
239
291
  gap: var(--ss-gap-sm);
@@ -286,7 +338,7 @@
286
338
  .ss-heatmap .cell {
287
339
  stroke: var(--ss-line);
288
340
  stroke-width: 1;
289
- cursor: pointer;
341
+ cursor: default;
290
342
  shape-rendering: crispEdges;
291
343
  transition: fill-opacity var(--ss-dur-fast) var(--ss-ease);
292
344
  }
@@ -302,12 +354,38 @@
302
354
  fill: none;
303
355
  cursor: default;
304
356
  }
357
+ .ss-heatmap {
358
+ /* Value text: --ss-fg glyphs on a --ss-bg halo, so the glyph's immediate background is
359
+ always --ss-bg whatever the cell opacity (≥13.9:1 in both themes; see DS-0164). A
360
+ two-colour flip cannot reach 4.5:1 across the mid-opacity band. */
361
+ }
305
362
  .ss-heatmap .cell-text {
306
363
  font-family: var(--ss-font-mono);
307
364
  font-size: var(--ss-ui-xs);
308
365
  fill: var(--ss-fg);
366
+ stroke: var(--ss-bg);
367
+ stroke-width: 0.3em;
368
+ stroke-linejoin: round;
369
+ paint-order: stroke fill;
309
370
  pointer-events: none;
310
371
  }
372
+ .ss-heatmap .legend {
373
+ display: flex;
374
+ align-items: center;
375
+ gap: var(--ss-gap-xs);
376
+ font-family: var(--ss-font-mono);
377
+ font-size: var(--ss-ui-xs);
378
+ color: var(--ss-fg-muted);
379
+ }
380
+ .ss-heatmap .legend-ramp {
381
+ display: inline-flex;
382
+ border: 1px solid var(--ss-line);
383
+ }
384
+ .ss-heatmap .legend-step {
385
+ inline-size: var(--ss-icon);
386
+ block-size: var(--ss-gap-sm);
387
+ background: var(--ss-primary);
388
+ }
311
389
  .ss-heatmap .tooltip {
312
390
  position: absolute;
313
391
  transform: translate(-50%, calc(-100% - 8px));
@@ -10,7 +10,8 @@ interface Props {
10
10
  domain?: [number, number];
11
11
  /** Format a cell value for its text + tooltip. */
12
12
  valueFormat?: (v: number) => string;
13
- /** Render the value text inside each cell. Default true. */
13
+ /** Render the value text inside each cell. Default true. When false, a min→max legend is
14
+ * drawn instead so intensity is not the only cue. */
14
15
  showValues?: boolean;
15
16
  /** X axis caption (drawn under the column headers). */
16
17
  xLabel?: string;
@@ -9,7 +9,11 @@
9
9
  import { resolveComponentSize, type Size } from '../config.js'
10
10
  // Aliased: the module script re-exports the same names, and eslint-plugin-svelte
11
11
  // merges both scopes.
12
- import { resolveIcon as lookupIcon, type IconName as GlyphName } from '../icons.js'
12
+ import {
13
+ resolveIcon as lookupIcon,
14
+ sanitizeIconMarkup,
15
+ type IconName as GlyphName,
16
+ } from '../icons.js'
13
17
 
14
18
  /**
15
19
  * Icon-local size scale (DS-0109). Distinct from the global `Size` axis
@@ -37,6 +41,10 @@
37
41
  * Raw SVG inner markup escape hatch — rendered when `name` is not a known
38
42
  * (built-in or runtime-registered) glyph. Lets callers pass one-off icons
39
43
  * without registering them globally.
44
+ *
45
+ * **Must be trusted markup** (authored by you, never user input): it is injected as HTML.
46
+ * A light filter strips `<script>`, `<foreignObject>`, `on*` handlers and `javascript:`
47
+ * links, but it is not a security boundary.
40
48
  */
41
49
  paths?: string
42
50
  /** Accessible name; rendered as a real <title> and wired via aria-labelledby. */
@@ -88,7 +96,7 @@
88
96
 
89
97
  // Resolve the glyph: explicit `paths` escape hatch → registered/built-in → warn.
90
98
  const markup = $derived.by(() => {
91
- if (paths != null) return paths
99
+ if (paths != null) return sanitizeIconMarkup(paths)
92
100
  const found = lookupIcon(name)
93
101
  if (found != null) return found
94
102
  if (typeof console !== 'undefined') {
@@ -132,7 +140,6 @@
132
140
  )
133
141
  </script>
134
142
 
135
- <!-- eslint-disable-next-line svelte/no-at-html-tags -->
136
143
  <svg
137
144
  viewBox="0 0 24 24"
138
145
  fill={isSolid ? 'currentColor' : 'none'}
@@ -152,6 +159,8 @@
152
159
  aria-hidden={isDecorative ? 'true' : undefined}
153
160
  focusable="false"
154
161
  >
162
+ <!-- Trusted glyph markup only (DS-0176): title/desc are escaped, glyphs pass sanitizeIconMarkup. -->
163
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
155
164
  {@html inner}
156
165
  </svg>
157
166
 
@@ -23,6 +23,10 @@ interface Props {
23
23
  * Raw SVG inner markup escape hatch — rendered when `name` is not a known
24
24
  * (built-in or runtime-registered) glyph. Lets callers pass one-off icons
25
25
  * without registering them globally.
26
+ *
27
+ * **Must be trusted markup** (authored by you, never user input): it is injected as HTML.
28
+ * A light filter strips `<script>`, `<foreignObject>`, `on*` handlers and `javascript:`
29
+ * links, but it is not a security boundary.
26
30
  */
27
31
  paths?: string;
28
32
  /** Accessible name; rendered as a real <title> and wired via aria-labelledby. */
@@ -142,7 +142,7 @@
142
142
  }
143
143
  .ss-field .lbl .req {
144
144
  color: var(--ss-red);
145
- margin-left: 2px;
145
+ margin-inline-start: 2px;
146
146
  }
147
147
  .ss-field .control {
148
148
  display: flex;
@@ -180,6 +180,8 @@
180
180
  align-items: center;
181
181
  justify-content: center;
182
182
  flex: none;
183
+ min-inline-size: var(--ss-s-6);
184
+ min-block-size: var(--ss-s-6);
183
185
  font-family: var(--ss-font-body);
184
186
  font-size: var(--ss-input-font);
185
187
  line-height: 1;
@@ -198,9 +200,7 @@
198
200
  display: none;
199
201
  }
200
202
  .ss-field .clear:focus-visible {
201
- outline: none;
202
203
  color: var(--ss-fg);
203
- box-shadow: 0 0 0 2px var(--ss-primary-soft);
204
204
  }
205
205
  .ss-field .msg {
206
206
  font-family: var(--ss-font-mono);
@@ -48,10 +48,23 @@
48
48
  // A disabled link gets no external affordances (it cannot navigate).
49
49
  const isExternal = $derived(!disabled && (external ?? looksExternal))
50
50
 
51
- // External links open in a new tab and carry the security rel; callers can
52
- // still override target/rel explicitly via the forwarded attributes.
51
+ // External links default to a new tab; an explicit `target` always wins.
53
52
  const resolvedTarget = $derived(target ?? (isExternal ? '_blank' : undefined))
54
- const resolvedRel = $derived(rel ?? (isExternal ? 'noopener noreferrer' : undefined))
53
+ // The new-tab safeguards follow the RESOLVED target, not `isExternal`: any
54
+ // link that opens a new tab (auto-detected or an explicit target="_blank")
55
+ // gets `noopener noreferrer` and the "opens in a new tab" hint.
56
+ const opensNewTab = $derived(!disabled && resolvedTarget?.toLowerCase() === '_blank')
57
+ // Merge rather than replace: a caller's `rel` tokens are kept and the
58
+ // security tokens are appended when missing.
59
+ const resolvedRel = $derived.by(() => {
60
+ const tokens = (rel ?? '').split(/\s+/).filter(Boolean)
61
+ if (opensNewTab) {
62
+ for (const t of ['noopener', 'noreferrer']) {
63
+ if (!tokens.some((x) => x.toLowerCase() === t)) tokens.push(t)
64
+ }
65
+ }
66
+ return tokens.length ? tokens.join(' ') : undefined
67
+ })
55
68
 
56
69
  // Swallow activation while disabled; otherwise defer to a forwarded onclick.
57
70
  function handleClick(e: MouseEvent) {
@@ -80,10 +93,8 @@
80
93
  {...rest}
81
94
  >
82
95
  {#if children}<span class="label">{@render children()}</span>{/if}
83
- {#if isExternal}
84
- <Icon name="external" {size} class="ss-link-ext" />
85
- <span class="sr-only"> (opens in a new tab)</span>
86
- {/if}
96
+ {#if isExternal}<Icon name="external" {size} class="ss-link-ext" />{/if}
97
+ {#if opensNewTab}<span class="sr-only"> (opens in a new tab)</span>{/if}
87
98
  </a>
88
99
 
89
100
  <style>@charset "UTF-8";
@@ -99,6 +110,9 @@
99
110
  cursor: pointer;
100
111
  transition: color var(--ss-dur-fast) var(--ss-ease);
101
112
  }
113
+ .ss-link::before {
114
+ content: none;
115
+ }
102
116
  .ss-link:focus-visible {
103
117
  outline: 2px solid var(--ss-primary);
104
118
  outline-offset: 2px;
@@ -108,24 +122,21 @@
108
122
  opacity: 0.45;
109
123
  }
110
124
 
111
- /* ── inline: animated underline that reveals on hover/focus, with a glow ── */
125
+ /* ── inline: always-underlined, thickening with a glow on hover/focus ── */
112
126
  .ss-link.inline .label {
113
127
  position: relative;
114
128
  }
115
129
  .ss-link.inline .label::after {
116
130
  content: "";
117
131
  position: absolute;
118
- left: 0;
119
- right: 0;
132
+ inset-inline: 0;
120
133
  bottom: -1px;
121
134
  height: 1px;
122
135
  background: var(--ss-primary);
123
- transform: scaleX(0);
124
- transform-origin: left center;
125
- transition: transform var(--ss-dur-slow) var(--ss-ease), height var(--ss-dur-fast) var(--ss-ease), box-shadow var(--ss-dur-slow) var(--ss-ease);
136
+ transform: scaleX(1);
137
+ transition: height var(--ss-dur-fast) var(--ss-ease), box-shadow var(--ss-dur-slow) var(--ss-ease);
126
138
  }
127
139
  .ss-link.inline:hover .label::after, .ss-link.inline:focus-visible .label::after {
128
- transform: scaleX(1);
129
140
  height: 2px;
130
141
  box-shadow: var(--ss-shadow-glow);
131
142
  }
@@ -19,7 +19,6 @@
19
19
  <script lang="ts">
20
20
  import { tick, untrack, type Snippet } from 'svelte'
21
21
  import { resolveComponentSize, type Size } from '../config.js'
22
- import EmptyState from './EmptyState.svelte'
23
22
 
24
23
  interface Props {
25
24
  /** Controlled lines. When provided, the component renders exactly these (capped to `maxLines`). */
@@ -225,12 +224,15 @@
225
224
  {/if}
226
225
 
227
226
  <div class="viewport">
227
+ <!-- Focusable so keyboard users (notably Safari, which doesn't focus scrollers) can scroll it. -->
228
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
228
229
  <div
229
230
  class="scroll"
230
231
  class:nowrap={!wrapOn}
231
232
  bind:this={el}
232
233
  onscroll={onScroll}
233
234
  role="log"
235
+ tabindex="0"
234
236
  aria-label={ariaLabel}
235
237
  aria-live={announce}
236
238
  aria-busy={loading}
@@ -245,13 +247,14 @@
245
247
  {#if empty}
246
248
  {@render empty()}
247
249
  {:else}
248
- <EmptyState
249
- title="No log lines"
250
- message={allLines.length
251
- ? 'No lines match the current filters.'
252
- : 'Waiting for output…'}
253
- {size}
254
- />
250
+ <!-- Plain text, not <EmptyState>: its role="status" nested inside the
251
+ role="log" live region would announce the message twice. -->
252
+ <div class="empty">
253
+ <p class="empty-title">No log lines</p>
254
+ <p class="empty-msg">
255
+ {allLines.length ? 'No lines match the current filters.' : 'Waiting for output…'}
256
+ </p>
257
+ </div>
255
258
  {/if}
256
259
  {:else}
257
260
  {#each visibleLines as line, i (keyFor(line, i))}
@@ -330,7 +333,8 @@
330
333
  border-color: var(--ss-line-strong);
331
334
  }
332
335
  .chip[aria-pressed=false] {
333
- opacity: 0.45;
336
+ color: var(--ss-fg-muted);
337
+ border-style: dashed;
334
338
  }
335
339
  .chip.info[aria-pressed=true] {
336
340
  color: var(--ss-log-info);
@@ -412,6 +416,27 @@
412
416
  flex: none;
413
417
  }
414
418
 
419
+ .empty {
420
+ display: flex;
421
+ flex-direction: column;
422
+ align-items: center;
423
+ justify-content: center;
424
+ gap: var(--ss-gap-sm);
425
+ min-height: calc(var(--_min-h) - 2 * var(--ss-gap));
426
+ text-align: center;
427
+ }
428
+ .empty p {
429
+ margin: 0;
430
+ }
431
+ .empty .empty-title {
432
+ color: var(--ss-code-fg);
433
+ font-size: var(--ss-ui-md);
434
+ }
435
+ .empty .empty-msg {
436
+ color: var(--ss-fg-faint);
437
+ font-size: var(--ss-ui-sm);
438
+ }
439
+
415
440
  .status {
416
441
  display: flex;
417
442
  align-items: center;
@@ -60,8 +60,8 @@
60
60
  /** Vertical side the panel opens toward. */
61
61
  side?: Side
62
62
  /**
63
- * Accessible label for the panel (`role="menu"`). Falls back to the
64
- * trigger's text when omitted.
63
+ * Accessible label for the panel (`role="menu"`). When omitted the
64
+ * panel is named by the trigger's text via `aria-labelledby`.
65
65
  */
66
66
  label?: string
67
67
  /** Token size (sm|md|lg); inherits the global size when unset. */
@@ -83,6 +83,7 @@
83
83
 
84
84
  const uid = $props.id()
85
85
  const panelId = `${uid}-panel`
86
+ const triggerId = `${uid}-trigger`
86
87
 
87
88
  // When any item carries a `selected` flag the menu is a selection group, so
88
89
  // rows become `menuitemradio` + `aria-checked` (WAI-ARIA). Otherwise plain
@@ -216,6 +217,7 @@
216
217
  <div class="ss-menu" data-size-variant={sizeAttr} data-align={align} data-side={side}>
217
218
  <button
218
219
  bind:this={triggerEl}
220
+ id={triggerId}
219
221
  type="button"
220
222
  class="trigger"
221
223
  aria-haspopup="menu"
@@ -233,7 +235,8 @@
233
235
  class="panel"
234
236
  class:open
235
237
  role="menu"
236
- aria-label={label}
238
+ aria-label={label || undefined}
239
+ aria-labelledby={label ? undefined : triggerId}
237
240
  aria-hidden={!open}
238
241
  tabindex="-1"
239
242
  onkeydown={onPanelKeydown}
@@ -291,9 +294,7 @@
291
294
  background: var(--ss-hover);
292
295
  }
293
296
  .trigger:focus-visible {
294
- outline: none;
295
297
  border-color: var(--ss-primary);
296
- box-shadow: 0 0 0 3px var(--ss-primary-soft);
297
298
  }
298
299
 
299
300
  .panel {
@@ -336,11 +337,11 @@
336
337
  }
337
338
 
338
339
  .ss-menu[data-align=start] .panel {
339
- left: 0;
340
+ inset-inline-start: 0;
340
341
  }
341
342
 
342
343
  .ss-menu[data-align=end] .panel {
343
- right: 0;
344
+ inset-inline-end: 0;
344
345
  }
345
346
 
346
347
  .item {
@@ -348,7 +349,7 @@
348
349
  align-items: center;
349
350
  gap: var(--ss-menu-item-gap);
350
351
  width: 100%;
351
- text-align: left;
352
+ text-align: start;
352
353
  font: 500 var(--ss-ui-md) var(--ss-font-mono);
353
354
  color: var(--ss-fg-muted);
354
355
  background: transparent;
@@ -367,6 +368,9 @@
367
368
  background: var(--ss-hover);
368
369
  box-shadow: inset 2px 0 0 0 var(--ss-primary);
369
370
  }
371
+ .item:focus-visible:dir(rtl) {
372
+ box-shadow: inset -2px 0 0 0 var(--ss-primary);
373
+ }
370
374
  .item.selected {
371
375
  color: var(--ss-fg);
372
376
  background: color-mix(in srgb, var(--ss-accent) 6%, transparent);
@@ -52,8 +52,8 @@ interface Props {
52
52
  /** Vertical side the panel opens toward. */
53
53
  side?: Side;
54
54
  /**
55
- * Accessible label for the panel (`role="menu"`). Falls back to the
56
- * trigger's text when omitted.
55
+ * Accessible label for the panel (`role="menu"`). When omitted the
56
+ * panel is named by the trigger's text via `aria-labelledby`.
57
57
  */
58
58
  label?: string;
59
59
  /** Token size (sm|md|lg); inherits the global size when unset. */
@@ -26,6 +26,12 @@
26
26
  emphasis?: boolean
27
27
  /** Skeleton/loading state: hides the real value behind aria-hidden bars. */
28
28
  loading?: boolean
29
+ /**
30
+ * Announce updates to assistive tech. When `true` the whole tile is one polite, atomic
31
+ * live region, so a change is read as "label value delta" rather than a bare number.
32
+ * Off by default: a grid of always-live tiles would talk over each other (DS-0191).
33
+ */
34
+ live?: boolean
29
35
  /** Snippet slot below the delta — drop in a <Sparkline> here. */
30
36
  chart?: Snippet
31
37
  /** Token size (sm|md|lg); inherits the global size when unset. */
@@ -42,6 +48,7 @@
42
48
  deltaLabel,
43
49
  emphasis = false,
44
50
  loading = false,
51
+ live = false,
45
52
  chart,
46
53
  size,
47
54
  }: Props = $props()
@@ -59,6 +66,9 @@
59
66
  class="ss-metric"
60
67
  data-size-variant={resolveComponentSize('MetricTile', size)}
61
68
  aria-busy={loading ? 'true' : undefined}
69
+ role={live ? 'status' : undefined}
70
+ aria-live={live ? 'polite' : undefined}
71
+ aria-atomic={live ? 'true' : undefined}
62
72
  >
63
73
  <div class="label">{label}</div>
64
74
 
@@ -66,7 +76,7 @@
66
76
  <div class="skeleton skeleton-val" aria-hidden="true"></div>
67
77
  {#if delta}<div class="skeleton skeleton-delta" aria-hidden="true"></div>{/if}
68
78
  {:else}
69
- <div class="val" role="status" aria-live="polite">
79
+ <div class="val">
70
80
  {#if prefix}<span class="small">{prefix}</span>{/if}{value}{#if suffix}<span class="small"
71
81
  >{suffix}</span
72
82
  >{/if}
@@ -23,6 +23,12 @@ interface Props {
23
23
  emphasis?: boolean;
24
24
  /** Skeleton/loading state: hides the real value behind aria-hidden bars. */
25
25
  loading?: boolean;
26
+ /**
27
+ * Announce updates to assistive tech. When `true` the whole tile is one polite, atomic
28
+ * live region, so a change is read as "label value delta" rather than a bare number.
29
+ * Off by default: a grid of always-live tiles would talk over each other (DS-0191).
30
+ */
31
+ live?: boolean;
26
32
  /** Snippet slot below the delta — drop in a <Sparkline> here. */
27
33
  chart?: Snippet;
28
34
  /** Token size (sm|md|lg); inherits the global size when unset. */