dssoca 0.2.0 → 0.8.2
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 +54 -18
- package/dist/components/Accordion.svelte +281 -0
- package/dist/components/Accordion.svelte.d.ts +47 -0
- package/dist/components/Badge.svelte +144 -7
- package/dist/components/Badge.svelte.d.ts +31 -2
- package/dist/components/BottomNav.svelte +216 -0
- package/dist/components/BottomNav.svelte.d.ts +30 -0
- package/dist/components/Button.svelte +187 -6
- package/dist/components/Button.svelte.d.ts +24 -4
- package/dist/components/Card.svelte +203 -8
- package/dist/components/Card.svelte.d.ts +21 -1
- package/dist/components/EmptyState.svelte +123 -36
- package/dist/components/EmptyState.svelte.d.ts +17 -1
- package/dist/components/Icon.svelte +191 -12
- package/dist/components/Icon.svelte.d.ts +69 -2
- package/dist/components/Image.svelte +430 -0
- package/dist/components/Image.svelte.d.ts +49 -0
- package/dist/components/Input.svelte +206 -18
- package/dist/components/Input.svelte.d.ts +29 -0
- package/dist/components/Link.svelte +148 -0
- package/dist/components/Link.svelte.d.ts +22 -0
- package/dist/components/LogStream.svelte +403 -21
- package/dist/components/LogStream.svelte.d.ts +37 -6
- package/dist/components/Menu.svelte +355 -0
- package/dist/components/Menu.svelte.d.ts +46 -0
- package/dist/components/MetricTile.svelte +161 -7
- package/dist/components/MetricTile.svelte.d.ts +23 -0
- package/dist/components/SegmentedControl.svelte +208 -0
- package/dist/components/SegmentedControl.svelte.d.ts +30 -0
- package/dist/components/ServiceCard.svelte +270 -9
- package/dist/components/ServiceCard.svelte.d.ts +16 -1
- package/dist/components/Sidebar.svelte +391 -25
- package/dist/components/Sidebar.svelte.d.ts +20 -6
- package/dist/components/Sparkline.svelte +213 -6
- package/dist/components/Sparkline.svelte.d.ts +24 -0
- package/dist/components/Toaster.svelte +273 -60
- package/dist/components/Toaster.svelte.d.ts +9 -16
- package/dist/components/Topbar.svelte +273 -17
- package/dist/components/Topbar.svelte.d.ts +23 -0
- package/dist/config.d.ts +32 -14
- package/dist/config.js +43 -17
- package/dist/dssoca.config.d.ts +50 -0
- package/dist/dssoca.config.js +45 -0
- package/dist/index.d.ts +12 -5
- package/dist/index.js +14 -4
- package/dist/theme.css +587 -382
- package/dist/toast.svelte.d.ts +49 -5
- package/dist/toast.svelte.js +165 -9
- package/package.json +17 -3
- package/dist/components/PassocaMark.svelte +0 -15
- package/dist/components/PassocaMark.svelte.d.ts +0 -7
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
import { type Size } from '../config.js';
|
|
2
|
+
type Trend = 'auto' | 'up' | 'down' | 'flat' | 'none';
|
|
3
|
+
type Variant = 'bars' | 'line' | 'area';
|
|
1
4
|
interface Props {
|
|
2
5
|
data: number[];
|
|
6
|
+
/** Bar/line fill. Ignored when `trend` resolves to a non-`none` direction. */
|
|
3
7
|
color?: string;
|
|
8
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
9
|
+
size?: Size;
|
|
10
|
+
/** Accessible label; overrides the auto-generated summary as the accessible name. */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Lower bound of the scale. Defaults to the data min — set to fix the scale across rows. */
|
|
13
|
+
min?: number;
|
|
14
|
+
/** Upper bound of the scale. Defaults to the data max — set to fix the scale across rows. */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** Colour by direction. `auto` derives first-vs-last → success/danger/muted. Default `none`. */
|
|
17
|
+
trend?: Trend;
|
|
18
|
+
/** Rendering style. Default `bars`. */
|
|
19
|
+
variant?: Variant;
|
|
20
|
+
/** Flex the chart to fill its container width (table-cell friendly). */
|
|
21
|
+
fluid?: boolean;
|
|
22
|
+
/** Explicit CSS width (e.g. `'120px'`, `'100%'`). Overrides the intrinsic width. */
|
|
23
|
+
width?: string;
|
|
24
|
+
/** Format a value for the screen-reader summary (e.g. `v => v + '%'`). */
|
|
25
|
+
valueFormat?: (v: number) => string;
|
|
26
|
+
/** Replace the auto-generated screen-reader summary entirely. */
|
|
27
|
+
summary?: string;
|
|
4
28
|
}
|
|
5
29
|
declare const Sparkline: import("svelte").Component<Props, {}, "">;
|
|
6
30
|
type Sparkline = ReturnType<typeof Sparkline>;
|
|
@@ -1,72 +1,285 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fly } from 'svelte/transition'
|
|
3
|
-
import {
|
|
3
|
+
import { prefersReducedMotion } from 'svelte/motion'
|
|
4
|
+
import { toasts, type Toast, type ToastKind } from '../toast.svelte.js'
|
|
5
|
+
import { resolveComponentSize, type Size } from '../config.js'
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
type Position =
|
|
8
|
+
| 'top-right'
|
|
9
|
+
| 'top-left'
|
|
10
|
+
| 'bottom-right'
|
|
11
|
+
| 'bottom-left'
|
|
12
|
+
| 'top-center'
|
|
13
|
+
| 'bottom-center'
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
17
|
+
size?: Size
|
|
18
|
+
/** Where the stack anchors on screen. @default 'top-right' */
|
|
19
|
+
position?: Position
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let { size, position = 'top-right' }: Props = $props()
|
|
23
|
+
|
|
24
|
+
const glyph: Record<ToastKind, string> = { success: '✓', error: '✕', info: 'i', loading: '' }
|
|
25
|
+
// Honor prefers-reduced-motion: collapse the fly transition to an instant swap.
|
|
26
|
+
const reduce = $derived(prefersReducedMotion.current)
|
|
27
|
+
const flyDuration = $derived(reduce ? 0 : 180)
|
|
28
|
+
// Bottom anchors slide in from below; centered ones come straight down/up.
|
|
29
|
+
const flyX = $derived(position.endsWith('center') ? 0 : position.endsWith('left') ? -16 : 16)
|
|
30
|
+
const flyY = $derived(position.endsWith('center') ? (position.startsWith('top') ? -16 : 16) : 0)
|
|
31
|
+
|
|
32
|
+
// ── swipe-to-dismiss ──────────────────────────────────────────────
|
|
33
|
+
let dragId = $state<number | null>(null)
|
|
34
|
+
let dragDx = $state(0)
|
|
35
|
+
let dragStartX = 0
|
|
36
|
+
let dragPointer: number | null = null
|
|
37
|
+
|
|
38
|
+
const SWIPE_THRESHOLD = 64
|
|
39
|
+
|
|
40
|
+
function onPointerDown(e: PointerEvent, t: Toast) {
|
|
41
|
+
if (reduce || e.button !== 0) return
|
|
42
|
+
// Ignore drags that start on the controls (buttons own their clicks).
|
|
43
|
+
if ((e.target as HTMLElement).closest('button')) return
|
|
44
|
+
dragId = t.id
|
|
45
|
+
dragDx = 0
|
|
46
|
+
dragStartX = e.clientX
|
|
47
|
+
dragPointer = e.pointerId
|
|
48
|
+
toasts.pause(t.id)
|
|
49
|
+
;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function onPointerMove(e: PointerEvent, t: Toast) {
|
|
53
|
+
if (dragId !== t.id || e.pointerId !== dragPointer) return
|
|
54
|
+
dragDx = e.clientX - dragStartX
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function endDrag(e: PointerEvent, t: Toast) {
|
|
58
|
+
if (dragId !== t.id || e.pointerId !== dragPointer) return
|
|
59
|
+
const passed = Math.abs(dragDx) >= SWIPE_THRESHOLD
|
|
60
|
+
dragId = null
|
|
61
|
+
dragPointer = null
|
|
62
|
+
if (passed) toasts.dismiss(t.id)
|
|
63
|
+
else {
|
|
64
|
+
dragDx = 0
|
|
65
|
+
toasts.resume(t.id)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function runAction(t: Toast) {
|
|
70
|
+
const keep = t.action?.onClick() === false
|
|
71
|
+
if (!keep) toasts.dismiss(t.id)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function onKeydown(e: KeyboardEvent, t: Toast) {
|
|
75
|
+
if (e.key === 'Escape') {
|
|
76
|
+
e.stopPropagation()
|
|
77
|
+
toasts.dismiss(t.id)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
6
80
|
</script>
|
|
7
81
|
|
|
8
|
-
<div
|
|
82
|
+
<div
|
|
83
|
+
class="ss-toaster"
|
|
84
|
+
aria-label="Notifications"
|
|
85
|
+
data-position={position}
|
|
86
|
+
data-size-variant={resolveComponentSize('Toaster', size)}
|
|
87
|
+
>
|
|
9
88
|
{#each toasts.items as t (t.id)}
|
|
10
|
-
<
|
|
11
|
-
|
|
89
|
+
<div
|
|
90
|
+
class="ss-toast {t.kind}"
|
|
91
|
+
class:dragging={dragId === t.id}
|
|
92
|
+
role={t.kind === 'error' ? 'alert' : 'status'}
|
|
93
|
+
aria-live={t.kind === 'error' ? 'assertive' : 'polite'}
|
|
94
|
+
tabindex="-1"
|
|
95
|
+
style:transform={dragId === t.id ? `translateX(${dragDx}px)` : undefined}
|
|
96
|
+
style:opacity={dragId === t.id
|
|
97
|
+
? Math.max(0.3, 1 - Math.abs(dragDx) / 200)
|
|
98
|
+
: undefined}
|
|
99
|
+
transition:fly={{ x: flyX, y: flyY, duration: flyDuration }}
|
|
100
|
+
onpointerenter={() => toasts.pause(t.id)}
|
|
101
|
+
onpointerleave={() => dragId !== t.id && toasts.resume(t.id)}
|
|
102
|
+
onfocusin={() => toasts.pause(t.id)}
|
|
103
|
+
onfocusout={() => toasts.resume(t.id)}
|
|
104
|
+
onpointerdown={(e) => onPointerDown(e, t)}
|
|
105
|
+
onpointermove={(e) => onPointerMove(e, t)}
|
|
106
|
+
onpointerup={(e) => endDrag(e, t)}
|
|
107
|
+
onpointercancel={(e) => endDrag(e, t)}
|
|
108
|
+
onkeydown={(e) => onKeydown(e, t)}
|
|
109
|
+
>
|
|
110
|
+
{#if t.kind === 'loading'}
|
|
111
|
+
<span class="ic spinner" class:still={reduce} aria-hidden="true"></span>
|
|
112
|
+
{:else}
|
|
113
|
+
<span class="ic" aria-hidden="true">{glyph[t.kind]}</span>
|
|
114
|
+
{/if}
|
|
12
115
|
<span class="msg">{t.message}</span>
|
|
13
|
-
|
|
14
|
-
|
|
116
|
+
{#if t.action}
|
|
117
|
+
<button class="action" type="button" onclick={() => runAction(t)}>
|
|
118
|
+
{t.action.label}
|
|
119
|
+
</button>
|
|
120
|
+
{/if}
|
|
121
|
+
<button class="x" type="button" aria-label="Dismiss" onclick={() => toasts.dismiss(t.id)}
|
|
122
|
+
>×</button
|
|
123
|
+
>
|
|
124
|
+
</div>
|
|
15
125
|
{/each}
|
|
16
126
|
</div>
|
|
17
127
|
|
|
18
|
-
<style
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
128
|
+
<style>.ss-toaster {
|
|
129
|
+
position: fixed;
|
|
130
|
+
z-index: 1000;
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: var(--ss-s-2);
|
|
134
|
+
max-width: min(360px, 100vw - var(--ss-s-8));
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
top: var(--ss-s-4);
|
|
137
|
+
right: var(--ss-s-4);
|
|
138
|
+
}
|
|
139
|
+
.ss-toaster[data-position=top-left] {
|
|
140
|
+
right: auto;
|
|
141
|
+
left: var(--ss-s-4);
|
|
142
|
+
}
|
|
143
|
+
.ss-toaster[data-position=bottom-right] {
|
|
144
|
+
top: auto;
|
|
145
|
+
bottom: var(--ss-s-4);
|
|
146
|
+
flex-direction: column-reverse;
|
|
147
|
+
}
|
|
148
|
+
.ss-toaster[data-position=bottom-left] {
|
|
149
|
+
top: auto;
|
|
150
|
+
right: auto;
|
|
151
|
+
bottom: var(--ss-s-4);
|
|
152
|
+
left: var(--ss-s-4);
|
|
153
|
+
flex-direction: column-reverse;
|
|
154
|
+
}
|
|
155
|
+
.ss-toaster[data-position=top-center] {
|
|
156
|
+
right: auto;
|
|
157
|
+
left: 50%;
|
|
158
|
+
transform: translateX(-50%);
|
|
159
|
+
}
|
|
160
|
+
.ss-toaster[data-position=bottom-center] {
|
|
161
|
+
top: auto;
|
|
162
|
+
right: auto;
|
|
163
|
+
bottom: var(--ss-s-4);
|
|
164
|
+
left: 50%;
|
|
165
|
+
transform: translateX(-50%);
|
|
166
|
+
flex-direction: column-reverse;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.ss-toast {
|
|
170
|
+
pointer-events: auto;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
gap: var(--ss-s-3);
|
|
174
|
+
padding: var(--ss-s-3) var(--ss-s-4);
|
|
175
|
+
background: var(--ss-bg-elev);
|
|
176
|
+
border: 1px solid var(--ss-line);
|
|
177
|
+
border-left: 3px solid var(--ss-fg-faint);
|
|
178
|
+
box-shadow: var(--ss-shadow-pop);
|
|
179
|
+
font-family: var(--ss-font-mono);
|
|
180
|
+
font-size: var(--ss-ui-md);
|
|
181
|
+
color: var(--ss-fg);
|
|
182
|
+
touch-action: pan-y;
|
|
183
|
+
outline: none;
|
|
184
|
+
}
|
|
185
|
+
.ss-toast:focus-visible {
|
|
186
|
+
border-color: var(--ss-line-strong);
|
|
187
|
+
box-shadow: var(--ss-shadow-pop), 0 0 0 2px var(--ss-primary);
|
|
188
|
+
}
|
|
189
|
+
.ss-toast:not(.dragging) {
|
|
190
|
+
transition: transform var(--ss-dur-fast) var(--ss-ease);
|
|
191
|
+
}
|
|
192
|
+
.ss-toast.success {
|
|
193
|
+
border-left-color: var(--ss-primary);
|
|
194
|
+
}
|
|
195
|
+
.ss-toast.error {
|
|
196
|
+
border-left-color: var(--ss-red);
|
|
197
|
+
}
|
|
198
|
+
.ss-toast.info {
|
|
199
|
+
border-left-color: var(--ss-cyan);
|
|
200
|
+
}
|
|
201
|
+
.ss-toast.loading {
|
|
202
|
+
border-left-color: var(--ss-fg-faint);
|
|
203
|
+
}
|
|
204
|
+
.ss-toast .ic {
|
|
205
|
+
display: inline-flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
justify-content: center;
|
|
208
|
+
width: var(--ss-toast-ic);
|
|
209
|
+
height: var(--ss-toast-ic);
|
|
210
|
+
font-size: var(--ss-ui-sm);
|
|
211
|
+
color: var(--ss-fg-on-primary);
|
|
212
|
+
flex: none;
|
|
213
|
+
}
|
|
214
|
+
.ss-toast.success .ic {
|
|
215
|
+
background: var(--ss-primary);
|
|
216
|
+
}
|
|
217
|
+
.ss-toast.error .ic {
|
|
218
|
+
background: var(--ss-red);
|
|
219
|
+
}
|
|
220
|
+
.ss-toast.info .ic {
|
|
221
|
+
background: var(--ss-cyan);
|
|
222
|
+
}
|
|
223
|
+
.ss-toast .spinner {
|
|
224
|
+
box-sizing: border-box;
|
|
225
|
+
background: transparent;
|
|
226
|
+
border: 2px solid var(--ss-line-strong);
|
|
227
|
+
border-top-color: var(--ss-cyan);
|
|
228
|
+
animation: ss-toast-spin 0.7s linear infinite;
|
|
229
|
+
}
|
|
230
|
+
.ss-toast .spinner.still {
|
|
231
|
+
animation: none;
|
|
232
|
+
border-color: var(--ss-cyan);
|
|
233
|
+
}
|
|
234
|
+
.ss-toast .msg {
|
|
235
|
+
flex: 1;
|
|
236
|
+
line-height: 1.3;
|
|
237
|
+
}
|
|
238
|
+
.ss-toast .action {
|
|
239
|
+
flex: none;
|
|
240
|
+
background: none;
|
|
241
|
+
border: 1px solid var(--ss-line-strong);
|
|
242
|
+
color: var(--ss-fg);
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
font-family: inherit;
|
|
245
|
+
font-size: var(--ss-ui-sm);
|
|
246
|
+
line-height: 1;
|
|
247
|
+
padding: var(--ss-s-1) var(--ss-s-2);
|
|
248
|
+
}
|
|
249
|
+
.ss-toast .action:hover {
|
|
250
|
+
background: var(--ss-hover);
|
|
251
|
+
border-color: var(--ss-fg-faint);
|
|
252
|
+
}
|
|
253
|
+
.ss-toast .action:focus-visible {
|
|
254
|
+
outline: 2px solid var(--ss-primary);
|
|
255
|
+
outline-offset: 1px;
|
|
256
|
+
}
|
|
257
|
+
.ss-toast .x {
|
|
258
|
+
flex: none;
|
|
259
|
+
background: none;
|
|
260
|
+
border: none;
|
|
261
|
+
color: var(--ss-fg-faint);
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
font-size: var(--ss-size-h3);
|
|
264
|
+
line-height: 1;
|
|
265
|
+
padding: 0;
|
|
266
|
+
}
|
|
267
|
+
.ss-toast .x:hover {
|
|
268
|
+
color: var(--ss-fg);
|
|
269
|
+
}
|
|
270
|
+
.ss-toast .x:focus-visible {
|
|
271
|
+
outline: 2px solid var(--ss-primary);
|
|
272
|
+
outline-offset: 1px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
@keyframes ss-toast-spin {
|
|
276
|
+
to {
|
|
277
|
+
transform: rotate(360deg);
|
|
56
278
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
flex: none;
|
|
63
|
-
background: none;
|
|
64
|
-
border: none;
|
|
65
|
-
color: var(--ss-fg-faint);
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
font-size: var(--ss-size-h3);
|
|
68
|
-
line-height: 1;
|
|
69
|
-
padding: 0;
|
|
279
|
+
}
|
|
280
|
+
@media (prefers-reduced-motion: reduce) {
|
|
281
|
+
.ss-toast .spinner {
|
|
282
|
+
animation: none;
|
|
283
|
+
border-color: var(--ss-cyan);
|
|
70
284
|
}
|
|
71
|
-
|
|
72
|
-
</style>
|
|
285
|
+
}</style>
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
1
|
+
import { type Size } from '../config.js';
|
|
2
|
+
type Position = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Token size (sm|md|lg); inherits the global size when unset. */
|
|
5
|
+
size?: Size;
|
|
6
|
+
/** Where the stack anchors on screen. @default 'top-right' */
|
|
7
|
+
position?: Position;
|
|
13
8
|
}
|
|
14
|
-
declare const Toaster:
|
|
15
|
-
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type Toaster = InstanceType<typeof Toaster>;
|
|
9
|
+
declare const Toaster: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Toaster = ReturnType<typeof Toaster>;
|
|
18
11
|
export default Toaster;
|