@widgetic/design-system 0.5.33 → 0.5.35

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 (38) hide show
  1. package/dist/components/chat/ChatAlertCard.svelte +56 -0
  2. package/dist/components/chat/ChatAlertCard.svelte.d.ts +12 -0
  3. package/dist/components/chat/ChatHeader.svelte +5 -3
  4. package/dist/components/chat/Composer.svelte +8 -2
  5. package/dist/components/chat/Composer.svelte.d.ts +2 -0
  6. package/dist/components/chat/SuggestionCard.svelte +3 -2
  7. package/dist/components/chat/chatHeaderLogic.d.ts +1 -1
  8. package/dist/components/chat/chatHeaderLogic.js +3 -1
  9. package/dist/components/chat/composerLogic.d.ts +3 -2
  10. package/dist/components/chat/composerLogic.js +3 -2
  11. package/dist/components/chat/index.d.ts +1 -0
  12. package/dist/components/chat/index.js +2 -0
  13. package/dist/components/color-picker/ColorPicker.svelte +14 -2
  14. package/dist/components/color-picker/ColorPicker.svelte.d.ts +7 -0
  15. package/dist/components/creator/CanvasBoardStatusChip.svelte +62 -0
  16. package/dist/components/creator/CanvasBoardStatusChip.svelte.d.ts +14 -0
  17. package/dist/components/creator/CreatorBar.svelte +147 -0
  18. package/dist/components/creator/CreatorBar.svelte.d.ts +28 -0
  19. package/dist/components/creator/index.d.ts +3 -0
  20. package/dist/components/creator/index.js +2 -0
  21. package/dist/components/index.d.ts +2 -0
  22. package/dist/components/index.js +1 -0
  23. package/dist/components/navigation/Breadcrumbs.svelte +4 -1
  24. package/dist/components/shell/AppShell.svelte +16 -4
  25. package/dist/components/shell/AppShell.svelte.d.ts +1 -0
  26. package/dist/components/shell/NavSectionLabel.svelte +4 -1
  27. package/dist/components/shell/SettingsDialog.svelte +11 -13
  28. package/dist/components/shell/SettingsNav.svelte +11 -3
  29. package/dist/components/shell/WidgetRow.svelte +2 -2
  30. package/dist/components/shell/WidgetRow.svelte.d.ts +1 -1
  31. package/dist/components/toast/ToasterModal.svelte +14 -9
  32. package/dist/components/toast/ToasterModal.svelte.d.ts +1 -1
  33. package/dist/components/toast/toastQueue.d.ts +13 -0
  34. package/dist/components/toast/toastQueue.js +78 -0
  35. package/dist/styles/global.css +3 -3
  36. package/dist/utils/toastMotion.d.ts +4 -4
  37. package/dist/utils/toastMotion.js +4 -4
  38. package/package.json +1 -1
@@ -0,0 +1,56 @@
1
+ <!--
2
+ Figma Alert (526:3205): the card the chat shows when a reply failed, in place of a red line of text.
3
+ 408x86 in the 440px panel: rounded-xl, border, px 16 / py 12, a 16px warning icon, a title (Body/Medium) and a description
4
+ (Body, 90% of the destructive colour), and one outline Small button ("Try again") on the right, 8px below the text's centre.
5
+ Built on the DS Alert (grid with an icon column): the button is a third grid column. The Figma stroke sits inside the frame,
6
+ so the padding is one pixel smaller on every side than the Figma value (the border adds it back).
7
+ -->
8
+ <script lang="ts">
9
+ import type { HTMLAttributes } from 'svelte/elements';
10
+ import IconAlertTriangle from '@tabler/icons-svelte/icons/alert-triangle';
11
+ import { cn } from '../../utils.js';
12
+ import { Alert, AlertDescription, AlertTitle } from '../ui/alert/index.js';
13
+ import { Button } from '../ui/button/index.js';
14
+
15
+ export type ChatAlertCardProps = HTMLAttributes<HTMLDivElement> & {
16
+ title: string;
17
+ description?: string;
18
+ /** Text of the button; no button when empty. */
19
+ actionLabel?: string;
20
+ onAction?: () => void;
21
+ class?: string;
22
+ };
23
+
24
+ let { title, description = '', actionLabel = '', onAction, class: className, ...restProps }: ChatAlertCardProps = $props();
25
+
26
+ /** Whether the card has a button (a label and a handler). */
27
+ const hasAction = $derived(Boolean(actionLabel) && typeof onAction === 'function');
28
+ </script>
29
+
30
+ <Alert
31
+ {...restProps}
32
+ variant="destructive"
33
+ data-testid="chat-alert-card"
34
+ class={cn(
35
+ 'w-full gap-x-3 gap-y-0.5 p-[11px] ps-[15px] pe-[15px]',
36
+ hasAction && 'has-[>svg]:grid-cols-[auto_1fr_auto]',
37
+ className
38
+ )}
39
+ >
40
+ <IconAlertTriangle aria-hidden="true" />
41
+ <AlertTitle>{title}</AlertTitle>
42
+ {#if description}
43
+ <AlertDescription class="text-destructive/90">{description}</AlertDescription>
44
+ {/if}
45
+ {#if hasAction}
46
+ <Button
47
+ data-testid="chat-alert-card-action"
48
+ variant="outline"
49
+ size="sm"
50
+ class="col-start-3 row-span-2 row-start-1 mt-2 h-8 self-center"
51
+ onclick={onAction}
52
+ >
53
+ {actionLabel}
54
+ </Button>
55
+ {/if}
56
+ </Alert>
@@ -0,0 +1,12 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export type ChatAlertCardProps = HTMLAttributes<HTMLDivElement> & {
3
+ title: string;
4
+ description?: string;
5
+ /** Text of the button; no button when empty. */
6
+ actionLabel?: string;
7
+ onAction?: () => void;
8
+ class?: string;
9
+ };
10
+ declare const ChatAlertCard: import("svelte").Component<ChatAlertCardProps, {}, "">;
11
+ type ChatAlertCard = ReturnType<typeof ChatAlertCard>;
12
+ export default ChatAlertCard;
@@ -74,7 +74,8 @@
74
74
 
75
75
  const messages = $derived({ ...defaultMessages, ...messagesProp });
76
76
  const displayTitle = $derived(title?.trim() || messages.newChat);
77
- const consoleVisible = $derived(shouldShowConsoleButton(showConsole, onToggleConsole));
77
+ const consoleVisible = $derived(shouldShowConsoleButton(showConsole, onToggleConsole, layout));
78
+ const consoleDisabled = $derived(consoleVisible && typeof onToggleConsole !== 'function');
78
79
  const pinVisible = $derived(shouldShowPinButton(showConsole, onToggleConsole, onPin));
79
80
  </script>
80
81
 
@@ -82,7 +83,7 @@
82
83
  bind:this={ref}
83
84
  class={cn(
84
85
  'flex h-14 shrink-0 items-center gap-1 px-3',
85
- layout === 'panel' && 'w-chat-panel max-w-full',
86
+ layout === 'panel' && 'w-full max-w-full',
86
87
  layout === 'fullscreen' && 'max-w-content w-full',
87
88
  className
88
89
  )}
@@ -110,7 +111,8 @@
110
111
  variant="ghost"
111
112
  label={messages.console}
112
113
  aria-pressed={consoleOpen}
113
- onclick={onToggleConsole}
114
+ disabled={consoleDisabled}
115
+ onclick={() => onToggleConsole?.()}
114
116
  >
115
117
  <IconTerminal2 class="stroke-2" />
116
118
  </IconButton>
@@ -33,6 +33,8 @@
33
33
  messages?: Partial<ComposerMessages>;
34
34
  onSend?: (text: string) => void;
35
35
  onStop?: () => void;
36
+ /** Figma side panel uses arrow-up on the primary send control; default is paper-plane. */
37
+ sendIcon?: 'send' | 'arrow-up';
36
38
  leading?: Snippet;
37
39
  trailing?: Snippet;
38
40
  attachments?: Snippet;
@@ -43,6 +45,7 @@
43
45
  import IconCheck from '@tabler/icons-svelte/icons/check';
44
46
  import IconChevronDown from '@tabler/icons-svelte/icons/chevron-down';
45
47
  import IconPlayerStop from '@tabler/icons-svelte/icons/player-stop';
48
+ import IconArrowUp from '@tabler/icons-svelte/icons/arrow-up';
46
49
  import IconSend from '@tabler/icons-svelte/icons/send';
47
50
  import { cn } from '../../utils.js';
48
51
  import { Button } from '../ui/button/index.js';
@@ -77,6 +80,7 @@
77
80
  messages: messagesProp,
78
81
  onSend,
79
82
  onStop,
83
+ sendIcon = 'send',
80
84
  leading,
81
85
  trailing,
82
86
  attachments,
@@ -138,7 +142,7 @@
138
142
  <div
139
143
  bind:this={ref}
140
144
  class={cn(
141
- 'max-w-content rounded-card border-input bg-background flex w-full flex-col gap-2 border p-3',
145
+ 'max-w-content rounded-card border-input bg-background flex w-full flex-col gap-2 border p-[11px]',
142
146
  disabled && 'pointer-events-none opacity-50',
143
147
  className
144
148
  )}
@@ -153,7 +157,7 @@
153
157
  bind:this={textareaRef}
154
158
  bind:value
155
159
  class="text-body text-foreground placeholder:text-muted-foreground block w-full resize-none overflow-y-auto border-0 bg-transparent outline-hidden focus-visible:outline-hidden disabled:cursor-not-allowed"
156
- style="min-height: 3rem; max-height: 7.5rem;"
160
+ style="min-height: 2.75rem; max-height: 7.5rem;"
157
161
  {placeholder}
158
162
  {disabled}
159
163
  aria-invalid={overLimit ? true : undefined}
@@ -221,6 +225,8 @@
221
225
  >
222
226
  {#if busy}
223
227
  <IconPlayerStop class="size-4 stroke-2" aria-hidden="true" />
228
+ {:else if sendIcon === 'arrow-up'}
229
+ <IconArrowUp class="size-4 stroke-2" aria-hidden="true" />
224
230
  {:else}
225
231
  <IconSend class="size-4 stroke-2" aria-hidden="true" />
226
232
  {/if}
@@ -26,6 +26,8 @@ export type ComposerProps = HTMLAttributes<HTMLDivElement> & {
26
26
  messages?: Partial<ComposerMessages>;
27
27
  onSend?: (text: string) => void;
28
28
  onStop?: () => void;
29
+ /** Figma side panel uses arrow-up on the primary send control; default is paper-plane. */
30
+ sendIcon?: 'send' | 'arrow-up';
29
31
  leading?: Snippet;
30
32
  trailing?: Snippet;
31
33
  attachments?: Snippet;
@@ -1,5 +1,6 @@
1
1
  <!--
2
- Figma: Suggestion Card (component set 48:3, page Suggestion Card)
2
+ Figma: Suggestion Card (component set 48:3, page Suggestion Card). The Figma stroke sits inside the frame, so the padding is 15/11 plus the 1px
3
+ border (16/12 in Figma): a card is 44 tall (76 with a two-line description), as in the frames.
3
4
  -->
4
5
  <script lang="ts">
5
6
  import type { Snippet } from 'svelte';
@@ -57,7 +58,7 @@
57
58
  disabled={disabled || undefined}
58
59
  title={disabled ? messages.unavailable : undefined}
59
60
  class={cn(
60
- 'group rounded-card border-border bg-card duration-fast flex w-full max-w-full items-center gap-3 border px-4 py-3 text-start transition-colors',
61
+ 'group rounded-card border-border bg-card duration-fast flex w-full max-w-full items-center gap-3 border px-[15px] py-[11px] text-start transition-colors',
61
62
  'hover:bg-accent focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',
62
63
  'disabled:pointer-events-none disabled:opacity-50',
63
64
  className
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Whether the chat header shows the debug console control instead of the pin control.
3
3
  */
4
- export declare function shouldShowConsoleButton(showConsole: boolean, onToggleConsole?: (() => void) | null): boolean;
4
+ export declare function shouldShowConsoleButton(showConsole: boolean, onToggleConsole?: (() => void) | null, layout?: 'panel' | 'fullscreen'): boolean;
5
5
  /**
6
6
  * Pin stays available for hosts that still use it; hidden when the console control is shown.
7
7
  */
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Whether the chat header shows the debug console control instead of the pin control.
3
3
  */
4
- export function shouldShowConsoleButton(showConsole, onToggleConsole) {
4
+ export function shouldShowConsoleButton(showConsole, onToggleConsole, layout = 'fullscreen') {
5
+ if (layout === 'panel' && showConsole)
6
+ return true;
5
7
  return showConsole && typeof onToggleConsole === 'function';
6
8
  }
7
9
  /**
@@ -1,7 +1,8 @@
1
1
  /** Max auto-grow height for the composer textarea (matches product chat input). */
2
2
  export declare const COMPOSER_TEXTAREA_MAX_HEIGHT_PX = 120;
3
- /** Initial textarea row area height from the Figma Composer default tree. */
4
- export declare const COMPOSER_TEXTAREA_MIN_HEIGHT_PX = 48;
3
+ /** Initial textarea height: the Figma Composer default tree has a 48px text frame with 4px of padding on top, so 44px of
4
+ * text area (the composer is then 112px: 2px border + 22px padding + 48 + 8 gap + 32 footer). */
5
+ export declare const COMPOSER_TEXTAREA_MIN_HEIGHT_PX = 44;
5
6
  /** Whether Enter should submit (Shift+Enter inserts a newline; IME composition must not send). */
6
7
  export declare function shouldSendOnKeyDown(key: string, shiftKey: boolean, isComposing: boolean): boolean;
7
8
  /** Clamp measured scroll height between min and max for autosize. */
@@ -1,7 +1,8 @@
1
1
  /** Max auto-grow height for the composer textarea (matches product chat input). */
2
2
  export const COMPOSER_TEXTAREA_MAX_HEIGHT_PX = 120;
3
- /** Initial textarea row area height from the Figma Composer default tree. */
4
- export const COMPOSER_TEXTAREA_MIN_HEIGHT_PX = 48;
3
+ /** Initial textarea height: the Figma Composer default tree has a 48px text frame with 4px of padding on top, so 44px of
4
+ * text area (the composer is then 112px: 2px border + 22px padding + 48 + 8 gap + 32 footer). */
5
+ export const COMPOSER_TEXTAREA_MIN_HEIGHT_PX = 44;
5
6
  /** Whether Enter should submit (Shift+Enter inserts a newline; IME composition must not send). */
6
7
  export function shouldSendOnKeyDown(key, shiftKey, isComposing) {
7
8
  if (isComposing)
@@ -2,6 +2,7 @@ export { Chip } from '../ui/chip';
2
2
  export { IconButton } from '../ui/icon-button';
3
3
  export { default as Composer, type ComposerMessages, type ComposerProps } from './Composer.svelte';
4
4
  export { default as Message, type MessageMessages, type MessageProps, type MessageRole } from './Message.svelte';
5
+ export { default as ChatAlertCard, type ChatAlertCardProps } from './ChatAlertCard.svelte';
5
6
  export { default as ActivityRow, type ActivityRowProps, type ActivityRowStatus } from './ActivityRow.svelte';
6
7
  export { default as OptionRow, type OptionRowProps, type OptionRowSelectionMode } from './OptionRow.svelte';
7
8
  export { default as TaskRow, type TaskRowProps, type TaskRowStatus } from './TaskRow.svelte';
@@ -6,6 +6,8 @@ export { Chip } from '../ui/chip';
6
6
  export { IconButton } from '../ui/icon-button';
7
7
  export { default as Composer } from './Composer.svelte';
8
8
  export { default as Message } from './Message.svelte';
9
+ // The card a failed reply is shown in (Figma Alert 526:3205), with its "Try again" button.
10
+ export { default as ChatAlertCard } from './ChatAlertCard.svelte';
9
11
  export { default as ActivityRow } from './ActivityRow.svelte';
10
12
  export { default as OptionRow } from './OptionRow.svelte';
11
13
  export { default as TaskRow } from './TaskRow.svelte';
@@ -38,10 +38,17 @@
38
38
  maxSwatches?: number;
39
39
  /** Shows the hex field and the button; off for a picker that only changes `value`. */
40
40
  showConfirm?: boolean;
41
+ /**
42
+ * Shows the Add button next to the hex field. Off for a picker whose caller saves when it closes: Enter in the hex field
43
+ * still calls `onConfirm`, so a typed colour can be taken at once.
44
+ */
45
+ showConfirmButton?: boolean;
41
46
  /** Called with `#RRGGBB` when Add is pressed, or Enter in the hex field. */
42
47
  onConfirm?: (hex: string) => void;
43
48
  /** Called with `#RRGGBB` every time the colour changes, while the person drags or types. */
44
49
  onChange?: (hex: string) => void;
50
+ /** Live preview while dragging or typing; same timing as `onChange`, for callers that prefer an input-style name. */
51
+ onInput?: (hex: string) => void;
45
52
  messages?: Partial<ColorPickerMessages>;
46
53
  };
47
54
  </script>
@@ -85,8 +92,10 @@
85
92
  swatches = [],
86
93
  maxSwatches = 5,
87
94
  showConfirm = true,
95
+ showConfirmButton = true,
88
96
  onConfirm,
89
97
  onChange,
98
+ onInput,
90
99
  messages: messagesProp,
91
100
  ...restProps
92
101
  }: ColorPickerProps = $props();
@@ -135,6 +144,7 @@
135
144
  if (!keepTyped) hexText = hex;
136
145
  value = hex;
137
146
  onChange?.(hex);
147
+ onInput?.(hex);
138
148
  }
139
149
 
140
150
  // ---- saturation and brightness area
@@ -240,7 +250,7 @@
240
250
  <div class={cn('flex w-full flex-col', className)} {...restProps}>
241
251
  <div class="flex flex-col gap-3 p-3">
242
252
  {#if shownSwatches.length > 0}
243
- <div class="flex gap-2">
253
+ <div class="flex w-full justify-start gap-2" dir="ltr">
244
254
  {#each shownSwatches as swatch (swatch)}
245
255
  <button
246
256
  type="button"
@@ -318,7 +328,9 @@
318
328
  onblur={handleHexBlur}
319
329
  onkeydown={handleHexKeydown}
320
330
  />
321
- <Button type="button" size="sm" disabled={typedHex === null} onclick={confirm}>{messages.add}</Button>
331
+ {#if showConfirmButton}
332
+ <Button type="button" size="sm" disabled={typedHex === null} onclick={confirm}>{messages.add}</Button>
333
+ {/if}
322
334
  </div>
323
335
  {/if}
324
336
  </div>
@@ -23,10 +23,17 @@ export type ColorPickerProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'>
23
23
  maxSwatches?: number;
24
24
  /** Shows the hex field and the button; off for a picker that only changes `value`. */
25
25
  showConfirm?: boolean;
26
+ /**
27
+ * Shows the Add button next to the hex field. Off for a picker whose caller saves when it closes: Enter in the hex field
28
+ * still calls `onConfirm`, so a typed colour can be taken at once.
29
+ */
30
+ showConfirmButton?: boolean;
26
31
  /** Called with `#RRGGBB` when Add is pressed, or Enter in the hex field. */
27
32
  onConfirm?: (hex: string) => void;
28
33
  /** Called with `#RRGGBB` every time the colour changes, while the person drags or types. */
29
34
  onChange?: (hex: string) => void;
35
+ /** Live preview while dragging or typing; same timing as `onChange`, for callers that prefer an input-style name. */
36
+ onInput?: (hex: string) => void;
30
37
  messages?: Partial<ColorPickerMessages>;
31
38
  };
32
39
  declare const ColorPicker: import("svelte").Component<ColorPickerProps, {}, "value">;
@@ -0,0 +1,62 @@
1
+ <!--
2
+ Figma Generation Chip (Ready 177x28 / Generating / Failed 347x40), centred 16px under the top of the sketch canvas.
3
+ One pill: pl-3 pr-1 py-1, gap 8, a 16px icon, the label in Body/Medium (14/20), an optional action button (32px, Figma "action")
4
+ and the Shadow/Floating shadow. The Figma stroke sits inside the frame, so the border is part of the 4px padding (no extra size).
5
+ -->
6
+ <script lang="ts">
7
+ import type { HTMLAttributes } from 'svelte/elements';
8
+ import IconCircleCheck from '@tabler/icons-svelte/icons/circle-check';
9
+ import IconLoader2 from '@tabler/icons-svelte/icons/loader-2';
10
+ import IconAlertTriangle from '@tabler/icons-svelte/icons/alert-triangle';
11
+ import { cn } from '../../utils.js';
12
+ import { Button } from '../ui/button/index.js';
13
+
14
+ export type CanvasBoardStatusChipVariant = 'ready' | 'generating' | 'failed';
15
+
16
+ type Props = HTMLAttributes<HTMLDivElement> & {
17
+ variant: CanvasBoardStatusChipVariant;
18
+ label: string;
19
+ /** Text of the action button inside the chip (Figma "Customize" on Ready, "Try again" on Failed); no button when empty. */
20
+ actionLabel?: string;
21
+ /** Click handler of the action button; the chip takes pointer events only when it has an action. */
22
+ onAction?: () => void;
23
+ class?: string;
24
+ };
25
+
26
+ let { variant, label, actionLabel = '', onAction, class: className, ...restProps }: Props = $props();
27
+
28
+ /** Whether the chip carries an action button (and so must receive clicks). */
29
+ const hasAction = $derived(Boolean(actionLabel) && typeof onAction === 'function');
30
+ </script>
31
+
32
+ <div
33
+ {...restProps}
34
+ data-testid="canvas-board-status-chip"
35
+ data-variant={variant}
36
+ class={cn(
37
+ 'border-border bg-background text-foreground text-body-medium shadow-floating absolute top-4 left-1/2 z-30 flex -translate-x-1/2 items-center gap-2 rounded-full border py-[3px] ps-[11px] pe-[3px]',
38
+ hasAction ? 'pointer-events-auto' : 'pointer-events-none',
39
+ className
40
+ )}
41
+ role="status"
42
+ >
43
+ {#if variant === 'ready'}
44
+ <IconCircleCheck class="text-brand-foreground size-4 shrink-0 stroke-2" aria-hidden="true" />
45
+ {:else if variant === 'generating'}
46
+ <IconLoader2 class="text-muted-foreground size-4 shrink-0 animate-spin stroke-2" aria-hidden="true" />
47
+ {:else}
48
+ <IconAlertTriangle class="text-destructive size-4 shrink-0 stroke-2" aria-hidden="true" />
49
+ {/if}
50
+ <span class="whitespace-nowrap">{label}</span>
51
+ {#if hasAction}
52
+ <Button
53
+ data-testid="canvas-board-status-chip-action"
54
+ variant="ghost"
55
+ size="sm"
56
+ class="h-8 shrink-0"
57
+ onclick={onAction}
58
+ >
59
+ {actionLabel}
60
+ </Button>
61
+ {/if}
62
+ </div>
@@ -0,0 +1,14 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ export type CanvasBoardStatusChipVariant = 'ready' | 'generating' | 'failed';
3
+ type Props = HTMLAttributes<HTMLDivElement> & {
4
+ variant: CanvasBoardStatusChipVariant;
5
+ label: string;
6
+ /** Text of the action button inside the chip (Figma "Customize" on Ready, "Try again" on Failed); no button when empty. */
7
+ actionLabel?: string;
8
+ /** Click handler of the action button; the chip takes pointer events only when it has an action. */
9
+ onAction?: () => void;
10
+ class?: string;
11
+ };
12
+ declare const CanvasBoardStatusChip: import("svelte").Component<Props, {}, "">;
13
+ type CanvasBoardStatusChip = ReturnType<typeof CanvasBoardStatusChip>;
14
+ export default CanvasBoardStatusChip;
@@ -0,0 +1,147 @@
1
+ <!--
2
+ Figma: Creator Bar (component set 514:43, node 514:43)
3
+ -->
4
+ <script lang="ts">
5
+ import type { HTMLAttributes } from 'svelte/elements';
6
+ import type { Snippet } from 'svelte';
7
+ import IconChevronDown from '@tabler/icons-svelte/icons/chevron-down';
8
+ import IconArrowLeft from '@tabler/icons-svelte/icons/arrow-left';
9
+ import IconAdjustments from '@tabler/icons-svelte/icons/adjustments-horizontal';
10
+ import IconLink from '@tabler/icons-svelte/icons/link';
11
+ import { cn } from '../../utils.js';
12
+ import { Button } from '../ui/button/index.js';
13
+ import { IconButton } from '../ui/icon-button/index.js';
14
+
15
+ export type CreatorBarStatus = string;
16
+
17
+ type Props = HTMLAttributes<HTMLElement> & {
18
+ ref?: HTMLElement | null;
19
+ class?: string;
20
+ title: string;
21
+ /** e.g. "Draft" / "Saved" — Figma Caption/Default, muted */
22
+ status?: string;
23
+ showStatus?: boolean;
24
+ showLiveBadge?: boolean;
25
+ liveLabel?: string;
26
+ showPublish?: boolean;
27
+ publishLabel?: string;
28
+ publishDisabled?: boolean;
29
+ showCustomize?: boolean;
30
+ customizeLabel?: string;
31
+ onBack?: () => void;
32
+ onTitleClick?: () => void;
33
+ onPublish?: () => void;
34
+ onCustomize?: () => void;
35
+ /** Figma: title row always shows ▾ when a sketch menu is available, even before an action is wired. */
36
+ showTitleChevron?: boolean;
37
+ trailing?: Snippet;
38
+ };
39
+
40
+ let {
41
+ ref = $bindable(null),
42
+ class: className,
43
+ title,
44
+ status = 'Draft',
45
+ showStatus = true,
46
+ showLiveBadge = false,
47
+ liveLabel = 'Live',
48
+ showPublish = false,
49
+ publishLabel = 'Publish',
50
+ publishDisabled = false,
51
+ showCustomize = false,
52
+ customizeLabel = 'Customize',
53
+ onBack,
54
+ onTitleClick,
55
+ onPublish,
56
+ onCustomize,
57
+ showTitleChevron = false,
58
+ trailing,
59
+ ...restProps
60
+ }: Props = $props();
61
+
62
+ const titleIsInteractive = $derived(Boolean(onTitleClick) || showTitleChevron);
63
+ </script>
64
+
65
+ <header
66
+ bind:this={ref}
67
+ data-testid="creator-bar"
68
+ data-creator-bar
69
+ class={cn(
70
+ 'border-border flex h-14 shrink-0 items-center gap-2 px-4 py-3',
71
+ '[--creator-bar-btn-h:2rem]',
72
+ className
73
+ )}
74
+ {...restProps}
75
+ >
76
+ {#if onBack}
77
+ <IconButton data-testid="creator-bar-back" variant="ghost" size="default" class="size-8 shrink-0" label="Back" onclick={onBack}>
78
+ <IconArrowLeft class="size-4 stroke-2" />
79
+ </IconButton>
80
+ {/if}
81
+
82
+ {#if titleIsInteractive}
83
+ <Button
84
+ data-testid="creator-bar-title"
85
+ variant="ghost"
86
+ size="sm"
87
+ class="h-8 max-w-[min(100%,14rem)] shrink-0 gap-1 px-2"
88
+ onclick={onTitleClick}
89
+ disabled={!onTitleClick}
90
+ >
91
+ <span class="truncate">{title}</span>
92
+ <IconChevronDown class="size-4 shrink-0 stroke-2" aria-hidden="true" />
93
+ </Button>
94
+ {:else}
95
+ <span class="text-body-medium max-w-[min(100%,14rem)] truncate px-2">{title}</span>
96
+ {/if}
97
+
98
+ {#if showLiveBadge}
99
+ <span
100
+ data-testid="creator-bar-live-badge"
101
+ class="bg-brand-subtle text-brand-foreground text-caption-medium inline-flex h-5 shrink-0 items-center gap-1.5 rounded-full px-2"
102
+ >
103
+ <span class="bg-brand-foreground size-1.5 shrink-0 rounded-full" aria-hidden="true"></span>
104
+ <span class="text-caption-medium">{liveLabel}</span>
105
+ </span>
106
+ {/if}
107
+
108
+ {#if showStatus && status}
109
+ <span data-testid="creator-bar-status" class="text-caption text-muted-foreground shrink-0 whitespace-nowrap">{status}</span>
110
+ {/if}
111
+
112
+ <span class="min-w-0 flex-1" aria-hidden="true"></span>
113
+
114
+ <!--
115
+ Figma 514:69 (Customize) and 514:84 (Publish) are Button Small: h 32, padding 8 and a label box of 4 (so text + 40 with the
116
+ icon, text + 24 without), text 14/20 medium, radius 8, border `input`. The design system's `Button size="sm"` draws exactly
117
+ that, so the buttons stay the design system's Button; no gap or padding is overridden here (a `gap-1.5` made Customize 2px
118
+ wider than Figma) and no colour is written by hand.
119
+ -->
120
+ {#if showCustomize && onCustomize}
121
+ <Button data-testid="creator-bar-customize" variant="outline" size="sm" class="h-8 shrink-0" onclick={onCustomize}>
122
+ {#if showLiveBadge}
123
+ <IconLink class="size-4 shrink-0 stroke-[1.75]" aria-hidden="true" />
124
+ {:else}
125
+ <IconAdjustments class="size-4 shrink-0 stroke-[1.75]" aria-hidden="true" />
126
+ {/if}
127
+ {customizeLabel}
128
+ </Button>
129
+ {/if}
130
+
131
+ {#if showPublish && onPublish}
132
+ <Button
133
+ data-testid="creator-bar-publish"
134
+ variant="default"
135
+ size="sm"
136
+ class="h-8 shrink-0"
137
+ disabled={publishDisabled}
138
+ onclick={onPublish}
139
+ >
140
+ {publishLabel}
141
+ </Button>
142
+ {/if}
143
+
144
+ {#if trailing}
145
+ {@render trailing()}
146
+ {/if}
147
+ </header>
@@ -0,0 +1,28 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { Snippet } from 'svelte';
3
+ export type CreatorBarStatus = string;
4
+ type Props = HTMLAttributes<HTMLElement> & {
5
+ ref?: HTMLElement | null;
6
+ class?: string;
7
+ title: string;
8
+ /** e.g. "Draft" / "Saved" — Figma Caption/Default, muted */
9
+ status?: string;
10
+ showStatus?: boolean;
11
+ showLiveBadge?: boolean;
12
+ liveLabel?: string;
13
+ showPublish?: boolean;
14
+ publishLabel?: string;
15
+ publishDisabled?: boolean;
16
+ showCustomize?: boolean;
17
+ customizeLabel?: string;
18
+ onBack?: () => void;
19
+ onTitleClick?: () => void;
20
+ onPublish?: () => void;
21
+ onCustomize?: () => void;
22
+ /** Figma: title row always shows ▾ when a sketch menu is available, even before an action is wired. */
23
+ showTitleChevron?: boolean;
24
+ trailing?: Snippet;
25
+ };
26
+ declare const CreatorBar: import("svelte").Component<Props, {}, "ref">;
27
+ type CreatorBar = ReturnType<typeof CreatorBar>;
28
+ export default CreatorBar;
@@ -0,0 +1,3 @@
1
+ export { default as CreatorBar } from './CreatorBar.svelte';
2
+ export { default as CanvasBoardStatusChip } from './CanvasBoardStatusChip.svelte';
3
+ export type { CanvasBoardStatusChipVariant } from './CanvasBoardStatusChip.svelte';
@@ -0,0 +1,2 @@
1
+ export { default as CreatorBar } from './CreatorBar.svelte';
2
+ export { default as CanvasBoardStatusChip } from './CanvasBoardStatusChip.svelte';
@@ -5,6 +5,8 @@ export { default as PasswordInput } from './PasswordInput.svelte';
5
5
  export { default as ThumbHashImage } from './ThumbHashImage.svelte';
6
6
  export { default as WScrollArea } from './WScrollArea.svelte';
7
7
  export { Composer, type ComposerMessages, type ComposerProps, Message, type MessageMessages, type MessageProps, type MessageRole, ActivityRow, type ActivityRowProps, type ActivityRowStatus, OptionRow, type OptionRowProps, type OptionRowSelectionMode, TaskRow, type TaskRowProps, type TaskRowStatus, ScrollToBottom, type ScrollToBottomProps, canSendText, clampTextareaHeight, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption, SuggestionCard } from './chat';
8
+ export { CreatorBar, CanvasBoardStatusChip } from './creator';
9
+ export type { CanvasBoardStatusChipVariant } from './creator';
8
10
  export { ColorPicker, type ColorPickerMessages, type ColorPickerProps, normalizeHex, hexToHsv, hsvToHex, type Hsv } from './color-picker';
9
11
  export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
10
12
  export { FontPicker, type FontPickerMessages, type FontPickerProps, filterFonts, fontFamilyCss, type FontPickerFont } from './font-picker';
@@ -6,6 +6,7 @@ export { default as PasswordInput } from './PasswordInput.svelte';
6
6
  export { default as ThumbHashImage } from './ThumbHashImage.svelte';
7
7
  export { default as WScrollArea } from './WScrollArea.svelte';
8
8
  export { Composer, Message, ActivityRow, OptionRow, TaskRow, ScrollToBottom, canSendText, clampTextareaHeight, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption, SuggestionCard } from './chat';
9
+ export { CreatorBar, CanvasBoardStatusChip } from './creator';
9
10
  export { ColorPicker, normalizeHex, hexToHsv, hsvToHex } from './color-picker';
10
11
  export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
11
12
  export { FontPicker, filterFonts, fontFamilyCss } from './font-picker';
@@ -297,7 +297,10 @@
297
297
  <Breadcrumb.Item class="shrink-0">
298
298
  {#if currentPath.length === 0}
299
299
  <!-- At the root the root crumb is the page you are on (Figma Crumbs Depth=Root: foreground) -->
300
- <span class="{crumbTextClass} text-foreground whitespace-nowrap" aria-current="page">
300
+ <span
301
+ class="{crumbTextClass} text-foreground whitespace-nowrap rounded-md px-1"
302
+ aria-current="page"
303
+ >
301
304
  {rootLabel}
302
305
  </span>
303
306
  {:else}
@@ -10,6 +10,8 @@
10
10
  topBarTitle,
11
11
  menuLabel = 'Open navigation',
12
12
  drawerOpen = $bindable(false),
13
+ /** `panel` (default) = rounded white content card; `plain` = grey field, children supply their own cards (Figma project dashboard). */
14
+ contentSurface = 'panel',
13
15
  sidebar,
14
16
  children,
15
17
  topBarAction
@@ -18,10 +20,17 @@
18
20
  topBarTitle: string;
19
21
  menuLabel?: string;
20
22
  drawerOpen?: boolean;
23
+ contentSurface?: 'panel' | 'plain';
21
24
  sidebar?: Snippet;
22
25
  children?: Snippet;
23
26
  topBarAction?: Snippet;
24
27
  } = $props();
28
+
29
+ const contentSurfaceClass = $derived(
30
+ contentSurface === 'plain'
31
+ ? 'border-transparent bg-transparent shadow-none rounded-none'
32
+ : 'rounded-panel border-border bg-background border shadow-none'
33
+ );
25
34
  </script>
26
35
 
27
36
  <div class={cn('bg-muted flex h-full min-h-screen', className)}>
@@ -37,10 +46,13 @@
37
46
  action={topBarAction}
38
47
  />
39
48
 
40
- <div class="flex min-h-0 flex-1 flex-col gap-2 p-2 lg:ps-0">
41
- <div
42
- class="rounded-panel border-border bg-background flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden border shadow-none"
43
- >
49
+ <div
50
+ class={cn(
51
+ 'flex min-h-0 flex-1 flex-col gap-2 lg:ps-0',
52
+ contentSurface === 'plain' ? 'pt-2 pe-2 pb-2 ps-0' : 'p-2'
53
+ )}
54
+ >
55
+ <div class={cn('flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden', contentSurfaceClass)}>
44
56
  {@render children?.()}
45
57
  </div>
46
58
  </div>
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  topBarTitle: string;
5
5
  menuLabel?: string;
6
6
  drawerOpen?: boolean;
7
+ contentSurface?: 'panel' | 'plain';
7
8
  sidebar?: Snippet;
8
9
  children?: Snippet;
9
10
  topBarAction?: Snippet;
@@ -17,7 +17,10 @@
17
17
  </script>
18
18
 
19
19
  <div
20
- class={cn('flex h-8 w-full min-w-0 items-center gap-2 py-1 ps-3 pe-2 pb-1 text-start', className)}
20
+ class={cn(
21
+ 'flex h-8 w-full min-w-0 items-center gap-2 px-2 pt-3 pb-1 text-start',
22
+ className
23
+ )}
21
24
  {...restProps}
22
25
  >
23
26
  <span class="text-caption-medium text-muted-foreground min-w-0 flex-1 truncate">{label}</span>
@@ -110,12 +110,11 @@
110
110
  );
111
111
  }
112
112
 
113
- // Parent keeps pe-8 (32px). A native bar always sits against the content box, so when the page scrolls we
114
- // (1) pull the scroll area into that padding and (2) add matching padding-right so the cards stay on the
115
- // pe-8 line and the bar is centred in the leftover space between the cards and the dialog edge.
113
+ // Parent keeps pe-8 (32px): the cards of a page end on that line. When the page scrolls we pull the scroll area into that
114
+ // padding, so the bar is drawn in the margin right of the cards, close to the dialog edge, and never over a card.
116
115
  const PANE_RIGHT_PADDING_PX = 32;
117
- /** Moves the scroll rail toward the dialog edge while the content line stays on pe-8. */
118
- const SCROLLBAR_SHIFT_TOWARD_EDGE_PX = 8;
116
+ /** How far the bar sits from the dialog's edge (the border is outside it). */
117
+ const SCROLLBAR_EDGE_GAP_PX = 2;
119
118
  let paneScrollStyle = $state('');
120
119
 
121
120
  function overlayScrollbar(node: HTMLElement) {
@@ -125,16 +124,15 @@
125
124
  paneScrollStyle = '';
126
125
  return;
127
126
  }
128
- // Read the real bar width (often ~14px in Chromium, 8px when thin styles apply).
129
- const barWidth = Math.max(node.offsetWidth - node.clientWidth, 8);
130
- const outerGap = Math.max(
131
- (PANE_RIGHT_PADDING_PX - barWidth) / 2 - SCROLLBAR_SHIFT_TOWARD_EDGE_PX,
132
- 0
133
- );
134
- const pull = PANE_RIGHT_PADDING_PX - outerGap;
127
+ // A classic bar takes room inside the box (offsetWidth - clientWidth); an overlay bar (macOS with "show scroll bars
128
+ // when scrolling") takes none and is drawn over the padding. Either way the padding that follows the bar is what is
129
+ // left of the pull, so the content keeps ending on the pe-8 line and the bar never covers it.
130
+ const barLayoutWidth = Math.max(node.offsetWidth - node.clientWidth, 0);
131
+ const pull = PANE_RIGHT_PADDING_PX - SCROLLBAR_EDGE_GAP_PX;
132
+ const contentGap = Math.max(pull - barLayoutWidth, 0);
135
133
  // End side, not the right: the bar sits at the inline end of the page, so a dialog read right to left mirrors it
136
134
  // (tests/rtl/sourcePlacement.test.ts fails on a physical side). Left to right, this is margin-right/padding-right.
137
- paneScrollStyle = `margin-inline-end: -${pull}px; padding-inline-end: ${outerGap}px`;
135
+ paneScrollStyle = `margin-inline-end: -${pull}px; padding-inline-end: ${contentGap}px`;
138
136
  }
139
137
  const resizeObserver = new ResizeObserver(check);
140
138
  resizeObserver.observe(node);
@@ -70,9 +70,17 @@
70
70
  {/each}
71
71
  </nav>
72
72
  {:else}
73
- <nav class={cn('flex w-full flex-col gap-0.5', className)} aria-label="Settings" {...restProps}>
74
- {#each groups as group (group.id)}
75
- <div class="flex flex-col gap-0.5">
73
+ <nav
74
+ class={cn('flex w-full flex-col gap-0.5', className)}
75
+ aria-label="Settings"
76
+ data-testid="settings-nav"
77
+ {...restProps}
78
+ >
79
+ {#each groups as group, groupIndex (group.id)}
80
+ <div
81
+ class={cn('flex flex-col gap-0.5', groupIndex > 0 && 'mt-3')}
82
+ data-testid="settings-nav-group-{group.id}"
83
+ >
76
84
  <NavSectionLabel label={group.label} />
77
85
  {#each group.items as item (item.id)}
78
86
  {@const active = settingsNavItemIsActive(activeId, item.id)}
@@ -50,7 +50,7 @@
50
50
  meta?: string;
51
51
  showBadge?: boolean;
52
52
  badgeLabel?: string;
53
- /** Figma 55:441 — Published uses the green pill; Draft is plain neutral text without a dot. */
53
+ /** Figma Badge — Published uses `secondary` (brand) with dot; Draft uses `default` (neutral grey) without dot. */
54
54
  badgeTone?: 'published' | 'draft';
55
55
  selected?: boolean;
56
56
  loading?: boolean;
@@ -113,7 +113,7 @@
113
113
 
114
114
  {#if showBadge}
115
115
  {#if badgeTone === 'draft'}
116
- <span class="text-caption text-muted-foreground shrink-0 max-sm:hidden">{badgeLabel}</span>
116
+ <Badge variant="default" class="shrink-0 max-sm:hidden">{badgeLabel}</Badge>
117
117
  {:else}
118
118
  <Badge variant="secondary" showDot class="shrink-0 max-sm:hidden">{badgeLabel}</Badge>
119
119
  {/if}
@@ -65,7 +65,7 @@ type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
65
65
  meta?: string;
66
66
  showBadge?: boolean;
67
67
  badgeLabel?: string;
68
- /** Figma 55:441 — Published uses the green pill; Draft is plain neutral text without a dot. */
68
+ /** Figma Badge — Published uses `secondary` (brand) with dot; Draft uses `default` (neutral grey) without dot. */
69
69
  badgeTone?: 'published' | 'draft';
70
70
  selected?: boolean;
71
71
  loading?: boolean;
@@ -10,6 +10,7 @@
10
10
  holdActiveToastsDuringKeyboardFocus,
11
11
  restartDismissCountdownForActiveToasts
12
12
  } from './toastDismissCountdown';
13
+ import { queueShowToast } from './toastQueue.js';
13
14
 
14
15
  type ToastTypes = 'success' | 'error' | 'warning' | 'info' | 'loading';
15
16
 
@@ -54,7 +55,12 @@
54
55
  const toneIcon = toneIcons[type as ToastTypes];
55
56
  if (toneIcon) options.icon = toneIcon;
56
57
 
57
- const { description: _ignoredDescription, ...toastOptions } = options;
58
+ const {
59
+ description: _ignoredDescription,
60
+ action: _stripAction,
61
+ cancel: _stripCancel,
62
+ ...toastOptions
63
+ } = options;
58
64
 
59
65
  let toastKey: ToastTypes = type as ToastTypes;
60
66
  if (typeof toast[toastKey] !== 'function') {
@@ -62,7 +68,7 @@
62
68
  toastKey = 'info';
63
69
  }
64
70
 
65
- return toast[toastKey](line, {
71
+ return queueShowToast(toastKey, line, {
66
72
  ...toastOptions,
67
73
  duration,
68
74
  unstyled: true,
@@ -121,13 +127,12 @@
121
127
  classes: {
122
128
  toast:
123
129
  toastMainClass +
124
- ` !relative !flex !w-max !min-w-0 ${toastMaxWidthClass} !flex-nowrap !items-center !gap-2 !rounded-xl !border !px-4 !py-2.5 !pe-9 !text-sm !font-medium !shadow-none [&>[data-icon]]:!hidden [&>[data-content]]:!min-w-0 [&>[data-content]]:!flex-1 [&>[data-content]]:!truncate`,
130
+ ` !relative !flex !w-max !min-w-0 ${toastMaxWidthClass} !items-center !gap-2 !rounded-xl !border !px-4 !py-2.5 !pe-9 !text-sm !font-medium !shadow-none [&>[data-icon]]:!hidden [&>[data-button]]:!hidden [&>[data-content]]:!min-w-0 [&>[data-content]]:!flex-1`,
125
131
  title:
126
132
  toastMainClass +
127
- '-title !min-w-0 !flex-1 !truncate !whitespace-nowrap !text-inherit',
133
+ '-title !min-w-0 !flex-1 !whitespace-normal !break-words !text-balance !text-inherit',
128
134
  description: toastMainClass + '-description !hidden',
129
- actionButton:
130
- '!h-8 !rounded-lg !border !border-current/30 !bg-transparent !px-2 !text-label !text-inherit hover:!bg-current/15',
135
+ actionButton: '!hidden !pointer-events-none',
131
136
  cancelButton: '',
132
137
  closeButton:
133
138
  toastMainClass +
@@ -140,9 +145,9 @@
140
145
  '!border-transparent !bg-destructive !text-destructive-foreground [&>[data-icon]]:!hidden'
141
146
  }
142
147
  }}
143
- expand={true}
144
- visibleToasts={3}
145
- offset="1rem"
148
+ expand={false}
149
+ visibleToasts={1}
150
+ offset="16px"
146
151
  class="{className} toast-modal-host"
147
152
  style="--width: max-content; --toast-enter-ms: {toastEnterDurationMs}ms; --toast-exit-ms: {toastExitDurationMs}ms;{style}"
148
153
  />
@@ -8,7 +8,7 @@ export declare let element: HTMLElement | null;
8
8
  * `message` is the sentence users see. Legacy callers may still pass `options.description`; it is
9
9
  * only used when `message` is empty, otherwise ignored so the toast stays one line.
10
10
  */
11
- export declare function showToast(type: string | undefined, message: string, options?: Record<string, unknown> | null): string | number;
11
+ export declare function showToast(type: string | undefined, message: string, options?: Record<string, unknown> | null): unknown;
12
12
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
13
13
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
14
14
  $$bindings?: Bindings;
@@ -0,0 +1,13 @@
1
+ /** When the wait list is full, drop the oldest entry so the newest toast is still shown eventually. */
2
+ export declare const TOAST_QUEUE_OVERFLOW_POLICY: "drop-oldest";
3
+ export declare const TOAST_QUEUE_MAX_PENDING = 3;
4
+ export type QueuedToast = {
5
+ key: string;
6
+ type: string;
7
+ line: string;
8
+ options: Record<string, unknown>;
9
+ };
10
+ /** One toast on screen at a time; further `showToast` calls wait in a short queue. */
11
+ export declare function queueShowToast(type: string, line: string, options: Record<string, unknown> | null): unknown;
12
+ /** Test-only reset. */
13
+ export declare function resetToastQueueForTests(): void;
@@ -0,0 +1,78 @@
1
+ import { toast } from '../ui/sonner/index.js';
2
+ /** When the wait list is full, drop the oldest entry so the newest toast is still shown eventually. */
3
+ export const TOAST_QUEUE_OVERFLOW_POLICY = 'drop-oldest';
4
+ export const TOAST_QUEUE_MAX_PENDING = 3;
5
+ let pending = [];
6
+ let presenting = false;
7
+ function queueKey(line) {
8
+ return line.trim();
9
+ }
10
+ function stripInteractiveToastOptions(options) {
11
+ const { action: _action, cancel: _cancel, ...rest } = options;
12
+ return rest;
13
+ }
14
+ function enqueue(item) {
15
+ if (pending.some((entry) => entry.key === item.key))
16
+ return;
17
+ if (pending.length >= TOAST_QUEUE_MAX_PENDING) {
18
+ if (TOAST_QUEUE_OVERFLOW_POLICY === 'drop-oldest')
19
+ pending.shift();
20
+ else
21
+ return;
22
+ }
23
+ pending.push(item);
24
+ }
25
+ function releaseSlot() {
26
+ presenting = false;
27
+ flushQueue();
28
+ }
29
+ function flushQueue() {
30
+ if (presenting || pending.length === 0)
31
+ return;
32
+ presenting = true;
33
+ const item = pending.shift();
34
+ const toastOptions = stripInteractiveToastOptions(item.options);
35
+ const userOnDismiss = toastOptions.onDismiss;
36
+ const userOnAutoClose = toastOptions.onAutoClose;
37
+ const chainedOptions = {
38
+ ...toastOptions,
39
+ onDismiss: (toastInstance) => {
40
+ if (typeof userOnDismiss === 'function')
41
+ userOnDismiss(toastInstance);
42
+ releaseSlot();
43
+ },
44
+ onAutoClose: (toastInstance) => {
45
+ if (typeof userOnAutoClose === 'function')
46
+ userOnAutoClose(toastInstance);
47
+ releaseSlot();
48
+ }
49
+ };
50
+ const presentersByType = toast;
51
+ const presenter = presentersByType[item.type];
52
+ if (typeof presenter === 'function') {
53
+ presenter(item.line, chainedOptions);
54
+ return;
55
+ }
56
+ toast(item.line, {
57
+ ...chainedOptions,
58
+ type: item.type
59
+ });
60
+ }
61
+ /** One toast on screen at a time; further `showToast` calls wait in a short queue. */
62
+ export function queueShowToast(type, line, options) {
63
+ const normalized = stripInteractiveToastOptions(options ?? {});
64
+ const item = { key: queueKey(line), type, line, options: normalized };
65
+ const active = toast.getActiveToasts().filter((entry) => entry.type !== 'loading');
66
+ if (presenting || active.length > 0) {
67
+ enqueue(item);
68
+ return undefined;
69
+ }
70
+ pending.push(item);
71
+ flushQueue();
72
+ return undefined;
73
+ }
74
+ /** Test-only reset. */
75
+ export function resetToastQueueForTests() {
76
+ pending = [];
77
+ presenting = false;
78
+ }
@@ -942,12 +942,12 @@ go 3 levels up in development mode, 2 levels up in production mode*/
942
942
  right: auto !important;
943
943
  transform: translateX(-50%) !important;
944
944
  width: max-content !important;
945
- max-width: min(420px, calc(100vw - 2rem));
945
+ max-width: min(32rem, calc(100vw - 32px));
946
946
  }
947
947
 
948
948
  .toast-modal-host [data-sonner-toast].toast-modal {
949
949
  width: max-content;
950
- max-width: 420px;
950
+ max-width: min(32rem, calc(100vw - 32px));
951
951
  }
952
952
 
953
953
  .toast-modal-host [data-sonner-toast].toast-modal [data-title] {
@@ -1015,7 +1015,7 @@ go 3 levels up in development mode, 2 levels up in production mode*/
1015
1015
  left: auto !important;
1016
1016
  right: auto !important;
1017
1017
  width: max-content !important;
1018
- max-width: min(420px, calc(100vw - 2rem));
1018
+ max-width: min(32rem, calc(100vw - 32px));
1019
1019
  }
1020
1020
  }
1021
1021
 
@@ -6,7 +6,7 @@
6
6
  export declare const toastEnterDurationMs = 200;
7
7
  /** Dismiss fades in place (no slide), slightly quicker than enter. */
8
8
  export declare const toastExitDurationMs = 150;
9
- /** Long titles wrap inside this width (px). */
10
- export declare const toastMaxWidthPx = 420;
11
- /** Literal for Tailwind scanner — keep in sync with `toastMaxWidthPx`. */
12
- export declare const toastMaxWidthClass = "!max-w-[420px]";
9
+ /** Long titles wrap inside this width (px), capped for narrow viewports. */
10
+ export declare const toastMaxWidthPx = 512;
11
+ /** Literal for Tailwind scanner — keep in sync with the toast max-width spec. */
12
+ export declare const toastMaxWidthClass = "!max-w-[min(32rem,calc(100vw-32px))]";
@@ -6,7 +6,7 @@
6
6
  export const toastEnterDurationMs = 200;
7
7
  /** Dismiss fades in place (no slide), slightly quicker than enter. */
8
8
  export const toastExitDurationMs = 150;
9
- /** Long titles wrap inside this width (px). */
10
- export const toastMaxWidthPx = 420;
11
- /** Literal for Tailwind scanner — keep in sync with `toastMaxWidthPx`. */
12
- export const toastMaxWidthClass = '!max-w-[420px]';
9
+ /** Long titles wrap inside this width (px), capped for narrow viewports. */
10
+ export const toastMaxWidthPx = 512;
11
+ /** Literal for Tailwind scanner — keep in sync with the toast max-width spec. */
12
+ export const toastMaxWidthClass = '!max-w-[min(32rem,calc(100vw-32px))]';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/design-system",
3
- "version": "0.5.33",
3
+ "version": "0.5.35",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",