@diegopluna/narvi 0.0.2 → 0.2.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 +116 -44
- package/dist/base.css +96 -0
- package/dist/color.d.ts +1 -1
- package/dist/color.js +1 -1
- package/dist/components/activity/ActivityContent.svelte +3 -15
- package/dist/components/activity/ActivityStep.svelte +12 -12
- package/dist/components/activity/ActivityThought.svelte +4 -4
- package/dist/components/activity/ActivityTrigger.svelte +5 -6
- 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 +17 -17
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +2 -2
- package/dist/components/app-shell/AppShellMain.svelte +4 -20
- package/dist/components/app-shell/AppShellPanel.svelte +21 -19
- 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 +50 -24
- package/dist/components/app-shell/AppShellRoot.svelte.d.ts +8 -6
- 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 +41 -65
- package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +1 -5
- package/dist/components/app-shell/AppShellToggle.svelte +62 -23
- package/dist/components/app-shell/AppShellToggle.svelte.d.ts +2 -0
- 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 +99 -23
- package/dist/components/approval/Approval.svelte.d.ts +7 -0
- package/dist/components/avatar/AvatarFallback.svelte +1 -2
- package/dist/components/avatar/AvatarRoot.svelte +2 -2
- package/dist/components/badge/Badge.svelte +5 -5
- package/dist/components/button/Button.svelte +227 -51
- package/dist/components/button/Button.svelte.d.ts +38 -2
- package/dist/components/card/Card.svelte +19 -33
- package/dist/components/change-stats/ChangeStats.svelte +1 -2
- package/dist/components/changes-summary/ChangesSummary.svelte +14 -15
- package/dist/components/checkbox/Checkbox.svelte +31 -25
- package/dist/components/checkbox/Checkbox.svelte.d.ts +5 -0
- package/dist/components/code/Code.svelte +1 -2
- package/dist/components/collapsible/CollapsibleContent.svelte +38 -0
- package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +11 -0
- package/dist/components/collapsible/CollapsibleRoot.svelte +44 -0
- package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +11 -0
- package/dist/components/collapsible/CollapsibleTrigger.svelte +83 -0
- package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +13 -0
- package/dist/components/collapsible/context.d.ts +5 -0
- package/dist/components/collapsible/context.js +11 -0
- package/dist/components/collapsible/index.d.ts +7 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/command/CommandItem.svelte +1 -1
- package/dist/components/command/styles.d.ts +3 -2
- package/dist/components/command/styles.js +15 -12
- package/dist/components/composer/ComposerAttachButton.svelte +1 -1
- package/dist/components/composer/ComposerAttachment.svelte +13 -18
- package/dist/components/composer/ComposerModelPicker.svelte +24 -28
- package/dist/components/composer/ComposerRoot.svelte +15 -13
- package/dist/components/composer/ComposerSubmit.svelte +12 -20
- package/dist/components/composer/ComposerTextarea.svelte +1 -1
- package/dist/components/composer/ComposerToggle.svelte +16 -18
- 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 +3 -2
- package/dist/components/conversation/ConversationEmpty.svelte +1 -1
- package/dist/components/conversation/ConversationScrollButton.svelte +9 -11
- package/dist/components/dialog/ConfirmDialog.svelte +1 -1
- package/dist/components/dialog/DialogContent.svelte +5 -1
- package/dist/components/dialog/styles.d.ts +2 -26
- package/dist/components/dialog/styles.js +12 -49
- package/dist/components/divider/Divider.svelte +3 -3
- package/dist/components/empty-state/EmptyState.svelte +4 -5
- package/dist/components/field/Field.svelte +4 -4
- package/dist/components/frame/Frame.svelte +6 -7
- package/dist/components/frame/Frame.svelte.d.ts +1 -1
- package/dist/components/grid/Grid.svelte +111 -0
- package/dist/components/grid/Grid.svelte.d.ts +27 -0
- package/dist/components/heading/Heading.svelte +2 -2
- package/dist/components/hover-card/HoverCardContent.svelte +50 -0
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +10 -0
- package/dist/components/hover-card/HoverCardRoot.svelte +22 -0
- package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -0
- package/dist/components/hover-card/index.d.ts +7 -0
- package/dist/components/hover-card/index.js +7 -0
- package/dist/components/kbd/Kbd.svelte +12 -7
- package/dist/components/link/Link.svelte +9 -7
- package/dist/components/link/Link.svelte.d.ts +4 -1
- 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 +134 -0
- package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte +61 -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 +265 -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 +328 -0
- package/dist/components/markdown/styles.js +302 -0
- package/dist/components/menu/MenuRadioItem.svelte +3 -3
- package/dist/components/menu/index.d.ts +23 -0
- package/dist/components/menu/index.js +3 -1
- package/dist/components/message/MessageAction.svelte +24 -5
- package/dist/components/message/MessageAction.svelte.d.ts +9 -0
- package/dist/components/message/MessageActions.svelte +2 -3
- package/dist/components/message/MessageContent.svelte +2 -3
- package/dist/components/message/MessageCopy.svelte +66 -8
- package/dist/components/message/MessageCopy.svelte.d.ts +17 -1
- package/dist/components/message/MessageHeader.svelte +3 -3
- package/dist/components/message/MessagePending.svelte +1 -1
- package/dist/components/message/MessageRoot.svelte +3 -4
- package/dist/components/message/MessageTime.svelte +3 -4
- package/dist/components/notice/Notice.svelte +14 -10
- package/dist/components/plan/Plan.svelte +25 -21
- package/dist/components/progress/Progress.svelte +34 -38
- package/dist/components/questionnaire/Questionnaire.svelte +19 -22
- package/dist/components/queued-message/QueuedMessage.svelte +14 -7
- package/dist/components/rail/RailItem.svelte +43 -40
- package/dist/components/rail/RailItem.svelte.d.ts +3 -1
- package/dist/components/rail/RailRoot.svelte +18 -4
- package/dist/components/rail/RailRoot.svelte.d.ts +1 -1
- 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 +4 -8
- package/dist/components/reasoning/ReasoningTrigger.svelte +4 -5
- package/dist/components/resize-handle/ResizeHandle.svelte +4 -7
- package/dist/components/reveal/Reveal.svelte +89 -0
- package/dist/components/reveal/Reveal.svelte.d.ts +17 -0
- package/dist/components/reveal/revealed.d.ts +38 -0
- package/dist/components/reveal/revealed.js +79 -0
- package/dist/components/segmented/SegmentedControl.svelte +11 -16
- package/dist/components/select/Select.svelte +1 -1
- package/dist/components/separator/Separator.svelte +1 -1
- package/dist/components/settings-row/SettingsRow.svelte +5 -5
- package/dist/components/sheet/SheetContent.svelte +63 -0
- package/dist/components/sheet/SheetContent.svelte.d.ts +18 -0
- package/dist/components/sheet/index.d.ts +12 -0
- package/dist/components/sheet/index.js +12 -0
- package/dist/components/sheet/styles.d.ts +51 -0
- package/dist/components/sheet/styles.js +65 -0
- package/dist/components/shimmer/Shimmer.svelte +41 -26
- package/dist/components/sidebar/SidebarContent.svelte +1 -1
- package/dist/components/sidebar/SidebarFolder.svelte +142 -0
- package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
- package/dist/components/sidebar/SidebarFooter.svelte +1 -1
- package/dist/components/sidebar/SidebarGroup.svelte +41 -35
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +3 -3
- package/dist/components/sidebar/SidebarHeader.svelte +12 -6
- package/dist/components/sidebar/SidebarHeader.svelte.d.ts +4 -1
- package/dist/components/sidebar/SidebarItem.svelte +34 -38
- package/dist/components/sidebar/SidebarRoot.svelte +62 -0
- package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
- package/dist/components/sidebar/index.d.ts +5 -1
- package/dist/components/sidebar/index.js +3 -1
- package/dist/components/skeleton/Skeleton.svelte +26 -15
- package/dist/components/slider/Slider.svelte +200 -0
- package/dist/components/slider/Slider.svelte.d.ts +55 -0
- package/dist/components/spinner/Spinner.svelte +4 -11
- package/dist/components/stack/Stack.svelte +37 -44
- package/dist/components/stack/Stack.svelte.d.ts +12 -6
- package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
- package/dist/components/suggestions/SuggestionsItem.svelte +11 -13
- package/dist/components/switch/Switch.svelte +16 -25
- package/dist/components/tab-strip/TabStrip.svelte +340 -0
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
- package/dist/components/tabs/Tabs.svelte +15 -14
- package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
- package/dist/components/text/Text.svelte +64 -14
- package/dist/components/text/Text.svelte.d.ts +13 -3
- package/dist/components/toast/Toaster.svelte +12 -10
- package/dist/components/toggle/Toggle.svelte +40 -0
- package/dist/components/toggle/Toggle.svelte.d.ts +15 -0
- package/dist/components/toggle-group/ToggleGroupItem.svelte +37 -0
- package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +12 -0
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +95 -0
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +33 -0
- package/dist/components/toggle-group/context.d.ts +6 -0
- package/dist/components/toggle-group/context.js +11 -0
- package/dist/components/toggle-group/index.d.ts +5 -0
- package/dist/components/toggle-group/index.js +3 -0
- package/dist/components/tool/ToolContent.svelte +3 -8
- package/dist/components/tool/ToolSection.svelte +4 -5
- package/dist/components/tool/ToolTrigger.svelte +14 -15
- package/dist/components/tooltip/TooltipContent.svelte +9 -6
- package/dist/components/work-fold/WorkFold.svelte +17 -34
- package/dist/components/work-fold/WorkFold.svelte.d.ts +1 -1
- package/dist/index.d.ts +38 -10
- package/dist/index.js +38 -12
- package/dist/internal/Chevron.svelte +2 -3
- package/dist/internal/Code.svelte +3 -4
- package/dist/internal/Collapse.svelte +6 -5
- package/dist/internal/Collapse.svelte.d.ts +2 -1
- package/dist/internal/Glyph.svelte +16 -0
- package/dist/internal/Glyph.svelte.d.ts +6 -0
- package/dist/internal/Tile.svelte +17 -37
- package/dist/internal/control.d.ts +4 -4
- package/dist/internal/control.js +21 -18
- package/dist/internal/layer.d.ts +3 -5
- package/dist/internal/layer.js +14 -18
- package/dist/internal/layout.d.ts +13 -0
- package/dist/internal/layout.js +453 -0
- package/dist/internal/markers.stylex.d.ts +8 -0
- package/dist/internal/markers.stylex.js +4 -0
- package/dist/internal/plugin-order.d.ts +8 -0
- package/dist/internal/plugin-order.js +16 -0
- package/dist/internal/responsive.d.ts +45 -0
- package/dist/internal/responsive.js +42 -0
- 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 +31 -4
- package/dist/internal/sx.js +17 -0
- package/dist/internal/toggle.d.ts +73 -0
- package/dist/internal/toggle.js +83 -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 +177 -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 +23 -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 +178 -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/media.stylex.d.ts +52 -0
- package/dist/media.stylex.js +53 -0
- package/dist/preset.d.ts +40 -16
- package/dist/preset.js +169 -51
- package/dist/tokens.stylex.d.ts +70 -37
- package/dist/tokens.stylex.js +127 -62
- package/dist/typography.d.ts +48 -0
- package/dist/typography.js +55 -0
- package/dist/vite.d.ts +9 -1
- package/dist/vite.js +37 -4
- package/package.json +58 -6
- package/skills/building-ui/SKILL.md +242 -0
- package/skills/building-ui/references/components.md +207 -0
- package/skills/markdown/SKILL.md +452 -0
- package/skills/markdown/references/plugins.md +103 -0
- package/skills/setup/SKILL.md +191 -0
- package/skills/styling/SKILL.md +269 -0
- package/skills/theming/SKILL.md +184 -0
- package/dist/internal/loop.d.ts +0 -35
- package/dist/internal/loop.js +0 -72
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A row that holds other rows: a project and its threads. It folds, and its rows
|
|
3
|
+
are set in under it. It is a row in the list like any other, so the arrow keys
|
|
4
|
+
pass through it; the right arrow opens it and the left one shuts it.
|
|
5
|
+
-->
|
|
6
|
+
<script lang="ts" module>
|
|
7
|
+
import * as stylex from '@stylexjs/stylex';
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
10
|
+
import Chevron from '../../internal/Chevron.svelte';
|
|
11
|
+
import Collapse from '../../internal/Collapse.svelte';
|
|
12
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
13
|
+
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
14
|
+
import { media } from '../../media.stylex.js';
|
|
15
|
+
|
|
16
|
+
export type SidebarFolderProps = Omit<HTMLAttributes<HTMLLIElement>, 'children'> & {
|
|
17
|
+
/** Its name: a project. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Whether its rows show. Bindable. */
|
|
20
|
+
open?: boolean;
|
|
21
|
+
/** Before the name: a mark for the project. */
|
|
22
|
+
leading?: Snippet;
|
|
23
|
+
/** At the end of the row: a count. */
|
|
24
|
+
trailing?: Snippet;
|
|
25
|
+
sx?: Sx;
|
|
26
|
+
/** Sidebar.Item rows. */
|
|
27
|
+
children?: Snippet;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const styles = stylex.create({
|
|
31
|
+
folder: { position: 'relative', listStyleType: 'none' },
|
|
32
|
+
row: {
|
|
33
|
+
boxSizing: 'border-box',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
gap: '0.5rem',
|
|
37
|
+
width: '100%',
|
|
38
|
+
margin: 0,
|
|
39
|
+
paddingBlock: '0.375rem',
|
|
40
|
+
// The same as Sidebar.Item, so a folder's mark and a row's icon share one edge
|
|
41
|
+
paddingInline: '0.5rem',
|
|
42
|
+
borderWidth: 0,
|
|
43
|
+
borderRadius: radius.control,
|
|
44
|
+
backgroundColor: {
|
|
45
|
+
default: 'transparent',
|
|
46
|
+
':hover': { default: null, [media.hover]: colors.fillHover }
|
|
47
|
+
},
|
|
48
|
+
color: colors.text,
|
|
49
|
+
fontFamily: 'inherit',
|
|
50
|
+
fontSize: font.sizeMeta,
|
|
51
|
+
fontWeight: font.weightMedium,
|
|
52
|
+
lineHeight: '1.125rem',
|
|
53
|
+
textAlign: 'start',
|
|
54
|
+
cursor: 'pointer',
|
|
55
|
+
WebkitTapHighlightColor: 'transparent',
|
|
56
|
+
WebkitAppRegion: 'no-drag',
|
|
57
|
+
outlineStyle: 'solid',
|
|
58
|
+
outlineWidth: { default: 0, ':focus-visible': '2px', [media.forcedColors]: '1px' },
|
|
59
|
+
outlineColor: { default: 'transparent', ':focus-visible': colors.focusRing },
|
|
60
|
+
outlineOffset: '-2px',
|
|
61
|
+
transitionProperty: 'background-color',
|
|
62
|
+
transitionDuration: motion.fast,
|
|
63
|
+
transitionTimingFunction: 'ease'
|
|
64
|
+
},
|
|
65
|
+
// After the name, as in Sidebar.Group, and pulled a little closer to it
|
|
66
|
+
chevron: {
|
|
67
|
+
display: 'grid',
|
|
68
|
+
flexShrink: 0,
|
|
69
|
+
marginInlineStart: '-0.25rem',
|
|
70
|
+
color: colors.textSubtle
|
|
71
|
+
},
|
|
72
|
+
lead: { display: 'grid', placeItems: 'center', flexShrink: 0, width: '1rem' },
|
|
73
|
+
grow: { flexGrow: 1 },
|
|
74
|
+
label: {
|
|
75
|
+
minWidth: 0,
|
|
76
|
+
overflow: 'hidden',
|
|
77
|
+
textOverflow: 'ellipsis',
|
|
78
|
+
whiteSpace: 'nowrap'
|
|
79
|
+
},
|
|
80
|
+
trail: {
|
|
81
|
+
flexShrink: 0,
|
|
82
|
+
color: colors.textSubtle,
|
|
83
|
+
fontSize: font.sizeCaption,
|
|
84
|
+
fontWeight: font.weightRegular,
|
|
85
|
+
fontVariantNumeric: 'tabular-nums'
|
|
86
|
+
},
|
|
87
|
+
// The rows are set in, to where the folder's name starts
|
|
88
|
+
list: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
flexDirection: 'column',
|
|
91
|
+
gap: '1px',
|
|
92
|
+
margin: 0,
|
|
93
|
+
padding: 0,
|
|
94
|
+
paddingTop: '1px',
|
|
95
|
+
paddingBottom: '0.25rem',
|
|
96
|
+
paddingInlineStart: '1rem',
|
|
97
|
+
listStyleType: 'none'
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<script lang="ts">
|
|
103
|
+
let {
|
|
104
|
+
label,
|
|
105
|
+
open = $bindable(true),
|
|
106
|
+
leading,
|
|
107
|
+
trailing,
|
|
108
|
+
sx,
|
|
109
|
+
class: className,
|
|
110
|
+
children,
|
|
111
|
+
...rest
|
|
112
|
+
}: SidebarFolderProps = $props();
|
|
113
|
+
|
|
114
|
+
const uid = $props.id();
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<li data-slot="sidebar-folder" {...rest} {...attrs([styles.folder, sx], className)}>
|
|
118
|
+
<button
|
|
119
|
+
type="button"
|
|
120
|
+
data-sidebar-row
|
|
121
|
+
aria-expanded={open}
|
|
122
|
+
aria-controls="{uid}-rows"
|
|
123
|
+
{...stylex.attrs(styles.row)}
|
|
124
|
+
onclick={() => (open = !open)}
|
|
125
|
+
onkeydown={(event) => {
|
|
126
|
+
const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';
|
|
127
|
+
if (event.key === (rtl ? 'ArrowLeft' : 'ArrowRight') && !open) open = true;
|
|
128
|
+
else if (event.key === (rtl ? 'ArrowRight' : 'ArrowLeft') && open) open = false;
|
|
129
|
+
else return;
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{#if leading}<span {...stylex.attrs(styles.lead)}>{@render leading()}</span>{/if}
|
|
134
|
+
<span {...stylex.attrs(styles.label)}>{label}</span>
|
|
135
|
+
<span {...stylex.attrs(styles.chevron)}><Chevron {open} size={12} /></span>
|
|
136
|
+
<span {...stylex.attrs(styles.grow)}></span>
|
|
137
|
+
{#if trailing}<span {...stylex.attrs(styles.trail)}>{@render trailing()}</span>{/if}
|
|
138
|
+
</button>
|
|
139
|
+
<Collapse {open} id="{uid}-rows">
|
|
140
|
+
<ul aria-label={label} {...stylex.attrs(styles.list)}>{@render children?.()}</ul>
|
|
141
|
+
</Collapse>
|
|
142
|
+
</li>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type SidebarFolderProps = Omit<HTMLAttributes<HTMLLIElement>, 'children'> & {
|
|
5
|
+
/** Its name: a project. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Whether its rows show. Bindable. */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/** Before the name: a mark for the project. */
|
|
10
|
+
leading?: Snippet;
|
|
11
|
+
/** At the end of the row: a count. */
|
|
12
|
+
trailing?: Snippet;
|
|
13
|
+
sx?: Sx;
|
|
14
|
+
/** Sidebar.Item rows. */
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
};
|
|
17
|
+
declare const SidebarFolder: import("svelte").Component<SidebarFolderProps, {}, "open">;
|
|
18
|
+
type SidebarFolder = ReturnType<typeof SidebarFolder>;
|
|
19
|
+
export default SidebarFolder;
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
import Collapse from '../../internal/Collapse.svelte';
|
|
7
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
8
8
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
9
|
+
import { media } from '../../media.stylex.js';
|
|
9
10
|
|
|
10
11
|
export type SidebarGroupProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
11
|
-
/** The group's name:
|
|
12
|
-
label
|
|
12
|
+
/** The group's name: "Projects", or "Today". Without one, the rows stand alone; name the group with `aria-label`. */
|
|
13
|
+
label?: string;
|
|
13
14
|
/** Lets the person fold the group away. */
|
|
14
15
|
collapsible?: boolean;
|
|
15
16
|
/** Whether a collapsible group is open. Bindable. */
|
|
@@ -17,14 +18,14 @@
|
|
|
17
18
|
/** Controls at the end of the label, such as a button to add an item. */
|
|
18
19
|
actions?: Snippet;
|
|
19
20
|
sx?: Sx;
|
|
20
|
-
/** Sidebar.Item rows. */
|
|
21
|
+
/** Sidebar.Item and Sidebar.Folder rows. */
|
|
21
22
|
children?: Snippet;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
25
|
-
|
|
26
25
|
const styles = stylex.create({
|
|
27
26
|
group: { display: 'flex', flexDirection: 'column', paddingTop: '0.75rem' },
|
|
27
|
+
// Rows with no label over them start closer to what is above
|
|
28
|
+
bare: { paddingTop: '0.375rem' },
|
|
28
29
|
head: {
|
|
29
30
|
display: 'flex',
|
|
30
31
|
alignItems: 'center',
|
|
@@ -42,17 +43,20 @@
|
|
|
42
43
|
margin: 0,
|
|
43
44
|
padding: 0,
|
|
44
45
|
borderWidth: 0,
|
|
45
|
-
borderRadius: radius.
|
|
46
|
+
borderRadius: radius.chip,
|
|
46
47
|
backgroundColor: 'transparent',
|
|
47
|
-
color: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
color: {
|
|
49
|
+
default: colors.textSubtle,
|
|
50
|
+
':hover': { default: null, [media.hover]: colors.textMuted }
|
|
51
|
+
},
|
|
52
|
+
// Sentence case, in the text's own face: it names, it does not shout
|
|
53
|
+
fontFamily: 'inherit',
|
|
54
|
+
fontSize: font.sizeCaption,
|
|
55
|
+
fontWeight: font.weightMedium,
|
|
52
56
|
textAlign: 'start',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
// A long name wraps: cut short, there would be nowhere to read the rest of it
|
|
58
|
+
lineHeight: font.leadingSnug,
|
|
59
|
+
overflowWrap: 'anywhere',
|
|
56
60
|
outlineStyle: 'solid',
|
|
57
61
|
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
58
62
|
outlineColor: colors.focusRing,
|
|
@@ -90,30 +94,32 @@
|
|
|
90
94
|
</script>
|
|
91
95
|
|
|
92
96
|
<section
|
|
93
|
-
aria-labelledby=
|
|
97
|
+
aria-labelledby={label ? `${uid}-label` : undefined}
|
|
94
98
|
data-slot="sidebar-group"
|
|
95
99
|
{...rest}
|
|
96
|
-
{...attrs([styles.group, sx], className)}
|
|
100
|
+
{...attrs([styles.group, !label && styles.bare, sx], className)}
|
|
97
101
|
>
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
{#if label}
|
|
103
|
+
<div {...stylex.attrs(styles.head)}>
|
|
104
|
+
{#if collapsible}
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
id="{uid}-label"
|
|
108
|
+
aria-expanded={open}
|
|
109
|
+
aria-controls="{uid}-list"
|
|
110
|
+
{...stylex.attrs(styles.label, styles.button)}
|
|
111
|
+
onclick={() => (open = !open)}
|
|
112
|
+
>
|
|
113
|
+
<bdi>{label}</bdi>
|
|
114
|
+
<Chevron {open} size={12} />
|
|
115
|
+
</button>
|
|
116
|
+
{:else}
|
|
117
|
+
<h3 id="{uid}-label" {...stylex.attrs(styles.label)}><bdi>{label}</bdi></h3>
|
|
118
|
+
{/if}
|
|
119
|
+
{@render actions?.()}
|
|
120
|
+
</div>
|
|
121
|
+
{/if}
|
|
122
|
+
{#if collapsible && label}
|
|
117
123
|
<Collapse {open} id="{uid}-list">
|
|
118
124
|
<ul {...stylex.attrs(styles.list)}>{@render children?.()}</ul>
|
|
119
125
|
</Collapse>
|
|
@@ -2,8 +2,8 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import { type Sx } from '../../internal/sx.js';
|
|
4
4
|
export type SidebarGroupProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
5
|
-
/** The group's name:
|
|
6
|
-
label
|
|
5
|
+
/** The group's name: "Projects", or "Today". Without one, the rows stand alone; name the group with `aria-label`. */
|
|
6
|
+
label?: string;
|
|
7
7
|
/** Lets the person fold the group away. */
|
|
8
8
|
collapsible?: boolean;
|
|
9
9
|
/** Whether a collapsible group is open. Bindable. */
|
|
@@ -11,7 +11,7 @@ export type SidebarGroupProps = Omit<HTMLAttributes<HTMLElement>, 'children'> &
|
|
|
11
11
|
/** Controls at the end of the label, such as a button to add an item. */
|
|
12
12
|
actions?: Snippet;
|
|
13
13
|
sx?: Sx;
|
|
14
|
-
/** Sidebar.Item rows. */
|
|
14
|
+
/** Sidebar.Item and Sidebar.Folder rows. */
|
|
15
15
|
children?: Snippet;
|
|
16
16
|
};
|
|
17
17
|
declare const SidebarGroup: import("svelte").Component<SidebarGroupProps, {}, "open">;
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
|
|
8
8
|
export type SidebarHeaderProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Whether it drags the window, in Electron. Off by default: AppShell.Bar is the
|
|
11
|
+
* window's drag region. Turn it on in a shell that has no bar.
|
|
12
|
+
*/
|
|
10
13
|
drag?: boolean;
|
|
11
14
|
sx?: Sx;
|
|
12
15
|
children?: Snippet;
|
|
@@ -16,18 +19,21 @@
|
|
|
16
19
|
header: {
|
|
17
20
|
display: 'flex',
|
|
18
21
|
alignItems: 'center',
|
|
19
|
-
gap: '0.
|
|
20
|
-
|
|
22
|
+
gap: '0.25rem',
|
|
23
|
+
boxSizing: 'border-box',
|
|
24
|
+
flexShrink: 0,
|
|
25
|
+
// The same height as AppShell.Header, so the columns' heads sit on one line
|
|
26
|
+
height: '3rem',
|
|
27
|
+
// The usual edge, or clear of the traffic lights in a shell with no bar
|
|
28
|
+
paddingInlineStart: 'max(1rem, calc(var(--narvi-inset-sidebar, 0px) + 0.5rem))',
|
|
21
29
|
paddingInlineEnd: '0.5rem',
|
|
22
|
-
// Clear of the window's traffic lights
|
|
23
|
-
paddingInlineStart: 'calc(0.75rem + var(--narvi-window-inset, 0px))',
|
|
24
30
|
whiteSpace: 'nowrap'
|
|
25
31
|
}
|
|
26
32
|
});
|
|
27
33
|
</script>
|
|
28
34
|
|
|
29
35
|
<script lang="ts">
|
|
30
|
-
let { drag =
|
|
36
|
+
let { drag = false, sx, class: className, children, ...rest }: SidebarHeaderProps = $props();
|
|
31
37
|
</script>
|
|
32
38
|
|
|
33
39
|
<div
|
|
@@ -2,7 +2,10 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import { type Sx } from '../../internal/sx.js';
|
|
4
4
|
export type SidebarHeaderProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Whether it drags the window, in Electron. Off by default: AppShell.Bar is the
|
|
7
|
+
* window's drag region. Turn it on in a shell that has no bar.
|
|
8
|
+
*/
|
|
6
9
|
drag?: boolean;
|
|
7
10
|
sx?: Sx;
|
|
8
11
|
children?: Snippet;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { sidebarItemMarker } from '../../internal/markers.stylex.js';
|
|
11
11
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
12
12
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
13
|
+
import { media } from '../../media.stylex.js';
|
|
13
14
|
|
|
14
15
|
export type SidebarItemProps = Omit<HTMLAnchorAttributes, 'children'> & {
|
|
15
16
|
/** A link to go to. Without it the row is a button; listen with `onclick`. */
|
|
@@ -33,8 +34,6 @@
|
|
|
33
34
|
children?: Snippet;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
37
|
-
const FORCED = '@media (forced-colors: active)';
|
|
38
37
|
// StyleX reads `when` only where it is written inline, in the keys below
|
|
39
38
|
|
|
40
39
|
const styles = stylex.create({
|
|
@@ -50,50 +49,38 @@
|
|
|
50
49
|
rowGap: '0.125rem',
|
|
51
50
|
width: '100%',
|
|
52
51
|
margin: 0,
|
|
53
|
-
paddingBlock: '0.
|
|
54
|
-
paddingInline: '0.
|
|
52
|
+
paddingBlock: '0.375rem',
|
|
53
|
+
paddingInline: '0.5rem',
|
|
55
54
|
borderWidth: 0,
|
|
56
|
-
borderRadius: radius.
|
|
55
|
+
borderRadius: radius.control,
|
|
57
56
|
backgroundColor: {
|
|
58
57
|
default: 'transparent',
|
|
59
|
-
':hover': { default: null, [
|
|
58
|
+
':hover': { default: null, [media.hover]: colors.fillHover }
|
|
60
59
|
},
|
|
61
60
|
color: colors.text,
|
|
62
61
|
fontFamily: 'inherit',
|
|
63
|
-
fontSize: font.
|
|
64
|
-
|
|
62
|
+
fontSize: font.sizeMeta,
|
|
63
|
+
// A whole number of pixels, so every row is 30px and none sits between pixels
|
|
64
|
+
lineHeight: '1.125rem',
|
|
65
65
|
textAlign: 'start',
|
|
66
66
|
textDecoration: 'none',
|
|
67
67
|
cursor: 'pointer',
|
|
68
68
|
WebkitTapHighlightColor: 'transparent',
|
|
69
69
|
WebkitAppRegion: 'no-drag',
|
|
70
70
|
outlineStyle: 'solid',
|
|
71
|
-
outlineWidth: { default: 0, ':focus-visible': '2px', [
|
|
71
|
+
outlineWidth: { default: 0, ':focus-visible': '2px', [media.forcedColors]: '1px' },
|
|
72
72
|
outlineColor: { default: 'transparent', ':focus-visible': colors.focusRing },
|
|
73
73
|
outlineOffset: '-2px',
|
|
74
74
|
transitionProperty: 'background-color, color',
|
|
75
75
|
transitionDuration: motion.fast,
|
|
76
76
|
transitionTimingFunction: 'ease'
|
|
77
77
|
},
|
|
78
|
-
compact: { gridTemplateAreas: '"lead title trail"'
|
|
78
|
+
compact: { gridTemplateAreas: '"lead title trail"' },
|
|
79
79
|
muted: { color: colors.textMuted },
|
|
80
|
-
// The open row
|
|
80
|
+
// The open row: a flat fill and a heavier title
|
|
81
81
|
current: {
|
|
82
82
|
color: colors.text,
|
|
83
|
-
backgroundColor: { default: colors.
|
|
84
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}`,
|
|
85
|
-
'::before': {
|
|
86
|
-
content: '""',
|
|
87
|
-
position: 'absolute',
|
|
88
|
-
insetInlineStart: '-0.5rem',
|
|
89
|
-
top: '25%',
|
|
90
|
-
bottom: '25%',
|
|
91
|
-
width: '2px',
|
|
92
|
-
borderRadius: '2px',
|
|
93
|
-
backgroundColor: { default: colors.ithil, [FORCED]: 'Highlight' },
|
|
94
|
-
boxShadow: `0 0 8px ${colors.glow}`,
|
|
95
|
-
forcedColorAdjust: 'none'
|
|
96
|
-
}
|
|
83
|
+
backgroundColor: { default: colors.fillSelected, ':hover': colors.fillSelected }
|
|
97
84
|
},
|
|
98
85
|
lead: {
|
|
99
86
|
gridArea: 'lead',
|
|
@@ -101,7 +88,7 @@
|
|
|
101
88
|
display: 'grid',
|
|
102
89
|
placeItems: 'center',
|
|
103
90
|
width: '1rem',
|
|
104
|
-
height: '1.
|
|
91
|
+
height: '1.125rem',
|
|
105
92
|
color: colors.textSubtle
|
|
106
93
|
},
|
|
107
94
|
title: {
|
|
@@ -111,14 +98,14 @@
|
|
|
111
98
|
textOverflow: 'ellipsis',
|
|
112
99
|
whiteSpace: 'nowrap'
|
|
113
100
|
},
|
|
114
|
-
titleCurrent: { fontWeight: font.
|
|
101
|
+
titleCurrent: { fontWeight: font.weightSemibold },
|
|
115
102
|
trail: {
|
|
116
103
|
gridArea: 'trail',
|
|
117
104
|
display: 'inline-flex',
|
|
118
105
|
alignItems: 'center',
|
|
119
106
|
gap: '0.25rem',
|
|
120
107
|
color: colors.textSubtle,
|
|
121
|
-
fontSize: font.
|
|
108
|
+
fontSize: font.sizeCaption,
|
|
122
109
|
fontVariantNumeric: 'tabular-nums',
|
|
123
110
|
whiteSpace: 'nowrap',
|
|
124
111
|
transitionProperty: 'opacity',
|
|
@@ -129,7 +116,7 @@
|
|
|
129
116
|
trailHides: {
|
|
130
117
|
opacity: {
|
|
131
118
|
default: 1,
|
|
132
|
-
[
|
|
119
|
+
[media.hover]: { default: 1, [stylex.when.ancestor(':hover', sidebarItemMarker)]: 0 },
|
|
133
120
|
[stylex.when.ancestor(':focus-within', sidebarItemMarker)]: 0
|
|
134
121
|
}
|
|
135
122
|
},
|
|
@@ -141,28 +128,37 @@
|
|
|
141
128
|
minWidth: 0,
|
|
142
129
|
overflow: 'hidden',
|
|
143
130
|
color: colors.textSubtle,
|
|
144
|
-
fontSize: font.
|
|
131
|
+
fontSize: font.sizeCaption,
|
|
145
132
|
whiteSpace: 'nowrap'
|
|
146
133
|
},
|
|
134
|
+
// The tray sits 1px inside the row, so its radius is the row's less 1px. Narvi's small
|
|
135
|
+
// buttons reach past their own edges to be easy to hit; here that would reach into the
|
|
136
|
+
// rows above and below, so the tray clips them, and shows the focus ring itself.
|
|
147
137
|
actions: {
|
|
148
138
|
position: 'absolute',
|
|
149
|
-
top: '
|
|
150
|
-
insetInlineEnd: '
|
|
139
|
+
top: '1px',
|
|
140
|
+
insetInlineEnd: '1px',
|
|
151
141
|
zIndex: 1,
|
|
152
142
|
display: 'flex',
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
borderRadius: radius.md,
|
|
143
|
+
overflow: 'clip',
|
|
144
|
+
borderRadius: `calc(${radius.control} - 1px)`,
|
|
156
145
|
backgroundColor: colors.bgRaised,
|
|
157
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
146
|
+
boxShadow: `inset 0 0 0 1px ${colors.border}`,
|
|
147
|
+
outlineStyle: 'solid',
|
|
148
|
+
outlineWidth: { default: 0, ':focus-within': '2px' },
|
|
149
|
+
outlineColor: colors.focusRing,
|
|
150
|
+
outlineOffset: '1px',
|
|
158
151
|
opacity: {
|
|
159
152
|
default: 1,
|
|
160
|
-
[
|
|
153
|
+
[media.hover]: { default: 0, [stylex.when.ancestor(':hover', sidebarItemMarker)]: 1 },
|
|
161
154
|
[stylex.when.ancestor(':focus-within', sidebarItemMarker)]: 1
|
|
162
155
|
},
|
|
163
156
|
pointerEvents: {
|
|
164
157
|
default: 'auto',
|
|
165
|
-
[
|
|
158
|
+
[media.hover]: {
|
|
159
|
+
default: 'none',
|
|
160
|
+
[stylex.when.ancestor(':hover', sidebarItemMarker)]: 'auto'
|
|
161
|
+
},
|
|
166
162
|
[stylex.when.ancestor(':focus-within', sidebarItemMarker)]: 'auto'
|
|
167
163
|
},
|
|
168
164
|
transitionProperty: 'opacity',
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A sidebar on its own: a column that holds a Sidebar.Header, a Sidebar.Content
|
|
3
|
+
and a Sidebar.Footer, anywhere on a page.
|
|
4
|
+
|
|
5
|
+
Inside an app shell there is no need for it: AppShell.Sidebar is the column
|
|
6
|
+
there, and it folds away and becomes a drawer. This one has no surface and no
|
|
7
|
+
edge of its own; give it the ones its place calls for with `sx`.
|
|
8
|
+
-->
|
|
9
|
+
<script lang="ts" module>
|
|
10
|
+
import * as stylex from '@stylexjs/stylex';
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
13
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
14
|
+
import { colors, font } from '../../tokens.stylex.js';
|
|
15
|
+
|
|
16
|
+
export type SidebarRootProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
17
|
+
/** Names the region: "Chats", "Projects". */
|
|
18
|
+
label?: string;
|
|
19
|
+
sx?: Sx;
|
|
20
|
+
ref?: HTMLElement | null;
|
|
21
|
+
/** A Sidebar.Header, a Sidebar.Content and a Sidebar.Footer. */
|
|
22
|
+
children?: Snippet;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const styles = stylex.create({
|
|
26
|
+
// The width the app shell gives its sidebar, and the text it sets its rows in
|
|
27
|
+
root: {
|
|
28
|
+
boxSizing: 'border-box',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
flexShrink: 0,
|
|
32
|
+
width: '16.25rem',
|
|
33
|
+
maxWidth: '100%',
|
|
34
|
+
minHeight: 0,
|
|
35
|
+
color: colors.text,
|
|
36
|
+
fontFamily: font.body,
|
|
37
|
+
fontSize: font.sizeMeta,
|
|
38
|
+
lineHeight: font.leadingSnug
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script lang="ts">
|
|
44
|
+
let {
|
|
45
|
+
label = 'Sidebar',
|
|
46
|
+
sx,
|
|
47
|
+
class: className,
|
|
48
|
+
ref = $bindable(null),
|
|
49
|
+
children,
|
|
50
|
+
...rest
|
|
51
|
+
}: SidebarRootProps = $props();
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<aside
|
|
55
|
+
bind:this={ref}
|
|
56
|
+
aria-label={label}
|
|
57
|
+
data-slot="sidebar"
|
|
58
|
+
{...rest}
|
|
59
|
+
{...attrs([styles.root, sx], className)}
|
|
60
|
+
>
|
|
61
|
+
{@render children?.()}
|
|
62
|
+
</aside>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type SidebarRootProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
5
|
+
/** Names the region: "Chats", "Projects". */
|
|
6
|
+
label?: string;
|
|
7
|
+
sx?: Sx;
|
|
8
|
+
ref?: HTMLElement | null;
|
|
9
|
+
/** A Sidebar.Header, a Sidebar.Content and a Sidebar.Footer. */
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
};
|
|
12
|
+
declare const SidebarRoot: import("svelte").Component<SidebarRootProps, {}, "ref">;
|
|
13
|
+
type SidebarRoot = ReturnType<typeof SidebarRoot>;
|
|
14
|
+
export default SidebarRoot;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import Content from './SidebarContent.svelte';
|
|
2
|
+
import Folder from './SidebarFolder.svelte';
|
|
2
3
|
import Footer from './SidebarFooter.svelte';
|
|
3
4
|
import Group from './SidebarGroup.svelte';
|
|
4
5
|
import Header from './SidebarHeader.svelte';
|
|
5
6
|
import Item from './SidebarItem.svelte';
|
|
6
|
-
|
|
7
|
+
import Root from './SidebarRoot.svelte';
|
|
8
|
+
export { Root, Header, Content, Group, Folder, Item, Footer };
|
|
7
9
|
export type { SidebarContentProps } from './SidebarContent.svelte';
|
|
10
|
+
export type { SidebarFolderProps } from './SidebarFolder.svelte';
|
|
8
11
|
export type { SidebarFooterProps } from './SidebarFooter.svelte';
|
|
9
12
|
export type { SidebarGroupProps } from './SidebarGroup.svelte';
|
|
10
13
|
export type { SidebarHeaderProps } from './SidebarHeader.svelte';
|
|
11
14
|
export type { SidebarItemProps } from './SidebarItem.svelte';
|
|
15
|
+
export type { SidebarRootProps } from './SidebarRoot.svelte';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Content from './SidebarContent.svelte';
|
|
2
|
+
import Folder from './SidebarFolder.svelte';
|
|
2
3
|
import Footer from './SidebarFooter.svelte';
|
|
3
4
|
import Group from './SidebarGroup.svelte';
|
|
4
5
|
import Header from './SidebarHeader.svelte';
|
|
5
6
|
import Item from './SidebarItem.svelte';
|
|
6
|
-
|
|
7
|
+
import Root from './SidebarRoot.svelte';
|
|
8
|
+
export { Root, Header, Content, Group, Folder, Item, Footer };
|