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
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { fly } from 'svelte/transition'
3
3
  import { prefersReducedMotion } from 'svelte/motion'
4
+ import { untrack } from 'svelte'
4
5
  import { toasts, type Toast, type ToastKind } from '../toast.svelte.js'
5
6
  import { resolveComponentSize, type Size } from '../config.js'
6
7
 
@@ -20,6 +21,7 @@
20
21
  }
21
22
 
22
23
  let { size, position = 'top-right' }: Props = $props()
24
+ const uid = $props.id()
23
25
 
24
26
  const glyph: Record<ToastKind, string> = { success: '✓', error: '✕', info: 'i', loading: '' }
25
27
  // Honor prefers-reduced-motion: collapse the fly transition to an instant swap.
@@ -43,7 +45,16 @@
43
45
  })
44
46
  const flyDuration = $derived(reduce ? 0 : tokenDuration)
45
47
  // Bottom anchors slide in from below; centered ones come straight down/up.
46
- const flyX = $derived(position.endsWith('center') ? 0 : position.endsWith('left') ? -16 : 16)
48
+ // `left`/`right` positions are logical (inline start/end), so in RTL the
49
+ // horizontal slide mirrors with them.
50
+ const rtl = $derived(
51
+ !!rootEl &&
52
+ typeof getComputedStyle === 'function' &&
53
+ getComputedStyle(rootEl).direction === 'rtl',
54
+ )
55
+ const flyX = $derived(
56
+ position.endsWith('center') ? 0 : (position.endsWith('left') ? -16 : 16) * (rtl ? -1 : 1),
57
+ )
47
58
  const flyY = $derived(position.endsWith('center') ? (position.startsWith('top') ? -16 : 16) : 0)
48
59
 
49
60
  // ── swipe-to-dismiss ──────────────────────────────────────────────
@@ -79,7 +90,8 @@
79
90
  if (passed) toasts.dismiss(t.id)
80
91
  else {
81
92
  dragDx = 0
82
- toasts.resume(t.id)
93
+ const el = e.currentTarget as HTMLElement
94
+ if (hoverId !== t.id && !el.contains(document.activeElement)) toasts.resume(t.id)
83
95
  }
84
96
  }
85
97
 
@@ -94,29 +106,127 @@
94
106
  toasts.dismiss(t.id)
95
107
  }
96
108
  }
109
+
110
+ // ── pause / resume ────────────────────────────────────────────────
111
+ // Hover OR keyboard focus holds the timer; it only runs again once the
112
+ // pointer has left AND focus is outside the toast (a pointerleave must not
113
+ // restart the clock under a keyboard user, and vice versa).
114
+ let hoverId: number | null = null
115
+
116
+ function onPointerEnter(t: Toast) {
117
+ hoverId = t.id
118
+ toasts.pause(t.id)
119
+ }
120
+
121
+ function onPointerLeave(e: PointerEvent, t: Toast) {
122
+ if (hoverId === t.id) hoverId = null
123
+ if (dragId === t.id) return
124
+ const el = e.currentTarget as HTMLElement
125
+ if (el.contains(document.activeElement)) return
126
+ toasts.resume(t.id)
127
+ }
128
+
129
+ function onFocusOut(e: FocusEvent, t: Toast) {
130
+ const el = e.currentTarget as HTMLElement
131
+ if (el.contains(e.relatedTarget as Node | null)) return
132
+ if (hoverId === t.id || dragId === t.id) return
133
+ toasts.resume(t.id)
134
+ }
135
+
136
+ // ── focus management ──────────────────────────────────────────────
137
+ // Dismissing the toast that holds focus would drop focus to <body>. Before
138
+ // the node goes, move focus to a neighbouring toast, or back to where focus
139
+ // came from before it entered the stack.
140
+ // Plain (non-reactive) bookkeeping: read only inside the pre-effect below.
141
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
142
+ const toastEls = new Map<number, HTMLElement>()
143
+ let order: number[] = []
144
+ let returnFocus: HTMLElement | null = null
145
+
146
+ function track(id: number) {
147
+ return (el: HTMLElement) => {
148
+ toastEls.set(id, el)
149
+ return () => {
150
+ if (toastEls.get(id) === el) toastEls.delete(id)
151
+ }
152
+ }
153
+ }
154
+
155
+ function onRootFocusIn(e: FocusEvent) {
156
+ const from = e.relatedTarget as HTMLElement | null
157
+ if (from && rootEl && !rootEl.contains(from)) returnFocus = from
158
+ }
159
+
160
+ $effect.pre(() => {
161
+ const ids = toasts.items.map((t) => t.id)
162
+ untrack(() => {
163
+ const alive = new Set(ids)
164
+ const active = typeof document === 'undefined' ? null : document.activeElement
165
+ if (active && rootEl?.contains(active)) {
166
+ const holder = order.find((id) => !alive.has(id) && toastEls.get(id)?.contains(active))
167
+ if (holder !== undefined) moveFocusFrom(holder, alive)
168
+ }
169
+ order = ids
170
+ })
171
+ })
172
+
173
+ function moveFocusFrom(id: number, alive: Set<number>) {
174
+ const i = order.indexOf(id)
175
+ const after = order.slice(i + 1).find((n) => alive.has(n) && toastEls.has(n))
176
+ const before = order
177
+ .slice(0, i)
178
+ .reverse()
179
+ .find((n) => alive.has(n) && toastEls.has(n))
180
+ const next = after ?? before
181
+ if (next !== undefined) {
182
+ toastEls.get(next)!.focus()
183
+ } else if (returnFocus?.isConnected) {
184
+ returnFocus.focus()
185
+ returnFocus = null
186
+ }
187
+ }
188
+
189
+ // Screen-reader announcements go through two live regions that are always
190
+ // rendered (a node inserted already carrying role=status/alert is often
191
+ // skipped by NVDA/JAWS). Each visible toast mirrors its message into the
192
+ // polite (status) or assertive (alert, errors) region; the visual toasts
193
+ // themselves carry no live semantics, so nothing is announced twice.
194
+ const politeItems = $derived(toasts.items.filter((t) => t.kind !== 'error'))
195
+ const assertiveItems = $derived(toasts.items.filter((t) => t.kind === 'error'))
97
196
  </script>
98
197
 
99
198
  <div
100
199
  class="ss-toaster"
200
+ role="region"
101
201
  aria-label="Notifications"
102
202
  data-position={position}
103
203
  data-size-variant={resolveComponentSize('Toaster', size)}
104
204
  bind:this={rootEl}
205
+ onfocusin={onRootFocusIn}
105
206
  >
207
+ <div class="live" role="status" aria-live="polite">
208
+ {#each politeItems as t (t.id)}<p>{t.message}</p>{/each}
209
+ </div>
210
+ <div class="live" role="alert" aria-live="assertive">
211
+ {#each assertiveItems as t (t.id)}<p>{t.message}</p>{/each}
212
+ </div>
106
213
  {#each toasts.items as t (t.id)}
214
+ <!-- The pointer/key handlers are progressive extras (pause, swipe, Escape); the buttons inside are the real controls. -->
215
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
107
216
  <div
108
217
  class="ss-toast {t.kind}"
109
218
  class:dragging={dragId === t.id}
110
- role={t.kind === 'error' ? 'alert' : 'status'}
111
- aria-live={t.kind === 'error' ? 'assertive' : 'polite'}
219
+ role="group"
220
+ aria-labelledby="{uid}-msg-{t.id}"
112
221
  tabindex="-1"
222
+ {@attach track(t.id)}
113
223
  style:transform={dragId === t.id ? `translateX(${dragDx}px)` : undefined}
114
224
  style:opacity={dragId === t.id ? Math.max(0.3, 1 - Math.abs(dragDx) / 200) : undefined}
115
225
  transition:fly={{ x: flyX, y: flyY, duration: flyDuration }}
116
- onpointerenter={() => toasts.pause(t.id)}
117
- onpointerleave={() => dragId !== t.id && toasts.resume(t.id)}
226
+ onpointerenter={() => onPointerEnter(t)}
227
+ onpointerleave={(e) => onPointerLeave(e, t)}
118
228
  onfocusin={() => toasts.pause(t.id)}
119
- onfocusout={() => toasts.resume(t.id)}
229
+ onfocusout={(e) => onFocusOut(e, t)}
120
230
  onpointerdown={(e) => onPointerDown(e, t)}
121
231
  onpointermove={(e) => onPointerMove(e, t)}
122
232
  onpointerup={(e) => endDrag(e, t)}
@@ -128,7 +238,7 @@
128
238
  {:else}
129
239
  <span class="ic" aria-hidden="true">{glyph[t.kind]}</span>
130
240
  {/if}
131
- <span class="msg">{t.message}</span>
241
+ <span class="msg" id="{uid}-msg-{t.id}">{t.message}</span>
132
242
  {#if t.action}
133
243
  <button class="action" type="button" onclick={() => runAction(t)}>
134
244
  {t.action.label}
@@ -147,14 +257,13 @@
147
257
  display: flex;
148
258
  flex-direction: column;
149
259
  gap: var(--ss-s-2);
150
- max-width: min(360px, 100vw - var(--ss-s-8));
260
+ max-inline-size: min(360px, 100vw - var(--ss-s-8));
151
261
  pointer-events: none;
152
262
  top: var(--ss-s-4);
153
- right: var(--ss-s-4);
263
+ inset-inline-end: var(--ss-s-4);
154
264
  }
155
265
  .ss-toaster[data-position=top-left] {
156
- right: auto;
157
- left: var(--ss-s-4);
266
+ inset-inline: var(--ss-s-4) auto;
158
267
  }
159
268
  .ss-toaster[data-position=bottom-right] {
160
269
  top: auto;
@@ -163,24 +272,34 @@
163
272
  }
164
273
  .ss-toaster[data-position=bottom-left] {
165
274
  top: auto;
166
- right: auto;
167
275
  bottom: var(--ss-s-4);
168
- left: var(--ss-s-4);
276
+ inset-inline: var(--ss-s-4) auto;
169
277
  flex-direction: column-reverse;
170
278
  }
171
279
  .ss-toaster[data-position=top-center] {
172
- right: auto;
280
+ inset-inline: auto;
173
281
  left: 50%;
174
282
  transform: translateX(-50%);
175
283
  }
176
284
  .ss-toaster[data-position=bottom-center] {
177
285
  top: auto;
178
- right: auto;
179
286
  bottom: var(--ss-s-4);
287
+ inset-inline: auto;
180
288
  left: 50%;
181
289
  transform: translateX(-50%);
182
290
  flex-direction: column-reverse;
183
291
  }
292
+ .ss-toaster .live {
293
+ position: absolute;
294
+ inline-size: 1px;
295
+ block-size: 1px;
296
+ padding: 0;
297
+ margin: -1px;
298
+ overflow: hidden;
299
+ clip: rect(0 0 0 0);
300
+ white-space: nowrap;
301
+ border: 0;
302
+ }
184
303
 
185
304
  .ss-toast {
186
305
  pointer-events: auto;
@@ -190,7 +309,7 @@
190
309
  padding: var(--ss-s-3) var(--ss-s-4);
191
310
  background: var(--ss-bg-elev);
192
311
  border: 1px solid var(--ss-line);
193
- border-left: 3px solid var(--ss-fg-faint);
312
+ border-inline-start: 3px solid var(--ss-fg-faint);
194
313
  box-shadow: var(--ss-shadow-pop);
195
314
  font-family: var(--ss-font-mono);
196
315
  font-size: var(--ss-ui-md);
@@ -206,16 +325,16 @@
206
325
  transition: transform var(--ss-dur-fast) var(--ss-ease);
207
326
  }
208
327
  .ss-toast.success {
209
- border-left-color: var(--ss-primary);
328
+ border-inline-start-color: var(--ss-primary);
210
329
  }
211
330
  .ss-toast.error {
212
- border-left-color: var(--ss-red);
331
+ border-inline-start-color: var(--ss-red);
213
332
  }
214
333
  .ss-toast.info {
215
- border-left-color: var(--ss-cyan);
334
+ border-inline-start-color: var(--ss-cyan);
216
335
  }
217
336
  .ss-toast.loading {
218
- border-left-color: var(--ss-fg-faint);
337
+ border-inline-start-color: var(--ss-fg-faint);
219
338
  }
220
339
  .ss-toast .ic {
221
340
  display: inline-flex;
@@ -279,6 +398,10 @@
279
398
  font-size: var(--ss-size-h3);
280
399
  line-height: 1;
281
400
  padding: 0;
401
+ display: inline-grid;
402
+ place-items: center;
403
+ min-inline-size: var(--ss-s-6);
404
+ min-block-size: var(--ss-s-6);
282
405
  }
283
406
  .ss-toast .x:hover {
284
407
  color: var(--ss-fg);
@@ -10,7 +10,7 @@
10
10
  * Tooltip content (the accessible description of the trigger): a plain string, or a
11
11
  * snippet for a small rendered template. Snippets must stay **phrasing content**
12
12
  * (`code`, `strong`, `kbd`, `br`, `Icon`, …) and must not contain interactive
13
- * elements — the tip is `pointer-events: none` and hidden while closed, per the
13
+ * elements — the tip is never focusable and is hidden while closed, per the
14
14
  * WAI-ARIA tooltip pattern.
15
15
  */
16
16
  text: string | Snippet
@@ -47,18 +47,70 @@
47
47
  /** Cross-axis nudge in px (x for top/bottom, y for left/right). */
48
48
  let shift = $state(0)
49
49
 
50
- function show() {
50
+ /** Focusable elements inside the trigger snippet, in the order a hover falls back on. */
51
+ const FOCUSABLE =
52
+ 'a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]'
53
+
54
+ /**
55
+ * The element that carries `aria-describedby` while open: the focused trigger on
56
+ * focusin, else the first focusable element in the trigger (a hover), else the
57
+ * trigger's first element. The wrapper `<span>` is never focused, so a description on
58
+ * it would never be read (DS-0163).
59
+ */
60
+ let describedEl: HTMLElement | null = null
61
+
62
+ function describedTarget(from?: EventTarget | null): HTMLElement | null {
63
+ if (!triggerEl) return null
64
+ if (from instanceof HTMLElement && from !== triggerEl && triggerEl.contains(from)) return from
65
+ return (
66
+ triggerEl.querySelector<HTMLElement>(FOCUSABLE) ??
67
+ (triggerEl.firstElementChild as HTMLElement | null) ??
68
+ triggerEl
69
+ )
70
+ }
71
+
72
+ /** Add/remove `tipId` as one token, so a trigger's own description (e.g. a hint) is kept. */
73
+ function describe(el: HTMLElement | null) {
74
+ if (describedEl === el) return
75
+ undescribe()
76
+ if (!el) return
77
+ const ids = (el.getAttribute('aria-describedby') ?? '').split(/\s+/).filter(Boolean)
78
+ if (!ids.includes(tipId)) el.setAttribute('aria-describedby', [...ids, tipId].join(' '))
79
+ describedEl = el
80
+ }
81
+ function undescribe() {
82
+ const el = describedEl
83
+ describedEl = null
84
+ if (!el) return
85
+ const ids = (el.getAttribute('aria-describedby') ?? '')
86
+ .split(/\s+/)
87
+ .filter((id) => id && id !== tipId)
88
+ if (ids.length) el.setAttribute('aria-describedby', ids.join(' '))
89
+ else el.removeAttribute('aria-describedby')
90
+ }
91
+
92
+ function show(e?: Event) {
51
93
  open = true
94
+ describe(describedTarget(e?.target))
52
95
  }
53
96
  function hide() {
54
97
  open = false
98
+ undescribe()
55
99
  }
56
- function onKeydown(e: KeyboardEvent) {
57
- // Escape dismisses the tooltip (WAI-ARIA tooltip pattern).
58
- if (e.key === 'Escape' && open) {
59
- open = false
100
+
101
+ // Escape dismisses the tooltip wherever focus is (WCAG 1.4.13, WAI-ARIA tooltip
102
+ // pattern): a document-level listener while open, so a hover-opened tip closes too.
103
+ $effect(() => {
104
+ if (!open) return
105
+ const onKeydown = (e: KeyboardEvent) => {
106
+ if (e.key === 'Escape') hide()
60
107
  }
61
- }
108
+ document.addEventListener('keydown', onKeydown)
109
+ return () => document.removeEventListener('keydown', onKeydown)
110
+ })
111
+
112
+ // Unmounting while open must not leave a dangling id on the trigger.
113
+ $effect(() => () => undescribe())
62
114
 
63
115
  const sizeAttr = $derived(resolveComponentSize('Tooltip', size))
64
116
 
@@ -173,9 +225,12 @@
173
225
  <!--
174
226
  Inline-block wrapper around the trigger snippet. Hover (mouseenter/leave) and
175
227
  focus (focusin/out — bubbling, so a focusable child trigger counts) toggle the
176
- tooltip; Escape dismisses it. While open the wrapper carries aria-describedby
177
- pointing at the tooltip; the tip itself is kept in the DOM but hidden (and
178
- given `hidden`) when closed so it is never announced.
228
+ tooltip; Escape (a document-level listener while open) dismisses it. While open
229
+ the focusable trigger inside the snippet (not this wrapper) carries
230
+ aria-describedby pointing at the tooltip; the tip itself is kept in the DOM but
231
+ hidden (and given `hidden`) when closed so it is never announced. While open the
232
+ tip is hoverable (it is a child of the wrapper, and a pseudo-element bridges the
233
+ offset gap), so moving the pointer onto it does not close it (WCAG 1.4.13).
179
234
 
180
235
  `text` is either a string or a snippet (DS-0144); a snippet renders inside the
181
236
  same tip element, so the accessible description stays whatever the tip contains.
@@ -186,17 +241,15 @@
186
241
  -->
187
242
  <!-- svelte-ignore a11y_no_static_element_interactions -- the wrapper is a passive
188
243
  container; the real interactive element is the trigger snippet inside it, and the
189
- hover/focus/keydown handlers only react to that child's bubbling events. -->
244
+ hover/focus handlers only react to that child's bubbling events. -->
190
245
  <span
191
246
  class="ss-tooltip"
192
247
  data-size-variant={sizeAttr}
193
248
  data-placement={resolved}
194
- aria-describedby={open ? tipId : undefined}
195
249
  onmouseenter={show}
196
250
  onmouseleave={hide}
197
251
  onfocusin={show}
198
252
  onfocusout={hide}
199
- onkeydown={onKeydown}
200
253
  >
201
254
  <span class="trigger" bind:this={triggerEl}>{@render children()}</span>
202
255
  <span
@@ -241,9 +294,14 @@
241
294
  transform: scale(0.98);
242
295
  transition: opacity var(--ss-dur) var(--ss-ease), transform var(--ss-dur) var(--ss-ease), visibility 0s linear var(--ss-dur);
243
296
  }
297
+ .tip::before {
298
+ content: "";
299
+ position: absolute;
300
+ }
244
301
  .tip.open {
245
302
  opacity: 1;
246
303
  visibility: visible;
304
+ pointer-events: auto;
247
305
  transform: scale(1);
248
306
  transition: opacity var(--ss-dur) var(--ss-ease), transform var(--ss-dur) var(--ss-ease), visibility 0s linear 0s;
249
307
  }
@@ -292,6 +350,36 @@
292
350
  transform: translateY(calc(-50% + var(--shift))) scale(1);
293
351
  }
294
352
 
353
+ .ss-tooltip[data-placement=top] .tip::before,
354
+ .ss-tooltip[data-placement=bottom] .tip::before {
355
+ left: 0;
356
+ right: 0;
357
+ height: var(--ss-tooltip-offset, 6px);
358
+ }
359
+
360
+ .ss-tooltip[data-placement=top] .tip::before {
361
+ top: 100%;
362
+ }
363
+
364
+ .ss-tooltip[data-placement=bottom] .tip::before {
365
+ bottom: 100%;
366
+ }
367
+
368
+ .ss-tooltip[data-placement=left] .tip::before,
369
+ .ss-tooltip[data-placement=right] .tip::before {
370
+ top: 0;
371
+ bottom: 0;
372
+ width: var(--ss-tooltip-offset, 6px);
373
+ }
374
+
375
+ .ss-tooltip[data-placement=left] .tip::before {
376
+ left: 100%;
377
+ }
378
+
379
+ .ss-tooltip[data-placement=right] .tip::before {
380
+ right: 100%;
381
+ }
382
+
295
383
  @media (prefers-reduced-motion: reduce) {
296
384
  .tip,
297
385
  .tip.open {
@@ -7,7 +7,7 @@ interface Props {
7
7
  * Tooltip content (the accessible description of the trigger): a plain string, or a
8
8
  * snippet for a small rendered template. Snippets must stay **phrasing content**
9
9
  * (`code`, `strong`, `kbd`, `br`, `Icon`, …) and must not contain interactive
10
- * elements — the tip is `pointer-events: none` and hidden while closed, per the
10
+ * elements — the tip is never focusable and is hidden while closed, per the
11
11
  * WAI-ARIA tooltip pattern.
12
12
  */
13
13
  text: string | Snippet;
@@ -29,6 +29,7 @@
29
29
  type ShortcutPlatform,
30
30
  } from '../shortcuts.svelte.js'
31
31
  import Kbd from './Kbd.svelte'
32
+ import Icon from './Icon.svelte'
32
33
 
33
34
  interface Stat {
34
35
  key: string
@@ -117,6 +118,13 @@
117
118
  ),
118
119
  )
119
120
 
121
+ // DS-0182: the roving tab stop is the active tab; when `active` matches no
122
+ // tab, fall back to the first button tab so the strip stays reachable by Tab.
123
+ const rovingIdx = $derived.by(() => {
124
+ const i = items.findIndex((t) => t.id === active)
125
+ return i >= 0 ? i : items.findIndex((t) => !t.href)
126
+ })
127
+
120
128
  // DS-0081: resolve the services prop to data-or-nothing.
121
129
  const svc = $derived(services === true ? DEFAULT_SERVICES : services === false ? null : services)
122
130
 
@@ -238,7 +246,7 @@
238
246
  type="button"
239
247
  class="tab {current ? 'active' : ''}"
240
248
  aria-current={current ? 'page' : undefined}
241
- tabindex={current ? 0 : -1}
249
+ tabindex={i === rovingIdx ? 0 : -1}
242
250
  onclick={() => onTab?.(tab.id)}
243
251
  onkeydown={(e) => onTabKeydown(e, i)}
244
252
  >
@@ -272,6 +280,8 @@
272
280
  onclick={() => onCommand?.()}
273
281
  >
274
282
  <span class="kbd" aria-hidden="true"><Kbd keys="mod+k" {platform} {size} /></span>
283
+ <!-- DS-0157: the chip hides on keyboard-less devices; a search glyph keeps the tap target visible. -->
284
+ <span class="touch" aria-hidden="true"><Icon name="search" px={14} /></span>
275
285
  </button>
276
286
  {/if}
277
287
 
@@ -309,8 +319,8 @@
309
319
  }
310
320
  .ss-topbar .skip {
311
321
  position: absolute;
312
- left: var(--ss-s-1);
313
- top: var(--ss-s-1);
322
+ inset-inline-start: var(--ss-s-1);
323
+ inset-block-start: var(--ss-s-1);
314
324
  z-index: 20;
315
325
  padding: var(--ss-chip-py) var(--ss-badge-px);
316
326
  background: var(--ss-primary);
@@ -328,13 +338,13 @@
328
338
  align-items: center;
329
339
  gap: var(--ss-s-2);
330
340
  padding: 0 var(--ss-panel-head-px);
331
- border-right: 1px solid var(--ss-line);
341
+ border-inline-end: 1px solid var(--ss-line);
332
342
  cursor: default;
333
343
  flex: none;
334
344
  }
335
345
  .ss-topbar .seg.right {
336
- border-right: none;
337
- border-left: 1px solid var(--ss-line);
346
+ border-inline-end: none;
347
+ border-inline-start: 1px solid var(--ss-line);
338
348
  }
339
349
  .ss-topbar .seg.click {
340
350
  cursor: pointer;
@@ -345,15 +355,14 @@
345
355
  }
346
356
  .ss-topbar button.seg {
347
357
  background: transparent;
348
- border-top: 0;
349
- border-bottom: 0;
350
- border-right: 0;
358
+ border-block: 0;
359
+ border-inline-end: 0;
351
360
  color: inherit;
352
361
  font: inherit;
353
362
  min-height: var(--ss-s-6);
354
363
  }
355
364
  .ss-topbar button.seg.right {
356
- border-left: 1px solid var(--ss-line);
365
+ border-inline-start: 1px solid var(--ss-line);
357
366
  }
358
367
  .ss-topbar .logo {
359
368
  color: var(--ss-fg);
@@ -382,13 +391,12 @@
382
391
  padding: 0 var(--ss-row-px);
383
392
  min-height: var(--ss-s-6);
384
393
  color: var(--ss-fg-faint);
385
- border-right: 1px solid var(--ss-line);
394
+ border-inline-end: 1px solid var(--ss-line);
386
395
  cursor: pointer;
387
396
  font: 500 var(--ss-ui-md) var(--ss-font-mono);
388
397
  background: transparent;
389
- border-top: 0;
390
- border-bottom: 0;
391
- border-left: 0;
398
+ border-block: 0;
399
+ border-inline-start: 0;
392
400
  text-decoration: none;
393
401
  transition: all var(--ss-dur-fast) var(--ss-ease);
394
402
  }
@@ -398,7 +406,7 @@
398
406
  }
399
407
  .ss-topbar .ws .tab .n {
400
408
  color: var(--ss-fg-faint);
401
- margin-right: 6px;
409
+ margin-inline-end: 6px;
402
410
  }
403
411
  .ss-topbar .ws .tab.active {
404
412
  color: var(--ss-fg);
@@ -422,7 +430,7 @@
422
430
  }
423
431
  .ss-topbar .stat .k {
424
432
  color: var(--ss-fg-faint);
425
- margin-right: var(--ss-s-1);
433
+ margin-inline-end: var(--ss-s-1);
426
434
  }
427
435
  .ss-topbar .stat .v {
428
436
  color: var(--ss-fg);
@@ -439,6 +447,16 @@
439
447
  display: inline-flex;
440
448
  align-items: center;
441
449
  }
450
+ .ss-topbar .touch {
451
+ display: none;
452
+ align-items: center;
453
+ color: var(--ss-fg-muted);
454
+ }
455
+ @media (hover: none) and (pointer: coarse) {
456
+ .ss-topbar .touch {
457
+ display: inline-flex;
458
+ }
459
+ }
442
460
  @media (max-width: 720px) {
443
461
  .ss-topbar .collapsible {
444
462
  display: none;
@@ -448,4 +466,9 @@
448
466
  .ss-topbar .ws {
449
467
  display: none;
450
468
  }
469
+ }
470
+
471
+ .tab::before,
472
+ .skip::before {
473
+ content: none;
451
474
  }</style>
@@ -81,7 +81,7 @@ export interface Palette {
81
81
  /** Size axis values — derived from the manifest (`'sm' | 'md' | 'lg'`). */
82
82
  export type Size = (typeof dssocaConfig)['size']['values'][number];
83
83
  /** Names of the components that accept a `size` prop / `componentsSize` entry. */
84
- export declare const COMPONENT_NAMES: readonly ["Accordion", "Avatar", "Badge", "BottomNav", "Button", "Card", "Chart", "Container", "DateField", "EmptyState", "FileDrop", "Heading", "Icon", "Image", "Input", "Kbd", "Link", "LogStream", "Menu", "MetricTile", "Modal", "NumberField", "Pagination", "SearchPalette", "SegmentedControl", "Select", "ServiceCard", "Sidebar", "Sparkline", "Spinner", "Switch", "Table", "Textarea", "Toaster", "Tooltip", "Topbar"];
84
+ export declare const COMPONENT_NAMES: readonly ["Accordion", "Avatar", "Badge", "BottomNav", "Button", "Card", "Chart", "Container", "DateField", "EmptyState", "FileDrop", "Heading", "Icon", "Image", "Input", "Kbd", "Link", "LogStream", "Menu", "MetricTile", "Modal", "NumberField", "Pagination", "SearchPalette", "SegmentedControl", "Select", "ServiceCard", "Sidebar", "Sparkline", "Spinner", "Switch", "Table", "Textarea", "TierList", "Toaster", "Tooltip", "Topbar"];
85
85
  export type ComponentName = (typeof COMPONENT_NAMES)[number];
86
86
  /** Per-component default sizes; any omitted component inherits `sizeVariant`. */
87
87
  export type ComponentsSize = Partial<Record<ComponentName, Size>>;
@@ -103,6 +103,7 @@ export const COMPONENT_NAMES = [
103
103
  'Switch',
104
104
  'Table',
105
105
  'Textarea',
106
+ 'TierList',
106
107
  'Toaster',
107
108
  'Tooltip',
108
109
  'Topbar',
package/dist/icons.d.ts CHANGED
@@ -33,6 +33,7 @@ declare const BUILTIN_PATHS: {
33
33
  readonly linkedin: "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\"/><path d=\"M8 16v-5M8 8v.01M12 16v-5h2l2 2v3\"/>";
34
34
  readonly language: "<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M3 12h18M12 3L8 12l4 9M12 3l4 9-4 9\"/>";
35
35
  readonly 'color-swatch': "<rect x=\"3\" y=\"3\" width=\"8\" height=\"18\"/><path d=\"M7 17v.01\"/><path d=\"M11 19l8-8 2 2-8 8\"/><path d=\"M13 21h8\"/>";
36
+ readonly search: "<circle cx=\"10.5\" cy=\"10.5\" r=\"6.5\"/><path d=\"M15.5 15.5L21 21\"/>";
36
37
  };
37
38
  export type IconName = keyof typeof BUILTIN_PATHS;
38
39
  /**
@@ -40,15 +41,32 @@ export type IconName = keyof typeof BUILTIN_PATHS;
40
41
  * (`PATHS` is kept as the public name for backward compatibility.)
41
42
  */
42
43
  export declare const PATHS: Record<string, string>;
44
+ /**
45
+ * Strip `<script>`, `<foreignObject>`, `on*` event-handler attributes and `javascript:`
46
+ * links from SVG inner markup. Repeats until stable so split-up payloads can't reassemble.
47
+ *
48
+ * This is a light filter, **not** a security boundary: a regex can't fully parse markup.
49
+ * Markup passed to `registerIcon` or Icon's `paths` must still be trusted (authored by you,
50
+ * never user input).
51
+ */
52
+ export declare function sanitizeIconMarkup(markup: string): string;
43
53
  /**
44
54
  * Register (or override) a glyph at runtime so `<Icon name="foo" />` resolves
45
55
  * raw SVG inner markup that isn't part of the curated {@link IconName} union.
46
- * The markup is rendered verbatim inside the icon's `<svg viewBox="0 0 24 24">`.
56
+ * The markup is rendered inside the icon's `<svg viewBox="0 0 24 24">` after a light
57
+ * {@link sanitizeIconMarkup} pass.
58
+ *
59
+ * **Trust requirement:** `paths` is injected as HTML. Only pass markup you control (your own
60
+ * icon set, a vetted file); never user-supplied or third-party strings. The filter removes
61
+ * obvious script vectors but is not a substitute for that.
47
62
  *
48
63
  * registerIcon('heart', '<path d="M12 21 4 13a5 5 0 0 1 7-7l1 1 1-1a5 5 0 0 1 7 7z"/>')
49
64
  * <Icon name={'heart' as IconName} />
50
65
  */
51
66
  export declare function registerIcon(name: string, paths: string): void;
52
- /** Look a glyph up; built-ins first, then runtime registrations. */
67
+ /**
68
+ * Look a glyph up; built-ins first, then runtime registrations. Registered markup comes back
69
+ * through {@link sanitizeIconMarkup} (also covers direct writes to the public `PATHS` record).
70
+ */
53
71
  export declare function resolveIcon(name: string): string | undefined;
54
72
  export {};