entasis 0.11.0 → 0.12.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 +1 -1
- package/dist/attachments/disclosurePanel.svelte.d.ts +84 -0
- package/dist/attachments/disclosurePanel.svelte.js +277 -0
- package/dist/attachments/portal.d.ts +17 -1
- package/dist/attachments/portal.js +39 -2
- package/dist/attachments/spinnerOverlay.svelte.js +12 -0
- package/dist/attachments/transitionSize.d.ts +6 -0
- package/dist/attachments/transitionSize.js +30 -0
- package/dist/components/AIAskUserQuestion/AIAskUserQuestion.svelte +131 -17
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionFileStep.svelte +26 -6
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionFileStep.svelte.d.ts +6 -0
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionFooter.svelte +27 -53
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionFooter.svelte.d.ts +3 -4
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionHeader.svelte +19 -16
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionStep.svelte +180 -21
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionStep.svelte.d.ts +9 -1
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionSummary.svelte +56 -0
- package/dist/components/AIAskUserQuestion/AIAskUserQuestionSummary.svelte.d.ts +4 -0
- package/dist/components/AIAskUserQuestion/aiAskUserQuestion.mcp.d.ts +1 -1
- package/dist/components/AIAskUserQuestion/aiAskUserQuestion.mcp.js +26 -8
- package/dist/components/AIAskUserQuestion/aiAskUserQuestion.props.d.ts +62 -5
- package/dist/components/AIAskUserQuestion/aiAskUserQuestion.theme.d.ts +42 -0
- package/dist/components/AIAskUserQuestion/aiAskUserQuestion.theme.js +53 -12
- package/dist/components/AIAskUserQuestion/aiAskUserQuestionAnswers.d.ts +17 -1
- package/dist/components/AIAskUserQuestion/aiAskUserQuestionAnswers.js +56 -8
- package/dist/components/AIAskUserQuestion/index.d.ts +3 -1
- package/dist/components/AIAskUserQuestion/index.js +2 -0
- package/dist/components/AIAskUserQuestion/schemas.d.ts +44 -0
- package/dist/components/AIAskUserQuestion/schemas.js +10 -3
- package/dist/components/AIChat/AIChat.svelte +10 -0
- package/dist/components/AIChat/AIChat.svelte.d.ts +2 -2
- package/dist/components/AIChat/AIChatComposerSurface.svelte +23 -5
- package/dist/components/AIChat/AIChatComposerSurface.svelte.d.ts +5 -0
- package/dist/components/AIChat/AIChatSkeleton.svelte +29 -37
- package/dist/components/AIChat/AIChatSurface.svelte +30 -2
- package/dist/components/AIChat/AIChatSurface.svelte.d.ts +1 -1
- package/dist/components/AIChat/AIChatThreadSurface.svelte +11 -1
- package/dist/components/AIChat/AIChatThreadSurface.svelte.d.ts +3 -1
- package/dist/components/AIChat/aiChat.mcp.d.ts +1 -1
- package/dist/components/AIChat/aiChat.mcp.js +31 -15
- package/dist/components/AIChat/aiChat.props.d.ts +36 -10
- package/dist/components/AIChat/aiChat.theme.d.ts +9 -0
- package/dist/components/AIChat/aiChat.theme.js +21 -4
- package/dist/components/AIChat/aiChatSkeleton.props.d.ts +5 -0
- package/dist/components/AIChat/index.d.ts +1 -1
- package/dist/components/AIComposer/AIComposer.svelte +102 -5
- package/dist/components/AIComposer/AIComposer.svelte.d.ts +1 -0
- package/dist/components/AIComposer/AIComposerFooter.svelte +54 -12
- package/dist/components/AIComposer/AIComposerFooter.svelte.d.ts +2 -0
- package/dist/components/AIComposer/AIComposerQueue.svelte +8 -3
- package/dist/components/AIComposer/aiComposer.editor.theme.js +13 -2
- package/dist/components/AIComposer/aiComposer.mcp.d.ts +1 -1
- package/dist/components/AIComposer/aiComposer.mcp.js +15 -7
- package/dist/components/AIComposer/aiComposer.props.d.ts +27 -7
- package/dist/components/AIComposer/aiComposer.theme.d.ts +42 -3
- package/dist/components/AIComposer/aiComposer.theme.js +37 -5
- package/dist/components/AIComposer/aiComposerFileController.svelte.d.ts +20 -0
- package/dist/components/AIComposer/aiComposerFileController.svelte.js +75 -9
- package/dist/components/AIComposer/aiComposerSourceAdapter.js +22 -4
- package/dist/components/AIComposer/aiComposerSubmitController.svelte.d.ts +12 -0
- package/dist/components/AIComposer/aiComposerSubmitController.svelte.js +16 -6
- package/dist/components/AIContext/AIContext.svelte +7 -3
- package/dist/components/AIContext/aiContext.mcp.d.ts +1 -1
- package/dist/components/AIContext/aiContext.mcp.js +1 -1
- package/dist/components/AIContext/aiContext.props.d.ts +4 -1
- package/dist/components/AIContext/aiContext.theme.d.ts +3 -0
- package/dist/components/AIContext/aiContext.theme.js +7 -2
- package/dist/components/AIConversation/AIConversation.svelte.d.ts +2 -2
- package/dist/components/AIFilePreview/aiFilePreview.theme.js +1 -1
- package/dist/components/AIMarker/AIMarker.svelte +2 -0
- package/dist/components/AIMarker/aiMarker.mcp.d.ts +1 -1
- package/dist/components/AIMarker/aiMarker.mcp.js +2 -0
- package/dist/components/AIMarker/aiMarker.props.d.ts +3 -0
- package/dist/components/AIMarker/aiMarker.theme.js +2 -2
- package/dist/components/AIMessage/AIMessage.svelte +38 -16
- package/dist/components/AIMessage/aiMessage.mcp.d.ts +1 -1
- package/dist/components/AIMessage/aiMessage.mcp.js +20 -6
- package/dist/components/AIMessage/aiMessage.props.d.ts +18 -2
- package/dist/components/AIMessage/aiMessage.theme.d.ts +51 -6
- package/dist/components/AIMessage/aiMessage.theme.js +91 -32
- package/dist/components/AIMessageActions/AIMessageActions.svelte +19 -9
- package/dist/components/AIMessageActions/aiMessageActions.mcp.d.ts +1 -1
- package/dist/components/AIMessageActions/aiMessageActions.mcp.js +11 -3
- package/dist/components/AIMessageActions/aiMessageActions.theme.js +36 -9
- package/dist/components/AIModelSelector/AIModelSelector.svelte +25 -10
- package/dist/components/AIModelSelector/aiModelSelector.mcp.d.ts +1 -1
- package/dist/components/AIModelSelector/aiModelSelector.mcp.js +1 -1
- package/dist/components/AIModelSelector/aiModelSelector.theme.d.ts +3 -0
- package/dist/components/AIModelSelector/aiModelSelector.theme.js +7 -3
- package/dist/components/AIReasoning/AIReasoning.svelte +135 -38
- package/dist/components/AIReasoning/aiReasoning.mcp.d.ts +1 -1
- package/dist/components/AIReasoning/aiReasoning.mcp.js +11 -5
- package/dist/components/AIReasoning/aiReasoning.props.d.ts +15 -4
- package/dist/components/AIReasoning/aiReasoning.theme.d.ts +45 -0
- package/dist/components/AIReasoning/aiReasoning.theme.js +47 -7
- package/dist/components/AISuggestion/AISuggestion.svelte +2 -1
- package/dist/components/AISuggestion/AISuggestions.svelte +2 -1
- package/dist/components/AISuggestion/aiSuggestion.mcp.d.ts +1 -1
- package/dist/components/AISuggestion/aiSuggestion.mcp.js +8 -1
- package/dist/components/AISuggestion/aiSuggestion.props.d.ts +4 -1
- package/dist/components/AISuggestion/aiSuggestion.theme.js +1 -1
- package/dist/components/AISuggestion/aiSuggestions.props.d.ts +7 -0
- package/dist/components/AIThread/AIThread.svelte +378 -95
- package/dist/components/AIThread/AIThreadAskUserQuestion.svelte +1 -0
- package/dist/components/AIThread/AIThreadItems.svelte +266 -64
- package/dist/components/AIThread/AIThreadItems.svelte.d.ts +7 -3
- package/dist/components/AIThread/AIThreadMarker.svelte +8 -1
- package/dist/components/AIThread/AIThreadMarker.svelte.d.ts +1 -0
- package/dist/components/AIThread/aiThread.mcp.d.ts +1 -1
- package/dist/components/AIThread/aiThread.mcp.js +34 -20
- package/dist/components/AIThread/aiThread.props.d.ts +73 -8
- package/dist/components/AIThread/aiThread.theme.d.ts +78 -0
- package/dist/components/AIThread/aiThread.theme.js +108 -9
- package/dist/components/AIThread/index.d.ts +1 -1
- package/dist/components/AIThread/threadAskUserQuestion.d.ts +4 -1
- package/dist/components/AIThread/threadAskUserQuestion.js +8 -4
- package/dist/components/AIThread/threadRenderItems.d.ts +74 -3
- package/dist/components/AIThread/threadRenderItems.js +265 -77
- package/dist/components/AIThread/threadScrollController.d.ts +0 -8
- package/dist/components/AIThread/threadScrollController.js +2 -39
- package/dist/components/AIThread/threadTools.d.ts +11 -0
- package/dist/components/AIThread/threadTools.js +79 -0
- package/dist/components/AIThreadToc/AIThreadToc.svelte +188 -18
- package/dist/components/AIThreadToc/AIThreadTocPreview.svelte +25 -2
- package/dist/components/AIThreadToc/AIThreadTocPreview.svelte.d.ts +3 -0
- package/dist/components/AIThreadToc/aiThreadToc.d.ts +4 -2
- package/dist/components/AIThreadToc/aiThreadToc.js +17 -5
- package/dist/components/AIThreadToc/aiThreadToc.mcp.d.ts +1 -1
- package/dist/components/AIThreadToc/aiThreadToc.mcp.js +13 -3
- package/dist/components/AIThreadToc/aiThreadToc.props.d.ts +11 -0
- package/dist/components/AIThreadToc/aiThreadToc.theme.d.ts +3 -0
- package/dist/components/AIThreadToc/aiThreadToc.theme.js +15 -6
- package/dist/components/AITool/AITool.svelte +56 -21
- package/dist/components/AITool/AIToolCallList.svelte +79 -29
- package/dist/components/AITool/AIToolCallList.svelte.d.ts +6 -2
- package/dist/components/AITool/AIToolStatusMark.svelte +52 -0
- package/dist/components/AITool/AIToolStatusMark.svelte.d.ts +14 -0
- package/dist/components/AITool/AIToolValueSection.svelte +126 -28
- package/dist/components/AITool/AIToolValueSection.svelte.d.ts +6 -2
- package/dist/components/AITool/AIToolValueTree.svelte +11 -16
- package/dist/components/AITool/AIToolValueTree.svelte.d.ts +2 -3
- package/dist/components/AITool/aiTool.mcp.d.ts +1 -1
- package/dist/components/AITool/aiTool.mcp.js +36 -8
- package/dist/components/AITool/aiTool.props.d.ts +52 -6
- package/dist/components/AITool/aiTool.theme.d.ts +117 -39
- package/dist/components/AITool/aiTool.theme.js +144 -140
- package/dist/components/AITool/aiToolClock.svelte.d.ts +18 -0
- package/dist/components/AITool/aiToolClock.svelte.js +62 -0
- package/dist/components/AITool/aiToolPrimitiveThemes.d.ts +0 -2
- package/dist/components/AITool/aiToolPrimitiveThemes.js +0 -10
- package/dist/components/AITool/index.d.ts +2 -1
- package/dist/components/AITool/index.js +1 -0
- package/dist/components/AITool/toolRendering.d.ts +33 -1
- package/dist/components/AITool/toolRendering.js +179 -15
- package/dist/components/AITool/toolValueTree.d.ts +14 -1
- package/dist/components/AITool/toolValueTree.js +126 -27
- package/dist/components/Accordion/Accordion.svelte +109 -109
- package/dist/components/Accordion/Accordion.svelte.d.ts +0 -1
- package/dist/components/Accordion/AccordionPanel.svelte +64 -0
- package/dist/components/Accordion/AccordionPanel.svelte.d.ts +20 -0
- package/dist/components/Accordion/accordion.attributes.d.ts +24 -0
- package/dist/components/Accordion/accordion.attributes.js +20 -0
- package/dist/components/Accordion/accordion.mcp.d.ts +1 -1
- package/dist/components/Accordion/accordion.mcp.js +78 -22
- package/dist/components/Accordion/accordion.props.d.ts +54 -10
- package/dist/components/Accordion/accordion.theme.d.ts +3 -0
- package/dist/components/Accordion/accordion.theme.js +4 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/AudioPlayer/audioPlayerVolumeControl.slider.theme.d.ts +31 -1
- package/dist/components/Avatar/Avatar.svelte +60 -10
- package/dist/components/Avatar/AvatarGroup.svelte +9 -0
- package/dist/components/Avatar/avatar.mcp.d.ts +1 -1
- package/dist/components/Avatar/avatar.mcp.js +13 -5
- package/dist/components/Avatar/avatar.props.d.ts +28 -1
- package/dist/components/Avatar/avatar.theme.js +3 -3
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Breadcrumbs/breadcrumbs.mcp.d.ts +1 -1
- package/dist/components/Breadcrumbs/breadcrumbs.mcp.js +1 -1
- package/dist/components/Button/Button.svelte +35 -15
- package/dist/components/Button/button.mcp.d.ts +1 -1
- package/dist/components/Button/button.mcp.js +8 -4
- package/dist/components/Button/button.props.d.ts +23 -8
- package/dist/components/Button/button.theme.d.ts +12 -0
- package/dist/components/Button/button.theme.js +17 -4
- package/dist/components/ButtonGroup/buttonGroup.mcp.d.ts +1 -1
- package/dist/components/ButtonGroup/buttonGroup.mcp.js +1 -1
- package/dist/components/ButtonGroup/buttonGroup.props.d.ts +4 -1
- package/dist/components/Collapsible/Collapsible.svelte +125 -19
- package/dist/components/Collapsible/collapsible.attributes.d.ts +21 -0
- package/dist/components/Collapsible/collapsible.attributes.js +17 -0
- package/dist/components/Collapsible/collapsible.mcp.d.ts +1 -1
- package/dist/components/Collapsible/collapsible.mcp.js +62 -12
- package/dist/components/Collapsible/collapsible.props.d.ts +39 -8
- package/dist/components/Collapsible/collapsible.theme.js +3 -1
- package/dist/components/Collapsible/index.d.ts +1 -0
- package/dist/components/Collapsible/index.js +1 -0
- package/dist/components/Command/Command.svelte +56 -14
- package/dist/components/Command/command.mcp.d.ts +1 -1
- package/dist/components/Command/command.mcp.js +12 -6
- package/dist/components/Command/command.props.d.ts +39 -6
- package/dist/components/Command/command.state.svelte.d.ts +40 -11
- package/dist/components/Command/command.state.svelte.js +75 -28
- package/dist/components/Command/command.theme.js +4 -3
- package/dist/components/Confirmation/Confirmation.svelte +72 -31
- package/dist/components/Confirmation/confirmation.mcp.d.ts +1 -1
- package/dist/components/Confirmation/confirmation.mcp.js +5 -4
- package/dist/components/ContextMenu/ContextMenu.svelte +126 -16
- package/dist/components/ContextMenu/contextMenu.mcp.d.ts +1 -1
- package/dist/components/ContextMenu/contextMenu.mcp.js +10 -7
- package/dist/components/ContextMenu/contextMenu.props.d.ts +13 -4
- package/dist/components/ContextMenu/contextMenu.theme.d.ts +3 -3
- package/dist/components/ContextMenu/contextMenu.theme.js +3 -2
- package/dist/components/DataTable/DataTable.svelte +4 -9
- package/dist/components/DataTable/DataTableEditor.svelte +5 -0
- package/dist/components/DataTable/DataTableFilter.svelte +1 -0
- package/dist/components/DataTable/DataTableToolbar.svelte +1 -0
- package/dist/components/DataTable/dataTable.mcp.d.ts +1 -1
- package/dist/components/DataTable/dataTable.mcp.js +4 -2
- package/dist/components/DataTable/dataTable.theme.d.ts +0 -3
- package/dist/components/DataTable/dataTable.theme.js +9 -6
- package/dist/components/Dialog/Dialog.svelte +120 -35
- package/dist/components/Dialog/Dialog.svelte.d.ts +1 -1
- package/dist/components/Dialog/DialogBackdrop.svelte +21 -1
- package/dist/components/Dialog/dialog.api.d.ts +65 -0
- package/dist/components/Dialog/dialog.api.js +1 -0
- package/dist/components/Dialog/dialog.attributes.d.ts +23 -0
- package/dist/components/Dialog/dialog.attributes.js +19 -0
- package/dist/components/Dialog/dialog.indent.d.ts +6 -0
- package/dist/components/Dialog/dialog.indent.js +16 -0
- package/dist/components/Dialog/dialog.mcp.d.ts +1 -1
- package/dist/components/Dialog/dialog.mcp.js +195 -22
- package/dist/components/Dialog/dialog.props.d.ts +102 -19
- package/dist/components/Dialog/dialog.snap.d.ts +40 -0
- package/dist/components/Dialog/dialog.snap.js +78 -0
- package/dist/components/Dialog/dialog.state.svelte.d.ts +122 -10
- package/dist/components/Dialog/dialog.state.svelte.js +525 -66
- package/dist/components/Dialog/dialog.theme.d.ts +48 -0
- package/dist/components/Dialog/dialog.theme.js +32 -9
- package/dist/components/Dialog/index.d.ts +4 -1
- package/dist/components/Dialog/index.js +1 -0
- package/dist/components/DocumentViewer/DocumentSearchControl.svelte +5 -3
- package/dist/components/DocumentViewer/documentOutput.js +2 -1
- package/dist/components/FloatingWindow/FloatingWindow.svelte +20 -32
- package/dist/components/FloatingWindow/FloatingWindow.svelte.d.ts +1 -1
- package/dist/components/FloatingWindow/floatingWindow.mcp.d.ts +1 -1
- package/dist/components/FloatingWindow/floatingWindow.mcp.js +3 -3
- package/dist/components/FloatingWindow/floatingWindow.props.d.ts +9 -4
- package/dist/components/FloatingWindow/floatingWindow.state.svelte.d.ts +8 -2
- package/dist/components/FloatingWindow/floatingWindow.state.svelte.js +18 -7
- package/dist/components/Form/Ask/Ask.svelte +9 -13
- package/dist/components/Form/Ask/ask.mcp.d.ts +1 -1
- package/dist/components/Form/Ask/ask.mcp.js +1 -1
- package/dist/components/Form/Ask/ask.props.d.ts +1 -1
- package/dist/components/Form/Autocomplete/Autocomplete.svelte +418 -0
- package/dist/components/Form/Autocomplete/Autocomplete.svelte.d.ts +4 -0
- package/dist/components/Form/Autocomplete/autocomplete.items.d.ts +30 -0
- package/dist/components/Form/Autocomplete/autocomplete.items.js +64 -0
- package/dist/components/Form/Autocomplete/autocomplete.mcp.d.ts +1 -0
- package/dist/components/Form/Autocomplete/autocomplete.mcp.js +134 -0
- package/dist/components/Form/Autocomplete/autocomplete.props.d.ts +146 -0
- package/dist/components/Form/Autocomplete/autocomplete.props.js +1 -0
- package/dist/components/Form/Autocomplete/autocomplete.theme.d.ts +213 -0
- package/dist/components/Form/Autocomplete/autocomplete.theme.js +119 -0
- package/dist/components/Form/Autocomplete/index.d.ts +3 -0
- package/dist/components/Form/Autocomplete/index.js +2 -0
- package/dist/components/Form/Calendar/CalendarInput.svelte +9 -0
- package/dist/components/Form/Calendar/CalendarMonthYearPicker.svelte +3 -0
- package/dist/components/Form/Calendar/CalendarPrimitive.svelte +5 -0
- package/dist/components/Form/Calendar/calendar.mcp.d.ts +1 -1
- package/dist/components/Form/Calendar/calendar.mcp.js +2 -1
- package/dist/components/Form/Calendar/calendarInput.props.d.ts +2 -0
- package/dist/components/Form/Calendar/useCalendar.svelte.d.ts +3 -0
- package/dist/components/Form/Calendar/useCalendar.svelte.js +3 -0
- package/dist/components/Form/Checkbox/Checkbox.svelte +17 -2
- package/dist/components/Form/Checkbox/checkbox.mcp.d.ts +1 -1
- package/dist/components/Form/Checkbox/checkbox.mcp.js +11 -1
- package/dist/components/Form/Checkbox/checkbox.props.d.ts +12 -1
- package/dist/components/Form/CheckboxesInput/CheckboxLine.svelte +69 -32
- package/dist/components/Form/CheckboxesInput/CheckboxLine.svelte.d.ts +10 -2
- package/dist/components/Form/CheckboxesInput/CheckboxesInput.svelte +123 -74
- package/dist/components/Form/CheckboxesInput/CheckboxesInput.svelte.d.ts +12 -12
- package/dist/components/Form/CheckboxesInput/checkboxesInput.mcp.d.ts +1 -1
- package/dist/components/Form/CheckboxesInput/checkboxesInput.mcp.js +11 -7
- package/dist/components/Form/CheckboxesInput/checkboxesInput.props.d.ts +25 -9
- package/dist/components/Form/CheckboxesInput/checkboxesInput.theme.d.ts +12 -0
- package/dist/components/Form/CheckboxesInput/checkboxesInput.theme.js +9 -4
- package/dist/components/Form/CheckboxesInput/choiceEnter.d.ts +11 -0
- package/dist/components/Form/CheckboxesInput/choiceEnter.js +27 -0
- package/dist/components/Form/ColorInput/ColorInput.svelte +12 -3
- package/dist/components/Form/ColorInput/colorInput.mcp.d.ts +1 -1
- package/dist/components/Form/ColorInput/colorInput.mcp.js +1 -0
- package/dist/components/Form/ColorPicker/ColorPicker.svelte +11 -2
- package/dist/components/Form/ColorPicker/ColorPickerInput.svelte +9 -0
- package/dist/components/Form/ColorPicker/colorPicker.mcp.d.ts +1 -1
- package/dist/components/Form/ColorPicker/colorPicker.mcp.js +1 -0
- package/dist/components/Form/ColorPicker/colorPicker.props.d.ts +2 -0
- package/dist/components/Form/ColorPicker/colorPicker.state.svelte.d.ts +4 -0
- package/dist/components/Form/ColorPicker/colorPicker.state.svelte.js +12 -8
- package/dist/components/Form/Combobox/Combobox.svelte +145 -185
- package/dist/components/Form/Combobox/Combobox.svelte.d.ts +1 -1
- package/dist/components/Form/Combobox/ComboboxPopup.svelte +128 -0
- package/dist/components/Form/Combobox/ComboboxPopup.svelte.d.ts +28 -0
- package/dist/components/Form/Combobox/combobox.attributes.d.ts +34 -0
- package/dist/components/Form/Combobox/combobox.attributes.js +25 -0
- package/dist/components/Form/Combobox/combobox.items.d.ts +28 -0
- package/dist/components/Form/Combobox/combobox.items.js +68 -0
- package/dist/components/Form/Combobox/combobox.mcp.d.ts +1 -1
- package/dist/components/Form/Combobox/combobox.mcp.js +104 -13
- package/dist/components/Form/Combobox/combobox.props.d.ts +113 -19
- package/dist/components/Form/Combobox/combobox.state.svelte.d.ts +137 -0
- package/dist/components/Form/Combobox/combobox.state.svelte.js +375 -0
- package/dist/components/Form/Combobox/combobox.theme.d.ts +63 -0
- package/dist/components/Form/Combobox/combobox.theme.js +37 -1
- package/dist/components/Form/Combobox/index.d.ts +2 -1
- package/dist/components/Form/Combobox/index.js +1 -0
- package/dist/components/Form/DateInput/DateInput.svelte +11 -3
- package/dist/components/Form/DateInput/dateInput.mcp.d.ts +1 -1
- package/dist/components/Form/DateInput/dateInput.mcp.js +5 -0
- package/dist/components/Form/DateSelector/DateSelector.svelte +5 -2
- package/dist/components/Form/DateSelector/DateSelectorInput.svelte +9 -0
- package/dist/components/Form/DateSelector/dateSelector.mcp.d.ts +1 -1
- package/dist/components/Form/DateSelector/dateSelector.mcp.js +2 -2
- package/dist/components/Form/DateSelector/dateSelector.props.d.ts +2 -0
- package/dist/components/Form/Field/Field.svelte +256 -30
- package/dist/components/Form/Field/Field.svelte.d.ts +9 -0
- package/dist/components/Form/Field/FieldGroup.svelte +29 -0
- package/dist/components/Form/Field/FieldGroup.svelte.d.ts +11 -0
- package/dist/components/Form/Field/FieldHiddenInputs.svelte +187 -0
- package/dist/components/Form/Field/FieldHiddenInputs.svelte.d.ts +26 -0
- package/dist/components/Form/Field/field.d.ts +64 -8
- package/dist/components/Form/Field/field.mcp.d.ts +1 -1
- package/dist/components/Form/Field/field.mcp.js +158 -18
- package/dist/components/Form/Field/field.messages.d.ts +47 -0
- package/dist/components/Form/Field/field.messages.js +64 -0
- package/dist/components/Form/Field/field.state.svelte.d.ts +109 -3
- package/dist/components/Form/Field/field.state.svelte.js +508 -16
- package/dist/components/Form/Field/field.theme.d.ts +46 -0
- package/dist/components/Form/Field/field.theme.js +33 -0
- package/dist/components/Form/Field/fieldHiddenInputs.props.d.ts +61 -0
- package/dist/components/Form/Field/fieldHiddenInputs.props.js +1 -0
- package/dist/components/Form/Field/fieldNativeForm.svelte.d.ts +14 -0
- package/dist/components/Form/Field/fieldNativeForm.svelte.js +113 -0
- package/dist/components/Form/Field/index.d.ts +5 -2
- package/dist/components/Form/Field/index.js +1 -0
- package/dist/components/Form/Field/schemas.js +7 -2
- package/dist/components/Form/File/FileInput.svelte +24 -3
- package/dist/components/Form/File/fileInput.mcp.d.ts +1 -1
- package/dist/components/Form/File/fileInput.mcp.js +1 -0
- package/dist/components/Form/Form/Form.svelte +47 -14
- package/dist/components/Form/Form/FormActions.svelte +3 -1
- package/dist/components/Form/Form/FormActions.svelte.d.ts +42 -2
- package/dist/components/Form/Form/FormFieldRenderer.svelte +40 -2
- package/dist/components/Form/Form/FormInputRenderer.svelte +7 -0
- package/dist/components/Form/Form/form.d.ts +35 -6
- package/dist/components/Form/Form/form.mcp.d.ts +1 -1
- package/dist/components/Form/Form/form.mcp.js +113 -13
- package/dist/components/Form/Form/form.props.d.ts +32 -1
- package/dist/components/Form/Form/form.registry.d.ts +2 -2
- package/dist/components/Form/Form/form.registry.js +1 -4
- package/dist/components/Form/Form/form.state.svelte.d.ts +1138 -413
- package/dist/components/Form/Form/form.state.svelte.js +319 -26
- package/dist/components/Form/Form/index.d.ts +3 -1
- package/dist/components/Form/Form/visibility.d.ts +3096 -1831
- package/dist/components/Form/KeyValueInput/KeyValueInput.svelte +22 -10
- package/dist/components/Form/KeyValueInput/keyValueInput.mcp.d.ts +1 -1
- package/dist/components/Form/KeyValueInput/keyValueInput.mcp.js +1 -0
- package/dist/components/Form/MultiStepForm/MultiStepForm.svelte +12 -5
- package/dist/components/Form/MultiStepForm/multiStepForm.mcp.d.ts +1 -1
- package/dist/components/Form/MultiStepForm/multiStepForm.mcp.js +5 -3
- package/dist/components/Form/MultiStepForm/multiStepForm.props.d.ts +5 -0
- package/dist/components/Form/MultiStepForm/multiStepForm.state.svelte.d.ts +1022 -408
- package/dist/components/Form/MultiStepForm/multiStepForm.state.svelte.js +48 -24
- package/dist/components/Form/NumberInput/NumberInput.svelte +365 -46
- package/dist/components/Form/NumberInput/index.d.ts +1 -1
- package/dist/components/Form/NumberInput/numberInput.mcp.d.ts +1 -1
- package/dist/components/Form/NumberInput/numberInput.mcp.js +55 -30
- package/dist/components/Form/NumberInput/numberInput.props.d.ts +64 -4
- package/dist/components/Form/PasswordInput/Password.svelte +28 -1
- package/dist/components/Form/PasswordInput/index.d.ts +1 -1
- package/dist/components/Form/PasswordInput/passwordInput.mcp.d.ts +1 -1
- package/dist/components/Form/PasswordInput/passwordInput.mcp.js +20 -2
- package/dist/components/Form/PasswordInput/passwordInput.props.d.ts +23 -0
- package/dist/components/Form/PhoneInput/PhoneInput.svelte +11 -4
- package/dist/components/Form/PhoneInput/PhoneInputCountryPicker.svelte +47 -21
- package/dist/components/Form/PhoneInput/phoneInput-cdn.js +2 -1
- package/dist/components/Form/PhoneInput/phoneInput.mcp.d.ts +1 -1
- package/dist/components/Form/PhoneInput/phoneInput.mcp.js +6 -2
- package/dist/components/Form/PhoneInput/phoneInputCountry.d.ts +9 -3
- package/dist/components/Form/PhoneInput/phoneInputCountry.js +34 -24
- package/dist/components/Form/PinInput/PinInput.svelte +44 -9
- package/dist/components/Form/PinInput/PinInputCells.svelte +22 -1
- package/dist/components/Form/PinInput/PinInputCells.svelte.d.ts +1 -0
- package/dist/components/Form/PinInput/index.d.ts +1 -1
- package/dist/components/Form/PinInput/pinInput.mcp.d.ts +1 -1
- package/dist/components/Form/PinInput/pinInput.mcp.js +29 -6
- package/dist/components/Form/PinInput/pinInput.props.d.ts +38 -4
- package/dist/components/Form/PinInput/pinInput.state.svelte.d.ts +41 -0
- package/dist/components/Form/PinInput/pinInput.state.svelte.js +227 -24
- package/dist/components/Form/PinInput/pinInput.theme.d.ts +39 -3
- package/dist/components/Form/PinInput/pinInput.theme.js +27 -1
- package/dist/components/Form/RadioInput/RadioInput.svelte +94 -32
- package/dist/components/Form/RadioInput/RadioInput.svelte.d.ts +12 -12
- package/dist/components/Form/RadioInput/radioInput.mcp.d.ts +1 -1
- package/dist/components/Form/RadioInput/radioInput.mcp.js +12 -9
- package/dist/components/Form/RadioInput/radioInput.props.d.ts +22 -6
- package/dist/components/Form/RadioInput/radioInput.theme.d.ts +12 -0
- package/dist/components/Form/RadioInput/radioInput.theme.js +10 -5
- package/dist/components/Form/RatingInput/RatingInput.svelte +13 -4
- package/dist/components/Form/RatingInput/ratingInput.mcp.d.ts +1 -1
- package/dist/components/Form/RatingInput/ratingInput.mcp.js +3 -3
- package/dist/components/Form/RatingInput/ratingInput.props.d.ts +1 -1
- package/dist/components/Form/Select/Select.svelte +186 -48
- package/dist/components/Form/Select/Select.svelte.d.ts +23 -2
- package/dist/components/Form/Select/SelectOptionRow.svelte +69 -0
- package/dist/components/Form/Select/SelectOptionRow.svelte.d.ts +18 -0
- package/dist/components/Form/Select/index.d.ts +2 -1
- package/dist/components/Form/Select/index.js +1 -0
- package/dist/components/Form/Select/select.align.d.ts +5 -0
- package/dist/components/Form/Select/select.align.js +19 -5
- package/dist/components/Form/Select/select.attributes.d.ts +36 -0
- package/dist/components/Form/Select/select.attributes.js +27 -0
- package/dist/components/Form/Select/select.mcp.d.ts +1 -1
- package/dist/components/Form/Select/select.mcp.js +103 -18
- package/dist/components/Form/Select/select.props.d.ts +87 -10
- package/dist/components/Form/Select/select.state.svelte.d.ts +108 -17
- package/dist/components/Form/Select/select.state.svelte.js +354 -59
- package/dist/components/Form/Select/select.theme.d.ts +21 -0
- package/dist/components/Form/Select/select.theme.js +22 -0
- package/dist/components/Form/Slider/Slider.svelte +54 -14
- package/dist/components/Form/Slider/SliderMarks.svelte +1 -1
- package/dist/components/Form/Slider/SliderThumb.svelte +49 -19
- package/dist/components/Form/Slider/SliderThumb.svelte.d.ts +8 -2
- package/dist/components/Form/Slider/SliderTrack.svelte +33 -12
- package/dist/components/Form/Slider/SliderTrack.svelte.d.ts +6 -2
- package/dist/components/Form/Slider/index.d.ts +1 -1
- package/dist/components/Form/Slider/slider.mcp.d.ts +1 -1
- package/dist/components/Form/Slider/slider.mcp.js +55 -11
- package/dist/components/Form/Slider/slider.props.d.ts +35 -2
- package/dist/components/Form/Slider/slider.state.svelte.d.ts +66 -5
- package/dist/components/Form/Slider/slider.state.svelte.js +273 -49
- package/dist/components/Form/Slider/slider.theme.d.ts +36 -0
- package/dist/components/Form/Slider/slider.theme.js +35 -17
- package/dist/components/Form/Switch/Switch.svelte +61 -38
- package/dist/components/Form/Switch/switch.mcp.d.ts +1 -1
- package/dist/components/Form/Switch/switch.mcp.js +25 -5
- package/dist/components/Form/Switch/switch.props.d.ts +14 -1
- package/dist/components/Form/Switch/switch.theme.d.ts +12 -0
- package/dist/components/Form/Switch/switch.theme.js +8 -3
- package/dist/components/Form/TagGroup/TagGroup.svelte +8 -0
- package/dist/components/Form/TagGroup/tagGroup.mcp.d.ts +1 -1
- package/dist/components/Form/TagGroup/tagGroup.mcp.js +1 -0
- package/dist/components/Form/TagsInput/TagsInput.svelte +277 -275
- package/dist/components/Form/TagsInput/TagsInput.svelte.d.ts +1 -1
- package/dist/components/Form/TagsInput/tagsInput.mcp.d.ts +1 -1
- package/dist/components/Form/TagsInput/tagsInput.mcp.js +31 -11
- package/dist/components/Form/TagsInput/tagsInput.props.d.ts +6 -26
- package/dist/components/Form/TagsInput/tagsInput.theme.d.ts +63 -0
- package/dist/components/Form/TagsInput/tagsInput.theme.js +37 -1
- package/dist/components/Form/TextArea/TextArea.svelte +8 -0
- package/dist/components/Form/TextArea/textArea.mcp.d.ts +1 -1
- package/dist/components/Form/TextArea/textArea.mcp.js +1 -0
- package/dist/components/Form/TextInput/TextInput.svelte +8 -1
- package/dist/components/Form/TextInput/textInput.mcp.d.ts +1 -1
- package/dist/components/Form/TextInput/textInput.mcp.js +5 -0
- package/dist/components/Form/TimeInput/TimeInput.svelte +9 -1
- package/dist/components/Form/TimeInput/timeInput.mcp.d.ts +1 -1
- package/dist/components/Form/TimeInput/timeInput.mcp.js +31 -0
- package/dist/components/Form/VoiceInput/VoiceInput.svelte +10 -2
- package/dist/components/Form/VoiceInput/voiceInput.mcp.d.ts +1 -1
- package/dist/components/Form/VoiceInput/voiceInput.mcp.js +1 -0
- package/dist/components/GanttChart/GanttDependencyControl.svelte +4 -4
- package/dist/components/HoverCard/HoverCard.svelte +100 -10
- package/dist/components/HoverCard/hoverCard.attributes.d.ts +33 -0
- package/dist/components/HoverCard/hoverCard.attributes.js +24 -0
- package/dist/components/HoverCard/hoverCard.mcp.d.ts +1 -1
- package/dist/components/HoverCard/hoverCard.mcp.js +61 -2
- package/dist/components/HoverCard/hoverCard.props.d.ts +19 -0
- package/dist/components/HoverCard/hoverCard.theme.d.ts +12 -0
- package/dist/components/HoverCard/hoverCard.theme.js +9 -2
- package/dist/components/HoverCard/index.d.ts +1 -0
- package/dist/components/HoverCard/index.js +1 -0
- package/dist/components/ImageGallery/imageGallery.state.svelte.d.ts +1 -1
- package/dist/components/ImageZoom/imageZoom.lightbox.js +40 -6
- package/dist/components/ImageZoom/imageZoom.mcp.d.ts +1 -1
- package/dist/components/ImageZoom/imageZoom.mcp.js +3 -3
- package/dist/components/ImageZoom/imageZoom.props.d.ts +10 -4
- package/dist/components/ImageZoom/imageZoom.state.svelte.d.ts +16 -4
- package/dist/components/ImageZoom/imageZoom.state.svelte.js +38 -9
- package/dist/components/Kanban/kanban.theme.js +7 -3
- package/dist/components/Layout/layoutSpacing.d.ts +2 -2
- package/dist/components/LinkPreview/LinkPreview.svelte +7 -1
- package/dist/components/LinkPreview/linkPreview.mcp.d.ts +1 -1
- package/dist/components/LinkPreview/linkPreview.mcp.js +4 -1
- package/dist/components/LinkPreview/linkPreview.props.d.ts +15 -0
- package/dist/components/LinkPreview/linkPreview.theme.d.ts +12 -0
- package/dist/components/LinkPreview/linkPreview.theme.js +9 -2
- package/dist/components/Map/maplibre-cdn.js +3 -2
- package/dist/components/Markdown/markdown.mcp.d.ts +1 -1
- package/dist/components/Markdown/markdown.mcp.js +2 -1
- package/dist/components/Markdown/markdown.theme.js +18 -9
- package/dist/components/MediaVolume/MediaVolumeControl.svelte +4 -3
- package/dist/components/Menu/Menu.svelte +3 -3
- package/dist/components/Menu/Menu.svelte.d.ts +1 -1
- package/dist/components/Menu/MenuCheckboxItem.svelte +87 -0
- package/dist/components/Menu/MenuCheckboxItem.svelte.d.ts +16 -0
- package/dist/components/Menu/MenuFloating.svelte +421 -74
- package/dist/components/Menu/MenuFloating.svelte.d.ts +1 -1
- package/dist/components/Menu/MenuMirroredIcon.svelte +9 -0
- package/dist/components/Menu/MenuMirroredIcon.svelte.d.ts +7 -0
- package/dist/components/Menu/MenuRadioGroup.svelte +102 -0
- package/dist/components/Menu/MenuRadioGroup.svelte.d.ts +18 -0
- package/dist/components/Menu/MenuSearchField.svelte +54 -0
- package/dist/components/Menu/MenuSearchField.svelte.d.ts +20 -0
- package/dist/components/Menu/MenuStacked.svelte +404 -158
- package/dist/components/Menu/MenuStacked.svelte.d.ts +1 -1
- package/dist/components/Menu/MenuStackedBackHeader.svelte +6 -1
- package/dist/components/Menu/index.d.ts +2 -1
- package/dist/components/Menu/index.js +1 -0
- package/dist/components/Menu/menu.attributes.d.ts +37 -0
- package/dist/components/Menu/menu.attributes.js +28 -0
- package/dist/components/Menu/menu.filter.svelte.d.ts +52 -0
- package/dist/components/Menu/menu.filter.svelte.js +143 -0
- package/dist/components/Menu/menu.mcp.d.ts +1 -1
- package/dist/components/Menu/menu.mcp.js +227 -17
- package/dist/components/Menu/menu.platform.d.ts +5 -0
- package/dist/components/Menu/menu.platform.js +11 -0
- package/dist/components/Menu/menu.props.d.ts +172 -9
- package/dist/components/Menu/menu.theme.d.ts +147 -0
- package/dist/components/Menu/menu.theme.js +101 -0
- package/dist/components/Menu/menuTree.d.ts +35 -1
- package/dist/components/Menu/menuTree.js +158 -1
- package/dist/components/MenuBar/menuBar.mcp.d.ts +1 -1
- package/dist/components/MenuBar/menuBar.mcp.js +4 -2
- package/dist/components/MenuBar/menuBar.state.svelte.js +28 -10
- package/dist/components/MenuOption/MenuOption.svelte +5 -1
- package/dist/components/MenuOption/menuOption.mcp.d.ts +1 -1
- package/dist/components/MenuOption/menuOption.mcp.js +8 -0
- package/dist/components/MenuOption/menuOption.props.d.ts +12 -0
- package/dist/components/MenuOption/menuOption.theme.d.ts +18 -0
- package/dist/components/MenuOption/menuOption.theme.js +24 -4
- package/dist/components/Mermaid/mermaid.mcp.d.ts +1 -1
- package/dist/components/Mermaid/mermaid.mcp.js +8 -8
- package/dist/components/Mermaid/mermaid.props.d.ts +3 -4
- package/dist/components/Mermaid/mermaid.state.svelte.d.ts +20 -19
- package/dist/components/Mermaid/mermaid.state.svelte.js +80 -243
- package/dist/components/Mermaid/mermaid.theme.js +26 -1
- package/dist/components/MetadataList/MetadataList.svelte.d.ts +1 -1
- package/dist/components/Meter/Meter.svelte +110 -24
- package/dist/components/Meter/Meter.svelte.d.ts +12 -12
- package/dist/components/Meter/meter.mcp.d.ts +1 -1
- package/dist/components/Meter/meter.mcp.js +23 -37
- package/dist/components/Meter/meter.props.d.ts +36 -44
- package/dist/components/NavigationMenu/NavigationMenu.svelte +181 -0
- package/dist/components/NavigationMenu/NavigationMenu.svelte.d.ts +25 -0
- package/dist/components/NavigationMenu/NavigationMenuContent.svelte +141 -0
- package/dist/components/NavigationMenu/NavigationMenuContent.svelte.d.ts +13 -0
- package/dist/components/NavigationMenu/NavigationMenuTrigger.svelte +75 -0
- package/dist/components/NavigationMenu/NavigationMenuTrigger.svelte.d.ts +13 -0
- package/dist/components/NavigationMenu/index.d.ts +4 -0
- package/dist/components/NavigationMenu/index.js +3 -0
- package/dist/components/NavigationMenu/navigationMenu.attributes.d.ts +24 -0
- package/dist/components/NavigationMenu/navigationMenu.attributes.js +21 -0
- package/dist/components/NavigationMenu/navigationMenu.mcp.d.ts +1 -0
- package/dist/components/NavigationMenu/navigationMenu.mcp.js +138 -0
- package/dist/components/NavigationMenu/navigationMenu.props.d.ts +129 -0
- package/dist/components/NavigationMenu/navigationMenu.props.js +1 -0
- package/dist/components/NavigationMenu/navigationMenu.state.svelte.d.ts +163 -0
- package/dist/components/NavigationMenu/navigationMenu.state.svelte.js +721 -0
- package/dist/components/NavigationMenu/navigationMenu.theme.d.ts +326 -0
- package/dist/components/NavigationMenu/navigationMenu.theme.js +239 -0
- package/dist/components/Overlay/Overlay.svelte +19 -30
- package/dist/components/Overlay/index.d.ts +1 -0
- package/dist/components/Overlay/index.js +1 -0
- package/dist/components/Overlay/overlay.attributes.d.ts +16 -0
- package/dist/components/Overlay/overlay.attributes.js +14 -0
- package/dist/components/Overlay/overlay.mcp.d.ts +1 -1
- package/dist/components/Overlay/overlay.mcp.js +21 -3
- package/dist/components/Overlay/overlay.props.d.ts +8 -4
- package/dist/components/Popover/Popover.svelte +163 -52
- package/dist/components/Popover/Popover.svelte.d.ts +23 -2
- package/dist/components/Popover/PopoverSession.svelte +12 -0
- package/dist/components/Popover/PopoverSession.svelte.d.ts +7 -0
- package/dist/components/Popover/index.d.ts +10 -2
- package/dist/components/Popover/index.js +4 -1
- package/dist/components/Popover/popover.api.d.ts +83 -0
- package/dist/components/Popover/popover.api.js +1 -0
- package/dist/components/Popover/popover.attributes.d.ts +32 -0
- package/dist/components/Popover/popover.attributes.js +28 -0
- package/dist/components/Popover/popover.claims.d.ts +19 -0
- package/dist/components/Popover/popover.claims.js +45 -0
- package/dist/components/Popover/popover.mcp.d.ts +1 -1
- package/dist/components/Popover/popover.mcp.js +163 -31
- package/dist/components/Popover/popover.position.d.ts +226 -0
- package/dist/components/Popover/popover.position.js +402 -0
- package/dist/components/Popover/popover.props.d.ts +179 -24
- package/dist/components/Popover/popover.state.svelte.d.ts +169 -37
- package/dist/components/Popover/popover.state.svelte.js +1034 -194
- package/dist/components/Popover/popover.theme.d.ts +15 -0
- package/dist/components/Popover/popover.theme.js +27 -2
- package/dist/components/PopupMenu/PopupMenu.svelte +193 -22
- package/dist/components/PopupMenu/PopupMenu.svelte.d.ts +2 -2
- package/dist/components/PopupMenu/popupMenu.context.d.ts +42 -0
- package/dist/components/PopupMenu/popupMenu.context.js +52 -0
- package/dist/components/PopupMenu/popupMenu.mcp.d.ts +1 -1
- package/dist/components/PopupMenu/popupMenu.mcp.js +46 -6
- package/dist/components/PopupMenu/popupMenu.props.d.ts +29 -2
- package/dist/components/Progress/Progress.svelte +160 -0
- package/dist/components/Progress/Progress.svelte.d.ts +4 -0
- package/dist/components/Progress/index.d.ts +3 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Progress/progress.mcp.d.ts +1 -0
- package/dist/components/Progress/progress.mcp.js +101 -0
- package/dist/components/Progress/progress.props.d.ts +79 -0
- package/dist/components/Progress/progress.props.js +1 -0
- package/dist/components/Progress/progress.theme.d.ts +129 -0
- package/dist/components/Progress/progress.theme.js +83 -0
- package/dist/components/ProgressCircle/ProgressCircle.svelte +51 -6
- package/dist/components/ProgressCircle/progressCircle.mcp.d.ts +1 -1
- package/dist/components/ProgressCircle/progressCircle.mcp.js +18 -4
- package/dist/components/ProgressCircle/progressCircle.props.d.ts +32 -2
- package/dist/components/ProgressCircle/progressCircle.theme.d.ts +15 -3
- package/dist/components/ProgressCircle/progressCircle.theme.js +7 -2
- package/dist/components/RichTextInput/RichTextInput.svelte +19 -1
- package/dist/components/RichTextInput/RichTextInputChrome.svelte +5 -1
- package/dist/components/RichTextInput/RichTextInputChrome.svelte.d.ts +2 -0
- package/dist/components/RichTextInput/RichTextInputViewport.svelte +3 -1
- package/dist/components/RichTextInput/RichTextInputViewport.svelte.d.ts +1 -0
- package/dist/components/RichTextInput/richTextInput.mcp.d.ts +1 -1
- package/dist/components/RichTextInput/richTextInput.mcp.js +1 -0
- package/dist/components/RichTextInput/suggestions.js +2 -0
- package/dist/components/ScrollArea/ScrollArea.svelte +166 -27
- package/dist/components/ScrollArea/index.d.ts +2 -1
- package/dist/components/ScrollArea/index.js +1 -0
- package/dist/components/ScrollArea/scrollArea.attributes.d.ts +25 -0
- package/dist/components/ScrollArea/scrollArea.attributes.js +21 -0
- package/dist/components/ScrollArea/scrollArea.mcp.d.ts +1 -1
- package/dist/components/ScrollArea/scrollArea.mcp.js +47 -3
- package/dist/components/ScrollArea/scrollArea.props.d.ts +33 -6
- package/dist/components/ScrollArea/scrollArea.svelte.d.ts +56 -12
- package/dist/components/ScrollArea/scrollArea.svelte.js +281 -71
- package/dist/components/ScrollArea/scrollArea.theme.js +5 -2
- package/dist/components/SegmentedControl/SegmentedControl.svelte +4 -3
- package/dist/components/SegmentedControl/segmentedControl.mcp.d.ts +1 -1
- package/dist/components/SegmentedControl/segmentedControl.mcp.js +3 -2
- package/dist/components/SelectionMenu/SelectionMenu.svelte +4 -2
- package/dist/components/Sidebar/SidebarAction.svelte +13 -3
- package/dist/components/Sidebar/SidebarAction.svelte.d.ts +2 -1
- package/dist/components/Sidebar/SidebarActivityBar.svelte +14 -7
- package/dist/components/Sidebar/SidebarFlyout.svelte +97 -0
- package/dist/components/Sidebar/SidebarFlyout.svelte.d.ts +32 -0
- package/dist/components/Sidebar/SidebarGroup.svelte +39 -15
- package/dist/components/Sidebar/SidebarMenuButton.svelte +6 -3
- package/dist/components/Sidebar/SidebarMenuItem.svelte +134 -31
- package/dist/components/Sidebar/SidebarMenuSubItem.svelte +30 -14
- package/dist/components/Sidebar/SidebarTreeNode.svelte +41 -61
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/Sidebar/index.js +1 -0
- package/dist/components/Sidebar/sidebar-position.d.ts +37 -2
- package/dist/components/Sidebar/sidebar-position.js +31 -2
- package/dist/components/Sidebar/sidebar.attributes.d.ts +33 -0
- package/dist/components/Sidebar/sidebar.attributes.js +29 -0
- package/dist/components/Sidebar/sidebar.mcp.d.ts +1 -1
- package/dist/components/Sidebar/sidebar.mcp.js +45 -10
- package/dist/components/Sidebar/sidebar.props.d.ts +28 -7
- package/dist/components/Sidebar/sidebar.theme.d.ts +51 -21
- package/dist/components/Sidebar/sidebar.theme.js +113 -62
- package/dist/components/Sidebar/sidebar.views.svelte.js +11 -18
- package/dist/components/Stepper/Stepper.svelte +2 -0
- package/dist/components/Stepper/stepper.mcp.d.ts +1 -1
- package/dist/components/Stepper/stepper.mcp.js +1 -0
- package/dist/components/Stepper/stepper.props.d.ts +5 -0
- package/dist/components/Stepper/stepper.state.svelte.d.ts +2 -0
- package/dist/components/Stepper/stepper.state.svelte.js +31 -12
- package/dist/components/Tabbar/Tabbar.svelte +55 -16
- package/dist/components/Tabbar/index.d.ts +1 -1
- package/dist/components/Tabbar/tabbar.mcp.d.ts +1 -1
- package/dist/components/Tabbar/tabbar.mcp.js +26 -9
- package/dist/components/Tabbar/tabbar.props.d.ts +34 -5
- package/dist/components/Tabbar/tabbar.selection.svelte.d.ts +79 -0
- package/dist/components/Tabbar/tabbar.selection.svelte.js +99 -0
- package/dist/components/TableOfContents/tableOfContents.state.svelte.js +9 -7
- package/dist/components/Tabs/Tabs.svelte +73 -16
- package/dist/components/Tabs/index.d.ts +2 -1
- package/dist/components/Tabs/tabs.direction.svelte.d.ts +25 -0
- package/dist/components/Tabs/tabs.direction.svelte.js +40 -0
- package/dist/components/Tabs/tabs.mcp.d.ts +1 -1
- package/dist/components/Tabs/tabs.mcp.js +22 -4
- package/dist/components/Tabs/tabs.props.d.ts +39 -12
- package/dist/components/Tabs/tabs.theme.js +3 -1
- package/dist/components/Theme/Theme.svelte +44 -27
- package/dist/components/Theme/helper.d.ts +16 -2
- package/dist/components/Theme/helper.js +46 -4
- package/dist/components/Theme/theme.mcp.d.ts +1 -1
- package/dist/components/Theme/theme.mcp.js +103 -0
- package/dist/components/Theme/theme.props.d.ts +16 -0
- package/dist/components/Theme/theme.state.svelte.d.ts +14 -1
- package/dist/components/Theme/theme.state.svelte.js +18 -1
- package/dist/components/Toast/Toast.svelte +184 -39
- package/dist/components/Toast/Toaster.svelte +14 -10
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/components/Toast/toast.mcp.d.ts +1 -1
- package/dist/components/Toast/toast.mcp.js +47 -6
- package/dist/components/Toast/toast.state.svelte.d.ts +172 -6
- package/dist/components/Toast/toast.state.svelte.js +513 -68
- package/dist/components/Toast/toast.theme.js +1 -1
- package/dist/components/ToggleButton/ToggleButton.svelte +23 -1
- package/dist/components/ToggleButton/toggleButton.mcp.d.ts +1 -1
- package/dist/components/ToggleButton/toggleButton.mcp.js +3 -1
- package/dist/components/ToggleButton/toggleButton.props.d.ts +13 -1
- package/dist/components/ToggleButton/toggleButton.theme.d.ts +12 -0
- package/dist/components/ToggleButton/toggleButton.theme.js +15 -3
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.svelte +29 -9
- package/dist/components/ToggleButtonGroup/index.d.ts +1 -1
- package/dist/components/ToggleButtonGroup/toggleButtonGroup.mcp.d.ts +1 -1
- package/dist/components/ToggleButtonGroup/toggleButtonGroup.mcp.js +5 -2
- package/dist/components/ToggleButtonGroup/toggleButtonGroup.props.d.ts +19 -1
- package/dist/components/ToggleButtonGroup/toggleButtonGroup.theme.d.ts +12 -0
- package/dist/components/ToggleButtonGroup/toggleButtonGroup.theme.js +21 -2
- package/dist/components/ToggleMenu/ToggleMenu.svelte +57 -43
- package/dist/components/ToggleMenu/ToggleMenuGroup.svelte +1 -0
- package/dist/components/ToggleMenu/ToggleMenuMenu.svelte +9 -3
- package/dist/components/ToggleMenu/ToggleMenuRadioGroup.svelte +7 -2
- package/dist/components/ToggleMenu/toggleMenu.mcp.d.ts +1 -1
- package/dist/components/ToggleMenu/toggleMenu.mcp.js +3 -2
- package/dist/components/ToggleMenu/toggleMenu.props.d.ts +4 -1
- package/dist/components/Tooltip/Tooltip.svelte +4 -12
- package/dist/components/Tooltip/TooltipHost.svelte +136 -15
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/components/Tooltip/tooltip.attachment.svelte.d.ts +5 -0
- package/dist/components/Tooltip/tooltip.attachment.svelte.js +215 -33
- package/dist/components/Tooltip/tooltip.attributes.d.ts +32 -0
- package/dist/components/Tooltip/tooltip.attributes.js +28 -0
- package/dist/components/Tooltip/tooltip.mcp.d.ts +1 -1
- package/dist/components/Tooltip/tooltip.mcp.js +111 -10
- package/dist/components/Tooltip/tooltip.props.d.ts +33 -2
- package/dist/components/Tooltip/tooltip.surface.d.ts +24 -0
- package/dist/components/Tooltip/tooltip.surface.js +42 -0
- package/dist/components/Tree/TreeContextMenuSurface.svelte +16 -3
- package/dist/components/Utils/BeforeHydratation.svelte +14 -3
- package/dist/components/Utils/BeforeHydratation.svelte.d.ts +2 -0
- package/dist/components/VideoPlayer/VideoPlayer.svelte.d.ts +1 -1
- package/dist/components/VideoPlayer/VideoPlayerSettings.svelte +2 -0
- package/dist/generated/componentAliases.d.ts +3 -0
- package/dist/generated/componentAliases.js +3 -0
- package/dist/generated/componentContract.d.ts +79 -34
- package/dist/generated/componentContract.js +225 -6
- package/dist/generated/componentMcpRegistry.js +6 -0
- package/dist/i18n/ar.js +107 -3
- package/dist/i18n/context.svelte.d.ts +6 -0
- package/dist/i18n/context.svelte.js +12 -0
- package/dist/i18n/de.js +101 -3
- package/dist/i18n/en.d.ts +91 -2
- package/dist/i18n/en.js +101 -3
- package/dist/i18n/es.js +101 -3
- package/dist/i18n/fr.js +101 -3
- package/dist/i18n/ja.js +101 -3
- package/dist/i18n/pt.js +101 -3
- package/dist/i18n/zh.js +101 -3
- package/dist/tailwind/geometry.js +7 -0
- package/dist/tailwind/global.js +31 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.mcp.d.ts +1 -1
- package/dist/types/types.mcp.js +23 -0
- package/dist/utils/cspNonce.d.ts +16 -0
- package/dist/utils/cspNonce.js +39 -0
- package/dist/utils/cva/merge.d.ts +5 -1
- package/dist/utils/cva/merge.js +6 -4
- package/dist/utils/focus.d.ts +34 -0
- package/dist/utils/focus.js +93 -0
- package/dist/utils/focusHistory.d.ts +21 -0
- package/dist/utils/focusHistory.js +99 -0
- package/dist/utils/handlers.d.ts +7 -0
- package/dist/utils/handlers.js +14 -0
- package/dist/utils/hoverIntent.d.ts +42 -0
- package/dist/utils/hoverIntent.js +57 -0
- package/dist/utils/id.d.ts +7 -0
- package/dist/utils/id.js +15 -0
- package/dist/utils/layers.svelte.d.ts +32 -4
- package/dist/utils/layers.svelte.js +214 -21
- package/dist/utils/listFilter.d.ts +44 -0
- package/dist/utils/listFilter.js +130 -0
- package/dist/utils/match.d.ts +35 -0
- package/dist/utils/match.js +36 -0
- package/dist/utils/number.d.ts +126 -0
- package/dist/utils/number.js +401 -0
- package/dist/utils/openChange.d.ts +88 -0
- package/dist/utils/openChange.js +71 -0
- package/dist/utils/openLifecycle.svelte.d.ts +41 -0
- package/dist/utils/openLifecycle.svelte.js +134 -0
- package/dist/utils/pointerDrag.d.ts +10 -0
- package/dist/utils/pointerDrag.js +37 -2
- package/dist/utils/pragmaticDragAndDrop.d.ts +2 -1
- package/dist/utils/pragmaticDragAndDrop.js +8 -3
- package/dist/utils/range.d.ts +62 -0
- package/dist/utils/range.js +70 -0
- package/dist/utils/requestNativeSubmit.d.ts +17 -0
- package/dist/utils/requestNativeSubmit.js +47 -0
- package/dist/utils/safeArea.svelte.d.ts +10 -1
- package/dist/utils/safeArea.svelte.js +19 -11
- package/dist/utils/stateAttributes.d.ts +108 -0
- package/dist/utils/stateAttributes.js +78 -0
- package/dist/utils/swipeVelocity.d.ts +32 -0
- package/dist/utils/swipeVelocity.js +59 -0
- package/dist/utils/timer.svelte.d.ts +65 -2
- package/dist/utils/timer.svelte.js +159 -25
- package/dist/utils/trigger.d.ts +41 -0
- package/dist/utils/trigger.js +103 -0
- package/dist/utils/typeahead.d.ts +9 -0
- package/dist/utils/typeahead.js +21 -9
- package/dist/utils/useDndList.svelte.d.ts +1 -1
- package/dist/utils/useDndList.svelte.js +6 -23
- package/dist/utils/useFocusScope.svelte.d.ts +29 -0
- package/dist/utils/useFocusScope.svelte.js +189 -27
- package/dist/utils/useHoverAction.svelte.d.ts +44 -4
- package/dist/utils/useHoverAction.svelte.js +161 -51
- package/dist/utils/useKeyDown.svelte.d.ts +19 -2
- package/dist/utils/useKeyDown.svelte.js +19 -12
- package/dist/utils/useListNavigation.svelte.d.ts +94 -13
- package/dist/utils/useListNavigation.svelte.js +261 -35
- package/dist/utils/useLiveAnnouncer.svelte.d.ts +77 -2
- package/dist/utils/useLiveAnnouncer.svelte.js +119 -2
- package/dist/utils/useNavigation.svelte.d.ts +36 -3
- package/dist/utils/useNavigation.svelte.js +699 -332
- package/dist/utils/usePressAndHold.svelte.d.ts +38 -0
- package/dist/utils/usePressAndHold.svelte.js +191 -0
- package/dist/utils/useScrollLock.svelte.d.ts +20 -1
- package/dist/utils/useScrollLock.svelte.js +54 -13
- package/dist/utils/useSlidingIndicator.svelte.d.ts +2 -0
- package/dist/utils/useSlidingIndicator.svelte.js +27 -5
- package/dist/utils/useTabBridge.svelte.d.ts +20 -0
- package/dist/utils/useTabBridge.svelte.js +109 -0
- package/dist/utils/values.d.ts +15 -0
- package/dist/utils/values.js +49 -0
- package/package.json +31 -2
- package/dist/generated/componentMcpRegistry.d.ts +0 -142
- package/dist/utils/useDrag.svelte.d.ts +0 -11
- package/dist/utils/useDrag.svelte.js +0 -55
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
import { ThemeState, useTheme } from '../Theme/theme.state.svelte.js';
|
|
2
|
-
import { Timer } from '../../utils/timer.svelte.js';
|
|
2
|
+
import { Timer, WINDOW_INACTIVE_REASON, watchWindowActivity } from '../../utils/timer.svelte.js';
|
|
3
|
+
import { useLiveRegions } from '../../utils/useLiveAnnouncer.svelte.js';
|
|
3
4
|
import { DEV } from 'esm-env';
|
|
4
|
-
import { onMount, untrack } from 'svelte';
|
|
5
|
+
import { onMount, tick, untrack } from 'svelte';
|
|
5
6
|
import { createId } from '../../utils/id.js';
|
|
6
7
|
import { createBindableStateClass } from '../../utils/state.svelte.js';
|
|
7
8
|
import { useToastMotion } from './toast.theme.js';
|
|
9
|
+
const HOVER_REASON = 'hover';
|
|
10
|
+
const FOCUS_REASON = 'focus';
|
|
11
|
+
const SWIPE_REASON = 'swipe';
|
|
12
|
+
/** Whether `element` shows keyboard focus; engines without `:focus-visible` count every focus. */
|
|
13
|
+
const isFocusVisible = (element) => {
|
|
14
|
+
if (!element)
|
|
15
|
+
return false;
|
|
16
|
+
try {
|
|
17
|
+
return element.matches(':focus-visible');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const HOLD_REASONS = [WINDOW_INACTIVE_REASON, HOVER_REASON, FOCUS_REASON, SWIPE_REASON];
|
|
8
24
|
export class Toaster extends createBindableStateClass() {
|
|
9
25
|
toasts = $state([]);
|
|
10
26
|
element = $state();
|
|
27
|
+
/** The position whose stack the pointer is over, if any. Set with `setHovering`. */
|
|
11
28
|
hovering = $state(null);
|
|
29
|
+
/**
|
|
30
|
+
* The toast holding keyboard focus (`:focus-visible`), whose stack keeps its timers paused. A
|
|
31
|
+
* touch tap or a mouse click focuses a toast without pausing anything.
|
|
32
|
+
*/
|
|
33
|
+
focusedToast = $state(null);
|
|
34
|
+
/** Focus rests on the notification region itself, where F6 puts it; every stack is held. */
|
|
35
|
+
regionFocused = $state(false);
|
|
12
36
|
polygon = $state([0, 0, 0, 0]);
|
|
13
37
|
isOpen = $state(false);
|
|
14
38
|
theme = useTheme();
|
|
39
|
+
// Persistent polite and assertive regions that announce toasts: they exist before the first
|
|
40
|
+
// toast and outlive every one, which live regions inserted with their text already filled in
|
|
41
|
+
// do not (NVDA and JAWS often skip those). Attached to the section in `Toaster.svelte`.
|
|
42
|
+
liveRegions = useLiveRegions(createId('toaster'));
|
|
15
43
|
// Per-position preset from `toastTheme.motion`, through the override ladder
|
|
16
44
|
// (registry → `setToastTheme` → Toaster `theme.motion` → per-toast `transition`).
|
|
17
45
|
// Lives on the Toaster because `useComponentMotion` must run during init, while
|
|
@@ -41,7 +69,14 @@ export class Toaster extends createBindableStateClass() {
|
|
|
41
69
|
onMount(() => {
|
|
42
70
|
window.toaster = this;
|
|
43
71
|
flushPendingToasts(this);
|
|
72
|
+
const stopWatchingWindow = watchWindowActivity((inactive) => {
|
|
73
|
+
this.windowInactive = inactive;
|
|
74
|
+
this.syncHolds();
|
|
75
|
+
});
|
|
44
76
|
return () => {
|
|
77
|
+
stopWatchingWindow();
|
|
78
|
+
clearTimeout(this.announceTimer);
|
|
79
|
+
this.announceTimer = undefined;
|
|
45
80
|
// Don't leave a dangling reference if this Toaster unmounts (another
|
|
46
81
|
// mounted Toaster may have already replaced it).
|
|
47
82
|
if (window.toaster === this)
|
|
@@ -50,35 +85,103 @@ export class Toaster extends createBindableStateClass() {
|
|
|
50
85
|
});
|
|
51
86
|
// Track duration configuration changes
|
|
52
87
|
$effect(() => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
duration: toast.opts.duration || 0,
|
|
58
|
-
// Timeout is the only path that fires onAutoDismiss (the deferred-commit hook).
|
|
59
|
-
callback: () => toast.remove('auto')
|
|
60
|
-
};
|
|
61
|
-
});
|
|
88
|
+
const durations = this.toasts.map((toast) => ({
|
|
89
|
+
toast,
|
|
90
|
+
duration: toast.opts.duration || 0
|
|
91
|
+
}));
|
|
62
92
|
untrack(() => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
toast.timer.pause();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else if (duration !== toast.timer?.delay && duration > 0 && toast.timer) {
|
|
71
|
-
toast.timer.update(duration);
|
|
72
|
-
}
|
|
73
|
-
else if (toast.timer && duration <= 0) {
|
|
74
|
-
// duration switched to false/0: the toast became persistent.
|
|
75
|
-
toast.timer.destroy();
|
|
76
|
-
toast.timer = undefined;
|
|
93
|
+
durations.forEach(({ toast, duration }) => {
|
|
94
|
+
// No timer reads as a delay of 0, so a new finite duration creates one.
|
|
95
|
+
if (duration !== (toast.timer?.delay ?? 0)) {
|
|
96
|
+
this.syncTimer(toast);
|
|
77
97
|
}
|
|
78
98
|
});
|
|
79
99
|
});
|
|
80
100
|
});
|
|
81
101
|
}
|
|
102
|
+
// Several things hold a toast's countdown at once, each under its own reason, and it runs only
|
|
103
|
+
// while none does: the pointer over its stack, keyboard focus in it, a press or swipe on one of
|
|
104
|
+
// its toasts, and an inactive window. Frames stop in a hidden tab while `performance.now()`
|
|
105
|
+
// keeps counting, so without the window reason every pending toast would expire on the first
|
|
106
|
+
// frame after the user comes back.
|
|
107
|
+
windowInactive = false;
|
|
108
|
+
/** The reasons that currently hold the timers of the toasts at `position`. */
|
|
109
|
+
reasonsFor = (position) => {
|
|
110
|
+
const reasons = [];
|
|
111
|
+
if (this.windowInactive)
|
|
112
|
+
reasons.push(WINDOW_INACTIVE_REASON);
|
|
113
|
+
if (this.hovering === position)
|
|
114
|
+
reasons.push(HOVER_REASON);
|
|
115
|
+
if (this.regionFocused || this.focusedToast?.opts.position === position) {
|
|
116
|
+
reasons.push(FOCUS_REASON);
|
|
117
|
+
}
|
|
118
|
+
if (this.isPressed(position))
|
|
119
|
+
reasons.push(SWIPE_REASON);
|
|
120
|
+
return reasons;
|
|
121
|
+
};
|
|
122
|
+
syncToastHolds = (toast) => {
|
|
123
|
+
const timer = toast.timer;
|
|
124
|
+
if (!timer)
|
|
125
|
+
return;
|
|
126
|
+
const wanted = this.reasonsFor(toast.opts.position);
|
|
127
|
+
for (const reason of HOLD_REASONS) {
|
|
128
|
+
if (wanted.includes(reason))
|
|
129
|
+
timer.hold(reason);
|
|
130
|
+
else
|
|
131
|
+
timer.release(reason);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/** Matches every timer's holds to the pointer, focus, swipe and window state. */
|
|
135
|
+
syncHolds = () => untrack(() => {
|
|
136
|
+
for (const toast of this.toasts)
|
|
137
|
+
this.syncToastHolds(toast);
|
|
138
|
+
});
|
|
139
|
+
/** Whether a press or a swipe is on a toast at `position`. */
|
|
140
|
+
isPressed = (position) => this.toasts.some((toast) => toast.pressed && toast.opts.position === position);
|
|
141
|
+
/** Whether a toast at `position` is being dragged; the stack stays expanded meanwhile. */
|
|
142
|
+
isSwiping = (position) => this.toasts.some((toast) => toast.dragging && toast.opts.position === position);
|
|
143
|
+
/** The pointer entered (`position`) or left (`null`) a stack. */
|
|
144
|
+
setHovering = (position) => {
|
|
145
|
+
if (this.hovering === position)
|
|
146
|
+
return;
|
|
147
|
+
this.hovering = position;
|
|
148
|
+
this.syncHolds();
|
|
149
|
+
};
|
|
150
|
+
/** Keyboard focus entered `toast` (`:focus-visible`), or left it (`null`, only if it holds it). */
|
|
151
|
+
setFocused = (toast, from) => {
|
|
152
|
+
if (from && this.focusedToast !== from)
|
|
153
|
+
return;
|
|
154
|
+
if (this.focusedToast === toast)
|
|
155
|
+
return;
|
|
156
|
+
this.focusedToast = toast;
|
|
157
|
+
this.syncHolds();
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Matches a toast's timer to its duration. `restart` counts down the full duration again
|
|
161
|
+
* even when it did not change. A new timer starts held by whatever holds its position.
|
|
162
|
+
*/
|
|
163
|
+
syncTimer = (toast, restart = false) => {
|
|
164
|
+
const duration = toast.opts.duration || 0;
|
|
165
|
+
if (duration <= 0) {
|
|
166
|
+
// duration switched to false/0: the toast became persistent.
|
|
167
|
+
toast.timer?.destroy();
|
|
168
|
+
toast.timer = undefined;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!toast.timer) {
|
|
172
|
+
// Timeout is the only path that fires onAutoDismiss (the deferred-commit hook).
|
|
173
|
+
toast.timer = new Timer(() => toast.remove('auto'), duration, {
|
|
174
|
+
heldBy: this.reasonsFor(toast.opts.position)
|
|
175
|
+
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!restart && duration === toast.timer.delay)
|
|
179
|
+
return;
|
|
180
|
+
// `update` keeps the holds; an upsert can also have moved the toast to another position,
|
|
181
|
+
// whose pointer, focus and swipe state differ.
|
|
182
|
+
toast.timer.update(duration);
|
|
183
|
+
this.syncToastHolds(toast);
|
|
184
|
+
};
|
|
82
185
|
maybeCloseToaster = () => {
|
|
83
186
|
if (this.toasts.length === 0) {
|
|
84
187
|
this.isOpen = false;
|
|
@@ -99,30 +202,248 @@ export class Toaster extends createBindableStateClass() {
|
|
|
99
202
|
showCloseIcon: opts.showCloseIcon ?? this.showCloseIcon ?? true,
|
|
100
203
|
progress: opts.progress ?? this.progress ?? false
|
|
101
204
|
});
|
|
102
|
-
addToast = (opts) => this.adoptToast(new Toast({ ...opts, id: opts
|
|
205
|
+
addToast = (opts) => this.adoptToast(new Toast({ ...opts, id: toastId(opts) }));
|
|
206
|
+
// Removed toasts whose exit transition may still be playing, by id. The list keys its
|
|
207
|
+
// items by id, so a toast re-added with that id resumes the leaving item instead of
|
|
208
|
+
// mounting a new one; see `adoptToast`.
|
|
209
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- bookkeeping read imperatively, never rendered
|
|
210
|
+
leaving = new Map();
|
|
211
|
+
// Toasts re-added over a leaving one, by id, waiting for that removal to reach the DOM.
|
|
212
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity -- bookkeeping read imperatively, never rendered
|
|
213
|
+
arriving = new Map();
|
|
103
214
|
/**
|
|
104
215
|
* Attaches a toast to this Toaster: resolves its options against the Toaster's
|
|
105
216
|
* defaults and pushes it onto the stack. Used both for a freshly created toast and
|
|
106
217
|
* for one parked in the pending queue while no Toaster was mounted.
|
|
218
|
+
*
|
|
219
|
+
* A toast whose id is already on screen is not added twice (the list is keyed by id):
|
|
220
|
+
* its options are merged into the live toast, its timer restarts, and the live toast is
|
|
221
|
+
* returned. A toast whose id is still animating out joins a microtask later, once that
|
|
222
|
+
* removal has reached the DOM, and takes the leaving item over.
|
|
107
223
|
*/
|
|
108
|
-
adoptToast = (toast) =>
|
|
224
|
+
adoptToast = (toast) =>
|
|
225
|
+
// `toast()` is often called from an effect. Reading the stack here would subscribe that
|
|
226
|
+
// effect to it, and the push below would then re-run it without end.
|
|
227
|
+
untrack(() => {
|
|
228
|
+
const live = this.toasts.find((candidate) => candidate.id === toast.id) ?? this.arriving.get(toast.id);
|
|
229
|
+
if (live) {
|
|
230
|
+
if (live !== toast) {
|
|
231
|
+
live.merge(toast.requested);
|
|
232
|
+
// Shown again while already on screen: the update alone would go unnoticed.
|
|
233
|
+
if (this.toasts.includes(live))
|
|
234
|
+
live.attentionKey += 1;
|
|
235
|
+
}
|
|
236
|
+
this.refreshToast(live);
|
|
237
|
+
return live;
|
|
238
|
+
}
|
|
109
239
|
toast.toaster = this;
|
|
110
240
|
toast.theme = this.theme;
|
|
111
241
|
toast.opts = this.resolveOptions(toast.requested);
|
|
242
|
+
const leaving = this.leaving.get(toast.id);
|
|
243
|
+
if (leaving && leaving !== toast && leaving.element?.isConnected) {
|
|
244
|
+
// The same id is animating out, or is about to: its removal may not have reached
|
|
245
|
+
// the DOM yet. Joined in the same tick, the toast would only swap the item's value
|
|
246
|
+
// in place, with no entry transition and no `onAfterOpen`. Joined once the removal
|
|
247
|
+
// has flushed, Svelte resumes the leaving item and plays the entry again.
|
|
248
|
+
this.arriving.set(toast.id, toast);
|
|
249
|
+
tick().then(() => {
|
|
250
|
+
// Dismissed before it joined.
|
|
251
|
+
if (this.arriving.get(toast.id) !== toast)
|
|
252
|
+
return;
|
|
253
|
+
this.arriving.delete(toast.id);
|
|
254
|
+
this.joinStack(toast);
|
|
255
|
+
});
|
|
256
|
+
return toast;
|
|
257
|
+
}
|
|
258
|
+
this.joinStack(toast);
|
|
259
|
+
return toast;
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* Resolves a live toast's options against the Toaster's defaults again after they changed, and
|
|
263
|
+
* restarts its countdown. An arriving toast gets its timer when it joins the stack.
|
|
264
|
+
*/
|
|
265
|
+
refreshToast = (toast) => untrack(() => {
|
|
266
|
+
if (toast.toaster !== this)
|
|
267
|
+
return;
|
|
268
|
+
toast.opts = this.resolveOptions(toast.requested);
|
|
269
|
+
if (this.toasts.includes(toast))
|
|
270
|
+
this.syncTimer(toast, true);
|
|
271
|
+
});
|
|
272
|
+
/** The toast with `id` that is on screen or about to be, never one that is leaving. */
|
|
273
|
+
find = (id) => untrack(() => this.toasts.find((toast) => toast.id === id) ?? this.arriving.get(id));
|
|
274
|
+
/** Dismisses every toast on screen or about to be; each fires `onDismiss` once. */
|
|
275
|
+
dismissAll = () => untrack(() => {
|
|
276
|
+
for (const toast of [...this.toasts, ...this.arriving.values()])
|
|
277
|
+
toast.remove();
|
|
278
|
+
});
|
|
279
|
+
joinStack = (toast) => {
|
|
280
|
+
const leaving = this.leaving.get(toast.id);
|
|
281
|
+
this.leaving.delete(toast.id);
|
|
282
|
+
// Svelte resumes a leaving item with this toast as its value. The component keeps its
|
|
283
|
+
// element, whose one-shot `bind:this` and size bindings do not follow the new value.
|
|
284
|
+
if (leaving && leaving !== toast && leaving.element?.isConnected) {
|
|
285
|
+
toast.element = leaving.element;
|
|
286
|
+
toast.height = leaving.height;
|
|
287
|
+
}
|
|
112
288
|
this.toasts.push(toast);
|
|
113
289
|
this.isOpen = true;
|
|
114
|
-
return toast;
|
|
115
290
|
};
|
|
116
|
-
removeToast = (toast) => {
|
|
117
|
-
|
|
291
|
+
removeToast = (toast) => untrack(() => {
|
|
292
|
+
if (this.arriving.get(toast.id) === toast) {
|
|
293
|
+
this.arriving.delete(toast.id);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (!this.toasts.includes(toast))
|
|
297
|
+
return;
|
|
298
|
+
this.moveFocusFrom(toast);
|
|
299
|
+
this.toasts = this.toasts.filter((t) => t !== toast);
|
|
300
|
+
// Drop entries whose exit already finished so the map only holds leaving toasts.
|
|
301
|
+
for (const [id, leaving] of this.leaving) {
|
|
302
|
+
if (!leaving.element?.isConnected)
|
|
303
|
+
this.leaving.delete(id);
|
|
304
|
+
}
|
|
305
|
+
this.leaving.set(toast.id, toast);
|
|
306
|
+
// A leaving toast's timers are gone, and the hold it kept on its stack goes with it.
|
|
307
|
+
if (this.focusedToast === toast)
|
|
308
|
+
this.focusedToast = null;
|
|
309
|
+
// Nothing left to hover: the pointer cannot leave a stack that is gone.
|
|
310
|
+
const position = toast.opts.position;
|
|
311
|
+
if (this.hovering === position && !this.toasts.some((t) => t.opts.position === position)) {
|
|
312
|
+
this.hovering = null;
|
|
313
|
+
}
|
|
314
|
+
this.syncHolds();
|
|
315
|
+
});
|
|
316
|
+
// The element focused before F6 sent focus to the region; focus returns there once no toast
|
|
317
|
+
// is left to hold it.
|
|
318
|
+
focusOrigin = null;
|
|
319
|
+
/**
|
|
320
|
+
* F6: moves focus into the notification region, remembering where it came from. With no toast
|
|
321
|
+
* on screen there is nothing to reach, and focus stays where it is.
|
|
322
|
+
*/
|
|
323
|
+
focusRegion = () => {
|
|
324
|
+
const region = this.element;
|
|
325
|
+
if (!region || untrack(() => this.toasts.length) === 0)
|
|
326
|
+
return;
|
|
327
|
+
const active = region.ownerDocument.activeElement;
|
|
328
|
+
if (active instanceof HTMLElement && active !== region.ownerDocument.body) {
|
|
329
|
+
if (!region.contains(active))
|
|
330
|
+
this.focusOrigin = active;
|
|
331
|
+
}
|
|
332
|
+
this.focusRegionElement(true);
|
|
118
333
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
334
|
+
// Set while focus is being sent to the region on behalf of a keyboard user (F6, or the toast
|
|
335
|
+
// they had focused leaving): that focus holds every stack even where `:focus-visible` is unsure.
|
|
336
|
+
keyboardRegionFocus = false;
|
|
337
|
+
/**
|
|
338
|
+
* Focuses the region. Only keyboard focus holds the timers: a pointer or touch user whose toast
|
|
339
|
+
* left lands on the region too, and must not leave every later toast waiting on it.
|
|
340
|
+
*/
|
|
341
|
+
focusRegionElement = (keyboard) => {
|
|
342
|
+
const region = this.element;
|
|
343
|
+
if (!region)
|
|
344
|
+
return;
|
|
345
|
+
this.keyboardRegionFocus = keyboard;
|
|
346
|
+
try {
|
|
347
|
+
region.focus({ preventScroll: true });
|
|
348
|
+
// Already focused: no focus event announces the keyboard user's intent.
|
|
349
|
+
if (keyboard && region.ownerDocument.activeElement === region)
|
|
350
|
+
this.holdRegion();
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
this.keyboardRegionFocus = false;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
holdRegion = () => {
|
|
357
|
+
if (this.regionFocused)
|
|
358
|
+
return;
|
|
359
|
+
this.regionFocused = true;
|
|
360
|
+
this.syncHolds();
|
|
361
|
+
};
|
|
362
|
+
/** Focus entered the region element itself: the toasts it holds wait for the user to reach them. */
|
|
363
|
+
onRegionFocusIn = (event) => {
|
|
364
|
+
const region = this.element;
|
|
365
|
+
if (event.target !== region)
|
|
366
|
+
return;
|
|
367
|
+
if (this.keyboardRegionFocus || isFocusVisible(region))
|
|
368
|
+
this.holdRegion();
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Focus left the region element, or left the region and everything in it. The element F6 came
|
|
372
|
+
* from is forgotten once focus is somewhere else on its own, so it cannot pull focus back later.
|
|
373
|
+
*/
|
|
374
|
+
onRegionFocusOut = (event) => {
|
|
375
|
+
if (event.target === this.element && this.regionFocused) {
|
|
376
|
+
this.regionFocused = false;
|
|
377
|
+
this.syncHolds();
|
|
378
|
+
}
|
|
379
|
+
const next = event.relatedTarget;
|
|
380
|
+
if (!(next instanceof Node) || !this.element?.contains(next))
|
|
381
|
+
this.focusOrigin = null;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Called while `toast` still holds focus and is about to leave: it was dismissed, or it is
|
|
385
|
+
* pushed past `visibleToasts` and turns inert. Focus moves to the toast nearest to it in the
|
|
386
|
+
* stack that stays visible, else back to the element F6 left, else to the region, rather than
|
|
387
|
+
* dropping to the document body.
|
|
388
|
+
*/
|
|
389
|
+
moveFocusFrom = (toast) => {
|
|
390
|
+
const element = toast.element;
|
|
391
|
+
const ownerDocument = element?.ownerDocument;
|
|
392
|
+
if (!element ||
|
|
393
|
+
!ownerDocument?.activeElement ||
|
|
394
|
+
!element.contains(ownerDocument.activeElement)) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const stack = this.toastsPerPositions[toast.opts.position] ?? [];
|
|
398
|
+
const former = stack.indexOf(toast);
|
|
399
|
+
// Read before the toast leaves: a pointer user's focus is not keyboard focus.
|
|
400
|
+
const keyboard = isFocusVisible(ownerDocument.activeElement);
|
|
401
|
+
tick().then(() => {
|
|
402
|
+
const active = ownerDocument.activeElement;
|
|
403
|
+
// Focus went somewhere else on its own in the meantime.
|
|
404
|
+
if (active && active !== ownerDocument.body && !element.contains(active))
|
|
405
|
+
return;
|
|
406
|
+
const remaining = (this.toastsPerPositions[toast.opts.position] ?? []).filter((candidate) => candidate !== toast);
|
|
407
|
+
// The newest toasts show; a candidate may only be inert until this update settles.
|
|
408
|
+
const visible = remaining.slice(Math.max(0, remaining.length - this.visibleToasts));
|
|
409
|
+
const order = (candidate) => Math.abs(stack.indexOf(candidate) - former);
|
|
410
|
+
const next = visible
|
|
411
|
+
.filter((candidate) => candidate.element?.isConnected)
|
|
412
|
+
.sort((a, b) => order(a) - order(b) || stack.indexOf(b) - stack.indexOf(a))[0];
|
|
413
|
+
const origin = this.focusOrigin?.isConnected ? this.focusOrigin : null;
|
|
414
|
+
const target = next?.element ?? origin;
|
|
415
|
+
if (target)
|
|
416
|
+
target.focus({ preventScroll: true });
|
|
417
|
+
else
|
|
418
|
+
this.focusRegionElement(keyboard);
|
|
124
419
|
});
|
|
125
420
|
};
|
|
421
|
+
// Toasts created in the same tick are spoken together: the live regions hold one message at a
|
|
422
|
+
// time, and each announcement replaces the one before it within the same frame.
|
|
423
|
+
pendingAnnouncements = {
|
|
424
|
+
polite: [],
|
|
425
|
+
assertive: []
|
|
426
|
+
};
|
|
427
|
+
announceTimer;
|
|
428
|
+
/** Announces a toast's text in the persistent live regions; `important` ones are assertive. */
|
|
429
|
+
announce = (message, important = false) => {
|
|
430
|
+
if (!message)
|
|
431
|
+
return;
|
|
432
|
+
this.pendingAnnouncements[important ? 'assertive' : 'polite'].push(message);
|
|
433
|
+
if (this.announceTimer !== undefined)
|
|
434
|
+
return;
|
|
435
|
+
// A macrotask, so every toast of the burst has reached its announce call by then.
|
|
436
|
+
this.announceTimer = setTimeout(() => {
|
|
437
|
+
this.announceTimer = undefined;
|
|
438
|
+
for (const politeness of ['polite', 'assertive']) {
|
|
439
|
+
const messages = this.pendingAnnouncements[politeness];
|
|
440
|
+
if (!messages.length)
|
|
441
|
+
continue;
|
|
442
|
+
this.pendingAnnouncements[politeness] = [];
|
|
443
|
+
this.liveRegions.announce(messages.join('. '), politeness);
|
|
444
|
+
}
|
|
445
|
+
}, 0);
|
|
446
|
+
};
|
|
126
447
|
}
|
|
127
448
|
export class Toast {
|
|
128
449
|
id;
|
|
@@ -132,11 +453,28 @@ export class Toast {
|
|
|
132
453
|
// `<Toaster />` mounts parks the instance in `pendingToasts` first.
|
|
133
454
|
toaster = $state(null);
|
|
134
455
|
theme = null;
|
|
135
|
-
/**
|
|
456
|
+
/**
|
|
457
|
+
* The caller's own options; a Toaster layers its defaults over them on adoption. A later
|
|
458
|
+
* `toast()` call with the same id merges its options in (see `merge`).
|
|
459
|
+
*/
|
|
136
460
|
requested;
|
|
137
461
|
element = $state();
|
|
138
462
|
height = $state(0);
|
|
139
463
|
loading = $state(false);
|
|
464
|
+
/**
|
|
465
|
+
* Counts the updates this toast received after it was created, by `toast()` with its id,
|
|
466
|
+
* `toast.update()` or `update()`. Rendered as `data-update-key`.
|
|
467
|
+
*/
|
|
468
|
+
updateKey = $state(0);
|
|
469
|
+
/**
|
|
470
|
+
* Counts the times this toast was shown again while on screen (a `toast()` call with its id, or
|
|
471
|
+
* the same message deduplicated). Each one plays a short bounce to draw the eye back to it.
|
|
472
|
+
*/
|
|
473
|
+
attentionKey = $state(0);
|
|
474
|
+
/** A pointer is down on the toast, or it is being swiped; its stack's timers are held. */
|
|
475
|
+
pressed = $state(false);
|
|
476
|
+
/** The toast is being dragged; its stack stays expanded meanwhile. */
|
|
477
|
+
dragging = $state(false);
|
|
140
478
|
timer = $state(undefined);
|
|
141
479
|
index = $state(0);
|
|
142
480
|
opts = $state({
|
|
@@ -155,6 +493,40 @@ export class Toast {
|
|
|
155
493
|
// flip `toast.loading` later (e.g. resolve a pending action to a result).
|
|
156
494
|
this.loading = opts.loading ?? false;
|
|
157
495
|
}
|
|
496
|
+
/**
|
|
497
|
+
* Merges the options of a later `toast()` call with this id over the ones this toast
|
|
498
|
+
* was created with; keys the call leaves out keep their value. The owning Toaster
|
|
499
|
+
* resolves its defaults over the result.
|
|
500
|
+
*/
|
|
501
|
+
merge = (request) => {
|
|
502
|
+
this.updateKey += 1;
|
|
503
|
+
this.requested = { ...this.requested, ...request, id: this.id };
|
|
504
|
+
// Provisional, like the constructor's: `adoptToast` resolves the Toaster defaults.
|
|
505
|
+
this.opts = { ...this.requested, position: this.requested.position ?? 'bottom-right' };
|
|
506
|
+
if ('loading' in request)
|
|
507
|
+
this.loading = request.loading ?? false;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* Updates the toast in place: a patch, or a function that receives the current options and
|
|
511
|
+
* returns one. Keys left out keep their value, the countdown restarts from the full duration,
|
|
512
|
+
* and `data-update-key` changes. A toast that was dismissed stays dismissed: updating it, such
|
|
513
|
+
* as when a promise settles after the user closed its toast, does nothing.
|
|
514
|
+
*/
|
|
515
|
+
update = (patch) => {
|
|
516
|
+
if (this.removed)
|
|
517
|
+
return this;
|
|
518
|
+
// Like `toast()`, often called from an effect, which must not subscribe to this toast.
|
|
519
|
+
untrack(() => {
|
|
520
|
+
const next = typeof patch === 'function' ? patch(this.opts) : patch;
|
|
521
|
+
this.merge(next);
|
|
522
|
+
this.toaster?.refreshToast(this);
|
|
523
|
+
});
|
|
524
|
+
return this;
|
|
525
|
+
};
|
|
526
|
+
/** Whether the toast was dismissed, by the user, a timeout or `remove()`. */
|
|
527
|
+
get dismissed() {
|
|
528
|
+
return this.removed;
|
|
529
|
+
}
|
|
158
530
|
// `$derived.by` (not `$derived`): `toaster` is assigned on adoption, so the
|
|
159
531
|
// reference has to sit inside a function the initializer only stores. Only ever read
|
|
160
532
|
// while the toast is rendered, i.e. once a Toaster owns it.
|
|
@@ -183,7 +555,7 @@ export class Toast {
|
|
|
183
555
|
const position = this.opts.position;
|
|
184
556
|
if (position === 'banner-top' || position === 'banner-bottom')
|
|
185
557
|
return false;
|
|
186
|
-
return !this.toaster?.expand && !this.hovered;
|
|
558
|
+
return !this.toaster?.expand && !this.hovered && !this.toaster?.isSwiping(position);
|
|
187
559
|
});
|
|
188
560
|
absolutePosition = $derived.by(() => (this.toaster?.toastsPerPositions?.[this.position] || [])
|
|
189
561
|
.toReversed()
|
|
@@ -235,18 +607,21 @@ export class Toast {
|
|
|
235
607
|
if (this.removed)
|
|
236
608
|
return;
|
|
237
609
|
this.removed = true;
|
|
238
|
-
//
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
this.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
610
|
+
// Like `toast()`, often called from an effect, which must not subscribe to this toast.
|
|
611
|
+
untrack(() => {
|
|
612
|
+
// A toast dismissed before any Toaster mounted is still parked in the pending queue.
|
|
613
|
+
// Leaving it there would have the first Toaster adopt an already-dismissed toast that
|
|
614
|
+
// nothing can dismiss again, since this method is idempotent.
|
|
615
|
+
dropPendingToast(this);
|
|
616
|
+
this.toaster?.removeToast(this);
|
|
617
|
+
this.timer?.destroy();
|
|
618
|
+
if (reason === 'auto') {
|
|
619
|
+
this.opts?.onAutoDismiss?.(this);
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
this.opts?.onDismiss?.(this);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
250
625
|
};
|
|
251
626
|
}
|
|
252
627
|
// `toast()` can legitimately run before any `<Toaster />` has mounted — module
|
|
@@ -284,28 +659,98 @@ const warnIfNothingMounts = () => {
|
|
|
284
659
|
console.warn(`entasis: ${pendingToasts.length} toast(s) are queued because no <Toaster /> is mounted. Add <Toaster /> to your root layout; they will appear as soon as one mounts.`);
|
|
285
660
|
}, 0);
|
|
286
661
|
};
|
|
662
|
+
// The id a toast gets: the one the caller supplied, else one derived from what the toast says, so
|
|
663
|
+
// the same message submitted twice is one toast. A snippet title or description cannot be compared,
|
|
664
|
+
// so such a toast, one with no text at all, and one with `dedupe: false` are always new.
|
|
665
|
+
const toastId = (opts) => {
|
|
666
|
+
if (opts.id)
|
|
667
|
+
return opts.id;
|
|
668
|
+
const { title, description } = opts;
|
|
669
|
+
const comparable = (value) => value === undefined || typeof value === 'string';
|
|
670
|
+
const hasText = typeof title === 'string' || typeof description === 'string';
|
|
671
|
+
if (opts.dedupe === false || !hasText || !comparable(title) || !comparable(description)) {
|
|
672
|
+
return createId('toast');
|
|
673
|
+
}
|
|
674
|
+
return `dedupe:${opts.color ?? ''}:${title ?? ''}\u0000${description ?? ''}`;
|
|
675
|
+
};
|
|
676
|
+
const createToast = (color, payload) => {
|
|
677
|
+
const toast = new Toast({
|
|
678
|
+
color,
|
|
679
|
+
...payload,
|
|
680
|
+
id: toastId({ ...payload, color })
|
|
681
|
+
});
|
|
682
|
+
// On the server nothing ever mounts a Toaster, so the queue would only retain
|
|
683
|
+
// toasts for the lifetime of the process. The caller still gets its handle.
|
|
684
|
+
if (typeof window === 'undefined')
|
|
685
|
+
return toast;
|
|
686
|
+
// A toast whose id is already shown is updated in place (see `adoptToast`).
|
|
687
|
+
if (window.toaster)
|
|
688
|
+
return window.toaster.adoptToast(toast);
|
|
689
|
+
// Same for one still queued: the first Toaster adopts a single toast per id.
|
|
690
|
+
const queued = pendingToasts.find((candidate) => candidate.id === toast.id);
|
|
691
|
+
if (queued) {
|
|
692
|
+
queued.merge(toast.requested);
|
|
693
|
+
return queued;
|
|
694
|
+
}
|
|
695
|
+
pendingToasts.push(toast);
|
|
696
|
+
if (pendingToasts.length > pendingToastLimit)
|
|
697
|
+
pendingToasts.shift();
|
|
698
|
+
if (DEV)
|
|
699
|
+
warnIfNothingMounts();
|
|
700
|
+
return toast;
|
|
701
|
+
};
|
|
702
|
+
/** The live toast with `id`: on screen, about to join the stack, or still waiting for a Toaster. */
|
|
703
|
+
const findToast = (id) => {
|
|
704
|
+
if (typeof window === 'undefined')
|
|
705
|
+
return undefined;
|
|
706
|
+
return window.toaster?.find(id) ?? pendingToasts.find((candidate) => candidate.id === id);
|
|
707
|
+
};
|
|
708
|
+
const updateToast = (id, patch) => findToast(id)?.update(patch);
|
|
709
|
+
const dismissToast = (id) => {
|
|
710
|
+
if (id !== undefined) {
|
|
711
|
+
findToast(id)?.remove();
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (typeof window !== 'undefined')
|
|
715
|
+
window.toaster?.dismissAll();
|
|
716
|
+
for (const queued of [...pendingToasts])
|
|
717
|
+
queued.remove();
|
|
718
|
+
};
|
|
719
|
+
// A stage's patch starts from a clean slate so the pending toast's text and actions never leak into
|
|
720
|
+
// its result; the stage's own options win.
|
|
721
|
+
const stageUpdate = (stage) => {
|
|
722
|
+
const options = typeof stage === 'string' ? { title: stage } : stage;
|
|
723
|
+
return { title: undefined, description: undefined, actions: undefined, ...options };
|
|
724
|
+
};
|
|
725
|
+
const promiseToast = (promise, options) => {
|
|
726
|
+
const handle = createToast('primary', {
|
|
727
|
+
...stageUpdate(options.loading),
|
|
728
|
+
id: options.id,
|
|
729
|
+
loading: true,
|
|
730
|
+
duration: false
|
|
731
|
+
});
|
|
732
|
+
const settle = (color, stage, value) => {
|
|
733
|
+
const resolved = typeof stage === 'function' ? stage(value) : stage;
|
|
734
|
+
// `update` leaves a toast the user dismissed in the meantime alone.
|
|
735
|
+
handle.update({ color, loading: false, duration: undefined, ...stageUpdate(resolved) });
|
|
736
|
+
// The result arrives in a toast the user may have stopped watching: bounce it once, as a
|
|
737
|
+
// toast shown again does. A dismissed toast stays gone.
|
|
738
|
+
if (!handle.dismissed)
|
|
739
|
+
handle.attentionKey += 1;
|
|
740
|
+
};
|
|
741
|
+
promise.then((result) => settle('success', options.success, result), (error) => settle('danger', options.error, error));
|
|
742
|
+
return promise;
|
|
743
|
+
};
|
|
287
744
|
export const toast = new Proxy({}, {
|
|
288
745
|
get(_obj, key) {
|
|
746
|
+
if (key === 'update')
|
|
747
|
+
return updateToast;
|
|
748
|
+
if (key === 'dismiss')
|
|
749
|
+
return dismissToast;
|
|
750
|
+
if (key === 'promise')
|
|
751
|
+
return promiseToast;
|
|
289
752
|
if (typeof key === 'string') {
|
|
290
|
-
return (payload) =>
|
|
291
|
-
const toast = new Toast({
|
|
292
|
-
color: key,
|
|
293
|
-
...payload,
|
|
294
|
-
id: payload?.id || createId('toast')
|
|
295
|
-
});
|
|
296
|
-
// On the server nothing ever mounts a Toaster, so the queue would only retain
|
|
297
|
-
// toasts for the lifetime of the process. The caller still gets its handle.
|
|
298
|
-
if (typeof window === 'undefined')
|
|
299
|
-
return toast;
|
|
300
|
-
if (window.toaster)
|
|
301
|
-
return window.toaster.adoptToast(toast);
|
|
302
|
-
pendingToasts.push(toast);
|
|
303
|
-
if (pendingToasts.length > pendingToastLimit)
|
|
304
|
-
pendingToasts.shift();
|
|
305
|
-
if (DEV)
|
|
306
|
-
warnIfNothingMounts();
|
|
307
|
-
return toast;
|
|
308
|
-
};
|
|
753
|
+
return (payload) => createToast(key, payload);
|
|
309
754
|
}
|
|
310
755
|
}
|
|
311
756
|
});
|