dssoca 0.19.0 → 0.21.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 +3 -3
- package/dist/components/Accordion.svelte +30 -54
- package/dist/components/Badge.svelte +12 -7
- package/dist/components/Badge.svelte.d.ts +2 -1
- package/dist/components/BottomNav.svelte +18 -28
- package/dist/components/BoxPlot.svelte +34 -7
- package/dist/components/BumpChart.svelte +65 -26
- package/dist/components/Button.svelte +23 -1
- package/dist/components/Button.svelte.d.ts +5 -1
- package/dist/components/Card.svelte +32 -14
- package/dist/components/Card.svelte.d.ts +4 -1
- package/dist/components/Chart.svelte +166 -32
- package/dist/components/Chart.svelte.d.ts +13 -1
- package/dist/components/Checkbox.svelte +210 -0
- package/dist/components/Checkbox.svelte.d.ts +38 -0
- package/dist/components/DateField.svelte +1 -1
- package/dist/components/FileDrop.svelte +113 -77
- package/dist/components/FileDrop.svelte.d.ts +12 -2
- package/dist/components/Heatmap.svelte +128 -50
- package/dist/components/Heatmap.svelte.d.ts +2 -1
- package/dist/components/Icon.svelte +12 -3
- package/dist/components/Icon.svelte.d.ts +4 -0
- package/dist/components/Image.svelte +44 -44
- package/dist/components/Input.svelte +11 -6
- package/dist/components/Link.svelte +25 -14
- package/dist/components/LogStream.svelte +48 -33
- package/dist/components/Menu.svelte +81 -102
- package/dist/components/Menu.svelte.d.ts +8 -2
- package/dist/components/MetricTile.svelte +11 -1
- package/dist/components/MetricTile.svelte.d.ts +6 -0
- package/dist/components/Modal.svelte +108 -21
- package/dist/components/Modal.svelte.d.ts +18 -5
- package/dist/components/NumberField.svelte +44 -22
- package/dist/components/Pagination.svelte +54 -41
- package/dist/components/Pagination.svelte.d.ts +6 -2
- package/dist/components/Popover.svelte +247 -0
- package/dist/components/Popover.svelte.d.ts +36 -0
- package/dist/components/RadioGroup.svelte +227 -0
- package/dist/components/RadioGroup.svelte.d.ts +42 -0
- package/dist/components/ScatterPlot.svelte +42 -7
- package/dist/components/SearchPalette.svelte +216 -136
- package/dist/components/SearchPalette.svelte.d.ts +11 -4
- package/dist/components/SegmentedControl.svelte +47 -59
- package/dist/components/SegmentedControl.svelte.d.ts +7 -2
- package/dist/components/Select.svelte +3 -4
- package/dist/components/ServiceCard.svelte +105 -68
- package/dist/components/ServiceCard.svelte.d.ts +8 -3
- package/dist/components/ShortcutsHelp.svelte +49 -48
- package/dist/components/Sidebar.svelte +88 -117
- package/dist/components/Switch.svelte +24 -18
- package/dist/components/Switch.svelte.d.ts +6 -2
- package/dist/components/Table.svelte +29 -44
- package/dist/components/Table.svelte.d.ts +6 -2
- package/dist/components/Tabs.svelte +223 -0
- package/dist/components/Tabs.svelte.d.ts +51 -0
- package/dist/components/Textarea.svelte +1 -1
- package/dist/components/TierList.svelte +45 -49
- package/dist/components/TierList.svelte.d.ts +7 -3
- package/dist/components/Toaster.svelte +154 -32
- package/dist/components/Tooltip.svelte +122 -18
- package/dist/components/Tooltip.svelte.d.ts +1 -1
- package/dist/components/Topbar.svelte +29 -49
- package/dist/core/accordion.d.ts +32 -0
- package/dist/core/accordion.js +53 -0
- package/dist/core/behaviors/focusable.d.ts +5 -0
- package/dist/core/behaviors/focusable.js +14 -0
- package/dist/core/behaviors/roving.d.ts +13 -0
- package/dist/core/behaviors/roving.js +29 -0
- package/dist/core/bottom-nav.d.ts +36 -0
- package/dist/core/bottom-nav.js +33 -0
- package/dist/core/chart-nav.d.ts +53 -0
- package/dist/core/chart-nav.js +62 -0
- package/dist/core/checkbox.d.ts +36 -0
- package/dist/core/checkbox.js +29 -0
- package/dist/core/file-drop.d.ts +75 -0
- package/dist/core/file-drop.js +101 -0
- package/dist/core/image.d.ts +59 -0
- package/dist/core/image.js +64 -0
- package/dist/core/input.d.ts +21 -0
- package/dist/core/input.js +17 -0
- package/dist/core/log-stream.d.ts +51 -0
- package/dist/core/log-stream.js +50 -0
- package/dist/core/menu.d.ts +70 -0
- package/dist/core/menu.js +84 -0
- package/dist/core/modal.d.ts +59 -0
- package/dist/core/modal.js +44 -0
- package/dist/core/number-field.d.ts +47 -0
- package/dist/core/number-field.js +64 -0
- package/dist/core/pagination.d.ts +59 -0
- package/dist/core/pagination.js +65 -0
- package/dist/core/popover.d.ts +68 -0
- package/dist/core/popover.js +55 -0
- package/dist/core/radio.d.ts +36 -0
- package/dist/core/radio.js +48 -0
- package/dist/core/search-palette.d.ts +124 -0
- package/dist/core/search-palette.js +149 -0
- package/dist/core/segmented.d.ts +46 -0
- package/dist/core/segmented.js +66 -0
- package/dist/core/shortcuts-help.d.ts +56 -0
- package/dist/core/shortcuts-help.js +50 -0
- package/dist/core/sidebar.d.ts +63 -0
- package/dist/core/sidebar.js +84 -0
- package/dist/core/switch.d.ts +19 -0
- package/dist/core/switch.js +11 -0
- package/dist/core/table.d.ts +40 -0
- package/dist/core/table.js +57 -0
- package/dist/core/tabs.d.ts +84 -0
- package/dist/core/tabs.js +90 -0
- package/dist/{tierlist-core.d.ts → core/tierlist.d.ts} +77 -5
- package/dist/{tierlist-core.js → core/tierlist.js} +64 -7
- package/dist/core/toast.d.ts +112 -0
- package/dist/{toast-core.js → core/toast.js} +48 -2
- package/dist/core/tooltip.d.ts +47 -0
- package/dist/core/tooltip.js +51 -0
- package/dist/core/topbar.d.ts +41 -0
- package/dist/core/topbar.js +52 -0
- package/dist/dssoca.config.d.ts +1 -1
- package/dist/dssoca.config.js +4 -0
- package/dist/icons.d.ts +19 -2
- package/dist/icons.js +42 -3
- package/dist/index.d.ts +15 -2
- package/dist/index.js +10 -2
- package/dist/theme.css +47 -0
- package/dist/toast.svelte.d.ts +2 -2
- package/dist/toast.svelte.js +1 -1
- package/dist/tokens.css +47 -0
- package/dist/vanilla/accordion.js +35 -32
- package/dist/vanilla/checkbox.d.ts +8 -0
- package/dist/vanilla/checkbox.js +43 -0
- package/dist/vanilla/delegate.d.ts +2 -0
- package/dist/vanilla/delegate.js +9 -0
- package/dist/vanilla/fields.js +46 -28
- package/dist/vanilla/index.d.ts +5 -1
- package/dist/vanilla/index.js +17 -4
- package/dist/vanilla/menu.js +101 -84
- package/dist/vanilla/modal.d.ts +7 -1
- package/dist/vanilla/modal.js +120 -15
- package/dist/vanilla/popover.d.ts +10 -0
- package/dist/vanilla/popover.js +129 -0
- package/dist/vanilla/radio.d.ts +3 -0
- package/dist/vanilla/radio.js +54 -0
- package/dist/vanilla/segmented.js +50 -43
- package/dist/vanilla/switch.d.ts +2 -1
- package/dist/vanilla/switch.js +13 -8
- package/dist/vanilla/tabs.d.ts +2 -0
- package/dist/vanilla/tabs.js +87 -0
- package/dist/vanilla/tierlist.d.ts +1 -1
- package/dist/vanilla/tierlist.js +34 -34
- package/dist/vanilla/toast.d.ts +13 -5
- package/dist/vanilla/toast.js +132 -16
- package/dist/vanilla/tooltip.d.ts +5 -1
- package/dist/vanilla/tooltip.js +78 -19
- package/dist/vanilla.css +675 -160
- package/package.json +1 -1
- package/dist/toast-core.d.ts +0 -61
|
@@ -21,14 +21,28 @@
|
|
|
21
21
|
// ─────────────────────────────────────────────────────────────────────────
|
|
22
22
|
import Icon from './Icon.svelte'
|
|
23
23
|
import { resolveComponentSize, type Size } from '../config.js'
|
|
24
|
+
import {
|
|
25
|
+
segmentedGroupAttrs,
|
|
26
|
+
segmentedItemAttrs,
|
|
27
|
+
segmentedKey,
|
|
28
|
+
segmentedPress,
|
|
29
|
+
segmentedTabStop,
|
|
30
|
+
type SegmentedAction,
|
|
31
|
+
type SegmentedChangeDetails,
|
|
32
|
+
type SegmentedState,
|
|
33
|
+
} from '../core/segmented.js'
|
|
24
34
|
|
|
25
35
|
interface Props {
|
|
26
36
|
/** Mutually-exclusive options: { value, label, icon?, disabled? }. */
|
|
27
37
|
options?: SegmentOption[]
|
|
28
38
|
/** Selected option value (bindable). */
|
|
29
39
|
value?: string
|
|
30
|
-
/**
|
|
31
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Fired when the selection changes (after `value` updates). `details.reason`
|
|
42
|
+
* says what moved it: `'press'` (a segment was clicked) or `'key'` (arrows /
|
|
43
|
+
* Home / End).
|
|
44
|
+
*/
|
|
45
|
+
onChange?: (value: string, details: SegmentedChangeDetails) => void
|
|
32
46
|
/** Stretch segments to equal widths and fill the container. */
|
|
33
47
|
fullWidth?: boolean
|
|
34
48
|
/**
|
|
@@ -68,62 +82,39 @@
|
|
|
68
82
|
options.map((o, i) => (isOptionDisabled(o) ? -1 : i)).filter((i) => i >= 0),
|
|
69
83
|
)
|
|
70
84
|
|
|
85
|
+
// The group's state as `core/segmented.ts` sees it. Every decision (what a press
|
|
86
|
+
// or a key selects, which segment owns the tab stop) is made there, shared with
|
|
87
|
+
// vanilla/segmented.ts (DS-0197).
|
|
88
|
+
const group = $derived<SegmentedState>({
|
|
89
|
+
selected: options.findIndex((o) => o.value === value),
|
|
90
|
+
enabled: enabledIndexes,
|
|
91
|
+
})
|
|
92
|
+
|
|
71
93
|
/** Index that owns the single tab stop (roving tabindex). The selected option
|
|
72
94
|
* when it's enabled; otherwise the first enabled option; -1 when none. */
|
|
73
|
-
const tabbableIndex = $derived
|
|
74
|
-
const sel = options.findIndex((o) => o.value === value && !isOptionDisabled(o))
|
|
75
|
-
if (sel >= 0) return sel
|
|
76
|
-
return enabledIndexes[0] ?? -1
|
|
77
|
-
})
|
|
95
|
+
const tabbableIndex = $derived(segmentedTabStop(group))
|
|
78
96
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!
|
|
82
|
-
|
|
97
|
+
/** Apply a core action: move the selection (and focus, for the keyboard). */
|
|
98
|
+
function run(action: SegmentedAction | null) {
|
|
99
|
+
if (!action) return
|
|
100
|
+
const opt = options[action.index]
|
|
101
|
+
if (action.changed && opt) {
|
|
83
102
|
value = opt.value
|
|
84
|
-
onChange?.(opt.value)
|
|
103
|
+
onChange?.(opt.value, { reason: action.reason })
|
|
85
104
|
}
|
|
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]
|
|
105
|
+
if (action.focus) segments[action.index]?.focus()
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
function onKeydown(e: KeyboardEvent, index: number) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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()
|
|
109
|
+
// RTL: the row is laid out right-to-left, so ArrowLeft points at the NEXT
|
|
110
|
+
// segment. Read the computed direction at keydown time (it inherits from
|
|
111
|
+
// any ancestor `dir`) and hand it to the core, which stays DOM-free.
|
|
112
|
+
const rtl = getComputedStyle(e.currentTarget as Element).direction === 'rtl'
|
|
113
|
+
const result = segmentedKey(group, index, e.key, rtl)
|
|
114
|
+
if (!result) return
|
|
115
|
+
if (result.preventDefault) e.preventDefault()
|
|
124
116
|
// radiogroup semantics: moving focus also moves the selection.
|
|
125
|
-
|
|
126
|
-
focusIndex(target)
|
|
117
|
+
run(result.action)
|
|
127
118
|
}
|
|
128
119
|
|
|
129
120
|
const sizeAttr = $derived(resolveComponentSize('SegmentedControl', size))
|
|
@@ -132,23 +123,20 @@
|
|
|
132
123
|
<div
|
|
133
124
|
class="ss-segmented"
|
|
134
125
|
class:full={fullWidth}
|
|
135
|
-
role="radiogroup"
|
|
136
126
|
aria-label={label}
|
|
137
|
-
aria-disabled={disabled ? 'true' : undefined}
|
|
138
127
|
data-size-variant={sizeAttr}
|
|
128
|
+
{...segmentedGroupAttrs(disabled)}
|
|
139
129
|
>
|
|
140
130
|
{#each options as opt, i (opt.value)}
|
|
141
|
-
{@const selected =
|
|
131
|
+
{@const selected = i === group.selected}
|
|
142
132
|
<button
|
|
143
133
|
bind:this={segments[i]}
|
|
144
134
|
type="button"
|
|
145
135
|
class="segment"
|
|
146
136
|
class:selected
|
|
147
|
-
|
|
148
|
-
aria-checked={selected}
|
|
149
|
-
tabindex={i === tabbableIndex ? 0 : -1}
|
|
137
|
+
{...segmentedItemAttrs(i, group.selected, tabbableIndex)}
|
|
150
138
|
disabled={isOptionDisabled(opt)}
|
|
151
|
-
onclick={() =>
|
|
139
|
+
onclick={() => run(segmentedPress(group, i))}
|
|
152
140
|
onkeydown={(e) => onKeydown(e, i)}
|
|
153
141
|
>
|
|
154
142
|
{#if opt.icon}<Icon name={opt.icon} class="ic" />{/if}
|
|
@@ -178,7 +166,7 @@
|
|
|
178
166
|
color: var(--ss-fg-muted);
|
|
179
167
|
background: transparent;
|
|
180
168
|
border: 0;
|
|
181
|
-
border-
|
|
169
|
+
border-inline-start: 1px solid var(--ss-line);
|
|
182
170
|
padding: var(--ss-seg-py) var(--ss-seg-px);
|
|
183
171
|
cursor: pointer;
|
|
184
172
|
white-space: nowrap;
|
|
@@ -186,7 +174,7 @@
|
|
|
186
174
|
transition: color var(--ss-dur-fast) var(--ss-ease), background var(--ss-dur-fast) var(--ss-ease);
|
|
187
175
|
}
|
|
188
176
|
.ss-segmented .segment:first-child {
|
|
189
|
-
border-
|
|
177
|
+
border-inline-start: 0;
|
|
190
178
|
}
|
|
191
179
|
.ss-segmented .segment:hover:not(.selected):not(:disabled) {
|
|
192
180
|
color: var(--ss-fg);
|
|
@@ -198,7 +186,7 @@
|
|
|
198
186
|
}
|
|
199
187
|
.ss-segmented .segment:focus-visible {
|
|
200
188
|
outline: none;
|
|
201
|
-
box-shadow: inset 0 0 0 2px var(--ss-primary
|
|
189
|
+
box-shadow: inset 0 0 0 2px var(--ss-primary);
|
|
202
190
|
z-index: 1;
|
|
203
191
|
}
|
|
204
192
|
.ss-segmented .segment.selected:focus-visible {
|
|
@@ -8,13 +8,18 @@ export interface SegmentOption {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}
|
|
10
10
|
import { type Size } from '../config.js';
|
|
11
|
+
import { type SegmentedChangeDetails } from '../core/segmented.js';
|
|
11
12
|
interface Props {
|
|
12
13
|
/** Mutually-exclusive options: { value, label, icon?, disabled? }. */
|
|
13
14
|
options?: SegmentOption[];
|
|
14
15
|
/** Selected option value (bindable). */
|
|
15
16
|
value?: string;
|
|
16
|
-
/**
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Fired when the selection changes (after `value` updates). `details.reason`
|
|
19
|
+
* says what moved it: `'press'` (a segment was clicked) or `'key'` (arrows /
|
|
20
|
+
* Home / End).
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (value: string, details: SegmentedChangeDetails) => void;
|
|
18
23
|
/** Stretch segments to equal widths and fill the container. */
|
|
19
24
|
fullWidth?: boolean;
|
|
20
25
|
/**
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
}
|
|
141
141
|
.ss-select .lbl .req {
|
|
142
142
|
color: var(--ss-red);
|
|
143
|
-
margin-
|
|
143
|
+
margin-inline-start: 2px;
|
|
144
144
|
}
|
|
145
145
|
.ss-select .control {
|
|
146
146
|
position: relative;
|
|
@@ -171,9 +171,8 @@
|
|
|
171
171
|
pointer-events: none;
|
|
172
172
|
width: 0;
|
|
173
173
|
height: 0;
|
|
174
|
-
margin-
|
|
175
|
-
border-
|
|
176
|
-
border-right: var(--ss-select-chevron, 5px) solid transparent;
|
|
174
|
+
margin-inline-start: var(--ss-gap-sm);
|
|
175
|
+
border-inline: var(--ss-select-chevron, 5px) solid transparent;
|
|
177
176
|
border-top: var(--ss-select-chevron, 5px) solid var(--ss-fg-muted);
|
|
178
177
|
transition: border-top-color var(--ss-dur-fast) var(--ss-ease);
|
|
179
178
|
}
|
|
@@ -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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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 = [
|
|
39
|
+
spark = [],
|
|
35
40
|
onclick,
|
|
36
41
|
href,
|
|
37
42
|
loading = false,
|
|
@@ -67,13 +72,24 @@
|
|
|
67
72
|
: 'positive',
|
|
68
73
|
)
|
|
69
74
|
|
|
70
|
-
//
|
|
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
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
|
246
|
-
|
|
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
|
-
|
|
256
|
-
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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;
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
formatShortcut,
|
|
27
27
|
type ShortcutInfo,
|
|
28
28
|
} from '../shortcuts.svelte.js'
|
|
29
|
+
import {
|
|
30
|
+
SHORTCUTS_FALLBACK_GROUP as FALLBACK_GROUP,
|
|
31
|
+
shortcutsHelpGroups,
|
|
32
|
+
shortcutsHelpRecordKey,
|
|
33
|
+
shortcutsHelpRecordPress,
|
|
34
|
+
type ShortcutComboVerdict,
|
|
35
|
+
type ShortcutsHelpGroup,
|
|
36
|
+
} from '../core/shortcuts-help.js'
|
|
29
37
|
|
|
30
38
|
interface Props {
|
|
31
39
|
/** Whether the overlay is shown. Bindable — control it, or let the hotkey manage it. */
|
|
@@ -67,8 +75,6 @@
|
|
|
67
75
|
children,
|
|
68
76
|
}: Props = $props()
|
|
69
77
|
|
|
70
|
-
const FALLBACK_GROUP = 'General'
|
|
71
|
-
|
|
72
78
|
// Self-registration. `add()` returns the disposer, which doubles as the
|
|
73
79
|
// effect's cleanup: unmount unregisters, a `hotkey` change re-registers.
|
|
74
80
|
// Effects never run on the server, so SSR stays registration-free.
|
|
@@ -85,33 +91,15 @@
|
|
|
85
91
|
})
|
|
86
92
|
})
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
items: ShortcutInfo[]
|
|
91
|
-
}
|
|
94
|
+
// Behaviour lives in `core/shortcuts-help.ts`: the sectioning below and what a key does
|
|
95
|
+
// while recording are decided there; the registry stays the source of the shortcuts.
|
|
92
96
|
|
|
93
97
|
// Live grouping of the registry: buckets in first-appearance order with
|
|
94
98
|
// "General" forced last; an explicit `groupOrder` lists its named groups
|
|
95
99
|
// first and the rest keep the default order.
|
|
96
|
-
const groups:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const name = item.group ?? FALLBACK_GROUP
|
|
100
|
-
const bucket = buckets.find((g) => g.name === name)
|
|
101
|
-
if (bucket) bucket.items.push(item)
|
|
102
|
-
else buckets.push({ name, items: [item] })
|
|
103
|
-
}
|
|
104
|
-
let ordered = buckets.filter((g) => g.name !== FALLBACK_GROUP)
|
|
105
|
-
const general = buckets.find((g) => g.name === FALLBACK_GROUP)
|
|
106
|
-
if (general) ordered.push(general)
|
|
107
|
-
if (groupOrder?.length) {
|
|
108
|
-
const explicit = groupOrder
|
|
109
|
-
.map((n) => ordered.find((g) => g.name === n))
|
|
110
|
-
.filter((g): g is Group => g !== undefined)
|
|
111
|
-
ordered = [...explicit, ...ordered.filter((g) => !explicit.includes(g))]
|
|
112
|
-
}
|
|
113
|
-
return ordered
|
|
114
|
-
})
|
|
100
|
+
const groups: ShortcutsHelpGroup<ShortcutInfo>[] = $derived(
|
|
101
|
+
shortcutsHelpGroups(shortcuts.items, groupOrder),
|
|
102
|
+
)
|
|
115
103
|
|
|
116
104
|
// ── Editable mode (DS-0141) — remap recorder + live announcements ────────
|
|
117
105
|
// One shortcut records at a time; `status` feeds the visible role="status"
|
|
@@ -132,6 +120,20 @@
|
|
|
132
120
|
status = 'Shortcut change cancelled.'
|
|
133
121
|
}
|
|
134
122
|
|
|
123
|
+
function toggleRecording(item: ShortcutInfo) {
|
|
124
|
+
if (shortcutsHelpRecordPress(recordingId, item.id).type === 'start') startRecording(item)
|
|
125
|
+
else cancelRecording()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// The registry's own judgement of a combo (its parser throws on what it cannot bind).
|
|
129
|
+
function verdict(combo: string): ShortcutComboVerdict {
|
|
130
|
+
try {
|
|
131
|
+
return isReservedCombo(combo) ? 'reserved' : 'ok'
|
|
132
|
+
} catch {
|
|
133
|
+
return 'invalid'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
135
137
|
function resetRow(item: ShortcutInfo) {
|
|
136
138
|
shortcuts.remap(item.id, null)
|
|
137
139
|
status = `"${item.label}" restored to ${spoken(item.defaultKeys)}.`
|
|
@@ -157,27 +159,27 @@
|
|
|
157
159
|
const onKeydown = (event: KeyboardEvent) => {
|
|
158
160
|
event.preventDefault()
|
|
159
161
|
event.stopPropagation()
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
162
|
+
const action = shortcutsHelpRecordKey(comboFromEvent(event), verdict)
|
|
163
|
+
switch (action.type) {
|
|
164
|
+
case 'wait':
|
|
165
|
+
break
|
|
166
|
+
case 'cancel':
|
|
167
|
+
cancelRecording()
|
|
168
|
+
break
|
|
169
|
+
case 'reject':
|
|
170
|
+
status =
|
|
171
|
+
action.why === 'invalid'
|
|
172
|
+
? 'That key cannot be used — try another combination.'
|
|
173
|
+
: `${spoken(action.combo)} is reserved by the browser — try another combination.`
|
|
174
|
+
break
|
|
175
|
+
case 'remap': {
|
|
176
|
+
const label = shortcuts.items.find((i) => i.id === id)?.label ?? id
|
|
177
|
+
shortcuts.remap(id, action.combo)
|
|
178
|
+
recordingId = null
|
|
179
|
+
status = `"${label}" is now ${spoken(action.combo)}.`
|
|
180
|
+
break
|
|
181
|
+
}
|
|
177
182
|
}
|
|
178
|
-
shortcuts.remap(id, combo)
|
|
179
|
-
recordingId = null
|
|
180
|
-
status = `"${label}" is now ${spoken(combo)}.`
|
|
181
183
|
}
|
|
182
184
|
window.addEventListener('keydown', onKeydown, true)
|
|
183
185
|
return () => window.removeEventListener('keydown', onKeydown, true)
|
|
@@ -239,8 +241,7 @@
|
|
|
239
241
|
aria-label={recordingId === item.id
|
|
240
242
|
? `Recording a new shortcut for "${item.label}" — press keys, Escape cancels`
|
|
241
243
|
: `Change the shortcut for "${item.label}"`}
|
|
242
|
-
onclick={() =>
|
|
243
|
-
recordingId === item.id ? cancelRecording() : startRecording(item)}
|
|
244
|
+
onclick={() => toggleRecording(item)}
|
|
244
245
|
>
|
|
245
246
|
{recordingId === item.id ? 'Cancel' : 'Change'}
|
|
246
247
|
</Button>
|
|
@@ -344,7 +345,7 @@
|
|
|
344
345
|
text-decoration: line-through;
|
|
345
346
|
}
|
|
346
347
|
.ss-shortcuts-help .off-tag {
|
|
347
|
-
margin-
|
|
348
|
+
margin-inline-start: var(--ss-s-1);
|
|
348
349
|
color: var(--ss-fg-muted);
|
|
349
350
|
}
|
|
350
351
|
.ss-shortcuts-help .extra {
|