dssoca 0.14.0 → 0.15.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.
@@ -25,6 +25,14 @@
25
25
  title?: string
26
26
  /** Token size (sm|md|lg); controls max-width. Inherits the global size when unset. */
27
27
  size?: Size
28
+ /**
29
+ * Fill the viewport instead of rendering a centred, capped panel (DS-0145).
30
+ * The size axis no longer affects width, and — since the panel is full-bleed —
31
+ * there is no backdrop left to click, so `closeOnBackdrop` is unreachable:
32
+ * the close button and Esc are the exits. Drive responsiveness from the
33
+ * caller (`fullscreen={width < 640}`). @default false
34
+ */
35
+ fullscreen?: boolean
28
36
  /** Clicking the backdrop (outside the panel) closes the modal. @default true */
29
37
  closeOnBackdrop?: boolean
30
38
  /** Esc closes the modal. When false, Esc is swallowed (cancel prevented). @default true */
@@ -47,6 +55,7 @@
47
55
  open = $bindable(false),
48
56
  title,
49
57
  size,
58
+ fullscreen = false,
50
59
  closeOnBackdrop = true,
51
60
  closeOnEsc = true,
52
61
  danger = false,
@@ -97,6 +106,7 @@
97
106
  class="ss-modal"
98
107
  class:danger
99
108
  data-size-variant={resolveComponentSize('Modal', size)}
109
+ data-fullscreen={fullscreen ? '' : undefined}
100
110
  aria-labelledby={title ? titleId : undefined}
101
111
  aria-label={title ? undefined : ariaLabel}
102
112
  onclose={onDialogClose}
@@ -148,6 +158,20 @@
148
158
  .ss-modal[data-size-variant=lg] {
149
159
  --ss-modal-w: 48rem;
150
160
  }
161
+ .ss-modal[data-fullscreen] {
162
+ width: 100vw;
163
+ height: 100vh;
164
+ max-width: none;
165
+ max-height: none;
166
+ margin: 0;
167
+ border: 0;
168
+ }
169
+ @supports (height: 100dvh) {
170
+ .ss-modal[data-fullscreen] {
171
+ width: 100dvw;
172
+ height: 100dvh;
173
+ }
174
+ }
151
175
 
152
176
  .panel {
153
177
  display: flex;
@@ -155,6 +179,21 @@
155
179
  max-height: inherit;
156
180
  }
157
181
 
182
+ .ss-modal[data-fullscreen] .panel {
183
+ height: 100%;
184
+ max-height: none;
185
+ }
186
+
187
+ .ss-modal[data-fullscreen] .head,
188
+ .ss-modal[data-fullscreen] .foot {
189
+ flex: none;
190
+ }
191
+
192
+ .ss-modal[data-fullscreen] .body {
193
+ flex: 1 1 auto;
194
+ min-height: 0;
195
+ }
196
+
158
197
  .head {
159
198
  display: flex;
160
199
  align-items: center;
@@ -7,6 +7,14 @@ interface Props {
7
7
  title?: string;
8
8
  /** Token size (sm|md|lg); controls max-width. Inherits the global size when unset. */
9
9
  size?: Size;
10
+ /**
11
+ * Fill the viewport instead of rendering a centred, capped panel (DS-0145).
12
+ * The size axis no longer affects width, and — since the panel is full-bleed —
13
+ * there is no backdrop left to click, so `closeOnBackdrop` is unreachable:
14
+ * the close button and Esc are the exits. Drive responsiveness from the
15
+ * caller (`fullscreen={width < 640}`). @default false
16
+ */
17
+ fullscreen?: boolean;
10
18
  /** Clicking the backdrop (outside the panel) closes the modal. @default true */
11
19
  closeOnBackdrop?: boolean;
12
20
  /** Esc closes the modal. When false, Esc is swallowed (cancel prevented). @default true */
@@ -6,8 +6,14 @@
6
6
  type Placement = 'top' | 'bottom' | 'left' | 'right'
7
7
 
8
8
  interface Props {
9
- /** Tooltip text (the accessible description of the trigger). */
10
- text: string
9
+ /**
10
+ * Tooltip content (the accessible description of the trigger): a plain string, or a
11
+ * snippet for a small rendered template. Snippets must stay **phrasing content**
12
+ * (`code`, `strong`, `kbd`, `br`, `Icon`, …) and must not contain interactive
13
+ * elements — the tip is `pointer-events: none` and hidden while closed, per the
14
+ * WAI-ARIA tooltip pattern.
15
+ */
16
+ text: string | Snippet
11
17
  /** Where the tooltip attaches relative to the trigger. Default `top`. */
12
18
  placement?: Placement
13
19
  /** Token size (sm|md|lg); inherits the global size when unset. */
@@ -36,6 +42,9 @@
36
42
  }
37
43
 
38
44
  const sizeAttr = $derived(resolveComponentSize('Tooltip', size))
45
+
46
+ // Snippets are functions, so a runtime typeof check narrows the union.
47
+ const tipSnippet = $derived(typeof text === 'function' ? text : undefined)
39
48
  </script>
40
49
 
41
50
  <!--
@@ -44,6 +53,9 @@
44
53
  tooltip; Escape dismisses it. While open the wrapper carries aria-describedby
45
54
  pointing at the tooltip; the tip itself is kept in the DOM but hidden (and
46
55
  given `hidden`) when closed so it is never announced.
56
+
57
+ `text` is either a string or a snippet (DS-0144); a snippet renders inside the
58
+ same tip element, so the accessible description stays whatever the tip contains.
47
59
  -->
48
60
  <!-- svelte-ignore a11y_no_static_element_interactions -- the wrapper is a passive
49
61
  container; the real interactive element is the trigger snippet inside it, and the
@@ -60,7 +72,9 @@
60
72
  onkeydown={onKeydown}
61
73
  >
62
74
  <span class="trigger">{@render children()}</span>
63
- <span id={tipId} class="tip" class:open role="tooltip" hidden={!open}>{text}</span>
75
+ <span id={tipId} class="tip" class:open role="tooltip" hidden={!open}>
76
+ {#if tipSnippet}{@render tipSnippet()}{:else}{text}{/if}
77
+ </span>
64
78
  </span>
65
79
 
66
80
  <style>.ss-tooltip {
@@ -75,6 +89,7 @@
75
89
  .tip {
76
90
  position: absolute;
77
91
  z-index: 60;
92
+ display: block;
78
93
  width: max-content;
79
94
  max-width: var(--ss-tooltip-max-w, 240px);
80
95
  padding: var(--ss-tooltip-py, 4px) var(--ss-tooltip-px, 8px);
@@ -3,8 +3,14 @@ import { type Size } from '../config.js';
3
3
  /** Side the tooltip attaches to relative to the trigger. */
4
4
  type Placement = 'top' | 'bottom' | 'left' | 'right';
5
5
  interface Props {
6
- /** Tooltip text (the accessible description of the trigger). */
7
- text: string;
6
+ /**
7
+ * Tooltip content (the accessible description of the trigger): a plain string, or a
8
+ * snippet for a small rendered template. Snippets must stay **phrasing content**
9
+ * (`code`, `strong`, `kbd`, `br`, `Icon`, …) and must not contain interactive
10
+ * elements — the tip is `pointer-events: none` and hidden while closed, per the
11
+ * WAI-ARIA tooltip pattern.
12
+ */
13
+ text: string | Snippet;
8
14
  /** Where the tooltip attaches relative to the trigger. Default `top`. */
9
15
  placement?: Placement;
10
16
  /** Token size (sm|md|lg); inherits the global size when unset. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dssoca",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Svelte 5 design system — signal green on near-black, monospace-forward, zero border-radius; configured along two axes (color: dark/light, density: comfy/compact).",
5
5
  "license": "MIT",
6
6
  "author": "Rafael Passoca",