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
@@ -0,0 +1,216 @@
1
+ <script module lang="ts">
2
+ import type { IconName } from './Icon.svelte'
3
+
4
+ /** One tab in the bottom navigation bar. */
5
+ export interface BottomNavItem {
6
+ /** Stable id — matched against `active` and passed to `onSelect`. */
7
+ id: string
8
+ /** Visible label rendered under the icon. */
9
+ label: string
10
+ /** Leading glyph (shared `Icon` component). */
11
+ icon: IconName
12
+ /** Optional URL — when set the tab renders as a real `<a href>`. */
13
+ href?: string
14
+ /** Optional count/label rendered as a small square badge on the icon. */
15
+ badge?: string | number
16
+ }
17
+ </script>
18
+
19
+ <script lang="ts">
20
+ import Icon from './Icon.svelte'
21
+ import { resolveComponentSize, type Size } from '../config.js'
22
+
23
+ interface Props {
24
+ /** Tabs to render, left → right, in equal-width columns. */
25
+ items?: BottomNavItem[]
26
+ /** Id of the active tab; highlighted + `aria-current="page"`. */
27
+ active?: string
28
+ /** Fired with the tab id on activation (also fires for `href` tabs as an SPA fallback). */
29
+ onSelect?: (id: string) => void
30
+ /** Accessible name for the wrapping `<nav>` landmark. */
31
+ ariaLabel?: string
32
+ /** Token size (sm|md|lg); inherits the global size when unset. */
33
+ size?: Size
34
+ }
35
+
36
+ const DEFAULT_ITEMS: BottomNavItem[] = [
37
+ { id: 'home', label: 'Home', icon: 'grid' },
38
+ { id: 'services', label: 'Services', icon: 'database' },
39
+ { id: 'activity', label: 'Activity', icon: 'activity' },
40
+ { id: 'account', label: 'Account', icon: 'user' },
41
+ ]
42
+
43
+ let {
44
+ items = DEFAULT_ITEMS,
45
+ active,
46
+ onSelect,
47
+ ariaLabel = 'Primary',
48
+ size,
49
+ }: Props = $props()
50
+
51
+ const isActive = (item: BottomNavItem): boolean => item.id === active
52
+
53
+ const hasBadge = (item: BottomNavItem): boolean =>
54
+ item.badge != null && item.badge !== ''
55
+
56
+ /** Fold the count badge into the accessible name so it isn't lost to AT. */
57
+ function accessibleName(item: BottomNavItem): string {
58
+ return hasBadge(item) ? `${item.label}, ${item.badge}` : item.label
59
+ }
60
+
61
+ function activate(item: BottomNavItem, e: MouseEvent) {
62
+ // Real links navigate natively; intercept only the SPA (no-href) path so a
63
+ // plain <button> never submits/scrolls. onSelect fires either way.
64
+ if (!item.href) e.preventDefault()
65
+ onSelect?.(item.id)
66
+ }
67
+
68
+ const sizeAttr = $derived(resolveComponentSize('BottomNav', size))
69
+ </script>
70
+
71
+ <nav class="ss-bottom-nav" aria-label={ariaLabel} data-size-variant={sizeAttr}>
72
+ <ul class="list">
73
+ {#each items as item (item.id)}
74
+ {@const current = isActive(item)}
75
+ <li class="row">
76
+ {#if item.href}
77
+ <a
78
+ class="tab {current ? 'active' : ''}"
79
+ href={item.href}
80
+ aria-current={current ? 'page' : undefined}
81
+ aria-label={hasBadge(item) ? accessibleName(item) : undefined}
82
+ onclick={(e) => activate(item, e)}
83
+ >
84
+ <span class="glyph">
85
+ <Icon name={item.icon} px={20} />
86
+ {#if hasBadge(item)}
87
+ <span class="badge" aria-hidden="true">{item.badge}</span>
88
+ {/if}
89
+ </span>
90
+ <span class="label">{item.label}</span>
91
+ </a>
92
+ {:else}
93
+ <button
94
+ type="button"
95
+ class="tab {current ? 'active' : ''}"
96
+ aria-current={current ? 'page' : undefined}
97
+ aria-label={hasBadge(item) ? accessibleName(item) : undefined}
98
+ onclick={(e) => activate(item, e)}
99
+ >
100
+ <span class="glyph">
101
+ <Icon name={item.icon} px={20} />
102
+ {#if hasBadge(item)}
103
+ <span class="badge" aria-hidden="true">{item.badge}</span>
104
+ {/if}
105
+ </span>
106
+ <span class="label">{item.label}</span>
107
+ </button>
108
+ {/if}
109
+ </li>
110
+ {/each}
111
+ </ul>
112
+ </nav>
113
+
114
+ <style>.ss-bottom-nav {
115
+ --_bar-h: var(--ss-bottom-nav-h, var(--ss-shell-top-h, 48px));
116
+ --_pad-x: var(--ss-bottom-nav-px, var(--ss-s-2, 8px));
117
+ --_tab-py: var(--ss-bottom-nav-tab-py, var(--ss-s-1, 4px));
118
+ --_gap: var(--ss-bottom-nav-gap, 4px);
119
+ --_label-fs: var(--ss-bottom-nav-label-fs, var(--ss-ui-xs, 11px));
120
+ position: fixed;
121
+ left: 0;
122
+ right: 0;
123
+ bottom: 0;
124
+ z-index: 30;
125
+ box-sizing: border-box;
126
+ padding-bottom: env(safe-area-inset-bottom, 0px);
127
+ background: color-mix(in srgb, var(--ss-bg) 88%, transparent);
128
+ backdrop-filter: blur(14px);
129
+ -webkit-backdrop-filter: blur(14px);
130
+ border-top: 1px solid var(--ss-line);
131
+ font-family: var(--ss-font-mono);
132
+ }
133
+ .ss-bottom-nav .list {
134
+ list-style: none;
135
+ margin: 0;
136
+ padding: 0;
137
+ display: grid;
138
+ grid-auto-flow: column;
139
+ grid-auto-columns: 1fr;
140
+ align-items: stretch;
141
+ }
142
+ .ss-bottom-nav .row {
143
+ display: flex;
144
+ }
145
+ .ss-bottom-nav .tab {
146
+ flex: 1 1 auto;
147
+ display: flex;
148
+ flex-direction: column;
149
+ align-items: center;
150
+ justify-content: center;
151
+ gap: var(--_gap);
152
+ width: 100%;
153
+ min-height: max(var(--_bar-h), 44px);
154
+ padding: var(--_tab-py) var(--_pad-x);
155
+ box-sizing: border-box;
156
+ cursor: pointer;
157
+ text-decoration: none;
158
+ color: var(--ss-fg-faint);
159
+ background: none;
160
+ border: 0;
161
+ border-top: 2px solid transparent;
162
+ font: inherit;
163
+ transition: color var(--ss-dur-fast) var(--ss-ease), background var(--ss-dur-fast) var(--ss-ease);
164
+ }
165
+ .ss-bottom-nav .tab:hover {
166
+ color: var(--ss-fg);
167
+ }
168
+ .ss-bottom-nav .tab:focus-visible {
169
+ outline: 2px solid var(--ss-primary);
170
+ outline-offset: -2px;
171
+ }
172
+ .ss-bottom-nav .tab.active {
173
+ color: var(--ss-primary);
174
+ background: rgba(var(--ss-primary-rgb), 0.06);
175
+ border-top-color: var(--ss-primary);
176
+ }
177
+ .ss-bottom-nav .glyph {
178
+ position: relative;
179
+ display: inline-flex;
180
+ align-items: center;
181
+ justify-content: center;
182
+ line-height: 0;
183
+ }
184
+ .ss-bottom-nav .badge {
185
+ position: absolute;
186
+ top: -6px;
187
+ left: calc(50% + 6px);
188
+ min-width: 14px;
189
+ height: 14px;
190
+ padding: 0 3px;
191
+ box-sizing: border-box;
192
+ display: inline-flex;
193
+ align-items: center;
194
+ justify-content: center;
195
+ font-family: var(--ss-font-mono);
196
+ font-size: 9px;
197
+ line-height: 1;
198
+ font-variant-numeric: tabular-nums;
199
+ color: var(--ss-fg-on-primary, #001b04);
200
+ background: var(--ss-primary);
201
+ border-radius: 0;
202
+ }
203
+ .ss-bottom-nav .label {
204
+ font-size: var(--_label-fs);
205
+ line-height: 1;
206
+ letter-spacing: 0.02em;
207
+ max-width: 100%;
208
+ overflow: hidden;
209
+ text-overflow: ellipsis;
210
+ white-space: nowrap;
211
+ }
212
+ @media (prefers-reduced-motion: reduce) {
213
+ .ss-bottom-nav .tab {
214
+ transition: none;
215
+ }
216
+ }</style>
@@ -0,0 +1,30 @@
1
+ import type { IconName } from './Icon.svelte';
2
+ /** One tab in the bottom navigation bar. */
3
+ export interface BottomNavItem {
4
+ /** Stable id — matched against `active` and passed to `onSelect`. */
5
+ id: string;
6
+ /** Visible label rendered under the icon. */
7
+ label: string;
8
+ /** Leading glyph (shared `Icon` component). */
9
+ icon: IconName;
10
+ /** Optional URL — when set the tab renders as a real `<a href>`. */
11
+ href?: string;
12
+ /** Optional count/label rendered as a small square badge on the icon. */
13
+ badge?: string | number;
14
+ }
15
+ import { type Size } from '../config.js';
16
+ interface Props {
17
+ /** Tabs to render, left → right, in equal-width columns. */
18
+ items?: BottomNavItem[];
19
+ /** Id of the active tab; highlighted + `aria-current="page"`. */
20
+ active?: string;
21
+ /** Fired with the tab id on activation (also fires for `href` tabs as an SPA fallback). */
22
+ onSelect?: (id: string) => void;
23
+ /** Accessible name for the wrapping `<nav>` landmark. */
24
+ ariaLabel?: string;
25
+ /** Token size (sm|md|lg); inherits the global size when unset. */
26
+ size?: Size;
27
+ }
28
+ declare const BottomNav: import("svelte").Component<Props, {}, "">;
29
+ type BottomNav = ReturnType<typeof BottomNav>;
30
+ export default BottomNav;
@@ -1,21 +1,88 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte'
3
+ import type { HTMLButtonAttributes } from 'svelte/elements'
3
4
  import { resolveComponentSize, type Size } from '../config.js'
4
5
 
5
- interface Props {
6
- variant?: 'primary' | 'secondary' | 'ghost'
6
+ interface Props extends HTMLButtonAttributes {
7
+ variant?: 'primary' | 'secondary' | 'ghost' | 'danger'
7
8
  type?: 'button' | 'submit' | 'reset'
8
9
  disabled?: boolean
10
+ /** Loading state: shows a spinner, blocks clicks, sets aria-busy; stays focusable. */
11
+ loading?: boolean
12
+ /** Accessible name while loading (keeps the name stable when the label is hidden). */
13
+ loadingLabel?: string
9
14
  onclick?: (e: MouseEvent) => void
10
15
  /** Token size (sm|md|lg); inherits the global size when unset. */
11
16
  size?: Size
12
- children: Snippet
17
+ /** Icon-only square button — `label` is required and becomes the aria-label. */
18
+ iconOnly?: boolean
19
+ /** Accessible name; required for icon-only buttons (→ aria-label). */
20
+ label?: string
21
+ /** Block-level: stretch to fill the inline axis and center the content. */
22
+ fullWidth?: boolean
23
+ /** Leading icon snippet, rendered before children. */
24
+ leading?: Snippet
25
+ /** Trailing icon snippet, rendered after children. */
26
+ trailing?: Snippet
27
+ children?: Snippet
28
+ /** Bound reference to the underlying <button>. */
29
+ el?: HTMLButtonElement
30
+ }
31
+ let {
32
+ variant = 'secondary',
33
+ type = 'button',
34
+ disabled = false,
35
+ loading = false,
36
+ loadingLabel,
37
+ onclick,
38
+ size,
39
+ iconOnly = false,
40
+ label,
41
+ fullWidth = false,
42
+ leading,
43
+ trailing,
44
+ children,
45
+ el = $bindable(),
46
+ ...rest
47
+ }: Props = $props()
48
+
49
+ // Soft-disable: keep the control focusable/announceable via aria-disabled while
50
+ // loading, but still emit native `disabled` so forms don't submit it.
51
+ let busy = $derived(loading)
52
+ let ariaLabel = $derived(iconOnly ? label : rest['aria-label'])
53
+ let accessibleName = $derived(loading ? (loadingLabel ?? ariaLabel) : ariaLabel)
54
+
55
+ function handleClick(e: MouseEvent) {
56
+ if (loading || disabled) {
57
+ e.preventDefault()
58
+ e.stopImmediatePropagation()
59
+ return
60
+ }
61
+ onclick?.(e)
13
62
  }
14
- let { variant = 'secondary', type = 'button', disabled = false, onclick, size, children }: Props = $props()
15
63
  </script>
16
64
 
17
- <button class="ss-btn {variant}" {type} {disabled} {onclick} data-size-variant={resolveComponentSize('Button', size)}>
18
- {@render children()}
65
+ <button
66
+ bind:this={el}
67
+ class="ss-btn {variant}"
68
+ class:icon-only={iconOnly}
69
+ class:full-width={fullWidth}
70
+ class:loading
71
+ {type}
72
+ {disabled}
73
+ aria-busy={busy ? 'true' : undefined}
74
+ aria-disabled={loading ? 'true' : undefined}
75
+ aria-label={accessibleName}
76
+ data-size-variant={resolveComponentSize('Button', size)}
77
+ {...rest}
78
+ onclick={handleClick}
79
+ >
80
+ {#if loading}
81
+ <span class="spinner" aria-hidden="true"></span>
82
+ {/if}
83
+ {#if leading}<span class="affix" aria-hidden="true">{@render leading()}</span>{/if}
84
+ {#if children}<span class="label">{@render children()}</span>{/if}
85
+ {#if trailing}<span class="affix" aria-hidden="true">{@render trailing()}</span>{/if}
19
86
  </button>
20
87
 
21
88
  <style>.ss-btn {
@@ -30,10 +97,10 @@
30
97
  cursor: pointer;
31
98
  display: inline-flex;
32
99
  align-items: center;
33
- gap: 6px;
100
+ gap: var(--ss-gap-sm);
34
101
  transition: all var(--ss-dur-fast) var(--ss-ease);
35
102
  }
36
- .ss-btn:hover {
103
+ .ss-btn:not(:disabled):hover {
37
104
  background: var(--ss-hover);
38
105
  border-color: var(--ss-line-strong);
39
106
  }
@@ -43,18 +110,88 @@
43
110
  border-color: var(--ss-primary);
44
111
  font-weight: 600;
45
112
  }
46
- .ss-btn.primary:hover {
113
+ .ss-btn.primary:not(:disabled):hover {
47
114
  background: var(--ss-primary-hover);
48
115
  border-color: var(--ss-primary-hover);
49
116
  box-shadow: var(--ss-shadow-glow);
50
117
  }
118
+ .ss-btn.danger {
119
+ background: var(--ss-danger);
120
+ color: var(--ss-fg-on-danger);
121
+ border-color: var(--ss-danger);
122
+ font-weight: 600;
123
+ }
124
+ .ss-btn.danger:not(:disabled):hover {
125
+ background: var(--ss-danger-hover);
126
+ border-color: var(--ss-danger-hover);
127
+ }
51
128
  .ss-btn.ghost {
52
129
  border-color: transparent;
53
130
  color: var(--ss-fg-muted);
54
131
  padding: var(--ss-control-py) var(--ss-gap-sm);
55
132
  }
56
- .ss-btn.ghost:hover {
133
+ .ss-btn.ghost:not(:disabled):hover {
57
134
  color: var(--ss-fg);
58
135
  background: var(--ss-hover);
59
136
  border-color: transparent;
137
+ }
138
+ .ss-btn {
139
+ /* Icon-only: square padding derived from the vertical control token. */
140
+ }
141
+ .ss-btn.icon-only {
142
+ padding: var(--ss-control-py);
143
+ gap: 0;
144
+ }
145
+ .ss-btn {
146
+ /* Block-level: fill the inline axis, center the content. */
147
+ }
148
+ .ss-btn.full-width {
149
+ width: 100%;
150
+ justify-content: center;
151
+ }
152
+ .ss-btn {
153
+ /* Soft-disabled while loading: keep focusable, dim, block the pointer. */
154
+ }
155
+ .ss-btn.loading {
156
+ cursor: progress;
157
+ opacity: 0.8;
158
+ }
159
+ .ss-btn:disabled {
160
+ cursor: not-allowed;
161
+ opacity: 0.5;
162
+ box-shadow: none;
163
+ }
164
+
165
+ .label {
166
+ display: inline-flex;
167
+ align-items: center;
168
+ }
169
+
170
+ .affix {
171
+ display: inline-flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ line-height: 0;
175
+ }
176
+
177
+ /* em-sized spinner so it tracks the button font; reduced-motion safe. */
178
+ .spinner {
179
+ display: inline-block;
180
+ width: 1em;
181
+ height: 1em;
182
+ border: 2px solid currentColor;
183
+ border-top-color: transparent;
184
+ box-sizing: border-box;
185
+ animation: ss-btn-spin var(--ss-dur-xslow) linear infinite;
186
+ }
187
+
188
+ @keyframes ss-btn-spin {
189
+ to {
190
+ transform: rotate(360deg);
191
+ }
192
+ }
193
+ @media (prefers-reduced-motion: reduce) {
194
+ .spinner {
195
+ animation: none;
196
+ }
60
197
  }</style>
@@ -1,14 +1,31 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
2
3
  import { type Size } from '../config.js';
3
- interface Props {
4
- variant?: 'primary' | 'secondary' | 'ghost';
4
+ interface Props extends HTMLButtonAttributes {
5
+ variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
5
6
  type?: 'button' | 'submit' | 'reset';
6
7
  disabled?: boolean;
8
+ /** Loading state: shows a spinner, blocks clicks, sets aria-busy; stays focusable. */
9
+ loading?: boolean;
10
+ /** Accessible name while loading (keeps the name stable when the label is hidden). */
11
+ loadingLabel?: string;
7
12
  onclick?: (e: MouseEvent) => void;
8
13
  /** Token size (sm|md|lg); inherits the global size when unset. */
9
14
  size?: Size;
10
- children: Snippet;
15
+ /** Icon-only square button — `label` is required and becomes the aria-label. */
16
+ iconOnly?: boolean;
17
+ /** Accessible name; required for icon-only buttons (→ aria-label). */
18
+ label?: string;
19
+ /** Block-level: stretch to fill the inline axis and center the content. */
20
+ fullWidth?: boolean;
21
+ /** Leading icon snippet, rendered before children. */
22
+ leading?: Snippet;
23
+ /** Trailing icon snippet, rendered after children. */
24
+ trailing?: Snippet;
25
+ children?: Snippet;
26
+ /** Bound reference to the underlying <button>. */
27
+ el?: HTMLButtonElement;
11
28
  }
12
- declare const Button: import("svelte").Component<Props, {}, "">;
29
+ declare const Button: import("svelte").Component<Props, {}, "el">;
13
30
  type Button = ReturnType<typeof Button>;
14
31
  export default Button;
@@ -3,23 +3,87 @@
3
3
  import { resolveComponentSize, type Size } from '../config.js'
4
4
 
5
5
  interface Props {
6
- title?: string
6
+ /** Heading text, or a Snippet for inline icons/badges in the title. */
7
+ title?: string | Snippet
8
+ /** Secondary label rendered to the right of the title. */
7
9
  meta?: string
10
+ /** Muted description rendered under the heading. */
11
+ description?: string
12
+ /** Header controls (buttons, menus) rendered to the right. */
8
13
  action?: Snippet
14
+ /** Full-bleed visual rendered above the head (zero side padding). */
15
+ media?: Snippet
16
+ /** Footer band mirroring the head, rendered only when provided. */
17
+ footer?: Snippet
9
18
  children: Snippet
19
+ /** Makes the whole card a primary link to this href. */
20
+ href?: string
21
+ /** Makes the whole card clickable; pairs with keyboard activation. */
22
+ onclick?: (e: MouseEvent | KeyboardEvent) => void
23
+ /** Surface style: outlined (default) or elevated (shadow tokens). */
24
+ variant?: 'outlined' | 'elevated'
10
25
  /** Token size (sm|md|lg); inherits the global size when unset. */
11
26
  size?: Size
12
27
  /** Heading level for the title (aria-level), for correct document outline. */
13
28
  titleLevel?: number
14
29
  }
15
- let { title, meta, action, children, size, titleLevel = 3 }: Props = $props()
30
+ let {
31
+ title,
32
+ meta,
33
+ description,
34
+ action,
35
+ media,
36
+ footer,
37
+ children,
38
+ href,
39
+ onclick,
40
+ variant = 'outlined',
41
+ size,
42
+ titleLevel = 3,
43
+ }: Props = $props()
44
+
45
+ // A stable id so the region can be labelled by its title for assistive tech.
46
+ const titleId = $props.id()
47
+
48
+ const isTitleSnippet = $derived(typeof title === 'function')
49
+ const interactive = $derived(Boolean(href || onclick))
50
+
51
+ function onKeydown(e: KeyboardEvent) {
52
+ if (onclick && !href && (e.key === 'Enter' || e.key === ' ')) {
53
+ e.preventDefault()
54
+ onclick(e)
55
+ }
56
+ }
16
57
  </script>
17
58
 
18
- <div class="ss-panel" data-size-variant={resolveComponentSize('Card', size)}>
19
- {#if title}
59
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -- role is set to "button" in the same condition -->
60
+ <div
61
+ class="ss-card"
62
+ class:elevated={variant === 'elevated'}
63
+ class:interactive
64
+ data-size-variant={resolveComponentSize('Card', size)}
65
+ role={interactive && !href ? 'button' : undefined}
66
+ tabindex={interactive && !href ? 0 : undefined}
67
+ aria-labelledby={title ? titleId : undefined}
68
+ onclick={!href ? onclick : undefined}
69
+ onkeydown={!href ? onKeydown : undefined}
70
+ >
71
+ {#if media}
72
+ <div class="media">{@render media()}</div>
73
+ {/if}
74
+ {#if title || meta || description || action}
20
75
  <div class="head">
21
- <div class="title" role="heading" aria-level={titleLevel}>{title}</div>
22
- <div style="display:flex;gap:12px;align-items:center">
76
+ <div class="heading">
77
+ <div class="title" id={titleId} role="heading" aria-level={titleLevel}>
78
+ {#if isTitleSnippet}
79
+ {@render (title as Snippet)()}
80
+ {:else}
81
+ {title}
82
+ {/if}
83
+ </div>
84
+ {#if description}<div class="desc">{description}</div>{/if}
85
+ </div>
86
+ <div class="actions">
23
87
  {#if meta}<div class="meta">{meta}</div>{/if}
24
88
  {#if action}{@render action()}{/if}
25
89
  </div>
@@ -28,35 +92,130 @@
28
92
  <div class="body">
29
93
  {@render children()}
30
94
  </div>
95
+ {#if footer}
96
+ <div class="foot">{@render footer()}</div>
97
+ {/if}
98
+ {#if href}
99
+ <a class="overlay" {href} {onclick} onkeydown={onKeydown} aria-labelledby={title ? titleId : undefined}>
100
+ <span class="sr-only">{typeof title === 'string' ? title : 'Open'}</span>
101
+ </a>
102
+ {/if}
31
103
  </div>
32
104
 
33
- <style>.ss-panel {
105
+ <style>.ss-card {
106
+ position: relative;
34
107
  border: 1px solid var(--ss-line);
35
108
  background: var(--ss-bg-elev);
109
+ border-radius: 0;
110
+ }
111
+ .ss-card.elevated {
112
+ border-color: transparent;
113
+ box-shadow: var(--ss-shadow-1);
114
+ }
115
+ .ss-card.interactive {
116
+ cursor: pointer;
117
+ transition: box-shadow var(--ss-dur-fast) var(--ss-ease), border-color var(--ss-dur-fast) var(--ss-ease);
118
+ }
119
+ .ss-card.interactive:hover {
120
+ border-color: var(--ss-line-strong);
121
+ }
122
+ .ss-card.interactive.elevated:hover {
123
+ box-shadow: var(--ss-shadow-2);
124
+ }
125
+ .ss-card.interactive:focus-within {
126
+ border-color: var(--ss-line-strong);
127
+ }
128
+
129
+ .media {
130
+ display: block;
131
+ line-height: 0;
132
+ }
133
+ .media :global(img),
134
+ .media :global(svg),
135
+ .media :global(video) {
136
+ display: block;
137
+ width: 100%;
36
138
  }
37
139
 
38
140
  .head {
39
141
  padding: var(--ss-panel-head-py) var(--ss-panel-head-px);
40
142
  border-bottom: 1px solid var(--ss-line);
41
143
  display: flex;
42
- align-items: center;
144
+ align-items: flex-start;
43
145
  justify-content: space-between;
146
+ gap: var(--ss-gap-sm);
44
147
  font-family: var(--ss-font-mono);
45
148
  font-size: var(--ss-ui-sm);
46
149
  color: var(--ss-fg-faint);
47
150
  text-transform: uppercase;
48
151
  letter-spacing: 0.06em;
49
152
  }
153
+ .head .heading {
154
+ display: flex;
155
+ flex-direction: column;
156
+ gap: var(--ss-s-1);
157
+ min-width: 0;
158
+ }
50
159
  .head .title {
51
160
  color: var(--ss-fg);
52
161
  letter-spacing: 0.06em;
53
162
  }
163
+ .head .desc {
164
+ color: var(--ss-fg-muted);
165
+ text-transform: none;
166
+ letter-spacing: normal;
167
+ font-family: var(--ss-font-body);
168
+ }
54
169
  .head .meta {
55
170
  color: var(--ss-fg-faint);
56
171
  text-transform: lowercase;
57
172
  letter-spacing: 0.04em;
58
173
  }
59
174
 
175
+ .actions {
176
+ position: relative;
177
+ z-index: 1;
178
+ display: flex;
179
+ gap: var(--ss-gap);
180
+ align-items: center;
181
+ }
182
+
60
183
  .body {
61
184
  padding: var(--ss-panel-body-py) var(--ss-panel-body-px);
185
+ }
186
+
187
+ .foot {
188
+ position: relative;
189
+ z-index: 1;
190
+ padding: var(--ss-panel-head-py) var(--ss-panel-head-px);
191
+ border-top: 1px solid var(--ss-line);
192
+ display: flex;
193
+ align-items: center;
194
+ justify-content: space-between;
195
+ gap: var(--ss-gap-sm);
196
+ font-family: var(--ss-font-mono);
197
+ font-size: var(--ss-ui-sm);
198
+ color: var(--ss-fg-faint);
199
+ }
200
+
201
+ .overlay {
202
+ position: static;
203
+ }
204
+ .overlay::after {
205
+ content: "";
206
+ position: absolute;
207
+ inset: 0;
208
+ z-index: 0;
209
+ }
210
+
211
+ .sr-only {
212
+ position: absolute;
213
+ width: 1px;
214
+ height: 1px;
215
+ padding: 0;
216
+ margin: -1px;
217
+ overflow: hidden;
218
+ clip: rect(0 0 0 0);
219
+ white-space: nowrap;
220
+ border: 0;
62
221
  }</style>