dssoca 0.8.2 → 0.10.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 (65) hide show
  1. package/README.md +39 -13
  2. package/dist/components/Accordion.svelte +22 -6
  3. package/dist/components/Accordion.svelte.d.ts +5 -1
  4. package/dist/components/Avatar.svelte +119 -0
  5. package/dist/components/Avatar.svelte.d.ts +18 -0
  6. package/dist/components/Badge.svelte +3 -5
  7. package/dist/components/BottomNav.svelte +57 -19
  8. package/dist/components/BottomNav.svelte.d.ts +2 -0
  9. package/dist/components/Card.svelte +7 -1
  10. package/dist/components/Chart.svelte +527 -0
  11. package/dist/components/Chart.svelte.d.ts +42 -0
  12. package/dist/components/Container.svelte +55 -0
  13. package/dist/components/Container.svelte.d.ts +16 -0
  14. package/dist/components/DateField.svelte +188 -0
  15. package/dist/components/DateField.svelte.d.ts +37 -0
  16. package/dist/components/EmptyState.svelte +9 -3
  17. package/dist/components/EmptyState.svelte.d.ts +6 -0
  18. package/dist/components/FileDrop.svelte +355 -0
  19. package/dist/components/FileDrop.svelte.d.ts +24 -0
  20. package/dist/components/Heading.svelte +83 -0
  21. package/dist/components/Heading.svelte.d.ts +17 -0
  22. package/dist/components/Icon.svelte +32 -23
  23. package/dist/components/Icon.svelte.d.ts +7 -0
  24. package/dist/components/Image.svelte +19 -21
  25. package/dist/components/Input.svelte +2 -3
  26. package/dist/components/Link.svelte +42 -7
  27. package/dist/components/Link.svelte.d.ts +7 -0
  28. package/dist/components/LogStream.svelte +46 -31
  29. package/dist/components/Menu.svelte +59 -6
  30. package/dist/components/Menu.svelte.d.ts +22 -2
  31. package/dist/components/MetricTile.svelte +4 -4
  32. package/dist/components/Modal.svelte +223 -0
  33. package/dist/components/Modal.svelte.d.ts +29 -0
  34. package/dist/components/NumberField.svelte +260 -0
  35. package/dist/components/NumberField.svelte.d.ts +35 -0
  36. package/dist/components/Pagination.svelte +193 -0
  37. package/dist/components/Pagination.svelte.d.ts +22 -0
  38. package/dist/components/SegmentedControl.svelte +16 -4
  39. package/dist/components/SegmentedControl.svelte.d.ts +7 -0
  40. package/dist/components/Select.svelte +224 -0
  41. package/dist/components/Select.svelte.d.ts +42 -0
  42. package/dist/components/ServiceCard.svelte +15 -15
  43. package/dist/components/Sidebar.svelte +47 -21
  44. package/dist/components/Sparkline.svelte +15 -13
  45. package/dist/components/Spinner.svelte +124 -0
  46. package/dist/components/Spinner.svelte.d.ts +74 -0
  47. package/dist/components/Switch.svelte +144 -0
  48. package/dist/components/Switch.svelte.d.ts +22 -0
  49. package/dist/components/Table.svelte +267 -0
  50. package/dist/components/Table.svelte.d.ts +52 -0
  51. package/dist/components/Textarea.svelte +214 -0
  52. package/dist/components/Textarea.svelte.d.ts +38 -0
  53. package/dist/components/Toaster.svelte +20 -4
  54. package/dist/components/Tooltip.svelte +162 -0
  55. package/dist/components/Tooltip.svelte.d.ts +17 -0
  56. package/dist/components/Topbar.svelte +170 -50
  57. package/dist/components/Topbar.svelte.d.ts +30 -3
  58. package/dist/dssoca.config.d.ts +1 -1
  59. package/dist/dssoca.config.js +15 -0
  60. package/dist/index.d.ts +19 -1
  61. package/dist/index.js +19 -1
  62. package/dist/theme.css +177 -37
  63. package/dist/toast.svelte.js +3 -3
  64. package/dist/tokens.css +597 -0
  65. package/package.json +33 -4
@@ -0,0 +1,162 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+ import { resolveComponentSize, type Size } from '../config.js'
4
+
5
+ /** Side the tooltip attaches to relative to the trigger. */
6
+ type Placement = 'top' | 'bottom' | 'left' | 'right'
7
+
8
+ interface Props {
9
+ /** Tooltip text (the accessible description of the trigger). */
10
+ text: string
11
+ /** Where the tooltip attaches relative to the trigger. Default `top`. */
12
+ placement?: Placement
13
+ /** Token size (sm|md|lg); inherits the global size when unset. */
14
+ size?: Size
15
+ /** Trigger content (wrapped in an inline-block container). */
16
+ children: Snippet
17
+ }
18
+
19
+ let { text, placement = 'top', size, children }: Props = $props()
20
+
21
+ const tipId = $props.id()
22
+
23
+ let open = $state(false)
24
+
25
+ function show() {
26
+ open = true
27
+ }
28
+ function hide() {
29
+ open = false
30
+ }
31
+ function onKeydown(e: KeyboardEvent) {
32
+ // Escape dismisses the tooltip (WAI-ARIA tooltip pattern).
33
+ if (e.key === 'Escape' && open) {
34
+ open = false
35
+ }
36
+ }
37
+
38
+ const sizeAttr = $derived(resolveComponentSize('Tooltip', size))
39
+ </script>
40
+
41
+ <!--
42
+ Inline-block wrapper around the trigger snippet. Hover (mouseenter/leave) and
43
+ focus (focusin/out — bubbling, so a focusable child trigger counts) toggle the
44
+ tooltip; Escape dismisses it. While open the wrapper carries aria-describedby
45
+ pointing at the tooltip; the tip itself is kept in the DOM but hidden (and
46
+ given `hidden`) when closed so it is never announced.
47
+ -->
48
+ <!-- svelte-ignore a11y_no_static_element_interactions -- the wrapper is a passive
49
+ container; the real interactive element is the trigger snippet inside it, and the
50
+ hover/focus/keydown handlers only react to that child's bubbling events. -->
51
+ <span
52
+ class="ss-tooltip"
53
+ data-size-variant={sizeAttr}
54
+ data-placement={placement}
55
+ aria-describedby={open ? tipId : undefined}
56
+ onmouseenter={show}
57
+ onmouseleave={hide}
58
+ onfocusin={show}
59
+ onfocusout={hide}
60
+ onkeydown={onKeydown}
61
+ >
62
+ <span class="trigger">{@render children()}</span>
63
+ <span id={tipId} class="tip" class:open role="tooltip" hidden={!open}>{text}</span>
64
+ </span>
65
+
66
+ <style>.ss-tooltip {
67
+ position: relative;
68
+ display: inline-block;
69
+ }
70
+
71
+ .trigger {
72
+ display: inline-flex;
73
+ }
74
+
75
+ .tip {
76
+ position: absolute;
77
+ z-index: 60;
78
+ width: max-content;
79
+ max-width: var(--ss-tooltip-max-w, 240px);
80
+ padding: var(--ss-tooltip-py, 4px) var(--ss-tooltip-px, 8px);
81
+ font: 500 var(--ss-ui-xs) var(--ss-font-mono);
82
+ color: var(--ss-fg);
83
+ background: var(--ss-bg-elev);
84
+ border: 1px solid var(--ss-line);
85
+ box-shadow: var(--ss-shadow-pop);
86
+ border-radius: 0;
87
+ opacity: 0;
88
+ visibility: hidden;
89
+ pointer-events: none;
90
+ transform: scale(0.98);
91
+ transition: opacity var(--ss-dur) var(--ss-ease), transform var(--ss-dur) var(--ss-ease), visibility 0s linear var(--ss-dur);
92
+ }
93
+ .tip.open {
94
+ opacity: 1;
95
+ visibility: visible;
96
+ transform: scale(1);
97
+ transition: opacity var(--ss-dur) var(--ss-ease), transform var(--ss-dur) var(--ss-ease), visibility 0s linear 0s;
98
+ }
99
+
100
+ .ss-tooltip[data-placement=top] .tip {
101
+ bottom: calc(100% + var(--ss-tooltip-offset, 6px));
102
+ left: 50%;
103
+ transform: translateX(-50%) scale(0.98);
104
+ transform-origin: bottom center;
105
+ }
106
+
107
+ .ss-tooltip[data-placement=top] .tip.open {
108
+ transform: translateX(-50%) scale(1);
109
+ }
110
+
111
+ .ss-tooltip[data-placement=bottom] .tip {
112
+ top: calc(100% + var(--ss-tooltip-offset, 6px));
113
+ left: 50%;
114
+ transform: translateX(-50%) scale(0.98);
115
+ transform-origin: top center;
116
+ }
117
+
118
+ .ss-tooltip[data-placement=bottom] .tip.open {
119
+ transform: translateX(-50%) scale(1);
120
+ }
121
+
122
+ .ss-tooltip[data-placement=left] .tip {
123
+ right: calc(100% + var(--ss-tooltip-offset, 6px));
124
+ top: 50%;
125
+ transform: translateY(-50%) scale(0.98);
126
+ transform-origin: right center;
127
+ }
128
+
129
+ .ss-tooltip[data-placement=left] .tip.open {
130
+ transform: translateY(-50%) scale(1);
131
+ }
132
+
133
+ .ss-tooltip[data-placement=right] .tip {
134
+ left: calc(100% + var(--ss-tooltip-offset, 6px));
135
+ top: 50%;
136
+ transform: translateY(-50%) scale(0.98);
137
+ transform-origin: left center;
138
+ }
139
+
140
+ .ss-tooltip[data-placement=right] .tip.open {
141
+ transform: translateY(-50%) scale(1);
142
+ }
143
+
144
+ @media (prefers-reduced-motion: reduce) {
145
+ .tip,
146
+ .tip.open {
147
+ transition: none;
148
+ transform: none;
149
+ }
150
+ .ss-tooltip[data-placement=top] .tip,
151
+ .ss-tooltip[data-placement=top] .tip.open,
152
+ .ss-tooltip[data-placement=bottom] .tip,
153
+ .ss-tooltip[data-placement=bottom] .tip.open {
154
+ transform: translateX(-50%);
155
+ }
156
+ .ss-tooltip[data-placement=left] .tip,
157
+ .ss-tooltip[data-placement=left] .tip.open,
158
+ .ss-tooltip[data-placement=right] .tip,
159
+ .ss-tooltip[data-placement=right] .tip.open {
160
+ transform: translateY(-50%);
161
+ }
162
+ }</style>
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type Size } from '../config.js';
3
+ /** Side the tooltip attaches to relative to the trigger. */
4
+ type Placement = 'top' | 'bottom' | 'left' | 'right';
5
+ interface Props {
6
+ /** Tooltip text (the accessible description of the trigger). */
7
+ text: string;
8
+ /** Where the tooltip attaches relative to the trigger. Default `top`. */
9
+ placement?: Placement;
10
+ /** Token size (sm|md|lg); inherits the global size when unset. */
11
+ size?: Size;
12
+ /** Trigger content (wrapped in an inline-block container). */
13
+ children: Snippet;
14
+ }
15
+ declare const Tooltip: import("svelte").Component<Props, {}, "">;
16
+ type Tooltip = ReturnType<typeof Tooltip>;
17
+ export default Tooltip;
@@ -1,15 +1,43 @@
1
+ <script module lang="ts">
2
+ /**
3
+ * One tab in the Topbar strip (DS-0080). The shorthand `string` form is
4
+ * equivalent to `{ id: s, label: s }`.
5
+ */
6
+ export interface TopbarTab {
7
+ /** Stable id — matched against `active` and passed to `onTab`. */
8
+ id: string
9
+ /** Visible label; defaults to `id` (decouple for localized labels). */
10
+ label?: string
11
+ /** Optional URL — when set the tab renders as a real `<a href>`. */
12
+ href?: string
13
+ }
14
+
15
+ /** Services status summary shown in the right-side dot segment. */
16
+ export interface TopbarServices {
17
+ up: number
18
+ total: number
19
+ }
20
+ </script>
21
+
1
22
  <script lang="ts">
2
23
  import type { Snippet } from 'svelte'
3
24
  import { resolveComponentSize, type Size } from '../config.js'
4
25
 
5
- interface Stat { key: string; value: string; title?: string }
26
+ interface Stat {
27
+ key: string
28
+ value: string
29
+ title?: string
30
+ }
6
31
 
7
32
  interface Props {
8
33
  active?: string
9
34
  user?: string
10
- tabs?: string[]
35
+ /** Tab strip: plain strings (id = label) or `{ id, label?, href? }` objects. */
36
+ tabs?: Array<string | TopbarTab>
37
+ /** Fired with the tab id when a tab is activated (also for `href` tabs). */
11
38
  onTab?: (tab: string) => void
12
- /** Fired when the command menu is opened (chip click or Cmd/Ctrl+K). */
39
+ /** Fired when the command menu is opened (chip click or Cmd/Ctrl+K).
40
+ * The ⌘K chip and the shortcut only exist when this handler is provided. */
13
41
  onCommand?: () => void
14
42
  /** Fired when the user chip is activated (when no `userMenu` snippet given). */
15
43
  onUser?: () => void
@@ -17,12 +45,19 @@
17
45
  userMenu?: Snippet
18
46
  /** Custom brand mark + name; defaults to the built-in logo. */
19
47
  brand?: Snippet
20
- /** Right-aligned stat segments; defaults to the built-in homelab stats. */
48
+ /** Right-aligned stat segments; defaults to the built-in homelab stats. Pass `[]` to remove. */
21
49
  stats?: Stat[]
50
+ /** Services status segment: `true` keeps the built-in 6/7 demo summary,
51
+ * `{ up, total }` renders real numbers, `false` removes the segment. */
52
+ services?: boolean | TopbarServices
53
+ /** Live clock segment; `false` removes it (and skips the interval). */
54
+ clock?: boolean
22
55
  /** Anchor the skip link jumps to. */
23
56
  skipTarget?: string
24
57
  /** When true, the header sticks to the top of the viewport. */
25
58
  sticky?: boolean
59
+ /** Accessible name for the tab-strip `<nav>` landmark (DS-0078). */
60
+ ariaLabel?: string
26
61
  /** Token size (sm|md|lg); inherits the global size when unset. */
27
62
  size?: Size
28
63
  }
@@ -33,6 +68,8 @@
33
68
  { key: 'net', value: '↓1.2 ↑0.3', title: 'network' },
34
69
  ]
35
70
 
71
+ const DEFAULT_SERVICES: TopbarServices = { up: 6, total: 7 }
72
+
36
73
  let {
37
74
  active = 'overview',
38
75
  user = 'admin@hub.home',
@@ -43,51 +80,96 @@
43
80
  userMenu,
44
81
  brand,
45
82
  stats = DEFAULT_STATS,
83
+ services = true,
84
+ clock = true,
46
85
  skipTarget = '#main',
47
86
  sticky = true,
87
+ ariaLabel = 'Primary',
48
88
  size,
49
89
  }: Props = $props()
50
90
 
51
- function pad(n: number) { return String(n).padStart(2, '0') }
91
+ // SSR safety (DS-0067): same guard pattern as toast.svelte.ts — effects
92
+ // normally don't run on the server, but the guard is the house convention
93
+ // and protects against eager evaluation.
94
+ const hasWindow = typeof window !== 'undefined'
95
+
96
+ // DS-0080: normalize both tab shapes to one internal form. `string` tabs
97
+ // keep id === label; object tabs default `label` to `id`.
98
+ const items = $derived(
99
+ tabs.map((t): { id: string; label: string; href?: string } =>
100
+ typeof t === 'string'
101
+ ? { id: t, label: t }
102
+ : { id: t.id, label: t.label ?? t.id, href: t.href },
103
+ ),
104
+ )
105
+
106
+ // DS-0081: resolve the services prop to data-or-nothing.
107
+ const svc = $derived(services === true ? DEFAULT_SERVICES : services === false ? null : services)
108
+
109
+ function pad(n: number) {
110
+ return String(n).padStart(2, '0')
111
+ }
52
112
  function nowStr() {
53
113
  const d = new Date()
54
114
  return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
55
115
  }
56
116
 
57
- let clock = $state(nowStr())
117
+ let time = $state(nowStr())
58
118
 
59
119
  $effect(() => {
60
- const t = setInterval(() => { clock = nowStr() }, 1000)
120
+ const t = clock
121
+ ? setInterval(() => {
122
+ time = nowStr()
123
+ }, 1000)
124
+ : undefined
61
125
  const onKey = (e: KeyboardEvent) => {
62
- if ((e.metaKey || e.ctrlKey) && (e.key === 'k' || e.key === 'K')) {
126
+ // Only claim the Cmd/Ctrl+K shortcut when a command handler exists
127
+ // (DS-0081) — otherwise leave the browser's default alone.
128
+ if (onCommand && (e.metaKey || e.ctrlKey) && (e.key === 'k' || e.key === 'K')) {
63
129
  e.preventDefault()
64
- onCommand?.()
130
+ onCommand()
65
131
  }
66
132
  }
67
- window.addEventListener('keydown', onKey)
133
+ if (hasWindow) window.addEventListener('keydown', onKey)
68
134
  return () => {
69
- clearInterval(t)
70
- window.removeEventListener('keydown', onKey)
135
+ if (t) clearInterval(t)
136
+ if (hasWindow) window.removeEventListener('keydown', onKey)
71
137
  }
72
138
  })
73
139
 
74
- const [h, m, s] = $derived(clock.split(':'))
140
+ const [h, m, s] = $derived(time.split(':'))
75
141
 
76
142
  // Roving tabindex: arrow keys move focus across the tab strip (wrapping),
77
- // Home/End jump to the ends. The active tab is the single tab stop.
78
- let tabEls: HTMLButtonElement[] = $state([])
143
+ // Home/End jump to the ends. Button tabs keep the active tab as the single
144
+ // tab stop; link tabs stay in the natural tab order so they remain
145
+ // keyboard-reachable without JS (SSR, DS-0080).
146
+ let tabEls: (HTMLAnchorElement | HTMLButtonElement)[] = $state([])
79
147
  function focusTab(i: number) {
80
- const n = tabs.length
148
+ const n = items.length
81
149
  if (!n) return
82
150
  const idx = ((i % n) + n) % n
83
151
  tabEls[idx]?.focus()
84
152
  }
85
153
  function onTabKeydown(e: KeyboardEvent, i: number) {
86
154
  switch (e.key) {
87
- case 'ArrowRight': case 'ArrowDown': e.preventDefault(); focusTab(i + 1); break
88
- case 'ArrowLeft': case 'ArrowUp': e.preventDefault(); focusTab(i - 1); break
89
- case 'Home': e.preventDefault(); focusTab(0); break
90
- case 'End': e.preventDefault(); focusTab(tabs.length - 1); break
155
+ case 'ArrowRight':
156
+ case 'ArrowDown':
157
+ e.preventDefault()
158
+ focusTab(i + 1)
159
+ break
160
+ case 'ArrowLeft':
161
+ case 'ArrowUp':
162
+ e.preventDefault()
163
+ focusTab(i - 1)
164
+ break
165
+ case 'Home':
166
+ e.preventDefault()
167
+ focusTab(0)
168
+ break
169
+ case 'End':
170
+ e.preventDefault()
171
+ focusTab(items.length - 1)
172
+ break
91
173
  }
92
174
  }
93
175
  </script>
@@ -99,7 +181,14 @@
99
181
  {#if brand}
100
182
  {@render brand()}
101
183
  {:else}
102
- <svg class="mark" viewBox="0 0 103 89" fill="var(--ss-primary)" width="14" height="14" aria-hidden="true">
184
+ <svg
185
+ class="mark"
186
+ viewBox="0 0 103 89"
187
+ fill="var(--ss-primary)"
188
+ width="14"
189
+ height="14"
190
+ aria-hidden="true"
191
+ >
103
192
  <path
104
193
  fill-rule="evenodd"
105
194
  clip-rule="evenodd"
@@ -110,27 +199,45 @@
110
199
  {/if}
111
200
  </div>
112
201
 
113
- <nav class="ws" aria-label="Primary">
114
- {#each tabs as tab, i (tab)}
115
- <button
116
- bind:this={tabEls[i]}
117
- class="tab {tab === active ? 'active' : ''}"
118
- aria-current={tab === active ? 'page' : undefined}
119
- tabindex={tab === active ? 0 : -1}
120
- onclick={() => onTab?.(tab)}
121
- onkeydown={(e) => onTabKeydown(e, i)}
122
- >
123
- <span class="n" aria-hidden="true">{i + 1}</span>{tab}
124
- </button>
202
+ <nav class="ws" aria-label={ariaLabel}>
203
+ {#each items as tab, i (tab.id)}
204
+ {@const current = tab.id === active}
205
+ {#if tab.href}
206
+ <a
207
+ bind:this={tabEls[i]}
208
+ class="tab {current ? 'active' : ''}"
209
+ href={tab.href}
210
+ aria-current={current ? 'page' : undefined}
211
+ onclick={() => onTab?.(tab.id)}
212
+ onkeydown={(e) => onTabKeydown(e, i)}
213
+ >
214
+ <span class="n" aria-hidden="true">{i + 1}</span>{tab.label}
215
+ </a>
216
+ {:else}
217
+ <button
218
+ bind:this={tabEls[i]}
219
+ type="button"
220
+ class="tab {current ? 'active' : ''}"
221
+ aria-current={current ? 'page' : undefined}
222
+ tabindex={current ? 0 : -1}
223
+ onclick={() => onTab?.(tab.id)}
224
+ onkeydown={(e) => onTabKeydown(e, i)}
225
+ >
226
+ <span class="n" aria-hidden="true">{i + 1}</span>{tab.label}
227
+ </button>
228
+ {/if}
125
229
  {/each}
126
230
  </nav>
127
231
 
128
232
  <div class="grow"></div>
129
233
 
130
- <div class="seg right" title="services">
131
- <span class="dot" aria-hidden="true"></span>
132
- <span class="stat"><span class="v">6</span><span class="k">/7 up</span></span>
133
- </div>
234
+ {#if svc}
235
+ <div class="seg right" title="services">
236
+ <span class="dot" aria-hidden="true"></span>
237
+ <span class="stat"><span class="v">{svc.up}</span><span class="k">/{svc.total} up</span></span
238
+ >
239
+ </div>
240
+ {/if}
134
241
 
135
242
  {#each stats as st (st.key)}
136
243
  <div class="seg right stat collapsible" title={st.title ?? st.key}>
@@ -138,14 +245,16 @@
138
245
  </div>
139
246
  {/each}
140
247
 
141
- <button
142
- class="seg right click cmd"
143
- aria-keyshortcuts="Meta+K Control+K"
144
- aria-label="Open command menu"
145
- onclick={() => onCommand?.()}
146
- >
147
- <span class="kbd" aria-hidden="true">⌘K</span>
148
- </button>
248
+ {#if onCommand}
249
+ <button
250
+ class="seg right click cmd"
251
+ aria-keyshortcuts="Meta+K Control+K"
252
+ aria-label="Open command menu"
253
+ onclick={() => onCommand?.()}
254
+ >
255
+ <span class="kbd" aria-hidden="true">⌘K</span>
256
+ </button>
257
+ {/if}
149
258
 
150
259
  {#if userMenu}
151
260
  <div class="seg right user-slot">{@render userMenu()}</div>
@@ -153,9 +262,13 @@
153
262
  <button class="seg right click user-btn" onclick={() => onUser?.()}>{user}</button>
154
263
  {/if}
155
264
 
156
- <div class="seg right clock">
157
- <span>{h}</span><span class="sep">:</span><span>{m}</span><span class="sep">:</span><span>{s}</span>
158
- </div>
265
+ {#if clock}
266
+ <div class="seg right clock">
267
+ <span>{h}</span><span class="sep">:</span><span>{m}</span><span class="sep">:</span><span
268
+ >{s}</span
269
+ >
270
+ </div>
271
+ {/if}
159
272
  </header>
160
273
 
161
274
  <style>.ss-topbar {
@@ -194,10 +307,11 @@
194
307
  .ss-topbar .seg {
195
308
  display: flex;
196
309
  align-items: center;
197
- gap: 8px;
310
+ gap: var(--ss-s-2);
198
311
  padding: 0 var(--ss-panel-head-px);
199
312
  border-right: 1px solid var(--ss-line);
200
313
  cursor: default;
314
+ flex: none;
201
315
  }
202
316
  .ss-topbar .seg.right {
203
317
  border-right: none;
@@ -237,10 +351,15 @@
237
351
  .ss-topbar .ws {
238
352
  display: flex;
239
353
  align-items: stretch;
354
+ min-width: 0;
355
+ overflow-x: auto;
356
+ scrollbar-width: thin;
240
357
  }
241
358
  .ss-topbar .ws .tab {
242
359
  display: flex;
243
360
  align-items: center;
361
+ flex: none;
362
+ white-space: nowrap;
244
363
  padding: 0 var(--ss-row-px);
245
364
  min-height: var(--ss-s-6);
246
365
  color: var(--ss-fg-faint);
@@ -251,6 +370,7 @@
251
370
  border-top: 0;
252
371
  border-bottom: 0;
253
372
  border-left: 0;
373
+ text-decoration: none;
254
374
  transition: all var(--ss-dur-fast) var(--ss-ease);
255
375
  }
256
376
  .ss-topbar .ws .tab:hover {
@@ -283,7 +403,7 @@
283
403
  }
284
404
  .ss-topbar .stat .k {
285
405
  color: var(--ss-fg-faint);
286
- margin-right: 4px;
406
+ margin-right: var(--ss-s-1);
287
407
  }
288
408
  .ss-topbar .stat .v {
289
409
  color: var(--ss-fg);
@@ -1,3 +1,20 @@
1
+ /**
2
+ * One tab in the Topbar strip (DS-0080). The shorthand `string` form is
3
+ * equivalent to `{ id: s, label: s }`.
4
+ */
5
+ export interface TopbarTab {
6
+ /** Stable id — matched against `active` and passed to `onTab`. */
7
+ id: string;
8
+ /** Visible label; defaults to `id` (decouple for localized labels). */
9
+ label?: string;
10
+ /** Optional URL — when set the tab renders as a real `<a href>`. */
11
+ href?: string;
12
+ }
13
+ /** Services status summary shown in the right-side dot segment. */
14
+ export interface TopbarServices {
15
+ up: number;
16
+ total: number;
17
+ }
1
18
  import type { Snippet } from 'svelte';
2
19
  import { type Size } from '../config.js';
3
20
  interface Stat {
@@ -8,9 +25,12 @@ interface Stat {
8
25
  interface Props {
9
26
  active?: string;
10
27
  user?: string;
11
- tabs?: string[];
28
+ /** Tab strip: plain strings (id = label) or `{ id, label?, href? }` objects. */
29
+ tabs?: Array<string | TopbarTab>;
30
+ /** Fired with the tab id when a tab is activated (also for `href` tabs). */
12
31
  onTab?: (tab: string) => void;
13
- /** Fired when the command menu is opened (chip click or Cmd/Ctrl+K). */
32
+ /** Fired when the command menu is opened (chip click or Cmd/Ctrl+K).
33
+ * The ⌘K chip and the shortcut only exist when this handler is provided. */
14
34
  onCommand?: () => void;
15
35
  /** Fired when the user chip is activated (when no `userMenu` snippet given). */
16
36
  onUser?: () => void;
@@ -18,12 +38,19 @@ interface Props {
18
38
  userMenu?: Snippet;
19
39
  /** Custom brand mark + name; defaults to the built-in logo. */
20
40
  brand?: Snippet;
21
- /** Right-aligned stat segments; defaults to the built-in homelab stats. */
41
+ /** Right-aligned stat segments; defaults to the built-in homelab stats. Pass `[]` to remove. */
22
42
  stats?: Stat[];
43
+ /** Services status segment: `true` keeps the built-in 6/7 demo summary,
44
+ * `{ up, total }` renders real numbers, `false` removes the segment. */
45
+ services?: boolean | TopbarServices;
46
+ /** Live clock segment; `false` removes it (and skips the interval). */
47
+ clock?: boolean;
23
48
  /** Anchor the skip link jumps to. */
24
49
  skipTarget?: string;
25
50
  /** When true, the header sticks to the top of the viewport. */
26
51
  sticky?: boolean;
52
+ /** Accessible name for the tab-strip `<nav>` landmark (DS-0078). */
53
+ ariaLabel?: string;
27
54
  /** Token size (sm|md|lg); inherits the global size when unset. */
28
55
  size?: Size;
29
56
  }
@@ -44,7 +44,7 @@ export type ColorTheme = (typeof dssocaConfig)['theme']['values'][number];
44
44
  /** Size axis values — derived from the manifest (`'sm' | 'md' | 'lg'`). */
45
45
  export type Size = (typeof dssocaConfig)['size']['values'][number];
46
46
  /** Names of the components that accept a `size` prop / `componentsSize` entry. */
47
- export declare const COMPONENT_NAMES: readonly ["Accordion", "Badge", "BottomNav", "Button", "Card", "EmptyState", "Icon", "Image", "Input", "Link", "LogStream", "Menu", "MetricTile", "SegmentedControl", "ServiceCard", "Sidebar", "Sparkline", "Toaster", "Topbar"];
47
+ export declare const COMPONENT_NAMES: readonly ["Accordion", "Avatar", "Badge", "BottomNav", "Button", "Card", "Chart", "Container", "DateField", "EmptyState", "FileDrop", "Heading", "Icon", "Image", "Input", "Link", "LogStream", "Menu", "MetricTile", "Modal", "NumberField", "Pagination", "SegmentedControl", "Select", "ServiceCard", "Sidebar", "Sparkline", "Spinner", "Switch", "Table", "Textarea", "Toaster", "Tooltip", "Topbar"];
48
48
  export type ComponentName = (typeof COMPONENT_NAMES)[number];
49
49
  /** Per-component default sizes; any omitted component inherits `sizeVariant`. */
50
50
  export type ComponentsSize = Partial<Record<ComponentName, Size>>;
@@ -24,11 +24,17 @@ export const dssocaConfig = {
24
24
  /** Names of the components that accept a `size` prop / `componentsSize` entry. */
25
25
  export const COMPONENT_NAMES = [
26
26
  'Accordion',
27
+ 'Avatar',
27
28
  'Badge',
28
29
  'BottomNav',
29
30
  'Button',
30
31
  'Card',
32
+ 'Chart',
33
+ 'Container',
34
+ 'DateField',
31
35
  'EmptyState',
36
+ 'FileDrop',
37
+ 'Heading',
32
38
  'Icon',
33
39
  'Image',
34
40
  'Input',
@@ -36,10 +42,19 @@ export const COMPONENT_NAMES = [
36
42
  'LogStream',
37
43
  'Menu',
38
44
  'MetricTile',
45
+ 'Modal',
46
+ 'NumberField',
47
+ 'Pagination',
39
48
  'SegmentedControl',
49
+ 'Select',
40
50
  'ServiceCard',
41
51
  'Sidebar',
42
52
  'Sparkline',
53
+ 'Spinner',
54
+ 'Switch',
55
+ 'Table',
56
+ 'Textarea',
43
57
  'Toaster',
58
+ 'Tooltip',
44
59
  'Topbar',
45
60
  ];
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { default as Sparkline } from './components/Sparkline.svelte';
9
9
  export { default as ServiceCard } from './components/ServiceCard.svelte';
10
10
  export { default as MetricTile } from './components/MetricTile.svelte';
11
11
  export { default as Topbar } from './components/Topbar.svelte';
12
+ export { type TopbarTab, type TopbarServices } from './components/Topbar.svelte';
12
13
  export { default as Sidebar } from './components/Sidebar.svelte';
13
14
  export { type SideItem, type SideGroup, type SideStatus } from './components/Sidebar.svelte';
14
15
  export { default as LogStream, type LogLevel, type LogLine } from './components/LogStream.svelte';
@@ -17,7 +18,24 @@ export { default as EmptyState } from './components/EmptyState.svelte';
17
18
  export { default as Menu, type MenuItem } from './components/Menu.svelte';
18
19
  export { default as Accordion, type AccordionItem } from './components/Accordion.svelte';
19
20
  export { default as Link } from './components/Link.svelte';
20
- export { default as SegmentedControl, type SegmentOption } from './components/SegmentedControl.svelte';
21
+ export { default as SegmentedControl, type SegmentOption, } from './components/SegmentedControl.svelte';
21
22
  export { default as BottomNav, type BottomNavItem } from './components/BottomNav.svelte';
22
23
  export { default as Image, type ImageSource } from './components/Image.svelte';
24
+ export { default as Heading } from './components/Heading.svelte';
25
+ export { default as Container } from './components/Container.svelte';
26
+ export { default as Textarea } from './components/Textarea.svelte';
27
+ export { default as Spinner, SPINNER_VARIANTS, SPINNER_VARIANT_NAMES, } from './components/Spinner.svelte';
28
+ export type { SpinnerVariant, SpinnerFrames } from './components/Spinner.svelte';
29
+ export { default as Chart, type ChartSeries, type ChartPoint } from './components/Chart.svelte';
30
+ export { default as Table, type TableColumn, type TableSort } from './components/Table.svelte';
31
+ export { default as Select } from './components/Select.svelte';
32
+ export type { SelectOption, SelectOptGroup } from './components/Select.svelte';
33
+ export { default as Modal } from './components/Modal.svelte';
34
+ export { default as DateField } from './components/DateField.svelte';
35
+ export { default as FileDrop } from './components/FileDrop.svelte';
36
+ export { default as NumberField } from './components/NumberField.svelte';
37
+ export { default as Tooltip } from './components/Tooltip.svelte';
38
+ export { default as Avatar } from './components/Avatar.svelte';
39
+ export { default as Pagination } from './components/Pagination.svelte';
40
+ export { default as Switch } from './components/Switch.svelte';
23
41
  export { toast, toasts, type Toast, type ToastKind, type ToastAction, type ToastOptions, type ToastPatch, type PromiseMessages, } from './toast.svelte.js';