dssoca 0.5.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.
Files changed (46) hide show
  1. package/dist/components/Accordion.svelte +281 -0
  2. package/dist/components/Accordion.svelte.d.ts +47 -0
  3. package/dist/components/Badge.svelte +115 -18
  4. package/dist/components/Badge.svelte.d.ts +28 -2
  5. package/dist/components/BottomNav.svelte +216 -0
  6. package/dist/components/BottomNav.svelte.d.ts +30 -0
  7. package/dist/components/Button.svelte +147 -10
  8. package/dist/components/Button.svelte.d.ts +21 -4
  9. package/dist/components/Card.svelte +167 -8
  10. package/dist/components/Card.svelte.d.ts +16 -1
  11. package/dist/components/EmptyState.svelte +85 -9
  12. package/dist/components/EmptyState.svelte.d.ts +14 -3
  13. package/dist/components/Icon.svelte +179 -13
  14. package/dist/components/Icon.svelte.d.ts +63 -2
  15. package/dist/components/Image.svelte +430 -0
  16. package/dist/components/Image.svelte.d.ts +49 -0
  17. package/dist/components/Input.svelte +174 -39
  18. package/dist/components/Input.svelte.d.ts +22 -0
  19. package/dist/components/Link.svelte +148 -0
  20. package/dist/components/Link.svelte.d.ts +22 -0
  21. package/dist/components/LogStream.svelte +378 -37
  22. package/dist/components/LogStream.svelte.d.ts +35 -7
  23. package/dist/components/Menu.svelte +355 -0
  24. package/dist/components/Menu.svelte.d.ts +46 -0
  25. package/dist/components/MetricTile.svelte +124 -12
  26. package/dist/components/MetricTile.svelte.d.ts +20 -0
  27. package/dist/components/SegmentedControl.svelte +208 -0
  28. package/dist/components/SegmentedControl.svelte.d.ts +30 -0
  29. package/dist/components/ServiceCard.svelte +222 -26
  30. package/dist/components/ServiceCard.svelte.d.ts +13 -1
  31. package/dist/components/Sidebar.svelte +340 -29
  32. package/dist/components/Sidebar.svelte.d.ts +18 -7
  33. package/dist/components/Sparkline.svelte +196 -13
  34. package/dist/components/Sparkline.svelte.d.ts +20 -1
  35. package/dist/components/Toaster.svelte +193 -12
  36. package/dist/components/Toaster.svelte.d.ts +3 -0
  37. package/dist/components/Topbar.svelte +152 -21
  38. package/dist/components/Topbar.svelte.d.ts +20 -0
  39. package/dist/dssoca.config.d.ts +1 -1
  40. package/dist/dssoca.config.js +6 -0
  41. package/dist/index.d.ts +10 -3
  42. package/dist/index.js +12 -2
  43. package/dist/theme.css +242 -0
  44. package/dist/toast.svelte.d.ts +49 -5
  45. package/dist/toast.svelte.js +165 -9
  46. package/package.json +1 -1
@@ -1,10 +1,25 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import { type Size } from '../config.js';
3
3
  interface Props {
4
- title?: string;
4
+ /** Heading text, or a Snippet for inline icons/badges in the title. */
5
+ title?: string | Snippet;
6
+ /** Secondary label rendered to the right of the title. */
5
7
  meta?: string;
8
+ /** Muted description rendered under the heading. */
9
+ description?: string;
10
+ /** Header controls (buttons, menus) rendered to the right. */
6
11
  action?: Snippet;
12
+ /** Full-bleed visual rendered above the head (zero side padding). */
13
+ media?: Snippet;
14
+ /** Footer band mirroring the head, rendered only when provided. */
15
+ footer?: Snippet;
7
16
  children: Snippet;
17
+ /** Makes the whole card a primary link to this href. */
18
+ href?: string;
19
+ /** Makes the whole card clickable; pairs with keyboard activation. */
20
+ onclick?: (e: MouseEvent | KeyboardEvent) => void;
21
+ /** Surface style: outlined (default) or elevated (shadow tokens). */
22
+ variant?: 'outlined' | 'elevated';
8
23
  /** Token size (sm|md|lg); inherits the global size when unset. */
9
24
  size?: Size;
10
25
  /** Heading level for the title (aria-level), for correct document outline. */
@@ -3,28 +3,74 @@
3
3
  import { resolveComponentSize, type Size } from '../config.js'
4
4
 
5
5
  interface Props {
6
- variant?: 'empty' | 'error'
6
+ variant?: 'empty' | 'error' | 'no-results'
7
7
  title: string
8
8
  message?: string
9
+ /** Decorative glyph fallback when no `visual` snippet is given. */
9
10
  icon?: string
11
+ /** Visual slot — drop in an <Icon>, illustration or <img>; rendered aria-hidden. */
12
+ visual?: Snippet
10
13
  action?: Snippet
14
+ /** Secondary, lower-emphasis action rendered beside the primary one. */
15
+ secondaryAction?: Snippet
16
+ /** Low-emphasis footer (tertiary links) rendered below everything. */
17
+ footer?: Snippet
11
18
  /** Token size (sm|md|lg); inherits the global size when unset. */
12
19
  size?: Size
13
- /** Heading level for the title (aria-level), for correct document outline. */
14
- headingLevel?: number
20
+ /** Heading level for the title (aria-level). `false` renders a plain <p> with no heading role. */
21
+ headingLevel?: number | false
22
+ /** Compact density — drops padding and shrinks the title for inline/cell use. */
23
+ compact?: boolean
24
+ /** Remove the centered max-width cap and span the container. */
25
+ fullWidth?: boolean
15
26
  }
16
- let { variant = 'empty', title, message, icon, action, size, headingLevel = 2 }: Props = $props()
27
+ let {
28
+ variant = 'empty',
29
+ title,
30
+ message,
31
+ icon,
32
+ visual,
33
+ action,
34
+ secondaryAction,
35
+ footer,
36
+ size,
37
+ headingLevel = 2,
38
+ compact = false,
39
+ fullWidth = false,
40
+ }: Props = $props()
41
+
42
+ // error → assertive alert; everything else announces politely without moving focus (WCAG 4.1.3).
43
+ const role = $derived(
44
+ variant === 'error' ? 'alert' : 'status'
45
+ )
17
46
  </script>
18
47
 
19
48
  <div
20
49
  class="ss-empty {variant}"
50
+ class:compact
51
+ class:full-width={fullWidth}
21
52
  data-size-variant={resolveComponentSize('EmptyState', size)}
22
- role={variant === 'error' ? 'alert' : undefined}
53
+ {role}
54
+ aria-atomic="true"
23
55
  >
24
- {#if icon}<div class="ic" aria-hidden="true">{icon}</div>{/if}
25
- <p class="title" role="heading" aria-level={headingLevel}>{title}</p>
56
+ {#if visual}
57
+ <div class="ic" aria-hidden="true">{@render visual()}</div>
58
+ {:else if icon}
59
+ <div class="ic glyph" aria-hidden="true">{icon}</div>
60
+ {/if}
61
+ {#if headingLevel === false}
62
+ <p class="title">{title}</p>
63
+ {:else}
64
+ <p class="title" role="heading" aria-level={headingLevel}>{title}</p>
65
+ {/if}
26
66
  {#if message}<p class="msg">{message}</p>{/if}
27
- {#if action}<div class="act">{@render action()}</div>{/if}
67
+ {#if action || secondaryAction}
68
+ <div class="act">
69
+ {#if action}{@render action()}{/if}
70
+ {#if secondaryAction}{@render secondaryAction()}{/if}
71
+ </div>
72
+ {/if}
73
+ {#if footer}<div class="foot">{@render footer()}</div>{/if}
28
74
  </div>
29
75
 
30
76
  <style>.ss-empty {
@@ -34,12 +80,19 @@
34
80
  gap: var(--ss-s-3);
35
81
  text-align: center;
36
82
  padding: var(--ss-s-12) var(--ss-s-4);
83
+ max-width: var(--ss-empty-max-w);
84
+ margin-inline: auto;
85
+ }
86
+ .ss-empty.full-width {
87
+ max-width: none;
37
88
  }
38
89
  .ss-empty .ic {
39
- font-size: 40px;
40
90
  line-height: 1;
41
91
  margin-bottom: var(--ss-s-1);
42
92
  }
93
+ .ss-empty .ic.glyph {
94
+ font-size: var(--ss-empty-glyph);
95
+ }
43
96
  .ss-empty .title {
44
97
  margin: 0;
45
98
  font-family: var(--ss-font-display);
@@ -58,4 +111,27 @@
58
111
  }
59
112
  .ss-empty .act {
60
113
  margin-top: var(--ss-s-4);
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ gap: var(--ss-s-3);
118
+ flex-wrap: wrap;
119
+ }
120
+ .ss-empty .foot {
121
+ margin-top: var(--ss-s-2);
122
+ color: var(--ss-fg-faint);
123
+ font-size: var(--ss-ui-sm);
124
+ }
125
+ .ss-empty.compact {
126
+ gap: var(--ss-s-2);
127
+ padding: var(--ss-s-6) var(--ss-s-3);
128
+ }
129
+ .ss-empty.compact .title {
130
+ font-size: var(--ss-size-h3);
131
+ }
132
+ .ss-empty.compact .ic.glyph {
133
+ font-size: var(--ss-empty-glyph-compact);
134
+ }
135
+ .ss-empty.compact .act {
136
+ margin-top: var(--ss-s-3);
61
137
  }</style>
@@ -1,15 +1,26 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import { type Size } from '../config.js';
3
3
  interface Props {
4
- variant?: 'empty' | 'error';
4
+ variant?: 'empty' | 'error' | 'no-results';
5
5
  title: string;
6
6
  message?: string;
7
+ /** Decorative glyph fallback when no `visual` snippet is given. */
7
8
  icon?: string;
9
+ /** Visual slot — drop in an <Icon>, illustration or <img>; rendered aria-hidden. */
10
+ visual?: Snippet;
8
11
  action?: Snippet;
12
+ /** Secondary, lower-emphasis action rendered beside the primary one. */
13
+ secondaryAction?: Snippet;
14
+ /** Low-emphasis footer (tertiary links) rendered below everything. */
15
+ footer?: Snippet;
9
16
  /** Token size (sm|md|lg); inherits the global size when unset. */
10
17
  size?: Size;
11
- /** Heading level for the title (aria-level), for correct document outline. */
12
- headingLevel?: number;
18
+ /** Heading level for the title (aria-level). `false` renders a plain <p> with no heading role. */
19
+ headingLevel?: number | false;
20
+ /** Compact density — drops padding and shrinks the title for inline/cell use. */
21
+ compact?: boolean;
22
+ /** Remove the centered max-width cap and span the container. */
23
+ fullWidth?: boolean;
13
24
  }
14
25
  declare const EmptyState: import("svelte").Component<Props, {}, "">;
15
26
  type EmptyState = ReturnType<typeof EmptyState>;
@@ -1,5 +1,7 @@
1
1
  <script module lang="ts">
2
- export const PATHS: Record<string, string> = {
2
+ /** Curated glyph set. `target`'s centre dot is a filled circle in the *outline*
3
+ * variant — handled by the `variant` switch in markup, not a per-glyph fill hack. */
4
+ const BUILTIN_PATHS = {
3
5
  grid: '<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/>',
4
6
  activity: '<path d="M3 12h4l3-8 4 16 3-8h4"/>',
5
7
  database: '<rect x="3" y="4" width="18" height="16"/><path d="M3 9h18M8 4v5"/>',
@@ -15,45 +17,209 @@
15
17
  check: '<path d="M5 12l4 4L19 6"/>',
16
18
  cup: '<path d="M4 8h12v6a4 4 0 01-4 4H8a4 4 0 01-4-4z"/><path d="M16 10h2a2 2 0 010 4h-2M6 4v2M10 4v2M14 4v2"/>',
17
19
  wallet: '<rect x="3" y="6" width="18" height="14"/><path d="M3 10h18M17 14h2"/>',
18
- target: '<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/>',
20
+ target: '<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.5" class="ss-icon-dot"/>',
21
+ spinner: '<path d="M12 3a9 9 0 1 0 9 9" stroke-linecap="round"/>',
22
+ } as const
23
+
24
+ export type IconName = keyof typeof BUILTIN_PATHS
25
+
26
+ /**
27
+ * The curated built-in glyphs plus any runtime-registered ones.
28
+ * (`PATHS` is kept as the public name for backward compatibility.)
29
+ */
30
+ export const PATHS: Record<string, string> = { ...BUILTIN_PATHS }
31
+
32
+ /**
33
+ * Register (or override) a glyph at runtime so `<Icon name="foo" />` resolves
34
+ * raw SVG inner markup that isn't part of the curated {@link IconName} union.
35
+ * The markup is rendered verbatim inside the icon's `<svg viewBox="0 0 24 24">`.
36
+ *
37
+ * registerIcon('heart', '<path d="M12 21 4 13a5 5 0 0 1 7-7l1 1 1-1a5 5 0 0 1 7 7z"/>')
38
+ * <Icon name={'heart' as IconName} />
39
+ */
40
+ export function registerIcon(name: string, paths: string): void {
41
+ PATHS[name] = paths
19
42
  }
20
43
 
21
- export type IconName = keyof typeof PATHS
44
+ /** Look a glyph up; built-ins first, then runtime registrations. */
45
+ export function resolveIcon(name: string): string | undefined {
46
+ return PATHS[name]
47
+ }
22
48
  </script>
23
49
 
24
50
  <script lang="ts">
25
51
  import { resolveComponentSize, type Size } from '../config.js'
26
52
 
53
+ /** Resolved px for each token size — used to keep absolute stroke optically constant. */
54
+ const SIZE_PX: Record<Size, number> = { sm: 14, md: 16, lg: 20 }
55
+ const DEFAULT_PX = SIZE_PX.md
56
+
27
57
  interface Props {
28
58
  name: IconName
29
59
  /** Token-driven size (sm|md|lg); inherits the active size when unset. */
30
60
  size?: Size
31
61
  /** Explicit pixel size — overrides the token sizing. */
32
62
  px?: number
33
- /** Accessible name; when set the icon is exposed to AT (role="img"). Omit for decorative icons (default: aria-hidden). */
63
+ /**
64
+ * Raw SVG inner markup escape hatch — rendered when `name` is not a known
65
+ * (built-in or runtime-registered) glyph. Lets callers pass one-off icons
66
+ * without registering them globally.
67
+ */
68
+ paths?: string
69
+ /** Accessible name; rendered as a real <title> and wired via aria-labelledby. */
34
70
  title?: string
71
+ /** Extended description, rendered as <desc> and appended to aria-labelledby. */
72
+ desc?: string
73
+ /**
74
+ * Mark the icon purely decorative (aria-hidden, no a11y name). Defaults to
75
+ * true when no `title` is given, false when a `title` is present.
76
+ */
77
+ decorative?: boolean
78
+ /** Spin the glyph (e.g. a loader). Honours prefers-reduced-motion. */
79
+ spin?: boolean
80
+ /** Quarter-turn rotation. */
81
+ rotate?: 0 | 90 | 180 | 270
82
+ /** Mirror the glyph. */
83
+ flip?: 'horizontal' | 'vertical'
84
+ /** outline (stroked, default) | solid (filled with currentColor). */
85
+ variant?: 'outline' | 'solid'
86
+ /** Stroke weight in viewBox units (default 2). */
87
+ strokeWidth?: number
88
+ /** Keep `strokeWidth` optically constant across sizes (recompute from resolved px). */
89
+ absoluteStroke?: boolean
35
90
  class?: string
36
91
  }
37
- let { name, size, px, title, class: cls = '' }: Props = $props()
92
+ let {
93
+ name,
94
+ size,
95
+ px,
96
+ paths,
97
+ title,
98
+ desc,
99
+ decorative,
100
+ spin = false,
101
+ rotate = 0,
102
+ flip,
103
+ variant = 'outline',
104
+ strokeWidth = 2,
105
+ absoluteStroke = false,
106
+ class: cls = '',
107
+ }: Props = $props()
38
108
 
39
109
  const dim = $derived(px != null ? `${px}px` : 'var(--ss-icon)')
110
+
111
+ // Resolve the glyph: explicit `paths` escape hatch → registered/built-in → warn.
112
+ const markup = $derived.by(() => {
113
+ if (paths != null) return paths
114
+ const found = resolveIcon(name)
115
+ if (found != null) return found
116
+ if (typeof console !== 'undefined') {
117
+ console.warn(`[dssoca] Icon: unknown name "${name}" (no registered glyph). Rendering empty; pass \`paths\` or call registerIcon().`)
118
+ }
119
+ return ''
120
+ })
121
+
122
+ // Optically-constant stroke: recompute weight from the resolved px so a
123
+ // 2u stroke at the canonical 24-unit viewBox looks the same at 14/16/20px.
124
+ const resolvedPx = $derived(px != null ? px : SIZE_PX[size ?? 'md'] ?? DEFAULT_PX)
125
+ const stroke = $derived(
126
+ absoluteStroke ? (strokeWidth * 24) / resolvedPx : strokeWidth,
127
+ )
128
+
129
+ const isSolid = $derived(variant === 'solid')
130
+
131
+ // Decorative unless an explicit title (or explicit decorative=false) opts in.
132
+ const isDecorative = $derived(decorative ?? title == null)
133
+
134
+ // Unique ids for <title>/<desc>, wired through aria-labelledby.
135
+ const uid = $props.id()
136
+ const titleId = $derived(title ? `${uid}-t` : undefined)
137
+ const descId = $derived(desc ? `${uid}-d` : undefined)
138
+ const labelledBy = $derived(
139
+ [titleId, descId].filter(Boolean).join(' ') || undefined,
140
+ )
141
+ const labelled = $derived(!isDecorative && labelledBy != null)
142
+
143
+ const esc = (s: string) =>
144
+ s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
145
+
146
+ // <title>/<desc> are folded into the same @html string as the glyph so the
147
+ // SVG carries no Svelte {#if} comment anchors (keeps innerHTML clean for AT
148
+ // and tests). a11y ids still resolve via aria-labelledby above.
149
+ const inner = $derived(
150
+ (title ? `<title id="${titleId}">${esc(title)}</title>` : '') +
151
+ (desc ? `<desc id="${descId}">${esc(desc)}</desc>` : '') +
152
+ markup,
153
+ )
40
154
  </script>
41
155
 
42
156
  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
43
157
  <svg
44
158
  viewBox="0 0 24 24"
45
- fill="none"
46
- stroke="currentColor"
47
- stroke-width="2"
159
+ fill={isSolid ? 'currentColor' : 'none'}
160
+ stroke={isSolid ? 'none' : 'currentColor'}
161
+ stroke-width={stroke}
48
162
  stroke-linecap="square"
49
163
  stroke-linejoin="miter"
50
- class={cls}
164
+ class="ss-icon {cls}"
165
+ class:spin
166
+ class:flip-h={flip === 'horizontal'}
167
+ class:flip-v={flip === 'vertical'}
51
168
  data-size-variant={resolveComponentSize('Icon', size)}
169
+ data-rotate={rotate || undefined}
52
170
  style="width:{dim};height:{dim}"
53
- role={title ? 'img' : undefined}
54
- aria-label={title}
55
- aria-hidden={title ? undefined : 'true'}
171
+ role={labelled ? 'img' : undefined}
172
+ aria-labelledby={labelled ? labelledBy : undefined}
173
+ aria-hidden={isDecorative ? 'true' : undefined}
56
174
  focusable="false"
57
175
  >
58
- {@html PATHS[name] ?? ''}
176
+ {@html inner}
59
177
  </svg>
178
+
179
+ <style>.ss-icon {
180
+ display: inline-block;
181
+ flex: none;
182
+ transform-origin: center;
183
+ }
184
+ .ss-icon :global(.ss-icon-dot) {
185
+ fill: currentColor;
186
+ stroke: none;
187
+ }
188
+
189
+ .ss-icon[data-rotate="90"] {
190
+ transform: rotate(90deg);
191
+ }
192
+
193
+ .ss-icon[data-rotate="180"] {
194
+ transform: rotate(180deg);
195
+ }
196
+
197
+ .ss-icon[data-rotate="270"] {
198
+ transform: rotate(270deg);
199
+ }
200
+
201
+ .ss-icon.flip-h {
202
+ transform: scaleX(-1);
203
+ }
204
+
205
+ .ss-icon.flip-v {
206
+ transform: scaleY(-1);
207
+ }
208
+
209
+ .ss-icon.spin {
210
+ animation: ss-icon-spin var(--ss-icon-spin-dur, 900ms) linear infinite;
211
+ }
212
+
213
+ @keyframes ss-icon-spin {
214
+ from {
215
+ transform: rotate(0deg);
216
+ }
217
+ to {
218
+ transform: rotate(360deg);
219
+ }
220
+ }
221
+ @media (prefers-reduced-motion: reduce) {
222
+ .ss-icon.spin {
223
+ animation: none;
224
+ }
225
+ }</style>
@@ -1,5 +1,41 @@
1
+ /** Curated glyph set. `target`'s centre dot is a filled circle in the *outline*
2
+ * variant — handled by the `variant` switch in markup, not a per-glyph fill hack. */
3
+ declare const BUILTIN_PATHS: {
4
+ readonly grid: "<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\"/>";
5
+ readonly activity: "<path d=\"M3 12h4l3-8 4 16 3-8h4\"/>";
6
+ readonly database: "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\"/><path d=\"M3 9h18M8 4v5\"/>";
7
+ readonly logs: "<path d=\"M4 6h16M4 12h16M4 18h10\"/>";
8
+ readonly terminal: "<rect x=\"3\" y=\"5\" width=\"18\" height=\"14\"/><path d=\"M3 9h18M7 14h4\"/>";
9
+ readonly settings: "<circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1\"/>";
10
+ readonly user: "<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4 21c0-4 4-7 8-7s8 3 8 7\"/>";
11
+ readonly arrow: "<path d=\"M5 12h14M13 5l7 7-7 7\"/>";
12
+ readonly external: "<path d=\"M7 17L17 7M9 7h8v8\"/>";
13
+ readonly film: "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\"/><path d=\"M3 8h4M3 16h4M17 8h4M17 16h4M3 12h18\"/>";
14
+ readonly note: "<rect x=\"4\" y=\"3\" width=\"16\" height=\"18\"/><path d=\"M8 8h8M8 12h8M8 16h6\"/>";
15
+ readonly book: "<path d=\"M6 4h11a1 1 0 011 1v15H7a1 1 0 01-1-1z\"/><path d=\"M17 20a2 2 0 002-2V6a2 2 0 00-2-2\"/><path d=\"M9 8h5\"/>";
16
+ readonly check: "<path d=\"M5 12l4 4L19 6\"/>";
17
+ readonly cup: "<path d=\"M4 8h12v6a4 4 0 01-4 4H8a4 4 0 01-4-4z\"/><path d=\"M16 10h2a2 2 0 010 4h-2M6 4v2M10 4v2M14 4v2\"/>";
18
+ readonly wallet: "<rect x=\"3\" y=\"6\" width=\"18\" height=\"14\"/><path d=\"M3 10h18M17 14h2\"/>";
19
+ readonly target: "<circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"5\"/><circle cx=\"12\" cy=\"12\" r=\"1.5\" class=\"ss-icon-dot\"/>";
20
+ readonly spinner: "<path d=\"M12 3a9 9 0 1 0 9 9\" stroke-linecap=\"round\"/>";
21
+ };
22
+ export type IconName = keyof typeof BUILTIN_PATHS;
23
+ /**
24
+ * The curated built-in glyphs plus any runtime-registered ones.
25
+ * (`PATHS` is kept as the public name for backward compatibility.)
26
+ */
1
27
  export declare const PATHS: Record<string, string>;
2
- export type IconName = keyof typeof PATHS;
28
+ /**
29
+ * Register (or override) a glyph at runtime so `<Icon name="foo" />` resolves
30
+ * raw SVG inner markup that isn't part of the curated {@link IconName} union.
31
+ * The markup is rendered verbatim inside the icon's `<svg viewBox="0 0 24 24">`.
32
+ *
33
+ * registerIcon('heart', '<path d="M12 21 4 13a5 5 0 0 1 7-7l1 1 1-1a5 5 0 0 1 7 7z"/>')
34
+ * <Icon name={'heart' as IconName} />
35
+ */
36
+ export declare function registerIcon(name: string, paths: string): void;
37
+ /** Look a glyph up; built-ins first, then runtime registrations. */
38
+ export declare function resolveIcon(name: string): string | undefined;
3
39
  import { type Size } from '../config.js';
4
40
  interface Props {
5
41
  name: IconName;
@@ -7,8 +43,33 @@ interface Props {
7
43
  size?: Size;
8
44
  /** Explicit pixel size — overrides the token sizing. */
9
45
  px?: number;
10
- /** Accessible name; when set the icon is exposed to AT (role="img"). Omit for decorative icons (default: aria-hidden). */
46
+ /**
47
+ * Raw SVG inner markup escape hatch — rendered when `name` is not a known
48
+ * (built-in or runtime-registered) glyph. Lets callers pass one-off icons
49
+ * without registering them globally.
50
+ */
51
+ paths?: string;
52
+ /** Accessible name; rendered as a real <title> and wired via aria-labelledby. */
11
53
  title?: string;
54
+ /** Extended description, rendered as <desc> and appended to aria-labelledby. */
55
+ desc?: string;
56
+ /**
57
+ * Mark the icon purely decorative (aria-hidden, no a11y name). Defaults to
58
+ * true when no `title` is given, false when a `title` is present.
59
+ */
60
+ decorative?: boolean;
61
+ /** Spin the glyph (e.g. a loader). Honours prefers-reduced-motion. */
62
+ spin?: boolean;
63
+ /** Quarter-turn rotation. */
64
+ rotate?: 0 | 90 | 180 | 270;
65
+ /** Mirror the glyph. */
66
+ flip?: 'horizontal' | 'vertical';
67
+ /** outline (stroked, default) | solid (filled with currentColor). */
68
+ variant?: 'outline' | 'solid';
69
+ /** Stroke weight in viewBox units (default 2). */
70
+ strokeWidth?: number;
71
+ /** Keep `strokeWidth` optically constant across sizes (recompute from resolved px). */
72
+ absoluteStroke?: boolean;
12
73
  class?: string;
13
74
  }
14
75
  declare const Icon: import("svelte").Component<Props, {}, "">;