dssoca 0.8.2 → 0.10.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 (65) 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/Avatar.svelte +119 -0
  5. package/dist/components/Avatar.svelte.d.ts +18 -0
  6. package/dist/components/Badge.svelte +3 -5
  7. package/dist/components/BottomNav.svelte +57 -19
  8. package/dist/components/BottomNav.svelte.d.ts +2 -0
  9. package/dist/components/Card.svelte +7 -1
  10. package/dist/components/Chart.svelte +527 -0
  11. package/dist/components/Chart.svelte.d.ts +42 -0
  12. package/dist/components/Container.svelte +55 -0
  13. package/dist/components/Container.svelte.d.ts +16 -0
  14. package/dist/components/DateField.svelte +188 -0
  15. package/dist/components/DateField.svelte.d.ts +37 -0
  16. package/dist/components/EmptyState.svelte +9 -3
  17. package/dist/components/EmptyState.svelte.d.ts +6 -0
  18. package/dist/components/FileDrop.svelte +355 -0
  19. package/dist/components/FileDrop.svelte.d.ts +24 -0
  20. package/dist/components/Heading.svelte +83 -0
  21. package/dist/components/Heading.svelte.d.ts +17 -0
  22. package/dist/components/Icon.svelte +32 -23
  23. package/dist/components/Icon.svelte.d.ts +7 -0
  24. package/dist/components/Image.svelte +19 -21
  25. package/dist/components/Input.svelte +2 -3
  26. package/dist/components/Link.svelte +42 -7
  27. package/dist/components/Link.svelte.d.ts +7 -0
  28. package/dist/components/LogStream.svelte +46 -31
  29. package/dist/components/Menu.svelte +59 -6
  30. package/dist/components/Menu.svelte.d.ts +22 -2
  31. package/dist/components/MetricTile.svelte +4 -4
  32. package/dist/components/Modal.svelte +223 -0
  33. package/dist/components/Modal.svelte.d.ts +29 -0
  34. package/dist/components/NumberField.svelte +260 -0
  35. package/dist/components/NumberField.svelte.d.ts +35 -0
  36. package/dist/components/Pagination.svelte +193 -0
  37. package/dist/components/Pagination.svelte.d.ts +22 -0
  38. package/dist/components/SegmentedControl.svelte +16 -4
  39. package/dist/components/SegmentedControl.svelte.d.ts +7 -0
  40. package/dist/components/Select.svelte +224 -0
  41. package/dist/components/Select.svelte.d.ts +42 -0
  42. package/dist/components/ServiceCard.svelte +15 -15
  43. package/dist/components/Sidebar.svelte +47 -21
  44. package/dist/components/Sparkline.svelte +15 -13
  45. package/dist/components/Spinner.svelte +124 -0
  46. package/dist/components/Spinner.svelte.d.ts +74 -0
  47. package/dist/components/Switch.svelte +144 -0
  48. package/dist/components/Switch.svelte.d.ts +22 -0
  49. package/dist/components/Table.svelte +267 -0
  50. package/dist/components/Table.svelte.d.ts +52 -0
  51. package/dist/components/Textarea.svelte +214 -0
  52. package/dist/components/Textarea.svelte.d.ts +38 -0
  53. package/dist/components/Toaster.svelte +20 -4
  54. package/dist/components/Tooltip.svelte +162 -0
  55. package/dist/components/Tooltip.svelte.d.ts +17 -0
  56. package/dist/components/Topbar.svelte +170 -50
  57. package/dist/components/Topbar.svelte.d.ts +30 -3
  58. package/dist/dssoca.config.d.ts +1 -1
  59. package/dist/dssoca.config.js +15 -0
  60. package/dist/index.d.ts +19 -1
  61. package/dist/index.js +19 -1
  62. package/dist/theme.css +177 -37
  63. package/dist/toast.svelte.js +3 -3
  64. package/dist/tokens.css +597 -0
  65. package/package.json +33 -4
@@ -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;
@@ -2,23 +2,35 @@
2
2
  /** Curated glyph set. `target`'s centre dot is a filled circle in the *outline*
3
3
  * variant — handled by the `variant` switch in markup, not a per-glyph fill hack. */
4
4
  const BUILTIN_PATHS = {
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"/>',
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"/>',
6
6
  activity: '<path d="M3 12h4l3-8 4 16 3-8h4"/>',
7
7
  database: '<rect x="3" y="4" width="18" height="16"/><path d="M3 9h18M8 4v5"/>',
8
- logs: '<path d="M4 6h16M4 12h16M4 18h10"/>',
8
+ logs: '<path d="M4 6h16M4 12h16M4 18h10"/>',
9
9
  terminal: '<rect x="3" y="5" width="18" height="14"/><path d="M3 9h18M7 14h4"/>',
10
- 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"/>',
11
- user: '<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-7 8-7s8 3 8 7"/>',
12
- arrow: '<path d="M5 12h14M13 5l7 7-7 7"/>',
10
+ settings:
11
+ '<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"/>',
12
+ user: '<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-7 8-7s8 3 8 7"/>',
13
+ arrow: '<path d="M5 12h14M13 5l7 7-7 7"/>',
13
14
  external: '<path d="M7 17L17 7M9 7h8v8"/>',
14
- film: '<rect x="3" y="4" width="18" height="16"/><path d="M3 8h4M3 16h4M17 8h4M17 16h4M3 12h18"/>',
15
- note: '<rect x="4" y="3" width="16" height="18"/><path d="M8 8h8M8 12h8M8 16h6"/>',
16
- 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"/>',
17
- check: '<path d="M5 12l4 4L19 6"/>',
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"/>',
19
- wallet: '<rect x="3" y="6" width="18" height="14"/><path d="M3 10h18M17 14h2"/>',
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"/>',
15
+ film: '<rect x="3" y="4" width="18" height="16"/><path d="M3 8h4M3 16h4M17 8h4M17 16h4M3 12h18"/>',
16
+ note: '<rect x="4" y="3" width="16" height="18"/><path d="M8 8h8M8 12h8M8 16h6"/>',
17
+ 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"/>',
18
+ check: '<path d="M5 12l4 4L19 6"/>',
19
+ 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"/>',
20
+ wallet: '<rect x="3" y="6" width="18" height="14"/><path d="M3 10h18M17 14h2"/>',
21
+ target:
22
+ '<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"/>',
23
+ spinner: '<path d="M12 3a9 9 0 1 0 9 9" stroke-linecap="round"/>',
24
+ home: '<path d="M4 11l8-8 8 8"/><path d="M6 9v12h12V9"/><path d="M10 21v-6h4v6"/>',
25
+ briefcase: '<rect x="3" y="7" width="18" height="13"/><path d="M9 7V4h6v3M3 12h18"/>',
26
+ folder: '<path d="M3 5h7l2 3h9v13H3z"/><path d="M3 8h9"/>',
27
+ github:
28
+ '<path d="M7 3h10l2 2v6l-2 3h-4l1 2v5h-4v-5l1-2H7l-2-3V5l2-2z"/><path d="M9 8h1M14 8h1"/>',
29
+ linkedin:
30
+ '<rect x="3" y="3" width="18" height="18"/><path d="M8 16v-5M8 8v.01M12 16v-5h2l2 2v3"/>',
31
+ language: '<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3L8 12l4 9M12 3l4 9-4 9"/>',
32
+ 'color-swatch':
33
+ '<rect x="3" y="3" width="8" height="18"/><path d="M7 17v.01"/><path d="M11 19l8-8 2 2-8 8"/><path d="M13 21h8"/>',
22
34
  } as const
23
35
 
24
36
  export type IconName = keyof typeof BUILTIN_PATHS
@@ -114,17 +126,17 @@
114
126
  const found = resolveIcon(name)
115
127
  if (found != null) return found
116
128
  if (typeof console !== 'undefined') {
117
- console.warn(`[dssoca] Icon: unknown name "${name}" (no registered glyph). Rendering empty; pass \`paths\` or call registerIcon().`)
129
+ console.warn(
130
+ `[dssoca] Icon: unknown name "${name}" (no registered glyph). Rendering empty; pass \`paths\` or call registerIcon().`,
131
+ )
118
132
  }
119
133
  return ''
120
134
  })
121
135
 
122
136
  // Optically-constant stroke: recompute weight from the resolved px so a
123
137
  // 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
- )
138
+ const resolvedPx = $derived(px != null ? px : (SIZE_PX[size ?? 'md'] ?? DEFAULT_PX))
139
+ const stroke = $derived(absoluteStroke ? (strokeWidth * 24) / resolvedPx : strokeWidth)
128
140
 
129
141
  const isSolid = $derived(variant === 'solid')
130
142
 
@@ -135,13 +147,10 @@
135
147
  const uid = $props.id()
136
148
  const titleId = $derived(title ? `${uid}-t` : undefined)
137
149
  const descId = $derived(desc ? `${uid}-d` : undefined)
138
- const labelledBy = $derived(
139
- [titleId, descId].filter(Boolean).join(' ') || undefined,
140
- )
150
+ const labelledBy = $derived([titleId, descId].filter(Boolean).join(' ') || undefined)
141
151
  const labelled = $derived(!isDecorative && labelledBy != null)
142
152
 
143
- const esc = (s: string) =>
144
- s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
153
+ const esc = (s: string) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
145
154
 
146
155
  // <title>/<desc> are folded into the same @html string as the glyph so the
147
156
  // SVG carries no Svelte {#if} comment anchors (keeps innerHTML clean for AT
@@ -18,6 +18,13 @@ declare const BUILTIN_PATHS: {
18
18
  readonly wallet: "<rect x=\"3\" y=\"6\" width=\"18\" height=\"14\"/><path d=\"M3 10h18M17 14h2\"/>";
19
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
20
  readonly spinner: "<path d=\"M12 3a9 9 0 1 0 9 9\" stroke-linecap=\"round\"/>";
21
+ readonly home: "<path d=\"M4 11l8-8 8 8\"/><path d=\"M6 9v12h12V9\"/><path d=\"M10 21v-6h4v6\"/>";
22
+ readonly briefcase: "<rect x=\"3\" y=\"7\" width=\"18\" height=\"13\"/><path d=\"M9 7V4h6v3M3 12h18\"/>";
23
+ readonly folder: "<path d=\"M3 5h7l2 3h9v13H3z\"/><path d=\"M3 8h9\"/>";
24
+ readonly github: "<path d=\"M7 3h10l2 2v6l-2 3h-4l1 2v5h-4v-5l1-2H7l-2-3V5l2-2z\"/><path d=\"M9 8h1M14 8h1\"/>";
25
+ readonly linkedin: "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\"/><path d=\"M8 16v-5M8 8v.01M12 16v-5h2l2 2v3\"/>";
26
+ readonly language: "<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M3 12h18M12 3L8 12l4 9M12 3l4 9-4 9\"/>";
27
+ readonly 'color-swatch': "<rect x=\"3\" y=\"3\" width=\"8\" height=\"18\"/><path d=\"M7 17v.01\"/><path d=\"M11 19l8-8 2 2-8 8\"/><path d=\"M13 21h8\"/>";
21
28
  };
22
29
  export type IconName = keyof typeof BUILTIN_PATHS;
23
30
  /**
@@ -80,21 +80,17 @@
80
80
  // Reserve space before load → no layout shift (CLS). Prefer an explicit
81
81
  // ratio, else derive from intrinsic width/height. `null` → no box reserved.
82
82
  const aspect = $derived(
83
- ratio && ratio > 0
84
- ? ratio
85
- : width && height && height > 0
86
- ? width / height
87
- : null,
83
+ ratio && ratio > 0 ? ratio : width && height && height > 0 ? width / height : null,
88
84
  )
89
85
 
90
86
  type State = 'loading' | 'loaded' | 'error'
91
- let state = $state<State>('loading')
87
+ let loadState = $state<State>('loading')
92
88
 
93
89
  function onLoad() {
94
- state = 'loaded'
90
+ loadState = 'loaded'
95
91
  }
96
92
  function onError() {
97
- state = 'error'
93
+ loadState = 'error'
98
94
  }
99
95
 
100
96
  // ── Lightbox ───────────────────────────────────────────────────────────
@@ -103,7 +99,7 @@
103
99
  let dialog = $state<HTMLDivElement | null>(null)
104
100
  let closeBtn = $state<HTMLButtonElement | null>(null)
105
101
 
106
- const canOpen = $derived(lightbox && state !== 'error')
102
+ const canOpen = $derived(lightbox && loadState !== 'error')
107
103
 
108
104
  async function openLightbox() {
109
105
  if (!canOpen) return
@@ -127,8 +123,15 @@
127
123
  return
128
124
  }
129
125
  if (e.key !== 'Tab' || !dialog) return
126
+ // DS-0078: exclude disabled focusables (and anything opted out of the tab
127
+ // order with tabindex="-1", e.g. the backdrop button) so the trap never
128
+ // wraps relative to an element that cannot actually take tab focus.
130
129
  const focusables = dialog.querySelectorAll<HTMLElement>(
131
- 'button, [href], [tabindex]:not([tabindex="-1"])',
130
+ [
131
+ 'button:not([disabled]):not([aria-disabled="true"]):not([tabindex="-1"])',
132
+ '[href]:not([aria-disabled="true"]):not([tabindex="-1"])',
133
+ '[tabindex]:not([tabindex="-1"]):not([disabled]):not([aria-disabled="true"])',
134
+ ].join(', '),
132
135
  )
133
136
  if (focusables.length === 0) return
134
137
  const first = focusables[0]
@@ -146,22 +149,22 @@
146
149
 
147
150
  <figure
148
151
  class="ss-image {className ?? ''}"
149
- class:is-loading={state === 'loading'}
150
- class:is-error={state === 'error'}
152
+ class:is-loading={loadState === 'loading'}
153
+ class:is-error={loadState === 'error'}
151
154
  class:has-ratio={aspect != null}
152
155
  data-size-variant={resolveComponentSize('Image', size)}
153
156
  >
154
157
  <div
155
158
  class="frame"
156
159
  style:aspect-ratio={aspect != null ? `${aspect}` : undefined}
157
- aria-busy={state === 'loading'}
160
+ aria-busy={loadState === 'loading'}
158
161
  >
159
- {#if state === 'error'}
162
+ {#if loadState === 'error'}
160
163
  <div class="fallback" role="img" aria-label={alt || 'Image failed to load'}>
161
164
  <span class="glyph" aria-hidden="true">⊘</span>
162
165
  </div>
163
166
  {:else}
164
- {#if state === 'loading'}
167
+ {#if loadState === 'loading'}
165
168
  <div class="skeleton" aria-hidden="true"></div>
166
169
  {/if}
167
170
  {#if canOpen}
@@ -218,12 +221,7 @@
218
221
  tabindex="-1"
219
222
  onkeydown={onDialogKeydown}
220
223
  >
221
- <button
222
- type="button"
223
- class="backdrop"
224
- tabindex="-1"
225
- aria-hidden="true"
226
- onclick={closeLightbox}
224
+ <button type="button" class="backdrop" tabindex="-1" aria-hidden="true" onclick={closeLightbox}
227
225
  ></button>
228
226
  <div class="dialog-body">
229
227
  <button
@@ -73,9 +73,8 @@
73
73
 
74
74
  // error wins, then hint, then any caller-supplied describedby — order matters for AT.
75
75
  const describedBy = $derived(
76
- [error ? errorId : null, hint ? hintId : null, describedby]
77
- .filter(Boolean)
78
- .join(' ') || undefined,
76
+ [error ? errorId : null, hint ? hintId : null, describedby].filter(Boolean).join(' ') ||
77
+ undefined,
79
78
  )
80
79
  const isInvalid = $derived(invalid || Boolean(error) || undefined)
81
80
  const resolvedSize = $derived(resolveComponentSize('Input', size))
@@ -16,6 +16,13 @@
16
16
  size?: Size
17
17
  /** Destination URL. */
18
18
  href?: string
19
+ /**
20
+ * Render the link inert (DS-0078): the `href` is dropped (no navigation,
21
+ * out of the tab order), link semantics are kept via `role="link"`, and
22
+ * the state is communicated to AT with `aria-disabled="true"`. Forwarded
23
+ * `onclick` handlers do not fire while disabled.
24
+ */
25
+ disabled?: boolean
19
26
  children?: Snippet
20
27
  /** Bound reference to the underlying <a>. */
21
28
  el?: HTMLAnchorElement
@@ -26,34 +33,50 @@
26
33
  external,
27
34
  size,
28
35
  href,
36
+ disabled = false,
29
37
  children,
30
38
  el = $bindable(),
31
39
  target,
32
40
  rel,
41
+ onclick,
33
42
  ...rest
34
43
  }: Props = $props()
35
44
 
36
45
  // Off-site detection: absolute http(s) URL, or a protocol-relative one.
37
46
  // Honoured only when `external` is left undefined (explicit wins).
38
- const looksExternal = $derived(
39
- typeof href === 'string' && /^(https?:)?\/\//i.test(href),
40
- )
41
- const isExternal = $derived(external ?? looksExternal)
47
+ const looksExternal = $derived(typeof href === 'string' && /^(https?:)?\/\//i.test(href))
48
+ // A disabled link gets no external affordances (it cannot navigate).
49
+ const isExternal = $derived(!disabled && (external ?? looksExternal))
42
50
 
43
51
  // External links open in a new tab and carry the security rel; callers can
44
52
  // still override target/rel explicitly via the forwarded attributes.
45
53
  const resolvedTarget = $derived(target ?? (isExternal ? '_blank' : undefined))
46
54
  const resolvedRel = $derived(rel ?? (isExternal ? 'noopener noreferrer' : undefined))
55
+
56
+ // Swallow activation while disabled; otherwise defer to a forwarded onclick.
57
+ function handleClick(e: MouseEvent) {
58
+ if (disabled) {
59
+ e.preventDefault()
60
+ e.stopPropagation()
61
+ return
62
+ }
63
+ onclick?.(e as MouseEvent & { currentTarget: EventTarget & HTMLAnchorElement })
64
+ }
47
65
  </script>
48
66
 
49
67
  <a
50
68
  bind:this={el}
51
- {href}
69
+ href={disabled ? undefined : href}
52
70
  class="ss-link {variant}"
53
71
  class:external={isExternal}
72
+ class:disabled
73
+ role={disabled ? 'link' : undefined}
74
+ aria-disabled={disabled ? 'true' : undefined}
75
+ tabindex={disabled ? -1 : undefined}
54
76
  data-size-variant={resolveComponentSize('Link', size)}
55
- target={resolvedTarget}
56
- rel={resolvedRel}
77
+ target={disabled ? undefined : resolvedTarget}
78
+ rel={disabled ? undefined : resolvedRel}
79
+ onclick={handleClick}
57
80
  {...rest}
58
81
  >
59
82
  {#if children}<span class="label">{@render children()}</span>{/if}
@@ -80,6 +103,10 @@
80
103
  outline: 2px solid var(--ss-primary);
81
104
  outline-offset: 2px;
82
105
  }
106
+ .ss-link.disabled {
107
+ cursor: not-allowed;
108
+ opacity: 0.45;
109
+ }
83
110
 
84
111
  /* ── inline: animated underline that reveals on hover/focus, with a glow ── */
85
112
  .ss-link.inline .label {
@@ -102,6 +129,9 @@
102
129
  height: 2px;
103
130
  box-shadow: var(--ss-shadow-glow);
104
131
  }
132
+ .ss-link.inline.disabled .label::after {
133
+ display: none;
134
+ }
105
135
  .ss-link.inline:visited {
106
136
  color: var(--ss-fg-muted);
107
137
  }
@@ -124,6 +154,11 @@
124
154
  border-color: var(--ss-primary-hover);
125
155
  box-shadow: var(--ss-shadow-glow);
126
156
  }
157
+ .ss-link.button.disabled:hover {
158
+ background: var(--ss-primary);
159
+ border-color: var(--ss-primary);
160
+ box-shadow: none;
161
+ }
127
162
  .ss-link.button .label::after {
128
163
  display: none;
129
164
  }
@@ -13,6 +13,13 @@ interface Props extends HTMLAnchorAttributes {
13
13
  size?: Size;
14
14
  /** Destination URL. */
15
15
  href?: string;
16
+ /**
17
+ * Render the link inert (DS-0078): the `href` is dropped (no navigation,
18
+ * out of the tab order), link semantics are kept via `role="link"`, and
19
+ * the state is communicated to AT with `aria-disabled="true"`. Forwarded
20
+ * `onclick` handlers do not fire while disabled.
21
+ */
22
+ disabled?: boolean;
16
23
  children?: Snippet;
17
24
  /** Bound reference to the underlying <a>. */
18
25
  el?: HTMLAnchorElement;
@@ -52,16 +52,18 @@
52
52
 
53
53
  const TEMPLATES: Omit<LogLine, 'id'>[] = [
54
54
  { lvl: 'info', svc: '[movies-api]', msg: 'GET /movies?status=to_watch — 3 rows · 4ms' },
55
- { lvl: 'ok', svc: '[hub]', msg: 'GET /api/auth/session — 8ms' },
56
- { lvl: 'info', svc: '[hub]', msg: 'session refresh — user=admin' },
57
- { lvl: 'warn', svc: '[caddy]', msg: 'tls internal renewing hub.home' },
58
- { lvl: 'err', svc: '[tasks-api]', msg: 'EADDRINUSE :3004 — retrying in 2s' },
59
- { lvl: 'info', svc: '[notes-api]', msg: 'slow query · 182ms · SELECT * FROM notes' },
60
- { lvl: 'ok', svc: '[meals-api]', msg: 'POST /meals — created id=m_a4f1 · 6ms' },
55
+ { lvl: 'ok', svc: '[hub]', msg: 'GET /api/auth/session — 8ms' },
56
+ { lvl: 'info', svc: '[hub]', msg: 'session refresh — user=admin' },
57
+ { lvl: 'warn', svc: '[caddy]', msg: 'tls internal renewing hub.home' },
58
+ { lvl: 'err', svc: '[tasks-api]', msg: 'EADDRINUSE :3004 — retrying in 2s' },
59
+ { lvl: 'info', svc: '[notes-api]', msg: 'slow query · 182ms · SELECT * FROM notes' },
60
+ { lvl: 'ok', svc: '[meals-api]', msg: 'POST /meals — created id=m_a4f1 · 6ms' },
61
61
  { lvl: 'info', svc: '[movies-api]', msg: 'drizzle migrated 0002 · runtime 12ms' },
62
62
  ]
63
63
 
64
- function pad(n: number) { return String(n).padStart(2, '0') }
64
+ function pad(n: number) {
65
+ return String(n).padStart(2, '0')
66
+ }
65
67
  function nowStr() {
66
68
  const d = new Date()
67
69
  return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
@@ -95,20 +97,18 @@
95
97
  // Internal demo buffer.
96
98
  const seed = untrack(() => initialLines ?? TEMPLATES)
97
99
  let counter = $state(seed.length)
98
- let demoLines = $state<LogLine[]>(
99
- seed.map((t, i) => ({ ...t, t: t.t || timeAgo(i * 4), id: i }))
100
- )
100
+ let demoLines = $state<LogLine[]>(seed.map((t, i) => ({ ...t, t: t.t || timeAgo(i * 4), id: i })))
101
101
 
102
102
  // The source of truth, capped to maxLines.
103
- const allLines = $derived(
104
- (controlled ? (lines as LogLine[]) : demoLines).slice(-maxLines)
105
- )
103
+ const allLines = $derived((controlled ? (lines as LogLine[]) : demoLines).slice(-maxLines))
106
104
 
107
105
  // --- toolbar state ---
108
106
  let activeLevels = $state<Set<LogLevel>>(new Set(LEVELS))
109
107
  let query = $state('')
110
108
  let wrapOn = $state(untrack(() => wrap))
111
- $effect(() => { wrapOn = wrap })
109
+ $effect(() => {
110
+ wrapOn = wrap
111
+ })
112
112
 
113
113
  const visibleLines = $derived(
114
114
  allLines.filter((l) => {
@@ -119,7 +119,7 @@
119
119
  if (!hay.includes(q)) return false
120
120
  }
121
121
  return true
122
- })
122
+ }),
123
123
  )
124
124
 
125
125
  function toggleLevel(lvl: LogLevel) {
@@ -202,8 +202,8 @@
202
202
  type="button"
203
203
  class="chip {lvl}"
204
204
  aria-pressed={activeLevels.has(lvl)}
205
- onclick={() => toggleLevel(lvl)}
206
- >{lvl.toUpperCase()}</button>
205
+ onclick={() => toggleLevel(lvl)}>{lvl.toUpperCase()}</button
206
+ >
207
207
  {/each}
208
208
  </div>
209
209
  <input
@@ -213,12 +213,9 @@
213
213
  aria-label="Filter log text"
214
214
  bind:value={query}
215
215
  />
216
- <button
217
- type="button"
218
- class="chip"
219
- aria-pressed={wrapOn}
220
- onclick={() => (wrapOn = !wrapOn)}
221
- >WRAP</button>
216
+ <button type="button" class="chip" aria-pressed={wrapOn} onclick={() => (wrapOn = !wrapOn)}
217
+ >WRAP</button
218
+ >
222
219
  <button type="button" class="chip" onclick={copyVisible}>COPY</button>
223
220
  {#if !controlled}
224
221
  <button type="button" class="chip" onclick={clear}>CLEAR</button>
@@ -250,7 +247,9 @@
250
247
  {:else}
251
248
  <EmptyState
252
249
  title="No log lines"
253
- message={allLines.length ? 'No lines match the current filters.' : 'Waiting for output…'}
250
+ message={allLines.length
251
+ ? 'No lines match the current filters.'
252
+ : 'Waiting for output…'}
254
253
  {size}
255
254
  />
256
255
  {/if}
@@ -267,14 +266,30 @@
267
266
  </div>
268
267
 
269
268
  {#if !following}
270
- <button type="button" class="jump" onclick={jumpToBottom}>
271
- Jump to bottom
272
- </button>
269
+ <button type="button" class="jump" onclick={jumpToBottom}> Jump to bottom </button>
273
270
  {/if}
274
271
  </div>
275
272
  </div>
276
273
 
277
274
  <style>.ss-logs {
275
+ --_min-h: var(--ss-log-min-h, 160px);
276
+ --_max-h: var(--ss-log-max-h, 240px);
277
+ --_t-w: var(--ss-log-t-w, 58px);
278
+ --_lvl-w: var(--ss-log-lvl-w, 38px);
279
+ }
280
+ .ss-logs[data-size-variant=sm] {
281
+ --_min-h: var(--ss-log-min-h, 120px);
282
+ --_max-h: var(--ss-log-max-h, 200px);
283
+ --_t-w: var(--ss-log-t-w, 52px);
284
+ --_lvl-w: var(--ss-log-lvl-w, 34px);
285
+ }
286
+ .ss-logs[data-size-variant=lg] {
287
+ --_min-h: var(--ss-log-min-h, 200px);
288
+ --_max-h: var(--ss-log-max-h, 320px);
289
+ --_t-w: var(--ss-log-t-w, 64px);
290
+ --_lvl-w: var(--ss-log-lvl-w, 42px);
291
+ }
292
+ .ss-logs {
278
293
  font-family: var(--ss-font-mono);
279
294
  background: var(--ss-code-bg);
280
295
  color: var(--ss-code-fg);
@@ -355,8 +370,8 @@
355
370
  .scroll {
356
371
  font-size: var(--ss-ui-md);
357
372
  padding: var(--ss-gap) var(--ss-panel-body-px);
358
- min-height: 160px;
359
- max-height: 240px;
373
+ min-height: var(--_min-h);
374
+ max-height: var(--_max-h);
360
375
  overflow: auto;
361
376
  }
362
377
  .scroll .ln {
@@ -373,11 +388,11 @@
373
388
  }
374
389
  .scroll .t {
375
390
  color: var(--ss-fg-faint);
376
- min-width: 58px;
391
+ min-width: var(--_t-w);
377
392
  flex: none;
378
393
  }
379
394
  .scroll .lvl {
380
- min-width: 38px;
395
+ min-width: var(--_lvl-w);
381
396
  flex: none;
382
397
  }
383
398
  .scroll .lvl.info {