dssoca 0.10.0 → 0.12.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/dist/components/Accordion.svelte +35 -15
- package/dist/components/Accordion.svelte.d.ts +7 -0
- package/dist/components/Avatar.svelte +5 -9
- package/dist/components/Badge.svelte +27 -53
- package/dist/components/Badge.svelte.d.ts +2 -5
- package/dist/components/BottomNav.svelte +2 -2
- package/dist/components/BoxPlot.svelte +421 -0
- package/dist/components/BoxPlot.svelte.d.ts +36 -0
- package/dist/components/BumpChart.svelte +345 -0
- package/dist/components/BumpChart.svelte.d.ts +32 -0
- package/dist/components/Button.svelte +50 -34
- package/dist/components/Button.svelte.d.ts +8 -2
- package/dist/components/Chart.svelte +2 -8
- package/dist/components/DateField.svelte +1 -1
- package/dist/components/FileDrop.svelte +1 -1
- package/dist/components/Heatmap.svelte +333 -0
- package/dist/components/Heatmap.svelte.d.ts +30 -0
- package/dist/components/Icon.svelte +29 -7
- package/dist/components/Icon.svelte.d.ts +14 -2
- package/dist/components/Input.svelte +1 -1
- package/dist/components/LogStream.svelte +3 -3
- package/dist/components/Menu.svelte +1 -1
- package/dist/components/NumberField.svelte +1 -1
- package/dist/components/ScatterPlot.svelte +395 -0
- package/dist/components/ScatterPlot.svelte.d.ts +55 -0
- package/dist/components/Select.svelte +1 -1
- package/dist/components/ServiceCard.svelte +13 -2
- package/dist/components/Sidebar.svelte +1 -1
- package/dist/components/Spinner.svelte +26 -19
- package/dist/components/Spinner.svelte.d.ts +14 -4
- package/dist/components/Textarea.svelte +1 -1
- package/dist/components/Topbar.svelte +2 -2
- package/dist/config.d.ts +44 -3
- package/dist/config.js +52 -3
- package/dist/dssoca.config.d.ts +38 -1
- package/dist/dssoca.config.js +47 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.js +11 -4
- package/dist/palette.d.ts +10 -0
- package/dist/palette.js +17 -0
- package/dist/theme.css +158 -158
- package/dist/tokens.css +158 -158
- package/package.json +3 -2
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export interface ScatterPoint {
|
|
3
|
+
/** Label shown next to the dot and in the tooltip / accessible name. */
|
|
4
|
+
label: string
|
|
5
|
+
x: number
|
|
6
|
+
y: number
|
|
7
|
+
/** Optional magnitude → bubble area (sqrt-scaled radius). Omit for a fixed dot. */
|
|
8
|
+
size?: number
|
|
9
|
+
/** Optional per-point colour; falls back to the cycling palette. */
|
|
10
|
+
color?: string
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { CHART_PALETTE } from '../palette.js'
|
|
16
|
+
import { scaleLinear, scaleSqrt } from 'd3-scale'
|
|
17
|
+
import { extent, max } from 'd3-array'
|
|
18
|
+
import { resolveComponentSize, type Size } from '../config.js'
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
/** One dot per datum. Two encoded axes (x, y), optional `size` and `color`. */
|
|
22
|
+
points: ScatterPoint[]
|
|
23
|
+
/** X axis caption (drawn under the axis). */
|
|
24
|
+
xLabel?: string
|
|
25
|
+
/** Y axis caption (drawn rotated beside the axis). */
|
|
26
|
+
yLabel?: string
|
|
27
|
+
/** Draw a dashed vertical reference line at this x (e.g. the median) → quadrants. */
|
|
28
|
+
xRef?: number
|
|
29
|
+
/** Draw a dashed horizontal reference line at this y (e.g. the median) → quadrants. */
|
|
30
|
+
yRef?: number
|
|
31
|
+
/** Corner captions for the four quadrants (needs xRef + yRef to read well). */
|
|
32
|
+
quadrantLabels?: { tl?: string; tr?: string; bl?: string; br?: string }
|
|
33
|
+
/** Force the x domain; defaults to the padded data extent. */
|
|
34
|
+
xDomain?: [number, number]
|
|
35
|
+
/** Force the y domain; defaults to the padded data extent. */
|
|
36
|
+
yDomain?: [number, number]
|
|
37
|
+
/** Format an x value for ticks + tooltip. */
|
|
38
|
+
xFormat?: (x: number) => string
|
|
39
|
+
/** Format a y value for ticks + tooltip. */
|
|
40
|
+
yFormat?: (y: number) => string
|
|
41
|
+
/** Draw each point's label next to its dot. Default true. */
|
|
42
|
+
showLabels?: boolean
|
|
43
|
+
/** Intrinsic drawing height in px. Default 320. */
|
|
44
|
+
height?: number
|
|
45
|
+
/** Intrinsic drawing width in px. Default 420. */
|
|
46
|
+
width?: number
|
|
47
|
+
/** Stretch to the container width via the viewBox (width:100%). */
|
|
48
|
+
fluid?: boolean
|
|
49
|
+
/** Reveal a tooltip on hover/focus of a point. Default true. */
|
|
50
|
+
tooltip?: boolean
|
|
51
|
+
/** SR summary + accessible name; auto-generated when absent. */
|
|
52
|
+
summary?: string
|
|
53
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
54
|
+
size?: Size
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let {
|
|
58
|
+
points,
|
|
59
|
+
xLabel,
|
|
60
|
+
yLabel,
|
|
61
|
+
xRef,
|
|
62
|
+
yRef,
|
|
63
|
+
quadrantLabels,
|
|
64
|
+
xDomain,
|
|
65
|
+
yDomain,
|
|
66
|
+
xFormat,
|
|
67
|
+
yFormat,
|
|
68
|
+
showLabels = true,
|
|
69
|
+
height = 320,
|
|
70
|
+
width = 420,
|
|
71
|
+
fluid = false,
|
|
72
|
+
tooltip = true,
|
|
73
|
+
summary,
|
|
74
|
+
size,
|
|
75
|
+
}: Props = $props()
|
|
76
|
+
|
|
77
|
+
const PALETTE = CHART_PALETTE
|
|
78
|
+
|
|
79
|
+
const M = { top: 12, right: 16, bottom: 36, left: 48 }
|
|
80
|
+
|
|
81
|
+
const clean = $derived(
|
|
82
|
+
(points ?? []).filter((p) => p && Number.isFinite(p.x) && Number.isFinite(p.y)),
|
|
83
|
+
)
|
|
84
|
+
const isEmpty = $derived(clean.length === 0)
|
|
85
|
+
|
|
86
|
+
function colorFor(p: ScatterPoint, i: number): string {
|
|
87
|
+
return p.color ?? PALETTE[i % PALETTE.length]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const innerW = $derived(Math.max(0, width - M.left - M.right))
|
|
91
|
+
const innerH = $derived(Math.max(0, height - M.top - M.bottom))
|
|
92
|
+
|
|
93
|
+
const fmtX = $derived(xFormat ?? ((x: number) => String(x)))
|
|
94
|
+
const fmtY = $derived(yFormat ?? ((y: number) => String(y)))
|
|
95
|
+
|
|
96
|
+
/** Data extent padded by 8% each side; a flat axis is expanded to ±1. */
|
|
97
|
+
function paddedExtent(values: number[]): [number, number] {
|
|
98
|
+
const e = extent(values) as [number, number]
|
|
99
|
+
if (e[0] === undefined) return [0, 1]
|
|
100
|
+
if (e[0] === e[1]) return [e[0] - 1, e[1] + 1]
|
|
101
|
+
const pad = (e[1] - e[0]) * 0.08
|
|
102
|
+
return [e[0] - pad, e[1] + pad]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const xDom = $derived(xDomain ?? paddedExtent(clean.map((p) => p.x)))
|
|
106
|
+
const yDom = $derived(yDomain ?? paddedExtent(clean.map((p) => p.y)))
|
|
107
|
+
|
|
108
|
+
const xScaleObj = $derived(scaleLinear().domain(xDom).nice().range([0, innerW]))
|
|
109
|
+
const yScaleObj = $derived(scaleLinear().domain(yDom).nice().range([innerH, 0]))
|
|
110
|
+
|
|
111
|
+
// Bubble radius: sqrt scale (area-true) when any point carries a size, else fixed.
|
|
112
|
+
const hasSizes = $derived(clean.some((p) => typeof p.size === 'number'))
|
|
113
|
+
const rScaleObj = $derived(
|
|
114
|
+
scaleSqrt()
|
|
115
|
+
.domain([0, max(clean, (p) => p.size ?? 0) || 1])
|
|
116
|
+
.range([4, 16]),
|
|
117
|
+
)
|
|
118
|
+
function radiusFor(p: ScatterPoint): number {
|
|
119
|
+
return hasSizes ? rScaleObj(p.size ?? 0) : 5
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const xTicks = $derived(xScaleObj.ticks(5))
|
|
123
|
+
const yTicks = $derived(yScaleObj.ticks(5))
|
|
124
|
+
|
|
125
|
+
const marks = $derived(
|
|
126
|
+
clean.map((p, i) => ({
|
|
127
|
+
cx: xScaleObj(p.x),
|
|
128
|
+
cy: yScaleObj(p.y),
|
|
129
|
+
r: radiusFor(p),
|
|
130
|
+
color: colorFor(p, i),
|
|
131
|
+
label: p.label,
|
|
132
|
+
x: p.x,
|
|
133
|
+
y: p.y,
|
|
134
|
+
})),
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
const corners = $derived.by(() => {
|
|
138
|
+
if (!quadrantLabels) return [] as { x: number; y: number; anchor: string; text: string }[]
|
|
139
|
+
const pad = 4
|
|
140
|
+
const out: { x: number; y: number; anchor: string; text: string }[] = []
|
|
141
|
+
if (quadrantLabels.tl)
|
|
142
|
+
out.push({ x: pad, y: pad + 8, anchor: 'start', text: quadrantLabels.tl })
|
|
143
|
+
if (quadrantLabels.tr)
|
|
144
|
+
out.push({ x: innerW - pad, y: pad + 8, anchor: 'end', text: quadrantLabels.tr })
|
|
145
|
+
if (quadrantLabels.bl)
|
|
146
|
+
out.push({ x: pad, y: innerH - pad, anchor: 'start', text: quadrantLabels.bl })
|
|
147
|
+
if (quadrantLabels.br)
|
|
148
|
+
out.push({ x: innerW - pad, y: innerH - pad, anchor: 'end', text: quadrantLabels.br })
|
|
149
|
+
return out
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
const autoSummary = $derived.by(() => {
|
|
153
|
+
if (isEmpty) return 'No data'
|
|
154
|
+
const names = clean.map((p) => p.label).join(', ')
|
|
155
|
+
return `Scatter plot with ${clean.length} points (${names}).`
|
|
156
|
+
})
|
|
157
|
+
const srText = $derived(summary ?? autoSummary)
|
|
158
|
+
|
|
159
|
+
const resolvedSize = $derived(resolveComponentSize('Chart', size))
|
|
160
|
+
|
|
161
|
+
let active = $state<{ label: string; x: number; y: number; cx: number; cy: number } | null>(null)
|
|
162
|
+
function show(label: string, x: number, y: number, cx: number, cy: number) {
|
|
163
|
+
if (tooltip) active = { label, x, y, cx, cy }
|
|
164
|
+
}
|
|
165
|
+
function hide() {
|
|
166
|
+
active = null
|
|
167
|
+
}
|
|
168
|
+
function datumLabel(label: string, x: number, y: number): string {
|
|
169
|
+
return `${label}: ${fmtX(x)}, ${fmtY(y)}`
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div
|
|
174
|
+
class="ss-scatter"
|
|
175
|
+
class:fluid
|
|
176
|
+
data-size-variant={resolvedSize}
|
|
177
|
+
role="group"
|
|
178
|
+
aria-label={srText}
|
|
179
|
+
>
|
|
180
|
+
{#if isEmpty}
|
|
181
|
+
<span class="empty" aria-hidden="true">—</span>
|
|
182
|
+
<span class="sr-only">No data</span>
|
|
183
|
+
{:else}
|
|
184
|
+
<div class="plot">
|
|
185
|
+
<svg
|
|
186
|
+
class="canvas"
|
|
187
|
+
viewBox="0 0 {width} {height}"
|
|
188
|
+
width={fluid ? undefined : width}
|
|
189
|
+
height={fluid ? undefined : height}
|
|
190
|
+
preserveAspectRatio="xMidYMid meet"
|
|
191
|
+
role="presentation"
|
|
192
|
+
>
|
|
193
|
+
<g transform="translate({M.left},{M.top})">
|
|
194
|
+
<!-- gridlines + y axis -->
|
|
195
|
+
{#each yTicks as t}
|
|
196
|
+
<line class="grid" x1="0" x2={innerW} y1={yScaleObj(t)} y2={yScaleObj(t)} />
|
|
197
|
+
<text class="tick y" x="-6" y={yScaleObj(t)} dy="0.32em" text-anchor="end"
|
|
198
|
+
>{fmtY(t)}</text
|
|
199
|
+
>
|
|
200
|
+
{/each}
|
|
201
|
+
{#each xTicks as t}
|
|
202
|
+
<text class="tick x" x={xScaleObj(t)} y={innerH + 16} text-anchor="middle"
|
|
203
|
+
>{fmtX(t)}</text
|
|
204
|
+
>
|
|
205
|
+
{/each}
|
|
206
|
+
<line class="axis" x1="0" x2="0" y1="0" y2={innerH} />
|
|
207
|
+
<line class="axis" x1="0" x2={innerW} y1={innerH} y2={innerH} />
|
|
208
|
+
|
|
209
|
+
<!-- quadrant reference lines -->
|
|
210
|
+
{#if xRef !== undefined}
|
|
211
|
+
<line class="ref" x1={xScaleObj(xRef)} x2={xScaleObj(xRef)} y1="0" y2={innerH} />
|
|
212
|
+
{/if}
|
|
213
|
+
{#if yRef !== undefined}
|
|
214
|
+
<line class="ref" x1="0" x2={innerW} y1={yScaleObj(yRef)} y2={yScaleObj(yRef)} />
|
|
215
|
+
{/if}
|
|
216
|
+
|
|
217
|
+
<!-- quadrant captions -->
|
|
218
|
+
{#each corners as c}
|
|
219
|
+
<text class="quadrant" x={c.x} y={c.y} text-anchor={c.anchor}>{c.text}</text>
|
|
220
|
+
{/each}
|
|
221
|
+
|
|
222
|
+
<!-- points -->
|
|
223
|
+
{#each marks as m}
|
|
224
|
+
<circle
|
|
225
|
+
class="point"
|
|
226
|
+
cx={m.cx}
|
|
227
|
+
cy={m.cy}
|
|
228
|
+
r={m.r}
|
|
229
|
+
style="fill:{m.color}"
|
|
230
|
+
tabindex="0"
|
|
231
|
+
role="button"
|
|
232
|
+
aria-label={datumLabel(m.label, m.x, m.y)}
|
|
233
|
+
onfocus={() => show(m.label, m.x, m.y, m.cx, m.cy)}
|
|
234
|
+
onblur={hide}
|
|
235
|
+
onmouseenter={() => show(m.label, m.x, m.y, m.cx, m.cy)}
|
|
236
|
+
onmouseleave={hide}
|
|
237
|
+
/>
|
|
238
|
+
{#if showLabels}
|
|
239
|
+
<text class="point-label" x={m.cx + m.r + 4} y={m.cy} dy="0.32em">{m.label}</text>
|
|
240
|
+
{/if}
|
|
241
|
+
{/each}
|
|
242
|
+
|
|
243
|
+
<!-- axis captions -->
|
|
244
|
+
{#if xLabel}
|
|
245
|
+
<text class="axis-label x" x={innerW / 2} y={innerH + 32} text-anchor="middle"
|
|
246
|
+
>{xLabel}</text
|
|
247
|
+
>
|
|
248
|
+
{/if}
|
|
249
|
+
{#if yLabel}
|
|
250
|
+
<text
|
|
251
|
+
class="axis-label y"
|
|
252
|
+
transform="translate({-M.left + 12},{innerH / 2}) rotate(-90)"
|
|
253
|
+
text-anchor="middle">{yLabel}</text
|
|
254
|
+
>
|
|
255
|
+
{/if}
|
|
256
|
+
</g>
|
|
257
|
+
</svg>
|
|
258
|
+
|
|
259
|
+
{#if tooltip && active}
|
|
260
|
+
<div
|
|
261
|
+
class="tooltip"
|
|
262
|
+
role="status"
|
|
263
|
+
style="left:{((active.cx + M.left) / width) * 100}%;top:{((active.cy + M.top) / height) *
|
|
264
|
+
100}%"
|
|
265
|
+
>
|
|
266
|
+
<span class="t-label">{active.label}</span>
|
|
267
|
+
<span class="t-val">{fmtX(active.x)} · {fmtY(active.y)}</span>
|
|
268
|
+
</div>
|
|
269
|
+
{/if}
|
|
270
|
+
</div>
|
|
271
|
+
{/if}
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
<style>.ss-scatter {
|
|
275
|
+
display: inline-flex;
|
|
276
|
+
flex-direction: column;
|
|
277
|
+
gap: var(--ss-gap-sm);
|
|
278
|
+
font-family: var(--ss-font-body);
|
|
279
|
+
color: var(--ss-fg);
|
|
280
|
+
max-width: 100%;
|
|
281
|
+
}
|
|
282
|
+
.ss-scatter.fluid {
|
|
283
|
+
display: flex;
|
|
284
|
+
width: 100%;
|
|
285
|
+
}
|
|
286
|
+
.ss-scatter .plot {
|
|
287
|
+
position: relative;
|
|
288
|
+
width: 100%;
|
|
289
|
+
}
|
|
290
|
+
.ss-scatter .canvas {
|
|
291
|
+
display: block;
|
|
292
|
+
max-width: 100%;
|
|
293
|
+
height: auto;
|
|
294
|
+
overflow: visible;
|
|
295
|
+
}
|
|
296
|
+
.ss-scatter.fluid .canvas {
|
|
297
|
+
width: 100%;
|
|
298
|
+
}
|
|
299
|
+
.ss-scatter .empty {
|
|
300
|
+
align-self: center;
|
|
301
|
+
margin: auto;
|
|
302
|
+
padding: var(--ss-gap-sm);
|
|
303
|
+
color: var(--ss-fg-muted);
|
|
304
|
+
font-family: var(--ss-font-mono);
|
|
305
|
+
line-height: 1;
|
|
306
|
+
min-height: var(--ss-chart-h, 240px);
|
|
307
|
+
display: flex;
|
|
308
|
+
align-items: center;
|
|
309
|
+
}
|
|
310
|
+
.ss-scatter .sr-only {
|
|
311
|
+
position: absolute;
|
|
312
|
+
width: 1px;
|
|
313
|
+
height: 1px;
|
|
314
|
+
padding: 0;
|
|
315
|
+
margin: -1px;
|
|
316
|
+
overflow: hidden;
|
|
317
|
+
clip: rect(0, 0, 0, 0);
|
|
318
|
+
white-space: nowrap;
|
|
319
|
+
border: 0;
|
|
320
|
+
}
|
|
321
|
+
.ss-scatter .grid {
|
|
322
|
+
stroke: var(--ss-line);
|
|
323
|
+
stroke-width: 1;
|
|
324
|
+
opacity: 0.5;
|
|
325
|
+
shape-rendering: crispEdges;
|
|
326
|
+
}
|
|
327
|
+
.ss-scatter .axis {
|
|
328
|
+
stroke: var(--ss-line);
|
|
329
|
+
stroke-width: 1;
|
|
330
|
+
shape-rendering: crispEdges;
|
|
331
|
+
}
|
|
332
|
+
.ss-scatter .ref {
|
|
333
|
+
stroke: var(--ss-line-strong);
|
|
334
|
+
stroke-width: 1;
|
|
335
|
+
stroke-dasharray: 3 3;
|
|
336
|
+
shape-rendering: crispEdges;
|
|
337
|
+
}
|
|
338
|
+
.ss-scatter .tick {
|
|
339
|
+
font-family: var(--ss-font-mono);
|
|
340
|
+
font-size: var(--ss-ui-xs);
|
|
341
|
+
fill: var(--ss-fg-muted);
|
|
342
|
+
}
|
|
343
|
+
.ss-scatter .quadrant {
|
|
344
|
+
font-family: var(--ss-font-mono);
|
|
345
|
+
font-size: var(--ss-ui-xs);
|
|
346
|
+
fill: var(--ss-fg-muted);
|
|
347
|
+
opacity: 0.75;
|
|
348
|
+
}
|
|
349
|
+
.ss-scatter .axis-label {
|
|
350
|
+
font-family: var(--ss-font-mono);
|
|
351
|
+
font-size: var(--ss-ui-xs);
|
|
352
|
+
fill: var(--ss-fg-muted);
|
|
353
|
+
}
|
|
354
|
+
.ss-scatter .point {
|
|
355
|
+
cursor: pointer;
|
|
356
|
+
fill-opacity: 0.85;
|
|
357
|
+
transition: fill-opacity var(--ss-dur-fast) var(--ss-ease);
|
|
358
|
+
}
|
|
359
|
+
.ss-scatter .point:hover {
|
|
360
|
+
fill-opacity: 1;
|
|
361
|
+
}
|
|
362
|
+
.ss-scatter .point:focus-visible {
|
|
363
|
+
outline: none;
|
|
364
|
+
stroke: var(--ss-fg);
|
|
365
|
+
stroke-width: 2;
|
|
366
|
+
}
|
|
367
|
+
.ss-scatter .point-label {
|
|
368
|
+
font-family: var(--ss-font-mono);
|
|
369
|
+
font-size: var(--ss-ui-xs);
|
|
370
|
+
fill: var(--ss-fg);
|
|
371
|
+
pointer-events: none;
|
|
372
|
+
}
|
|
373
|
+
.ss-scatter .tooltip {
|
|
374
|
+
position: absolute;
|
|
375
|
+
transform: translate(-50%, calc(-100% - 8px));
|
|
376
|
+
pointer-events: none;
|
|
377
|
+
background: var(--ss-bg-elev);
|
|
378
|
+
border: 1px solid var(--ss-line-strong);
|
|
379
|
+
padding: var(--ss-gap-sm);
|
|
380
|
+
font-size: var(--ss-ui-xs);
|
|
381
|
+
line-height: 1.3;
|
|
382
|
+
white-space: nowrap;
|
|
383
|
+
display: flex;
|
|
384
|
+
flex-direction: column;
|
|
385
|
+
gap: 2px;
|
|
386
|
+
z-index: 2;
|
|
387
|
+
}
|
|
388
|
+
.ss-scatter .tooltip .t-label {
|
|
389
|
+
font-family: var(--ss-font-mono);
|
|
390
|
+
color: var(--ss-fg);
|
|
391
|
+
}
|
|
392
|
+
.ss-scatter .tooltip .t-val {
|
|
393
|
+
font-family: var(--ss-font-mono);
|
|
394
|
+
color: var(--ss-fg-muted);
|
|
395
|
+
}</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface ScatterPoint {
|
|
2
|
+
/** Label shown next to the dot and in the tooltip / accessible name. */
|
|
3
|
+
label: string;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
/** Optional magnitude → bubble area (sqrt-scaled radius). Omit for a fixed dot. */
|
|
7
|
+
size?: number;
|
|
8
|
+
/** Optional per-point colour; falls back to the cycling palette. */
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
import { type Size } from '../config.js';
|
|
12
|
+
interface Props {
|
|
13
|
+
/** One dot per datum. Two encoded axes (x, y), optional `size` and `color`. */
|
|
14
|
+
points: ScatterPoint[];
|
|
15
|
+
/** X axis caption (drawn under the axis). */
|
|
16
|
+
xLabel?: string;
|
|
17
|
+
/** Y axis caption (drawn rotated beside the axis). */
|
|
18
|
+
yLabel?: string;
|
|
19
|
+
/** Draw a dashed vertical reference line at this x (e.g. the median) → quadrants. */
|
|
20
|
+
xRef?: number;
|
|
21
|
+
/** Draw a dashed horizontal reference line at this y (e.g. the median) → quadrants. */
|
|
22
|
+
yRef?: number;
|
|
23
|
+
/** Corner captions for the four quadrants (needs xRef + yRef to read well). */
|
|
24
|
+
quadrantLabels?: {
|
|
25
|
+
tl?: string;
|
|
26
|
+
tr?: string;
|
|
27
|
+
bl?: string;
|
|
28
|
+
br?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Force the x domain; defaults to the padded data extent. */
|
|
31
|
+
xDomain?: [number, number];
|
|
32
|
+
/** Force the y domain; defaults to the padded data extent. */
|
|
33
|
+
yDomain?: [number, number];
|
|
34
|
+
/** Format an x value for ticks + tooltip. */
|
|
35
|
+
xFormat?: (x: number) => string;
|
|
36
|
+
/** Format a y value for ticks + tooltip. */
|
|
37
|
+
yFormat?: (y: number) => string;
|
|
38
|
+
/** Draw each point's label next to its dot. Default true. */
|
|
39
|
+
showLabels?: boolean;
|
|
40
|
+
/** Intrinsic drawing height in px. Default 320. */
|
|
41
|
+
height?: number;
|
|
42
|
+
/** Intrinsic drawing width in px. Default 420. */
|
|
43
|
+
width?: number;
|
|
44
|
+
/** Stretch to the container width via the viewBox (width:100%). */
|
|
45
|
+
fluid?: boolean;
|
|
46
|
+
/** Reveal a tooltip on hover/focus of a point. Default true. */
|
|
47
|
+
tooltip?: boolean;
|
|
48
|
+
/** SR summary + accessible name; auto-generated when absent. */
|
|
49
|
+
summary?: string;
|
|
50
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
51
|
+
size?: Size;
|
|
52
|
+
}
|
|
53
|
+
declare const ScatterPlot: import("svelte").Component<Props, {}, "">;
|
|
54
|
+
type ScatterPlot = ReturnType<typeof ScatterPlot>;
|
|
55
|
+
export default ScatterPlot;
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
}
|
|
162
162
|
.ss-select.invalid .control:focus-within {
|
|
163
163
|
border-color: var(--ss-red);
|
|
164
|
-
box-shadow: 0 0 0 3px
|
|
164
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--ss-danger) 22%, transparent);
|
|
165
165
|
}
|
|
166
166
|
.ss-select.disabled .control {
|
|
167
167
|
border-color: var(--ss-line);
|
|
@@ -56,6 +56,17 @@
|
|
|
56
56
|
status === 'deg' ? 'degraded' : status === 'maint' ? 'maintenance' : status,
|
|
57
57
|
)
|
|
58
58
|
|
|
59
|
+
// Map the service status onto a Badge semantic tone (DS-0119).
|
|
60
|
+
const badgeTone = $derived(
|
|
61
|
+
status === 'deg'
|
|
62
|
+
? 'caution'
|
|
63
|
+
: status === 'down'
|
|
64
|
+
? 'critical'
|
|
65
|
+
: status === 'maint'
|
|
66
|
+
? 'brand'
|
|
67
|
+
: 'positive',
|
|
68
|
+
)
|
|
69
|
+
|
|
59
70
|
// Status is decorative on the dot/badge, but meaningful — fold it into the label.
|
|
60
71
|
const cardLabel = $derived(`${name}, ${statusLabel}`)
|
|
61
72
|
|
|
@@ -99,7 +110,7 @@
|
|
|
99
110
|
{#if loading}
|
|
100
111
|
<div class="sk sk-badge" aria-hidden="true"></div>
|
|
101
112
|
{:else}
|
|
102
|
-
<Badge tone={
|
|
113
|
+
<Badge tone={badgeTone}>{statusLabel}</Badge>
|
|
103
114
|
<div class="latency">{latency}</div>
|
|
104
115
|
{/if}
|
|
105
116
|
</div>
|
|
@@ -285,7 +296,7 @@ a.ss-svc:focus-visible,
|
|
|
285
296
|
|
|
286
297
|
.sk-badge {
|
|
287
298
|
width: 64px;
|
|
288
|
-
height: calc(var(--ss-ui-xs) + var(--ss-
|
|
299
|
+
height: calc(var(--ss-ui-xs) + var(--ss-chip-py) * 2);
|
|
289
300
|
}
|
|
290
301
|
|
|
291
302
|
.sk-spark {
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
}
|
|
381
381
|
.ss-side .item.active {
|
|
382
382
|
color: var(--ss-fg);
|
|
383
|
-
background:
|
|
383
|
+
background: color-mix(in srgb, var(--ss-accent) 6%, transparent);
|
|
384
384
|
border-left-color: var(--ss-primary);
|
|
385
385
|
}
|
|
386
386
|
.ss-side .item .label {
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
+
import { type SpinnerVariant as SpinnerVariantName } from '../dssoca.config.js'
|
|
3
|
+
|
|
4
|
+
// Surfaced for backward compatibility (consumers importing from this component
|
|
5
|
+
// path); the source of truth is `dssoca.config.ts` (DS-0108). The const is a
|
|
6
|
+
// plain re-export; the type is aliased so it doesn't collide with the import.
|
|
7
|
+
export { SPINNER_VARIANT_NAMES } from '../dssoca.config.js'
|
|
8
|
+
export type SpinnerVariant = SpinnerVariantName
|
|
9
|
+
|
|
2
10
|
/**
|
|
3
11
|
* Text-frame spinner variants. Frames + intervals are embedded verbatim from
|
|
4
12
|
* sindresorhus/cli-spinners (MIT — https://github.com/sindresorhus/cli-spinners),
|
|
5
13
|
* curated for the squared/blocky glyphs that fit the DS's zero-radius look.
|
|
6
14
|
* No runtime fetch, no dependency — just data.
|
|
15
|
+
*
|
|
16
|
+
* The *variant names* are owned by `dssoca.config.ts` (`SpinnerVariant`,
|
|
17
|
+
* derived from the `spinner` manifest axis — DS-0108); this object holds the
|
|
18
|
+
* frame data and is pinned to that union via `satisfies Record<SpinnerVariant,
|
|
19
|
+
* …>`, so the two cannot drift.
|
|
7
20
|
*/
|
|
8
21
|
export interface SpinnerFrames {
|
|
9
22
|
/** Milliseconds between frames (cli-spinners' recommended cadence). */
|
|
@@ -26,19 +39,19 @@
|
|
|
26
39
|
interval: 120,
|
|
27
40
|
frames: ['▏', '▎', '▍', '▌', '▋', '▊', '▉', '▊', '▋', '▌', '▍', '▎'],
|
|
28
41
|
},
|
|
29
|
-
} as const satisfies Record<
|
|
30
|
-
|
|
31
|
-
export type SpinnerVariant = keyof typeof SPINNER_VARIANTS
|
|
32
|
-
|
|
33
|
-
export const SPINNER_VARIANT_NAMES = Object.keys(SPINNER_VARIANTS) as SpinnerVariant[]
|
|
42
|
+
} as const satisfies Record<SpinnerVariantName, SpinnerFrames>
|
|
34
43
|
</script>
|
|
35
44
|
|
|
36
45
|
<script lang="ts">
|
|
37
|
-
import { resolveComponentSize, type Size } from '../config.js'
|
|
46
|
+
import { resolveComponentSize, resolveSpinnerVariant, type Size } from '../config.js'
|
|
38
47
|
|
|
39
48
|
interface Props {
|
|
40
|
-
/**
|
|
41
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Which frame set to animate (curated from cli-spinners, MIT). When unset,
|
|
51
|
+
* falls back to the configured global default (`spinnerVariant`, default
|
|
52
|
+
* `boxBounce2`); an explicit value here always wins (DS-0108).
|
|
53
|
+
*/
|
|
54
|
+
variant?: SpinnerVariantName
|
|
42
55
|
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
43
56
|
size?: Size
|
|
44
57
|
/** Accessible name announced via role="status". */
|
|
@@ -50,19 +63,13 @@
|
|
|
50
63
|
/** Any remaining native attributes are forwarded to the root span. */
|
|
51
64
|
[key: string]: unknown
|
|
52
65
|
}
|
|
53
|
-
let {
|
|
54
|
-
variant = 'boxBounce2',
|
|
55
|
-
size,
|
|
56
|
-
label = 'Loading',
|
|
57
|
-
showLabel = false,
|
|
58
|
-
speed,
|
|
59
|
-
...rest
|
|
60
|
-
}: Props = $props()
|
|
66
|
+
let { variant, size, label = 'Loading', showLabel = false, speed, ...rest }: Props = $props()
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
// An explicit `variant` prop wins; otherwise fall back to the configured
|
|
69
|
+
// house default (`spinnerVariant`, from the manifest) — DS-0108.
|
|
70
|
+
const resolvedVariant = $derived(resolveSpinnerVariant(variant))
|
|
71
|
+
const spinner = $derived(SPINNER_VARIANTS[resolvedVariant])
|
|
63
72
|
const interval = $derived(speed ?? spinner.interval)
|
|
64
|
-
// 'Spinner' is not in the ComponentName union yet (manifest is owned by the
|
|
65
|
-
// integration step) — cast until dssoca.config.ts registers it.
|
|
66
73
|
const resolvedSize = $derived(resolveComponentSize('Spinner', size))
|
|
67
74
|
|
|
68
75
|
// Under prefers-reduced-motion the first frame renders statically — no cycling.
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { type SpinnerVariant as SpinnerVariantName } from '../dssoca.config.js';
|
|
2
|
+
export { SPINNER_VARIANT_NAMES } from '../dssoca.config.js';
|
|
3
|
+
export type SpinnerVariant = SpinnerVariantName;
|
|
1
4
|
/**
|
|
2
5
|
* Text-frame spinner variants. Frames + intervals are embedded verbatim from
|
|
3
6
|
* sindresorhus/cli-spinners (MIT — https://github.com/sindresorhus/cli-spinners),
|
|
4
7
|
* curated for the squared/blocky glyphs that fit the DS's zero-radius look.
|
|
5
8
|
* No runtime fetch, no dependency — just data.
|
|
9
|
+
*
|
|
10
|
+
* The *variant names* are owned by `dssoca.config.ts` (`SpinnerVariant`,
|
|
11
|
+
* derived from the `spinner` manifest axis — DS-0108); this object holds the
|
|
12
|
+
* frame data and is pinned to that union via `satisfies Record<SpinnerVariant,
|
|
13
|
+
* …>`, so the two cannot drift.
|
|
6
14
|
*/
|
|
7
15
|
export interface SpinnerFrames {
|
|
8
16
|
/** Milliseconds between frames (cli-spinners' recommended cadence). */
|
|
@@ -52,12 +60,14 @@ export declare const SPINNER_VARIANTS: {
|
|
|
52
60
|
readonly frames: readonly ["▏", "▎", "▍", "▌", "▋", "▊", "▉", "▊", "▋", "▌", "▍", "▎"];
|
|
53
61
|
};
|
|
54
62
|
};
|
|
55
|
-
export type SpinnerVariant = keyof typeof SPINNER_VARIANTS;
|
|
56
|
-
export declare const SPINNER_VARIANT_NAMES: SpinnerVariant[];
|
|
57
63
|
import { type Size } from '../config.js';
|
|
58
64
|
interface Props {
|
|
59
|
-
/**
|
|
60
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Which frame set to animate (curated from cli-spinners, MIT). When unset,
|
|
67
|
+
* falls back to the configured global default (`spinnerVariant`, default
|
|
68
|
+
* `boxBounce2`); an explicit value here always wins (DS-0108).
|
|
69
|
+
*/
|
|
70
|
+
variant?: SpinnerVariantName;
|
|
61
71
|
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
62
72
|
size?: Size;
|
|
63
73
|
/** Accessible name announced via role="status". */
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
.ss-textarea.invalid .control:focus-within {
|
|
160
160
|
border-color: var(--ss-red);
|
|
161
|
-
box-shadow: 0 0 0 3px
|
|
161
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--ss-danger) 22%, transparent);
|
|
162
162
|
}
|
|
163
163
|
.ss-textarea.disabled .control {
|
|
164
164
|
border-color: var(--ss-line);
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
left: var(--ss-s-1);
|
|
294
294
|
top: var(--ss-s-1);
|
|
295
295
|
z-index: 20;
|
|
296
|
-
padding: var(--ss-
|
|
296
|
+
padding: var(--ss-chip-py) var(--ss-badge-px);
|
|
297
297
|
background: var(--ss-primary);
|
|
298
298
|
color: var(--ss-fg-on-primary);
|
|
299
299
|
font: 500 var(--ss-ui-md) var(--ss-font-mono);
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
}
|
|
384
384
|
.ss-topbar .ws .tab.active {
|
|
385
385
|
color: var(--ss-fg);
|
|
386
|
-
background:
|
|
386
|
+
background: color-mix(in srgb, var(--ss-accent) 6%, transparent);
|
|
387
387
|
box-shadow: inset 0 -2px 0 var(--ss-primary);
|
|
388
388
|
}
|
|
389
389
|
.ss-topbar .ws .tab.active .n {
|