fancy-ui-svelte 0.9.1 → 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.
- package/README.md +8 -102
- package/dist/fancy-ui/_internals/FieldConsumer.test.svelte +25 -0
- package/dist/fancy-ui/_internals/FieldConsumer.test.svelte.d.ts +18 -0
- package/dist/fancy-ui/_internals/FieldHarness.test.svelte +37 -0
- package/dist/fancy-ui/_internals/FieldHarness.test.svelte.d.ts +8 -0
- package/dist/fancy-ui/_internals/Markdown.svelte +227 -0
- package/dist/fancy-ui/_internals/Markdown.svelte.d.ts +24 -0
- package/dist/fancy-ui/_internals/MarkdownInline.svelte +56 -0
- package/dist/fancy-ui/_internals/MarkdownInline.svelte.d.ts +7 -0
- package/dist/fancy-ui/_internals/StreamText.svelte +64 -0
- package/dist/fancy-ui/_internals/StreamText.svelte.d.ts +14 -0
- package/dist/fancy-ui/_internals/StreamText.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/StreamText.test.js +77 -0
- package/dist/fancy-ui/_internals/ai-types.d.ts +117 -0
- package/dist/fancy-ui/_internals/ai-types.js +9 -0
- package/dist/fancy-ui/_internals/anchor-position.d.ts +61 -0
- package/dist/fancy-ui/_internals/anchor-position.js +158 -0
- package/dist/fancy-ui/_internals/anchor-position.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/anchor-position.test.js +205 -0
- package/dist/fancy-ui/_internals/autoscroll.d.ts +30 -0
- package/dist/fancy-ui/_internals/autoscroll.js +149 -0
- package/dist/fancy-ui/_internals/autoscroll.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/autoscroll.test.js +233 -0
- package/dist/fancy-ui/_internals/calendar-core.d.ts +26 -0
- package/dist/fancy-ui/_internals/calendar-core.js +75 -0
- package/dist/fancy-ui/_internals/calendar-core.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/calendar-core.test.js +132 -0
- package/dist/fancy-ui/_internals/clipboard.svelte.d.ts +18 -0
- package/dist/fancy-ui/_internals/clipboard.svelte.js +58 -0
- package/dist/fancy-ui/_internals/clipboard.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/clipboard.test.js +97 -0
- package/dist/fancy-ui/_internals/diff.d.ts +38 -0
- package/dist/fancy-ui/_internals/diff.js +211 -0
- package/dist/fancy-ui/_internals/diff.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/diff.test.js +261 -0
- package/dist/fancy-ui/_internals/dismissable.d.ts +12 -0
- package/dist/fancy-ui/_internals/dismissable.js +63 -0
- package/dist/fancy-ui/_internals/dismissable.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/dismissable.test.js +128 -0
- package/dist/fancy-ui/_internals/elapsed.svelte.d.ts +49 -0
- package/dist/fancy-ui/_internals/elapsed.svelte.js +106 -0
- package/dist/fancy-ui/_internals/elapsed.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/elapsed.test.js +124 -0
- package/dist/fancy-ui/_internals/field.svelte.d.ts +106 -0
- package/dist/fancy-ui/_internals/field.svelte.js +73 -0
- package/dist/fancy-ui/_internals/field.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/field.test.js +223 -0
- package/dist/fancy-ui/_internals/float.d.ts +46 -0
- package/dist/fancy-ui/_internals/float.js +177 -0
- package/dist/fancy-ui/_internals/float.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/float.test.js +242 -0
- package/dist/fancy-ui/_internals/focus-trap.d.ts +18 -0
- package/dist/fancy-ui/_internals/focus-trap.js +135 -0
- package/dist/fancy-ui/_internals/focus-trap.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/focus-trap.test.js +229 -0
- package/dist/fancy-ui/_internals/host.d.ts +38 -0
- package/dist/fancy-ui/_internals/host.js +63 -0
- package/dist/fancy-ui/_internals/host.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/host.test.js +57 -0
- package/dist/fancy-ui/_internals/id.d.ts +11 -0
- package/dist/fancy-ui/_internals/id.js +30 -0
- package/dist/fancy-ui/_internals/id.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/id.test.js +31 -0
- package/dist/fancy-ui/_internals/listbox.svelte.d.ts +50 -0
- package/dist/fancy-ui/_internals/listbox.svelte.js +207 -0
- package/dist/fancy-ui/_internals/listbox.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/listbox.test.js +399 -0
- package/dist/fancy-ui/_internals/markdown-security.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/markdown-security.test.js +258 -0
- package/dist/fancy-ui/_internals/markdown.d.ts +66 -0
- package/dist/fancy-ui/_internals/markdown.js +586 -0
- package/dist/fancy-ui/_internals/markdown.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/markdown.test.js +473 -0
- package/dist/fancy-ui/_internals/menu.svelte.d.ts +74 -0
- package/dist/fancy-ui/_internals/menu.svelte.js +307 -0
- package/dist/fancy-ui/_internals/menu.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/menu.test.js +393 -0
- package/dist/fancy-ui/_internals/portal.d.ts +14 -0
- package/dist/fancy-ui/_internals/portal.js +49 -0
- package/dist/fancy-ui/_internals/portal.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/portal.test.js +57 -0
- package/dist/fancy-ui/_internals/relative-time.d.ts +22 -0
- package/dist/fancy-ui/_internals/relative-time.js +56 -0
- package/dist/fancy-ui/_internals/relative-time.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/relative-time.test.js +56 -0
- package/dist/fancy-ui/_internals/scroll-lock.d.ts +7 -0
- package/dist/fancy-ui/_internals/scroll-lock.js +91 -0
- package/dist/fancy-ui/_internals/scroll-lock.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/scroll-lock.test.js +98 -0
- package/dist/fancy-ui/_internals/stream-text.svelte.d.ts +45 -0
- package/dist/fancy-ui/_internals/stream-text.svelte.js +106 -0
- package/dist/fancy-ui/_internals/stream-text.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/stream-text.test.js +117 -0
- package/dist/fancy-ui/_internals/waveform-core.d.ts +33 -0
- package/dist/fancy-ui/_internals/waveform-core.js +63 -0
- package/dist/fancy-ui/_internals/waveform-core.test.d.ts +1 -0
- package/dist/fancy-ui/_internals/waveform-core.test.js +124 -0
- package/dist/fancy-ui/agent-plan/AgentPlan.svelte +459 -0
- package/dist/fancy-ui/agent-plan/AgentPlan.svelte.d.ts +24 -0
- package/dist/fancy-ui/agent-plan/AgentPlan.test.d.ts +1 -0
- package/dist/fancy-ui/agent-plan/AgentPlan.test.js +305 -0
- package/dist/fancy-ui/agent-plan/README.md +136 -0
- package/dist/fancy-ui/agent-plan/index.d.ts +3 -0
- package/dist/fancy-ui/agent-plan/index.js +2 -0
- package/dist/fancy-ui/ai-data-table/AiDataTable.svelte +214 -0
- package/dist/fancy-ui/ai-data-table/AiDataTable.svelte.d.ts +45 -0
- package/dist/fancy-ui/ai-data-table/AiDataTable.test.d.ts +1 -0
- package/dist/fancy-ui/ai-data-table/AiDataTable.test.js +223 -0
- package/dist/fancy-ui/ai-data-table/README.md +147 -0
- package/dist/fancy-ui/ai-data-table/index.d.ts +3 -0
- package/dist/fancy-ui/ai-data-table/index.js +2 -0
- package/dist/fancy-ui/alert-dialog/AlertDialog.svelte +139 -0
- package/dist/fancy-ui/alert-dialog/AlertDialog.svelte.d.ts +34 -0
- package/dist/fancy-ui/alert-dialog/AlertDialog.test.d.ts +1 -0
- package/dist/fancy-ui/alert-dialog/AlertDialog.test.js +254 -0
- package/dist/fancy-ui/alert-dialog/README.md +75 -0
- package/dist/fancy-ui/alert-dialog/index.d.ts +2 -0
- package/dist/fancy-ui/alert-dialog/index.js +2 -0
- package/dist/fancy-ui/approval-card/ApprovalCard.svelte +299 -0
- package/dist/fancy-ui/approval-card/ApprovalCard.svelte.d.ts +35 -0
- package/dist/fancy-ui/approval-card/ApprovalCard.test.d.ts +1 -0
- package/dist/fancy-ui/approval-card/ApprovalCard.test.js +175 -0
- package/dist/fancy-ui/approval-card/ApprovalCardHarness.test.svelte +35 -0
- package/dist/fancy-ui/approval-card/ApprovalCardHarness.test.svelte.d.ts +13 -0
- package/dist/fancy-ui/approval-card/README.md +116 -0
- package/dist/fancy-ui/approval-card/index.d.ts +3 -0
- package/dist/fancy-ui/approval-card/index.js +2 -0
- package/dist/fancy-ui/artifact-card/ArtifactCard.svelte +362 -0
- package/dist/fancy-ui/artifact-card/ArtifactCard.svelte.d.ts +35 -0
- package/dist/fancy-ui/artifact-card/ArtifactCard.test.d.ts +1 -0
- package/dist/fancy-ui/artifact-card/ArtifactCard.test.js +214 -0
- package/dist/fancy-ui/artifact-card/README.md +124 -0
- package/dist/fancy-ui/artifact-card/index.d.ts +3 -0
- package/dist/fancy-ui/artifact-card/index.js +2 -0
- package/dist/fancy-ui/autocomplete/Autocomplete.svelte +272 -0
- package/dist/fancy-ui/autocomplete/Autocomplete.svelte.d.ts +35 -0
- package/dist/fancy-ui/autocomplete/Autocomplete.test.d.ts +1 -0
- package/dist/fancy-ui/autocomplete/Autocomplete.test.js +400 -0
- package/dist/fancy-ui/autocomplete/AutocompleteFieldHarness.test.svelte +68 -0
- package/dist/fancy-ui/autocomplete/AutocompleteFieldHarness.test.svelte.d.ts +20 -0
- package/dist/fancy-ui/autocomplete/AutocompleteHarness.test.svelte +30 -0
- package/dist/fancy-ui/autocomplete/AutocompleteHarness.test.svelte.d.ts +9 -0
- package/dist/fancy-ui/autocomplete/AutocompletePanel.svelte +75 -0
- package/dist/fancy-ui/autocomplete/AutocompletePanel.svelte.d.ts +18 -0
- package/dist/fancy-ui/autocomplete/README.md +160 -0
- package/dist/fancy-ui/autocomplete/index.d.ts +4 -0
- package/dist/fancy-ui/autocomplete/index.js +3 -0
- package/dist/fancy-ui/autocomplete/match.d.ts +6 -0
- package/dist/fancy-ui/autocomplete/match.js +16 -0
- package/dist/fancy-ui/autocomplete/types.d.ts +32 -0
- package/dist/fancy-ui/autocomplete/types.js +1 -0
- package/dist/fancy-ui/breadcrumb/Breadcrumb.svelte +145 -0
- package/dist/fancy-ui/breadcrumb/Breadcrumb.svelte.d.ts +39 -0
- package/dist/fancy-ui/breadcrumb/Breadcrumb.test.d.ts +1 -0
- package/dist/fancy-ui/breadcrumb/Breadcrumb.test.js +268 -0
- package/dist/fancy-ui/breadcrumb/README.md +119 -0
- package/dist/fancy-ui/breadcrumb/index.d.ts +3 -0
- package/dist/fancy-ui/breadcrumb/index.js +2 -0
- package/dist/fancy-ui/button/Button.svelte +234 -0
- package/dist/fancy-ui/button/Button.svelte.d.ts +43 -0
- package/dist/fancy-ui/button/Button.test.d.ts +1 -0
- package/dist/fancy-ui/button/Button.test.js +231 -0
- package/dist/fancy-ui/button/README.md +91 -0
- package/dist/fancy-ui/button/index.d.ts +3 -0
- package/dist/fancy-ui/button/index.js +2 -0
- package/dist/fancy-ui/button/types.d.ts +4 -0
- package/dist/fancy-ui/button/types.js +1 -0
- package/dist/fancy-ui/button-group/ButtonGroup.svelte +129 -0
- package/dist/fancy-ui/button-group/ButtonGroup.svelte.d.ts +17 -0
- package/dist/fancy-ui/button-group/ButtonGroup.test.d.ts +1 -0
- package/dist/fancy-ui/button-group/ButtonGroup.test.js +133 -0
- package/dist/fancy-ui/button-group/ButtonGroupContextProbe.test.svelte +15 -0
- package/dist/fancy-ui/button-group/ButtonGroupContextProbe.test.svelte.d.ts +18 -0
- package/dist/fancy-ui/button-group/ButtonGroupHarness.test.svelte +21 -0
- package/dist/fancy-ui/button-group/ButtonGroupHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/button-group/README.md +91 -0
- package/dist/fancy-ui/button-group/index.d.ts +4 -0
- package/dist/fancy-ui/button-group/index.js +3 -0
- package/dist/fancy-ui/button-group/types.d.ts +16 -0
- package/dist/fancy-ui/button-group/types.js +10 -0
- package/dist/fancy-ui/chat-error/ChatError.svelte +195 -0
- package/dist/fancy-ui/chat-error/ChatError.svelte.d.ts +27 -0
- package/dist/fancy-ui/chat-error/ChatError.test.d.ts +1 -0
- package/dist/fancy-ui/chat-error/ChatError.test.js +94 -0
- package/dist/fancy-ui/chat-error/README.md +78 -0
- package/dist/fancy-ui/chat-error/index.d.ts +3 -0
- package/dist/fancy-ui/chat-error/index.js +2 -0
- package/dist/fancy-ui/chat-message/ChatMessage.svelte +205 -0
- package/dist/fancy-ui/chat-message/ChatMessage.svelte.d.ts +31 -0
- package/dist/fancy-ui/chat-message/ChatMessage.test.d.ts +1 -0
- package/dist/fancy-ui/chat-message/ChatMessage.test.js +179 -0
- package/dist/fancy-ui/chat-message/ChatMessageAction.svelte +82 -0
- package/dist/fancy-ui/chat-message/ChatMessageAction.svelte.d.ts +21 -0
- package/dist/fancy-ui/chat-message/ChatMessageActions.svelte +73 -0
- package/dist/fancy-ui/chat-message/ChatMessageActions.svelte.d.ts +15 -0
- package/dist/fancy-ui/chat-message/ChatMessageBranches.svelte +86 -0
- package/dist/fancy-ui/chat-message/ChatMessageBranches.svelte.d.ts +16 -0
- package/dist/fancy-ui/chat-message/ChatMessageHarness.test.svelte +47 -0
- package/dist/fancy-ui/chat-message/ChatMessageHarness.test.svelte.d.ts +12 -0
- package/dist/fancy-ui/chat-message/ChatMessageParts.test.d.ts +1 -0
- package/dist/fancy-ui/chat-message/ChatMessageParts.test.js +173 -0
- package/dist/fancy-ui/chat-message/README.md +184 -0
- package/dist/fancy-ui/chat-message/index.d.ts +10 -0
- package/dist/fancy-ui/chat-message/index.js +6 -0
- package/dist/fancy-ui/chat-message/types.d.ts +18 -0
- package/dist/fancy-ui/chat-message/types.js +10 -0
- package/dist/fancy-ui/chat-panel/ChatEmptyState.svelte +80 -0
- package/dist/fancy-ui/chat-panel/ChatEmptyState.svelte.d.ts +21 -0
- package/dist/fancy-ui/chat-panel/ChatPanel.svelte +303 -0
- package/dist/fancy-ui/chat-panel/ChatPanel.svelte.d.ts +29 -0
- package/dist/fancy-ui/chat-panel/ChatPanel.test.d.ts +1 -0
- package/dist/fancy-ui/chat-panel/ChatPanel.test.js +303 -0
- package/dist/fancy-ui/chat-panel/README.md +209 -0
- package/dist/fancy-ui/chat-panel/index.d.ts +5 -0
- package/dist/fancy-ui/chat-panel/index.js +3 -0
- package/dist/fancy-ui/checkbox/Checkbox.svelte +235 -0
- package/dist/fancy-ui/checkbox/Checkbox.svelte.d.ts +50 -0
- package/dist/fancy-ui/checkbox/Checkbox.test.d.ts +1 -0
- package/dist/fancy-ui/checkbox/Checkbox.test.js +237 -0
- package/dist/fancy-ui/checkbox/CheckboxFieldHarness.test.svelte +25 -0
- package/dist/fancy-ui/checkbox/CheckboxFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/checkbox/CheckboxHarness.test.svelte +34 -0
- package/dist/fancy-ui/checkbox/CheckboxHarness.test.svelte.d.ts +8 -0
- package/dist/fancy-ui/checkbox/README.md +150 -0
- package/dist/fancy-ui/checkbox/index.d.ts +3 -0
- package/dist/fancy-ui/checkbox/index.js +2 -0
- package/dist/fancy-ui/code-diff/CodeDiff.svelte +428 -0
- package/dist/fancy-ui/code-diff/CodeDiff.svelte.d.ts +27 -0
- package/dist/fancy-ui/code-diff/CodeDiff.test.d.ts +1 -0
- package/dist/fancy-ui/code-diff/CodeDiff.test.js +298 -0
- package/dist/fancy-ui/code-diff/README.md +82 -0
- package/dist/fancy-ui/code-diff/index.d.ts +3 -0
- package/dist/fancy-ui/code-diff/index.js +2 -0
- package/dist/fancy-ui/combobox/Combobox.svelte +337 -0
- package/dist/fancy-ui/combobox/Combobox.svelte.d.ts +35 -0
- package/dist/fancy-ui/combobox/Combobox.test.d.ts +1 -0
- package/dist/fancy-ui/combobox/Combobox.test.js +445 -0
- package/dist/fancy-ui/combobox/ComboboxFieldHarness.test.svelte +69 -0
- package/dist/fancy-ui/combobox/ComboboxFieldHarness.test.svelte.d.ts +21 -0
- package/dist/fancy-ui/combobox/ComboboxHarness.test.svelte +30 -0
- package/dist/fancy-ui/combobox/ComboboxHarness.test.svelte.d.ts +9 -0
- package/dist/fancy-ui/combobox/ComboboxPanel.svelte +87 -0
- package/dist/fancy-ui/combobox/ComboboxPanel.svelte.d.ts +18 -0
- package/dist/fancy-ui/combobox/README.md +168 -0
- package/dist/fancy-ui/combobox/index.d.ts +4 -0
- package/dist/fancy-ui/combobox/index.js +3 -0
- package/dist/fancy-ui/combobox/match.d.ts +15 -0
- package/dist/fancy-ui/combobox/match.js +35 -0
- package/dist/fancy-ui/combobox/types.d.ts +40 -0
- package/dist/fancy-ui/combobox/types.js +12 -0
- package/dist/fancy-ui/command-menu/CommandMenu.svelte +547 -0
- package/dist/fancy-ui/command-menu/CommandMenu.svelte.d.ts +36 -0
- package/dist/fancy-ui/command-menu/CommandMenu.test.d.ts +1 -0
- package/dist/fancy-ui/command-menu/CommandMenu.test.js +569 -0
- package/dist/fancy-ui/command-menu/README.md +176 -0
- package/dist/fancy-ui/command-menu/index.d.ts +2 -0
- package/dist/fancy-ui/command-menu/index.js +2 -0
- package/dist/fancy-ui/command-menu/match.d.ts +19 -0
- package/dist/fancy-ui/command-menu/match.js +124 -0
- package/dist/fancy-ui/command-menu/types.d.ts +19 -0
- package/dist/fancy-ui/command-menu/types.js +1 -0
- package/dist/fancy-ui/composer/Composer.svelte +241 -0
- package/dist/fancy-ui/composer/Composer.svelte.d.ts +37 -0
- package/dist/fancy-ui/composer/Composer.test.d.ts +1 -0
- package/dist/fancy-ui/composer/Composer.test.js +399 -0
- package/dist/fancy-ui/composer/ComposerAttachment.svelte +220 -0
- package/dist/fancy-ui/composer/ComposerAttachment.svelte.d.ts +15 -0
- package/dist/fancy-ui/composer/ComposerAttachments.svelte +158 -0
- package/dist/fancy-ui/composer/ComposerAttachments.svelte.d.ts +19 -0
- package/dist/fancy-ui/composer/ComposerAttachments.test.d.ts +1 -0
- package/dist/fancy-ui/composer/ComposerAttachments.test.js +360 -0
- package/dist/fancy-ui/composer/ComposerCommandMenu.svelte +399 -0
- package/dist/fancy-ui/composer/ComposerCommandMenu.svelte.d.ts +34 -0
- package/dist/fancy-ui/composer/ComposerCommandMenu.test.d.ts +1 -0
- package/dist/fancy-ui/composer/ComposerCommandMenu.test.js +311 -0
- package/dist/fancy-ui/composer/ComposerHarness.test.svelte +99 -0
- package/dist/fancy-ui/composer/ComposerHarness.test.svelte.d.ts +24 -0
- package/dist/fancy-ui/composer/ComposerInput.svelte +178 -0
- package/dist/fancy-ui/composer/ComposerInput.svelte.d.ts +20 -0
- package/dist/fancy-ui/composer/ComposerIntegration.test.d.ts +14 -0
- package/dist/fancy-ui/composer/ComposerIntegration.test.js +283 -0
- package/dist/fancy-ui/composer/ComposerModelPicker.svelte +375 -0
- package/dist/fancy-ui/composer/ComposerModelPicker.svelte.d.ts +19 -0
- package/dist/fancy-ui/composer/ComposerSubmit.svelte +85 -0
- package/dist/fancy-ui/composer/ComposerSubmit.svelte.d.ts +17 -0
- package/dist/fancy-ui/composer/ComposerToolbar.svelte +55 -0
- package/dist/fancy-ui/composer/ComposerToolbar.svelte.d.ts +13 -0
- package/dist/fancy-ui/composer/ComposerToolbar.test.d.ts +1 -0
- package/dist/fancy-ui/composer/ComposerToolbar.test.js +285 -0
- package/dist/fancy-ui/composer/IntegrationHarness.test.svelte +142 -0
- package/dist/fancy-ui/composer/IntegrationHarness.test.svelte.d.ts +28 -0
- package/dist/fancy-ui/composer/README.md +416 -0
- package/dist/fancy-ui/composer/caret.d.ts +69 -0
- package/dist/fancy-ui/composer/caret.js +197 -0
- package/dist/fancy-ui/composer/caret.test.d.ts +1 -0
- package/dist/fancy-ui/composer/caret.test.js +87 -0
- package/dist/fancy-ui/composer/index.d.ts +18 -0
- package/dist/fancy-ui/composer/index.js +10 -0
- package/dist/fancy-ui/composer/types.d.ts +61 -0
- package/dist/fancy-ui/composer/types.js +18 -0
- package/dist/fancy-ui/context-menu/ContextMenu.svelte +147 -0
- package/dist/fancy-ui/context-menu/ContextMenu.svelte.d.ts +21 -0
- package/dist/fancy-ui/context-menu/ContextMenu.test.d.ts +1 -0
- package/dist/fancy-ui/context-menu/ContextMenu.test.js +309 -0
- package/dist/fancy-ui/context-menu/ContextMenuContent.svelte +130 -0
- package/dist/fancy-ui/context-menu/ContextMenuContent.svelte.d.ts +12 -0
- package/dist/fancy-ui/context-menu/ContextMenuHarness.test.svelte +72 -0
- package/dist/fancy-ui/context-menu/ContextMenuHarness.test.svelte.d.ts +16 -0
- package/dist/fancy-ui/context-menu/ContextMenuTrigger.svelte +72 -0
- package/dist/fancy-ui/context-menu/ContextMenuTrigger.svelte.d.ts +14 -0
- package/dist/fancy-ui/context-menu/README.md +226 -0
- package/dist/fancy-ui/context-menu/index.d.ts +12 -0
- package/dist/fancy-ui/context-menu/index.js +19 -0
- package/dist/fancy-ui/context-menu/types.d.ts +26 -0
- package/dist/fancy-ui/context-menu/types.js +8 -0
- package/dist/fancy-ui/context-ring/ContextRing.svelte +407 -0
- package/dist/fancy-ui/context-ring/ContextRing.svelte.d.ts +29 -0
- package/dist/fancy-ui/context-ring/ContextRing.test.d.ts +1 -0
- package/dist/fancy-ui/context-ring/ContextRing.test.js +250 -0
- package/dist/fancy-ui/context-ring/README.md +138 -0
- package/dist/fancy-ui/context-ring/index.d.ts +3 -0
- package/dist/fancy-ui/context-ring/index.js +2 -0
- package/dist/fancy-ui/copy-button/CopyButton.svelte +169 -0
- package/dist/fancy-ui/copy-button/CopyButton.svelte.d.ts +36 -0
- package/dist/fancy-ui/copy-button/CopyButton.test.d.ts +1 -0
- package/dist/fancy-ui/copy-button/CopyButton.test.js +183 -0
- package/dist/fancy-ui/copy-button/README.md +113 -0
- package/dist/fancy-ui/copy-button/index.d.ts +3 -0
- package/dist/fancy-ui/copy-button/index.js +2 -0
- package/dist/fancy-ui/date-picker/DatePicker.svelte +421 -0
- package/dist/fancy-ui/date-picker/DatePicker.svelte.d.ts +38 -0
- package/dist/fancy-ui/date-picker/DatePicker.test.d.ts +1 -0
- package/dist/fancy-ui/date-picker/DatePicker.test.js +402 -0
- package/dist/fancy-ui/date-picker/DatePickerFieldHarness.test.svelte +25 -0
- package/dist/fancy-ui/date-picker/DatePickerFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/date-picker/DatePickerHarness.test.svelte +29 -0
- package/dist/fancy-ui/date-picker/DatePickerHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/date-picker/README.md +193 -0
- package/dist/fancy-ui/date-picker/date-utils.d.ts +39 -0
- package/dist/fancy-ui/date-picker/date-utils.js +116 -0
- package/dist/fancy-ui/date-picker/date-utils.test.d.ts +1 -0
- package/dist/fancy-ui/date-picker/date-utils.test.js +175 -0
- package/dist/fancy-ui/date-picker/index.d.ts +3 -0
- package/dist/fancy-ui/date-picker/index.js +2 -0
- package/dist/fancy-ui/dialog/Dialog.svelte +149 -0
- package/dist/fancy-ui/dialog/Dialog.svelte.d.ts +28 -0
- package/dist/fancy-ui/dialog/Dialog.test.d.ts +1 -0
- package/dist/fancy-ui/dialog/Dialog.test.js +304 -0
- package/dist/fancy-ui/dialog/DialogSurface.svelte +126 -0
- package/dist/fancy-ui/dialog/DialogSurface.svelte.d.ts +4 -0
- package/dist/fancy-ui/dialog/README.md +95 -0
- package/dist/fancy-ui/dialog/index.d.ts +2 -0
- package/dist/fancy-ui/dialog/index.js +2 -0
- package/dist/fancy-ui/dialog/types.d.ts +58 -0
- package/dist/fancy-ui/dialog/types.js +1 -0
- package/dist/fancy-ui/drawer/Drawer.svelte +305 -0
- package/dist/fancy-ui/drawer/Drawer.svelte.d.ts +26 -0
- package/dist/fancy-ui/drawer/Drawer.test.d.ts +1 -0
- package/dist/fancy-ui/drawer/Drawer.test.js +283 -0
- package/dist/fancy-ui/drawer/DrawerHarness.test.svelte +31 -0
- package/dist/fancy-ui/drawer/DrawerHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/drawer/README.md +135 -0
- package/dist/fancy-ui/drawer/index.d.ts +3 -0
- package/dist/fancy-ui/drawer/index.js +2 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenu.svelte +123 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenu.svelte.d.ts +21 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenu.test.d.ts +1 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenu.test.js +504 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuContent.svelte +155 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuContent.svelte.d.ts +12 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuHarness.test.svelte +95 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuHarness.test.svelte.d.ts +24 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuItem.svelte +151 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuItem.svelte.d.ts +22 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuLabel.svelte +32 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuLabel.svelte.d.ts +10 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSeparator.svelte +18 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSeparator.svelte.d.ts +7 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSub.svelte +117 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSub.svelte.d.ts +8 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSubContent.svelte +155 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSubContent.svelte.d.ts +12 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSubTrigger.svelte +151 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuSubTrigger.svelte.d.ts +14 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuTrigger.svelte +96 -0
- package/dist/fancy-ui/dropdown-menu/DropdownMenuTrigger.svelte.d.ts +14 -0
- package/dist/fancy-ui/dropdown-menu/README.md +394 -0
- package/dist/fancy-ui/dropdown-menu/index.d.ts +11 -0
- package/dist/fancy-ui/dropdown-menu/index.js +11 -0
- package/dist/fancy-ui/dropdown-menu/menu-shared.d.ts +32 -0
- package/dist/fancy-ui/dropdown-menu/menu-shared.js +74 -0
- package/dist/fancy-ui/dropdown-menu/types.d.ts +97 -0
- package/dist/fancy-ui/dropdown-menu/types.js +3 -0
- package/dist/fancy-ui/file-upload/FileUpload.svelte +495 -0
- package/dist/fancy-ui/file-upload/FileUpload.svelte.d.ts +48 -0
- package/dist/fancy-ui/file-upload/FileUpload.test.d.ts +1 -0
- package/dist/fancy-ui/file-upload/FileUpload.test.js +286 -0
- package/dist/fancy-ui/file-upload/FileUploadFieldHarness.test.svelte +47 -0
- package/dist/fancy-ui/file-upload/FileUploadFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/file-upload/FileUploadHarness.test.svelte +28 -0
- package/dist/fancy-ui/file-upload/FileUploadHarness.test.svelte.d.ts +8 -0
- package/dist/fancy-ui/file-upload/README.md +217 -0
- package/dist/fancy-ui/file-upload/index.d.ts +3 -0
- package/dist/fancy-ui/file-upload/index.js +2 -0
- package/dist/fancy-ui/fluid-cursor/FluidCursor.svelte +71 -4
- package/dist/fancy-ui/fluid-cursor/FluidCursor.svelte.d.ts +13 -0
- package/dist/fancy-ui/fluid-cursor/FluidCursor.test.js +28 -0
- package/dist/fancy-ui/fluid-cursor/README.md +27 -0
- package/dist/fancy-ui/form-field/FormField.svelte +121 -0
- package/dist/fancy-ui/form-field/FormField.svelte.d.ts +4 -0
- package/dist/fancy-ui/form-field/FormField.test.d.ts +1 -0
- package/dist/fancy-ui/form-field/FormField.test.js +206 -0
- package/dist/fancy-ui/form-field/FormFieldControl.test.svelte +37 -0
- package/dist/fancy-ui/form-field/FormFieldControl.test.svelte.d.ts +8 -0
- package/dist/fancy-ui/form-field/FormFieldHarness.test.svelte +30 -0
- package/dist/fancy-ui/form-field/FormFieldHarness.test.svelte.d.ts +4 -0
- package/dist/fancy-ui/form-field/FormFieldPairHarness.test.svelte +20 -0
- package/dist/fancy-ui/form-field/FormFieldPairHarness.test.svelte.d.ts +18 -0
- package/dist/fancy-ui/form-field/README.md +215 -0
- package/dist/fancy-ui/form-field/index.d.ts +3 -0
- package/dist/fancy-ui/form-field/index.js +2 -0
- package/dist/fancy-ui/form-field/types.d.ts +40 -0
- package/dist/fancy-ui/form-field/types.js +1 -0
- package/dist/fancy-ui/hover-card/HoverCard.svelte +204 -0
- package/dist/fancy-ui/hover-card/HoverCard.svelte.d.ts +45 -0
- package/dist/fancy-ui/hover-card/HoverCard.test.d.ts +1 -0
- package/dist/fancy-ui/hover-card/HoverCard.test.js +243 -0
- package/dist/fancy-ui/hover-card/HoverCardAriaHarness.test.svelte +26 -0
- package/dist/fancy-ui/hover-card/HoverCardAriaHarness.test.svelte.d.ts +18 -0
- package/dist/fancy-ui/hover-card/HoverCardHarness.test.svelte +24 -0
- package/dist/fancy-ui/hover-card/HoverCardHarness.test.svelte.d.ts +6 -0
- package/dist/fancy-ui/hover-card/README.md +65 -0
- package/dist/fancy-ui/hover-card/index.d.ts +2 -0
- package/dist/fancy-ui/hover-card/index.js +2 -0
- package/dist/fancy-ui/icon-button/IconButton.svelte +111 -0
- package/dist/fancy-ui/icon-button/IconButton.svelte.d.ts +45 -0
- package/dist/fancy-ui/icon-button/IconButton.test.d.ts +1 -0
- package/dist/fancy-ui/icon-button/IconButton.test.js +120 -0
- package/dist/fancy-ui/icon-button/README.md +184 -0
- package/dist/fancy-ui/icon-button/index.d.ts +2 -0
- package/dist/fancy-ui/icon-button/index.js +2 -0
- package/dist/fancy-ui/image-generation/ImageGeneration.svelte +274 -0
- package/dist/fancy-ui/image-generation/ImageGeneration.svelte.d.ts +28 -0
- package/dist/fancy-ui/image-generation/ImageGeneration.test.d.ts +1 -0
- package/dist/fancy-ui/image-generation/ImageGeneration.test.js +248 -0
- package/dist/fancy-ui/image-generation/README.md +96 -0
- package/dist/fancy-ui/image-generation/index.d.ts +3 -0
- package/dist/fancy-ui/image-generation/index.js +2 -0
- package/dist/fancy-ui/index.d.ts +71 -0
- package/dist/fancy-ui/index.js +75 -0
- package/dist/fancy-ui/inline-citation/InlineCitation.svelte +289 -0
- package/dist/fancy-ui/inline-citation/InlineCitation.svelte.d.ts +24 -0
- package/dist/fancy-ui/inline-citation/InlineCitation.test.d.ts +1 -0
- package/dist/fancy-ui/inline-citation/InlineCitation.test.js +272 -0
- package/dist/fancy-ui/inline-citation/InlineCitationHarness.test.svelte +21 -0
- package/dist/fancy-ui/inline-citation/InlineCitationHarness.test.svelte.d.ts +9 -0
- package/dist/fancy-ui/inline-citation/README.md +107 -0
- package/dist/fancy-ui/inline-citation/index.d.ts +3 -0
- package/dist/fancy-ui/inline-citation/index.js +2 -0
- package/dist/fancy-ui/input/Input.svelte +123 -0
- package/dist/fancy-ui/input/Input.svelte.d.ts +34 -0
- package/dist/fancy-ui/input/Input.test.d.ts +1 -0
- package/dist/fancy-ui/input/Input.test.js +133 -0
- package/dist/fancy-ui/input/InputFieldHarness.test.svelte +49 -0
- package/dist/fancy-ui/input/InputFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/input/InputHarness.test.svelte +28 -0
- package/dist/fancy-ui/input/InputHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/input/README.md +126 -0
- package/dist/fancy-ui/input/index.d.ts +3 -0
- package/dist/fancy-ui/input/index.js +2 -0
- package/dist/fancy-ui/label/Label.svelte +54 -0
- package/dist/fancy-ui/label/Label.svelte.d.ts +16 -0
- package/dist/fancy-ui/label/Label.test.d.ts +1 -0
- package/dist/fancy-ui/label/Label.test.js +105 -0
- package/dist/fancy-ui/label/LabelHarness.test.svelte +37 -0
- package/dist/fancy-ui/label/LabelHarness.test.svelte.d.ts +11 -0
- package/dist/fancy-ui/label/README.md +87 -0
- package/dist/fancy-ui/label/index.d.ts +2 -0
- package/dist/fancy-ui/label/index.js +2 -0
- package/dist/fancy-ui/link/Link.svelte +145 -0
- package/dist/fancy-ui/link/Link.svelte.d.ts +29 -0
- package/dist/fancy-ui/link/Link.test.d.ts +1 -0
- package/dist/fancy-ui/link/Link.test.js +170 -0
- package/dist/fancy-ui/link/README.md +77 -0
- package/dist/fancy-ui/link/index.d.ts +3 -0
- package/dist/fancy-ui/link/index.js +2 -0
- package/dist/fancy-ui/liquid-text/LiquidText.svelte +52 -11
- package/dist/fancy-ui/liquid-text/LiquidText.test.js +1 -3
- package/dist/fancy-ui/navbar/Navbar.svelte +88 -0
- package/dist/fancy-ui/navbar/Navbar.svelte.d.ts +22 -0
- package/dist/fancy-ui/navbar/Navbar.test.d.ts +1 -0
- package/dist/fancy-ui/navbar/Navbar.test.js +157 -0
- package/dist/fancy-ui/navbar/NavbarLink.svelte +109 -0
- package/dist/fancy-ui/navbar/NavbarLink.svelte.d.ts +29 -0
- package/dist/fancy-ui/navbar/README.md +137 -0
- package/dist/fancy-ui/navbar/index.d.ts +5 -0
- package/dist/fancy-ui/navbar/index.js +3 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenu.svelte +265 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenu.svelte.d.ts +22 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenu.test.d.ts +1 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenu.test.js +487 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuContent.svelte +130 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuContent.svelte.d.ts +12 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuHarness.test.svelte +78 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuHarness.test.svelte.d.ts +24 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuItem.svelte +43 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuItem.svelte.d.ts +12 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuLink.svelte +93 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuLink.svelte.d.ts +24 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuList.svelte +40 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuList.svelte.d.ts +12 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuTrigger.svelte +137 -0
- package/dist/fancy-ui/navigation-menu/NavigationMenuTrigger.svelte.d.ts +12 -0
- package/dist/fancy-ui/navigation-menu/README.md +309 -0
- package/dist/fancy-ui/navigation-menu/index.d.ts +14 -0
- package/dist/fancy-ui/navigation-menu/index.js +8 -0
- package/dist/fancy-ui/navigation-menu/types.d.ts +77 -0
- package/dist/fancy-ui/navigation-menu/types.js +16 -0
- package/dist/fancy-ui/number-input/NumberInput.svelte +282 -0
- package/dist/fancy-ui/number-input/NumberInput.svelte.d.ts +33 -0
- package/dist/fancy-ui/number-input/NumberInput.test.d.ts +1 -0
- package/dist/fancy-ui/number-input/NumberInput.test.js +354 -0
- package/dist/fancy-ui/number-input/NumberInputFieldHarness.test.svelte +25 -0
- package/dist/fancy-ui/number-input/NumberInputFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/number-input/NumberInputHarness.test.svelte +31 -0
- package/dist/fancy-ui/number-input/NumberInputHarness.test.svelte.d.ts +10 -0
- package/dist/fancy-ui/number-input/README.md +141 -0
- package/dist/fancy-ui/number-input/index.d.ts +3 -0
- package/dist/fancy-ui/number-input/index.js +2 -0
- package/dist/fancy-ui/pagination/Pagination.svelte +226 -0
- package/dist/fancy-ui/pagination/Pagination.svelte.d.ts +30 -0
- package/dist/fancy-ui/pagination/Pagination.test.d.ts +1 -0
- package/dist/fancy-ui/pagination/Pagination.test.js +194 -0
- package/dist/fancy-ui/pagination/PaginationHarness.test.svelte +53 -0
- package/dist/fancy-ui/pagination/PaginationHarness.test.svelte.d.ts +13 -0
- package/dist/fancy-ui/pagination/README.md +117 -0
- package/dist/fancy-ui/pagination/index.d.ts +3 -0
- package/dist/fancy-ui/pagination/index.js +9 -0
- package/dist/fancy-ui/pagination/pagination-range.d.ts +11 -0
- package/dist/fancy-ui/pagination/pagination-range.js +77 -0
- package/dist/fancy-ui/pagination/pagination-range.test.d.ts +1 -0
- package/dist/fancy-ui/pagination/pagination-range.test.js +118 -0
- package/dist/fancy-ui/password-input/PasswordInput.svelte +314 -0
- package/dist/fancy-ui/password-input/PasswordInput.svelte.d.ts +44 -0
- package/dist/fancy-ui/password-input/PasswordInput.test.d.ts +1 -0
- package/dist/fancy-ui/password-input/PasswordInput.test.js +290 -0
- package/dist/fancy-ui/password-input/PasswordInputFieldHarness.test.svelte +66 -0
- package/dist/fancy-ui/password-input/PasswordInputFieldHarness.test.svelte.d.ts +19 -0
- package/dist/fancy-ui/password-input/PasswordInputHarness.test.svelte +28 -0
- package/dist/fancy-ui/password-input/PasswordInputHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/password-input/README.md +135 -0
- package/dist/fancy-ui/password-input/index.d.ts +2 -0
- package/dist/fancy-ui/password-input/index.js +2 -0
- package/dist/fancy-ui/pixel-loader/PixelLoader.svelte +111 -0
- package/dist/fancy-ui/pixel-loader/PixelLoader.svelte.d.ts +23 -0
- package/dist/fancy-ui/pixel-loader/PixelLoader.test.d.ts +1 -0
- package/dist/fancy-ui/pixel-loader/PixelLoader.test.js +77 -0
- package/dist/fancy-ui/pixel-loader/README.md +47 -0
- package/dist/fancy-ui/pixel-loader/index.d.ts +3 -0
- package/dist/fancy-ui/pixel-loader/index.js +2 -0
- package/dist/fancy-ui/popover/Popover.svelte +127 -0
- package/dist/fancy-ui/popover/Popover.svelte.d.ts +31 -0
- package/dist/fancy-ui/popover/Popover.test.d.ts +1 -0
- package/dist/fancy-ui/popover/Popover.test.js +246 -0
- package/dist/fancy-ui/popover/PopoverContent.svelte +85 -0
- package/dist/fancy-ui/popover/PopoverContent.svelte.d.ts +12 -0
- package/dist/fancy-ui/popover/README.md +146 -0
- package/dist/fancy-ui/popover/index.d.ts +6 -0
- package/dist/fancy-ui/popover/index.js +4 -0
- package/dist/fancy-ui/popover/types.d.ts +27 -0
- package/dist/fancy-ui/popover/types.js +1 -0
- package/dist/fancy-ui/prompt-suggestions/PromptSuggestions.svelte +130 -0
- package/dist/fancy-ui/prompt-suggestions/PromptSuggestions.svelte.d.ts +24 -0
- package/dist/fancy-ui/prompt-suggestions/PromptSuggestions.test.d.ts +1 -0
- package/dist/fancy-ui/prompt-suggestions/PromptSuggestions.test.js +129 -0
- package/dist/fancy-ui/prompt-suggestions/README.md +77 -0
- package/dist/fancy-ui/prompt-suggestions/index.d.ts +3 -0
- package/dist/fancy-ui/prompt-suggestions/index.js +2 -0
- package/dist/fancy-ui/radio-group/README.md +219 -0
- package/dist/fancy-ui/radio-group/RadioGroup.svelte +154 -0
- package/dist/fancy-ui/radio-group/RadioGroup.svelte.d.ts +39 -0
- package/dist/fancy-ui/radio-group/RadioGroup.test.d.ts +1 -0
- package/dist/fancy-ui/radio-group/RadioGroup.test.js +347 -0
- package/dist/fancy-ui/radio-group/RadioGroupHarness.test.svelte +67 -0
- package/dist/fancy-ui/radio-group/RadioGroupHarness.test.svelte.d.ts +22 -0
- package/dist/fancy-ui/radio-group/RadioGroupItem.svelte +148 -0
- package/dist/fancy-ui/radio-group/RadioGroupItem.svelte.d.ts +18 -0
- package/dist/fancy-ui/radio-group/index.d.ts +6 -0
- package/dist/fancy-ui/radio-group/index.js +4 -0
- package/dist/fancy-ui/radio-group/types.d.ts +35 -0
- package/dist/fancy-ui/radio-group/types.js +12 -0
- package/dist/fancy-ui/reasoning-panel/README.md +70 -0
- package/dist/fancy-ui/reasoning-panel/ReasoningPanel.svelte +260 -0
- package/dist/fancy-ui/reasoning-panel/ReasoningPanel.svelte.d.ts +32 -0
- package/dist/fancy-ui/reasoning-panel/ReasoningPanel.test.d.ts +1 -0
- package/dist/fancy-ui/reasoning-panel/ReasoningPanel.test.js +163 -0
- package/dist/fancy-ui/reasoning-panel/index.d.ts +3 -0
- package/dist/fancy-ui/reasoning-panel/index.js +2 -0
- package/dist/fancy-ui/recommendation-card/README.md +106 -0
- package/dist/fancy-ui/recommendation-card/RecommendationCard.svelte +375 -0
- package/dist/fancy-ui/recommendation-card/RecommendationCard.svelte.d.ts +38 -0
- package/dist/fancy-ui/recommendation-card/RecommendationCard.test.d.ts +1 -0
- package/dist/fancy-ui/recommendation-card/RecommendationCard.test.js +255 -0
- package/dist/fancy-ui/recommendation-card/RecommendationCardHarness.test.svelte +33 -0
- package/dist/fancy-ui/recommendation-card/RecommendationCardHarness.test.svelte.d.ts +12 -0
- package/dist/fancy-ui/recommendation-card/index.d.ts +3 -0
- package/dist/fancy-ui/recommendation-card/index.js +2 -0
- package/dist/fancy-ui/registry.d.ts +14 -1
- package/dist/fancy-ui/registry.js +4879 -40
- package/dist/fancy-ui/scroll-anchor/README.md +93 -0
- package/dist/fancy-ui/scroll-anchor/ScrollAnchor.svelte +197 -0
- package/dist/fancy-ui/scroll-anchor/ScrollAnchor.svelte.d.ts +31 -0
- package/dist/fancy-ui/scroll-anchor/ScrollAnchor.test.d.ts +1 -0
- package/dist/fancy-ui/scroll-anchor/ScrollAnchor.test.js +206 -0
- package/dist/fancy-ui/scroll-anchor/index.d.ts +3 -0
- package/dist/fancy-ui/scroll-anchor/index.js +2 -0
- package/dist/fancy-ui/search-input/README.md +118 -0
- package/dist/fancy-ui/search-input/SearchInput.svelte +261 -0
- package/dist/fancy-ui/search-input/SearchInput.svelte.d.ts +43 -0
- package/dist/fancy-ui/search-input/SearchInput.test.d.ts +1 -0
- package/dist/fancy-ui/search-input/SearchInput.test.js +279 -0
- package/dist/fancy-ui/search-input/SearchInputFieldHarness.test.svelte +66 -0
- package/dist/fancy-ui/search-input/SearchInputFieldHarness.test.svelte.d.ts +19 -0
- package/dist/fancy-ui/search-input/SearchInputHarness.test.svelte +28 -0
- package/dist/fancy-ui/search-input/SearchInputHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/search-input/index.d.ts +2 -0
- package/dist/fancy-ui/search-input/index.js +2 -0
- package/dist/fancy-ui/select/README.md +208 -0
- package/dist/fancy-ui/select/Select.svelte +361 -0
- package/dist/fancy-ui/select/Select.svelte.d.ts +36 -0
- package/dist/fancy-ui/select/Select.test.d.ts +1 -0
- package/dist/fancy-ui/select/Select.test.js +461 -0
- package/dist/fancy-ui/select/SelectHarness.test.svelte +63 -0
- package/dist/fancy-ui/select/SelectHarness.test.svelte.d.ts +19 -0
- package/dist/fancy-ui/select/SelectPanel.svelte +138 -0
- package/dist/fancy-ui/select/SelectPanel.svelte.d.ts +9 -0
- package/dist/fancy-ui/select/index.d.ts +3 -0
- package/dist/fancy-ui/select/index.js +2 -0
- package/dist/fancy-ui/select/types.d.ts +56 -0
- package/dist/fancy-ui/select/types.js +1 -0
- package/dist/fancy-ui/sheet/README.md +128 -0
- package/dist/fancy-ui/sheet/Sheet.svelte +240 -0
- package/dist/fancy-ui/sheet/Sheet.svelte.d.ts +30 -0
- package/dist/fancy-ui/sheet/Sheet.test.d.ts +1 -0
- package/dist/fancy-ui/sheet/Sheet.test.js +236 -0
- package/dist/fancy-ui/sheet/SheetHarness.test.svelte +31 -0
- package/dist/fancy-ui/sheet/SheetHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/sheet/index.d.ts +3 -0
- package/dist/fancy-ui/sheet/index.js +2 -0
- package/dist/fancy-ui/sidebar/README.md +219 -0
- package/dist/fancy-ui/sidebar/Sidebar.svelte +81 -0
- package/dist/fancy-ui/sidebar/Sidebar.svelte.d.ts +21 -0
- package/dist/fancy-ui/sidebar/Sidebar.test.d.ts +1 -0
- package/dist/fancy-ui/sidebar/Sidebar.test.js +307 -0
- package/dist/fancy-ui/sidebar/SidebarFooter.svelte +46 -0
- package/dist/fancy-ui/sidebar/SidebarFooter.svelte.d.ts +14 -0
- package/dist/fancy-ui/sidebar/SidebarGroup.svelte +45 -0
- package/dist/fancy-ui/sidebar/SidebarGroup.svelte.d.ts +12 -0
- package/dist/fancy-ui/sidebar/SidebarHarness.test.svelte +41 -0
- package/dist/fancy-ui/sidebar/SidebarHarness.test.svelte.d.ts +6 -0
- package/dist/fancy-ui/sidebar/SidebarItem.svelte +168 -0
- package/dist/fancy-ui/sidebar/SidebarItem.svelte.d.ts +32 -0
- package/dist/fancy-ui/sidebar/SidebarSeparator.svelte +17 -0
- package/dist/fancy-ui/sidebar/SidebarSeparator.svelte.d.ts +9 -0
- package/dist/fancy-ui/sidebar/index.d.ts +12 -0
- package/dist/fancy-ui/sidebar/index.js +7 -0
- package/dist/fancy-ui/sidebar/types.d.ts +23 -0
- package/dist/fancy-ui/sidebar/types.js +18 -0
- package/dist/fancy-ui/slider/README.md +126 -0
- package/dist/fancy-ui/slider/Slider.svelte +252 -0
- package/dist/fancy-ui/slider/Slider.svelte.d.ts +31 -0
- package/dist/fancy-ui/slider/Slider.test.d.ts +1 -0
- package/dist/fancy-ui/slider/Slider.test.js +175 -0
- package/dist/fancy-ui/slider/SliderFieldHarness.test.svelte +25 -0
- package/dist/fancy-ui/slider/SliderFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/slider/SliderHarness.test.svelte +28 -0
- package/dist/fancy-ui/slider/SliderHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/slider/index.d.ts +3 -0
- package/dist/fancy-ui/slider/index.js +2 -0
- package/dist/fancy-ui/sources/README.md +189 -0
- package/dist/fancy-ui/sources/SourceCard.svelte +174 -0
- package/dist/fancy-ui/sources/SourceCard.svelte.d.ts +22 -0
- package/dist/fancy-ui/sources/Sources.svelte +75 -0
- package/dist/fancy-ui/sources/Sources.svelte.d.ts +22 -0
- package/dist/fancy-ui/sources/Sources.test.d.ts +1 -0
- package/dist/fancy-ui/sources/Sources.test.js +140 -0
- package/dist/fancy-ui/sources/SourcesHarness.test.svelte +36 -0
- package/dist/fancy-ui/sources/SourcesHarness.test.svelte.d.ts +12 -0
- package/dist/fancy-ui/sources/SourcesList.svelte +123 -0
- package/dist/fancy-ui/sources/SourcesList.svelte.d.ts +14 -0
- package/dist/fancy-ui/sources/SourcesParts.test.d.ts +1 -0
- package/dist/fancy-ui/sources/SourcesParts.test.js +245 -0
- package/dist/fancy-ui/sources/SourcesTrigger.svelte +126 -0
- package/dist/fancy-ui/sources/SourcesTrigger.svelte.d.ts +12 -0
- package/dist/fancy-ui/sources/index.d.ts +10 -0
- package/dist/fancy-ui/sources/index.js +6 -0
- package/dist/fancy-ui/sources/types.d.ts +26 -0
- package/dist/fancy-ui/sources/types.js +10 -0
- package/dist/fancy-ui/stepper/README.md +173 -0
- package/dist/fancy-ui/stepper/Step.svelte +247 -0
- package/dist/fancy-ui/stepper/Step.svelte.d.ts +21 -0
- package/dist/fancy-ui/stepper/Stepper.svelte +123 -0
- package/dist/fancy-ui/stepper/Stepper.svelte.d.ts +22 -0
- package/dist/fancy-ui/stepper/Stepper.test.d.ts +1 -0
- package/dist/fancy-ui/stepper/Stepper.test.js +197 -0
- package/dist/fancy-ui/stepper/StepperHarness.test.svelte +49 -0
- package/dist/fancy-ui/stepper/StepperHarness.test.svelte.d.ts +15 -0
- package/dist/fancy-ui/stepper/index.d.ts +6 -0
- package/dist/fancy-ui/stepper/index.js +4 -0
- package/dist/fancy-ui/stepper/types.d.ts +45 -0
- package/dist/fancy-ui/stepper/types.js +1 -0
- package/dist/fancy-ui/streaming-text/README.md +80 -0
- package/dist/fancy-ui/streaming-text/StreamingText.svelte +126 -0
- package/dist/fancy-ui/streaming-text/StreamingText.svelte.d.ts +27 -0
- package/dist/fancy-ui/streaming-text/StreamingText.test.d.ts +1 -0
- package/dist/fancy-ui/streaming-text/StreamingText.test.js +98 -0
- package/dist/fancy-ui/streaming-text/index.d.ts +3 -0
- package/dist/fancy-ui/streaming-text/index.js +2 -0
- package/dist/fancy-ui/subagent-list/README.md +153 -0
- package/dist/fancy-ui/subagent-list/SubagentList.svelte +438 -0
- package/dist/fancy-ui/subagent-list/SubagentList.svelte.d.ts +27 -0
- package/dist/fancy-ui/subagent-list/SubagentList.test.d.ts +1 -0
- package/dist/fancy-ui/subagent-list/SubagentList.test.js +303 -0
- package/dist/fancy-ui/subagent-list/index.d.ts +3 -0
- package/dist/fancy-ui/subagent-list/index.js +2 -0
- package/dist/fancy-ui/switch/README.md +143 -0
- package/dist/fancy-ui/switch/Switch.svelte +233 -0
- package/dist/fancy-ui/switch/Switch.svelte.d.ts +40 -0
- package/dist/fancy-ui/switch/Switch.test.d.ts +1 -0
- package/dist/fancy-ui/switch/Switch.test.js +199 -0
- package/dist/fancy-ui/switch/SwitchFieldHarness.test.svelte +25 -0
- package/dist/fancy-ui/switch/SwitchFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/switch/SwitchHarness.test.svelte +28 -0
- package/dist/fancy-ui/switch/SwitchHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/switch/index.d.ts +3 -0
- package/dist/fancy-ui/switch/index.js +2 -0
- package/dist/fancy-ui/tabs/README.md +271 -0
- package/dist/fancy-ui/tabs/Tabs.svelte +218 -0
- package/dist/fancy-ui/tabs/Tabs.svelte.d.ts +26 -0
- package/dist/fancy-ui/tabs/Tabs.test.d.ts +1 -0
- package/dist/fancy-ui/tabs/Tabs.test.js +392 -0
- package/dist/fancy-ui/tabs/TabsContent.svelte +58 -0
- package/dist/fancy-ui/tabs/TabsContent.svelte.d.ts +22 -0
- package/dist/fancy-ui/tabs/TabsHarness.test.svelte +53 -0
- package/dist/fancy-ui/tabs/TabsHarness.test.svelte.d.ts +17 -0
- package/dist/fancy-ui/tabs/TabsList.svelte +73 -0
- package/dist/fancy-ui/tabs/TabsList.svelte.d.ts +12 -0
- package/dist/fancy-ui/tabs/TabsTrigger.svelte +246 -0
- package/dist/fancy-ui/tabs/TabsTrigger.svelte.d.ts +16 -0
- package/dist/fancy-ui/tabs/index.d.ts +10 -0
- package/dist/fancy-ui/tabs/index.js +6 -0
- package/dist/fancy-ui/tabs/types.d.ts +66 -0
- package/dist/fancy-ui/tabs/types.js +16 -0
- package/dist/fancy-ui/terminal-block/README.md +109 -0
- package/dist/fancy-ui/terminal-block/TerminalBlock.svelte +263 -0
- package/dist/fancy-ui/terminal-block/TerminalBlock.svelte.d.ts +31 -0
- package/dist/fancy-ui/terminal-block/TerminalBlock.test.d.ts +1 -0
- package/dist/fancy-ui/terminal-block/TerminalBlock.test.js +197 -0
- package/dist/fancy-ui/terminal-block/ansi.d.ts +30 -0
- package/dist/fancy-ui/terminal-block/ansi.js +163 -0
- package/dist/fancy-ui/terminal-block/ansi.test.d.ts +1 -0
- package/dist/fancy-ui/terminal-block/ansi.test.js +123 -0
- package/dist/fancy-ui/terminal-block/index.d.ts +3 -0
- package/dist/fancy-ui/terminal-block/index.js +2 -0
- package/dist/fancy-ui/textarea/README.md +134 -0
- package/dist/fancy-ui/textarea/Textarea.svelte +225 -0
- package/dist/fancy-ui/textarea/Textarea.svelte.d.ts +40 -0
- package/dist/fancy-ui/textarea/Textarea.test.d.ts +1 -0
- package/dist/fancy-ui/textarea/Textarea.test.js +179 -0
- package/dist/fancy-ui/textarea/TextareaFieldHarness.test.svelte +49 -0
- package/dist/fancy-ui/textarea/TextareaFieldHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/textarea/TextareaHarness.test.svelte +28 -0
- package/dist/fancy-ui/textarea/TextareaHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/textarea/index.d.ts +3 -0
- package/dist/fancy-ui/textarea/index.js +2 -0
- package/dist/fancy-ui/thinking-indicator/README.md +64 -0
- package/dist/fancy-ui/thinking-indicator/ThinkingIndicator.svelte +189 -0
- package/dist/fancy-ui/thinking-indicator/ThinkingIndicator.svelte.d.ts +27 -0
- package/dist/fancy-ui/thinking-indicator/ThinkingIndicator.test.d.ts +1 -0
- package/dist/fancy-ui/thinking-indicator/ThinkingIndicator.test.js +148 -0
- package/dist/fancy-ui/thinking-indicator/index.d.ts +3 -0
- package/dist/fancy-ui/thinking-indicator/index.js +2 -0
- package/dist/fancy-ui/thread-list/README.md +141 -0
- package/dist/fancy-ui/thread-list/ThreadList.svelte +340 -0
- package/dist/fancy-ui/thread-list/ThreadList.svelte.d.ts +28 -0
- package/dist/fancy-ui/thread-list/ThreadList.test.d.ts +1 -0
- package/dist/fancy-ui/thread-list/ThreadList.test.js +267 -0
- package/dist/fancy-ui/thread-list/ThreadListHarness.test.svelte +61 -0
- package/dist/fancy-ui/thread-list/ThreadListHarness.test.svelte.d.ts +15 -0
- package/dist/fancy-ui/thread-list/index.d.ts +3 -0
- package/dist/fancy-ui/thread-list/index.js +2 -0
- package/dist/fancy-ui/time-picker/README.md +155 -0
- package/dist/fancy-ui/time-picker/TimePicker.svelte +297 -0
- package/dist/fancy-ui/time-picker/TimePicker.svelte.d.ts +37 -0
- package/dist/fancy-ui/time-picker/TimePicker.test.d.ts +1 -0
- package/dist/fancy-ui/time-picker/TimePicker.test.js +365 -0
- package/dist/fancy-ui/time-picker/TimePickerFieldHarness.test.svelte +35 -0
- package/dist/fancy-ui/time-picker/TimePickerFieldHarness.test.svelte.d.ts +11 -0
- package/dist/fancy-ui/time-picker/TimePickerHarness.test.svelte +28 -0
- package/dist/fancy-ui/time-picker/TimePickerHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/time-picker/TimePickerPanel.svelte +109 -0
- package/dist/fancy-ui/time-picker/TimePickerPanel.svelte.d.ts +9 -0
- package/dist/fancy-ui/time-picker/index.d.ts +3 -0
- package/dist/fancy-ui/time-picker/index.js +2 -0
- package/dist/fancy-ui/time-picker/time-utils.d.ts +33 -0
- package/dist/fancy-ui/time-picker/time-utils.js +96 -0
- package/dist/fancy-ui/time-picker/time-utils.test.d.ts +1 -0
- package/dist/fancy-ui/time-picker/time-utils.test.js +123 -0
- package/dist/fancy-ui/time-picker/types.d.ts +32 -0
- package/dist/fancy-ui/time-picker/types.js +1 -0
- package/dist/fancy-ui/toast/README.md +180 -0
- package/dist/fancy-ui/toast/Toast.svelte +203 -0
- package/dist/fancy-ui/toast/Toast.svelte.d.ts +12 -0
- package/dist/fancy-ui/toast/Toast.test.d.ts +1 -0
- package/dist/fancy-ui/toast/Toast.test.js +274 -0
- package/dist/fancy-ui/toast/Toaster.svelte +111 -0
- package/dist/fancy-ui/toast/Toaster.svelte.d.ts +12 -0
- package/dist/fancy-ui/toast/index.d.ts +4 -0
- package/dist/fancy-ui/toast/index.js +4 -0
- package/dist/fancy-ui/toast/store.svelte.d.ts +95 -0
- package/dist/fancy-ui/toast/store.svelte.js +160 -0
- package/dist/fancy-ui/toggle/README.md +89 -0
- package/dist/fancy-ui/toggle/Toggle.svelte +120 -0
- package/dist/fancy-ui/toggle/Toggle.svelte.d.ts +26 -0
- package/dist/fancy-ui/toggle/Toggle.test.d.ts +1 -0
- package/dist/fancy-ui/toggle/Toggle.test.js +97 -0
- package/dist/fancy-ui/toggle/ToggleHarness.test.svelte +30 -0
- package/dist/fancy-ui/toggle/ToggleHarness.test.svelte.d.ts +7 -0
- package/dist/fancy-ui/toggle/index.d.ts +3 -0
- package/dist/fancy-ui/toggle/index.js +2 -0
- package/dist/fancy-ui/toggle-group/README.md +206 -0
- package/dist/fancy-ui/toggle-group/ToggleGroup.svelte +259 -0
- package/dist/fancy-ui/toggle-group/ToggleGroup.svelte.d.ts +29 -0
- package/dist/fancy-ui/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/dist/fancy-ui/toggle-group/ToggleGroup.test.js +382 -0
- package/dist/fancy-ui/toggle-group/ToggleGroupHarness.test.svelte +50 -0
- package/dist/fancy-ui/toggle-group/ToggleGroupHarness.test.svelte.d.ts +18 -0
- package/dist/fancy-ui/toggle-group/ToggleGroupItem.svelte +173 -0
- package/dist/fancy-ui/toggle-group/ToggleGroupItem.svelte.d.ts +18 -0
- package/dist/fancy-ui/toggle-group/index.d.ts +6 -0
- package/dist/fancy-ui/toggle-group/index.js +4 -0
- package/dist/fancy-ui/toggle-group/types.d.ts +50 -0
- package/dist/fancy-ui/toggle-group/types.js +17 -0
- package/dist/fancy-ui/tool-call/README.md +137 -0
- package/dist/fancy-ui/tool-call/ToolCall.svelte +430 -0
- package/dist/fancy-ui/tool-call/ToolCall.svelte.d.ts +30 -0
- package/dist/fancy-ui/tool-call/ToolCall.test.d.ts +1 -0
- package/dist/fancy-ui/tool-call/ToolCall.test.js +241 -0
- package/dist/fancy-ui/tool-call/index.d.ts +3 -0
- package/dist/fancy-ui/tool-call/index.js +2 -0
- package/dist/fancy-ui/tool-timeline/README.md +106 -0
- package/dist/fancy-ui/tool-timeline/ToolTimeline.svelte +263 -0
- package/dist/fancy-ui/tool-timeline/ToolTimeline.svelte.d.ts +24 -0
- package/dist/fancy-ui/tool-timeline/ToolTimeline.test.d.ts +1 -0
- package/dist/fancy-ui/tool-timeline/ToolTimeline.test.js +160 -0
- package/dist/fancy-ui/tool-timeline/index.d.ts +3 -0
- package/dist/fancy-ui/tool-timeline/index.js +2 -0
- package/dist/fancy-ui/tooltip/README.md +133 -0
- package/dist/fancy-ui/tooltip/Tooltip.svelte +307 -0
- package/dist/fancy-ui/tooltip/Tooltip.svelte.d.ts +32 -0
- package/dist/fancy-ui/tooltip/Tooltip.test.d.ts +1 -0
- package/dist/fancy-ui/tooltip/Tooltip.test.js +299 -0
- package/dist/fancy-ui/tooltip/index.d.ts +3 -0
- package/dist/fancy-ui/tooltip/index.js +2 -0
- package/dist/fancy-ui/typing-indicator/README.md +49 -0
- package/dist/fancy-ui/typing-indicator/TypingIndicator.svelte +97 -0
- package/dist/fancy-ui/typing-indicator/TypingIndicator.svelte.d.ts +17 -0
- package/dist/fancy-ui/typing-indicator/TypingIndicator.test.d.ts +1 -0
- package/dist/fancy-ui/typing-indicator/TypingIndicator.test.js +60 -0
- package/dist/fancy-ui/typing-indicator/index.d.ts +3 -0
- package/dist/fancy-ui/typing-indicator/index.js +2 -0
- package/dist/fancy-ui/voice-input/README.md +149 -0
- package/dist/fancy-ui/voice-input/VoiceInput.svelte +407 -0
- package/dist/fancy-ui/voice-input/VoiceInput.svelte.d.ts +43 -0
- package/dist/fancy-ui/voice-input/VoiceInput.test.d.ts +1 -0
- package/dist/fancy-ui/voice-input/VoiceInput.test.js +264 -0
- package/dist/fancy-ui/voice-input/VoiceInputHarness.test.svelte +34 -0
- package/dist/fancy-ui/voice-input/VoiceInputHarness.test.svelte.d.ts +11 -0
- package/dist/fancy-ui/voice-input/index.d.ts +3 -0
- package/dist/fancy-ui/voice-input/index.js +2 -0
- package/dist/fancy-ui/web-search/README.md +105 -0
- package/dist/fancy-ui/web-search/WebSearch.svelte +335 -0
- package/dist/fancy-ui/web-search/WebSearch.svelte.d.ts +28 -0
- package/dist/fancy-ui/web-search/WebSearch.test.d.ts +1 -0
- package/dist/fancy-ui/web-search/WebSearch.test.js +265 -0
- package/dist/fancy-ui/web-search/index.d.ts +3 -0
- package/dist/fancy-ui/web-search/index.js +2 -0
- package/dist/types.d.ts +3 -1
- package/package.json +5 -3
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { render, cleanup, fireEvent } from "@testing-library/svelte";
|
|
2
|
+
import { afterEach, beforeEach, describe, it, expect, vi } from "vitest";
|
|
3
|
+
import Toaster from "./Toaster.svelte";
|
|
4
|
+
import { toast, dismissToast, toastStore } from "./store.svelte.js";
|
|
5
|
+
/** The store is a module-level singleton — clear it between tests so none leak into the next. */
|
|
6
|
+
function resetStore() {
|
|
7
|
+
for (const item of [...toastStore.items]) {
|
|
8
|
+
dismissToast(item.id);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function politeRegion() {
|
|
12
|
+
return document.querySelector('[aria-live="polite"]');
|
|
13
|
+
}
|
|
14
|
+
function assertiveRegion() {
|
|
15
|
+
return document.querySelector('[aria-live="assertive"]');
|
|
16
|
+
}
|
|
17
|
+
function toastPanels() {
|
|
18
|
+
return Array.from(document.querySelectorAll(".ft-toast"));
|
|
19
|
+
}
|
|
20
|
+
describe("Toast / Toaster", () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
vi.useFakeTimers();
|
|
23
|
+
});
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
cleanup();
|
|
26
|
+
resetStore();
|
|
27
|
+
document.body.innerHTML = "";
|
|
28
|
+
vi.useRealTimers();
|
|
29
|
+
vi.unstubAllGlobals();
|
|
30
|
+
});
|
|
31
|
+
it("mounts both live regions empty, before any toast exists", () => {
|
|
32
|
+
render(Toaster);
|
|
33
|
+
expect(politeRegion()).not.toBeNull();
|
|
34
|
+
expect(assertiveRegion()).not.toBeNull();
|
|
35
|
+
expect(politeRegion().textContent).toBe("");
|
|
36
|
+
expect(assertiveRegion().textContent).toBe("");
|
|
37
|
+
});
|
|
38
|
+
it("announces a success toast through the polite region only", async () => {
|
|
39
|
+
render(Toaster);
|
|
40
|
+
toast({
|
|
41
|
+
title: "Theme saved",
|
|
42
|
+
description: "CSS copied to the clipboard.",
|
|
43
|
+
variant: "success",
|
|
44
|
+
});
|
|
45
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
46
|
+
expect(politeRegion().textContent).toBe("Theme saved. CSS copied to the clipboard.");
|
|
47
|
+
expect(assertiveRegion().textContent).toBe("");
|
|
48
|
+
});
|
|
49
|
+
it("announces an info toast through the polite region", async () => {
|
|
50
|
+
render(Toaster);
|
|
51
|
+
toast({ title: "Heads up", variant: "info" });
|
|
52
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
53
|
+
expect(politeRegion().textContent).toBe("Heads up");
|
|
54
|
+
});
|
|
55
|
+
it("announces a loading toast through the polite region", async () => {
|
|
56
|
+
render(Toaster);
|
|
57
|
+
toast({ title: "Publishing…", variant: "loading" });
|
|
58
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
59
|
+
expect(politeRegion().textContent).toBe("Publishing…");
|
|
60
|
+
});
|
|
61
|
+
it("announces an error toast through the assertive region only", async () => {
|
|
62
|
+
render(Toaster);
|
|
63
|
+
toast({ title: "Failed to send", description: "Check your connection.", variant: "error" });
|
|
64
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
65
|
+
expect(assertiveRegion().textContent).toBe("Failed to send. Check your connection.");
|
|
66
|
+
expect(politeRegion().textContent).toBe("");
|
|
67
|
+
});
|
|
68
|
+
it("renders each variant with its own chrome", async () => {
|
|
69
|
+
render(Toaster);
|
|
70
|
+
toast({ title: "Saved", variant: "success" });
|
|
71
|
+
toast({ title: "Failed", variant: "error" });
|
|
72
|
+
toast({ title: "Working", variant: "loading" });
|
|
73
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
74
|
+
expect(toastPanels().map((el) => el.getAttribute("data-variant"))).toEqual([
|
|
75
|
+
"success",
|
|
76
|
+
"error",
|
|
77
|
+
"loading",
|
|
78
|
+
]);
|
|
79
|
+
});
|
|
80
|
+
it("fires the action callback without dismissing the toast", async () => {
|
|
81
|
+
const onClick = vi.fn();
|
|
82
|
+
render(Toaster);
|
|
83
|
+
toast({
|
|
84
|
+
title: "Failed to send",
|
|
85
|
+
variant: "error",
|
|
86
|
+
duration: Infinity,
|
|
87
|
+
action: { label: "Retry", onClick },
|
|
88
|
+
});
|
|
89
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
90
|
+
const actionButton = toastPanels()[0].querySelector("button.ft-toast-action");
|
|
91
|
+
await fireEvent.click(actionButton);
|
|
92
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
93
|
+
expect(toastPanels()).toHaveLength(1);
|
|
94
|
+
});
|
|
95
|
+
it("does not auto-dismiss a toast with an action while the pointer is on it", async () => {
|
|
96
|
+
render(Toaster);
|
|
97
|
+
toast({
|
|
98
|
+
title: "Failed to send",
|
|
99
|
+
variant: "error",
|
|
100
|
+
duration: 1000,
|
|
101
|
+
action: { label: "Retry", onClick: () => { } },
|
|
102
|
+
});
|
|
103
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
104
|
+
const panel = toastPanels()[0];
|
|
105
|
+
panel.dispatchEvent(new PointerEvent("pointerenter", { bubbles: true }));
|
|
106
|
+
await vi.advanceTimersByTimeAsync(5000);
|
|
107
|
+
expect(toastPanels()).toHaveLength(1);
|
|
108
|
+
panel.dispatchEvent(new PointerEvent("pointerleave", { bubbles: true }));
|
|
109
|
+
await vi.advanceTimersByTimeAsync(1000);
|
|
110
|
+
expect(toastPanels()).toHaveLength(0);
|
|
111
|
+
});
|
|
112
|
+
// The pause/resume wiring (`hovering`/`focusedWithin`/`syncTimer` in
|
|
113
|
+
// Toast.svelte) is on every toast's root unconditionally — nothing there
|
|
114
|
+
// reads `item.action`. The two tests above only ever construct toasts
|
|
115
|
+
// with an action, so on their own they'd equally pass a version of the
|
|
116
|
+
// code that gated pausing on `item.action` existing. This test is the one
|
|
117
|
+
// that actually proves the protection is unconditional, not incidental
|
|
118
|
+
// to always having tested it alongside an action.
|
|
119
|
+
it("pauses on hover even without an action — the protection isn't scoped to actionable toasts", async () => {
|
|
120
|
+
render(Toaster);
|
|
121
|
+
toast({ title: "Theme saved", variant: "success", duration: 1000 });
|
|
122
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
123
|
+
const panel = toastPanels()[0];
|
|
124
|
+
expect(panel.querySelector(".ft-toast-action")).toBeNull();
|
|
125
|
+
panel.dispatchEvent(new PointerEvent("pointerenter", { bubbles: true }));
|
|
126
|
+
await vi.advanceTimersByTimeAsync(5000);
|
|
127
|
+
expect(toastPanels()).toHaveLength(1);
|
|
128
|
+
panel.dispatchEvent(new PointerEvent("pointerleave", { bubbles: true }));
|
|
129
|
+
await vi.advanceTimersByTimeAsync(1000);
|
|
130
|
+
expect(toastPanels()).toHaveLength(0);
|
|
131
|
+
});
|
|
132
|
+
it("pauses on focus within and resumes on blur, not just on hover", async () => {
|
|
133
|
+
render(Toaster);
|
|
134
|
+
toast({
|
|
135
|
+
title: "Failed to send",
|
|
136
|
+
variant: "error",
|
|
137
|
+
duration: 1000,
|
|
138
|
+
action: { label: "Retry", onClick: () => { } },
|
|
139
|
+
});
|
|
140
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
141
|
+
const actionButton = toastPanels()[0].querySelector("button.ft-toast-action");
|
|
142
|
+
actionButton.focus();
|
|
143
|
+
await vi.advanceTimersByTimeAsync(5000);
|
|
144
|
+
expect(toastPanels()).toHaveLength(1);
|
|
145
|
+
actionButton.blur();
|
|
146
|
+
await vi.advanceTimersByTimeAsync(1000);
|
|
147
|
+
expect(toastPanels()).toHaveLength(0);
|
|
148
|
+
});
|
|
149
|
+
it("never auto-dismisses when duration is Infinity", async () => {
|
|
150
|
+
render(Toaster);
|
|
151
|
+
toast({ title: "Sticky", duration: Infinity });
|
|
152
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
153
|
+
expect(toastPanels()).toHaveLength(1);
|
|
154
|
+
await vi.advanceTimersByTimeAsync(10_000_000);
|
|
155
|
+
expect(toastPanels()).toHaveLength(1);
|
|
156
|
+
});
|
|
157
|
+
it("defaults loading toasts to sticky", async () => {
|
|
158
|
+
render(Toaster);
|
|
159
|
+
toast({ title: "Publishing…", variant: "loading" });
|
|
160
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
161
|
+
expect(toastPanels()).toHaveLength(1);
|
|
162
|
+
await vi.advanceTimersByTimeAsync(60_000);
|
|
163
|
+
expect(toastPanels()).toHaveLength(1);
|
|
164
|
+
});
|
|
165
|
+
it("dismisses programmatically by id", async () => {
|
|
166
|
+
render(Toaster);
|
|
167
|
+
const id = toast({ title: "Bye", duration: Infinity });
|
|
168
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
169
|
+
expect(toastPanels()).toHaveLength(1);
|
|
170
|
+
dismissToast(id);
|
|
171
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
172
|
+
expect(toastPanels()).toHaveLength(0);
|
|
173
|
+
});
|
|
174
|
+
it("dismisses via its own close button", async () => {
|
|
175
|
+
render(Toaster);
|
|
176
|
+
toast({ title: "Bye", duration: Infinity });
|
|
177
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
178
|
+
const closeButton = toastPanels()[0].querySelector('button[aria-label="Dismiss"]');
|
|
179
|
+
await fireEvent.click(closeButton);
|
|
180
|
+
expect(toastPanels()).toHaveLength(0);
|
|
181
|
+
});
|
|
182
|
+
it("keeps at most 4 toasts, dismissing the oldest to make room for the newest", async () => {
|
|
183
|
+
render(Toaster);
|
|
184
|
+
toast({ title: "One", duration: Infinity });
|
|
185
|
+
toast({ title: "Two", duration: Infinity });
|
|
186
|
+
toast({ title: "Three", duration: Infinity });
|
|
187
|
+
toast({ title: "Four", duration: Infinity });
|
|
188
|
+
toast({ title: "Five", duration: Infinity });
|
|
189
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
190
|
+
const panels = toastPanels();
|
|
191
|
+
expect(panels).toHaveLength(4);
|
|
192
|
+
expect(panels[0].textContent).toContain("Two");
|
|
193
|
+
expect(panels[3].textContent).toContain("Five");
|
|
194
|
+
expect(panels.some((el) => el.textContent?.includes("One"))).toBe(false);
|
|
195
|
+
});
|
|
196
|
+
it("preserves DOM identity of surviving toasts when one in the middle is dismissed", async () => {
|
|
197
|
+
render(Toaster);
|
|
198
|
+
const aId = toast({ title: "A", duration: Infinity });
|
|
199
|
+
const bId = toast({ title: "B", duration: Infinity });
|
|
200
|
+
const cId = toast({ title: "C", duration: Infinity });
|
|
201
|
+
void aId;
|
|
202
|
+
void cId;
|
|
203
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
204
|
+
const [aEl, , cEl] = toastPanels();
|
|
205
|
+
dismissToast(bId);
|
|
206
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
207
|
+
const remaining = toastPanels();
|
|
208
|
+
expect(remaining).toHaveLength(2);
|
|
209
|
+
expect(remaining[0]).toBe(aEl);
|
|
210
|
+
expect(remaining[1]).toBe(cEl);
|
|
211
|
+
});
|
|
212
|
+
it("tells apart two toasts with identical content by id, not position", async () => {
|
|
213
|
+
render(Toaster);
|
|
214
|
+
const firstId = toast({ title: "Same title", duration: Infinity });
|
|
215
|
+
const secondId = toast({ title: "Same title", duration: Infinity });
|
|
216
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
217
|
+
expect(toastPanels()).toHaveLength(2);
|
|
218
|
+
dismissToast(firstId);
|
|
219
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
220
|
+
expect(toastPanels()).toHaveLength(1);
|
|
221
|
+
expect(toastStore.items[0]?.id).toBe(secondId);
|
|
222
|
+
});
|
|
223
|
+
it("stops its live timer on unmount, without losing the toast's deadline", async () => {
|
|
224
|
+
const { unmount } = render(Toaster);
|
|
225
|
+
toast({ title: "Paused between viewports", duration: 1000 });
|
|
226
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
227
|
+
expect(toastStore.items).toHaveLength(1);
|
|
228
|
+
unmount();
|
|
229
|
+
// A timer left running through this gap would have fired well before
|
|
230
|
+
// now — this proves it's genuinely stopped, not merely not-yet-due.
|
|
231
|
+
await vi.advanceTimersByTimeAsync(5000);
|
|
232
|
+
expect(toastStore.items).toHaveLength(1);
|
|
233
|
+
});
|
|
234
|
+
it("re-arms a toast a new Toaster inherits, rather than leaving it stuck forever", async () => {
|
|
235
|
+
const { unmount } = render(Toaster);
|
|
236
|
+
toast({ title: "Will resume elsewhere", duration: 1000 });
|
|
237
|
+
await vi.advanceTimersByTimeAsync(200); // 800ms left when the viewport goes away
|
|
238
|
+
expect(toastStore.items).toHaveLength(1);
|
|
239
|
+
unmount();
|
|
240
|
+
await vi.advanceTimersByTimeAsync(5000); // the gap between viewports
|
|
241
|
+
expect(toastStore.items).toHaveLength(1); // still here, still stopped
|
|
242
|
+
// A different Toaster mounts later and inherits the still-pending toast.
|
|
243
|
+
render(Toaster);
|
|
244
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
245
|
+
// Its deadline was already in the past by the time anything remounted
|
|
246
|
+
// to re-arm it, so it dismisses on the very next tick rather than
|
|
247
|
+
// waiting out a fresh duration.
|
|
248
|
+
expect(toastStore.items).toHaveLength(0);
|
|
249
|
+
});
|
|
250
|
+
it("re-arms a toast to its real remaining time, not a fresh duration", async () => {
|
|
251
|
+
const { unmount } = render(Toaster);
|
|
252
|
+
toast({ title: "Resumes with what was left", duration: 2000 });
|
|
253
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
254
|
+
unmount();
|
|
255
|
+
await vi.advanceTimersByTimeAsync(500); // 1500ms still owed when it comes back
|
|
256
|
+
render(Toaster);
|
|
257
|
+
await vi.advanceTimersByTimeAsync(1499);
|
|
258
|
+
expect(toastStore.items).toHaveLength(1); // not yet — this is real remaining time, not 2000ms again
|
|
259
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
260
|
+
expect(toastStore.items).toHaveLength(0);
|
|
261
|
+
});
|
|
262
|
+
it("queues toasts even before any Toaster is mounted", async () => {
|
|
263
|
+
toast({ title: "Early bird", duration: Infinity });
|
|
264
|
+
render(Toaster);
|
|
265
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
266
|
+
expect(toastPanels()).toHaveLength(1);
|
|
267
|
+
});
|
|
268
|
+
it("is a no-op outside the browser", () => {
|
|
269
|
+
vi.stubGlobal("window", undefined);
|
|
270
|
+
const id = toast({ title: "Server side" });
|
|
271
|
+
expect(id).toBe("");
|
|
272
|
+
expect(toastStore.items).toHaveLength(0);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type ToasterPosition =
|
|
3
|
+
| "top-left"
|
|
4
|
+
| "top-center"
|
|
5
|
+
| "top-right"
|
|
6
|
+
| "bottom-left"
|
|
7
|
+
| "bottom-center"
|
|
8
|
+
| "bottom-right";
|
|
9
|
+
|
|
10
|
+
export interface ToasterProps {
|
|
11
|
+
/** Corner (or edge-center) the stack anchors to. Defaults to `"bottom-right"`. */
|
|
12
|
+
position?: ToasterPosition;
|
|
13
|
+
/** Additional classes for the viewport that stacks the toasts. */
|
|
14
|
+
class?: string;
|
|
15
|
+
/** Element reference for the root node. */
|
|
16
|
+
ref?: HTMLDivElement | null;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { onDestroy, onMount } from "svelte";
|
|
22
|
+
import { cn } from "../../utils.js";
|
|
23
|
+
import { portal } from "../_internals/portal.js";
|
|
24
|
+
import { toastStore, clearAllToastTimers, rearmToastTimers } from "./store.svelte.js";
|
|
25
|
+
import type { ToastItem } from "./store.svelte.js";
|
|
26
|
+
import Toast from "./Toast.svelte";
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
position = "bottom-right",
|
|
30
|
+
class: className,
|
|
31
|
+
ref = $bindable(null),
|
|
32
|
+
}: ToasterProps = $props();
|
|
33
|
+
|
|
34
|
+
// Two regions, mounted empty and never re-created — only their *content*
|
|
35
|
+
// changes. A live region created at the moment of the announcement is not
|
|
36
|
+
// reliably picked up by screen readers; existing from mount and being
|
|
37
|
+
// updated in place is what makes the announcement land. Two of them, not
|
|
38
|
+
// one, because politeness is fixed per region: `polite` must never be
|
|
39
|
+
// upgraded to `assertive` (or the reverse) by mutating the same element's
|
|
40
|
+
// aria-live attribute, which most screen readers do not pick up reliably
|
|
41
|
+
// after the region already exists.
|
|
42
|
+
let politeAnnouncement = $state("");
|
|
43
|
+
let assertiveAnnouncement = $state("");
|
|
44
|
+
|
|
45
|
+
// Ids already announced, refreshed to exactly the current stack on every
|
|
46
|
+
// run — bounded to "currently visible", rather than growing forever for
|
|
47
|
+
// the life of the page.
|
|
48
|
+
let announcedIds = new Set<string>();
|
|
49
|
+
|
|
50
|
+
function announcementText(item: ToastItem): string {
|
|
51
|
+
return item.description ? `${item.title}. ${item.description}` : item.title;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
$effect(() => {
|
|
55
|
+
const current = toastStore.items;
|
|
56
|
+
for (const item of current) {
|
|
57
|
+
if (announcedIds.has(item.id)) continue;
|
|
58
|
+
if (item.variant === "error") {
|
|
59
|
+
assertiveAnnouncement = announcementText(item);
|
|
60
|
+
} else {
|
|
61
|
+
politeAnnouncement = announcementText(item);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
announcedIds = new Set(current.map((item) => item.id));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// The other half of `onDestroy` below: a toast that was already ticking
|
|
68
|
+
// down when the *previous* `<Toaster>` unmounted has a real deadline but
|
|
69
|
+
// no live timer counting toward it (that timer was cleared, deliberately
|
|
70
|
+
// — see `clearAllToastTimers`). Re-arming on mount is what stops such a
|
|
71
|
+
// toast from being stuck on screen forever with nothing left to dismiss
|
|
72
|
+
// it — `onMount` rather than a bare call in the script body so this only
|
|
73
|
+
// ever runs in the browser, never during SSR.
|
|
74
|
+
onMount(() => {
|
|
75
|
+
rearmToastTimers();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Stops the live timers, not the toasts or their deadlines — see
|
|
79
|
+
// `clearAllToastTimers`'s own doc comment for why unmounting isn't
|
|
80
|
+
// treated as pausing.
|
|
81
|
+
onDestroy(() => {
|
|
82
|
+
clearAllToastTimers();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const POSITION_CLASSES: Record<ToasterPosition, string> = {
|
|
86
|
+
"top-left": "top-4 left-4 items-start",
|
|
87
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2 items-center",
|
|
88
|
+
"top-right": "top-4 right-4 items-end",
|
|
89
|
+
"bottom-left": "bottom-4 left-4 items-start",
|
|
90
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center",
|
|
91
|
+
"bottom-right": "bottom-4 right-4 items-end",
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<div bind:this={ref} class={cn("ft-toaster contents", className)} use:portal>
|
|
96
|
+
<div aria-live="polite" aria-atomic="true" class="sr-only">{politeAnnouncement}</div>
|
|
97
|
+
<div aria-live="assertive" aria-atomic="true" class="sr-only">{assertiveAnnouncement}</div>
|
|
98
|
+
|
|
99
|
+
<div
|
|
100
|
+
class={cn(
|
|
101
|
+
"ft-toaster-viewport pointer-events-none fixed z-50 flex flex-col gap-2",
|
|
102
|
+
POSITION_CLASSES[position]
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
105
|
+
{#each toastStore.items as item (item.id)}
|
|
106
|
+
<div class="pointer-events-auto">
|
|
107
|
+
<Toast {item} />
|
|
108
|
+
</div>
|
|
109
|
+
{/each}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ToasterPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
2
|
+
export interface ToasterProps {
|
|
3
|
+
/** Corner (or edge-center) the stack anchors to. Defaults to `"bottom-right"`. */
|
|
4
|
+
position?: ToasterPosition;
|
|
5
|
+
/** Additional classes for the viewport that stacks the toasts. */
|
|
6
|
+
class?: string;
|
|
7
|
+
/** Element reference for the root node. */
|
|
8
|
+
ref?: HTMLDivElement | null;
|
|
9
|
+
}
|
|
10
|
+
declare const Toaster: import("svelte").Component<ToasterProps, {}, "ref">;
|
|
11
|
+
type Toaster = ReturnType<typeof Toaster>;
|
|
12
|
+
export default Toaster;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Toast, { type ToastProps } from "./Toast.svelte";
|
|
2
|
+
import Toaster, { type ToasterProps, type ToasterPosition } from "./Toaster.svelte";
|
|
3
|
+
import { toast, dismissToast, type ToastVariant, type ToastAction, type ToastOptions, type ToastItem } from "./store.svelte.js";
|
|
4
|
+
export { Toast, type ToastProps, Toaster, type ToasterProps, type ToasterPosition, toast, dismissToast, type ToastVariant, type ToastAction, type ToastOptions, type ToastItem, };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast store — a module-level singleton, unlike every other reactive helper
|
|
3
|
+
* in this library (which is a per-instance factory a component calls).
|
|
4
|
+
* `toast()` has to be callable from anywhere — a submit handler, a promise
|
|
5
|
+
* rejection, code with no component instance in scope at all — so there can
|
|
6
|
+
* only be one stack per app, shared by whichever `<Toaster>` is mounted.
|
|
7
|
+
*
|
|
8
|
+
* This file owns the data and the timers. `Toast.svelte` and `Toaster.svelte`
|
|
9
|
+
* only render what this exposes; they never touch `items` or the timer map
|
|
10
|
+
* directly.
|
|
11
|
+
*/
|
|
12
|
+
export type ToastVariant = "success" | "error" | "info" | "loading";
|
|
13
|
+
export interface ToastAction {
|
|
14
|
+
/** Label for the toast's single optional action button, e.g. "Retry". */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Called on activation. Does not dismiss the toast on its own — call `dismissToast` from inside if the action should also close it. */
|
|
17
|
+
onClick: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ToastOptions {
|
|
20
|
+
/** Primary line. */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Secondary line, shown under the title. */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Controls the icon, the accent color, and the live region's politeness. Defaults to `"info"`. */
|
|
25
|
+
variant?: ToastVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Milliseconds before auto-dismiss. `Infinity` means sticky — it never
|
|
28
|
+
* auto-dismisses. Defaults to 5000, except for `variant: "loading"`, which
|
|
29
|
+
* defaults to `Infinity`: a loading toast has no natural "done" time, and
|
|
30
|
+
* auto-dismissing it after a fixed delay would misreport an operation
|
|
31
|
+
* that is still running as finished.
|
|
32
|
+
*/
|
|
33
|
+
duration?: number;
|
|
34
|
+
/** A single optional action button. */
|
|
35
|
+
action?: ToastAction;
|
|
36
|
+
}
|
|
37
|
+
export interface ToastItem {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly title: string;
|
|
40
|
+
readonly description?: string;
|
|
41
|
+
readonly variant: ToastVariant;
|
|
42
|
+
readonly duration: number;
|
|
43
|
+
readonly action?: ToastAction;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Queues a toast and returns its id (usable with `dismissToast`). A no-op
|
|
47
|
+
* that returns `""` when called outside the browser: there is no client to
|
|
48
|
+
* show it to, and a module-level list surviving across requests on a
|
|
49
|
+
* long-lived server would leak toasts between unrelated users — the same
|
|
50
|
+
* trap `_internals/id.ts`'s `uid()` guards against for the same reason.
|
|
51
|
+
*/
|
|
52
|
+
export declare function toast(options: ToastOptions): string;
|
|
53
|
+
/** Dismisses a toast immediately and clears its timer. Safe to call with an id that no longer exists. */
|
|
54
|
+
export declare function dismissToast(id: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Pauses a toast's auto-dismiss countdown — e.g. while the pointer or focus
|
|
57
|
+
* is on it — so `resumeToast` can continue it rather than restart it. A
|
|
58
|
+
* no-op for a sticky toast or one already paused (or already unarmed for
|
|
59
|
+
* some other reason, e.g. no `<Toaster>` currently mounted to run it).
|
|
60
|
+
*/
|
|
61
|
+
export declare function pauseToast(id: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Resumes a paused toast's countdown from where it left off — the deadline
|
|
64
|
+
* shifts forward by exactly how long it spent paused, so the toast still
|
|
65
|
+
* gets the same amount of on-screen, unpaused time it was promised. A no-op
|
|
66
|
+
* if a live timer is already counting down (nothing to resume).
|
|
67
|
+
*/
|
|
68
|
+
export declare function resumeToast(id: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Clears every pending timer's *handle* without touching the toasts or their
|
|
71
|
+
* deadlines. `<Toaster>` calls this when it unmounts. Deliberately does not
|
|
72
|
+
* touch `deadline`: unmounting isn't pausing — there is no pointer left
|
|
73
|
+
* hovering anything for a destroyed viewport, so the countdown a toast was
|
|
74
|
+
* promised keeps running in real time whether or not something is currently
|
|
75
|
+
* rendering it. `rearmToastTimers` is the other half of this: whatever a new
|
|
76
|
+
* `<Toaster>` inherits gets a live timer again, counting toward the same
|
|
77
|
+
* deadline. Also clears any stale `pausedAt` — a pause tied to a hover/focus
|
|
78
|
+
* on a now-destroyed element cannot mean anything to whatever mounts next.
|
|
79
|
+
*/
|
|
80
|
+
export declare function clearAllToastTimers(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Re-arms every timer left unarmed with nothing currently pausing it — i.e.
|
|
83
|
+
* every finite-duration toast whose previous `<Toaster>` went away before
|
|
84
|
+
* its time was up. Call this from a `<Toaster>`'s own mount: without it, a
|
|
85
|
+
* toast that outlives one viewport and is picked up by another stays
|
|
86
|
+
* visible forever with no timer ever going to dismiss it, since nothing else
|
|
87
|
+
* re-arms what `clearAllToastTimers` cleared. A deadline already in the past
|
|
88
|
+
* (the gap between viewports was longer than the time left) re-arms to a
|
|
89
|
+
* near-immediate dismiss through the same path, rather than a special case.
|
|
90
|
+
*/
|
|
91
|
+
export declare function rearmToastTimers(): void;
|
|
92
|
+
/** Read-only view of the current toast stack, oldest first. `<Toaster>` renders this directly; nothing else should need to. */
|
|
93
|
+
export declare const toastStore: {
|
|
94
|
+
readonly items: readonly ToastItem[];
|
|
95
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast store — a module-level singleton, unlike every other reactive helper
|
|
3
|
+
* in this library (which is a per-instance factory a component calls).
|
|
4
|
+
* `toast()` has to be callable from anywhere — a submit handler, a promise
|
|
5
|
+
* rejection, code with no component instance in scope at all — so there can
|
|
6
|
+
* only be one stack per app, shared by whichever `<Toaster>` is mounted.
|
|
7
|
+
*
|
|
8
|
+
* This file owns the data and the timers. `Toast.svelte` and `Toaster.svelte`
|
|
9
|
+
* only render what this exposes; they never touch `items` or the timer map
|
|
10
|
+
* directly.
|
|
11
|
+
*/
|
|
12
|
+
/** Toasts visible at once. Past this, the oldest is dismissed to make room for the newest. */
|
|
13
|
+
const MAX_VISIBLE = 4;
|
|
14
|
+
const DEFAULT_DURATION = 5000;
|
|
15
|
+
let items = $state([]);
|
|
16
|
+
let seq = 0;
|
|
17
|
+
// Timers live outside `items` — they are bookkeeping the UI never renders,
|
|
18
|
+
// not state a template reads, so there is nothing to gain from making this
|
|
19
|
+
// reactive and a `Map` mutated from a `setTimeout` callback is simpler than
|
|
20
|
+
// juggling `$state` for it.
|
|
21
|
+
const timers = new Map();
|
|
22
|
+
function clearHandle(id) {
|
|
23
|
+
const entry = timers.get(id);
|
|
24
|
+
if (entry?.handle !== undefined) {
|
|
25
|
+
clearTimeout(entry.handle);
|
|
26
|
+
entry.handle = undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Arms (or re-arms) the live timer counting down to an entry's stored `deadline`. */
|
|
30
|
+
function armHandle(id) {
|
|
31
|
+
const entry = timers.get(id);
|
|
32
|
+
if (!entry)
|
|
33
|
+
return;
|
|
34
|
+
const ms = Math.max(0, entry.deadline - Date.now());
|
|
35
|
+
entry.handle = setTimeout(() => dismissToast(id), ms);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Queues a toast and returns its id (usable with `dismissToast`). A no-op
|
|
39
|
+
* that returns `""` when called outside the browser: there is no client to
|
|
40
|
+
* show it to, and a module-level list surviving across requests on a
|
|
41
|
+
* long-lived server would leak toasts between unrelated users — the same
|
|
42
|
+
* trap `_internals/id.ts`'s `uid()` guards against for the same reason.
|
|
43
|
+
*/
|
|
44
|
+
export function toast(options) {
|
|
45
|
+
if (typeof window === "undefined") {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
seq += 1;
|
|
49
|
+
const id = `toast-${seq}`;
|
|
50
|
+
const variant = options.variant ?? "info";
|
|
51
|
+
const duration = options.duration ?? (variant === "loading" ? Infinity : DEFAULT_DURATION);
|
|
52
|
+
const item = {
|
|
53
|
+
id,
|
|
54
|
+
title: options.title,
|
|
55
|
+
description: options.description,
|
|
56
|
+
variant,
|
|
57
|
+
duration,
|
|
58
|
+
action: options.action,
|
|
59
|
+
};
|
|
60
|
+
// Append-ordered, so index 0 is always the longest-standing toast — the
|
|
61
|
+
// one evicted when a new toast would push the stack past the limit.
|
|
62
|
+
const next = [...items, item];
|
|
63
|
+
if (next.length > MAX_VISIBLE) {
|
|
64
|
+
const evicted = next.shift();
|
|
65
|
+
if (evicted) {
|
|
66
|
+
clearHandle(evicted.id);
|
|
67
|
+
timers.delete(evicted.id);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
items = next;
|
|
71
|
+
if (Number.isFinite(duration)) {
|
|
72
|
+
timers.set(id, { handle: undefined, deadline: Date.now() + duration, pausedAt: undefined });
|
|
73
|
+
armHandle(id);
|
|
74
|
+
}
|
|
75
|
+
return id;
|
|
76
|
+
}
|
|
77
|
+
/** Dismisses a toast immediately and clears its timer. Safe to call with an id that no longer exists. */
|
|
78
|
+
export function dismissToast(id) {
|
|
79
|
+
items = items.filter((item) => item.id !== id);
|
|
80
|
+
clearHandle(id);
|
|
81
|
+
timers.delete(id);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Pauses a toast's auto-dismiss countdown — e.g. while the pointer or focus
|
|
85
|
+
* is on it — so `resumeToast` can continue it rather than restart it. A
|
|
86
|
+
* no-op for a sticky toast or one already paused (or already unarmed for
|
|
87
|
+
* some other reason, e.g. no `<Toaster>` currently mounted to run it).
|
|
88
|
+
*/
|
|
89
|
+
export function pauseToast(id) {
|
|
90
|
+
const entry = timers.get(id);
|
|
91
|
+
if (!entry || entry.handle === undefined)
|
|
92
|
+
return;
|
|
93
|
+
clearHandle(id);
|
|
94
|
+
entry.pausedAt = Date.now();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resumes a paused toast's countdown from where it left off — the deadline
|
|
98
|
+
* shifts forward by exactly how long it spent paused, so the toast still
|
|
99
|
+
* gets the same amount of on-screen, unpaused time it was promised. A no-op
|
|
100
|
+
* if a live timer is already counting down (nothing to resume).
|
|
101
|
+
*/
|
|
102
|
+
export function resumeToast(id) {
|
|
103
|
+
const entry = timers.get(id);
|
|
104
|
+
if (!entry || entry.handle !== undefined)
|
|
105
|
+
return;
|
|
106
|
+
if (entry.pausedAt !== undefined) {
|
|
107
|
+
entry.deadline += Date.now() - entry.pausedAt;
|
|
108
|
+
entry.pausedAt = undefined;
|
|
109
|
+
}
|
|
110
|
+
if (entry.deadline <= Date.now()) {
|
|
111
|
+
dismissToast(id);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
armHandle(id);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Clears every pending timer's *handle* without touching the toasts or their
|
|
118
|
+
* deadlines. `<Toaster>` calls this when it unmounts. Deliberately does not
|
|
119
|
+
* touch `deadline`: unmounting isn't pausing — there is no pointer left
|
|
120
|
+
* hovering anything for a destroyed viewport, so the countdown a toast was
|
|
121
|
+
* promised keeps running in real time whether or not something is currently
|
|
122
|
+
* rendering it. `rearmToastTimers` is the other half of this: whatever a new
|
|
123
|
+
* `<Toaster>` inherits gets a live timer again, counting toward the same
|
|
124
|
+
* deadline. Also clears any stale `pausedAt` — a pause tied to a hover/focus
|
|
125
|
+
* on a now-destroyed element cannot mean anything to whatever mounts next.
|
|
126
|
+
*/
|
|
127
|
+
export function clearAllToastTimers() {
|
|
128
|
+
for (const entry of timers.values()) {
|
|
129
|
+
if (entry.handle !== undefined) {
|
|
130
|
+
clearTimeout(entry.handle);
|
|
131
|
+
entry.handle = undefined;
|
|
132
|
+
}
|
|
133
|
+
entry.pausedAt = undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Re-arms every timer left unarmed with nothing currently pausing it — i.e.
|
|
138
|
+
* every finite-duration toast whose previous `<Toaster>` went away before
|
|
139
|
+
* its time was up. Call this from a `<Toaster>`'s own mount: without it, a
|
|
140
|
+
* toast that outlives one viewport and is picked up by another stays
|
|
141
|
+
* visible forever with no timer ever going to dismiss it, since nothing else
|
|
142
|
+
* re-arms what `clearAllToastTimers` cleared. A deadline already in the past
|
|
143
|
+
* (the gap between viewports was longer than the time left) re-arms to a
|
|
144
|
+
* near-immediate dismiss through the same path, rather than a special case.
|
|
145
|
+
*/
|
|
146
|
+
export function rearmToastTimers() {
|
|
147
|
+
for (const [id, entry] of timers) {
|
|
148
|
+
if (entry.handle !== undefined)
|
|
149
|
+
continue; // already counting down
|
|
150
|
+
if (entry.pausedAt !== undefined)
|
|
151
|
+
continue; // genuinely paused; resumeToast's job
|
|
152
|
+
armHandle(id);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Read-only view of the current toast stack, oldest first. `<Toaster>` renders this directly; nothing else should need to. */
|
|
156
|
+
export const toastStore = {
|
|
157
|
+
get items() {
|
|
158
|
+
return items;
|
|
159
|
+
},
|
|
160
|
+
};
|