dssoca 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +39 -13
  2. package/dist/components/Accordion.svelte +22 -6
  3. package/dist/components/Accordion.svelte.d.ts +5 -1
  4. package/dist/components/Badge.svelte +3 -5
  5. package/dist/components/BottomNav.svelte +57 -19
  6. package/dist/components/BottomNav.svelte.d.ts +2 -0
  7. package/dist/components/Card.svelte +7 -1
  8. package/dist/components/Container.svelte +55 -0
  9. package/dist/components/Container.svelte.d.ts +16 -0
  10. package/dist/components/EmptyState.svelte +9 -3
  11. package/dist/components/EmptyState.svelte.d.ts +6 -0
  12. package/dist/components/Heading.svelte +83 -0
  13. package/dist/components/Heading.svelte.d.ts +17 -0
  14. package/dist/components/Icon.svelte +32 -23
  15. package/dist/components/Icon.svelte.d.ts +7 -0
  16. package/dist/components/Image.svelte +19 -21
  17. package/dist/components/Input.svelte +2 -3
  18. package/dist/components/Link.svelte +42 -7
  19. package/dist/components/Link.svelte.d.ts +7 -0
  20. package/dist/components/LogStream.svelte +46 -31
  21. package/dist/components/Menu.svelte +59 -6
  22. package/dist/components/Menu.svelte.d.ts +22 -2
  23. package/dist/components/MetricTile.svelte +4 -4
  24. package/dist/components/SegmentedControl.svelte +16 -4
  25. package/dist/components/SegmentedControl.svelte.d.ts +7 -0
  26. package/dist/components/ServiceCard.svelte +15 -15
  27. package/dist/components/Sidebar.svelte +47 -21
  28. package/dist/components/Sparkline.svelte +15 -13
  29. package/dist/components/Spinner.svelte +124 -0
  30. package/dist/components/Spinner.svelte.d.ts +74 -0
  31. package/dist/components/Textarea.svelte +214 -0
  32. package/dist/components/Textarea.svelte.d.ts +38 -0
  33. package/dist/components/Toaster.svelte +20 -4
  34. package/dist/components/Topbar.svelte +170 -50
  35. package/dist/components/Topbar.svelte.d.ts +30 -3
  36. package/dist/dssoca.config.d.ts +1 -1
  37. package/dist/dssoca.config.js +4 -0
  38. package/dist/index.d.ts +7 -1
  39. package/dist/index.js +7 -1
  40. package/dist/theme.css +177 -37
  41. package/dist/toast.svelte.js +3 -3
  42. package/dist/tokens.css +597 -0
  43. package/package.json +25 -4
package/README.md CHANGED
@@ -7,10 +7,10 @@
7
7
  A Svelte 5 design system — **signal green on near-black, monospace-forward, zero border-radius**
8
8
  everywhere. Configured along two orthogonal axes:
9
9
 
10
- | Axis | Attribute | Values | Default |
11
- |------------|----------------------|--------------------|---------|
12
- | **Color** | `data-theme` | `dark` · `light` | `dark` |
13
- | **Size** | `data-size-variant` | `sm` · `md` · `lg` | `md` |
10
+ | Axis | Attribute | Values | Default |
11
+ | --------- | ------------------- | ------------------ | ------- |
12
+ | **Color** | `data-theme` | `dark` · `light` | `dark` |
13
+ | **Size** | `data-size-variant` | `sm` · `md` · `lg` | `md` |
14
14
 
15
15
  Each component styles itself in a scoped block and consumes token-driven CSS custom properties;
16
16
  flip an axis on any ancestor (usually `<html>`) and everything below rescales/recolors. Components
@@ -44,15 +44,23 @@ Import the stylesheet once (global tokens + base styles), then use components:
44
44
  </Card>
45
45
  ```
46
46
 
47
+ Apps that own their global styles can import **tokens only** — every `--ss-*`
48
+ custom property (both themes, all size tiers, reduced-motion zeroing) with no
49
+ element styles and no webfont loading:
50
+
51
+ ```js
52
+ import 'dssoca/tokens.css'
53
+ ```
54
+
47
55
  ### Configure the axes from code
48
56
 
49
57
  ```ts
50
58
  import { applyDesignConfig, designAttributes } from 'dssoca'
51
59
 
52
60
  // flip axes; merges over current config; writes to <html>
53
- applyDesignConfig({ sizeVariant: 'sm' }) // global: everything small
54
- applyDesignConfig({ theme: 'light' }) // keeps size
55
- applyDesignConfig({ componentsSize: { Button: 'lg' } }) // per-component default
61
+ applyDesignConfig({ sizeVariant: 'sm' }) // global: everything small
62
+ applyDesignConfig({ theme: 'light' }) // keeps size
63
+ applyDesignConfig({ componentsSize: { Button: 'lg' } }) // per-component default
56
64
  ```
57
65
 
58
66
  Per instance, just set the `size` prop: `<Button size="lg">`.
@@ -69,15 +77,24 @@ SSR / no-flash — spread the attributes directly in markup instead of mutating
69
77
 
70
78
  ## What's in the box
71
79
 
72
- **Components:** `Icon`, `Badge`, `Button`, `Input`, `Card`, `Sparkline`,
73
- `ServiceCard`, `MetricTile`, `Topbar`, `Sidebar`, `LogStream`, `Toaster`, `EmptyState`.
80
+ **Components (23):** `Icon`, `Badge`, `Button`, `Input`, `Textarea`, `Card`, `Sparkline`,
81
+ `ServiceCard`, `MetricTile`, `Topbar`, `Sidebar`, `BottomNav`, `Menu`, `Link`,
82
+ `SegmentedControl`, `Accordion`, `LogStream`, `Toaster`, `EmptyState`, `Image`,
83
+ `Heading`, `Container`, `Spinner`.
74
84
 
75
- **Toasts:** `toast` (`.success` / `.error` / `.info`) + the `toasts` store — render once with
76
- `<Toaster />`.
85
+ **Toasts:** `toast` (`.success` / `.error` / `.info` / `.loading` / `.promise`) + the `toasts`
86
+ store (`update` / `dismiss` / `pause` / `resume` / `clear`, `max` cap) — render once with
87
+ `<Toaster />`. Types: `Toast`, `ToastKind`, `ToastAction`, `ToastOptions`, `ToastPatch`,
88
+ `PromiseMessages`.
77
89
 
78
90
  **Config:** `dssocaConfig` (the manifest), `applyDesignConfig`, `designAttributes`,
79
91
  `getDesignConfig`, `resolveComponentSize`, `defaultDesignConfig`, and the `ColorTheme` / `Size` /
80
- `DesignConfig` / `ComponentsSize` types.
92
+ `DesignConfig` / `ComponentsSize` / `DesignAxis` / `ComponentName` / `DssocaConfig` types.
93
+
94
+ **Component types:** `IconName` (+ `registerIcon`), `TopbarTab`, `TopbarServices`, `SideItem` /
95
+ `SideGroup` / `SideStatus`, `LogLevel` / `LogLine`, `MenuItem`, `AccordionItem`,
96
+ `SegmentOption`, `BottomNavItem`, `ImageSource`, and `SpinnerVariant` / `SpinnerFrames`
97
+ (+ `SPINNER_VARIANTS` / `SPINNER_VARIANT_NAMES`).
81
98
 
82
99
  ## Accessibility
83
100
 
@@ -104,7 +121,16 @@ pnpm docs:dev # docs site (run `pnpm storybook` alongside for the live demo
104
121
  pnpm docs:build # static build of the docs site
105
122
  ```
106
123
 
107
- The docs app is local-only and is **not** part of the published npm package.
124
+ The docs app is **not** part of the published npm package.
125
+
126
+ ### Deployment (maintainers)
127
+
128
+ The docs site and Storybook deploy to **Vercel as two projects** from this one repo; the
129
+ repo-root `vercel.json` branches its `buildCommand` on a `VERCEL_DEPLOY_TARGET=storybook` env
130
+ var. The per-component Storybook embeds on the deployed docs default to
131
+ `http://localhost:6006` — set **`VITE_STORYBOOK_URL`** (Vercel env var on the **docs**
132
+ project) to the deployed Storybook URL and redeploy, or the iframes stay blank. Full setup:
133
+ [`documentation/CLAUDE.md`](./documentation/CLAUDE.md) → _Deployment_.
108
134
 
109
135
  ## Develop
110
136
 
@@ -45,10 +45,18 @@
45
45
  size?: Size
46
46
  /** Heading level wrapping each header button (for the document outline). */
47
47
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
48
- /** Base id used to namespace the generated header/panel ids. */
48
+ /**
49
+ * Base id used to namespace the generated header/panel ids. Defaults to a
50
+ * stable per-instance id from `$props.id()` so server- and client-rendered
51
+ * IDs match (SSR-safe, DS-0067).
52
+ */
49
53
  idBase?: string
50
54
  }
51
55
 
56
+ // Stable instance id — consistent between server and client renders, unlike
57
+ // the previous Math.random() default (DS-0067).
58
+ const uid = $props.id()
59
+
52
60
  let {
53
61
  items,
54
62
  panel,
@@ -59,7 +67,7 @@
59
67
  onChange,
60
68
  size,
61
69
  headingLevel = 3,
62
- idBase = `ss-acc-${Math.random().toString(36).slice(2, 8)}`,
70
+ idBase = `ss-acc-${uid}`,
63
71
  }: Props = $props()
64
72
 
65
73
  // --- open-state model ----------------------------------------------------
@@ -116,13 +124,21 @@
116
124
  function onHeaderKeydown(e: KeyboardEvent, index: number) {
117
125
  switch (e.key) {
118
126
  case 'ArrowDown':
119
- e.preventDefault(); focusHeader(index + 1); break
127
+ e.preventDefault()
128
+ focusHeader(index + 1)
129
+ break
120
130
  case 'ArrowUp':
121
- e.preventDefault(); focusHeader(index - 1); break
131
+ e.preventDefault()
132
+ focusHeader(index - 1)
133
+ break
122
134
  case 'Home':
123
- e.preventDefault(); focusHeader(0); break
135
+ e.preventDefault()
136
+ focusHeader(0)
137
+ break
124
138
  case 'End':
125
- e.preventDefault(); focusHeader(items.length - 1); break
139
+ e.preventDefault()
140
+ focusHeader(items.length - 1)
141
+ break
126
142
  // Enter / Space activate the native <button>; no extra handling needed.
127
143
  }
128
144
  }
@@ -39,7 +39,11 @@ interface Props {
39
39
  size?: Size;
40
40
  /** Heading level wrapping each header button (for the document outline). */
41
41
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
42
- /** Base id used to namespace the generated header/panel ids. */
42
+ /**
43
+ * Base id used to namespace the generated header/panel ids. Defaults to a
44
+ * stable per-instance id from `$props.id()` so server- and client-rendered
45
+ * IDs match (SSR-safe, DS-0067).
46
+ */
43
47
  idBase?: string;
44
48
  }
45
49
  declare const Accordion: import("svelte").Component<Props, {}, "value">;
@@ -50,9 +50,7 @@
50
50
 
51
51
  // Numeric badge: clamp to max, hide entirely when zero.
52
52
  const showCount = $derived(count !== undefined && count !== 0)
53
- const countText = $derived(
54
- count === undefined ? '' : count > max ? `${max}+` : `${count}`,
55
- )
53
+ const countText = $derived(count === undefined ? '' : count > max ? `${max}+` : `${count}`)
56
54
 
57
55
  const hasLabel = $derived(children !== undefined)
58
56
  // Dot-only / count-only badges have no visible text → carry an aria-label so
@@ -80,8 +78,8 @@
80
78
  class="x"
81
79
  type="button"
82
80
  aria-label={label ? `Remove ${label}` : 'Remove'}
83
- onclick={ondismiss}
84
- >×</button>
81
+ onclick={ondismiss}>×</button
82
+ >
85
83
  {/if}
86
84
  </span>
87
85
 
@@ -13,6 +13,8 @@
13
13
  href?: string
14
14
  /** Optional count/label rendered as a small square badge on the icon. */
15
15
  badge?: string | number
16
+ /** Renders the tab inert: no navigation/onSelect, `aria-disabled`, out of the tab order. */
17
+ disabled?: boolean
16
18
  }
17
19
  </script>
18
20
 
@@ -34,24 +36,17 @@
34
36
  }
35
37
 
36
38
  const DEFAULT_ITEMS: BottomNavItem[] = [
37
- { id: 'home', label: 'Home', icon: 'grid' },
39
+ { id: 'home', label: 'Home', icon: 'grid' },
38
40
  { id: 'services', label: 'Services', icon: 'database' },
39
41
  { id: 'activity', label: 'Activity', icon: 'activity' },
40
- { id: 'account', label: 'Account', icon: 'user' },
42
+ { id: 'account', label: 'Account', icon: 'user' },
41
43
  ]
42
44
 
43
- let {
44
- items = DEFAULT_ITEMS,
45
- active,
46
- onSelect,
47
- ariaLabel = 'Primary',
48
- size,
49
- }: Props = $props()
45
+ let { items = DEFAULT_ITEMS, active, onSelect, ariaLabel = 'Primary', size }: Props = $props()
50
46
 
51
47
  const isActive = (item: BottomNavItem): boolean => item.id === active
52
48
 
53
- const hasBadge = (item: BottomNavItem): boolean =>
54
- item.badge != null && item.badge !== ''
49
+ const hasBadge = (item: BottomNavItem): boolean => item.badge != null && item.badge !== ''
55
50
 
56
51
  /** Fold the count badge into the accessible name so it isn't lost to AT. */
57
52
  function accessibleName(item: BottomNavItem): string {
@@ -59,6 +54,12 @@
59
54
  }
60
55
 
61
56
  function activate(item: BottomNavItem, e: MouseEvent) {
57
+ // Disabled tabs are inert (DS-0078): no navigation, no onSelect. The
58
+ // <button> branch is natively disabled; this also guards the <a> branch.
59
+ if (item.disabled) {
60
+ e.preventDefault()
61
+ return
62
+ }
62
63
  // Real links navigate natively; intercept only the SPA (no-href) path so a
63
64
  // plain <button> never submits/scrolls. onSelect fires either way.
64
65
  if (!item.href) e.preventDefault()
@@ -73,7 +74,7 @@
73
74
  {#each items as item (item.id)}
74
75
  {@const current = isActive(item)}
75
76
  <li class="row">
76
- {#if item.href}
77
+ {#if item.href && !item.disabled}
77
78
  <a
78
79
  class="tab {current ? 'active' : ''}"
79
80
  href={item.href}
@@ -90,9 +91,15 @@
90
91
  <span class="label">{item.label}</span>
91
92
  </a>
92
93
  {:else}
94
+ <!-- Disabled href tabs also land here (DS-0078): a natively disabled
95
+ <button> is reliably inert + skipped by the tab order, where a
96
+ dead <a> would need tabindex/role juggling. -->
93
97
  <button
94
98
  type="button"
95
99
  class="tab {current ? 'active' : ''}"
100
+ class:disabled={item.disabled}
101
+ disabled={item.disabled || undefined}
102
+ aria-disabled={item.disabled ? 'true' : undefined}
96
103
  aria-current={current ? 'page' : undefined}
97
104
  aria-label={hasBadge(item) ? accessibleName(item) : undefined}
98
105
  onclick={(e) => activate(item, e)}
@@ -117,6 +124,30 @@
117
124
  --_tab-py: var(--ss-bottom-nav-tab-py, var(--ss-s-1, 4px));
118
125
  --_gap: var(--ss-bottom-nav-gap, 4px);
119
126
  --_label-fs: var(--ss-bottom-nav-label-fs, var(--ss-ui-xs, 11px));
127
+ --_badge-top: var(--ss-bottom-nav-badge-top, -6px);
128
+ --_badge-dx: var(--ss-bottom-nav-badge-dx, 6px);
129
+ --_badge-min-w: var(--ss-bottom-nav-badge-min-w, 14px);
130
+ --_badge-h: var(--ss-bottom-nav-badge-h, 14px);
131
+ --_badge-fs: var(--ss-bottom-nav-badge-fs, 9px);
132
+ --_badge-px: var(--ss-bottom-nav-badge-px, 3px);
133
+ }
134
+ .ss-bottom-nav[data-size-variant=sm] {
135
+ --_badge-top: var(--ss-bottom-nav-badge-top, -5px);
136
+ --_badge-dx: var(--ss-bottom-nav-badge-dx, 5px);
137
+ --_badge-min-w: var(--ss-bottom-nav-badge-min-w, 12px);
138
+ --_badge-h: var(--ss-bottom-nav-badge-h, 12px);
139
+ --_badge-fs: var(--ss-bottom-nav-badge-fs, 8px);
140
+ --_badge-px: var(--ss-bottom-nav-badge-px, 2px);
141
+ }
142
+ .ss-bottom-nav[data-size-variant=lg] {
143
+ --_badge-top: var(--ss-bottom-nav-badge-top, -7px);
144
+ --_badge-dx: var(--ss-bottom-nav-badge-dx, 7px);
145
+ --_badge-min-w: var(--ss-bottom-nav-badge-min-w, 16px);
146
+ --_badge-h: var(--ss-bottom-nav-badge-h, 16px);
147
+ --_badge-fs: var(--ss-bottom-nav-badge-fs, 10px);
148
+ --_badge-px: var(--ss-bottom-nav-badge-px, 4px);
149
+ }
150
+ .ss-bottom-nav {
120
151
  position: fixed;
121
152
  left: 0;
122
153
  right: 0;
@@ -174,6 +205,13 @@
174
205
  background: rgba(var(--ss-primary-rgb), 0.06);
175
206
  border-top-color: var(--ss-primary);
176
207
  }
208
+ .ss-bottom-nav .tab:disabled, .ss-bottom-nav .tab.disabled {
209
+ cursor: default;
210
+ opacity: 0.45;
211
+ }
212
+ .ss-bottom-nav .tab:disabled:hover, .ss-bottom-nav .tab.disabled:hover {
213
+ color: var(--ss-fg-faint);
214
+ }
177
215
  .ss-bottom-nav .glyph {
178
216
  position: relative;
179
217
  display: inline-flex;
@@ -183,20 +221,20 @@
183
221
  }
184
222
  .ss-bottom-nav .badge {
185
223
  position: absolute;
186
- top: -6px;
187
- left: calc(50% + 6px);
188
- min-width: 14px;
189
- height: 14px;
190
- padding: 0 3px;
224
+ top: var(--_badge-top);
225
+ left: calc(50% + var(--_badge-dx));
226
+ min-width: var(--_badge-min-w);
227
+ height: var(--_badge-h);
228
+ padding: 0 var(--_badge-px);
191
229
  box-sizing: border-box;
192
230
  display: inline-flex;
193
231
  align-items: center;
194
232
  justify-content: center;
195
233
  font-family: var(--ss-font-mono);
196
- font-size: 9px;
234
+ font-size: var(--_badge-fs);
197
235
  line-height: 1;
198
236
  font-variant-numeric: tabular-nums;
199
- color: var(--ss-fg-on-primary, #001b04);
237
+ color: var(--ss-fg-on-primary);
200
238
  background: var(--ss-primary);
201
239
  border-radius: 0;
202
240
  }
@@ -11,6 +11,8 @@ export interface BottomNavItem {
11
11
  href?: string;
12
12
  /** Optional count/label rendered as a small square badge on the icon. */
13
13
  badge?: string | number;
14
+ /** Renders the tab inert: no navigation/onSelect, `aria-disabled`, out of the tab order. */
15
+ disabled?: boolean;
14
16
  }
15
17
  import { type Size } from '../config.js';
16
18
  interface Props {
@@ -96,7 +96,13 @@
96
96
  <div class="foot">{@render footer()}</div>
97
97
  {/if}
98
98
  {#if href}
99
- <a class="overlay" {href} {onclick} onkeydown={onKeydown} aria-labelledby={title ? titleId : undefined}>
99
+ <a
100
+ class="overlay"
101
+ {href}
102
+ {onclick}
103
+ onkeydown={onKeydown}
104
+ aria-labelledby={title ? titleId : undefined}
105
+ >
100
106
  <span class="sr-only">{typeof title === 'string' ? title : 'Open'}</span>
101
107
  </a>
102
108
  {/if}
@@ -0,0 +1,55 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+ import { resolveComponentSize, type Size } from '../config.js'
4
+
5
+ interface Props {
6
+ /**
7
+ * Page mode — behaves like a route page: fills the viewport height and
8
+ * adds vertical page padding on top of the horizontal gutters.
9
+ */
10
+ page?: boolean
11
+ /** Token size (sm|md|lg); inherits the global size when unset. */
12
+ size?: Size
13
+ /** Page content. */
14
+ children?: Snippet
15
+ }
16
+
17
+ let { page = false, size, children }: Props = $props()
18
+ </script>
19
+
20
+ <!--
21
+ Centered, max-width page-content wrapper (DS-0085) — the DS-owned version of
22
+ the per-site "AppContent" wrappers. Full-bleed at narrow viewports (the
23
+ max-width simply stops binding); gutters stay via the inline padding.
24
+ -->
25
+ <div class="ss-container" class:page data-size-variant={resolveComponentSize('Container', size)}>
26
+ {@render children?.()}
27
+ </div>
28
+
29
+ <style>.ss-container {
30
+ --ss-container-max-w: 875px;
31
+ --ss-container-px: var(--ss-main-px);
32
+ --ss-container-page-py: var(--ss-s-10);
33
+ }
34
+ .ss-container[data-size-variant=sm] {
35
+ --ss-container-max-w: 760px;
36
+ --ss-container-px: var(--ss-s-5);
37
+ --ss-container-page-py: var(--ss-s-8);
38
+ }
39
+ .ss-container[data-size-variant=lg] {
40
+ --ss-container-max-w: 1000px;
41
+ --ss-container-px: var(--ss-s-12);
42
+ --ss-container-page-py: var(--ss-s-12);
43
+ }
44
+ .ss-container {
45
+ box-sizing: border-box;
46
+ width: 100%;
47
+ max-width: var(--ss-container-max-w);
48
+ margin-inline: auto;
49
+ padding-inline: var(--ss-container-px);
50
+ }
51
+ .ss-container.page {
52
+ min-height: 100vh;
53
+ min-height: 100svh;
54
+ padding-block: var(--ss-container-page-py);
55
+ }</style>
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type Size } from '../config.js';
3
+ interface Props {
4
+ /**
5
+ * Page mode — behaves like a route page: fills the viewport height and
6
+ * adds vertical page padding on top of the horizontal gutters.
7
+ */
8
+ page?: boolean;
9
+ /** Token size (sm|md|lg); inherits the global size when unset. */
10
+ size?: Size;
11
+ /** Page content. */
12
+ children?: Snippet;
13
+ }
14
+ declare const Container: import("svelte").Component<Props, {}, "">;
15
+ type Container = ReturnType<typeof Container>;
16
+ export default Container;
@@ -15,6 +15,12 @@
15
15
  secondaryAction?: Snippet
16
16
  /** Low-emphasis footer (tertiary links) rendered below everything. */
17
17
  footer?: Snippet
18
+ /**
19
+ * Accessible name for the live region (DS-0078) — distinguishes multiple
20
+ * status/alert regions on one page. Optional; the visible `title` already
21
+ * provides the content.
22
+ */
23
+ ariaLabel?: string
18
24
  /** Token size (sm|md|lg); inherits the global size when unset. */
19
25
  size?: Size
20
26
  /** Heading level for the title (aria-level). `false` renders a plain <p> with no heading role. */
@@ -33,6 +39,7 @@
33
39
  action,
34
40
  secondaryAction,
35
41
  footer,
42
+ ariaLabel,
36
43
  size,
37
44
  headingLevel = 2,
38
45
  compact = false,
@@ -40,9 +47,7 @@
40
47
  }: Props = $props()
41
48
 
42
49
  // error → assertive alert; everything else announces politely without moving focus (WCAG 4.1.3).
43
- const role = $derived(
44
- variant === 'error' ? 'alert' : 'status'
45
- )
50
+ const role = $derived(variant === 'error' ? 'alert' : 'status')
46
51
  </script>
47
52
 
48
53
  <div
@@ -51,6 +56,7 @@
51
56
  class:full-width={fullWidth}
52
57
  data-size-variant={resolveComponentSize('EmptyState', size)}
53
58
  {role}
59
+ aria-label={ariaLabel}
54
60
  aria-atomic="true"
55
61
  >
56
62
  {#if visual}
@@ -13,6 +13,12 @@ interface Props {
13
13
  secondaryAction?: Snippet;
14
14
  /** Low-emphasis footer (tertiary links) rendered below everything. */
15
15
  footer?: Snippet;
16
+ /**
17
+ * Accessible name for the live region (DS-0078) — distinguishes multiple
18
+ * status/alert regions on one page. Optional; the visible `title` already
19
+ * provides the content.
20
+ */
21
+ ariaLabel?: string;
16
22
  /** Token size (sm|md|lg); inherits the global size when unset. */
17
23
  size?: Size;
18
24
  /** Heading level for the title (aria-level). `false` renders a plain <p> with no heading role. */
@@ -0,0 +1,83 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+ import { resolveComponentSize, type Size } from '../config.js'
4
+
5
+ interface Props {
6
+ /** Heading level (1–6) — picks the rendered element (h1…h6); styling is level-independent. */
7
+ level?: 1 | 2 | 3 | 4 | 5 | 6
8
+ /** Primary accent underline behind the text. On by default. */
9
+ accent?: boolean
10
+ /** Center the heading (text-align). */
11
+ centered?: boolean
12
+ /** Token size (sm|md|lg); inherits the global size when unset. */
13
+ size?: Size
14
+ /** Heading text. */
15
+ children?: Snippet
16
+ }
17
+
18
+ let { level = 1, accent = true, centered = false, size, children }: Props = $props()
19
+
20
+ const tag = $derived(`h${level}`)
21
+ </script>
22
+
23
+ <!--
24
+ Display/page-title heading — the `.hs-display` recipe from theme.css, carried
25
+ in-component so it works without the global stylesheet (DS-0083 / DS-0089).
26
+ The accent underline sits behind the text via a negative-z pseudo-element;
27
+ the bg-colored text-shadow lets the glyphs "cut into" the highlight.
28
+ -->
29
+ <svelte:element
30
+ this={tag}
31
+ class="ss-heading"
32
+ class:accent
33
+ class:centered
34
+ data-size-variant={resolveComponentSize('Heading', size)}
35
+ >
36
+ <span class="txt">{@render children?.()}</span>
37
+ </svelte:element>
38
+
39
+ <style>.ss-heading {
40
+ --ss-heading-size: var(--ss-size-display);
41
+ --ss-heading-mb: var(--ss-s-4);
42
+ --ss-heading-shadow: 3px;
43
+ }
44
+ .ss-heading[data-size-variant=sm] {
45
+ --ss-heading-size: clamp(30px, 6.5vw, 44px);
46
+ --ss-heading-mb: var(--ss-s-3);
47
+ --ss-heading-shadow: 2px;
48
+ }
49
+ .ss-heading[data-size-variant=lg] {
50
+ --ss-heading-size: clamp(44px, 9vw, 64px);
51
+ --ss-heading-mb: var(--ss-s-6);
52
+ --ss-heading-shadow: 4px;
53
+ }
54
+ .ss-heading {
55
+ font-family: var(--ss-font-display);
56
+ font-style: normal;
57
+ font-weight: 400;
58
+ font-size: var(--ss-heading-size);
59
+ line-height: 1.05;
60
+ letter-spacing: -0.015em;
61
+ color: var(--ss-fg);
62
+ margin: 0 0 var(--ss-heading-mb) 0;
63
+ text-shadow: var(--ss-heading-shadow) var(--ss-heading-shadow) var(--ss-bg);
64
+ position: relative;
65
+ z-index: 0;
66
+ }
67
+ .ss-heading.centered {
68
+ text-align: center;
69
+ }
70
+ .ss-heading .txt {
71
+ position: relative;
72
+ }
73
+ .ss-heading.accent .txt::before {
74
+ content: "";
75
+ position: absolute;
76
+ left: -2%;
77
+ right: -8%;
78
+ top: 70%;
79
+ height: 20%;
80
+ background: var(--ss-primary);
81
+ opacity: 0.9;
82
+ z-index: -1;
83
+ }</style>
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type Size } from '../config.js';
3
+ interface Props {
4
+ /** Heading level (1–6) — picks the rendered element (h1…h6); styling is level-independent. */
5
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
6
+ /** Primary accent underline behind the text. On by default. */
7
+ accent?: boolean;
8
+ /** Center the heading (text-align). */
9
+ centered?: boolean;
10
+ /** Token size (sm|md|lg); inherits the global size when unset. */
11
+ size?: Size;
12
+ /** Heading text. */
13
+ children?: Snippet;
14
+ }
15
+ declare const Heading: import("svelte").Component<Props, {}, "">;
16
+ type Heading = ReturnType<typeof Heading>;
17
+ export default Heading;