@diegopluna/narvi 0.1.0 → 0.3.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 +102 -41
- package/dist/base.css +2 -2
- package/dist/color.d.ts +2 -2
- package/dist/color.js +1 -1
- package/dist/components/activity/ActivityContent.svelte +5 -17
- package/dist/components/activity/ActivityContent.svelte.d.ts +2 -2
- package/dist/components/activity/ActivityRoot.svelte +5 -5
- package/dist/components/activity/ActivityRoot.svelte.d.ts +5 -5
- package/dist/components/activity/ActivityStep.svelte +21 -21
- package/dist/components/activity/ActivityStep.svelte.d.ts +9 -9
- package/dist/components/activity/ActivityThought.svelte +7 -7
- package/dist/components/activity/ActivityThought.svelte.d.ts +3 -3
- package/dist/components/activity/ActivityTrigger.svelte +8 -8
- package/dist/components/activity/ActivityTrigger.svelte.d.ts +5 -5
- package/dist/components/announcer/Announcer.svelte +5 -18
- package/dist/components/announcer/Announcer.svelte.d.ts +3 -3
- package/dist/components/app-shell/AppShellBar.svelte +89 -0
- package/dist/components/app-shell/AppShellBar.svelte.d.ts +20 -0
- package/dist/components/app-shell/AppShellHeader.svelte +20 -19
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +5 -5
- package/dist/components/app-shell/AppShellMain.svelte +6 -22
- package/dist/components/app-shell/AppShellMain.svelte.d.ts +2 -2
- package/dist/components/app-shell/AppShellPanel.svelte +27 -25
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +6 -6
- package/dist/components/app-shell/AppShellPanes.svelte +58 -0
- package/dist/components/app-shell/AppShellPanes.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRail.svelte +85 -0
- package/dist/components/app-shell/AppShellRail.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRoot.svelte +58 -32
- package/dist/components/app-shell/AppShellRoot.svelte.d.ts +16 -14
- package/dist/components/app-shell/AppShellSheet.svelte +95 -0
- package/dist/components/app-shell/AppShellSheet.svelte.d.ts +17 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +40 -64
- package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +4 -8
- package/dist/components/app-shell/AppShellToggle.svelte +66 -26
- package/dist/components/app-shell/AppShellToggle.svelte.d.ts +5 -3
- package/dist/components/app-shell/context.d.ts +6 -0
- package/dist/components/app-shell/index.d.ts +9 -1
- package/dist/components/app-shell/index.js +5 -1
- package/dist/components/approval/Approval.svelte +101 -29
- package/dist/components/approval/Approval.svelte.d.ts +17 -10
- package/dist/components/avatar/AvatarFallback.svelte +4 -4
- package/dist/components/avatar/AvatarFallback.svelte.d.ts +2 -2
- package/dist/components/avatar/AvatarImage.svelte +3 -3
- package/dist/components/avatar/AvatarImage.svelte.d.ts +3 -3
- package/dist/components/avatar/AvatarRoot.svelte +7 -7
- package/dist/components/avatar/AvatarRoot.svelte.d.ts +5 -5
- package/dist/components/badge/Badge.svelte +26 -11
- package/dist/components/badge/Badge.svelte.d.ts +8 -5
- package/dist/components/button/Button.svelte +263 -53
- package/dist/components/button/Button.svelte.d.ts +53 -11
- package/dist/components/card/Card.svelte +21 -32
- package/dist/components/card/Card.svelte.d.ts +6 -6
- package/dist/components/change-stats/ChangeStats.svelte +5 -6
- package/dist/components/change-stats/ChangeStats.svelte.d.ts +4 -4
- package/dist/components/changes-summary/ChangesSummary.svelte +20 -21
- package/dist/components/changes-summary/ChangesSummary.svelte.d.ts +6 -6
- package/dist/components/checkbox/Checkbox.svelte +37 -23
- package/dist/components/checkbox/Checkbox.svelte.d.ts +14 -7
- package/dist/components/choice-cards/ChoiceCards.svelte +145 -0
- package/dist/components/choice-cards/ChoiceCards.svelte.d.ts +29 -0
- package/dist/components/code/Code.svelte +3 -4
- package/dist/components/code/Code.svelte.d.ts +2 -2
- package/dist/components/collapsible/CollapsibleContent.svelte +8 -8
- package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +10 -5
- package/dist/components/collapsible/CollapsibleRoot.svelte +8 -5
- package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +10 -5
- package/dist/components/collapsible/CollapsibleTrigger.svelte +19 -10
- package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +20 -7
- package/dist/components/command/CommandDialog.svelte +3 -3
- package/dist/components/command/CommandDialog.svelte.d.ts +3 -3
- package/dist/components/command/CommandEmpty.svelte +8 -5
- package/dist/components/command/CommandEmpty.svelte.d.ts +10 -5
- package/dist/components/command/CommandFooter.svelte +2 -2
- package/dist/components/command/CommandFooter.svelte.d.ts +2 -2
- package/dist/components/command/CommandGroup.svelte +9 -6
- package/dist/components/command/CommandGroup.svelte.d.ts +12 -6
- package/dist/components/command/CommandInput.svelte +4 -1
- package/dist/components/command/CommandInput.svelte.d.ts +7 -4
- package/dist/components/command/CommandItem.svelte +15 -12
- package/dist/components/command/CommandItem.svelte.d.ts +18 -8
- package/dist/components/command/CommandList.svelte +7 -4
- package/dist/components/command/CommandList.svelte.d.ts +9 -5
- package/dist/components/command/CommandRoot.svelte +8 -5
- package/dist/components/command/CommandRoot.svelte.d.ts +10 -5
- package/dist/components/command/index.d.ts +3 -2
- package/dist/components/command/index.js +3 -2
- package/dist/components/command/styles.d.ts +3 -2
- package/dist/components/command/styles.js +13 -10
- package/dist/components/composer/ComposerAttachButton.svelte +5 -5
- package/dist/components/composer/ComposerAttachButton.svelte.d.ts +4 -4
- package/dist/components/composer/ComposerAttachment.svelte +11 -14
- package/dist/components/composer/ComposerAttachment.svelte.d.ts +2 -2
- package/dist/components/composer/ComposerAttachments.svelte +3 -3
- package/dist/components/composer/ComposerAttachments.svelte.d.ts +3 -3
- package/dist/components/composer/ComposerModelPicker.svelte +27 -29
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +9 -9
- package/dist/components/composer/ComposerRoot.svelte +26 -32
- package/dist/components/composer/ComposerRoot.svelte.d.ts +15 -15
- package/dist/components/composer/ComposerSubmit.svelte +14 -20
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +4 -4
- package/dist/components/composer/ComposerTextarea.svelte +4 -4
- package/dist/components/composer/ComposerTextarea.svelte.d.ts +3 -3
- package/dist/components/composer/ComposerToggle.svelte +13 -15
- package/dist/components/composer/ComposerToggle.svelte.d.ts +4 -4
- package/dist/components/composer/ComposerToolbar.svelte +2 -2
- package/dist/components/composer/ComposerToolbar.svelte.d.ts +2 -2
- package/dist/components/composer/ComposerTray.svelte +78 -0
- package/dist/components/composer/ComposerTray.svelte.d.ts +15 -0
- package/dist/components/composer/index.d.ts +3 -1
- package/dist/components/composer/index.js +3 -2
- package/dist/components/conversation/ConversationContent.svelte +7 -6
- package/dist/components/conversation/ConversationContent.svelte.d.ts +4 -4
- package/dist/components/conversation/ConversationEmpty.svelte +6 -6
- package/dist/components/conversation/ConversationEmpty.svelte.d.ts +5 -5
- package/dist/components/conversation/ConversationRoot.svelte +4 -4
- package/dist/components/conversation/ConversationRoot.svelte.d.ts +4 -4
- package/dist/components/conversation/ConversationScrollButton.svelte +7 -7
- package/dist/components/conversation/ConversationScrollButton.svelte.d.ts +4 -4
- package/dist/components/dialog/ConfirmDialog.svelte +47 -16
- package/dist/components/dialog/ConfirmDialog.svelte.d.ts +14 -9
- package/dist/components/dialog/DialogBody.svelte +12 -4
- package/dist/components/dialog/DialogBody.svelte.d.ts +5 -3
- package/dist/components/dialog/DialogContent.svelte +16 -11
- package/dist/components/dialog/DialogContent.svelte.d.ts +21 -9
- package/dist/components/dialog/DialogDescription.svelte +7 -4
- package/dist/components/dialog/DialogDescription.svelte.d.ts +9 -5
- package/dist/components/dialog/DialogFooter.svelte +2 -2
- package/dist/components/dialog/DialogFooter.svelte.d.ts +2 -2
- package/dist/components/dialog/DialogHeader.svelte +2 -2
- package/dist/components/dialog/DialogHeader.svelte.d.ts +2 -2
- package/dist/components/dialog/DialogTitle.svelte +7 -4
- package/dist/components/dialog/DialogTitle.svelte.d.ts +9 -5
- package/dist/components/dialog/index.d.ts +5 -4
- package/dist/components/dialog/index.js +4 -3
- package/dist/components/dialog/styles.d.ts +8 -3
- package/dist/components/dialog/styles.js +11 -7
- package/dist/components/divider/Divider.svelte +6 -6
- package/dist/components/divider/Divider.svelte.d.ts +3 -3
- package/dist/components/empty-state/EmptyState.svelte +14 -10
- package/dist/components/empty-state/EmptyState.svelte.d.ts +5 -4
- package/dist/components/field/Field.svelte +92 -31
- package/dist/components/field/Field.svelte.d.ts +24 -11
- package/dist/components/field/context.d.ts +6 -3
- package/dist/components/frame/Frame.svelte +12 -13
- package/dist/components/frame/Frame.svelte.d.ts +7 -7
- package/dist/components/grid/Grid.svelte +17 -6
- package/dist/components/grid/Grid.svelte.d.ts +6 -6
- package/dist/components/heading/Heading.svelte +31 -8
- package/dist/components/heading/Heading.svelte.d.ts +6 -4
- package/dist/components/hover-card/HoverCardContent.svelte +7 -4
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +9 -5
- package/dist/components/hover-card/HoverCardRoot.svelte +2 -1
- package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +3 -2
- package/dist/components/hover-card/index.d.ts +2 -1
- package/dist/components/hover-card/index.js +2 -1
- package/dist/components/input/Input.svelte +63 -17
- package/dist/components/input/Input.svelte.d.ts +12 -5
- package/dist/components/kbd/Kbd.svelte +14 -9
- package/dist/components/kbd/Kbd.svelte.d.ts +2 -2
- package/dist/components/link/Link.svelte +12 -8
- package/dist/components/link/Link.svelte.d.ts +9 -6
- package/dist/components/list/ListItem.svelte +41 -0
- package/dist/components/list/ListItem.svelte.d.ts +10 -0
- package/dist/components/list/ListRoot.svelte +69 -0
- package/dist/components/list/ListRoot.svelte.d.ts +28 -0
- package/dist/components/list/context.d.ts +5 -0
- package/dist/components/list/context.js +8 -0
- package/dist/components/list/index.d.ts +5 -0
- package/dist/components/list/index.js +3 -0
- package/dist/components/markdown/Markdown.svelte +714 -0
- package/dist/components/markdown/Markdown.svelte.d.ts +80 -0
- package/dist/components/markdown/MarkdownBlock.svelte +231 -0
- package/dist/components/markdown/MarkdownBlock.svelte.d.ts +11 -0
- package/dist/components/markdown/MarkdownBlocks.svelte +115 -0
- package/dist/components/markdown/MarkdownBlocks.svelte.d.ts +15 -0
- package/dist/components/markdown/MarkdownCode.svelte +583 -0
- package/dist/components/markdown/MarkdownCode.svelte.d.ts +23 -0
- package/dist/components/markdown/MarkdownDiagram.svelte +310 -0
- package/dist/components/markdown/MarkdownDiagram.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownFile.svelte +136 -0
- package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte +62 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownFresh.svelte +69 -0
- package/dist/components/markdown/MarkdownFresh.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownHtml.svelte +72 -0
- package/dist/components/markdown/MarkdownHtml.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownImage.svelte +150 -0
- package/dist/components/markdown/MarkdownImage.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownInlines.svelte +225 -0
- package/dist/components/markdown/MarkdownInlines.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownLink.svelte +120 -0
- package/dist/components/markdown/MarkdownLink.svelte.d.ts +25 -0
- package/dist/components/markdown/MarkdownMath.svelte +138 -0
- package/dist/components/markdown/MarkdownMath.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownTable.svelte +258 -0
- package/dist/components/markdown/MarkdownTable.svelte.d.ts +17 -0
- package/dist/components/markdown/caret.d.ts +14 -0
- package/dist/components/markdown/caret.js +67 -0
- package/dist/components/markdown/context.d.ts +93 -0
- package/dist/components/markdown/context.js +128 -0
- package/dist/components/markdown/copy.d.ts +13 -0
- package/dist/components/markdown/copy.js +74 -0
- package/dist/components/markdown/hidden.d.ts +12 -0
- package/dist/components/markdown/hidden.js +31 -0
- package/dist/components/markdown/kept.d.ts +32 -0
- package/dist/components/markdown/kept.js +71 -0
- package/dist/components/markdown/labels.d.ts +46 -0
- package/dist/components/markdown/labels.js +35 -0
- package/dist/components/markdown/save.d.ts +11 -0
- package/dist/components/markdown/save.js +58 -0
- package/dist/components/markdown/scrollable.d.ts +24 -0
- package/dist/components/markdown/scrollable.js +152 -0
- package/dist/components/markdown/static.d.ts +37 -0
- package/dist/components/markdown/static.js +233 -0
- package/dist/components/markdown/styles.d.ts +320 -0
- package/dist/components/markdown/styles.js +294 -0
- package/dist/components/menu/ContextMenuContent.svelte +8 -5
- package/dist/components/menu/ContextMenuContent.svelte.d.ts +10 -5
- package/dist/components/menu/ContextMenuTrigger.svelte +8 -5
- package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +10 -5
- package/dist/components/menu/MenuCheckboxItem.svelte +8 -5
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +11 -6
- package/dist/components/menu/MenuContent.svelte +7 -4
- package/dist/components/menu/MenuContent.svelte.d.ts +9 -5
- package/dist/components/menu/MenuItem.svelte +14 -11
- package/dist/components/menu/MenuItem.svelte.d.ts +18 -8
- package/dist/components/menu/MenuLabel.svelte +7 -4
- package/dist/components/menu/MenuLabel.svelte.d.ts +9 -5
- package/dist/components/menu/MenuRadioItem.svelte +26 -11
- package/dist/components/menu/MenuRadioItem.svelte.d.ts +20 -6
- package/dist/components/menu/MenuSeparator.svelte +6 -3
- package/dist/components/menu/MenuSeparator.svelte.d.ts +7 -4
- package/dist/components/menu/MenuSubContent.svelte +7 -4
- package/dist/components/menu/MenuSubContent.svelte.d.ts +9 -5
- package/dist/components/menu/MenuSubTrigger.svelte +9 -6
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +11 -6
- package/dist/components/menu/context-menu.d.ts +3 -1
- package/dist/components/menu/context-menu.js +2 -1
- package/dist/components/menu/index.d.ts +24 -0
- package/dist/components/menu/index.js +9 -6
- package/dist/components/message/MessageAction.svelte +26 -6
- package/dist/components/message/MessageAction.svelte.d.ts +13 -4
- package/dist/components/message/MessageActions.svelte +4 -4
- package/dist/components/message/MessageActions.svelte.d.ts +4 -4
- package/dist/components/message/MessageContent.svelte +5 -6
- package/dist/components/message/MessageContent.svelte.d.ts +3 -3
- package/dist/components/message/MessageCopy.svelte +74 -18
- package/dist/components/message/MessageCopy.svelte.d.ts +22 -6
- package/dist/components/message/MessageHeader.svelte +6 -6
- package/dist/components/message/MessageHeader.svelte.d.ts +3 -3
- package/dist/components/message/MessagePending.svelte +3 -3
- package/dist/components/message/MessagePending.svelte.d.ts +2 -2
- package/dist/components/message/MessageRoot.svelte +5 -5
- package/dist/components/message/MessageRoot.svelte.d.ts +5 -5
- package/dist/components/message/MessageTime.svelte +4 -4
- package/dist/components/message/MessageTime.svelte.d.ts +3 -3
- package/dist/components/notice/Notice.svelte +59 -19
- package/dist/components/notice/Notice.svelte.d.ts +13 -8
- package/dist/components/plan/Plan.svelte +28 -30
- package/dist/components/plan/Plan.svelte.d.ts +5 -5
- package/dist/components/popover/PopoverContent.svelte +7 -4
- package/dist/components/popover/PopoverContent.svelte.d.ts +9 -5
- package/dist/components/popover/index.d.ts +4 -3
- package/dist/components/popover/index.js +4 -3
- package/dist/components/progress/Progress.svelte +34 -36
- package/dist/components/progress/Progress.svelte.d.ts +3 -3
- package/dist/components/questionnaire/Questionnaire.svelte +36 -33
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +11 -11
- package/dist/components/queued-message/QueuedMessage.svelte +24 -17
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +10 -10
- package/dist/components/rail/RailItem.svelte +49 -53
- package/dist/components/rail/RailItem.svelte.d.ts +11 -9
- package/dist/components/rail/RailRoot.svelte +20 -6
- package/dist/components/rail/RailRoot.svelte.d.ts +3 -3
- package/dist/components/rail/RailSeparator.svelte +17 -0
- package/dist/components/rail/RailSeparator.svelte.d.ts +18 -0
- package/dist/components/rail/index.d.ts +2 -1
- package/dist/components/rail/index.js +2 -1
- package/dist/components/reasoning/ReasoningContent.svelte +6 -10
- package/dist/components/reasoning/ReasoningContent.svelte.d.ts +2 -2
- package/dist/components/reasoning/ReasoningRoot.svelte +6 -6
- package/dist/components/reasoning/ReasoningRoot.svelte.d.ts +6 -6
- package/dist/components/reasoning/ReasoningTrigger.svelte +5 -5
- package/dist/components/reasoning/ReasoningTrigger.svelte.d.ts +3 -3
- package/dist/components/resize-handle/ResizeHandle.svelte +12 -13
- package/dist/components/resize-handle/ResizeHandle.svelte.d.ts +10 -10
- package/dist/components/reveal/Reveal.svelte +16 -10
- package/dist/components/reveal/Reveal.svelte.d.ts +4 -4
- package/dist/components/reveal/revealed.js +13 -9
- package/dist/components/rolling-text/RollingText.svelte +3 -3
- package/dist/components/rolling-text/RollingText.svelte.d.ts +3 -3
- package/dist/components/search-button/SearchButton.svelte +92 -0
- package/dist/components/search-button/SearchButton.svelte.d.ts +13 -0
- package/dist/components/segmented/SegmentedControl.svelte +78 -32
- package/dist/components/segmented/SegmentedControl.svelte.d.ts +14 -5
- package/dist/components/select/Select.svelte +40 -15
- package/dist/components/select/Select.svelte.d.ts +21 -13
- package/dist/components/separator/Separator.svelte +4 -4
- package/dist/components/separator/Separator.svelte.d.ts +3 -3
- package/dist/components/settings-group/SettingsGroup.svelte +118 -0
- package/dist/components/settings-group/SettingsGroup.svelte.d.ts +19 -0
- package/dist/components/settings-group/context.d.ts +7 -0
- package/dist/components/settings-group/context.js +9 -0
- package/dist/components/settings-row/SettingsRow.svelte +185 -57
- package/dist/components/settings-row/SettingsRow.svelte.d.ts +39 -14
- package/dist/components/sheet/SheetContent.svelte +31 -11
- package/dist/components/sheet/SheetContent.svelte.d.ts +33 -9
- package/dist/components/sheet/index.d.ts +5 -4
- package/dist/components/sheet/index.js +4 -3
- package/dist/components/sheet/styles.d.ts +6 -0
- package/dist/components/sheet/styles.js +2 -0
- package/dist/components/shimmer/Shimmer.svelte +37 -24
- package/dist/components/shimmer/Shimmer.svelte.d.ts +3 -3
- package/dist/components/sidebar/SidebarContent.svelte +4 -4
- package/dist/components/sidebar/SidebarContent.svelte.d.ts +3 -3
- package/dist/components/sidebar/SidebarFolder.svelte +147 -0
- package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
- package/dist/components/sidebar/SidebarFooter.svelte +3 -3
- package/dist/components/sidebar/SidebarFooter.svelte.d.ts +2 -2
- package/dist/components/sidebar/SidebarGroup.svelte +41 -37
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +8 -8
- package/dist/components/sidebar/SidebarHeader.svelte +15 -9
- package/dist/components/sidebar/SidebarHeader.svelte.d.ts +7 -4
- package/dist/components/sidebar/SidebarItem.svelte +64 -45
- package/dist/components/sidebar/SidebarItem.svelte.d.ts +15 -10
- package/dist/components/sidebar/SidebarRoot.svelte +62 -0
- package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
- package/dist/components/sidebar/SidebarSwitcher.svelte +28 -0
- package/dist/components/sidebar/SidebarSwitcher.svelte.d.ts +11 -0
- package/dist/components/sidebar/depth.d.ts +8 -0
- package/dist/components/sidebar/depth.js +14 -0
- package/dist/components/sidebar/index.d.ts +7 -1
- package/dist/components/sidebar/index.js +4 -1
- package/dist/components/skeleton/Skeleton.svelte +31 -20
- package/dist/components/skeleton/Skeleton.svelte.d.ts +5 -5
- package/dist/components/slider/Slider.svelte +24 -23
- package/dist/components/slider/Slider.svelte.d.ts +13 -13
- package/dist/components/spinner/Spinner.svelte +8 -14
- package/dist/components/spinner/Spinner.svelte.d.ts +3 -3
- package/dist/components/stack/Stack.svelte +19 -8
- package/dist/components/stack/Stack.svelte.d.ts +8 -8
- package/dist/components/status-indicator/StatusIndicator.svelte +6 -5
- package/dist/components/status-indicator/StatusIndicator.svelte.d.ts +4 -4
- package/dist/components/suggestions/SuggestionsItem.svelte +8 -8
- package/dist/components/suggestions/SuggestionsItem.svelte.d.ts +3 -3
- package/dist/components/suggestions/SuggestionsRoot.svelte +5 -5
- package/dist/components/suggestions/SuggestionsRoot.svelte.d.ts +5 -5
- package/dist/components/switch/Switch.svelte +27 -21
- package/dist/components/switch/Switch.svelte.d.ts +8 -6
- package/dist/components/tab-strip/TabStrip.svelte +421 -0
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
- package/dist/components/tabs/Tabs.svelte +83 -33
- package/dist/components/tabs/Tabs.svelte.d.ts +15 -5
- package/dist/components/text/Text.svelte +63 -31
- package/dist/components/text/Text.svelte.d.ts +18 -12
- package/dist/components/textarea/Textarea.svelte +5 -5
- package/dist/components/textarea/Textarea.svelte.d.ts +5 -5
- package/dist/components/theme/Theme.svelte +4 -4
- package/dist/components/theme/Theme.svelte.d.ts +4 -4
- package/dist/components/toast/Toaster.svelte +39 -32
- package/dist/components/toast/Toaster.svelte.d.ts +2 -2
- package/dist/components/toast/toasts.svelte.d.ts +52 -15
- package/dist/components/toast/toasts.svelte.js +45 -20
- package/dist/components/toggle/Toggle.svelte +11 -8
- package/dist/components/toggle/Toggle.svelte.d.ts +15 -7
- package/dist/components/toggle-group/ToggleGroupItem.svelte +9 -6
- package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +12 -6
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +17 -14
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +13 -12
- package/dist/components/tool/ToolContent.svelte +5 -10
- package/dist/components/tool/ToolContent.svelte.d.ts +2 -2
- package/dist/components/tool/ToolInput.svelte +3 -3
- package/dist/components/tool/ToolInput.svelte.d.ts +3 -3
- package/dist/components/tool/ToolOutput.svelte +4 -4
- package/dist/components/tool/ToolOutput.svelte.d.ts +4 -4
- package/dist/components/tool/ToolRoot.svelte +7 -7
- package/dist/components/tool/ToolRoot.svelte.d.ts +7 -7
- package/dist/components/tool/ToolSection.svelte +8 -9
- package/dist/components/tool/ToolSection.svelte.d.ts +4 -4
- package/dist/components/tool/ToolTrigger.svelte +14 -13
- package/dist/components/tool/ToolTrigger.svelte.d.ts +4 -4
- package/dist/components/tooltip/TooltipContent.svelte +12 -9
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +12 -6
- package/dist/components/tooltip/TooltipRoot.svelte +7 -4
- package/dist/components/tooltip/TooltipRoot.svelte.d.ts +8 -4
- package/dist/components/tooltip/TooltipTrigger.svelte +2 -1
- package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +3 -2
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/components/tooltip/index.js +2 -1
- package/dist/components/work-fold/WorkFold.svelte +9 -13
- package/dist/components/work-fold/WorkFold.svelte.d.ts +4 -4
- package/dist/index.d.ts +30 -12
- package/dist/index.js +24 -10
- package/dist/internal/Chevron.svelte +1 -1
- package/dist/internal/Chevron.svelte.d.ts +1 -1
- package/dist/internal/Code.svelte +9 -5
- package/dist/internal/Code.svelte.d.ts +3 -3
- package/dist/internal/Collapse.svelte +4 -4
- package/dist/internal/Collapse.svelte.d.ts +4 -4
- package/dist/internal/Glyph.svelte +19 -1
- package/dist/internal/Glyph.svelte.d.ts +9 -2
- package/dist/internal/Tile.svelte +22 -42
- package/dist/internal/Tile.svelte.d.ts +5 -5
- package/dist/internal/complete.d.ts +8 -0
- package/dist/internal/complete.js +1 -0
- package/dist/internal/control.d.ts +4 -4
- package/dist/internal/control.js +20 -17
- package/dist/internal/icon.d.ts +9 -0
- package/dist/internal/icon.js +1 -0
- package/dist/internal/icons.css +14 -0
- package/dist/internal/json.d.ts +1 -1
- package/dist/internal/layer.d.ts +6 -6
- package/dist/internal/layer.js +17 -14
- package/dist/internal/layout.d.ts +1 -1
- package/dist/internal/layout.js +6 -0
- package/dist/internal/loose.d.ts +22 -0
- package/dist/internal/loose.js +4 -0
- package/dist/internal/markers.stylex.d.ts +12 -0
- package/dist/internal/markers.stylex.js +6 -0
- package/dist/internal/plugin-order.d.ts +8 -0
- package/dist/internal/plugin-order.js +16 -0
- package/dist/internal/responsive.d.ts +1 -1
- package/dist/internal/roving.d.ts +1 -1
- package/dist/internal/roving.js +5 -2
- package/dist/internal/shared.d.ts +8 -1
- package/dist/internal/shared.js +21 -5
- package/dist/internal/sx.d.ts +5 -5
- package/dist/internal/toggle.d.ts +1 -2
- package/dist/internal/toggle.js +8 -12
- package/dist/internal/tooltip-trigger.d.ts +9 -0
- package/dist/internal/tooltip-trigger.js +19 -0
- package/dist/internal/visible.d.ts +32 -0
- package/dist/internal/visible.js +44 -0
- package/dist/markdown/ast.d.ts +209 -0
- package/dist/markdown/ast.js +10 -0
- package/dist/markdown/blocks.d.ts +178 -0
- package/dist/markdown/blocks.js +1489 -0
- package/dist/markdown/code-info.d.ts +10 -0
- package/dist/markdown/code-info.js +16 -0
- package/dist/markdown/common.d.ts +25 -0
- package/dist/markdown/common.js +107 -0
- package/dist/markdown/diagrams.d.ts +2 -0
- package/dist/markdown/diagrams.js +18 -0
- package/dist/markdown/file-paths.d.ts +29 -0
- package/dist/markdown/file-paths.js +80 -0
- package/dist/markdown/files.d.ts +16 -0
- package/dist/markdown/files.js +133 -0
- package/dist/markdown/highlight.d.ts +30 -0
- package/dist/markdown/highlight.js +127 -0
- package/dist/markdown/html.d.ts +14 -0
- package/dist/markdown/html.js +289 -0
- package/dist/markdown/images.d.ts +15 -0
- package/dist/markdown/images.js +45 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +5 -0
- package/dist/markdown/inlines.d.ts +48 -0
- package/dist/markdown/inlines.js +1714 -0
- package/dist/markdown/math.d.ts +2 -0
- package/dist/markdown/math.js +22 -0
- package/dist/markdown/parse.d.ts +81 -0
- package/dist/markdown/parse.js +204 -0
- package/dist/markdown/plugin.d.ts +179 -0
- package/dist/markdown/plugin.js +160 -0
- package/dist/markdown/sanitize.d.ts +78 -0
- package/dist/markdown/sanitize.js +522 -0
- package/dist/markdown/share.d.ts +12 -0
- package/dist/markdown/share.js +59 -0
- package/dist/markdown/table.d.ts +13 -0
- package/dist/markdown/table.js +60 -0
- package/dist/markers.stylex.d.ts +13 -0
- package/dist/markers.stylex.js +11 -0
- package/dist/preset.d.ts +44 -20
- package/dist/preset.js +169 -51
- package/dist/tokens.stylex.d.ts +57 -37
- package/dist/tokens.stylex.js +113 -62
- package/dist/typography.d.ts +55 -0
- package/dist/typography.js +63 -0
- package/dist/visually-hidden.d.ts +18 -0
- package/dist/visually-hidden.js +21 -0
- package/dist/vite.d.ts +9 -3
- package/dist/vite.js +27 -2
- package/package.json +57 -6
- package/skills/building-ui/SKILL.md +385 -0
- package/skills/building-ui/references/components.md +211 -0
- package/skills/markdown/SKILL.md +452 -0
- package/skills/markdown/references/plugins.md +103 -0
- package/skills/setup/SKILL.md +199 -0
- package/skills/styling/SKILL.md +318 -0
- package/skills/theming/SKILL.md +277 -0
- package/dist/internal/loop.d.ts +0 -35
- package/dist/internal/loop.js +0 -72
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A strip of tabs for what is open in a pane: threads, files, terminals. Tabs
|
|
3
|
+
can be closed and one can be added. When they do not all fit, they narrow to
|
|
4
|
+
a minimum, their titles cut with an ellipsis; past that the strip scrolls
|
|
5
|
+
sideways, and keeps the open one in view. A tab with a leading icon shows its
|
|
6
|
+
close button in the icon's place, so no room is kept at its end.
|
|
7
|
+
|
|
8
|
+
It names the tabs and says which is open. The panel under it is yours: give
|
|
9
|
+
it `role="tabpanel"` and the id passed as `controls`. For a fixed set of
|
|
10
|
+
sections that own their panel, use Tabs.
|
|
11
|
+
-->
|
|
12
|
+
<script lang="ts" module>
|
|
13
|
+
import { visuallyHidden } from '../../visually-hidden.js';
|
|
14
|
+
import * as stylex from '@stylexjs/stylex';
|
|
15
|
+
import { tick, type Snippet } from 'svelte';
|
|
16
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
17
|
+
import Glyph from '../../internal/Glyph.svelte';
|
|
18
|
+
import { tabStripTabMarker } from '../../internal/markers.stylex.js';
|
|
19
|
+
import { roving } from '../../internal/roving.js';
|
|
20
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
21
|
+
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
22
|
+
import { media } from '../../media.stylex.js';
|
|
23
|
+
|
|
24
|
+
export type TabStripTab = {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
/** Shown in place of the close button until the pointer is on the tab: unsaved, or live. */
|
|
28
|
+
mark?: 'unsaved' | 'live' | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type TabStripProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onclose'> & {
|
|
32
|
+
tabs: TabStripTab[];
|
|
33
|
+
/** The id of the open tab. Bindable. */
|
|
34
|
+
value?: string | undefined;
|
|
35
|
+
/** Names the strip: "Open threads". */
|
|
36
|
+
label: string;
|
|
37
|
+
/** The id of the panel the tabs show. */
|
|
38
|
+
controls?: string | undefined;
|
|
39
|
+
/** Called to close a tab. Without it the tabs cannot be closed. */
|
|
40
|
+
onclose?: ((id: string) => void) | undefined;
|
|
41
|
+
/** Called to add one. Without it there is no button to add. */
|
|
42
|
+
onadd?: (() => void) | undefined;
|
|
43
|
+
addLabel?: string | undefined;
|
|
44
|
+
/** The name of a tab's close button. */
|
|
45
|
+
closeLabel?: ((tab: TabStripTab) => string) | undefined;
|
|
46
|
+
/** Before a tab's label: an icon, or a StatusIndicator. */
|
|
47
|
+
leading?: Snippet<[TabStripTab]> | undefined;
|
|
48
|
+
sx?: Sx | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// One key for every hover, so the catalog can show it without a pointer
|
|
52
|
+
const HOVER = ':is(:hover, [data-preview~="hover"])';
|
|
53
|
+
|
|
54
|
+
const styles = stylex.create({
|
|
55
|
+
root: {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
// The button to add one stands a little apart from the last tab
|
|
59
|
+
gap: '0.375rem',
|
|
60
|
+
minWidth: 0,
|
|
61
|
+
fontFamily: font.body
|
|
62
|
+
},
|
|
63
|
+
// The tabs scroll; the button to add one stays put at their end
|
|
64
|
+
list: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
gap: '0.125rem',
|
|
68
|
+
minWidth: 0,
|
|
69
|
+
overflowX: 'auto',
|
|
70
|
+
overscrollBehaviorX: 'contain',
|
|
71
|
+
scrollbarWidth: 'none',
|
|
72
|
+
// Room for a tab's focus ring, which the scroller would otherwise clip
|
|
73
|
+
padding: '2px',
|
|
74
|
+
margin: '-2px'
|
|
75
|
+
},
|
|
76
|
+
// Tabs narrow before the strip scrolls, so a title ends in an ellipsis, not mid-word
|
|
77
|
+
tab: {
|
|
78
|
+
position: 'relative',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
flexShrink: 1,
|
|
82
|
+
minWidth: '5.5rem',
|
|
83
|
+
maxWidth: '14rem',
|
|
84
|
+
borderRadius: radius.control,
|
|
85
|
+
backgroundColor: {
|
|
86
|
+
default: 'transparent',
|
|
87
|
+
[HOVER]: { default: null, [media.hover]: colors.fillHover }
|
|
88
|
+
},
|
|
89
|
+
color: {
|
|
90
|
+
default: colors.textMuted,
|
|
91
|
+
[HOVER]: { default: null, [media.hover]: colors.text }
|
|
92
|
+
},
|
|
93
|
+
transitionProperty: 'background-color, color',
|
|
94
|
+
transitionDuration: motion.fast,
|
|
95
|
+
transitionTimingFunction: 'ease'
|
|
96
|
+
},
|
|
97
|
+
// The open tab: a fill, as the open row of a list has
|
|
98
|
+
selected: {
|
|
99
|
+
backgroundColor: { default: colors.fillSelected, [HOVER]: colors.fillSelected },
|
|
100
|
+
color: colors.text
|
|
101
|
+
},
|
|
102
|
+
button: {
|
|
103
|
+
display: 'flex',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
gap: '0.4375rem',
|
|
106
|
+
flexGrow: 1,
|
|
107
|
+
minWidth: 0,
|
|
108
|
+
height: '1.75rem',
|
|
109
|
+
margin: 0,
|
|
110
|
+
paddingBlock: 0,
|
|
111
|
+
paddingInlineStart: '0.625rem',
|
|
112
|
+
paddingInlineEnd: '0.625rem',
|
|
113
|
+
borderWidth: 0,
|
|
114
|
+
borderRadius: 'inherit',
|
|
115
|
+
backgroundColor: 'transparent',
|
|
116
|
+
color: 'inherit',
|
|
117
|
+
fontFamily: 'inherit',
|
|
118
|
+
fontSize: font.sizeMeta,
|
|
119
|
+
fontWeight: font.weightMedium,
|
|
120
|
+
lineHeight: 1,
|
|
121
|
+
cursor: 'pointer',
|
|
122
|
+
WebkitAppRegion: 'no-drag',
|
|
123
|
+
WebkitTapHighlightColor: 'transparent',
|
|
124
|
+
outlineStyle: 'solid',
|
|
125
|
+
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
126
|
+
outlineColor: colors.focusRing,
|
|
127
|
+
outlineOffset: '0px'
|
|
128
|
+
},
|
|
129
|
+
// A tab that can be closed keeps room at its end for the button
|
|
130
|
+
closable: { paddingInlineEnd: '1.625rem' },
|
|
131
|
+
text: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
|
|
132
|
+
leading: { display: 'grid', flexShrink: 0 },
|
|
133
|
+
// With a leading icon, the close button and a mark take the icon's place: the icon
|
|
134
|
+
// steps aside under the pointer or with focus, and for a mark
|
|
135
|
+
leadCell: { display: 'grid', placeItems: 'center', flexShrink: 0, width: '1rem' },
|
|
136
|
+
leadIcon: {
|
|
137
|
+
gridArea: '1 / 1',
|
|
138
|
+
display: 'grid',
|
|
139
|
+
transitionProperty: 'opacity',
|
|
140
|
+
transitionDuration: motion.fast,
|
|
141
|
+
opacity: {
|
|
142
|
+
default: 1,
|
|
143
|
+
[media.hover]: { default: 1, [stylex.when.ancestor(':hover', tabStripTabMarker)]: 0 },
|
|
144
|
+
[stylex.when.ancestor(':focus-within', tabStripTabMarker)]: 0
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
// Where nothing hovers, the open tab shows its close button in the icon's place
|
|
148
|
+
leadIconSelected: { opacity: { default: 0, [media.hover]: { default: 1 } } },
|
|
149
|
+
leadMark: { gridArea: '1 / 1' },
|
|
150
|
+
start: {
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
insetInlineStart: '0.5rem',
|
|
153
|
+
top: '50%',
|
|
154
|
+
translate: '0 -50%',
|
|
155
|
+
display: 'grid',
|
|
156
|
+
width: '1.25rem',
|
|
157
|
+
height: '1.25rem'
|
|
158
|
+
},
|
|
159
|
+
closeLead: {
|
|
160
|
+
opacity: {
|
|
161
|
+
default: 0,
|
|
162
|
+
[media.hover]: { default: 0, [stylex.when.ancestor(':hover', tabStripTabMarker)]: 1 },
|
|
163
|
+
[stylex.when.ancestor(':focus-within', tabStripTabMarker)]: 1
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
closeLeadSelected: {
|
|
167
|
+
opacity: {
|
|
168
|
+
default: 1,
|
|
169
|
+
[media.hover]: { default: 0, [stylex.when.ancestor(':hover', tabStripTabMarker)]: 1 },
|
|
170
|
+
[stylex.when.ancestor(':focus-within', tabStripTabMarker)]: 1
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
// Over the end of the tab. Shown for the open tab, and for any under the pointer or
|
|
174
|
+
// with focus inside; until then a mark may stand there.
|
|
175
|
+
end: {
|
|
176
|
+
position: 'absolute',
|
|
177
|
+
insetInlineEnd: '0.25rem',
|
|
178
|
+
top: '50%',
|
|
179
|
+
translate: '0 -50%',
|
|
180
|
+
display: 'grid',
|
|
181
|
+
placeItems: 'center',
|
|
182
|
+
width: '1.125rem',
|
|
183
|
+
height: '1.125rem'
|
|
184
|
+
},
|
|
185
|
+
close: {
|
|
186
|
+
display: 'grid',
|
|
187
|
+
placeItems: 'center',
|
|
188
|
+
width: '100%',
|
|
189
|
+
height: '100%',
|
|
190
|
+
margin: 0,
|
|
191
|
+
padding: 0,
|
|
192
|
+
borderWidth: 0,
|
|
193
|
+
borderRadius: radius.chip,
|
|
194
|
+
backgroundColor: {
|
|
195
|
+
default: 'transparent',
|
|
196
|
+
[HOVER]: { default: null, [media.hover]: colors.fillHover }
|
|
197
|
+
},
|
|
198
|
+
color: { default: colors.textSubtle, [HOVER]: { default: null, [media.hover]: colors.text } },
|
|
199
|
+
cursor: 'pointer',
|
|
200
|
+
WebkitAppRegion: 'no-drag',
|
|
201
|
+
// Hidden where a pointer can hover, until it does; always there where it cannot
|
|
202
|
+
opacity: {
|
|
203
|
+
default: 1,
|
|
204
|
+
[media.hover]: { default: 0, [stylex.when.ancestor(':hover', tabStripTabMarker)]: 1 },
|
|
205
|
+
[stylex.when.ancestor(':focus-within', tabStripTabMarker)]: 1
|
|
206
|
+
},
|
|
207
|
+
outlineStyle: 'solid',
|
|
208
|
+
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
209
|
+
outlineColor: colors.focusRing,
|
|
210
|
+
outlineOffset: '0px'
|
|
211
|
+
},
|
|
212
|
+
closeShown: { opacity: 1 },
|
|
213
|
+
mark: {
|
|
214
|
+
gridArea: '1 / 1',
|
|
215
|
+
width: '0.375rem',
|
|
216
|
+
height: '0.375rem',
|
|
217
|
+
borderRadius: radius.pill,
|
|
218
|
+
backgroundColor: colors.textSubtle,
|
|
219
|
+
pointerEvents: 'none',
|
|
220
|
+
// Gives way to the close button
|
|
221
|
+
opacity: {
|
|
222
|
+
default: 0,
|
|
223
|
+
[media.hover]: { default: 1, [stylex.when.ancestor(':hover', tabStripTabMarker)]: 0 },
|
|
224
|
+
[stylex.when.ancestor(':focus-within', tabStripTabMarker)]: 0
|
|
225
|
+
},
|
|
226
|
+
forcedColorAdjust: 'none'
|
|
227
|
+
},
|
|
228
|
+
live: { backgroundColor: colors.accent },
|
|
229
|
+
// In the icon's place, a mark stands alone: it does not give way on hover
|
|
230
|
+
markStill: { opacity: 1 },
|
|
231
|
+
closeCell: { gridArea: '1 / 1', display: 'grid', width: '100%', height: '100%' },
|
|
232
|
+
add: {
|
|
233
|
+
display: 'grid',
|
|
234
|
+
placeItems: 'center',
|
|
235
|
+
flexShrink: 0,
|
|
236
|
+
width: '1.75rem',
|
|
237
|
+
height: '1.75rem',
|
|
238
|
+
margin: 0,
|
|
239
|
+
padding: 0,
|
|
240
|
+
borderWidth: 0,
|
|
241
|
+
borderRadius: radius.control,
|
|
242
|
+
backgroundColor: {
|
|
243
|
+
default: 'transparent',
|
|
244
|
+
[HOVER]: { default: null, [media.hover]: colors.fillHover }
|
|
245
|
+
},
|
|
246
|
+
color: { default: colors.textMuted, [HOVER]: { default: null, [media.hover]: colors.text } },
|
|
247
|
+
cursor: 'pointer',
|
|
248
|
+
WebkitAppRegion: 'no-drag',
|
|
249
|
+
outlineStyle: 'solid',
|
|
250
|
+
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
251
|
+
outlineColor: colors.focusRing,
|
|
252
|
+
outlineOffset: '0px'
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
</script>
|
|
256
|
+
|
|
257
|
+
<script lang="ts">
|
|
258
|
+
let {
|
|
259
|
+
tabs,
|
|
260
|
+
value = $bindable(),
|
|
261
|
+
label,
|
|
262
|
+
controls,
|
|
263
|
+
onclose,
|
|
264
|
+
onadd,
|
|
265
|
+
addLabel = 'New tab',
|
|
266
|
+
closeLabel = (tab) => `Close ${tab.label}`,
|
|
267
|
+
leading,
|
|
268
|
+
sx,
|
|
269
|
+
class: className,
|
|
270
|
+
...rest
|
|
271
|
+
}: TabStripProps = $props();
|
|
272
|
+
|
|
273
|
+
let list = $state<HTMLElement | null>(null);
|
|
274
|
+
|
|
275
|
+
// The open tab stays in view as tabs come, go and are chosen
|
|
276
|
+
$effect(() => {
|
|
277
|
+
void value;
|
|
278
|
+
void tabs.length;
|
|
279
|
+
tick().then(() =>
|
|
280
|
+
list
|
|
281
|
+
?.querySelector<HTMLElement>('[role="tab"][aria-selected="true"]')
|
|
282
|
+
?.scrollIntoView({ block: 'nearest', inline: 'nearest' })
|
|
283
|
+
);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
function close(tab: TabStripTab, viaKeyboard = false) {
|
|
287
|
+
if (!onclose) return;
|
|
288
|
+
const index = tabs.indexOf(tab);
|
|
289
|
+
onclose(tab.id);
|
|
290
|
+
// The tab that held focus is gone: its neighbour takes it
|
|
291
|
+
if (!viaKeyboard) return;
|
|
292
|
+
tick().then(() => {
|
|
293
|
+
const buttons = list?.querySelectorAll<HTMLElement>('[role="tab"]');
|
|
294
|
+
(buttons?.[Math.min(index, (buttons?.length ?? 1) - 1)] ?? null)?.focus();
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
</script>
|
|
298
|
+
|
|
299
|
+
<div data-slot="tab-strip" {...rest} {...attrs([styles.root, sx], className)}>
|
|
300
|
+
<div
|
|
301
|
+
bind:this={list}
|
|
302
|
+
role="tablist"
|
|
303
|
+
aria-label={label}
|
|
304
|
+
aria-orientation="horizontal"
|
|
305
|
+
{...stylex.attrs(styles.list)}
|
|
306
|
+
{@attach roving({ selector: '[role="tab"]', orientation: 'horizontal' })}
|
|
307
|
+
>
|
|
308
|
+
{#each tabs as tab (tab.id)}
|
|
309
|
+
{@const selected = tab.id === value}
|
|
310
|
+
<div
|
|
311
|
+
data-slot="tab-strip-tab"
|
|
312
|
+
{...stylex.attrs(styles.tab, selected && styles.selected, tabStripTabMarker)}
|
|
313
|
+
>
|
|
314
|
+
<button
|
|
315
|
+
type="button"
|
|
316
|
+
role="tab"
|
|
317
|
+
aria-selected={selected}
|
|
318
|
+
aria-controls={controls}
|
|
319
|
+
aria-current={selected ? 'true' : undefined}
|
|
320
|
+
title={tab.label}
|
|
321
|
+
{...stylex.attrs(styles.button, onclose && !leading && styles.closable)}
|
|
322
|
+
onclick={() => (value = tab.id)}
|
|
323
|
+
onauxclick={(event) => {
|
|
324
|
+
// The middle button closes, as it does in a browser
|
|
325
|
+
if (event.button === 1) close(tab);
|
|
326
|
+
}}
|
|
327
|
+
onkeydown={(event) => {
|
|
328
|
+
if (!onclose || (event.key !== 'Delete' && event.key !== 'Backspace')) return;
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
close(tab, true);
|
|
331
|
+
}}
|
|
332
|
+
>
|
|
333
|
+
{#if leading}
|
|
334
|
+
<span {...stylex.attrs(styles.leadCell)}>
|
|
335
|
+
{#if tab.mark}
|
|
336
|
+
<span
|
|
337
|
+
aria-hidden="true"
|
|
338
|
+
{...stylex.attrs(
|
|
339
|
+
styles.mark,
|
|
340
|
+
styles.markStill,
|
|
341
|
+
styles.leadMark,
|
|
342
|
+
tab.mark === 'live' && styles.live,
|
|
343
|
+
onclose && styles.leadIcon,
|
|
344
|
+
onclose && selected && styles.leadIconSelected
|
|
345
|
+
)}
|
|
346
|
+
></span>
|
|
347
|
+
{:else}
|
|
348
|
+
<span
|
|
349
|
+
{...stylex.attrs(
|
|
350
|
+
styles.leading,
|
|
351
|
+
onclose && styles.leadIcon,
|
|
352
|
+
onclose && selected && styles.leadIconSelected
|
|
353
|
+
)}>{@render leading(tab)}</span
|
|
354
|
+
>
|
|
355
|
+
{/if}
|
|
356
|
+
</span>
|
|
357
|
+
{/if}
|
|
358
|
+
<span {...stylex.attrs(styles.text)}>{tab.label}</span>
|
|
359
|
+
{#if tab.mark}<span {...stylex.attrs(visuallyHidden)}
|
|
360
|
+
>, {tab.mark === 'live' ? 'working' : 'unsaved'}</span
|
|
361
|
+
>{/if}
|
|
362
|
+
</button>
|
|
363
|
+
{#if leading && onclose}
|
|
364
|
+
<span {...stylex.attrs(styles.start)}>
|
|
365
|
+
<button
|
|
366
|
+
type="button"
|
|
367
|
+
tabindex="-1"
|
|
368
|
+
aria-label={closeLabel(tab)}
|
|
369
|
+
{...stylex.attrs(
|
|
370
|
+
styles.close,
|
|
371
|
+
selected ? styles.closeLeadSelected : styles.closeLead
|
|
372
|
+
)}
|
|
373
|
+
onclick={() => close(tab)}
|
|
374
|
+
>
|
|
375
|
+
<Glyph name="close" size={12} />
|
|
376
|
+
</button>
|
|
377
|
+
</span>
|
|
378
|
+
{:else if onclose || tab.mark}
|
|
379
|
+
<span {...stylex.attrs(styles.end)}>
|
|
380
|
+
{#if tab.mark}
|
|
381
|
+
<span
|
|
382
|
+
aria-hidden="true"
|
|
383
|
+
{...stylex.attrs(styles.mark, tab.mark === 'live' && styles.live)}
|
|
384
|
+
></span>
|
|
385
|
+
{/if}
|
|
386
|
+
{#if onclose}
|
|
387
|
+
<span {...stylex.attrs(styles.closeCell)}>
|
|
388
|
+
<button
|
|
389
|
+
type="button"
|
|
390
|
+
tabindex="-1"
|
|
391
|
+
aria-label={closeLabel(tab)}
|
|
392
|
+
{...stylex.attrs(styles.close, selected && !tab.mark && styles.closeShown)}
|
|
393
|
+
onclick={() => close(tab)}
|
|
394
|
+
>
|
|
395
|
+
<Glyph name="close" size={12} />
|
|
396
|
+
</button>
|
|
397
|
+
</span>
|
|
398
|
+
{/if}
|
|
399
|
+
</span>
|
|
400
|
+
{/if}
|
|
401
|
+
</div>
|
|
402
|
+
{/each}
|
|
403
|
+
</div>
|
|
404
|
+
{#if onadd}
|
|
405
|
+
<button type="button" aria-label={addLabel} {...stylex.attrs(styles.add)} onclick={onadd}>
|
|
406
|
+
<svg
|
|
407
|
+
data-glyph=""
|
|
408
|
+
width="14"
|
|
409
|
+
height="14"
|
|
410
|
+
viewBox="0 0 16 16"
|
|
411
|
+
fill="none"
|
|
412
|
+
stroke="currentColor"
|
|
413
|
+
stroke-width="1.5"
|
|
414
|
+
stroke-linecap="round"
|
|
415
|
+
aria-hidden="true"
|
|
416
|
+
>
|
|
417
|
+
<path d="M8 3.5v9M3.5 8h9" />
|
|
418
|
+
</svg>
|
|
419
|
+
</button>
|
|
420
|
+
{/if}
|
|
421
|
+
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type TabStripTab = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** Shown in place of the close button until the pointer is on the tab: unsaved, or live. */
|
|
8
|
+
mark?: 'unsaved' | 'live' | undefined;
|
|
9
|
+
};
|
|
10
|
+
export type TabStripProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onclose'> & {
|
|
11
|
+
tabs: TabStripTab[];
|
|
12
|
+
/** The id of the open tab. Bindable. */
|
|
13
|
+
value?: string | undefined;
|
|
14
|
+
/** Names the strip: "Open threads". */
|
|
15
|
+
label: string;
|
|
16
|
+
/** The id of the panel the tabs show. */
|
|
17
|
+
controls?: string | undefined;
|
|
18
|
+
/** Called to close a tab. Without it the tabs cannot be closed. */
|
|
19
|
+
onclose?: ((id: string) => void) | undefined;
|
|
20
|
+
/** Called to add one. Without it there is no button to add. */
|
|
21
|
+
onadd?: (() => void) | undefined;
|
|
22
|
+
addLabel?: string | undefined;
|
|
23
|
+
/** The name of a tab's close button. */
|
|
24
|
+
closeLabel?: ((tab: TabStripTab) => string) | undefined;
|
|
25
|
+
/** Before a tab's label: an icon, or a StatusIndicator. */
|
|
26
|
+
leading?: Snippet<[TabStripTab]> | undefined;
|
|
27
|
+
sx?: Sx | undefined;
|
|
28
|
+
};
|
|
29
|
+
declare const TabStrip: import("svelte").Component<TabStripProps, {}, "value">;
|
|
30
|
+
type TabStrip = ReturnType<typeof TabStrip>;
|
|
31
|
+
export default TabStrip;
|
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
+
import type { IconComponent } from '../../internal/icon.js';
|
|
2
3
|
import * as stylex from '@stylexjs/stylex';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
4
5
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
+
import '../../internal/icons.css';
|
|
7
|
+
import { groupTrigger } from '../../internal/tooltip-trigger.js';
|
|
8
|
+
import * as Tooltip from '../tooltip/index.js';
|
|
5
9
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
10
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
7
11
|
import { media } from '../../media.stylex.js';
|
|
8
12
|
|
|
9
|
-
export type TabItem = {
|
|
13
|
+
export type TabItem = {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
/** The tab in full, for a short label: a tooltip, and the tab's description. */
|
|
17
|
+
title?: string | undefined;
|
|
18
|
+
/** An icon before the label: a component, such as a Lucide icon, sized to fit. */
|
|
19
|
+
icon?: IconComponent | undefined;
|
|
20
|
+
count?: number | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
};
|
|
10
23
|
|
|
11
24
|
export type TabsProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
12
25
|
tabs: TabItem[];
|
|
13
26
|
/** The selected tab's value. Bindable. Defaults to the first tab. */
|
|
14
|
-
value?: string;
|
|
27
|
+
value?: string | undefined;
|
|
15
28
|
/** Accessible name for the row of tabs. */
|
|
16
29
|
label: string;
|
|
17
|
-
sx?: Sx;
|
|
30
|
+
sx?: Sx | undefined;
|
|
31
|
+
/** Styles for the row of tabs: its height and padding, to line it up with what is beside it. */
|
|
32
|
+
listSx?: Sx | undefined;
|
|
33
|
+
/** Styles for the panel under the tabs. */
|
|
34
|
+
panelSx?: Sx | undefined;
|
|
18
35
|
/** The panel for the selected tab. It receives the selected value. */
|
|
19
|
-
children?: Snippet<[string]
|
|
36
|
+
children?: Snippet<[string]> | undefined;
|
|
20
37
|
};
|
|
21
38
|
|
|
22
39
|
const styles = stylex.create({
|
|
@@ -30,23 +47,27 @@
|
|
|
30
47
|
gap: '1.25rem',
|
|
31
48
|
borderBottomWidth: '1px',
|
|
32
49
|
borderBottomStyle: 'solid',
|
|
33
|
-
borderBottomColor: colors.
|
|
50
|
+
borderBottomColor: colors.border
|
|
34
51
|
},
|
|
35
52
|
tab: {
|
|
53
|
+
'--narvi-icon-size': '0.875rem',
|
|
36
54
|
position: 'relative',
|
|
55
|
+
display: 'inline-flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
gap: '0.375rem',
|
|
37
58
|
flexShrink: 0,
|
|
38
59
|
minHeight: '2.125rem',
|
|
39
60
|
margin: 0,
|
|
40
61
|
padding: 0,
|
|
41
62
|
borderWidth: 0,
|
|
42
|
-
borderRadius: radius.
|
|
63
|
+
borderRadius: radius.chip,
|
|
43
64
|
backgroundColor: 'transparent',
|
|
44
65
|
color: {
|
|
45
66
|
default: colors.textMuted,
|
|
46
67
|
':hover': { default: null, [media.hover]: colors.text }
|
|
47
68
|
},
|
|
48
69
|
fontFamily: 'inherit',
|
|
49
|
-
fontSize: font.
|
|
70
|
+
fontSize: font.sizeBody,
|
|
50
71
|
fontWeight: font.weightMedium,
|
|
51
72
|
lineHeight: 1,
|
|
52
73
|
whiteSpace: 'nowrap',
|
|
@@ -71,16 +92,13 @@
|
|
|
71
92
|
bottom: '-1px',
|
|
72
93
|
height: '2px',
|
|
73
94
|
borderRadius: '2px',
|
|
74
|
-
backgroundColor: { default: colors.
|
|
75
|
-
boxShadow: `0 0 8px ${colors.glow}`,
|
|
95
|
+
backgroundColor: { default: colors.accent, [media.forcedColors]: 'Highlight' },
|
|
76
96
|
forcedColorAdjust: 'none'
|
|
77
97
|
}
|
|
78
98
|
},
|
|
79
99
|
count: {
|
|
80
|
-
marginInlineStart: '0.375rem',
|
|
81
100
|
color: colors.textSubtle,
|
|
82
|
-
|
|
83
|
-
fontSize: font.sizeXs,
|
|
101
|
+
fontSize: font.sizeCaption,
|
|
84
102
|
fontVariantNumeric: 'tabular-nums'
|
|
85
103
|
},
|
|
86
104
|
panel: {
|
|
@@ -99,6 +117,8 @@
|
|
|
99
117
|
value = $bindable(),
|
|
100
118
|
label,
|
|
101
119
|
sx,
|
|
120
|
+
listSx,
|
|
121
|
+
panelSx,
|
|
102
122
|
class: className,
|
|
103
123
|
children,
|
|
104
124
|
...rest
|
|
@@ -131,27 +151,57 @@
|
|
|
131
151
|
role="tablist"
|
|
132
152
|
aria-label={label}
|
|
133
153
|
{onkeydown}
|
|
134
|
-
{...
|
|
154
|
+
{...attrs([styles.list, listSx])}
|
|
135
155
|
>
|
|
136
|
-
{#
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
{#snippet items()}
|
|
157
|
+
{#each tabs as tab, at (tab.value)}
|
|
158
|
+
{@const active = tab.value === selected}
|
|
159
|
+
{@const titleId = tab.title ? `${uid}-title-${at}` : undefined}
|
|
160
|
+
{#snippet button(props: Record<string, unknown>)}
|
|
161
|
+
<button
|
|
162
|
+
{...props}
|
|
163
|
+
type="button"
|
|
164
|
+
role="tab"
|
|
165
|
+
id="{uid}-tab-{tab.value}"
|
|
166
|
+
data-value={tab.value}
|
|
167
|
+
data-icons
|
|
168
|
+
aria-selected={active}
|
|
169
|
+
aria-controls={children ? `${uid}-panel` : undefined}
|
|
170
|
+
aria-describedby={titleId}
|
|
171
|
+
tabindex={active ? 0 : -1}
|
|
172
|
+
disabled={tab.disabled}
|
|
173
|
+
onclick={(event) => {
|
|
174
|
+
(props.onclick as ((event: MouseEvent) => void) | undefined)?.(event);
|
|
175
|
+
value = tab.value;
|
|
176
|
+
}}
|
|
177
|
+
{...stylex.attrs(styles.tab, active && styles.selected)}
|
|
178
|
+
>
|
|
179
|
+
{#if tab.icon}<tab.icon
|
|
180
|
+
aria-hidden="true"
|
|
181
|
+
/>{/if}{tab.label}{#if tab.count !== undefined}<span {...stylex.attrs(styles.count)}
|
|
182
|
+
>{tab.count}</span
|
|
183
|
+
>{/if}
|
|
184
|
+
</button>
|
|
185
|
+
{/snippet}
|
|
186
|
+
{#if tab.title}
|
|
187
|
+
<Tooltip.Root>
|
|
188
|
+
<Tooltip.Trigger disabled={tab.disabled}>
|
|
189
|
+
{#snippet child({ props })}{@render button(groupTrigger(props))}{/snippet}
|
|
190
|
+
</Tooltip.Trigger>
|
|
191
|
+
<Tooltip.Content side="top">{tab.title}</Tooltip.Content>
|
|
192
|
+
</Tooltip.Root>
|
|
193
|
+
<!-- Always there to describe the tab, which the tooltip does only while open -->
|
|
194
|
+
<span id={titleId} hidden>{tab.title}</span>
|
|
195
|
+
{:else}
|
|
196
|
+
{@render button({})}
|
|
197
|
+
{/if}
|
|
198
|
+
{/each}
|
|
199
|
+
{/snippet}
|
|
200
|
+
{#if tabs.some((tab) => tab.title)}
|
|
201
|
+
<Tooltip.Provider delayDuration={400}>{@render items()}</Tooltip.Provider>
|
|
202
|
+
{:else}
|
|
203
|
+
{@render items()}
|
|
204
|
+
{/if}
|
|
155
205
|
</div>
|
|
156
206
|
{#if children && selected !== undefined}
|
|
157
207
|
<div
|
|
@@ -159,7 +209,7 @@
|
|
|
159
209
|
id="{uid}-panel"
|
|
160
210
|
aria-labelledby="{uid}-tab-{selected}"
|
|
161
211
|
tabindex="0"
|
|
162
|
-
{...
|
|
212
|
+
{...attrs([styles.panel, panelSx])}
|
|
163
213
|
>
|
|
164
214
|
{@render children(selected)}
|
|
165
215
|
</div>
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
+
import type { IconComponent } from '../../internal/icon.js';
|
|
1
2
|
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import '../../internal/icons.css';
|
|
3
5
|
import { type Sx } from '../../internal/sx.js';
|
|
4
6
|
export type TabItem = {
|
|
5
7
|
value: string;
|
|
6
8
|
label: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
/** The tab in full, for a short label: a tooltip, and the tab's description. */
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
/** An icon before the label: a component, such as a Lucide icon, sized to fit. */
|
|
12
|
+
icon?: IconComponent | undefined;
|
|
13
|
+
count?: number | undefined;
|
|
14
|
+
disabled?: boolean | undefined;
|
|
9
15
|
};
|
|
10
16
|
export type TabsProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
11
17
|
tabs: TabItem[];
|
|
12
18
|
/** The selected tab's value. Bindable. Defaults to the first tab. */
|
|
13
|
-
value?: string;
|
|
19
|
+
value?: string | undefined;
|
|
14
20
|
/** Accessible name for the row of tabs. */
|
|
15
21
|
label: string;
|
|
16
|
-
sx?: Sx;
|
|
22
|
+
sx?: Sx | undefined;
|
|
23
|
+
/** Styles for the row of tabs: its height and padding, to line it up with what is beside it. */
|
|
24
|
+
listSx?: Sx | undefined;
|
|
25
|
+
/** Styles for the panel under the tabs. */
|
|
26
|
+
panelSx?: Sx | undefined;
|
|
17
27
|
/** The panel for the selected tab. It receives the selected value. */
|
|
18
|
-
children?: Snippet<[string]
|
|
28
|
+
children?: Snippet<[string]> | undefined;
|
|
19
29
|
};
|
|
20
30
|
declare const Tabs: import("svelte").Component<TabsProps, {}, "value">;
|
|
21
31
|
type Tabs = ReturnType<typeof Tabs>;
|