dssoca 0.5.0 → 0.9.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.
- package/README.md +39 -13
- package/dist/components/Accordion.svelte +297 -0
- package/dist/components/Accordion.svelte.d.ts +51 -0
- package/dist/components/Badge.svelte +113 -18
- package/dist/components/Badge.svelte.d.ts +28 -2
- package/dist/components/BottomNav.svelte +254 -0
- package/dist/components/BottomNav.svelte.d.ts +32 -0
- package/dist/components/Button.svelte +147 -10
- package/dist/components/Button.svelte.d.ts +21 -4
- package/dist/components/Card.svelte +173 -8
- package/dist/components/Card.svelte.d.ts +16 -1
- package/dist/components/Container.svelte +55 -0
- package/dist/components/Container.svelte.d.ts +16 -0
- package/dist/components/EmptyState.svelte +91 -9
- package/dist/components/EmptyState.svelte.d.ts +20 -3
- package/dist/components/Heading.svelte +83 -0
- package/dist/components/Heading.svelte.d.ts +17 -0
- package/dist/components/Icon.svelte +199 -24
- package/dist/components/Icon.svelte.d.ts +70 -2
- package/dist/components/Image.svelte +428 -0
- package/dist/components/Image.svelte.d.ts +49 -0
- package/dist/components/Input.svelte +173 -39
- package/dist/components/Input.svelte.d.ts +22 -0
- package/dist/components/Link.svelte +183 -0
- package/dist/components/Link.svelte.d.ts +29 -0
- package/dist/components/LogStream.svelte +403 -47
- package/dist/components/LogStream.svelte.d.ts +35 -7
- package/dist/components/Menu.svelte +408 -0
- package/dist/components/Menu.svelte.d.ts +66 -0
- package/dist/components/MetricTile.svelte +124 -12
- package/dist/components/MetricTile.svelte.d.ts +20 -0
- package/dist/components/SegmentedControl.svelte +220 -0
- package/dist/components/SegmentedControl.svelte.d.ts +37 -0
- package/dist/components/ServiceCard.svelte +226 -30
- package/dist/components/ServiceCard.svelte.d.ts +13 -1
- package/dist/components/Sidebar.svelte +377 -40
- package/dist/components/Sidebar.svelte.d.ts +18 -7
- package/dist/components/Sparkline.svelte +198 -13
- package/dist/components/Sparkline.svelte.d.ts +20 -1
- package/dist/components/Spinner.svelte +124 -0
- package/dist/components/Spinner.svelte.d.ts +74 -0
- package/dist/components/Textarea.svelte +214 -0
- package/dist/components/Textarea.svelte.d.ts +38 -0
- package/dist/components/Toaster.svelte +209 -12
- package/dist/components/Toaster.svelte.d.ts +3 -0
- package/dist/components/Topbar.svelte +293 -42
- package/dist/components/Topbar.svelte.d.ts +48 -1
- package/dist/dssoca.config.d.ts +1 -1
- package/dist/dssoca.config.js +10 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +18 -2
- package/dist/theme.css +406 -24
- package/dist/toast.svelte.d.ts +49 -5
- package/dist/toast.svelte.js +165 -9
- package/dist/tokens.css +597 -0
- package/package.json +25 -4
|
@@ -1,73 +1,275 @@
|
|
|
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">
|
|
23
|
+
import type { Snippet } from 'svelte'
|
|
2
24
|
import { resolveComponentSize, type Size } from '../config.js'
|
|
3
25
|
|
|
26
|
+
interface Stat {
|
|
27
|
+
key: string
|
|
28
|
+
value: string
|
|
29
|
+
title?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
4
32
|
interface Props {
|
|
5
33
|
active?: string
|
|
6
34
|
user?: string
|
|
7
|
-
|
|
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). */
|
|
8
38
|
onTab?: (tab: string) => void
|
|
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. */
|
|
41
|
+
onCommand?: () => void
|
|
42
|
+
/** Fired when the user chip is activated (when no `userMenu` snippet given). */
|
|
43
|
+
onUser?: () => void
|
|
44
|
+
/** Custom user/avatar control rendered on the right; overrides the default user button. */
|
|
45
|
+
userMenu?: Snippet
|
|
46
|
+
/** Custom brand mark + name; defaults to the built-in logo. */
|
|
47
|
+
brand?: Snippet
|
|
48
|
+
/** Right-aligned stat segments; defaults to the built-in homelab stats. Pass `[]` to remove. */
|
|
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
|
|
55
|
+
/** Anchor the skip link jumps to. */
|
|
56
|
+
skipTarget?: string
|
|
57
|
+
/** When true, the header sticks to the top of the viewport. */
|
|
58
|
+
sticky?: boolean
|
|
59
|
+
/** Accessible name for the tab-strip `<nav>` landmark (DS-0078). */
|
|
60
|
+
ariaLabel?: string
|
|
9
61
|
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
10
62
|
size?: Size
|
|
11
63
|
}
|
|
64
|
+
|
|
65
|
+
const DEFAULT_STATS: Stat[] = [
|
|
66
|
+
{ key: 'cpu', value: '62%', title: 'cpu' },
|
|
67
|
+
{ key: 'mem', value: '3.8G', title: 'memory' },
|
|
68
|
+
{ key: 'net', value: '↓1.2 ↑0.3', title: 'network' },
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const DEFAULT_SERVICES: TopbarServices = { up: 6, total: 7 }
|
|
72
|
+
|
|
12
73
|
let {
|
|
13
74
|
active = 'overview',
|
|
14
|
-
user = '
|
|
75
|
+
user = 'admin@hub.home',
|
|
15
76
|
tabs = ['overview', 'services', 'logs', 'shell'],
|
|
16
77
|
onTab,
|
|
78
|
+
onCommand,
|
|
79
|
+
onUser,
|
|
80
|
+
userMenu,
|
|
81
|
+
brand,
|
|
82
|
+
stats = DEFAULT_STATS,
|
|
83
|
+
services = true,
|
|
84
|
+
clock = true,
|
|
85
|
+
skipTarget = '#main',
|
|
86
|
+
sticky = true,
|
|
87
|
+
ariaLabel = 'Primary',
|
|
17
88
|
size,
|
|
18
89
|
}: Props = $props()
|
|
19
90
|
|
|
20
|
-
|
|
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
|
+
}
|
|
21
112
|
function nowStr() {
|
|
22
113
|
const d = new Date()
|
|
23
114
|
return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
|
24
115
|
}
|
|
25
116
|
|
|
26
|
-
let
|
|
117
|
+
let time = $state(nowStr())
|
|
118
|
+
|
|
27
119
|
$effect(() => {
|
|
28
|
-
const t =
|
|
29
|
-
|
|
120
|
+
const t = clock
|
|
121
|
+
? setInterval(() => {
|
|
122
|
+
time = nowStr()
|
|
123
|
+
}, 1000)
|
|
124
|
+
: undefined
|
|
125
|
+
const onKey = (e: KeyboardEvent) => {
|
|
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')) {
|
|
129
|
+
e.preventDefault()
|
|
130
|
+
onCommand()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (hasWindow) window.addEventListener('keydown', onKey)
|
|
134
|
+
return () => {
|
|
135
|
+
if (t) clearInterval(t)
|
|
136
|
+
if (hasWindow) window.removeEventListener('keydown', onKey)
|
|
137
|
+
}
|
|
30
138
|
})
|
|
31
139
|
|
|
32
|
-
const [h, m, s] = $derived(
|
|
140
|
+
const [h, m, s] = $derived(time.split(':'))
|
|
141
|
+
|
|
142
|
+
// Roving tabindex: arrow keys move focus across the tab strip (wrapping),
|
|
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([])
|
|
147
|
+
function focusTab(i: number) {
|
|
148
|
+
const n = items.length
|
|
149
|
+
if (!n) return
|
|
150
|
+
const idx = ((i % n) + n) % n
|
|
151
|
+
tabEls[idx]?.focus()
|
|
152
|
+
}
|
|
153
|
+
function onTabKeydown(e: KeyboardEvent, i: number) {
|
|
154
|
+
switch (e.key) {
|
|
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
|
|
173
|
+
}
|
|
174
|
+
}
|
|
33
175
|
</script>
|
|
34
176
|
|
|
35
|
-
<
|
|
177
|
+
<header class="ss-topbar" class:sticky data-size-variant={resolveComponentSize('Topbar', size)}>
|
|
178
|
+
<a class="skip" href={skipTarget}>Skip to content</a>
|
|
179
|
+
|
|
36
180
|
<div class="seg logo">
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{#each tabs as tab, i}
|
|
48
|
-
<button
|
|
49
|
-
class="tab {tab === active ? 'active' : ''}"
|
|
50
|
-
aria-current={tab === active ? 'page' : undefined}
|
|
51
|
-
onclick={() => onTab?.(tab)}
|
|
181
|
+
{#if brand}
|
|
182
|
+
{@render brand()}
|
|
183
|
+
{:else}
|
|
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"
|
|
52
191
|
>
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
192
|
+
<path
|
|
193
|
+
fill-rule="evenodd"
|
|
194
|
+
clip-rule="evenodd"
|
|
195
|
+
d="M51.5 0L0 89H103L51.5 0ZM23.8643 80.151H87.6468L71.6884 52.5724L23.8643 80.151ZM65.5911 42.0354L60.7383 33.649L46.1956 42.0354H65.5911ZM56.14 25.7024L51.5 17.6837L42.2125 33.7339L56.14 25.7024ZM32.0977 51.2138L20.2949 71.6111L55.6656 51.2138H32.0977Z"
|
|
196
|
+
/>
|
|
197
|
+
</svg>
|
|
198
|
+
<span class="nm">hubssoca</span>
|
|
199
|
+
{/if}
|
|
56
200
|
</div>
|
|
201
|
+
|
|
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}
|
|
229
|
+
{/each}
|
|
230
|
+
</nav>
|
|
231
|
+
|
|
57
232
|
<div class="grow"></div>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
</div>
|
|
233
|
+
|
|
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}
|
|
241
|
+
|
|
242
|
+
{#each stats as st (st.key)}
|
|
243
|
+
<div class="seg right stat collapsible" title={st.title ?? st.key}>
|
|
244
|
+
<span class="k">{st.key}</span><span class="v">{st.value}</span>
|
|
245
|
+
</div>
|
|
246
|
+
{/each}
|
|
247
|
+
|
|
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}
|
|
258
|
+
|
|
259
|
+
{#if userMenu}
|
|
260
|
+
<div class="seg right user-slot">{@render userMenu()}</div>
|
|
261
|
+
{:else}
|
|
262
|
+
<button class="seg right click user-btn" onclick={() => onUser?.()}>{user}</button>
|
|
263
|
+
{/if}
|
|
264
|
+
|
|
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}
|
|
272
|
+
</header>
|
|
71
273
|
|
|
72
274
|
<style>.ss-topbar {
|
|
73
275
|
grid-column: 1/-1;
|
|
@@ -79,17 +281,37 @@
|
|
|
79
281
|
font-size: var(--ss-ui-md);
|
|
80
282
|
color: var(--ss-fg-muted);
|
|
81
283
|
user-select: none;
|
|
82
|
-
position:
|
|
284
|
+
position: relative;
|
|
83
285
|
top: 0;
|
|
84
286
|
z-index: 10;
|
|
85
287
|
}
|
|
288
|
+
.ss-topbar.sticky {
|
|
289
|
+
position: sticky;
|
|
290
|
+
}
|
|
291
|
+
.ss-topbar .skip {
|
|
292
|
+
position: absolute;
|
|
293
|
+
left: var(--ss-s-1);
|
|
294
|
+
top: var(--ss-s-1);
|
|
295
|
+
z-index: 20;
|
|
296
|
+
padding: var(--ss-badge-py) var(--ss-badge-px);
|
|
297
|
+
background: var(--ss-primary);
|
|
298
|
+
color: var(--ss-fg-on-primary);
|
|
299
|
+
font: 500 var(--ss-ui-md) var(--ss-font-mono);
|
|
300
|
+
text-decoration: none;
|
|
301
|
+
transform: translateY(-200%);
|
|
302
|
+
transition: transform var(--ss-dur-fast) var(--ss-ease);
|
|
303
|
+
}
|
|
304
|
+
.ss-topbar .skip:focus-visible, .ss-topbar .skip:focus {
|
|
305
|
+
transform: translateY(0);
|
|
306
|
+
}
|
|
86
307
|
.ss-topbar .seg {
|
|
87
308
|
display: flex;
|
|
88
309
|
align-items: center;
|
|
89
|
-
gap:
|
|
310
|
+
gap: var(--ss-s-2);
|
|
90
311
|
padding: 0 var(--ss-panel-head-px);
|
|
91
312
|
border-right: 1px solid var(--ss-line);
|
|
92
313
|
cursor: default;
|
|
314
|
+
flex: none;
|
|
93
315
|
}
|
|
94
316
|
.ss-topbar .seg.right {
|
|
95
317
|
border-right: none;
|
|
@@ -102,6 +324,18 @@
|
|
|
102
324
|
background: var(--ss-hover);
|
|
103
325
|
color: var(--ss-fg);
|
|
104
326
|
}
|
|
327
|
+
.ss-topbar button.seg {
|
|
328
|
+
background: transparent;
|
|
329
|
+
border-top: 0;
|
|
330
|
+
border-bottom: 0;
|
|
331
|
+
border-right: 0;
|
|
332
|
+
color: inherit;
|
|
333
|
+
font: inherit;
|
|
334
|
+
min-height: var(--ss-s-6);
|
|
335
|
+
}
|
|
336
|
+
.ss-topbar button.seg.right {
|
|
337
|
+
border-left: 1px solid var(--ss-line);
|
|
338
|
+
}
|
|
105
339
|
.ss-topbar .logo {
|
|
106
340
|
color: var(--ss-fg);
|
|
107
341
|
}
|
|
@@ -117,11 +351,17 @@
|
|
|
117
351
|
.ss-topbar .ws {
|
|
118
352
|
display: flex;
|
|
119
353
|
align-items: stretch;
|
|
354
|
+
min-width: 0;
|
|
355
|
+
overflow-x: auto;
|
|
356
|
+
scrollbar-width: thin;
|
|
120
357
|
}
|
|
121
358
|
.ss-topbar .ws .tab {
|
|
122
359
|
display: flex;
|
|
123
360
|
align-items: center;
|
|
361
|
+
flex: none;
|
|
362
|
+
white-space: nowrap;
|
|
124
363
|
padding: 0 var(--ss-row-px);
|
|
364
|
+
min-height: var(--ss-s-6);
|
|
125
365
|
color: var(--ss-fg-faint);
|
|
126
366
|
border-right: 1px solid var(--ss-line);
|
|
127
367
|
cursor: pointer;
|
|
@@ -130,6 +370,7 @@
|
|
|
130
370
|
border-top: 0;
|
|
131
371
|
border-bottom: 0;
|
|
132
372
|
border-left: 0;
|
|
373
|
+
text-decoration: none;
|
|
133
374
|
transition: all var(--ss-dur-fast) var(--ss-ease);
|
|
134
375
|
}
|
|
135
376
|
.ss-topbar .ws .tab:hover {
|
|
@@ -162,7 +403,7 @@
|
|
|
162
403
|
}
|
|
163
404
|
.ss-topbar .stat .k {
|
|
164
405
|
color: var(--ss-fg-faint);
|
|
165
|
-
margin-right:
|
|
406
|
+
margin-right: var(--ss-s-1);
|
|
166
407
|
}
|
|
167
408
|
.ss-topbar .stat .v {
|
|
168
409
|
color: var(--ss-fg);
|
|
@@ -182,4 +423,14 @@
|
|
|
182
423
|
border: 1px solid var(--ss-line);
|
|
183
424
|
padding: 2px 5px;
|
|
184
425
|
line-height: 1;
|
|
426
|
+
}
|
|
427
|
+
@media (max-width: 720px) {
|
|
428
|
+
.ss-topbar .collapsible {
|
|
429
|
+
display: none;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
@media (max-width: 520px) {
|
|
433
|
+
.ss-topbar .ws {
|
|
434
|
+
display: none;
|
|
435
|
+
}
|
|
185
436
|
}</style>
|
|
@@ -1,9 +1,56 @@
|
|
|
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
|
+
}
|
|
18
|
+
import type { Snippet } from 'svelte';
|
|
1
19
|
import { type Size } from '../config.js';
|
|
20
|
+
interface Stat {
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
}
|
|
2
25
|
interface Props {
|
|
3
26
|
active?: string;
|
|
4
27
|
user?: string;
|
|
5
|
-
|
|
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). */
|
|
6
31
|
onTab?: (tab: string) => void;
|
|
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. */
|
|
34
|
+
onCommand?: () => void;
|
|
35
|
+
/** Fired when the user chip is activated (when no `userMenu` snippet given). */
|
|
36
|
+
onUser?: () => void;
|
|
37
|
+
/** Custom user/avatar control rendered on the right; overrides the default user button. */
|
|
38
|
+
userMenu?: Snippet;
|
|
39
|
+
/** Custom brand mark + name; defaults to the built-in logo. */
|
|
40
|
+
brand?: Snippet;
|
|
41
|
+
/** Right-aligned stat segments; defaults to the built-in homelab stats. Pass `[]` to remove. */
|
|
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;
|
|
48
|
+
/** Anchor the skip link jumps to. */
|
|
49
|
+
skipTarget?: string;
|
|
50
|
+
/** When true, the header sticks to the top of the viewport. */
|
|
51
|
+
sticky?: boolean;
|
|
52
|
+
/** Accessible name for the tab-strip `<nav>` landmark (DS-0078). */
|
|
53
|
+
ariaLabel?: string;
|
|
7
54
|
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
8
55
|
size?: Size;
|
|
9
56
|
}
|
package/dist/dssoca.config.d.ts
CHANGED
|
@@ -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 ["Badge", "Button", "Card", "EmptyState", "Icon", "Input", "LogStream", "MetricTile", "ServiceCard", "Sidebar", "Sparkline", "Toaster", "Topbar"];
|
|
47
|
+
export declare const COMPONENT_NAMES: readonly ["Accordion", "Badge", "BottomNav", "Button", "Card", "Container", "EmptyState", "Heading", "Icon", "Image", "Input", "Link", "LogStream", "Menu", "MetricTile", "SegmentedControl", "ServiceCard", "Sidebar", "Sparkline", "Spinner", "Textarea", "Toaster", "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>>;
|
package/dist/dssoca.config.js
CHANGED
|
@@ -23,17 +23,27 @@ export const dssocaConfig = {
|
|
|
23
23
|
};
|
|
24
24
|
/** Names of the components that accept a `size` prop / `componentsSize` entry. */
|
|
25
25
|
export const COMPONENT_NAMES = [
|
|
26
|
+
'Accordion',
|
|
26
27
|
'Badge',
|
|
28
|
+
'BottomNav',
|
|
27
29
|
'Button',
|
|
28
30
|
'Card',
|
|
31
|
+
'Container',
|
|
29
32
|
'EmptyState',
|
|
33
|
+
'Heading',
|
|
30
34
|
'Icon',
|
|
35
|
+
'Image',
|
|
31
36
|
'Input',
|
|
37
|
+
'Link',
|
|
32
38
|
'LogStream',
|
|
39
|
+
'Menu',
|
|
33
40
|
'MetricTile',
|
|
41
|
+
'SegmentedControl',
|
|
34
42
|
'ServiceCard',
|
|
35
43
|
'Sidebar',
|
|
36
44
|
'Sparkline',
|
|
45
|
+
'Spinner',
|
|
46
|
+
'Textarea',
|
|
37
47
|
'Toaster',
|
|
38
48
|
'Topbar',
|
|
39
49
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { type ColorTheme, type Size, type DesignConfig, defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, resolveComponentSize, } from './config.js';
|
|
2
2
|
export { dssocaConfig, type DssocaConfig, type DesignAxis, type ComponentName, type ComponentsSize, } from './dssoca.config.js';
|
|
3
|
-
export { default as Icon } from './components/Icon.svelte';
|
|
3
|
+
export { default as Icon, registerIcon, type IconName } from './components/Icon.svelte';
|
|
4
4
|
export { default as Badge } from './components/Badge.svelte';
|
|
5
5
|
export { default as Button } from './components/Button.svelte';
|
|
6
6
|
export { default as Input } from './components/Input.svelte';
|
|
@@ -9,8 +9,21 @@ 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
|
-
export {
|
|
14
|
+
export { type SideItem, type SideGroup, type SideStatus } from './components/Sidebar.svelte';
|
|
15
|
+
export { default as LogStream, type LogLevel, type LogLine } from './components/LogStream.svelte';
|
|
14
16
|
export { default as Toaster } from './components/Toaster.svelte';
|
|
15
17
|
export { default as EmptyState } from './components/EmptyState.svelte';
|
|
16
|
-
export {
|
|
18
|
+
export { default as Menu, type MenuItem } from './components/Menu.svelte';
|
|
19
|
+
export { default as Accordion, type AccordionItem } from './components/Accordion.svelte';
|
|
20
|
+
export { default as Link } from './components/Link.svelte';
|
|
21
|
+
export { default as SegmentedControl, type SegmentOption, } from './components/SegmentedControl.svelte';
|
|
22
|
+
export { default as BottomNav, type BottomNavItem } from './components/BottomNav.svelte';
|
|
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 { toast, toasts, type Toast, type ToastKind, type ToastAction, type ToastOptions, type ToastPatch, type PromiseMessages, } from './toast.svelte.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { defaultDesignConfig, getDesignConfig, designAttributes, applyDesignConfig, resolveComponentSize, } from './config.js';
|
|
2
2
|
export { dssocaConfig, } from './dssoca.config.js';
|
|
3
|
-
export { default as Icon } from './components/Icon.svelte';
|
|
3
|
+
export { default as Icon, registerIcon } from './components/Icon.svelte';
|
|
4
4
|
export { default as Badge } from './components/Badge.svelte';
|
|
5
5
|
export { default as Button } from './components/Button.svelte';
|
|
6
6
|
export { default as Input } from './components/Input.svelte';
|
|
@@ -9,8 +9,24 @@ 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 {} from './components/Topbar.svelte';
|
|
12
13
|
export { default as Sidebar } from './components/Sidebar.svelte';
|
|
14
|
+
export {} from './components/Sidebar.svelte';
|
|
13
15
|
export { default as LogStream } from './components/LogStream.svelte';
|
|
14
16
|
export { default as Toaster } from './components/Toaster.svelte';
|
|
15
17
|
export { default as EmptyState } from './components/EmptyState.svelte';
|
|
16
|
-
|
|
18
|
+
// New components ported from the source website (DS-0043). Each line is the
|
|
19
|
+
// single, complete public surface for that component, so the per-component
|
|
20
|
+
// implementation PRs (DS-0050…0055) need not edit this barrel.
|
|
21
|
+
export { default as Menu } from './components/Menu.svelte';
|
|
22
|
+
export { default as Accordion } from './components/Accordion.svelte';
|
|
23
|
+
export { default as Link } from './components/Link.svelte';
|
|
24
|
+
export { default as SegmentedControl, } from './components/SegmentedControl.svelte';
|
|
25
|
+
export { default as BottomNav } from './components/BottomNav.svelte';
|
|
26
|
+
export { default as Image } from './components/Image.svelte';
|
|
27
|
+
// Adoption-gap components from the passoca migration (DS-0079).
|
|
28
|
+
export { default as Heading } from './components/Heading.svelte';
|
|
29
|
+
export { default as Container } from './components/Container.svelte';
|
|
30
|
+
export { default as Textarea } from './components/Textarea.svelte';
|
|
31
|
+
export { default as Spinner, SPINNER_VARIANTS, SPINNER_VARIANT_NAMES, } from './components/Spinner.svelte';
|
|
32
|
+
export { toast, toasts, } from './toast.svelte.js';
|