@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,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup
|
|
3
|
+
description: >
|
|
4
|
+
Use when adding @diegopluna/narvi to a SvelteKit or Vite app, or when Narvi components render
|
|
5
|
+
unstyled, styles are missing in dev or production, stylex.create throws at runtime, or Narvi is
|
|
6
|
+
used alongside Tailwind CSS 4.
|
|
7
|
+
metadata:
|
|
8
|
+
purpose: >
|
|
9
|
+
Install Narvi in a Svelte 5 app so its StyleX styles compile and load in development and in
|
|
10
|
+
production, with the base stylesheet in place, and order its cascade layer around Tailwind CSS
|
|
11
|
+
4 when the app uses it.
|
|
12
|
+
type: lifecycle
|
|
13
|
+
library: '@diegopluna/narvi'
|
|
14
|
+
library_version: '0.3.0'
|
|
15
|
+
sources:
|
|
16
|
+
- src/lib/vite.ts
|
|
17
|
+
- src/lib/base.css
|
|
18
|
+
- src/lib/components/dev-styles/DevStyles.svelte
|
|
19
|
+
- src/routes/docs/installation/+page.svelte
|
|
20
|
+
- src/routes/docs/styling/+page.svelte
|
|
21
|
+
- src/lib/internal/loose.ts
|
|
22
|
+
- scripts/exact/consumer.ts
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Set up Narvi
|
|
26
|
+
|
|
27
|
+
Narvi is a Svelte 5 component library styled with StyleX. Its styles compile to atomic CSS at
|
|
28
|
+
build time. Nothing styles at runtime, so **a component renders unstyled unless the Vite plugin
|
|
29
|
+
and the stylesheet wiring below are in place**. It needs Svelte 5.20 or later and Vite 6 or later,
|
|
30
|
+
and its colours use CSS `light-dark()` (Chrome 123, Safari 17.5, Firefox 120 and later).
|
|
31
|
+
|
|
32
|
+
Narvi is below 1.0, so a minor release can change an API. Pin the version you build against.
|
|
33
|
+
|
|
34
|
+
## Setup
|
|
35
|
+
|
|
36
|
+
1. Install the package, with StyleX for your own styles:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
pnpm add @diegopluna/narvi @stylexjs/stylex@0.19.1
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`@stylexjs/stylex` is only needed to import it in your own files. Keep it at the version Narvi
|
|
43
|
+
depends on (`npm view @diegopluna/narvi dependencies` lists it).
|
|
44
|
+
|
|
45
|
+
2. Add the plugin **after** `sveltekit()` (or after `svelte()` in a plain Vite app):
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// vite.config.ts
|
|
49
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
50
|
+
import { narvi } from '@diegopluna/narvi/vite';
|
|
51
|
+
import { defineConfig } from 'vite';
|
|
52
|
+
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
plugins: [sveltekit(), narvi()]
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Leave the options `sveltekit()` is given as they are (SvelteKit 3 passes its adapter there).
|
|
59
|
+
The plugin also sets `build.cssTarget` to browsers that have `light-dark()` (Chrome and Edge
|
|
60
|
+
123, Firefox 120, Safari 17.5), so Vite does not rewrite it in the app's stylesheet. An app
|
|
61
|
+
that sets `build.cssTarget` itself keeps its own.
|
|
62
|
+
|
|
63
|
+
3. Load the styles. Mount `DevStyles` once in the root layout. It loads the dev server's
|
|
64
|
+
stylesheet and refreshes it on hot updates, and renders nothing in production. The root
|
|
65
|
+
layout must also import a stylesheet of your own, because in a production build the plugin
|
|
66
|
+
appends Narvi's CSS to a stylesheet the app already imports. A fresh SvelteKit app has no
|
|
67
|
+
`src/app.css`: create it.
|
|
68
|
+
|
|
69
|
+
```svelte
|
|
70
|
+
<!-- src/routes/+layout.svelte -->
|
|
71
|
+
<script lang="ts">
|
|
72
|
+
import '../app.css';
|
|
73
|
+
import { DevStyles } from '@diegopluna/narvi';
|
|
74
|
+
|
|
75
|
+
let { children } = $props();
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<DevStyles />
|
|
79
|
+
|
|
80
|
+
{@render children()}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
/* src/app.css */
|
|
85
|
+
@import '@diegopluna/narvi/base.css';
|
|
86
|
+
|
|
87
|
+
:root {
|
|
88
|
+
/* Narvi's interface text inherits the page's face. Set it on the root, not on a wrapper,
|
|
89
|
+
so menus and dialogs, which are placed at the end of the body, take it too. */
|
|
90
|
+
font-family:
|
|
91
|
+
ui-sans-serif,
|
|
92
|
+
system-ui,
|
|
93
|
+
-apple-system,
|
|
94
|
+
'Segoe UI',
|
|
95
|
+
sans-serif;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
In a plain Vite app there is no layout: import the stylesheet in `src/main.ts` (Vite's
|
|
100
|
+
template already does) and mount `<DevStyles />` once in `src/App.svelte`.
|
|
101
|
+
|
|
102
|
+
`base.css` sets `color-scheme: light dark` (which Narvi's colours follow) and paints the root in
|
|
103
|
+
the `bg` and `text` tokens. It also adds a small reset: border-box sizing; no margin on the body,
|
|
104
|
+
headings, paragraphs and figures; lists without markers; and media as blocks. It sits in the
|
|
105
|
+
`narvi.base` layer, below every component, and any rule of yours outside a layer beats both.
|
|
106
|
+
|
|
107
|
+
4. Use a component:
|
|
108
|
+
|
|
109
|
+
```svelte
|
|
110
|
+
<script lang="ts">
|
|
111
|
+
import { Button } from '@diegopluna/narvi';
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<Button variant="primary" onclick={() => alert('Mellon!')}>Speak, friend</Button>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
In SvelteKit 3 apps there is no `$lib` alias by default. Aliases come from `package.json`
|
|
118
|
+
`imports` (often `#lib`), so the samples in these skills use relative imports such as
|
|
119
|
+
`'../lib/ember'`. Use the app's own alias if it has one.
|
|
120
|
+
|
|
121
|
+
Large headings use a serif (`Cormorant Garamond`), and code uses `Geist Mono`. Both fall back to
|
|
122
|
+
system faces. To load them, install `@fontsource/cormorant-garamond` (or the
|
|
123
|
+
`@fontsource-variable/` build) and `@fontsource/geist-mono` and import them in the root layout.
|
|
124
|
+
Narvi lists both naming styles, so neither needs a theme override.
|
|
125
|
+
|
|
126
|
+
## TypeScript
|
|
127
|
+
|
|
128
|
+
Narvi's types work with `exactOptionalPropertyTypes`. Every optional prop takes `undefined`, so
|
|
129
|
+
`<Notice detail={maybe}>` and `<Tooltip.Content side={maybe}>` type-check as they are, with no
|
|
130
|
+
need to spread a prop only when it is set. That holds for the parts Narvi takes from bits-ui too.
|
|
131
|
+
|
|
132
|
+
## With Tailwind CSS 4
|
|
133
|
+
|
|
134
|
+
Out of the box, Narvi's layer comes after Tailwind's, so a utility such as `hidden` on a Button
|
|
135
|
+
changes nothing. Both of these changes are needed:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
// vite.config.ts
|
|
139
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
140
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
141
|
+
import { narvi } from '@diegopluna/narvi/vite';
|
|
142
|
+
import { defineConfig } from 'vite';
|
|
143
|
+
|
|
144
|
+
export default defineConfig({
|
|
145
|
+
plugins: [tailwindcss(), sveltekit(), narvi({ tailwind: true })]
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```css
|
|
150
|
+
/* src/app.css: the order line comes first, before any @import */
|
|
151
|
+
@layer theme, base, narvi, components, utilities;
|
|
152
|
+
@import 'tailwindcss';
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The browser fixes the layer order from whichever stylesheet it reads first, and in development
|
|
156
|
+
that can be either one, so the plugin option and the CSS line are both needed. Narvi still beats
|
|
157
|
+
Preflight. Utilities replace whole properties: `p-0` on a Card removes its padding, not a part of it.
|
|
158
|
+
|
|
159
|
+
## Common mistakes
|
|
160
|
+
|
|
161
|
+
- **HIGH: `narvi()` listed before `sveltekit()`.** The plugin must receive components that the
|
|
162
|
+
Svelte compiler has already processed. Put it last. The build stops with "narvi() is listed
|
|
163
|
+
before the Svelte plugin"; in 0.1.0 the same mistake reads `Unexpected token` from
|
|
164
|
+
`@stylexjs/unplugin` in every `.svelte` file.
|
|
165
|
+
- **HIGH: the plugin missing from `vite.config.ts`.** The dev server fails with
|
|
166
|
+
`Failed to resolve import "virtual:stylex:runtime"`, or the page throws
|
|
167
|
+
`Unexpected 'stylex.defineVars' call at runtime`. Add `narvi()`.
|
|
168
|
+
- **HIGH: no stylesheet imported by the app.** In production, Narvi's CSS is appended to a
|
|
169
|
+
stylesheet the app imports. With none, the built site has unstyled components while `pnpm dev`
|
|
170
|
+
looks fine. Import `app.css` (or any CSS file) from the root layout.
|
|
171
|
+
- **HIGH: `DevStyles` missing.** In development, components render with class names but no
|
|
172
|
+
CSS. Mount it once in the root layout, not per page.
|
|
173
|
+
- **HIGH: adding Narvi to `optimizeDeps.include`.** Narvi ships StyleX source that the plugin
|
|
174
|
+
compiles. When Vite pre-bundles it, the page receives raw `stylex.create` calls that throw at
|
|
175
|
+
runtime. The plugin already keeps Narvi out of pre-bundling, so leave `optimizeDeps` alone. If
|
|
176
|
+
another package of yours ships StyleX source, pass it as `narvi({ externalPackages: ['pkg'] })`.
|
|
177
|
+
- **MEDIUM: lowering `build.cssTarget` below the browsers above.** Vite then rewrites
|
|
178
|
+
`light-dark()` in `base.css` into custom properties that follow only a `color-scheme` written in
|
|
179
|
+
a stylesheet. One set from script (`document.documentElement.style.colorScheme = 'dark'`)
|
|
180
|
+
darkens the components and leaves the page light, in production only. Leave the target to the
|
|
181
|
+
plugin, or switch schemes with a rule such as `:root[data-theme='dark'] { color-scheme: dark }`.
|
|
182
|
+
- **MEDIUM: putting the font on a layout `<div>`.** Popups are placed at the end of `<body>`,
|
|
183
|
+
outside that div, and fall back to the system font. Set `font-family` on `:root`.
|
|
184
|
+
- **MEDIUM: theming `bg` or `text` without updating the root.** `base.css` paints the root with
|
|
185
|
+
copies of those tokens. If you override them, set `:root { background-color; color }` to match.
|
|
186
|
+
|
|
187
|
+
## Completion
|
|
188
|
+
|
|
189
|
+
- `pnpm dev`: a `<Button variant="primary">` shows as a flat dark button (light scheme) with
|
|
190
|
+
rounded corners, not as a browser default button.
|
|
191
|
+
- `pnpm build`: the built CSS contains Narvi's layer. In a SvelteKit app, run
|
|
192
|
+
`grep -rl "@layer narvi" .svelte-kit/output/client` (in a plain Vite app,
|
|
193
|
+
`grep -rl "@layer narvi" dist`) and confirm it lists a file. If it doesn't, check step 3.
|
|
194
|
+
- pnpm may warn of an unmet peer, `@sveltejs/kit`, wanted by `runed` (a dependency of bits-ui) in
|
|
195
|
+
a SvelteKit 3 app. It can be ignored.
|
|
196
|
+
- With Tailwind, `<Button class="hidden">` disappears.
|
|
197
|
+
|
|
198
|
+
Next: to restyle components or write your own StyleX, load the `styling` skill. For dark mode and
|
|
199
|
+
custom themes, load `theming`. For building screens from Narvi's parts, load `building-ui`.
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: styling
|
|
3
|
+
description: >
|
|
4
|
+
Use when restyling Narvi components or writing your own styles in an app that uses
|
|
5
|
+
@diegopluna/narvi: the sx prop, StyleX with Narvi's design tokens and media conditions, hover
|
|
6
|
+
groups, styling elements or third-party components, plain CSS overrides, and building app
|
|
7
|
+
components the way Narvi does.
|
|
8
|
+
metadata:
|
|
9
|
+
purpose: >
|
|
10
|
+
Style Narvi components and an app's own components with StyleX and Narvi's tokens, so the
|
|
11
|
+
styles compile, follow the theme, win over Narvi's defaults predictably, and keep working with
|
|
12
|
+
hover, motion and forced-colour preferences.
|
|
13
|
+
type: core
|
|
14
|
+
library: '@diegopluna/narvi'
|
|
15
|
+
library_version: '0.3.0'
|
|
16
|
+
requires:
|
|
17
|
+
- setup
|
|
18
|
+
sources:
|
|
19
|
+
- src/lib/internal/sx.ts
|
|
20
|
+
- src/lib/tokens.stylex.ts
|
|
21
|
+
- src/lib/media.stylex.ts
|
|
22
|
+
- src/lib/index.ts
|
|
23
|
+
- src/routes/docs/styling/+page.svelte
|
|
24
|
+
- src/lib/markers.stylex.ts
|
|
25
|
+
- src/lib/visually-hidden.ts
|
|
26
|
+
- src/lib/typography.ts
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# Style with Narvi
|
|
30
|
+
|
|
31
|
+
This assumes Narvi is installed and its styles load (see the `setup` skill). Prefer StyleX with
|
|
32
|
+
Narvi's tokens. Use plain CSS only for a one-off override or in an app that already uses Tailwind.
|
|
33
|
+
|
|
34
|
+
## Setup
|
|
35
|
+
|
|
36
|
+
Write styles in a `<script module>` block, so they are created once and not per instance. Take
|
|
37
|
+
values from the tokens and conditions from `media`:
|
|
38
|
+
|
|
39
|
+
```svelte
|
|
40
|
+
<script lang="ts" module>
|
|
41
|
+
import * as stylex from '@stylexjs/stylex';
|
|
42
|
+
import { colors, radius, space } from '@diegopluna/narvi/tokens.stylex.js';
|
|
43
|
+
|
|
44
|
+
const styles = stylex.create({
|
|
45
|
+
pill: { paddingInline: space.x4, borderRadius: radius.pill },
|
|
46
|
+
quiet: { backgroundColor: colors.fillSunken, color: colors.accent }
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
import { Button } from '@diegopluna/narvi';
|
|
52
|
+
let { quiet = false } = $props();
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<Button sx={[styles.pill, quiet && styles.quiet]}>Pill</Button>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Every Narvi component takes `sx`: one style, or a nested array of styles. `false`, `null` and
|
|
59
|
+
`undefined` are skipped. These styles merge after the component's own, so yours win one property
|
|
60
|
+
at a time. Every component also passes `class` through to its root element.
|
|
61
|
+
|
|
62
|
+
## Tokens
|
|
63
|
+
|
|
64
|
+
Import tokens from `@diegopluna/narvi/tokens.stylex.js`, and always from that exact path.
|
|
65
|
+
StyleX resolves them while it compiles, so a re-export from a file of your own (or from the
|
|
66
|
+
package root) breaks them.
|
|
67
|
+
|
|
68
|
+
- `colors`, named by family. Backgrounds, which are opaque: `bg`, `bgRaised`, `bgWindow` (behind
|
|
69
|
+
an app shell's sheet). Fills, which are translucent and go over any background: `fillHover`,
|
|
70
|
+
`fillSelected` (what is chosen or open now), `fillMuted` (a flat block) and `fillSunken` (a
|
|
71
|
+
well: code, a track, a tray). Borders: `border`, `borderStrong`,
|
|
72
|
+
`borderControl` (the boundary of a field and an off switch's track: 3:1 on the plain
|
|
73
|
+
surface it rests on, and no heavier), `borderControlHover`. Shade: `shadow` (the
|
|
74
|
+
one drop, under what floats over the page) and `scrim` (behind a dialog). Text: `text`,
|
|
75
|
+
`textMuted`, `textSubtle`. The accent, which marks state: `accent`, `accentVivid`, `onAccent`,
|
|
76
|
+
`accentSoft`, `focusRing`, `focusHalo`. Status: `success`, `warning`, `danger`, and their
|
|
77
|
+
`…Soft` (fills) and `…Text` (text on a soft fill) variants. Syntax: `codeKey`, `codeString`,
|
|
78
|
+
`codeNumber`, `codeLiteral`, `codePunct`. The primary button: `primary`, `onPrimary`. The
|
|
79
|
+
thumb of a switch or slider: `thumb`.
|
|
80
|
+
- `space`: a 4px scale from `x1` (4px) to `x16` (64px), with `x1_5` (6px) between an icon and
|
|
81
|
+
its words.
|
|
82
|
+
- `radius`, named for what takes it: `chip` (a key cap, a checkbox), `item` (a small control),
|
|
83
|
+
`control` (a button, a field, a row), `panel` (a notice, a sheet), `card` (a card, a popover),
|
|
84
|
+
`frame` and `pill`.
|
|
85
|
+
- `font`: `body` (inherits the page), `display` (the heading serif), `mono`; the weights
|
|
86
|
+
`weightRegular`, `weightMedium` and `weightSemibold`; the line heights `leadingTight`,
|
|
87
|
+
`leadingSnug` and `leadingNormal`; and sizes named for what they set: `sizeMicro` (11px),
|
|
88
|
+
`sizeCaption` (12), `sizeMeta` (13), `sizeBody` (14), `sizeReading` (16), `sizeTitle` (17)
|
|
89
|
+
and `sizeFigure` (28, a number that is the point of its place). Prefer a whole role to a
|
|
90
|
+
size: `import { typography } from '@diegopluna/narvi'` gives `figure`, `title`, `reading`,
|
|
91
|
+
`label`, `body`, `meta`, `caption` and `micro`, each a size, a weight and a line height, for
|
|
92
|
+
`stylex.attrs(typography.caption, styles.count)`.
|
|
93
|
+
- `visuallyHidden` (from the package root) hides an element from sight and keeps it for
|
|
94
|
+
assistive technology: `stylex.attrs(visuallyHidden)`. Don't write your own.
|
|
95
|
+
- `play.whileVisible`: the `animationPlayState` for an animation that never ends. Attach
|
|
96
|
+
`whileVisible` (from the package root) to its element and it runs only while it can be seen.
|
|
97
|
+
Step such an animation (`steps(30)` over two seconds) so it costs a few frames a second.
|
|
98
|
+
- `motion`: `fast` 120ms, `base` 150ms, `slow` 200ms; `easeOut` for feedback, `easeInOut` for
|
|
99
|
+
things that travel. Nothing in an interface takes longer than `motion.slow`.
|
|
100
|
+
- `pageMotion`: a slower scale for pages read as they scroll (`Reveal` uses it). Never use it
|
|
101
|
+
for controls.
|
|
102
|
+
|
|
103
|
+
Each colour holds a light and a dark value, so a style that uses tokens follows the scheme. A
|
|
104
|
+
hex value does not.
|
|
105
|
+
|
|
106
|
+
## Conditions
|
|
107
|
+
|
|
108
|
+
Use `media` from `@diegopluna/narvi/media.stylex.js` as keys inside `stylex.create`:
|
|
109
|
+
|
|
110
|
+
```svelte
|
|
111
|
+
<script lang="ts" module>
|
|
112
|
+
import * as stylex from '@stylexjs/stylex';
|
|
113
|
+
import { media } from '@diegopluna/narvi/media.stylex.js';
|
|
114
|
+
import { colors, motion, space } from '@diegopluna/narvi/tokens.stylex.js';
|
|
115
|
+
|
|
116
|
+
const styles = stylex.create({
|
|
117
|
+
nav: {
|
|
118
|
+
display: { default: 'none', [media.md]: 'flex' },
|
|
119
|
+
gap: { default: space.x4, [media.lg]: space.x8 }
|
|
120
|
+
},
|
|
121
|
+
link: {
|
|
122
|
+
color: { default: colors.textMuted, ':hover': { default: null, [media.hover]: colors.text } },
|
|
123
|
+
transitionProperty: 'color',
|
|
124
|
+
transitionDuration: { default: '0s', [media.motion]: motion.fast }
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
</script>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- `media.hover`: a precise pointer that can hover. Put every hover style behind it, so a tap never
|
|
131
|
+
leaves one stuck.
|
|
132
|
+
- `media.motion` and `media.reducedMotion`: put movement behind `motion`.
|
|
133
|
+
- `media.dark`, `media.forcedColors` and `media.coarse` (touch).
|
|
134
|
+
- `media.sm`, `md`, `lg` and `xl`: minimum widths of 640, 768, 1024 and 1280px, mobile first.
|
|
135
|
+
|
|
136
|
+
For layout, the `Stack` and `Grid` components take the same breakpoints in their props
|
|
137
|
+
(`gap={{ default: 2, md: 4 }}`), so you often don't need a style at all.
|
|
138
|
+
|
|
139
|
+
## Core patterns
|
|
140
|
+
|
|
141
|
+
### Style an element, or a component that takes only a class
|
|
142
|
+
|
|
143
|
+
`sx()` resolves styles to `class` and `style` attributes to spread. `classes()` resolves them to
|
|
144
|
+
one class string. Both are exported from `@diegopluna/narvi`:
|
|
145
|
+
|
|
146
|
+
```svelte
|
|
147
|
+
<script lang="ts">
|
|
148
|
+
import { classes, sx } from '@diegopluna/narvi';
|
|
149
|
+
import Logo from 'some-icon-library/Logo.svelte';
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<svg {...sx(styles.mark, active && styles.lit)}>…</svg>
|
|
153
|
+
<Logo class={classes(styles.mark)} />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`classes()` drops the inline `style` that dynamic styles (`stylex.create` functions) set, so use
|
|
157
|
+
`sx()` for those.
|
|
158
|
+
|
|
159
|
+
### Hover groups
|
|
160
|
+
|
|
161
|
+
Mark the ancestor with `stylex.defaultMarker()` and style the descendant with
|
|
162
|
+
`stylex.when.ancestor(':hover')`. A component's `sx` takes markers beside styles:
|
|
163
|
+
|
|
164
|
+
```svelte
|
|
165
|
+
<script lang="ts" module>
|
|
166
|
+
import * as stylex from '@stylexjs/stylex';
|
|
167
|
+
import { media } from '@diegopluna/narvi/media.stylex.js';
|
|
168
|
+
import { colors } from '@diegopluna/narvi/tokens.stylex.js';
|
|
169
|
+
|
|
170
|
+
const styles = stylex.create({
|
|
171
|
+
arrow: {
|
|
172
|
+
color: {
|
|
173
|
+
default: colors.textMuted,
|
|
174
|
+
[stylex.when.ancestor(':hover')]: { default: null, [media.hover]: colors.accent }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<script lang="ts">
|
|
181
|
+
import { Card, sx } from '@diegopluna/narvi';
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<Card href="/download" variant="outlined" sx={stylex.defaultMarker()}>
|
|
185
|
+
Download <span aria-hidden="true" {...sx(styles.arrow)}>→</span>
|
|
186
|
+
</Card>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`when.ancestor` matches any marked ancestor. For a group nested in another (a row with its own
|
|
190
|
+
hover actions inside a card that has some), give each group a marker of its own, defined in a
|
|
191
|
+
`.stylex.ts` file, and pass it to both the ancestor and `when.ancestor`:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
// src/lib/markers.stylex.ts
|
|
195
|
+
import * as stylex from '@stylexjs/stylex';
|
|
196
|
+
|
|
197
|
+
export const rowMarker = stylex.defineMarker();
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```svelte
|
|
201
|
+
<script lang="ts" module>
|
|
202
|
+
import * as stylex from '@stylexjs/stylex';
|
|
203
|
+
import { media } from '@diegopluna/narvi/media.stylex.js';
|
|
204
|
+
import { rowMarker } from '../markers.stylex';
|
|
205
|
+
|
|
206
|
+
const styles = stylex.create({
|
|
207
|
+
actions: {
|
|
208
|
+
opacity: {
|
|
209
|
+
default: 0,
|
|
210
|
+
[stylex.when.ancestor(':hover', rowMarker)]: { default: null, [media.hover]: 1 },
|
|
211
|
+
[stylex.when.ancestor(':focus-within', rowMarker)]: 1
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
</script>
|
|
216
|
+
|
|
217
|
+
<li {...stylex.attrs(rowMarker)}>
|
|
218
|
+
Deploy key <span {...stylex.attrs(styles.actions)}>…</span>
|
|
219
|
+
</li>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Narvi's own parts carry markers of their own, so they never answer to yours. A Reveal's is
|
|
223
|
+
exported for styles that follow it: `revealMarker` from `@diegopluna/narvi/markers.stylex.js`,
|
|
224
|
+
with `[stylex.when.ancestor('[data-reveal=shown]', revealMarker)]`.
|
|
225
|
+
|
|
226
|
+
### Give tokens other names
|
|
227
|
+
|
|
228
|
+
A style can set custom properties, which is useful when another library reads its own variable names:
|
|
229
|
+
|
|
230
|
+
```svelte
|
|
231
|
+
<script lang="ts" module>
|
|
232
|
+
import * as stylex from '@stylexjs/stylex';
|
|
233
|
+
import { colors } from '@diegopluna/narvi/tokens.stylex.js';
|
|
234
|
+
const styles = stylex.create({
|
|
235
|
+
aliases: { '--primary': colors.accent, '--background': colors.bg }
|
|
236
|
+
});
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<script lang="ts">
|
|
240
|
+
import { Theme } from '@diegopluna/narvi';
|
|
241
|
+
let { children } = $props();
|
|
242
|
+
</script>
|
|
243
|
+
|
|
244
|
+
<Theme sx={styles.aliases}>{@render children()}</Theme>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Plain CSS
|
|
248
|
+
|
|
249
|
+
All of Narvi's CSS is in one cascade layer, `narvi`. Any rule outside a layer beats it,
|
|
250
|
+
whatever its specificity, so a single class works: `<Button class="sunset">` with
|
|
251
|
+
`:global(.sunset) { … }`. For Tailwind, see the `setup` skill.
|
|
252
|
+
|
|
253
|
+
### Your own components
|
|
254
|
+
|
|
255
|
+
Build them the way Narvi does: styles in the module script, applied with `stylex.attrs` (or
|
|
256
|
+
`sx()`). Take `sx` and `class` props and merge them last, so callers can restyle your component too:
|
|
257
|
+
|
|
258
|
+
```svelte
|
|
259
|
+
<!-- Panel.svelte -->
|
|
260
|
+
<script lang="ts" module>
|
|
261
|
+
import * as stylex from '@stylexjs/stylex';
|
|
262
|
+
import type { Snippet } from 'svelte';
|
|
263
|
+
import type { Sx } from '@diegopluna/narvi';
|
|
264
|
+
import { colors, radius, space } from '@diegopluna/narvi/tokens.stylex.js';
|
|
265
|
+
|
|
266
|
+
export type PanelProps = { sx?: Sx; class?: string; children: Snippet };
|
|
267
|
+
|
|
268
|
+
const styles = stylex.create({
|
|
269
|
+
panel: {
|
|
270
|
+
padding: space.x4,
|
|
271
|
+
borderRadius: radius.panel,
|
|
272
|
+
backgroundColor: colors.bgRaised,
|
|
273
|
+
color: colors.text
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
</script>
|
|
277
|
+
|
|
278
|
+
<script lang="ts">
|
|
279
|
+
import { sx as toAttrs } from '@diegopluna/narvi';
|
|
280
|
+
|
|
281
|
+
let { sx, class: className, children }: PanelProps = $props();
|
|
282
|
+
const attrs = $derived(toAttrs(styles.panel, sx));
|
|
283
|
+
</script>
|
|
284
|
+
|
|
285
|
+
<div class={[attrs.class, className]} style={attrs.style}>{@render children()}</div>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Common mistakes
|
|
289
|
+
|
|
290
|
+
- **HIGH: tokens imported through a re-export.** `import { colors } from '../lib/theme'` (a file
|
|
291
|
+
that re-exports them) fails the build with "Could not resolve the path to the imported file", and
|
|
292
|
+
the package root doesn't export them at all. Import from
|
|
293
|
+
`@diegopluna/narvi/tokens.stylex.js` and `@diegopluna/narvi/media.stylex.js` directly.
|
|
294
|
+
- **HIGH: `defineVars`, `defineConsts` or `defineMarker` outside a `.stylex.ts` file.** StyleX
|
|
295
|
+
requires these in files named `*.stylex.ts` (or `.js`), exported by name.
|
|
296
|
+
- **HIGH: `stylex.when.*` (or another `stylex.` call) kept in a variable outside `stylex.create`.**
|
|
297
|
+
`const hovered = stylex.when.ancestor(':hover', marker)` builds without a warning: StyleX
|
|
298
|
+
evaluates the variable where `stylex.create` uses it, but leaves the line itself in the output,
|
|
299
|
+
and there it throws "Unexpected 'stylex.when.ancestor' call at runtime" as soon as the module
|
|
300
|
+
loads, which may be only when the screen that imports it opens. Write the call inline, as the
|
|
301
|
+
key: `[stylex.when.ancestor(':hover', marker)]: 1`. A plain string kept in a variable
|
|
302
|
+
(`const HOVER = ':is(:hover, [data-open])'`) is fine.
|
|
303
|
+
- **MEDIUM: styles created in the instance `<script>`.** It compiles, but the styles are
|
|
304
|
+
created again for every instance. Put `stylex.create` in a `<script module>` block.
|
|
305
|
+
- **MEDIUM: a raw `@media` string mixed with `media` constants on one property.** StyleX ranks a
|
|
306
|
+
constant above a written-out query, so the cascade order goes wrong. Use the constants throughout.
|
|
307
|
+
- **MEDIUM: hover without `media.hover`, or a transition without `media.motion`.** The hover
|
|
308
|
+
sticks after a tap, and the motion ignores reduced-motion settings.
|
|
309
|
+
- **MEDIUM: drawing an edge with `border` on a Narvi surface.** Narvi draws edges with
|
|
310
|
+
`box-shadow` (`inset 0 0 0 1px colors.border`). A border changes the size and doesn't match.
|
|
311
|
+
For something new that must stay visible in forced-colours mode, add a transparent `outline`
|
|
312
|
+
of 1px, which turns into the edge there.
|
|
313
|
+
- **MEDIUM: a Tailwind utility seen as "adjusting".** Utilities replace the whole property.
|
|
314
|
+
|
|
315
|
+
## Completion
|
|
316
|
+
|
|
317
|
+
The styled element shows the new value in the browser's computed styles, in both the light and
|
|
318
|
+
the dark scheme. A hover style does not apply on a touch emulator, and `pnpm build` passes.
|