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
|
@@ -5,11 +5,17 @@
|
|
|
5
5
|
import { caretUpIcon } from '../Icons/caretUp.js';
|
|
6
6
|
import { checkIcon } from '../Icons/check.js';
|
|
7
7
|
import { getTabValue, type TabbarProps } from './tabbar.props.js';
|
|
8
|
+
import {
|
|
9
|
+
getDefaultTabValue,
|
|
10
|
+
getTabValueOrigin,
|
|
11
|
+
isTabDisabled,
|
|
12
|
+
useTabSelection
|
|
13
|
+
} from './tabbar.selection.svelte.js';
|
|
8
14
|
import { useTabbarTheme } from './tabbar.theme.js';
|
|
9
15
|
import { useNavigation } from '../../utils/useNavigation.svelte.js';
|
|
10
16
|
import { useOverflowObserver } from '../../utils/useOverflowObserver.svelte.js';
|
|
11
17
|
import { useSlidingIndicator } from '../../utils/useSlidingIndicator.svelte.js';
|
|
12
|
-
import type
|
|
18
|
+
import { untrack, type Snippet } from 'svelte';
|
|
13
19
|
import { createBindableValue } from '../../utils/state.svelte.js';
|
|
14
20
|
import { useDefaultColor } from '../Theme/theme.state.svelte.js';
|
|
15
21
|
|
|
@@ -22,6 +28,7 @@
|
|
|
22
28
|
label,
|
|
23
29
|
controlsPanels = false,
|
|
24
30
|
onValueChange,
|
|
31
|
+
activateOnFocus = true,
|
|
25
32
|
size = 'normal',
|
|
26
33
|
orientation = 'horizontal',
|
|
27
34
|
color,
|
|
@@ -34,12 +41,13 @@
|
|
|
34
41
|
scrollFade = true,
|
|
35
42
|
...attachments
|
|
36
43
|
}: TabbarProps = $props();
|
|
44
|
+
const origin = untrack(() => getTabValueOrigin(value, defaultValue));
|
|
37
45
|
const valueState = createBindableValue(
|
|
38
46
|
() => value,
|
|
39
47
|
(next) => {
|
|
40
48
|
value = next;
|
|
41
49
|
},
|
|
42
|
-
() => defaultValue ?? (items
|
|
50
|
+
() => defaultValue ?? getDefaultTabValue(items)
|
|
43
51
|
);
|
|
44
52
|
|
|
45
53
|
const generatedId = $props.id();
|
|
@@ -47,15 +55,28 @@
|
|
|
47
55
|
const classes = $derived(useTabbarTheme(theme));
|
|
48
56
|
const resolvedColor = $derived(useDefaultColor(color));
|
|
49
57
|
const tabValues = $derived(items.map(getTabValue));
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
// Removing or disabling the selected tab moves the selection to an enabled one, written back
|
|
59
|
+
// and reported; a value the parent set that names no enabled tab is shown as it is.
|
|
60
|
+
const selection = useTabSelection({
|
|
61
|
+
items: () => items,
|
|
62
|
+
value: () => valueState.value,
|
|
63
|
+
origin,
|
|
64
|
+
onFallback: (next, { reason }) => {
|
|
65
|
+
valueState.value = next;
|
|
66
|
+
if (reason) onValueChange?.({ value: next, reason });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
/** Index of the active tab; -1 when no tab is selected. */
|
|
70
|
+
const selectedIndex = $derived(selection.index);
|
|
52
71
|
const tabId = (index: number) => `${id}-tab-${index}`;
|
|
53
72
|
const panelId = (index: number) => (controlsPanels ? `${id}-panel-${index}` : undefined);
|
|
73
|
+
// Every path into a selection (click, focus-follows-selection, menu entry) lands here, so a
|
|
74
|
+
// disabled tab can never be selected even when a key reaches it while it holds DOM focus.
|
|
54
75
|
const select = (index: number) => {
|
|
55
|
-
if (
|
|
76
|
+
if (selectedIndex === index || isTabDisabled(items[index])) return;
|
|
56
77
|
const next = tabValues[index];
|
|
57
78
|
valueState.value = next;
|
|
58
|
-
onValueChange?.(next);
|
|
79
|
+
onValueChange?.({ value: next, reason: 'user' });
|
|
59
80
|
};
|
|
60
81
|
|
|
61
82
|
type NormalizedTab = {
|
|
@@ -124,12 +145,18 @@
|
|
|
124
145
|
enableHoverFocus: false,
|
|
125
146
|
onChange: (index) => {
|
|
126
147
|
// Menu tabs activate manually (via entry selection), never by focus alone —
|
|
127
|
-
// arrowing onto the trigger must not slide the indicator to it.
|
|
128
|
-
|
|
148
|
+
// arrowing onto the trigger must not slide the indicator to it. With
|
|
149
|
+
// `activateOnFocus={false}` no tab activates by focus: Enter, Space or a click does.
|
|
150
|
+
if (
|
|
151
|
+
activateOnFocus &&
|
|
152
|
+
index !== null &&
|
|
153
|
+
index !== selectedIndex &&
|
|
154
|
+
!normalizedTabs[index]?.menu
|
|
155
|
+
) {
|
|
129
156
|
select(index);
|
|
130
157
|
}
|
|
131
158
|
},
|
|
132
|
-
defaultFocusedIndex: () =>
|
|
159
|
+
defaultFocusedIndex: () => (selectedIndex >= 0 ? selectedIndex : null)
|
|
133
160
|
});
|
|
134
161
|
|
|
135
162
|
function handleTabClick(event: MouseEvent, index: number, tab: NormalizedTab) {
|
|
@@ -138,14 +165,23 @@
|
|
|
138
165
|
event.stopPropagation();
|
|
139
166
|
return;
|
|
140
167
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
168
|
+
// Link tabs select on click too, without preventing navigation: with focus-driven
|
|
169
|
+
// activation the focus already selected them (select is idempotent), and with
|
|
170
|
+
// `activateOnFocus={false}` this is their only path to a selection.
|
|
171
|
+
select(index);
|
|
172
|
+
if (!tab.href) navigation.focusItem(index);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Enter on an anchor already dispatches a click; Space does not, so a link tab selects on it
|
|
176
|
+
// here (and keeps the page from scrolling), matching button tabs.
|
|
177
|
+
function handleTabKeydown(event: KeyboardEvent, index: number, tab: NormalizedTab) {
|
|
178
|
+
if (event.key !== ' ' || !tab.href || tab.disabled) return;
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
select(index);
|
|
145
181
|
}
|
|
146
182
|
|
|
147
183
|
const indicator = useSlidingIndicator({
|
|
148
|
-
activeIndex: () =>
|
|
184
|
+
activeIndex: () => selectedIndex,
|
|
149
185
|
observe: () => [
|
|
150
186
|
items,
|
|
151
187
|
size,
|
|
@@ -211,11 +247,12 @@
|
|
|
211
247
|
style={indicator.style}
|
|
212
248
|
data-color={resolvedColor}
|
|
213
249
|
data-ready={indicator.isReady ? 'true' : 'false'}
|
|
250
|
+
hidden={!indicator.isVisible}
|
|
214
251
|
aria-hidden="true"
|
|
215
252
|
></div>
|
|
216
253
|
{/if}
|
|
217
254
|
{#each normalizedTabs as tab, index (index)}
|
|
218
|
-
{@const isActive =
|
|
255
|
+
{@const isActive = selectedIndex === index}
|
|
219
256
|
{@const isFocused = navigation.focusedIndex === index}
|
|
220
257
|
{@const elementType = tab.href ? 'a' : 'button'}
|
|
221
258
|
|
|
@@ -226,8 +263,9 @@
|
|
|
226
263
|
{/if}
|
|
227
264
|
{/snippet}
|
|
228
265
|
<PopupMenu
|
|
266
|
+
{size}
|
|
229
267
|
position="bottom-start"
|
|
230
|
-
menu={{ items: menuItemsFor(index, tab), header: menuHeader }}
|
|
268
|
+
menu={{ items: menuItemsFor(index, tab), header: menuHeader, size }}
|
|
231
269
|
>
|
|
232
270
|
{#snippet trigger(popover)}
|
|
233
271
|
<button
|
|
@@ -314,6 +352,7 @@
|
|
|
314
352
|
fullWidth
|
|
315
353
|
})}
|
|
316
354
|
onclick={(event: MouseEvent) => handleTabClick(event, index, tab)}
|
|
355
|
+
onkeydown={(event: KeyboardEvent) => handleTabKeydown(event, index, tab)}
|
|
317
356
|
{@attach navigation.itemReference}
|
|
318
357
|
{@attach indicator.itemReference(index)}
|
|
319
358
|
>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as Tabbar } from './Tabbar.svelte';
|
|
2
|
-
export type { TabbarProps, TabItem, TabAlignment, TabOrientation, TabbarPosition } from './tabbar.props.js';
|
|
2
|
+
export type { TabbarProps, TabItem, TabAlignment, TabOrientation, TabbarPosition, TabbarValueChangePayload, TabbarValueChangeReason } from './tabbar.props.js';
|
|
3
3
|
export { tabbarTheme, setTabbarTheme, useTabbarTheme, type TabbarTheme, type TabbarThemeProps } from './tabbar.theme.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const tabbarDescription = "\n# Tabbar Component\n\nThe Tabbar component is a flexible navigation component that displays a list of tabs with support for active state management, custom styling, icons, and links.\n\n## Basic Usage\n\n```svelte\n<script>\n\tlet activeTab = $state('Home');\n</script>\n\n<Tabbar items={['Home', 'Profile', 'Settings']} bind:value={activeTab} />\n```\n\n## Props\n\n### Core Props\n- **items**: Array<string | TabItem> (required)\n - Array of tab items. Each item can be:\n - A simple string (e.g., \"Home\")\n - A TabItem object with: { value?, label, prefix?, suffix?, href?, disabled?, target?, rel? }\n - Every tab resolves to a string value: its `value`, else its string label, else its index as a string (`getTabValue(item, index)` is exported from `entasis/tabbar`)\n\n- **value**: string (default: the first tab's value, bindable)\n - The value of the currently active tab (a string item is its own value)\n - Can be bound with `bind:value`\n- **defaultValue**: string - Initial active tab value when value is omitted\n\n- **onValueChange**: (value: string) => void\n - Callback function called when the active tab changes\n - Receives the new tab's value as an argument; not called when the current tab is re-selected\n\n### Styling Props\n- **size**: 'small' | 'normal' | 'large' (default: 'normal')\n - small: Compact size with smaller padding and text\n - normal: Standard size\n - large: Larger size with more padding\n\n- **orientation**: 'horizontal' | 'vertical' (default: 'horizontal')\n - horizontal: Tabs arranged in a row\n - vertical: Tabs arranged in a column\n\n- **color**: 'primary' | 'secondary' | 'neutral' | 'danger' | 'success' | 'warning' | 'info' (default: 'primary')\n - Determines the color scheme of the active tab\n\n- **variant**: 'underline' | 'pill' (default: 'underline')\n - underline: a colored bar slides along the active tab edge (side set by position)\n - pill: a rounded track where the active tab is a raised pill; the pill slides and resizes between tabs with the same animation\n - Both variants respect the color prop: the underline bar and the pill fill use color, and the active pill's label uses the color's contrast tone (use color='neutral' for a neutral pill)\n - The indicator is correct during SSR (a CSS-only bar rendered in the active tab) and hands off to a single measured element that slides after hydration, so it adapts to variable tab widths and to the vertical orientation\n\n- **alignment**: 'start' | 'center' | 'end' (default: 'start')\n - start: Tabs aligned to the start of the container\n - center: Tabs centered in the container\n - end: Tabs aligned to the end of the container\n\n- **fullWidth**: boolean (default: false)\n - Whether the tabbar should be full width\n - When true, the tabbar and individual tabs will expand to fill the available width\n\n- **scrollFade**: boolean (default: true)\n - Applies the shared logical-axis scroll fade only while the tab list overflows\n\n### Advanced Props\n- **label**: string - Accessible name for the tab list, applied as aria-label. Give one to every page that shows more than one set of tabs\n- **id**: string - DOM id prefix for the tabs; each tab renders as `{id}-tab-{index}`. Generated when omitted\n- **controlsPanels**: boolean (default: false) - Adds `aria-controls=\"{id}-panel-{index}\"` to every tab. `Tabs` sets it and renders the matching panels; only enable it yourself when you render panels with those ids\n- **ref**: HTMLDivElement | null (bindable) - Reference to the tab list element\n- **class**: string - Additional CSS classes for the tabbar container\n- **theme**: TabbarThemeProps - Custom theme overrides\n\nNative div attributes and attachments are forwarded to the root, minus the ARIA the tab list owns: `role`, `aria-orientation` (from `orientation`), and its accessible name (from `label`) are written by the component and cannot be overridden. Horizontal and vertical overflow use the shared `scroll-fade-x` and `scroll-fade-y` utilities by default; non-overflowing tab lists remain unmasked, including in no-support fallback browsers.\n\n## TabItem Structure\n\nWhen using object format for items:\n\n```typescript\ntype TabItem = {\n value?: string; // Stable identifier; defaults to the string label\n label: string | Snippet; // Tab label (required)\n prefix?: Snippet; // Icon or content before label\n suffix?: Snippet; // Icon or content after label\n href?: string; // URL for navigation tabs\n disabled?: boolean; // Disable the tab\n target?: string; // Link target (e.g., \"_blank\")\n rel?: string; // Link relationship\n menu?: string[]; // Entries shown in a popover menu (overflow pattern)\n onSelect?: (menuIndex: number) => void; // Called when a menu entry is picked\n}\n```\n\n### Menu tab (overflow pattern)\n\nA tab with `menu` renders with a chevron and opens a popover menu instead of activating directly. Selecting an entry activates the tab, displays the entry's label on it (the tab's own label becomes the menu header), slides the indicator to it, and calls `onSelect(menuIndex)`. The selected entry shows a check mark in the menu.\n\n```svelte\n<Tabbar\n\titems={['Home', 'Projects', { label: 'More', menu: ['Analytics', 'Reports', 'Billing'] }]}\n\tbind:value={activeTab}\n/>\n```\n\n## Structure\n\nThe tabbar follows this DOM structure:\n```\n<Tabbar>\n\t<Tab>\n\t\t<TabContent> <!-- Optional wrapper when prefix/suffix exist -->\n\t\t\t<Prefix /> <!-- Optional prefix content -->\n\t\t\t<Label /> <!-- Tab label -->\n\t\t\t<Suffix /> <!-- Optional suffix content -->\n\t\t</TabContent>\n\t</Tab>\n\t<!-- More tabs... -->\n</Tabbar>\n```\n\n## Examples\n\n### Simple String Tabs\n```svelte\n<script>\n\tlet activeTab = $state('Home');\n</script>\n\n<Tabbar \n\titems={['Home', 'About', 'Contact']} \n\tbind:value={activeTab}\n\tcolor=\"primary\"\n/>\n```\n\n### Tabs with Icons\n```svelte\n<script lang=\"ts\">\n\timport { houseIcon } from 'entasis/icons/house';\n\timport { userIcon } from 'entasis/icons/user';\n\timport { gearIcon } from 'entasis/icons/gear';\n\n\tlet activeTab = $state('Home');\n\n\tconst tabs = [\n\t\t{\n\t\t\tlabel: 'Home',\n\t\t\tprefix: houseIcon\n\t\t},\n\t\t{\n\t\t\tlabel: 'Profile',\n\t\t\tprefix: userIcon\n\t\t},\n\t\t{\n\t\t\tlabel: 'Settings',\n\t\t\tprefix: gearIcon\n\t\t}\n\t];\n</script>\n\n<Tabbar items={tabs} bind:value={activeTab} />\n```\n\n### Navigation Tabs (with links)\n```svelte\n<script>\n\tconst tabs = [\n\t\t{ label: 'Dashboard', href: '/dashboard' },\n\t\t{ label: 'Analytics', href: '/analytics' },\n\t\t{ label: 'Reports', href: '/reports' }\n\t];\n</script>\n\n<Tabbar items={tabs} />\n```\n\n### Tabs with Disabled State\n```svelte\n<script>\n\tlet activeTab = $state('Enabled Tab');\n\t\n\tconst tabs = [\n\t\t{ label: 'Enabled Tab' },\n\t\t{ label: 'Disabled Tab', disabled: true },\n\t\t{ label: 'Another Tab' }\n\t];\n</script>\n\n<Tabbar items={tabs} bind:value={activeTab} />\n```\n\n### Vertical Orientation\n```svelte\n<script>\n\tlet activeTab = $state('First');\n</script>\n\n<Tabbar \n\titems={['First', 'Second', 'Third']} \n\tbind:value={activeTab}\n\torientation=\"vertical\"\n/>\n```\n\n### Different Alignments\n```svelte\n<script>\n\tlet activeTab = $state('One');\n</script>\n\n<!-- Centered tabs -->\n<Tabbar items={['One', 'Two', 'Three']} bind:value={activeTab} alignment=\"center\" />\n\n<!-- Right-aligned tabs -->\n<Tabbar items={['One', 'Two', 'Three']} bind:value={activeTab} alignment=\"end\" />\n```\n\n### Full Width Tabs\n```svelte\n<script>\n\tlet activeTab = $state('Tab 1');\n</script>\n\n<!-- Full width tabbar where tabs expand to fill available space -->\n<Tabbar items={['Tab 1', 'Tab 2', 'Tab 3']} bind:value={activeTab} fullWidth />\n```\n\n### With onValueChange Callback\n```svelte\n<script lang=\"ts\">\n\tlet activeTab = $state('Tab 1');\n\t\n\tfunction handleTabChange(value: string) {\n\t\tconsole.log('Active tab changed to:', value); // e.g. 'Tab 2'\n\t}\n</script>\n\n<Tabbar \n\titems={['Tab 1', 'Tab 2', 'Tab 3']} \n\tbind:value={activeTab}\n\tonValueChange={handleTabChange}\n/>\n```\n\n### Different Sizes and Colors\n```svelte\n<script>\n\tlet activeTab = $state('Small');\n</script>\n\n<!-- Small size with secondary color -->\n<Tabbar \n\titems={['Small', 'Tabs']} \n\tbind:value={activeTab}\n\tsize=\"small\"\n\tcolor=\"secondary\"\n/>\n\n<!-- Large size with success color -->\n<Tabbar \n\titems={['Large', 'Tabs']} \n\tbind:value={activeTab}\n\tsize=\"large\"\n\tcolor=\"success\"\n/>\n```\n\n### Complex Tabs with Badges\n```svelte\n<script>\n\timport { Chip } from 'entasis/chip';\n\t\n\tlet activeTab = $state('Inbox');\n</script>\n\n{#snippet unreadCount()}\n\t<Chip color=\"danger\" size=\"small\">5</Chip>\n{/snippet}\n\n<Tabbar\n\titems={['Inbox', { label: 'Messages', suffix: unreadCount }, 'Sent']}\n\tbind:value={activeTab}\n/>\n```\n\n### External Links\n```svelte\n<script>\n\tconst tabs = [\n\t\t{ label: 'Internal', href: '/dashboard' },\n\t\t{ label: 'External', href: 'https://example.com', target: '_blank', rel: 'noopener' }\n\t];\n</script>\n\n<Tabbar items={tabs} />\n```\n\n## Accessibility\n\nThe Tabbar component follows WAI-ARIA best practices for tablist patterns:\n\n### ARIA Attributes\n- Sets `role=\"tablist\"` on the container\n- Sets `role=\"tab\"` on each tab button\n- Sets `aria-selected=\"true\"` on the active tab, `\"false\"` on others\n- Gives each tab a stable `id` (`{id}-tab-{index}`) and, with `controlsPanels`, an `aria-controls` pointing at its panel\n- Sets `aria-disabled=\"true\"` on disabled tabs\n- Sets `aria-activedescendant` on the container to reference the active tab\n- Implements roving tabindex pattern (active tab has `tabindex=\"0\"`, others have `tabindex=\"-1\"`)\n\n### Keyboard Navigation\nFull keyboard support following WAI-ARIA best practices:\n\n**Horizontal Orientation:**\n- **Arrow Left**: Move focus to previous tab\n- **Arrow Right**: Move focus to next tab\n- **Home**: Move focus to first tab\n- **End**: Move focus to last tab\n- **Enter/Space**: Activate the focused tab\n\n**Vertical Orientation:**\n- **Arrow Up**: Move focus to previous tab\n- **Arrow Down**: Move focus to next tab\n- **Home**: Move focus to first tab\n- **End**: Move focus to last tab\n- **Enter/Space**: Activate the focused tab\n\n**Behavior:**\n- Arrow keys move keyboard **focus** (visual indicator with ring)\n- Enter/Space keys **activate** the focused tab (changes selection)\n- Focus automatically wraps around (loops from last to first and vice versa)\n- Disabled tabs are automatically skipped during navigation\n- Focused tab automatically scrolls into view (smooth scroll)\n- All navigation keys are prevented from scrolling the page\n- Focus ring color matches the tab's color scheme\n\n**Visual States:**\n- **Active tab**: Colored text, background, and bottom/left border\n- **Focused tab**: Ring outline in theme color (keyboard navigation)\n- **Inactive tab**: Neutral gray text with subtle hover effect\n\n## Notes\n\n- When `href` is provided in a tab, it renders as an `<a>` tag, otherwise as a `<button>`\n- Disabled tabs cannot be clicked and do not trigger `onValueChange`\n- The active tab is identified by its string value (a string item's label, or an object item's `value` / string label); give object items an explicit `value` when labels may change or are snippets\n- The `value` prop is bindable for two-way data binding\n- Tabs with `href` will not update `value` on click (they navigate instead)\n- Icon/content sizing is automatically adjusted based on tab size\n- The component is fully responsive and works with all color schemes\n\n## Theme Customization\n\nThe Tabbar component uses a theme object that can be customized using the `theme` prop or by setting a global theme.\n\n### Theme Structure\n\nThe theme object contains the following parts:\n- **root**: Main tabbar container styles\n- **tab**: Individual tab styles\n- **indicator**: The single measured active indicator that slides between tabs\n- **staticIndicator**: The CSS-only indicator rendered inside the active tab for SSR / pre-hydration\n- **prefix**: Prefix icon/content styles\n- **suffix**: Suffix icon/content styles\n\n### Available Variants\n\n**root**:\n- base: Base classes for tabbar container\n- Variants:\n - orientation: 'horizontal' | 'vertical' - Tab orientation\n - scrollFade: 'none' | 'x' | 'y' - Logical-axis scroll fade, applied only while the list overflows\n - alignment: 'start' | 'center' | 'end' - Tab alignment\n - size: 'small' | 'normal' | 'large' - Gap between tabs\n - variant: 'underline' | 'pill' - Track styling\n - fullWidth: boolean - Expand the tabbar to fill its container\n\n**tab**:\n- base: Base classes for tab items\n- Variants:\n - size: 'small' | 'normal' | 'large' - Padding, text size and gap\n - color: Color variants\n - active: boolean - Active state styling\n - focused: boolean - Keyboard-focused state styling\n - disabled: boolean - Disabled state styling\n - orientation: 'horizontal' | 'vertical'\n - position: 'top' | 'bottom' | 'left' | 'right' - Indicator edge\n - variant: 'underline' | 'pill'\n - fullWidth: boolean\n\n**indicator**:\n- base: Base classes for the sliding active indicator\n- Variants:\n - variant: 'underline' | 'pill' - Bar or raised pill\n\n**staticIndicator**:\n- base: Base classes for the SSR indicator\n- Variants:\n - variant: 'underline' | 'pill'\n - position: 'top' | 'bottom' | 'left' | 'right' - Which tab edge the underline sits on\n\n**prefix**:\n- base: Base classes for prefix content\n- Variants:\n - size: 'small' | 'normal' | 'large' - Icon size\n\n**suffix**:\n- base: Base classes for suffix content\n- Variants:\n - size: 'small' | 'normal' | 'large' - Icon size\n\n### Usage Examples\n\n**Basic Theme Override**:\n```svelte\n<Tabbar items={tabs}\n bind:value={activeTab}\n theme={{\n root: {\n base: 'border-b-2 border-gray-200',\n size: {\n normal: 'gap-4'\n }\n },\n tab: {\n active: {\n true: 'border-b-2 border-primary'\n }\n }\n }}\n/>\n```\n\n**Custom Active State**:\n```svelte\n<Tabbar items={tabs}\n bind:value={activeTab}\n theme={{\n tab: {\n active: {\n true: 'bg-primary text-white rounded-t-lg'\n }\n },\n indicator: {\n base: 'bg-primary h-1 rounded-full'\n }\n }}\n/>\n```\n\n**Global Theme Setting**:\n```svelte\n<script>\n import { setTabbarTheme } from './index.ts';\n \n setTabbarTheme({\n root: {\n base: 'border-b border-gray-200',\n size: {\n normal: 'gap-2'\n }\n },\n tab: {\n base: 'transition-colors',\n active: {\n true: 'text-primary border-b-2 border-primary'\n }\n }\n });\n</script>\n```\n";
|
|
1
|
+
export declare const tabbarDescription = "\n# Tabbar Component\n\nThe Tabbar component is a flexible navigation component that displays a list of tabs with support for active state management, custom styling, icons, and links.\n\n## Basic Usage\n\n```svelte\n<script>\n\tlet activeTab = $state('Home');\n</script>\n\n<Tabbar items={['Home', 'Profile', 'Settings']} bind:value={activeTab} />\n```\n\n## Props\n\n### Core Props\n- **items**: Array<string | TabItem> (required)\n - Array of tab items. Each item can be:\n - A simple string (e.g., \"Home\")\n - A TabItem object with: { value?, label, prefix?, suffix?, href?, disabled?, target?, rel? }\n - Every tab resolves to a string value: its `value`, else its string label, else its index as a string\n\n- **value**: string (default: the first enabled tab's value, bindable)\n - The value of the currently active tab (a string item is its own value)\n - Can be bound with `bind:value`\n - A value you set is never rewritten; see Selection fallback for what the Tabbar changes by itself\n- **defaultValue**: string - Initial active tab value when value is omitted\n\n- **onValueChange**: (payload: { value: string; reason }) => void\n - Called once per change of the active tab with `{ value, reason }`, the new tab's value and why it changed: a click, an arrow key, Enter or Space, a menu entry, or an automatic fallback (see Selection fallback)\n - `reason` (`TabbarValueChangeReason`) is `user` for a click, key or menu entry, and `initial`, `disabled` or `missing` when the Tabbar selected an enabled tab by itself\n - Not called when the current tab is re-selected or when value is changed externally\n- **activateOnFocus**: boolean (default: true)\n - `true`: the arrow keys, Home and End select the tab they move to (selection follows focus)\n - `false`: manual activation. The keys only move focus; Enter, Space or a click selects the focused tab. Use it when selecting is costly, for example when lazy panels mount on selection, so arrowing across the list does not build every panel it passes\n - Menu tabs always open manually, whatever this is set to\n\n### Styling Props\n- **size**: 'small' | 'normal' | 'large' (default: 'normal')\n - small: Compact size with smaller padding and text\n - normal: Standard size\n - large: Larger size with more padding\n\n- **orientation**: 'horizontal' | 'vertical' (default: 'horizontal')\n - horizontal: Tabs arranged in a row\n - vertical: Tabs arranged in a column\n\n- **color**: 'primary' | 'secondary' | 'neutral' | 'danger' | 'success' | 'warning' | 'info' (default: 'primary')\n - Determines the color scheme of the active tab\n\n- **variant**: 'underline' | 'pill' (default: 'underline')\n - underline: a colored bar slides along the active tab edge (side set by position)\n - pill: a rounded track where the active tab is a raised pill; the pill slides and resizes between tabs with the same animation\n - Both variants respect the color prop: the underline bar and the pill fill use color, and the active pill's label uses the color's contrast tone (use color='neutral' for a neutral pill)\n - The indicator is correct during SSR (a CSS-only bar rendered in the active tab) and hands off to a single measured element that slides after hydration, so it adapts to variable tab widths and to the vertical orientation\n\n- **alignment**: 'start' | 'center' | 'end' (default: 'start')\n - start: Tabs aligned to the start of the container\n - center: Tabs centered in the container\n - end: Tabs aligned to the end of the container\n\n- **fullWidth**: boolean (default: false)\n - Whether the tabbar should be full width\n - When true, the tabbar and individual tabs will expand to fill the available width\n\n- **scrollFade**: boolean (default: true)\n - Applies the shared logical-axis scroll fade only while the tab list overflows\n\n### Advanced Props\n- **label**: string - Accessible name for the tab list, applied as aria-label. Give one to every page that shows more than one set of tabs\n- **id**: string - DOM id prefix for the tabs; each tab renders as `{id}-tab-{index}`. Generated when omitted\n- **controlsPanels**: boolean (default: false) - Adds `aria-controls=\"{id}-panel-{index}\"` to every tab. `Tabs` sets it and renders the matching panels; only enable it yourself when you render panels with those ids\n- **ref**: HTMLDivElement | null (bindable) - Reference to the tab list element\n- **class**: string - Additional CSS classes for the tabbar container\n- **theme**: TabbarThemeProps - Custom theme overrides\n\nNative div attributes and attachments are forwarded to the root, minus the ARIA the tab list owns: `role`, `aria-orientation` (from `orientation`), and its accessible name (from `label`) are written by the component and cannot be overridden. Horizontal and vertical overflow use the shared `scroll-fade-x` and `scroll-fade-y` utilities by default; non-overflowing tab lists remain unmasked, including in no-support fallback browsers.\n\n## Selection fallback\n\nThe Tabbar moves the selection by itself only when the change is its own; it then renders the new tab (also during SSR), writes its value back to value and calls onValueChange with it:\n\n- On mount, a defaultValue naming a disabled or unknown tab selects the first enabled tab.\n- When the selected tab becomes disabled, the first enabled tab is selected.\n- When the selected tab is removed from items, its nearest enabled neighbour is selected (the tab that moved into its place first, then the one before it).\n\nOmitting value and defaultValue selects the first enabled tab and reports nothing, including when items arrive after mount. A value the parent sets (on mount or later, by binding or by another control such as an overflow picker or a second tab list) is never rewritten: a value naming a disabled tab shows that tab, and a value naming no tab selects no tab until a tab with that value appears. With no selected tab every tab has `aria-selected=\"false\"` and the sliding indicator is `hidden` with `data-ready=\"false\"` and no inline style; when a tab is selected again the indicator snaps into place before it animates. When every tab is disabled, a value naming one of them stays selected. A disabled tab is never selected by a click, a key or a menu entry.\n\n## TabItem Structure\n\nWhen using object format for items:\n\n```typescript\ntype TabItem = {\n value?: string; // Stable identifier; defaults to the string label\n label: string | Snippet; // Tab label (required)\n prefix?: Snippet; // Icon or content before label\n suffix?: Snippet; // Icon or content after label\n href?: string; // URL for navigation tabs\n disabled?: boolean; // Disable the tab\n target?: string; // Link target (e.g., \"_blank\")\n rel?: string; // Link relationship\n menu?: string[]; // Entries shown in a popover menu (overflow pattern)\n onSelect?: (menuIndex: number) => void; // Called when a menu entry is picked\n}\n```\n\n### Menu tab (overflow pattern)\n\nA tab with `menu` renders with a chevron and opens a popover menu instead of activating directly. Selecting an entry activates the tab, displays the entry's label on it (the tab's own label becomes the menu header), slides the indicator to it, and calls `onSelect(menuIndex)`. The selected entry shows a check mark in the menu.\n\n```svelte\n<Tabbar\n\titems={['Home', 'Projects', { label: 'More', menu: ['Analytics', 'Reports', 'Billing'] }]}\n\tbind:value={activeTab}\n/>\n```\n\n## Structure\n\nThe tabbar follows this DOM structure:\n```\n<Tabbar>\n\t<Tab>\n\t\t<TabContent> <!-- Optional wrapper when prefix/suffix exist -->\n\t\t\t<Prefix /> <!-- Optional prefix content -->\n\t\t\t<Label /> <!-- Tab label -->\n\t\t\t<Suffix /> <!-- Optional suffix content -->\n\t\t</TabContent>\n\t</Tab>\n\t<!-- More tabs... -->\n</Tabbar>\n```\n\n## Examples\n\n### Simple String Tabs\n```svelte\n<script>\n\tlet activeTab = $state('Home');\n</script>\n\n<Tabbar \n\titems={['Home', 'About', 'Contact']} \n\tbind:value={activeTab}\n\tcolor=\"primary\"\n/>\n```\n\n### Tabs with Icons\n```svelte\n<script lang=\"ts\">\n\timport { houseIcon } from 'entasis/icons/house';\n\timport { userIcon } from 'entasis/icons/user';\n\timport { gearIcon } from 'entasis/icons/gear';\n\n\tlet activeTab = $state('Home');\n\n\tconst tabs = [\n\t\t{\n\t\t\tlabel: 'Home',\n\t\t\tprefix: houseIcon\n\t\t},\n\t\t{\n\t\t\tlabel: 'Profile',\n\t\t\tprefix: userIcon\n\t\t},\n\t\t{\n\t\t\tlabel: 'Settings',\n\t\t\tprefix: gearIcon\n\t\t}\n\t];\n</script>\n\n<Tabbar items={tabs} bind:value={activeTab} />\n```\n\n### Navigation Tabs (with links)\n```svelte\n<script>\n\tconst tabs = [\n\t\t{ label: 'Dashboard', href: '/dashboard' },\n\t\t{ label: 'Analytics', href: '/analytics' },\n\t\t{ label: 'Reports', href: '/reports' }\n\t];\n</script>\n\n<Tabbar items={tabs} />\n```\n\n### Tabs with Disabled State\n```svelte\n<script>\n\tlet activeTab = $state('Enabled Tab');\n\t\n\tconst tabs = [\n\t\t{ label: 'Enabled Tab' },\n\t\t{ label: 'Disabled Tab', disabled: true },\n\t\t{ label: 'Another Tab' }\n\t];\n</script>\n\n<Tabbar items={tabs} bind:value={activeTab} />\n```\n\n### Vertical Orientation\n```svelte\n<script>\n\tlet activeTab = $state('First');\n</script>\n\n<Tabbar \n\titems={['First', 'Second', 'Third']} \n\tbind:value={activeTab}\n\torientation=\"vertical\"\n/>\n```\n\n### Different Alignments\n```svelte\n<script>\n\tlet activeTab = $state('One');\n</script>\n\n<!-- Centered tabs -->\n<Tabbar items={['One', 'Two', 'Three']} bind:value={activeTab} alignment=\"center\" />\n\n<!-- Right-aligned tabs -->\n<Tabbar items={['One', 'Two', 'Three']} bind:value={activeTab} alignment=\"end\" />\n```\n\n### Full Width Tabs\n```svelte\n<script>\n\tlet activeTab = $state('Tab 1');\n</script>\n\n<!-- Full width tabbar where tabs expand to fill available space -->\n<Tabbar items={['Tab 1', 'Tab 2', 'Tab 3']} bind:value={activeTab} fullWidth />\n```\n\n### With onValueChange Callback\n```svelte\n<script lang=\"ts\">\n\tlet activeTab = $state('Tab 1');\n\t\n\tfunction handleTabChange({ value }: { value: string }) {\n\t\tconsole.log('Active tab changed to:', value); // e.g. 'Tab 2'\n\t}\n</script>\n\n<Tabbar \n\titems={['Tab 1', 'Tab 2', 'Tab 3']} \n\tbind:value={activeTab}\n\tonValueChange={handleTabChange}\n/>\n```\n\n### Different Sizes and Colors\n```svelte\n<script>\n\tlet activeTab = $state('Small');\n</script>\n\n<!-- Small size with secondary color -->\n<Tabbar \n\titems={['Small', 'Tabs']} \n\tbind:value={activeTab}\n\tsize=\"small\"\n\tcolor=\"secondary\"\n/>\n\n<!-- Large size with success color -->\n<Tabbar \n\titems={['Large', 'Tabs']} \n\tbind:value={activeTab}\n\tsize=\"large\"\n\tcolor=\"success\"\n/>\n```\n\n### Complex Tabs with Badges\n```svelte\n<script>\n\timport { Chip } from 'entasis/chip';\n\t\n\tlet activeTab = $state('Inbox');\n</script>\n\n{#snippet unreadCount()}\n\t<Chip color=\"danger\" size=\"small\">5</Chip>\n{/snippet}\n\n<Tabbar\n\titems={['Inbox', { label: 'Messages', suffix: unreadCount }, 'Sent']}\n\tbind:value={activeTab}\n/>\n```\n\n### External Links\n```svelte\n<script>\n\tconst tabs = [\n\t\t{ label: 'Internal', href: '/dashboard' },\n\t\t{ label: 'External', href: 'https://example.com', target: '_blank', rel: 'noopener' }\n\t];\n</script>\n\n<Tabbar items={tabs} />\n```\n\n## Accessibility\n\nThe Tabbar component follows WAI-ARIA best practices for tablist patterns:\n\n### ARIA Attributes\n- Sets `role=\"tablist\"` on the container\n- Sets `role=\"tab\"` on each tab button\n- Sets `aria-selected=\"true\"` on the active tab, `\"false\"` on others\n- Gives each tab a stable `id` (`{id}-tab-{index}`) and, with `controlsPanels`, an `aria-controls` pointing at its panel\n- Sets `aria-disabled=\"true\"` on disabled tabs\n- Sets `aria-activedescendant` on the container to reference the active tab\n- Implements roving tabindex pattern (active tab has `tabindex=\"0\"`, others have `tabindex=\"-1\"`). The tablist itself has `tabindex=\"-1\"`, so Tab and Shift+Tab pass through the tab list in one step\n- The tab stop stays on the focused tab element and skips tabs hidden with CSS, including ones hidden by a class, a style or a media query after mount; removing the focused tab moves focus to the tab that takes its place. Tabs are keyed by position, so inserting or reordering tabs before the focused one leaves focus and the tab stop at the same position\n\n### Keyboard Navigation\nFull keyboard support following WAI-ARIA best practices:\n\n**Horizontal Orientation:**\n- **Arrow Left**: Move focus to previous tab\n- **Arrow Right**: Move focus to next tab\n- **Home**: Move focus to first tab\n- **End**: Move focus to last tab\n- **Enter/Space**: Activate the focused tab\n\n**Vertical Orientation:**\n- **Arrow Up**: Move focus to previous tab\n- **Arrow Down**: Move focus to next tab\n- **Home**: Move focus to first tab\n- **End**: Move focus to last tab\n- **Enter/Space**: Activate the focused tab\n\n**Behavior:**\n- Arrow keys move keyboard **focus** (visual indicator with ring) and, by default, select the tab they reach (`activateOnFocus`)\n- With `activateOnFocus={false}` the arrow keys only move focus, and Enter/Space **activate** the focused tab (changes selection)\n- Focus automatically wraps around (loops from last to first and vice versa)\n- Disabled tabs are automatically skipped during navigation\n- Focused tab automatically scrolls into view (smooth scroll)\n- All navigation keys are prevented from scrolling the page\n- Focus ring color matches the tab's color scheme\n\n**Visual States:**\n- **Active tab**: Colored text, background, and bottom/left border\n- **Focused tab**: Ring outline in theme color (keyboard navigation)\n- **Inactive tab**: Neutral gray text with subtle hover effect\n\n## Notes\n\n- When `href` is provided in a tab, it renders as an `<a>` tag, otherwise as a `<button>`\n- Disabled tabs cannot be clicked and do not trigger `onValueChange`\n- The active tab is identified by its string value (a string item's label, or an object item's `value` / string label); give object items an explicit `value` when labels may change or are snippets\n- The `value` prop is bindable for two-way data binding\n- Tabs with `href` will not update `value` on click (they navigate instead)\n- Icon/content sizing is automatically adjusted based on tab size\n- The component is fully responsive and works with all color schemes\n\n## Theme Customization\n\nThe Tabbar component uses a theme object that can be customized using the `theme` prop or by setting a global theme.\n\n### Theme Structure\n\nThe theme object contains the following parts:\n- **root**: Main tabbar container styles\n- **tab**: Individual tab styles\n- **indicator**: The single measured active indicator that slides between tabs\n- **staticIndicator**: The CSS-only indicator rendered inside the active tab for SSR / pre-hydration\n- **prefix**: Prefix icon/content styles\n- **suffix**: Suffix icon/content styles\n\n### Available Variants\n\n**root**:\n- base: Base classes for tabbar container\n- Variants:\n - orientation: 'horizontal' | 'vertical' - Tab orientation\n - scrollFade: 'none' | 'x' | 'y' - Logical-axis scroll fade, applied only while the list overflows\n - alignment: 'start' | 'center' | 'end' - Tab alignment\n - size: 'small' | 'normal' | 'large' - Gap between tabs\n - variant: 'underline' | 'pill' - Track styling\n - fullWidth: boolean - Expand the tabbar to fill its container\n\n**tab**:\n- base: Base classes for tab items\n- Variants:\n - size: 'small' | 'normal' | 'large' - Padding, text size and gap\n - color: Color variants\n - active: boolean - Active state styling\n - focused: boolean - Keyboard-focused state styling\n - disabled: boolean - Disabled state styling\n - orientation: 'horizontal' | 'vertical'\n - position: 'top' | 'bottom' | 'left' | 'right' - Indicator edge\n - variant: 'underline' | 'pill'\n - fullWidth: boolean\n\n**indicator**:\n- base: Base classes for the sliding active indicator\n- Variants:\n - variant: 'underline' | 'pill' - Bar or raised pill\n\n**staticIndicator**:\n- base: Base classes for the SSR indicator\n- Variants:\n - variant: 'underline' | 'pill'\n - position: 'top' | 'bottom' | 'left' | 'right' - Which tab edge the underline sits on\n\n**prefix**:\n- base: Base classes for prefix content\n- Variants:\n - size: 'small' | 'normal' | 'large' - Icon size\n\n**suffix**:\n- base: Base classes for suffix content\n- Variants:\n - size: 'small' | 'normal' | 'large' - Icon size\n\n### Usage Examples\n\n**Basic Theme Override**:\n```svelte\n<Tabbar items={tabs}\n bind:value={activeTab}\n theme={{\n root: {\n base: 'border-b-2 border-gray-200',\n size: {\n normal: 'gap-4'\n }\n },\n tab: {\n active: {\n true: 'border-b-2 border-primary'\n }\n }\n }}\n/>\n```\n\n**Custom Active State**:\n```svelte\n<Tabbar items={tabs}\n bind:value={activeTab}\n theme={{\n tab: {\n active: {\n true: 'bg-primary text-white rounded-t-lg'\n }\n },\n indicator: {\n base: 'bg-primary h-1 rounded-full'\n }\n }}\n/>\n```\n\n**Global Theme Setting**:\n```svelte\n<script>\n import { setTabbarTheme } from './index.ts';\n \n setTabbarTheme({\n root: {\n base: 'border-b border-gray-200',\n size: {\n normal: 'gap-2'\n }\n },\n tab: {\n base: 'transition-colors',\n active: {\n true: 'text-primary border-b-2 border-primary'\n }\n }\n });\n</script>\n```\n";
|
|
@@ -20,16 +20,22 @@ The Tabbar component is a flexible navigation component that displays a list of
|
|
|
20
20
|
- Array of tab items. Each item can be:
|
|
21
21
|
- A simple string (e.g., "Home")
|
|
22
22
|
- A TabItem object with: { value?, label, prefix?, suffix?, href?, disabled?, target?, rel? }
|
|
23
|
-
- Every tab resolves to a string value: its \`value\`, else its string label, else its index as a string
|
|
23
|
+
- Every tab resolves to a string value: its \`value\`, else its string label, else its index as a string
|
|
24
24
|
|
|
25
|
-
- **value**: string (default: the first tab's value, bindable)
|
|
25
|
+
- **value**: string (default: the first enabled tab's value, bindable)
|
|
26
26
|
- The value of the currently active tab (a string item is its own value)
|
|
27
27
|
- Can be bound with \`bind:value\`
|
|
28
|
+
- A value you set is never rewritten; see Selection fallback for what the Tabbar changes by itself
|
|
28
29
|
- **defaultValue**: string - Initial active tab value when value is omitted
|
|
29
30
|
|
|
30
|
-
- **onValueChange**: (value: string) => void
|
|
31
|
-
-
|
|
32
|
-
-
|
|
31
|
+
- **onValueChange**: (payload: { value: string; reason }) => void
|
|
32
|
+
- Called once per change of the active tab with \`{ value, reason }\`, the new tab's value and why it changed: a click, an arrow key, Enter or Space, a menu entry, or an automatic fallback (see Selection fallback)
|
|
33
|
+
- \`reason\` (\`TabbarValueChangeReason\`) is \`user\` for a click, key or menu entry, and \`initial\`, \`disabled\` or \`missing\` when the Tabbar selected an enabled tab by itself
|
|
34
|
+
- Not called when the current tab is re-selected or when value is changed externally
|
|
35
|
+
- **activateOnFocus**: boolean (default: true)
|
|
36
|
+
- \`true\`: the arrow keys, Home and End select the tab they move to (selection follows focus)
|
|
37
|
+
- \`false\`: manual activation. The keys only move focus; Enter, Space or a click selects the focused tab. Use it when selecting is costly, for example when lazy panels mount on selection, so arrowing across the list does not build every panel it passes
|
|
38
|
+
- Menu tabs always open manually, whatever this is set to
|
|
33
39
|
|
|
34
40
|
### Styling Props
|
|
35
41
|
- **size**: 'small' | 'normal' | 'large' (default: 'normal')
|
|
@@ -72,6 +78,16 @@ The Tabbar component is a flexible navigation component that displays a list of
|
|
|
72
78
|
|
|
73
79
|
Native div attributes and attachments are forwarded to the root, minus the ARIA the tab list owns: \`role\`, \`aria-orientation\` (from \`orientation\`), and its accessible name (from \`label\`) are written by the component and cannot be overridden. Horizontal and vertical overflow use the shared \`scroll-fade-x\` and \`scroll-fade-y\` utilities by default; non-overflowing tab lists remain unmasked, including in no-support fallback browsers.
|
|
74
80
|
|
|
81
|
+
## Selection fallback
|
|
82
|
+
|
|
83
|
+
The Tabbar moves the selection by itself only when the change is its own; it then renders the new tab (also during SSR), writes its value back to value and calls onValueChange with it:
|
|
84
|
+
|
|
85
|
+
- On mount, a defaultValue naming a disabled or unknown tab selects the first enabled tab.
|
|
86
|
+
- When the selected tab becomes disabled, the first enabled tab is selected.
|
|
87
|
+
- When the selected tab is removed from items, its nearest enabled neighbour is selected (the tab that moved into its place first, then the one before it).
|
|
88
|
+
|
|
89
|
+
Omitting value and defaultValue selects the first enabled tab and reports nothing, including when items arrive after mount. A value the parent sets (on mount or later, by binding or by another control such as an overflow picker or a second tab list) is never rewritten: a value naming a disabled tab shows that tab, and a value naming no tab selects no tab until a tab with that value appears. With no selected tab every tab has \`aria-selected="false"\` and the sliding indicator is \`hidden\` with \`data-ready="false"\` and no inline style; when a tab is selected again the indicator snaps into place before it animates. When every tab is disabled, a value naming one of them stays selected. A disabled tab is never selected by a click, a key or a menu entry.
|
|
90
|
+
|
|
75
91
|
## TabItem Structure
|
|
76
92
|
|
|
77
93
|
When using object format for items:
|
|
@@ -230,7 +246,7 @@ The tabbar follows this DOM structure:
|
|
|
230
246
|
<script lang="ts">
|
|
231
247
|
let activeTab = $state('Tab 1');
|
|
232
248
|
|
|
233
|
-
function handleTabChange(value: string) {
|
|
249
|
+
function handleTabChange({ value }: { value: string }) {
|
|
234
250
|
console.log('Active tab changed to:', value); // e.g. 'Tab 2'
|
|
235
251
|
}
|
|
236
252
|
</script>
|
|
@@ -306,7 +322,8 @@ The Tabbar component follows WAI-ARIA best practices for tablist patterns:
|
|
|
306
322
|
- Gives each tab a stable \`id\` (\`{id}-tab-{index}\`) and, with \`controlsPanels\`, an \`aria-controls\` pointing at its panel
|
|
307
323
|
- Sets \`aria-disabled="true"\` on disabled tabs
|
|
308
324
|
- Sets \`aria-activedescendant\` on the container to reference the active tab
|
|
309
|
-
- Implements roving tabindex pattern (active tab has \`tabindex="0"\`, others have \`tabindex="-1"\`)
|
|
325
|
+
- Implements roving tabindex pattern (active tab has \`tabindex="0"\`, others have \`tabindex="-1"\`). The tablist itself has \`tabindex="-1"\`, so Tab and Shift+Tab pass through the tab list in one step
|
|
326
|
+
- The tab stop stays on the focused tab element and skips tabs hidden with CSS, including ones hidden by a class, a style or a media query after mount; removing the focused tab moves focus to the tab that takes its place. Tabs are keyed by position, so inserting or reordering tabs before the focused one leaves focus and the tab stop at the same position
|
|
310
327
|
|
|
311
328
|
### Keyboard Navigation
|
|
312
329
|
Full keyboard support following WAI-ARIA best practices:
|
|
@@ -326,8 +343,8 @@ Full keyboard support following WAI-ARIA best practices:
|
|
|
326
343
|
- **Enter/Space**: Activate the focused tab
|
|
327
344
|
|
|
328
345
|
**Behavior:**
|
|
329
|
-
- Arrow keys move keyboard **focus** (visual indicator with ring)
|
|
330
|
-
- Enter/Space
|
|
346
|
+
- Arrow keys move keyboard **focus** (visual indicator with ring) and, by default, select the tab they reach (\`activateOnFocus\`)
|
|
347
|
+
- With \`activateOnFocus={false}\` the arrow keys only move focus, and Enter/Space **activate** the focused tab (changes selection)
|
|
331
348
|
- Focus automatically wraps around (loops from last to first and vice versa)
|
|
332
349
|
- Disabled tabs are automatically skipped during navigation
|
|
333
350
|
- Focused tab automatically scrolls into view (smooth scroll)
|
|
@@ -3,6 +3,17 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
import type { WithAttachments } from '../../types/props.js';
|
|
4
4
|
import type { TabbarThemeProps } from './tabbar.theme.js';
|
|
5
5
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
+
/**
|
|
7
|
+
* Why a Tabbar reported a change: `user` for a click, arrow key, Enter, Space or menu entry,
|
|
8
|
+
* `initial`, `disabled` or `missing` when the Tabbar selected an enabled tab by itself.
|
|
9
|
+
*/
|
|
10
|
+
export type TabbarValueChangeReason = 'user' | 'initial' | 'disabled' | 'missing';
|
|
11
|
+
/** Payload of Tabbar's `onValueChange`. */
|
|
12
|
+
export type TabbarValueChangePayload = {
|
|
13
|
+
/** The new active tab's value. */
|
|
14
|
+
value: string;
|
|
15
|
+
reason: TabbarValueChangeReason;
|
|
16
|
+
};
|
|
6
17
|
export type TabAlignment = 'start' | 'center' | 'end';
|
|
7
18
|
export type TabOrientation = 'horizontal' | 'vertical';
|
|
8
19
|
export type TabbarPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -71,16 +82,34 @@ export type TabbarProps = WithAttachments<TabbarRootAttributes & {
|
|
|
71
82
|
items: TabItem[];
|
|
72
83
|
/**
|
|
73
84
|
* The `value` of the active tab (a string label resolves to itself). Bindable.
|
|
74
|
-
*
|
|
85
|
+
* A value you set is never rewritten: one naming a disabled tab shows that tab, and one
|
|
86
|
+
* naming no tab selects nothing. When the selected tab is removed or disabled, an enabled
|
|
87
|
+
* tab is selected instead, written back here and reported through `onValueChange`.
|
|
88
|
+
* @default the first enabled tab's value
|
|
75
89
|
*/
|
|
76
90
|
value?: string;
|
|
77
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Initial active tab value when `value` is omitted. One that names a disabled or unknown
|
|
93
|
+
* tab selects the first enabled tab on mount, reported through `onValueChange`.
|
|
94
|
+
*/
|
|
78
95
|
defaultValue?: string;
|
|
79
96
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
97
|
+
* Called once per change of the active tab with its value: a click, an arrow key, a menu
|
|
98
|
+
* entry, or the Tabbar moving the selection to an enabled tab by itself because
|
|
99
|
+
* `defaultValue` named no enabled tab or the selected tab was removed or disabled. Not
|
|
100
|
+
* called when the current tab is re-selected or when `value` is changed externally. The
|
|
101
|
+
* payload is `{ value, reason }`: `reason` is `user`, or `initial`, `disabled` or `missing`
|
|
102
|
+
* for a selection the Tabbar made by itself.
|
|
103
|
+
*/
|
|
104
|
+
onValueChange?: (payload: TabbarValueChangePayload) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Whether moving focus with the arrow keys, Home or End also selects the tab. Set `false`
|
|
107
|
+
* for manual activation: the keys only move focus, and Enter or Space (or a click) selects
|
|
108
|
+
* the focused tab. Use it when selecting a tab is costly, for example when each panel
|
|
109
|
+
* mounts lazily, so arrowing across the list does not build every panel on the way.
|
|
110
|
+
* @default true
|
|
82
111
|
*/
|
|
83
|
-
|
|
112
|
+
activateOnFocus?: boolean;
|
|
84
113
|
/** DOM id prefix for tab elements (`{id}-tab-{index}`); `aria-controls` targets `{id}-panel-{index}`. */
|
|
85
114
|
id?: string;
|
|
86
115
|
/**
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type TabItem } from './tabbar.props.js';
|
|
2
|
+
/**
|
|
3
|
+
* Why a tab list selected a tab by itself: `initial` when `defaultValue` named a disabled or
|
|
4
|
+
* unknown tab, `disabled` when the selected tab became disabled, `missing` when it was removed.
|
|
5
|
+
*/
|
|
6
|
+
export type TabFallbackReason = 'initial' | 'disabled' | 'missing';
|
|
7
|
+
/**
|
|
8
|
+
* The tab that shows as selected. `fallback` is set when the tab list moves the selection by
|
|
9
|
+
* itself: the new value is written back, and reported unless it is the silent `default`.
|
|
10
|
+
*/
|
|
11
|
+
export type TabSelection = {
|
|
12
|
+
index: number;
|
|
13
|
+
fallback?: TabFallbackReason | 'default';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Who chose the value a tab list starts with: the parent (`value`), the parent's `defaultValue`,
|
|
17
|
+
* or the tab list's own `default` (the first enabled tab) when neither was given.
|
|
18
|
+
*/
|
|
19
|
+
export type TabValueOrigin = 'value' | 'defaultValue' | 'default';
|
|
20
|
+
/**
|
|
21
|
+
* What a tab list remembers between resolutions.
|
|
22
|
+
* - `settled`: the value that last selected an enabled tab and that tab's index, kept while the
|
|
23
|
+
* value stays the same, so removing or disabling that tab is known to be the list's own change.
|
|
24
|
+
* - `initial`: the list's own starting value (`defaultValue` or the default), kept until a tab is
|
|
25
|
+
* first selected, so tabs that arrive after mount still replace it.
|
|
26
|
+
*/
|
|
27
|
+
export type TabSelectionHistory = {
|
|
28
|
+
settled?: {
|
|
29
|
+
value: string;
|
|
30
|
+
index: number;
|
|
31
|
+
};
|
|
32
|
+
initial?: {
|
|
33
|
+
value: string;
|
|
34
|
+
origin: Exclude<TabValueOrigin, 'value'>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const isTabDisabled: (item: TabItem | undefined) => boolean;
|
|
38
|
+
/** The default selection: the first enabled tab's value, else the first tab's, else `''`. */
|
|
39
|
+
export declare const getDefaultTabValue: (items: TabItem[]) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Who chose the starting value; read before `createBindableValue` writes its default back. A
|
|
42
|
+
* `value` equal to `defaultValue` is the default written back into a binding: the server renders
|
|
43
|
+
* a bound component again with it.
|
|
44
|
+
*/
|
|
45
|
+
export declare const getTabValueOrigin: (value: unknown, defaultValue: unknown) => TabValueOrigin;
|
|
46
|
+
/**
|
|
47
|
+
* Resolves the tab to show for `value`. A value that names an enabled tab is kept. The tab list
|
|
48
|
+
* replaces a value only when the change is its own: the selected tab was removed (`missing`, the
|
|
49
|
+
* nearest enabled neighbour) or disabled (`disabled`, the first enabled tab), or its starting
|
|
50
|
+
* value names no enabled tab (`initial` for `defaultValue`, the silent `default` otherwise). Any
|
|
51
|
+
* other value came from the parent and is never replaced: a disabled tab it names stays selected
|
|
52
|
+
* and an unknown value selects nothing (-1). With no enabled tab nothing can be replaced either.
|
|
53
|
+
*/
|
|
54
|
+
export declare const resolveTabSelection: (items: TabItem[], value: string, history?: TabSelectionHistory) => TabSelection;
|
|
55
|
+
type TabSelectionOptions = {
|
|
56
|
+
items: () => TabItem[];
|
|
57
|
+
value: () => string;
|
|
58
|
+
/** Who chose the value present on mount; see `getTabValueOrigin`. */
|
|
59
|
+
origin: TabValueOrigin;
|
|
60
|
+
/**
|
|
61
|
+
* Writes a selection the tab list made by itself; runs untracked, once per fallback. `reason`
|
|
62
|
+
* is undefined for the default selection, which is written back but not reported.
|
|
63
|
+
*/
|
|
64
|
+
onFallback: (value: string, details: {
|
|
65
|
+
index: number;
|
|
66
|
+
reason?: TabFallbackReason;
|
|
67
|
+
}) => void;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* One effective selection for a tab list. `index` is what renders — on the server too — and a
|
|
71
|
+
* fallback the list owns is written back through `onFallback` after it renders, so a bound
|
|
72
|
+
* `value` and the rendered tab never disagree for longer than one flush. A value the parent set
|
|
73
|
+
* is never written over, so two lists sharing one value cannot undo each other's picks.
|
|
74
|
+
*/
|
|
75
|
+
export declare const useTabSelection: (options: TabSelectionOptions) => {
|
|
76
|
+
/** Index of the tab that shows as selected; -1 when no tab is. */
|
|
77
|
+
readonly index: number;
|
|
78
|
+
};
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { untrack } from 'svelte';
|
|
2
|
+
import { getTabValue } from './tabbar.props.js';
|
|
3
|
+
export const isTabDisabled = (item) => typeof item === 'object' && item.disabled === true;
|
|
4
|
+
const firstEnabledIndex = (items) => items.findIndex((item) => !isTabDisabled(item));
|
|
5
|
+
/** The default selection: the first enabled tab's value, else the first tab's, else `''`. */
|
|
6
|
+
export const getDefaultTabValue = (items) => {
|
|
7
|
+
const index = Math.max(0, firstEnabledIndex(items));
|
|
8
|
+
const item = items[index];
|
|
9
|
+
return item === undefined ? '' : getTabValue(item, index);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Who chose the starting value; read before `createBindableValue` writes its default back. A
|
|
13
|
+
* `value` equal to `defaultValue` is the default written back into a binding: the server renders
|
|
14
|
+
* a bound component again with it.
|
|
15
|
+
*/
|
|
16
|
+
export const getTabValueOrigin = (value, defaultValue) => {
|
|
17
|
+
if (defaultValue !== undefined && (value === undefined || value === defaultValue)) {
|
|
18
|
+
return 'defaultValue';
|
|
19
|
+
}
|
|
20
|
+
return value === undefined ? 'default' : 'value';
|
|
21
|
+
};
|
|
22
|
+
// After a removal, the tabs that sat on either side of the removed one are at `from` and
|
|
23
|
+
// `from - 1`; the next ring out is `from + 1` and `from - 2`, and so on. Following tabs win ties.
|
|
24
|
+
const nearestEnabledIndex = (items, from) => {
|
|
25
|
+
for (let distance = 0; distance <= Math.max(from, items.length); distance += 1) {
|
|
26
|
+
for (const index of [from + distance, from - distance - 1]) {
|
|
27
|
+
if (index >= 0 && index < items.length && !isTabDisabled(items[index]))
|
|
28
|
+
return index;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return firstEnabledIndex(items);
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the tab to show for `value`. A value that names an enabled tab is kept. The tab list
|
|
35
|
+
* replaces a value only when the change is its own: the selected tab was removed (`missing`, the
|
|
36
|
+
* nearest enabled neighbour) or disabled (`disabled`, the first enabled tab), or its starting
|
|
37
|
+
* value names no enabled tab (`initial` for `defaultValue`, the silent `default` otherwise). Any
|
|
38
|
+
* other value came from the parent and is never replaced: a disabled tab it names stays selected
|
|
39
|
+
* and an unknown value selects nothing (-1). With no enabled tab nothing can be replaced either.
|
|
40
|
+
*/
|
|
41
|
+
export const resolveTabSelection = (items, value, history = {}) => {
|
|
42
|
+
const index = items.findIndex((item, itemIndex) => getTabValue(item, itemIndex) === value);
|
|
43
|
+
if (index !== -1 && !isTabDisabled(items[index]))
|
|
44
|
+
return { index };
|
|
45
|
+
const first = firstEnabledIndex(items);
|
|
46
|
+
if (first === -1)
|
|
47
|
+
return { index };
|
|
48
|
+
const { settled, initial } = history;
|
|
49
|
+
if (settled?.value === value) {
|
|
50
|
+
return index === -1
|
|
51
|
+
? { index: nearestEnabledIndex(items, settled.index), fallback: 'missing' }
|
|
52
|
+
: { index: first, fallback: 'disabled' };
|
|
53
|
+
}
|
|
54
|
+
if (initial?.value === value) {
|
|
55
|
+
return { index: first, fallback: initial.origin === 'default' ? 'default' : 'initial' };
|
|
56
|
+
}
|
|
57
|
+
return { index };
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* One effective selection for a tab list. `index` is what renders — on the server too — and a
|
|
61
|
+
* fallback the list owns is written back through `onFallback` after it renders, so a bound
|
|
62
|
+
* `value` and the rendered tab never disagree for longer than one flush. A value the parent set
|
|
63
|
+
* is never written over, so two lists sharing one value cannot undo each other's picks.
|
|
64
|
+
*/
|
|
65
|
+
export const useTabSelection = (options) => {
|
|
66
|
+
// A plain object on purpose: it describes the last committed selection and must not make the
|
|
67
|
+
// selection depend on its own write-back.
|
|
68
|
+
const history = {};
|
|
69
|
+
if (options.origin !== 'value') {
|
|
70
|
+
history.initial = { value: untrack(options.value), origin: options.origin };
|
|
71
|
+
}
|
|
72
|
+
const selection = $derived(resolveTabSelection(options.items(), options.value(), history));
|
|
73
|
+
$effect(() => {
|
|
74
|
+
const { index, fallback } = selection;
|
|
75
|
+
const items = options.items();
|
|
76
|
+
const value = options.value();
|
|
77
|
+
if (!fallback && index !== -1 && !isTabDisabled(items[index])) {
|
|
78
|
+
history.settled = { value, index };
|
|
79
|
+
history.initial = undefined;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// The value moved on: there is no selected tab left to fall back from.
|
|
83
|
+
if (history.settled?.value !== value)
|
|
84
|
+
history.settled = undefined;
|
|
85
|
+
if (history.initial?.value !== value)
|
|
86
|
+
history.initial = undefined;
|
|
87
|
+
}
|
|
88
|
+
if (!fallback)
|
|
89
|
+
return;
|
|
90
|
+
const reason = fallback === 'default' ? undefined : fallback;
|
|
91
|
+
untrack(() => options.onFallback(getTabValue(items[index], index), { index, reason }));
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
/** Index of the tab that shows as selected; -1 when no tab is. */
|
|
95
|
+
get index() {
|
|
96
|
+
return selection.index;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { elementById } from '../../utils/id.js';
|
|
1
2
|
import { withOptions } from '../../utils/state.svelte.js';
|
|
2
3
|
import { onDestroy, tick, untrack } from 'svelte';
|
|
3
4
|
import { normalizeTableOfContentsItems } from './tableOfContents.items.js';
|
|
@@ -196,7 +197,9 @@ export class TableOfContentsState extends withOptions() {
|
|
|
196
197
|
const headingElements = plainMap();
|
|
197
198
|
const targetHeadings = this.targetElement ? getHeadingElementsById(this.targetElement) : null;
|
|
198
199
|
for (const item of this.resolvedProvidedItems ?? []) {
|
|
199
|
-
const heading = targetHeadings
|
|
200
|
+
const heading = targetHeadings
|
|
201
|
+
? targetHeadings.get(item.id)
|
|
202
|
+
: getHeadingElementById(this.rootElement, item.id);
|
|
200
203
|
if (heading)
|
|
201
204
|
headingElements.set(item.id, heading);
|
|
202
205
|
}
|
|
@@ -388,10 +391,9 @@ function getHeadingElementsById(target) {
|
|
|
388
391
|
}
|
|
389
392
|
return headings;
|
|
390
393
|
}
|
|
391
|
-
function getHeadingElementById(id) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const element = document.getElementById(id);
|
|
394
|
+
function getHeadingElementById(from, id) {
|
|
395
|
+
// Resolved in the tree the table of contents renders in, so a shadow root's headings are found.
|
|
396
|
+
const element = elementById(from, id);
|
|
395
397
|
if (!(element instanceof HTMLElement) || !/^H[1-6]$/.test(element.tagName))
|
|
396
398
|
return null;
|
|
397
399
|
return element;
|
|
@@ -399,7 +401,7 @@ function getHeadingElementById(id) {
|
|
|
399
401
|
function getHeadingId(heading, title, usedIds) {
|
|
400
402
|
const explicitId = heading.id.trim();
|
|
401
403
|
if (explicitId) {
|
|
402
|
-
const owner =
|
|
404
|
+
const owner = elementById(heading, explicitId);
|
|
403
405
|
return !usedIds.has(explicitId) && (!owner || owner === heading) ? explicitId : null;
|
|
404
406
|
}
|
|
405
407
|
const slug = title
|
|
@@ -411,7 +413,7 @@ function getHeadingId(heading, title, usedIds) {
|
|
|
411
413
|
const baseId = `toc-${slug || 'section'}`;
|
|
412
414
|
let candidate = baseId;
|
|
413
415
|
let suffix = 2;
|
|
414
|
-
while (usedIds.has(candidate) ||
|
|
416
|
+
while (usedIds.has(candidate) || elementById(heading, candidate)) {
|
|
415
417
|
candidate = `${baseId}-${suffix}`;
|
|
416
418
|
suffix += 1;
|
|
417
419
|
}
|