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.
Files changed (56) hide show
  1. package/README.md +39 -13
  2. package/dist/components/Accordion.svelte +297 -0
  3. package/dist/components/Accordion.svelte.d.ts +51 -0
  4. package/dist/components/Badge.svelte +113 -18
  5. package/dist/components/Badge.svelte.d.ts +28 -2
  6. package/dist/components/BottomNav.svelte +254 -0
  7. package/dist/components/BottomNav.svelte.d.ts +32 -0
  8. package/dist/components/Button.svelte +147 -10
  9. package/dist/components/Button.svelte.d.ts +21 -4
  10. package/dist/components/Card.svelte +173 -8
  11. package/dist/components/Card.svelte.d.ts +16 -1
  12. package/dist/components/Container.svelte +55 -0
  13. package/dist/components/Container.svelte.d.ts +16 -0
  14. package/dist/components/EmptyState.svelte +91 -9
  15. package/dist/components/EmptyState.svelte.d.ts +20 -3
  16. package/dist/components/Heading.svelte +83 -0
  17. package/dist/components/Heading.svelte.d.ts +17 -0
  18. package/dist/components/Icon.svelte +199 -24
  19. package/dist/components/Icon.svelte.d.ts +70 -2
  20. package/dist/components/Image.svelte +428 -0
  21. package/dist/components/Image.svelte.d.ts +49 -0
  22. package/dist/components/Input.svelte +173 -39
  23. package/dist/components/Input.svelte.d.ts +22 -0
  24. package/dist/components/Link.svelte +183 -0
  25. package/dist/components/Link.svelte.d.ts +29 -0
  26. package/dist/components/LogStream.svelte +403 -47
  27. package/dist/components/LogStream.svelte.d.ts +35 -7
  28. package/dist/components/Menu.svelte +408 -0
  29. package/dist/components/Menu.svelte.d.ts +66 -0
  30. package/dist/components/MetricTile.svelte +124 -12
  31. package/dist/components/MetricTile.svelte.d.ts +20 -0
  32. package/dist/components/SegmentedControl.svelte +220 -0
  33. package/dist/components/SegmentedControl.svelte.d.ts +37 -0
  34. package/dist/components/ServiceCard.svelte +226 -30
  35. package/dist/components/ServiceCard.svelte.d.ts +13 -1
  36. package/dist/components/Sidebar.svelte +377 -40
  37. package/dist/components/Sidebar.svelte.d.ts +18 -7
  38. package/dist/components/Sparkline.svelte +198 -13
  39. package/dist/components/Sparkline.svelte.d.ts +20 -1
  40. package/dist/components/Spinner.svelte +124 -0
  41. package/dist/components/Spinner.svelte.d.ts +74 -0
  42. package/dist/components/Textarea.svelte +214 -0
  43. package/dist/components/Textarea.svelte.d.ts +38 -0
  44. package/dist/components/Toaster.svelte +209 -12
  45. package/dist/components/Toaster.svelte.d.ts +3 -0
  46. package/dist/components/Topbar.svelte +293 -42
  47. package/dist/components/Topbar.svelte.d.ts +48 -1
  48. package/dist/dssoca.config.d.ts +1 -1
  49. package/dist/dssoca.config.js +10 -0
  50. package/dist/index.d.ts +16 -3
  51. package/dist/index.js +18 -2
  52. package/dist/theme.css +406 -24
  53. package/dist/toast.svelte.d.ts +49 -5
  54. package/dist/toast.svelte.js +165 -9
  55. package/dist/tokens.css +597 -0
  56. package/package.json +25 -4
@@ -0,0 +1,220 @@
1
+ <script module lang="ts">
2
+ import type { IconName } from './Icon.svelte'
3
+
4
+ /** One option in a {@link SegmentedControl}. */
5
+ export interface SegmentOption {
6
+ value: string
7
+ label: string
8
+ /** Optional leading glyph. */
9
+ icon?: IconName
10
+ disabled?: boolean
11
+ }
12
+ </script>
13
+
14
+ <script lang="ts">
15
+ // ─────────────────────────────────────────────────────────────────────────
16
+ // SegmentedControl — DS-0053. A compact row of mutually-exclusive options
17
+ // (view / mode / locale). Generalizes the website's LanguageSwitcher to N
18
+ // options. Highlighted selection (token fill, zero radius), bindable `value`,
19
+ // `role="radiogroup"` with `role="radio"` segments, roving tabindex + arrow
20
+ // / Home / End keyboard nav (skips disabled), size-token density.
21
+ // ─────────────────────────────────────────────────────────────────────────
22
+ import Icon from './Icon.svelte'
23
+ import { resolveComponentSize, type Size } from '../config.js'
24
+
25
+ interface Props {
26
+ /** Mutually-exclusive options: { value, label, icon?, disabled? }. */
27
+ options?: SegmentOption[]
28
+ /** Selected option value (bindable). */
29
+ value?: string
30
+ /** Fired when the selection changes (after `value` updates). */
31
+ onChange?: (value: string) => void
32
+ /** Stretch segments to equal widths and fill the container. */
33
+ fullWidth?: boolean
34
+ /**
35
+ * Disable the whole control (DS-0078): every segment is rendered inert
36
+ * (`disabled` + skipped by keyboard nav) and the group carries
37
+ * `aria-disabled="true"`. Per-option `disabled` still works for
38
+ * disabling individual segments.
39
+ */
40
+ disabled?: boolean
41
+ /** Token size (sm|md|lg); inherits the global size when unset. */
42
+ size?: Size
43
+ /**
44
+ * Accessible name for the group. Required (WCAG 2.2 AA): a radiogroup with
45
+ * no name leaves AT users without context for the choice.
46
+ */
47
+ label: string
48
+ }
49
+
50
+ let {
51
+ options = [],
52
+ value = $bindable(),
53
+ onChange,
54
+ fullWidth = false,
55
+ disabled = false,
56
+ size,
57
+ label,
58
+ }: Props = $props()
59
+
60
+ // Component-wide `disabled` wins over (and combines with) per-option flags.
61
+ const isOptionDisabled = (o: SegmentOption) => disabled || Boolean(o.disabled)
62
+
63
+ // Bound references to each segment, indexed by option position, so keyboard
64
+ // navigation can move focus across the roving-tabindex group.
65
+ let segments = $state<(HTMLButtonElement | undefined)[]>([])
66
+
67
+ const enabledIndexes = $derived(
68
+ options.map((o, i) => (isOptionDisabled(o) ? -1 : i)).filter((i) => i >= 0),
69
+ )
70
+
71
+ /** Index that owns the single tab stop (roving tabindex). The selected option
72
+ * when it's enabled; otherwise the first enabled option; -1 when none. */
73
+ const tabbableIndex = $derived.by(() => {
74
+ const sel = options.findIndex((o) => o.value === value && !isOptionDisabled(o))
75
+ if (sel >= 0) return sel
76
+ return enabledIndexes[0] ?? -1
77
+ })
78
+
79
+ function select(index: number) {
80
+ const opt = options[index]
81
+ if (!opt || isOptionDisabled(opt)) return
82
+ if (opt.value !== value) {
83
+ value = opt.value
84
+ onChange?.(opt.value)
85
+ }
86
+ }
87
+
88
+ function focusIndex(index: number) {
89
+ segments[index]?.focus()
90
+ }
91
+
92
+ /** Next/previous enabled option index, wrapping around the row. */
93
+ function step(from: number, dir: 1 | -1): number {
94
+ if (enabledIndexes.length === 0) return from
95
+ const pos = enabledIndexes.indexOf(from)
96
+ // `from` might be disabled (shouldn't be focusable) — fall back to an edge.
97
+ const base = pos === -1 ? (dir === 1 ? -1 : 0) : pos
98
+ const next = (base + dir + enabledIndexes.length) % enabledIndexes.length
99
+ return enabledIndexes[next]
100
+ }
101
+
102
+ function onKeydown(e: KeyboardEvent, index: number) {
103
+ let target = -1
104
+ switch (e.key) {
105
+ case 'ArrowRight':
106
+ case 'ArrowDown':
107
+ target = step(index, 1)
108
+ break
109
+ case 'ArrowLeft':
110
+ case 'ArrowUp':
111
+ target = step(index, -1)
112
+ break
113
+ case 'Home':
114
+ target = enabledIndexes[0] ?? -1
115
+ break
116
+ case 'End':
117
+ target = enabledIndexes[enabledIndexes.length - 1] ?? -1
118
+ break
119
+ default:
120
+ return
121
+ }
122
+ if (target < 0) return
123
+ e.preventDefault()
124
+ // radiogroup semantics: moving focus also moves the selection.
125
+ select(target)
126
+ focusIndex(target)
127
+ }
128
+
129
+ const sizeAttr = $derived(resolveComponentSize('SegmentedControl', size))
130
+ </script>
131
+
132
+ <div
133
+ class="ss-segmented"
134
+ class:full={fullWidth}
135
+ role="radiogroup"
136
+ aria-label={label}
137
+ aria-disabled={disabled ? 'true' : undefined}
138
+ data-size-variant={sizeAttr}
139
+ >
140
+ {#each options as opt, i (opt.value)}
141
+ {@const selected = opt.value === value}
142
+ <button
143
+ bind:this={segments[i]}
144
+ type="button"
145
+ class="segment"
146
+ class:selected
147
+ role="radio"
148
+ aria-checked={selected}
149
+ tabindex={i === tabbableIndex ? 0 : -1}
150
+ disabled={isOptionDisabled(opt)}
151
+ onclick={() => select(i)}
152
+ onkeydown={(e) => onKeydown(e, i)}
153
+ >
154
+ {#if opt.icon}<Icon name={opt.icon} class="ic" />{/if}
155
+ <span class="label">{opt.label}</span>
156
+ </button>
157
+ {/each}
158
+ </div>
159
+
160
+ <style>.ss-segmented {
161
+ display: inline-flex;
162
+ gap: 0;
163
+ border: 1px solid var(--ss-line);
164
+ background: var(--ss-bg);
165
+ width: max-content;
166
+ max-width: 100%;
167
+ }
168
+ .ss-segmented.full {
169
+ display: flex;
170
+ width: 100%;
171
+ }
172
+ .ss-segmented .segment {
173
+ display: inline-flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ gap: var(--ss-seg-gap);
177
+ font: 500 var(--ss-seg-font)/1 var(--ss-font-body);
178
+ color: var(--ss-fg-muted);
179
+ background: transparent;
180
+ border: 0;
181
+ border-left: 1px solid var(--ss-line);
182
+ padding: var(--ss-seg-py) var(--ss-seg-px);
183
+ cursor: pointer;
184
+ white-space: nowrap;
185
+ text-align: center;
186
+ transition: color var(--ss-dur-fast) var(--ss-ease), background var(--ss-dur-fast) var(--ss-ease);
187
+ }
188
+ .ss-segmented .segment:first-child {
189
+ border-left: 0;
190
+ }
191
+ .ss-segmented .segment:hover:not(.selected):not(:disabled) {
192
+ color: var(--ss-fg);
193
+ background: var(--ss-hover);
194
+ }
195
+ .ss-segmented .segment.selected {
196
+ color: var(--ss-fg-on-primary);
197
+ background: var(--ss-primary);
198
+ }
199
+ .ss-segmented .segment:focus-visible {
200
+ outline: none;
201
+ box-shadow: inset 0 0 0 2px var(--ss-primary-soft);
202
+ z-index: 1;
203
+ }
204
+ .ss-segmented .segment.selected:focus-visible {
205
+ box-shadow: inset 0 0 0 2px var(--ss-bg);
206
+ }
207
+ .ss-segmented .segment:disabled {
208
+ cursor: not-allowed;
209
+ opacity: 0.45;
210
+ }
211
+ .ss-segmented .segment .label {
212
+ display: inline-block;
213
+ }
214
+ .ss-segmented.full .segment {
215
+ flex: 1 1 0;
216
+ min-width: 0;
217
+ }
218
+ .ss-segmented :global(.segment .ic) {
219
+ flex: 0 0 auto;
220
+ }</style>
@@ -0,0 +1,37 @@
1
+ import type { IconName } from './Icon.svelte';
2
+ /** One option in a {@link SegmentedControl}. */
3
+ export interface SegmentOption {
4
+ value: string;
5
+ label: string;
6
+ /** Optional leading glyph. */
7
+ icon?: IconName;
8
+ disabled?: boolean;
9
+ }
10
+ import { type Size } from '../config.js';
11
+ interface Props {
12
+ /** Mutually-exclusive options: { value, label, icon?, disabled? }. */
13
+ options?: SegmentOption[];
14
+ /** Selected option value (bindable). */
15
+ value?: string;
16
+ /** Fired when the selection changes (after `value` updates). */
17
+ onChange?: (value: string) => void;
18
+ /** Stretch segments to equal widths and fill the container. */
19
+ fullWidth?: boolean;
20
+ /**
21
+ * Disable the whole control (DS-0078): every segment is rendered inert
22
+ * (`disabled` + skipped by keyboard nav) and the group carries
23
+ * `aria-disabled="true"`. Per-option `disabled` still works for
24
+ * disabling individual segments.
25
+ */
26
+ disabled?: boolean;
27
+ /** Token size (sm|md|lg); inherits the global size when unset. */
28
+ size?: Size;
29
+ /**
30
+ * Accessible name for the group. Required (WCAG 2.2 AA): a radiogroup with
31
+ * no name leaves AT users without context for the choice.
32
+ */
33
+ label: string;
34
+ }
35
+ declare const SegmentedControl: import("svelte").Component<Props, {}, "value">;
36
+ type SegmentedControl = ReturnType<typeof SegmentedControl>;
37
+ export default SegmentedControl;
@@ -1,15 +1,28 @@
1
1
  <script lang="ts">
2
+ import type { Snippet } from 'svelte'
2
3
  import Badge from './Badge.svelte'
3
4
  import Sparkline from './Sparkline.svelte'
4
5
  import { resolveComponentSize, type Size } from '../config.js'
5
6
 
7
+ type Status = 'up' | 'deg' | 'down' | 'maint'
8
+
6
9
  interface Props {
7
10
  name: string
8
11
  host: string
9
- status?: 'up' | 'deg' | 'down'
12
+ status?: Status
10
13
  latency?: string
11
14
  spark?: number[]
12
15
  onclick?: () => void
16
+ /** When set, the card renders as a real `<a>` and navigates here (native Enter). */
17
+ href?: string
18
+ /** Render skeleton placeholders and mark the card `aria-busy`; suppresses interaction. */
19
+ loading?: boolean
20
+ /** Non-interactive variant: `aria-disabled`, no focus/pointer, no onclick. */
21
+ disabled?: boolean
22
+ /** "Last checked" instant; rendered as relative time in a `<time datetime>` footer slot. */
23
+ updatedAt?: Date | string
24
+ /** Optional extra metadata rows (version, IP, tags…) below the head. */
25
+ meta?: Snippet
13
26
  /** Token size (sm|md|lg); inherits the global size when unset. */
14
27
  size?: Size
15
28
  }
@@ -20,45 +33,138 @@
20
33
  latency = '',
21
34
  spark = [4, 8, 6, 10, 7, 12, 9, 14, 11, 16, 13, 10, 12],
22
35
  onclick,
36
+ href,
37
+ loading = false,
38
+ disabled = false,
39
+ updatedAt,
40
+ meta,
23
41
  size,
24
42
  }: Props = $props()
25
43
 
26
44
  const sparkColor = $derived(
27
- status === 'deg' ? 'var(--ss-yellow)'
28
- : status === 'down' ? 'var(--ss-red)'
29
- : 'var(--ss-primary)'
45
+ status === 'deg'
46
+ ? 'var(--ss-yellow)'
47
+ : status === 'down'
48
+ ? 'var(--ss-red)'
49
+ : status === 'maint'
50
+ ? 'var(--ss-blue)'
51
+ : 'var(--ss-primary)',
52
+ )
53
+
54
+ // Spell the status out for assistive tech (the abbreviations are opaque).
55
+ const statusLabel = $derived(
56
+ status === 'deg' ? 'degraded' : status === 'maint' ? 'maintenance' : status,
57
+ )
58
+
59
+ // Status is decorative on the dot/badge, but meaningful — fold it into the label.
60
+ const cardLabel = $derived(`${name}, ${statusLabel}`)
61
+
62
+ // The card is interactive (focusable, activatable) unless explicitly inert.
63
+ // This preserves the original default (a bare card was a role=button); `href`,
64
+ // `loading`, and `disabled` are the only things that change the element.
65
+ const interactive = $derived(!loading && !disabled)
66
+
67
+ // --- relative "last checked" timestamp -------------------------------------
68
+ const updatedDate = $derived(
69
+ updatedAt == null ? undefined : updatedAt instanceof Date ? updatedAt : new Date(updatedAt),
30
70
  )
71
+ const updatedValid = $derived(!!updatedDate && !Number.isNaN(updatedDate.getTime()))
72
+ const updatedISO = $derived(updatedValid ? updatedDate!.toISOString() : undefined)
31
73
 
32
- // Spell the status out for assistive tech ("deg" is an opaque abbreviation).
33
- const statusLabel = $derived(status === 'deg' ? 'degraded' : status)
74
+ function relativeTime(d: Date): string {
75
+ const secs = Math.round((d.getTime() - Date.now()) / 1000)
76
+ const abs = Math.abs(secs)
77
+ const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto', style: 'narrow' })
78
+ if (abs < 60) return rtf.format(Math.round(secs), 'second')
79
+ if (abs < 3600) return rtf.format(Math.round(secs / 60), 'minute')
80
+ if (abs < 86400) return rtf.format(Math.round(secs / 3600), 'hour')
81
+ return rtf.format(Math.round(secs / 86400), 'day')
82
+ }
83
+ const updatedLabel = $derived(updatedValid ? relativeTime(updatedDate!) : '')
34
84
  </script>
35
85
 
36
- <div
37
- class="ss-svc"
38
- role="button"
39
- tabindex="0"
40
- aria-label={name}
41
- data-size-variant={resolveComponentSize('ServiceCard', size)}
42
- {onclick}
43
- onkeydown={(e) => {
44
- if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onclick?.() }
45
- }}
46
- >
86
+ {#snippet body()}
47
87
  <div class="head">
48
88
  <div>
49
- <div class="name">{name}</div>
50
- <div class="host">{host}</div>
89
+ {#if loading}
90
+ <div class="sk sk-name" aria-hidden="true"></div>
91
+ <div class="sk sk-host" aria-hidden="true"></div>
92
+ {:else}
93
+ <div class="name">{name}</div>
94
+ <div class="host">{host}</div>
95
+ {/if}
51
96
  </div>
52
97
  </div>
53
98
  <div class="status">
54
- <Badge tone={status}>{statusLabel}</Badge>
55
- <div class="latency">{latency}</div>
99
+ {#if loading}
100
+ <div class="sk sk-badge" aria-hidden="true"></div>
101
+ {:else}
102
+ <Badge tone={status}>{statusLabel}</Badge>
103
+ <div class="latency">{latency}</div>
104
+ {/if}
56
105
  </div>
106
+ {#if meta && !loading}
107
+ <div class="meta">{@render meta()}</div>
108
+ {/if}
57
109
  <div class="footer">
58
- <Sparkline data={spark} color={sparkColor} />
59
- <div class="latency"><span aria-hidden="true">▸</span> open</div>
110
+ {#if loading}
111
+ <div class="sk sk-spark" aria-hidden="true"></div>
112
+ {:else}
113
+ <Sparkline data={spark} color={sparkColor} />
114
+ <div class="foot-meta">
115
+ {#if updatedValid}
116
+ <time class="updated" datetime={updatedISO}>{updatedLabel}</time>
117
+ {/if}
118
+ {#if interactive}
119
+ <span class="latency open"><span aria-hidden="true">▸</span> open</span>
120
+ {/if}
121
+ </div>
122
+ {/if}
123
+ </div>
124
+ {/snippet}
125
+
126
+ {#if href && interactive}
127
+ <a
128
+ class="ss-svc"
129
+ class:loading
130
+ {href}
131
+ aria-label={cardLabel}
132
+ data-size-variant={resolveComponentSize('ServiceCard', size)}
133
+ {onclick}
134
+ >
135
+ {@render body()}
136
+ </a>
137
+ {:else if interactive}
138
+ <div
139
+ class="ss-svc"
140
+ role="button"
141
+ tabindex="0"
142
+ aria-label={cardLabel}
143
+ data-size-variant={resolveComponentSize('ServiceCard', size)}
144
+ {onclick}
145
+ onkeydown={(e) => {
146
+ if (e.key === 'Enter' || e.key === ' ') {
147
+ e.preventDefault()
148
+ onclick?.()
149
+ }
150
+ }}
151
+ >
152
+ {@render body()}
153
+ </div>
154
+ {:else}
155
+ <div
156
+ class="ss-svc"
157
+ class:loading
158
+ class:disabled
159
+ role="group"
160
+ aria-label={cardLabel}
161
+ aria-busy={loading ? 'true' : undefined}
162
+ aria-disabled={disabled ? 'true' : undefined}
163
+ data-size-variant={resolveComponentSize('ServiceCard', size)}
164
+ >
165
+ {@render body()}
60
166
  </div>
61
- </div>
167
+ {/if}
62
168
 
63
169
  <style>.ss-svc {
64
170
  display: grid;
@@ -67,17 +173,14 @@
67
173
  padding: var(--ss-card-py) var(--ss-card-px);
68
174
  border: 1px solid var(--ss-line);
69
175
  background: var(--ss-bg-elev);
70
- cursor: pointer;
176
+ color: var(--ss-fg);
177
+ text-decoration: none;
71
178
  transition: all var(--ss-dur-fast) var(--ss-ease);
72
179
  }
73
- .ss-svc:hover {
74
- border-color: var(--ss-line-strong);
75
- background: #232323;
76
- }
77
180
  .ss-svc .head {
78
181
  display: flex;
79
182
  align-items: center;
80
- gap: 10px;
183
+ gap: var(--ss-gap-sm);
81
184
  }
82
185
  .ss-svc .head .name {
83
186
  font-family: var(--ss-font-display);
@@ -95,15 +198,108 @@
95
198
  align-items: flex-end;
96
199
  gap: 2px;
97
200
  }
201
+ .ss-svc .meta {
202
+ grid-column: 1/-1;
203
+ font-family: var(--ss-font-mono);
204
+ font-size: var(--ss-ui-sm);
205
+ color: var(--ss-fg-muted);
206
+ display: flex;
207
+ flex-direction: column;
208
+ gap: var(--ss-s-1);
209
+ }
98
210
  .ss-svc .footer {
99
211
  grid-column: 1/-1;
100
212
  display: flex;
101
213
  align-items: center;
102
214
  justify-content: space-between;
215
+ gap: var(--ss-gap-sm);
103
216
  margin-top: 2px;
104
217
  }
218
+ .ss-svc .foot-meta {
219
+ display: flex;
220
+ align-items: center;
221
+ gap: var(--ss-gap-sm);
222
+ }
105
223
  .ss-svc .latency {
106
224
  font-family: var(--ss-font-mono);
107
225
  font-size: var(--ss-ui-sm);
108
226
  color: var(--ss-fg-muted);
227
+ }
228
+ .ss-svc .updated {
229
+ font-family: var(--ss-font-mono);
230
+ font-size: var(--ss-ui-sm);
231
+ color: var(--ss-fg-muted);
232
+ }
233
+
234
+ /* Interactive variants (anchor + role=button div) get the affordance. */
235
+ a.ss-svc,
236
+ [role=button].ss-svc {
237
+ cursor: pointer;
238
+ }
239
+ a.ss-svc:hover,
240
+ [role=button].ss-svc:hover {
241
+ border-color: var(--ss-line-strong);
242
+ background: var(--ss-bg-elev-hover);
243
+ }
244
+ a.ss-svc:focus-visible,
245
+ [role=button].ss-svc:focus-visible {
246
+ outline: 2px solid var(--ss-primary);
247
+ outline-offset: 2px;
248
+ }
249
+
250
+ /* Disabled: inert, no affordance. */
251
+ .ss-svc.disabled {
252
+ cursor: default;
253
+ opacity: 0.55;
254
+ }
255
+
256
+ /* Loading: no affordance, shimmer placeholders. */
257
+ .ss-svc.loading {
258
+ cursor: default;
259
+ }
260
+
261
+ .sk {
262
+ background: var(--ss-bg-elev-hover);
263
+ position: relative;
264
+ overflow: hidden;
265
+ }
266
+ .sk::after {
267
+ content: "";
268
+ position: absolute;
269
+ inset: 0;
270
+ transform: translateX(-100%);
271
+ background: linear-gradient(90deg, transparent, var(--ss-hover), transparent);
272
+ animation: sk-shimmer var(--ss-dur-xslow) var(--ss-ease) infinite;
273
+ }
274
+
275
+ .sk-name {
276
+ width: 120px;
277
+ height: var(--ss-ui-lg);
278
+ margin-bottom: var(--ss-s-1);
279
+ }
280
+
281
+ .sk-host {
282
+ width: 90px;
283
+ height: var(--ss-ui-sm);
284
+ }
285
+
286
+ .sk-badge {
287
+ width: 64px;
288
+ height: calc(var(--ss-ui-xs) + var(--ss-badge-py) * 2);
289
+ }
290
+
291
+ .sk-spark {
292
+ width: 100%;
293
+ height: var(--ss-icon);
294
+ }
295
+
296
+ @keyframes sk-shimmer {
297
+ 100% {
298
+ transform: translateX(100%);
299
+ }
300
+ }
301
+ @media (prefers-reduced-motion: reduce) {
302
+ .sk::after {
303
+ animation: none;
304
+ }
109
305
  }</style>
@@ -1,11 +1,23 @@
1
+ import type { Snippet } from 'svelte';
1
2
  import { type Size } from '../config.js';
3
+ type Status = 'up' | 'deg' | 'down' | 'maint';
2
4
  interface Props {
3
5
  name: string;
4
6
  host: string;
5
- status?: 'up' | 'deg' | 'down';
7
+ status?: Status;
6
8
  latency?: string;
7
9
  spark?: number[];
8
10
  onclick?: () => void;
11
+ /** When set, the card renders as a real `<a>` and navigates here (native Enter). */
12
+ href?: string;
13
+ /** Render skeleton placeholders and mark the card `aria-busy`; suppresses interaction. */
14
+ loading?: boolean;
15
+ /** Non-interactive variant: `aria-disabled`, no focus/pointer, no onclick. */
16
+ disabled?: boolean;
17
+ /** "Last checked" instant; rendered as relative time in a `<time datetime>` footer slot. */
18
+ updatedAt?: Date | string;
19
+ /** Optional extra metadata rows (version, IP, tags…) below the head. */
20
+ meta?: Snippet;
9
21
  /** Token size (sm|md|lg); inherits the global size when unset. */
10
22
  size?: Size;
11
23
  }