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
@@ -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;
@@ -314,6 +350,7 @@ a.ss-svc:focus-visible,
314
350
  animation: none;
315
351
  }
316
352
  }
353
+ .overlay::before,
317
354
  .ss-svc::before {
318
355
  content: none;
319
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;
@@ -344,7 +344,7 @@
344
344
  text-decoration: line-through;
345
345
  }
346
346
  .ss-shortcuts-help .off-tag {
347
- margin-left: var(--ss-s-1);
347
+ margin-inline-start: var(--ss-s-1);
348
348
  color: var(--ss-fg-muted);
349
349
  }
350
350
  .ss-shortcuts-help .extra {
@@ -117,8 +117,23 @@
117
117
  }
118
118
 
119
119
  const sizeAttr = $derived(resolveComponentSize('Sidebar', size))
120
+
121
+ // Per-instance id prefix so two Sidebars on one page never share section/panel ids.
122
+ const uid = $props.id()
120
123
  </script>
121
124
 
125
+ <!-- Status dot + a visually hidden status word, so degraded/down never relies on colour alone
126
+ (WCAG 1.4.1). In the collapsed rail the item's aria-label already carries the word. -->
127
+ {#snippet statusDot(status: SideStatus | undefined)}
128
+ {#if status}
129
+ <span
130
+ class="dot {status === 'deg' ? 'warn' : status === 'down' ? 'err' : ''}"
131
+ aria-hidden="true"
132
+ ></span>
133
+ {#if STATUS_WORD[status]}<span class="sr-only">, {STATUS_WORD[status]}</span>{/if}
134
+ {/if}
135
+ {/snippet}
136
+
122
137
  <nav
123
138
  class="ss-side"
124
139
  aria-label="Sidebar"
@@ -129,8 +144,8 @@
129
144
  <button
130
145
  type="button"
131
146
  class="rail-toggle"
132
- aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
133
- aria-pressed={collapsed}
147
+ aria-label="Sidebar"
148
+ aria-expanded={!collapsed}
134
149
  onclick={() => onToggleCollapsed?.(!collapsed)}
135
150
  >
136
151
  <Icon name="arrow" px={13} />
@@ -138,14 +153,14 @@
138
153
  {/if}
139
154
 
140
155
  {#each groups as g, gi}
141
- {@const labelId = `ss-side-sec-${gi}`}
156
+ {@const labelId = `${uid}-sec-${gi}`}
142
157
  <div class="section" id={labelId}>{g.section}</div>
143
158
  <ul class="list" aria-labelledby={labelId}>
144
159
  {#each g.items as item}
145
160
  <li class="row">
146
161
  {#if item.children?.length}
147
162
  {@const open = isOpen(item)}
148
- {@const panelId = `ss-side-sub-${item.id}`}
163
+ {@const panelId = `${uid}-sub-${item.id}`}
149
164
  <button
150
165
  type="button"
151
166
  class="item disclosure {hasActiveDescendant(item) ? 'active' : ''}"
@@ -160,12 +175,7 @@
160
175
  {#if item.badge != null && item.badge !== ''}
161
176
  <span class="badge">{item.badge}</span>
162
177
  {/if}
163
- {#if item.status}
164
- <span
165
- class="dot {item.status === 'deg' ? 'warn' : item.status === 'down' ? 'err' : ''}"
166
- aria-hidden="true"
167
- ></span>
168
- {/if}
178
+ {@render statusDot(item.status)}
169
179
  <span class="caret {open ? 'open' : ''}" aria-hidden="true"></span>
170
180
  </button>
171
181
  <ul class="sublist" id={panelId} aria-label={item.label} hidden={!open}>
@@ -191,16 +201,7 @@
191
201
  {#if child.badge != null && child.badge !== ''}
192
202
  <span class="badge">{child.badge}</span>
193
203
  {/if}
194
- {#if child.status}
195
- <span
196
- class="dot {child.status === 'deg'
197
- ? 'warn'
198
- : child.status === 'down'
199
- ? 'err'
200
- : ''}"
201
- aria-hidden="true"
202
- ></span>
203
- {/if}
204
+ {@render statusDot(child.status)}
204
205
  </a>
205
206
  {:else}
206
207
  <div
@@ -223,16 +224,7 @@
223
224
  {#if child.badge != null && child.badge !== ''}
224
225
  <span class="badge">{child.badge}</span>
225
226
  {/if}
226
- {#if child.status}
227
- <span
228
- class="dot {child.status === 'deg'
229
- ? 'warn'
230
- : child.status === 'down'
231
- ? 'err'
232
- : ''}"
233
- aria-hidden="true"
234
- ></span>
235
- {/if}
227
+ {@render statusDot(child.status)}
236
228
  </div>
237
229
  {/if}
238
230
  </li>
@@ -258,12 +250,7 @@
258
250
  {#if item.badge != null && item.badge !== ''}
259
251
  <span class="badge">{item.badge}</span>
260
252
  {/if}
261
- {#if item.status}
262
- <span
263
- class="dot {item.status === 'deg' ? 'warn' : item.status === 'down' ? 'err' : ''}"
264
- aria-hidden="true"
265
- ></span>
266
- {/if}
253
+ {@render statusDot(item.status)}
267
254
  </a>
268
255
  {:else}
269
256
  <div
@@ -286,12 +273,7 @@
286
273
  {#if item.badge != null && item.badge !== ''}
287
274
  <span class="badge">{item.badge}</span>
288
275
  {/if}
289
- {#if item.status}
290
- <span
291
- class="dot {item.status === 'deg' ? 'warn' : item.status === 'down' ? 'err' : ''}"
292
- aria-hidden="true"
293
- ></span>
294
- {/if}
276
+ {@render statusDot(item.status)}
295
277
  </div>
296
278
  {/if}
297
279
  </li>
@@ -302,7 +284,7 @@
302
284
 
303
285
  <style>@charset "UTF-8";
304
286
  .ss-side {
305
- border-right: 1px solid var(--ss-line);
287
+ border-inline-end: 1px solid var(--ss-line);
306
288
  padding: var(--ss-gap) var(--ss-s-1);
307
289
  display: flex;
308
290
  flex-direction: column;
@@ -331,10 +313,10 @@
331
313
  gap: 0;
332
314
  }
333
315
  .ss-side[data-collapsed] .dot {
334
- margin-left: 0;
316
+ margin-inline-start: 0;
335
317
  }
336
318
  .ss-side[data-collapsed] .sublist {
337
- padding-left: 0;
319
+ padding-inline-start: 0;
338
320
  }
339
321
  .ss-side .list,
340
322
  .ss-side .sublist {
@@ -346,7 +328,7 @@
346
328
  gap: 1px;
347
329
  }
348
330
  .ss-side .sublist {
349
- padding-left: var(--ss-s-3);
331
+ padding-inline-start: var(--ss-s-3);
350
332
  }
351
333
  .ss-side .row {
352
334
  display: block;
@@ -383,12 +365,10 @@
383
365
  cursor: pointer;
384
366
  color: var(--ss-fg-muted);
385
367
  font: 500 var(--ss-ui-md) var(--ss-font-mono);
386
- border-left: 2px solid transparent;
387
- border-top: 0;
388
- border-right: 0;
389
- border-bottom: 0;
368
+ border: 0;
369
+ border-inline-start: 2px solid transparent;
390
370
  background: none;
391
- text-align: left;
371
+ text-align: start;
392
372
  text-decoration: none;
393
373
  box-sizing: border-box;
394
374
  transition: all var(--ss-dur-fast) var(--ss-ease);
@@ -400,7 +380,7 @@
400
380
  .ss-side .item.active {
401
381
  color: var(--ss-fg);
402
382
  background: color-mix(in srgb, var(--ss-accent) 6%, transparent);
403
- border-left-color: var(--ss-primary);
383
+ border-inline-start-color: var(--ss-primary);
404
384
  }
405
385
  .ss-side .item .label {
406
386
  flex: 1 1 auto;
@@ -427,7 +407,7 @@
427
407
  }
428
408
  .ss-side .item .badge {
429
409
  flex: 0 0 auto;
430
- margin-left: auto;
410
+ margin-inline-start: auto;
431
411
  font-family: var(--ss-font-mono);
432
412
  font-size: var(--ss-ui-xs);
433
413
  line-height: 1;
@@ -438,13 +418,13 @@
438
418
  border-radius: 0;
439
419
  }
440
420
  .ss-side .item .badge + .dot {
441
- margin-left: var(--ss-s-1);
421
+ margin-inline-start: var(--ss-s-1);
442
422
  }
443
423
  .ss-side .item .dot {
444
424
  flex: 0 0 auto;
445
425
  width: 5px;
446
426
  height: 5px;
447
- margin-left: auto;
427
+ margin-inline-start: auto;
448
428
  background: var(--ss-primary);
449
429
  }
450
430
  .ss-side .item .dot.warn {
@@ -455,10 +435,10 @@
455
435
  }
456
436
  .ss-side .item .caret {
457
437
  flex: 0 0 auto;
458
- margin-left: var(--ss-s-1);
438
+ margin-inline-start: var(--ss-s-1);
459
439
  width: 0;
460
440
  height: 0;
461
- border-left: 4px solid currentColor;
441
+ border-inline-start: 4px solid currentColor;
462
442
  border-top: 3px solid transparent;
463
443
  border-bottom: 3px solid transparent;
464
444
  transition: transform var(--ss-dur-fast) var(--ss-ease);
@@ -466,9 +446,12 @@
466
446
  .ss-side .item .caret.open {
467
447
  transform: rotate(90deg);
468
448
  }
449
+ .ss-side .item .caret.open:dir(rtl) {
450
+ transform: rotate(-90deg);
451
+ }
469
452
  .ss-side .item .badge + .caret,
470
453
  .ss-side .item .dot + .caret {
471
- margin-left: var(--ss-s-1);
454
+ margin-inline-start: var(--ss-s-1);
472
455
  }
473
456
  .ss-side .item.child {
474
457
  font-size: var(--ss-ui-sm);
@@ -117,13 +117,13 @@
117
117
  }
118
118
  .ss-switch .track .thumb {
119
119
  position: absolute;
120
- top: var(--ss-switch-pad, 2px);
121
- left: var(--ss-switch-pad, 2px);
120
+ inset-block-start: var(--ss-switch-pad, 2px);
121
+ inset-inline-start: var(--ss-switch-pad, 2px);
122
122
  width: var(--ss-switch-thumb, 1rem);
123
123
  height: var(--ss-switch-thumb, 1rem);
124
124
  border-radius: 0;
125
125
  background: var(--ss-fg);
126
- transition: transform var(--ss-dur-fast) var(--ss-ease);
126
+ transition: inset-inline-start var(--ss-dur-fast) var(--ss-ease);
127
127
  }
128
128
  .ss-switch .track.on {
129
129
  background: var(--ss-primary);
@@ -131,15 +131,11 @@
131
131
  }
132
132
  .ss-switch .track.on .thumb {
133
133
  background: var(--ss-bg);
134
- transform: translateX(calc(var(--ss-switch-w, 2.25rem) - var(--ss-switch-thumb, 1rem) - 2 * var(--ss-switch-pad, 2px) - 2px));
134
+ inset-inline-start: calc(100% - var(--ss-switch-thumb, 1rem) - var(--ss-switch-pad, 2px));
135
135
  }
136
136
  .ss-switch .track:not(:disabled):hover {
137
137
  border-color: var(--ss-line-strong);
138
138
  }
139
- .ss-switch .track:focus-visible {
140
- outline: none;
141
- box-shadow: 0 0 0 2px var(--ss-primary-soft);
142
- }
143
139
  .ss-switch .track:disabled {
144
140
  cursor: not-allowed;
145
141
  opacity: 0.45;
@@ -16,8 +16,12 @@
16
16
  key: string
17
17
  /** Header text. */
18
18
  label: string
19
- /** Text alignment of the body cells. Numeric columns default to `right`. */
20
- align?: 'left' | 'right' | 'center'
19
+ /**
20
+ * Text alignment of the header and body cells. Logical: `start`/`end` follow the
21
+ * writing direction (so they flip in RTL). `left`/`right` are accepted for backward
22
+ * compatibility and map to `start`/`end`. Numeric columns default to `end`.
23
+ */
24
+ align?: 'start' | 'end' | 'left' | 'right' | 'center'
21
25
  /** Allow clicking the header to sort by this column. */
22
26
  sortable?: boolean
23
27
  /** Treat values as numbers — right-aligns, uses the mono font, sorts numerically. */
@@ -106,8 +110,12 @@
106
110
  return col.format ? col.format(value, row) : String(value ?? '')
107
111
  }
108
112
 
109
- function colAlign(col: TableColumn): 'left' | 'right' | 'center' {
110
- return col.align ?? (col.numeric ? 'right' : 'left')
113
+ // Logical alignment: legacy `left`/`right` map to `start`/`end` so RTL mirrors.
114
+ function colAlign(col: TableColumn): 'start' | 'end' | 'center' {
115
+ const a = col.align ?? (col.numeric ? 'end' : 'start')
116
+ if (a === 'left') return 'start'
117
+ if (a === 'right') return 'end'
118
+ return a
111
119
  }
112
120
 
113
121
  const isEmpty = $derived(rows.length === 0)
@@ -170,7 +178,7 @@
170
178
  }
171
179
  .ss-table caption {
172
180
  caption-side: top;
173
- text-align: left;
181
+ text-align: start;
174
182
  font-family: var(--ss-font-mono);
175
183
  font-size: var(--ss-ui-xs);
176
184
  color: var(--ss-fg-muted);
@@ -178,7 +186,7 @@
178
186
  padding-bottom: var(--ss-gap-sm);
179
187
  }
180
188
  .ss-table .head {
181
- text-align: left;
189
+ text-align: start;
182
190
  font-family: var(--ss-font-mono);
183
191
  font-size: var(--ss-ui-xs);
184
192
  font-weight: 500;
@@ -190,8 +198,8 @@
190
198
  padding: var(--ss-table-py, 8px) var(--ss-table-px, 12px);
191
199
  white-space: nowrap;
192
200
  }
193
- .ss-table .head[data-align=right] {
194
- text-align: right;
201
+ .ss-table .head[data-align=end], .ss-table .head[data-align=right] {
202
+ text-align: end;
195
203
  }
196
204
  .ss-table .head[data-align=center] {
197
205
  text-align: center;
@@ -218,10 +226,9 @@
218
226
  color: var(--ss-fg);
219
227
  }
220
228
  .ss-table .sort:focus-visible {
221
- outline: none;
222
229
  color: var(--ss-fg);
223
- box-shadow: 0 0 0 2px var(--ss-primary-soft);
224
230
  }
231
+ .ss-table .head[data-align=end] .sort,
225
232
  .ss-table .head[data-align=right] .sort {
226
233
  flex-direction: row-reverse;
227
234
  }
@@ -248,10 +255,10 @@
248
255
  padding: var(--ss-table-py, 8px) var(--ss-table-px, 12px);
249
256
  border-bottom: 1px solid var(--ss-line);
250
257
  vertical-align: middle;
251
- text-align: left;
258
+ text-align: start;
252
259
  }
253
- .ss-table .cell[data-align=right] {
254
- text-align: right;
260
+ .ss-table .cell[data-align=end], .ss-table .cell[data-align=right] {
261
+ text-align: end;
255
262
  }
256
263
  .ss-table .cell[data-align=center] {
257
264
  text-align: center;
@@ -12,8 +12,12 @@ export interface TableColumn {
12
12
  key: string;
13
13
  /** Header text. */
14
14
  label: string;
15
- /** Text alignment of the body cells. Numeric columns default to `right`. */
16
- align?: 'left' | 'right' | 'center';
15
+ /**
16
+ * Text alignment of the header and body cells. Logical: `start`/`end` follow the
17
+ * writing direction (so they flip in RTL). `left`/`right` are accepted for backward
18
+ * compatibility and map to `start`/`end`. Numeric columns default to `end`.
19
+ */
20
+ align?: 'start' | 'end' | 'left' | 'right' | 'center';
17
21
  /** Allow clicking the header to sort by this column. */
18
22
  sortable?: boolean;
19
23
  /** Treat values as numbers — right-aligns, uses the mono font, sorts numerically. */