dssoca 0.17.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 (81) hide show
  1. package/README.md +9 -6
  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/BottomNav.svelte +4 -0
  8. package/dist/components/BoxPlot.svelte +33 -7
  9. package/dist/components/BumpChart.svelte +68 -26
  10. package/dist/components/Button.svelte +23 -1
  11. package/dist/components/Button.svelte.d.ts +5 -1
  12. package/dist/components/Card.svelte +48 -15
  13. package/dist/components/Card.svelte.d.ts +10 -1
  14. package/dist/components/Chart.svelte +169 -32
  15. package/dist/components/Chart.svelte.d.ts +13 -1
  16. package/dist/components/DateField.svelte +1 -1
  17. package/dist/components/FileDrop.svelte +81 -14
  18. package/dist/components/FileDrop.svelte.d.ts +6 -0
  19. package/dist/components/Heatmap.svelte +128 -50
  20. package/dist/components/Heatmap.svelte.d.ts +2 -1
  21. package/dist/components/Icon.svelte +12 -3
  22. package/dist/components/Icon.svelte.d.ts +4 -0
  23. package/dist/components/Input.svelte +6 -3
  24. package/dist/components/Kbd.svelte +17 -1
  25. package/dist/components/Kbd.svelte.d.ts +9 -0
  26. package/dist/components/Link.svelte +25 -14
  27. package/dist/components/LogStream.svelte +34 -9
  28. package/dist/components/Menu.svelte +12 -8
  29. package/dist/components/Menu.svelte.d.ts +2 -2
  30. package/dist/components/MetricTile.svelte +16 -2
  31. package/dist/components/MetricTile.svelte.d.ts +6 -0
  32. package/dist/components/Modal.svelte +47 -7
  33. package/dist/components/Modal.svelte.d.ts +11 -3
  34. package/dist/components/NumberField.svelte +33 -10
  35. package/dist/components/Pagination.svelte +7 -4
  36. package/dist/components/ScatterPlot.svelte +44 -7
  37. package/dist/components/SearchPalette.svelte +102 -23
  38. package/dist/components/SearchPalette.svelte.d.ts +5 -0
  39. package/dist/components/SegmentedControl.svelte +14 -5
  40. package/dist/components/Select.svelte +3 -4
  41. package/dist/components/ServiceCard.svelte +108 -68
  42. package/dist/components/ServiceCard.svelte.d.ts +8 -3
  43. package/dist/components/ShortcutsHelp.svelte +3 -2
  44. package/dist/components/Sidebar.svelte +84 -59
  45. package/dist/components/Sidebar.svelte.d.ts +5 -0
  46. package/dist/components/Switch.svelte +4 -8
  47. package/dist/components/Table.svelte +20 -13
  48. package/dist/components/Table.svelte.d.ts +6 -2
  49. package/dist/components/Textarea.svelte +1 -1
  50. package/dist/components/TierList.svelte +598 -0
  51. package/dist/components/TierList.svelte.d.ts +37 -0
  52. package/dist/components/Toaster.svelte +144 -21
  53. package/dist/components/Tooltip.svelte +101 -13
  54. package/dist/components/Tooltip.svelte.d.ts +1 -1
  55. package/dist/components/Topbar.svelte +39 -16
  56. package/dist/dssoca.config.d.ts +1 -1
  57. package/dist/dssoca.config.js +1 -0
  58. package/dist/icons.d.ts +20 -2
  59. package/dist/icons.js +43 -3
  60. package/dist/index.d.ts +3 -1
  61. package/dist/index.js +4 -1
  62. package/dist/theme.css +25 -27
  63. package/dist/tierlist-core.d.ts +97 -0
  64. package/dist/tierlist-core.js +206 -0
  65. package/dist/tokens.css +25 -0
  66. package/dist/vanilla/accordion.js +7 -3
  67. package/dist/vanilla/fields.js +19 -6
  68. package/dist/vanilla/index.d.ts +2 -1
  69. package/dist/vanilla/index.js +7 -4
  70. package/dist/vanilla/menu.js +12 -1
  71. package/dist/vanilla/modal.d.ts +4 -0
  72. package/dist/vanilla/modal.js +57 -2
  73. package/dist/vanilla/segmented.js +13 -4
  74. package/dist/vanilla/tierlist.d.ts +8 -0
  75. package/dist/vanilla/tierlist.js +300 -0
  76. package/dist/vanilla/toast.d.ts +11 -3
  77. package/dist/vanilla/toast.js +125 -10
  78. package/dist/vanilla/tooltip.d.ts +5 -1
  79. package/dist/vanilla/tooltip.js +57 -10
  80. package/dist/vanilla.css +581 -158
  81. package/package.json +4 -1
@@ -37,6 +37,11 @@ declare function $$render<T extends SearchPaletteItem>(): {
37
37
  'aria-label'?: string;
38
38
  /** No-results text (used when the `empty` snippet is absent). @default 'No results' */
39
39
  emptyText?: string;
40
+ /** Screen-reader announcement of the result count while a query is typed.
41
+ * @default (n) => `${n} result(s)` */
42
+ resultsText?: (count: number) => string;
43
+ /** Accessible name of the close button (shown on small, full-screen viewports). @default 'Close' */
44
+ closeLabel?: string;
40
45
  /** Footer hint row; false hides it. A `footer` snippet replaces it. @default '↑↓ navigate · ↵ open · esc close' */
41
46
  footerText?: string | false;
42
47
  /** Clear the query and selection when the palette closes. @default true */
@@ -100,13 +100,22 @@
100
100
  }
101
101
 
102
102
  function onKeydown(e: KeyboardEvent, index: number) {
103
- let target = -1
103
+ let target: number
104
+ // RTL: the row is laid out right-to-left, so ArrowLeft points at the NEXT
105
+ // segment. Read the computed direction at keydown time (it inherits from
106
+ // any ancestor `dir`). Up/Down stay logical (prev/next).
107
+ const rtl = getComputedStyle(e.currentTarget as Element).direction === 'rtl'
108
+ const right: 1 | -1 = rtl ? -1 : 1
104
109
  switch (e.key) {
105
110
  case 'ArrowRight':
111
+ target = step(index, right)
112
+ break
113
+ case 'ArrowLeft':
114
+ target = step(index, right === 1 ? -1 : 1)
115
+ break
106
116
  case 'ArrowDown':
107
117
  target = step(index, 1)
108
118
  break
109
- case 'ArrowLeft':
110
119
  case 'ArrowUp':
111
120
  target = step(index, -1)
112
121
  break
@@ -178,7 +187,7 @@
178
187
  color: var(--ss-fg-muted);
179
188
  background: transparent;
180
189
  border: 0;
181
- border-left: 1px solid var(--ss-line);
190
+ border-inline-start: 1px solid var(--ss-line);
182
191
  padding: var(--ss-seg-py) var(--ss-seg-px);
183
192
  cursor: pointer;
184
193
  white-space: nowrap;
@@ -186,7 +195,7 @@
186
195
  transition: color var(--ss-dur-fast) var(--ss-ease), background var(--ss-dur-fast) var(--ss-ease);
187
196
  }
188
197
  .ss-segmented .segment:first-child {
189
- border-left: 0;
198
+ border-inline-start: 0;
190
199
  }
191
200
  .ss-segmented .segment:hover:not(.selected):not(:disabled) {
192
201
  color: var(--ss-fg);
@@ -198,7 +207,7 @@
198
207
  }
199
208
  .ss-segmented .segment:focus-visible {
200
209
  outline: none;
201
- box-shadow: inset 0 0 0 2px var(--ss-primary-soft);
210
+ box-shadow: inset 0 0 0 2px var(--ss-primary);
202
211
  z-index: 1;
203
212
  }
204
213
  .ss-segmented .segment.selected:focus-visible {
@@ -140,7 +140,7 @@
140
140
  }
141
141
  .ss-select .lbl .req {
142
142
  color: var(--ss-red);
143
- margin-left: 2px;
143
+ margin-inline-start: 2px;
144
144
  }
145
145
  .ss-select .control {
146
146
  position: relative;
@@ -171,9 +171,8 @@
171
171
  pointer-events: none;
172
172
  width: 0;
173
173
  height: 0;
174
- margin-left: var(--ss-gap-sm);
175
- border-left: var(--ss-select-chevron, 5px) solid transparent;
176
- border-right: var(--ss-select-chevron, 5px) solid transparent;
174
+ margin-inline-start: var(--ss-gap-sm);
175
+ border-inline: var(--ss-select-chevron, 5px) solid transparent;
177
176
  border-top: var(--ss-select-chevron, 5px) solid var(--ss-fg-muted);
178
177
  transition: border-top-color var(--ss-dur-fast) var(--ss-ease);
179
178
  }
@@ -11,17 +11,22 @@
11
11
  host: string
12
12
  status?: Status
13
13
  latency?: string
14
+ /** Sparkline series. Defaults to `[]` (an honest "No data" state, not a made-up trend). */
14
15
  spark?: number[]
16
+ /** Makes the card interactive via a stretched overlay `<button>` (native Enter/Space). */
15
17
  onclick?: () => void
16
- /** When set, the card renders as a real `<a>` and navigates here (native Enter). */
18
+ /** When set, the card's overlay is a real `<a>` that navigates here (native Enter). */
17
19
  href?: string
18
20
  /** Render skeleton placeholders and mark the card `aria-busy`; suppresses interaction. */
19
21
  loading?: boolean
20
- /** Non-interactive variant: `aria-disabled`, no focus/pointer, no onclick. */
22
+ /** Inert variant: `aria-disabled`, no focus/pointer, no onclick/href. */
21
23
  disabled?: boolean
22
24
  /** "Last checked" instant; rendered as relative time in a `<time datetime>` footer slot. */
23
25
  updatedAt?: Date | string
24
- /** Optional extra metadata rows (version, IP, tags…) below the head. */
26
+ /**
27
+ * Optional extra metadata rows (version, IP, tags…) below the head. Sits above the card's
28
+ * overlay control, so links/buttons in it stay separately focusable and clickable.
29
+ */
25
30
  meta?: Snippet
26
31
  /** Token size (sm|md|lg); inherits the global size when unset. */
27
32
  size?: Size
@@ -31,7 +36,7 @@
31
36
  host,
32
37
  status = 'up',
33
38
  latency = '',
34
- spark = [4, 8, 6, 10, 7, 12, 9, 14, 11, 16, 13, 10, 12],
39
+ spark = [],
35
40
  onclick,
36
41
  href,
37
42
  loading = false,
@@ -67,13 +72,24 @@
67
72
  : 'positive',
68
73
  )
69
74
 
70
- // Status is decorative on the dot/badge, but meaningful — fold it into the label.
75
+ // Fallback name while loading (the name/host/badge aren't rendered, so nothing to reference).
71
76
  const cardLabel = $derived(`${name}, ${statusLabel}`)
72
77
 
73
- // The card is interactive (focusable, activatable) unless explicitly inert.
74
- // This preserves the original default (a bare card was a role=button); `href`,
75
- // `loading`, and `disabled` are the only things that change the element.
76
- const interactive = $derived(!loading && !disabled)
78
+ // Stable ids so the card is named by its visible name + status (aria-labelledby) and described
79
+ // by the rest of its visible content (aria-describedby) instead of an aria-label that replaced
80
+ // it (DS-0192).
81
+ const uid = $props.id()
82
+ const nameId = `${uid}-name`
83
+ const statusId = `${uid}-status`
84
+ const hostId = `${uid}-host`
85
+ const latencyId = `${uid}-latency`
86
+ const metaId = `${uid}-meta`
87
+ const trendId = `${uid}-trend`
88
+ const updatedId = `${uid}-updated`
89
+
90
+ // Interactive only when there is something to do: a bare card (no `href`/`onclick`) is a static
91
+ // group, not a dead role=button (DS-0192). `loading`/`disabled` still suppress interaction.
92
+ const interactive = $derived(!loading && !disabled && Boolean(href || onclick))
77
93
 
78
94
  // --- relative "last checked" timestamp -------------------------------------
79
95
  const updatedDate = $derived(
@@ -92,6 +108,19 @@
92
108
  return rtf.format(Math.round(secs / 86400), 'day')
93
109
  }
94
110
  const updatedLabel = $derived(updatedValid ? relativeTime(updatedDate!) : '')
111
+
112
+ const labelledBy = `${nameId} ${statusId}`
113
+ const describedBy = $derived(
114
+ [
115
+ hostId,
116
+ latency ? latencyId : '',
117
+ meta ? metaId : '',
118
+ spark.length ? trendId : '',
119
+ updatedValid ? updatedId : '',
120
+ ]
121
+ .filter(Boolean)
122
+ .join(' '),
123
+ )
95
124
  </script>
96
125
 
97
126
  {#snippet body()}
@@ -101,8 +130,8 @@
101
130
  <div class="sk sk-name" aria-hidden="true"></div>
102
131
  <div class="sk sk-host" aria-hidden="true"></div>
103
132
  {:else}
104
- <div class="name">{name}</div>
105
- <div class="host">{host}</div>
133
+ <div class="name" id={nameId}>{name}</div>
134
+ <div class="host" id={hostId}>{host}</div>
106
135
  {/if}
107
136
  </div>
108
137
  </div>
@@ -110,74 +139,67 @@
110
139
  {#if loading}
111
140
  <div class="sk sk-badge" aria-hidden="true"></div>
112
141
  {:else}
113
- <Badge tone={badgeTone}>{statusLabel}</Badge>
114
- <div class="latency">{latency}</div>
142
+ <Badge tone={badgeTone}><span id={statusId}>{statusLabel}</span></Badge>
143
+ <div class="latency" id={latency ? latencyId : undefined}>{latency}</div>
115
144
  {/if}
116
145
  </div>
117
146
  {#if meta && !loading}
118
- <div class="meta">{@render meta()}</div>
147
+ <div class="meta" id={metaId}>{@render meta()}</div>
119
148
  {/if}
120
149
  <div class="footer">
121
150
  {#if loading}
122
151
  <div class="sk sk-spark" aria-hidden="true"></div>
123
152
  {:else}
124
- <Sparkline data={spark} color={sparkColor} />
153
+ <div class="trend" id={trendId}><Sparkline data={spark} color={sparkColor} /></div>
125
154
  <div class="foot-meta">
126
155
  {#if updatedValid}
127
- <time class="updated" datetime={updatedISO}>{updatedLabel}</time>
156
+ <time class="updated" id={updatedId} datetime={updatedISO}>{updatedLabel}</time>
128
157
  {/if}
129
158
  {#if interactive}
130
- <span class="latency open"><span aria-hidden="true">▸</span> open</span>
159
+ <!-- Visual cue only: the overlay control carries the role and name. -->
160
+ <span class="latency open" aria-hidden="true">▸ open</span>
131
161
  {/if}
132
162
  </div>
133
163
  {/if}
134
164
  </div>
135
165
  {/snippet}
136
166
 
137
- {#if href && interactive}
138
- <a
139
- class="ss-svc"
140
- class:loading
141
- {href}
142
- aria-label={cardLabel}
143
- data-size-variant={resolveComponentSize('ServiceCard', size)}
144
- {onclick}
145
- >
146
- {@render body()}
147
- </a>
148
- {:else if interactive}
149
- <div
150
- class="ss-svc"
151
- role="button"
152
- tabindex="0"
153
- aria-label={cardLabel}
154
- data-size-variant={resolveComponentSize('ServiceCard', size)}
155
- {onclick}
156
- onkeydown={(e) => {
157
- if (e.key === 'Enter' || e.key === ' ') {
158
- e.preventDefault()
159
- onclick?.()
160
- }
161
- }}
162
- >
163
- {@render body()}
164
- </div>
165
- {:else}
166
- <div
167
- class="ss-svc"
168
- class:loading
169
- class:disabled
170
- role="group"
171
- aria-label={cardLabel}
172
- aria-busy={loading ? 'true' : undefined}
173
- aria-disabled={disabled ? 'true' : undefined}
174
- data-size-variant={resolveComponentSize('ServiceCard', size)}
175
- >
176
- {@render body()}
177
- </div>
178
- {/if}
167
+ <!--
168
+ The root is never itself interactive (DS-0192, mirroring Card's DS-0183): an interactive card
169
+ renders ONE stretched overlay control (an <a> for `href`, a <button> for `onclick`) named by the
170
+ visible name + status and described by the rest of the card, so `meta` controls are never nested
171
+ inside a link or button. A static card is a named, described group.
172
+ -->
173
+ <div
174
+ class="ss-svc"
175
+ class:interactive
176
+ class:loading
177
+ class:disabled
178
+ role={interactive ? undefined : 'group'}
179
+ aria-label={!interactive && loading ? cardLabel : undefined}
180
+ aria-labelledby={!interactive && !loading ? labelledBy : undefined}
181
+ aria-describedby={!interactive && !loading ? describedBy : undefined}
182
+ aria-busy={loading ? 'true' : undefined}
183
+ aria-disabled={disabled ? 'true' : undefined}
184
+ data-size-variant={resolveComponentSize('ServiceCard', size)}
185
+ >
186
+ {@render body()}
187
+ {#if interactive && href}
188
+ <a class="overlay" {href} {onclick} aria-labelledby={labelledBy} aria-describedby={describedBy}
189
+ ></a>
190
+ {:else if interactive}
191
+ <button
192
+ type="button"
193
+ class="overlay"
194
+ {onclick}
195
+ aria-labelledby={labelledBy}
196
+ aria-describedby={describedBy}
197
+ ></button>
198
+ {/if}
199
+ </div>
179
200
 
180
201
  <style>.ss-svc {
202
+ position: relative;
181
203
  display: grid;
182
204
  grid-template-columns: 1fr auto;
183
205
  gap: var(--ss-gap);
@@ -210,6 +232,8 @@
210
232
  gap: 2px;
211
233
  }
212
234
  .ss-svc .meta {
235
+ position: relative;
236
+ z-index: 1;
213
237
  grid-column: 1/-1;
214
238
  font-family: var(--ss-font-mono);
215
239
  font-size: var(--ss-ui-sm);
@@ -242,22 +266,34 @@
242
266
  color: var(--ss-fg-muted);
243
267
  }
244
268
 
245
- /* Interactive variants (anchor + role=button div) get the affordance. */
246
- a.ss-svc,
247
- [role=button].ss-svc {
248
- cursor: pointer;
249
- }
250
- a.ss-svc:hover,
251
- [role=button].ss-svc:hover {
269
+ /* Interactive card: hover affordance on the card, pointer via the overlay. */
270
+ .ss-svc.interactive:hover {
252
271
  border-color: var(--ss-line-strong);
253
272
  background: var(--ss-bg-elev-hover);
254
273
  }
255
- a.ss-svc:focus-visible,
256
- [role=button].ss-svc:focus-visible {
274
+
275
+ .overlay {
276
+ position: absolute;
277
+ inset: 0;
278
+ z-index: 0;
279
+ appearance: none;
280
+ margin: 0;
281
+ padding: 0;
282
+ border: 0;
283
+ background: none;
284
+ color: inherit;
285
+ font: inherit;
286
+ cursor: pointer;
287
+ }
288
+ .overlay:focus-visible {
257
289
  outline: 2px solid var(--ss-primary);
258
290
  outline-offset: 2px;
259
291
  }
260
292
 
293
+ .trend {
294
+ display: contents;
295
+ }
296
+
261
297
  /* Disabled: inert, no affordance. */
262
298
  .ss-svc.disabled {
263
299
  cursor: default;
@@ -313,4 +349,8 @@ a.ss-svc:focus-visible,
313
349
  .sk::after {
314
350
  animation: none;
315
351
  }
352
+ }
353
+ .overlay::before,
354
+ .ss-svc::before {
355
+ content: none;
316
356
  }</style>
@@ -6,17 +6,22 @@ interface Props {
6
6
  host: string;
7
7
  status?: Status;
8
8
  latency?: string;
9
+ /** Sparkline series. Defaults to `[]` (an honest "No data" state, not a made-up trend). */
9
10
  spark?: number[];
11
+ /** Makes the card interactive via a stretched overlay `<button>` (native Enter/Space). */
10
12
  onclick?: () => void;
11
- /** When set, the card renders as a real `<a>` and navigates here (native Enter). */
13
+ /** When set, the card's overlay is a real `<a>` that navigates here (native Enter). */
12
14
  href?: string;
13
15
  /** Render skeleton placeholders and mark the card `aria-busy`; suppresses interaction. */
14
16
  loading?: boolean;
15
- /** Non-interactive variant: `aria-disabled`, no focus/pointer, no onclick. */
17
+ /** Inert variant: `aria-disabled`, no focus/pointer, no onclick/href. */
16
18
  disabled?: boolean;
17
19
  /** "Last checked" instant; rendered as relative time in a `<time datetime>` footer slot. */
18
20
  updatedAt?: Date | string;
19
- /** Optional extra metadata rows (version, IP, tags…) below the head. */
21
+ /**
22
+ * Optional extra metadata rows (version, IP, tags…) below the head. Sits above the card's
23
+ * overlay control, so links/buttons in it stay separately focusable and clickable.
24
+ */
20
25
  meta?: Snippet;
21
26
  /** Token size (sm|md|lg); inherits the global size when unset. */
22
27
  size?: Size;
@@ -219,7 +219,8 @@
219
219
  {#if recordingId === item.id}
220
220
  <span class="prompt">Press keys…</span>
221
221
  {:else}
222
- <Kbd keys={item.keys} />
222
+ <!-- The chip IS the content here — never hide it on touch devices (DS-0157). -->
223
+ <Kbd keys={item.keys} hideOnMobile={false} />
223
224
  {/if}
224
225
  </dd>
225
226
  {#if editable}
@@ -343,7 +344,7 @@
343
344
  text-decoration: line-through;
344
345
  }
345
346
  .ss-shortcuts-help .off-tag {
346
- margin-left: var(--ss-s-1);
347
+ margin-inline-start: var(--ss-s-1);
347
348
  color: var(--ss-fg-muted);
348
349
  }
349
350
  .ss-shortcuts-help .extra {