@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
|
@@ -3,8 +3,8 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
3
3
|
import { type Sx } from '../../internal/sx.js';
|
|
4
4
|
export type AppShellHeaderProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
5
5
|
/**
|
|
6
|
-
* Whether
|
|
7
|
-
*
|
|
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
8
|
*/
|
|
9
9
|
drag?: boolean;
|
|
10
10
|
sx?: Sx;
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
import * as stylex from '@stylexjs/stylex';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
-
import { shared } from '../../internal/shared.js';
|
|
6
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
-
import { colors, radius } from '../../tokens.stylex.js';
|
|
8
|
-
import { useAppShell } from './context.js';
|
|
9
6
|
|
|
10
7
|
export type AppShellMainProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
11
8
|
sx?: Sx;
|
|
@@ -14,36 +11,23 @@
|
|
|
14
11
|
};
|
|
15
12
|
|
|
16
13
|
const styles = stylex.create({
|
|
17
|
-
// The page
|
|
14
|
+
// The page: the column of the sheet that takes whatever room the others leave
|
|
18
15
|
main: {
|
|
19
16
|
position: 'relative',
|
|
20
17
|
display: 'flex',
|
|
21
18
|
flexDirection: 'column',
|
|
22
19
|
flexGrow: 1,
|
|
23
20
|
minWidth: 0,
|
|
24
|
-
|
|
25
|
-
marginInlineEnd: '0.375rem',
|
|
26
|
-
overflow: 'clip',
|
|
27
|
-
borderRadius: radius.frame,
|
|
28
|
-
backgroundColor: colors.bgRaised,
|
|
29
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, 0 1px 2px ${colors.shade}`,
|
|
21
|
+
minHeight: 0,
|
|
30
22
|
outlineStyle: 'none'
|
|
31
|
-
}
|
|
32
|
-
narrow: { margin: 0, borderRadius: 0, boxShadow: 'none' }
|
|
23
|
+
}
|
|
33
24
|
});
|
|
34
25
|
</script>
|
|
35
26
|
|
|
36
27
|
<script lang="ts">
|
|
37
28
|
let { sx, class: className, children, ...rest }: AppShellMainProps = $props();
|
|
38
|
-
|
|
39
|
-
const shell = useAppShell('Main');
|
|
40
29
|
</script>
|
|
41
30
|
|
|
42
|
-
<main
|
|
43
|
-
tabindex="-1"
|
|
44
|
-
data-slot="app-shell-main"
|
|
45
|
-
{...rest}
|
|
46
|
-
{...attrs([styles.main, shared.edged, shell.narrow && styles.narrow, sx], className)}
|
|
47
|
-
>
|
|
31
|
+
<main tabindex="-1" data-slot="app-shell-main" {...rest} {...attrs([styles.main, sx], className)}>
|
|
48
32
|
{@render children?.()}
|
|
49
33
|
</main>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The last column of the sheet, beside the page: what the page is about, such as
|
|
3
|
+
the files a thread changed. Its start edge drags to resize it.
|
|
4
|
+
-->
|
|
1
5
|
<script lang="ts" module>
|
|
2
6
|
import * as stylex from '@stylexjs/stylex';
|
|
3
7
|
import type { Snippet } from 'svelte';
|
|
4
8
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
-
import { shared } from '../../internal/shared.js';
|
|
6
9
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
-
import { colors
|
|
10
|
+
import { colors } from '../../tokens.stylex.js';
|
|
8
11
|
import ResizeHandle from '../resize-handle/ResizeHandle.svelte';
|
|
9
12
|
import { useAppShell } from './context.js';
|
|
10
13
|
|
|
@@ -24,31 +27,32 @@
|
|
|
24
27
|
const styles = stylex.create({
|
|
25
28
|
panel: {
|
|
26
29
|
position: 'relative',
|
|
30
|
+
boxSizing: 'border-box',
|
|
27
31
|
display: 'flex',
|
|
28
32
|
flexDirection: 'column',
|
|
29
33
|
flexShrink: 0,
|
|
30
34
|
width: 'var(--narvi-panel-width)',
|
|
31
35
|
minWidth: 0,
|
|
32
|
-
|
|
33
|
-
marginInlineEnd: '0.375rem',
|
|
36
|
+
minHeight: 0,
|
|
34
37
|
overflow: 'clip',
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
borderInlineStartWidth: '1px',
|
|
39
|
+
borderInlineStartStyle: 'solid',
|
|
40
|
+
borderInlineStartColor: colors.border,
|
|
41
|
+
// The traffic lights are never over a panel, so a header inside one keeps no room for them
|
|
42
|
+
'--narvi-inset-page': '0px'
|
|
38
43
|
},
|
|
39
44
|
// On a narrow window the panel takes the place of the page, under its
|
|
40
45
|
// header, which stays in reach with the sidebar's toggle
|
|
41
46
|
narrow: {
|
|
42
47
|
position: 'absolute',
|
|
43
48
|
inset: 0,
|
|
44
|
-
top: '
|
|
49
|
+
top: '3rem',
|
|
45
50
|
zIndex: 5,
|
|
46
51
|
width: 'auto',
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
boxShadow: 'none'
|
|
52
|
+
borderInlineStartWidth: 0,
|
|
53
|
+
backgroundColor: colors.bgRaised
|
|
50
54
|
},
|
|
51
|
-
handle: { position: 'relative', alignSelf: 'stretch'
|
|
55
|
+
handle: { position: 'relative', alignSelf: 'stretch' }
|
|
52
56
|
});
|
|
53
57
|
</script>
|
|
54
58
|
|
|
@@ -72,13 +76,11 @@
|
|
|
72
76
|
const largest = () => {
|
|
73
77
|
// On the server there is no window to measure: no limit yet
|
|
74
78
|
if (typeof window === 'undefined') return Infinity;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'[data-slot="app-shell-sidebar"]'
|
|
79
|
+
const sheet = element?.parentElement;
|
|
80
|
+
const sidebar = sheet?.querySelector<HTMLElement>(':scope > [data-slot="app-shell-sidebar"]');
|
|
81
|
+
return (
|
|
82
|
+
(sheet?.clientWidth ?? innerWidth) - (sidebar?.offsetWidth ?? 0) - Math.max(mainMinWidth, 0)
|
|
80
83
|
);
|
|
81
|
-
return shellWidth - (sidebar?.offsetWidth ?? 0) - Math.max(mainMinWidth, 0) - (main ? 12 : 0);
|
|
82
84
|
};
|
|
83
85
|
</script>
|
|
84
86
|
|
|
@@ -101,7 +103,7 @@
|
|
|
101
103
|
data-slot="app-shell-panel"
|
|
102
104
|
style:--narvi-panel-width="{width}px"
|
|
103
105
|
{...rest}
|
|
104
|
-
{...attrs([styles.panel,
|
|
106
|
+
{...attrs([styles.panel, shell.narrow && styles.narrow, sx], className)}
|
|
105
107
|
>
|
|
106
108
|
{@render children?.()}
|
|
107
109
|
</aside>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Several sheets side by side, each a pane of its own, with the shell's gutter
|
|
3
|
+
between them. Put AppShell.Sheets inside: one for the sidebar, one for each
|
|
4
|
+
thing that is open.
|
|
5
|
+
|
|
6
|
+
The panes share the room equally unless one is given a width. On a narrow
|
|
7
|
+
window each is as wide as the window, and they are moved between by scrolling
|
|
8
|
+
sideways, one at a time.
|
|
9
|
+
-->
|
|
10
|
+
<script lang="ts" module>
|
|
11
|
+
import * as stylex from '@stylexjs/stylex';
|
|
12
|
+
import type { Snippet } from 'svelte';
|
|
13
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
14
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
15
|
+
import { useAppShell } from './context.js';
|
|
16
|
+
|
|
17
|
+
export type AppShellPanesProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
18
|
+
sx?: Sx;
|
|
19
|
+
/** AppShell.Sheets. */
|
|
20
|
+
children?: Snippet;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const styles = stylex.create({
|
|
24
|
+
panes: {
|
|
25
|
+
gridArea: 'sheet',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
gap: '0.375rem',
|
|
28
|
+
minWidth: 0,
|
|
29
|
+
minHeight: 0,
|
|
30
|
+
// Room for each sheet's edge, which is drawn just outside it
|
|
31
|
+
padding: '1px',
|
|
32
|
+
margin: '-1px'
|
|
33
|
+
},
|
|
34
|
+
narrow: {
|
|
35
|
+
gap: 0,
|
|
36
|
+
padding: 0,
|
|
37
|
+
margin: 0,
|
|
38
|
+
overflowX: 'auto',
|
|
39
|
+
overscrollBehaviorX: 'contain',
|
|
40
|
+
scrollSnapType: 'x mandatory',
|
|
41
|
+
scrollbarWidth: 'none'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<script lang="ts">
|
|
47
|
+
let { sx, class: className, children, ...rest }: AppShellPanesProps = $props();
|
|
48
|
+
|
|
49
|
+
const shell = useAppShell('Panes');
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<div
|
|
53
|
+
data-slot="app-shell-panes"
|
|
54
|
+
{...rest}
|
|
55
|
+
{...attrs([styles.panes, shell.narrow && styles.narrow, sx], className)}
|
|
56
|
+
>
|
|
57
|
+
{@render children?.()}
|
|
58
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type AppShellPanesProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
|
+
sx?: Sx;
|
|
6
|
+
/** AppShell.Sheets. */
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const AppShellPanes: import("svelte").Component<AppShellPanesProps, {}, "">;
|
|
10
|
+
type AppShellPanes = ReturnType<typeof AppShellPanes>;
|
|
11
|
+
export default AppShellPanes;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Where the rail stands: on the window itself, beside the sheet and under the bar.
|
|
3
|
+
It stays when the sidebar folds away. On a narrow window it joins the sidebar's
|
|
4
|
+
drawer, and the two slide in together.
|
|
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 { attrs, type Sx } from '../../internal/sx.js';
|
|
11
|
+
import { colors, motion } from '../../tokens.stylex.js';
|
|
12
|
+
import { media } from '../../media.stylex.js';
|
|
13
|
+
import { useAppShell } from './context.js';
|
|
14
|
+
|
|
15
|
+
export type AppShellRailProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
16
|
+
sx?: Sx;
|
|
17
|
+
/** A Rail.Root. */
|
|
18
|
+
children?: Snippet;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// The drawer's curve: quick out of the edge, a long gentle settle
|
|
22
|
+
const DRAWER = 'cubic-bezier(0.32, 0.72, 0, 1)';
|
|
23
|
+
|
|
24
|
+
const styles = stylex.create({
|
|
25
|
+
rail: {
|
|
26
|
+
gridArea: 'rail',
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
minHeight: 0,
|
|
30
|
+
width: 'var(--narvi-rail-width)',
|
|
31
|
+
// Back over the shell's gutter, to the window's edge and its foot
|
|
32
|
+
marginInlineStart: '-0.375rem',
|
|
33
|
+
marginBottom: '-0.375rem'
|
|
34
|
+
},
|
|
35
|
+
// Narrow: the first strip of the drawer
|
|
36
|
+
drawer: {
|
|
37
|
+
position: 'fixed',
|
|
38
|
+
insetBlock: 0,
|
|
39
|
+
insetInlineStart: 0,
|
|
40
|
+
zIndex: 41,
|
|
41
|
+
marginInlineStart: 0,
|
|
42
|
+
marginBottom: 0,
|
|
43
|
+
backgroundColor: colors.bgWindow,
|
|
44
|
+
// A divider, so a border: it follows the writing direction and survives forced colours
|
|
45
|
+
borderInlineEndWidth: '1px',
|
|
46
|
+
borderInlineEndStyle: 'solid',
|
|
47
|
+
borderInlineEndColor: colors.border,
|
|
48
|
+
boxSizing: 'border-box',
|
|
49
|
+
translate: { default: '-100% 0', ':dir(rtl)': '100% 0' },
|
|
50
|
+
visibility: 'hidden',
|
|
51
|
+
transitionProperty: { default: 'visibility', [media.motion]: 'translate, visibility' },
|
|
52
|
+
transitionDuration: { default: '0s', [media.motion]: `${motion.slow}, 0s` },
|
|
53
|
+
transitionDelay: { default: '0s', [media.motion]: `0s, ${motion.slow}` },
|
|
54
|
+
transitionTimingFunction: DRAWER
|
|
55
|
+
},
|
|
56
|
+
drawerOpen: {
|
|
57
|
+
translate: '0 0',
|
|
58
|
+
visibility: 'visible',
|
|
59
|
+
transitionDelay: { default: '0s', [media.motion]: '0s, 0s' }
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<script lang="ts">
|
|
65
|
+
let { sx, class: className, children, ...rest }: AppShellRailProps = $props();
|
|
66
|
+
|
|
67
|
+
const shell = useAppShell('Rail');
|
|
68
|
+
|
|
69
|
+
$effect(() => {
|
|
70
|
+
shell.setRail(true);
|
|
71
|
+
return () => shell.setRail(false);
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<div
|
|
76
|
+
inert={(shell.narrow && !shell.open) || undefined}
|
|
77
|
+
data-slot="app-shell-rail"
|
|
78
|
+
{...rest}
|
|
79
|
+
{...attrs(
|
|
80
|
+
[styles.rail, shell.narrow && [styles.drawer, shell.open && styles.drawerOpen], sx],
|
|
81
|
+
className
|
|
82
|
+
)}
|
|
83
|
+
>
|
|
84
|
+
{@render children?.()}
|
|
85
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type AppShellRailProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
|
+
sx?: Sx;
|
|
6
|
+
/** A Rail.Root. */
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const AppShellRail: import("svelte").Component<AppShellRailProps, {}, "">;
|
|
10
|
+
type AppShellRail = ReturnType<typeof AppShellRail>;
|
|
11
|
+
export default AppShellRail;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
The frame of an app
|
|
2
|
+
The frame of an app. A bar across the top is the window's own; under it a
|
|
3
|
+
narrow rail stands on the window, and beside the rail one sheet holds the
|
|
4
|
+
sidebar, the page and a panel.
|
|
5
|
+
|
|
6
|
+
The bar and the rail are optional. Without a bar the window's controls go in
|
|
7
|
+
the head of the first column: the sidebar's, or the page's while the sidebar
|
|
8
|
+
is away. A flush sheet then makes the sidebar and the page two columns of the
|
|
9
|
+
window itself.
|
|
3
10
|
|
|
4
11
|
Narvi lays it out and moves it; the app decides what is remembered. The open
|
|
5
12
|
state is bindable and nothing is stored, and no shortcut is bound: wire ⌘B,
|
|
@@ -14,15 +21,17 @@
|
|
|
14
21
|
import { setAppShellContext } from './context.js';
|
|
15
22
|
|
|
16
23
|
export type AppShellRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
17
|
-
/** Whether the sidebar shows
|
|
24
|
+
/** Whether the sidebar shows; closed, the page takes its room and the rail stays. Bindable. */
|
|
18
25
|
sidebarOpen?: boolean;
|
|
19
|
-
/** The width of the sidebar
|
|
26
|
+
/** The width of the sidebar, in rem or px. */
|
|
20
27
|
sidebarWidth?: string;
|
|
21
|
-
/** Below this window width, in pixels, the sidebar
|
|
28
|
+
/** Below this window width, in pixels, the rail and the sidebar become a drawer over the page. */
|
|
22
29
|
narrowAt?: number;
|
|
23
30
|
/**
|
|
24
|
-
* Room kept clear at the
|
|
25
|
-
*
|
|
31
|
+
* Room kept clear at the start of the bar, for macOS's traffic lights in an Electron
|
|
32
|
+
* window with a hidden title bar. They grew in macOS 26, so set it from the system the
|
|
33
|
+
* app runs on, and to `0px` in full screen and wherever the window has no lights.
|
|
34
|
+
* In a shell with no bar, the sidebar's head keeps it, or the page's while the sidebar is away.
|
|
26
35
|
*/
|
|
27
36
|
windowInset?: string;
|
|
28
37
|
/**
|
|
@@ -32,32 +41,42 @@
|
|
|
32
41
|
covered?: boolean;
|
|
33
42
|
sx?: Sx;
|
|
34
43
|
ref?: HTMLDivElement | null;
|
|
35
|
-
/** An AppShell.
|
|
44
|
+
/** An AppShell.Bar, an AppShell.Rail and an AppShell.Sheet. The bar and the rail are optional. */
|
|
36
45
|
children?: Snippet;
|
|
37
46
|
};
|
|
38
47
|
|
|
39
48
|
const styles = stylex.create({
|
|
49
|
+
// The window: one flat grey, a shade under the page's, for the sheet to stand out against
|
|
40
50
|
root: {
|
|
41
51
|
position: 'relative',
|
|
42
|
-
|
|
52
|
+
boxSizing: 'border-box',
|
|
53
|
+
display: 'grid',
|
|
54
|
+
gridTemplateColumns: 'auto minmax(0, 1fr)',
|
|
55
|
+
gridTemplateRows: 'auto minmax(0, 1fr)',
|
|
56
|
+
gridTemplateAreas: '"bar bar" "rail sheet"',
|
|
43
57
|
height: '100dvh',
|
|
58
|
+
// The gutter around the sheet. The bar and the rail reach back over it to the
|
|
59
|
+
// window's edge, so the sheet keeps a gutter only on the sides they leave free.
|
|
60
|
+
padding: '0.375rem',
|
|
44
61
|
// `clip`, not `hidden`: scrollIntoView scrolls an overflow:hidden box, and
|
|
45
62
|
// in Eregion one stray button slid the whole window under its header
|
|
46
63
|
overflow: 'clip',
|
|
47
64
|
overscrollBehavior: 'none',
|
|
48
|
-
backgroundColor: colors.
|
|
65
|
+
backgroundColor: colors.bgWindow,
|
|
49
66
|
color: colors.text,
|
|
50
67
|
fontFamily: font.body,
|
|
51
|
-
fontSize: font.
|
|
52
|
-
lineHeight: font.
|
|
53
|
-
}
|
|
68
|
+
fontSize: font.sizeMeta,
|
|
69
|
+
lineHeight: font.leadingSnug
|
|
70
|
+
},
|
|
71
|
+
// A narrow window is all sheet
|
|
72
|
+
narrow: { padding: 0 }
|
|
54
73
|
});
|
|
55
74
|
</script>
|
|
56
75
|
|
|
57
76
|
<script lang="ts">
|
|
58
77
|
let {
|
|
59
78
|
sidebarOpen = $bindable(true),
|
|
60
|
-
sidebarWidth = '
|
|
79
|
+
sidebarWidth = '16.25rem',
|
|
61
80
|
narrowAt = 768,
|
|
62
81
|
windowInset = '0px',
|
|
63
82
|
covered = false,
|
|
@@ -72,6 +91,10 @@
|
|
|
72
91
|
let narrow = $state(false);
|
|
73
92
|
let drawer = $state(false);
|
|
74
93
|
let rail = $state(false);
|
|
94
|
+
let bar = $state(false);
|
|
95
|
+
// Each time the person shows or hides the sidebar; a toggle that takes the place of
|
|
96
|
+
// the one pressed picks up the focus then, and not when the window changes size
|
|
97
|
+
let moves = $state(0);
|
|
75
98
|
|
|
76
99
|
$effect(() => {
|
|
77
100
|
const query = matchMedia(`(max-width: ${narrowAt - 0.02}px)`);
|
|
@@ -85,15 +108,6 @@
|
|
|
85
108
|
});
|
|
86
109
|
|
|
87
110
|
const open = $derived(narrow ? drawer : sidebarOpen);
|
|
88
|
-
// What the sidebar takes up now, so headers know how much of the window
|
|
89
|
-
// inset is still theirs to keep clear
|
|
90
|
-
const taken = $derived(
|
|
91
|
-
narrow
|
|
92
|
-
? '0px'
|
|
93
|
-
: sidebarOpen
|
|
94
|
-
? 'calc(var(--narvi-sidebar-width) + var(--narvi-rail-current))'
|
|
95
|
-
: 'var(--narvi-rail-current)'
|
|
96
|
-
);
|
|
97
111
|
|
|
98
112
|
setAppShellContext({
|
|
99
113
|
get open() {
|
|
@@ -103,16 +117,27 @@
|
|
|
103
117
|
return narrow;
|
|
104
118
|
},
|
|
105
119
|
sidebarId: `${uid}-sidebar`,
|
|
120
|
+
get moves() {
|
|
121
|
+
return moves;
|
|
122
|
+
},
|
|
106
123
|
toggle() {
|
|
107
124
|
if (narrow) drawer = !drawer;
|
|
108
125
|
else sidebarOpen = !sidebarOpen;
|
|
126
|
+
moves++;
|
|
109
127
|
},
|
|
110
128
|
close() {
|
|
111
129
|
if (narrow) drawer = false;
|
|
112
130
|
else sidebarOpen = false;
|
|
131
|
+
moves++;
|
|
132
|
+
},
|
|
133
|
+
get bar() {
|
|
134
|
+
return bar;
|
|
113
135
|
},
|
|
114
136
|
setRail(present) {
|
|
115
137
|
rail = present;
|
|
138
|
+
},
|
|
139
|
+
setBar(present) {
|
|
140
|
+
bar = present;
|
|
116
141
|
}
|
|
117
142
|
});
|
|
118
143
|
</script>
|
|
@@ -128,9 +153,10 @@
|
|
|
128
153
|
style:--narvi-rail-width="3.25rem"
|
|
129
154
|
style:--narvi-rail-current={rail ? 'var(--narvi-rail-width)' : '0px'}
|
|
130
155
|
style:--narvi-window-inset={windowInset}
|
|
131
|
-
style:--narvi-sidebar
|
|
156
|
+
style:--narvi-inset-sidebar={bar ? '0px' : windowInset}
|
|
157
|
+
style:--narvi-inset-page={bar || (open && !narrow) ? '0px' : windowInset}
|
|
132
158
|
{...rest}
|
|
133
|
-
{...attrs([styles.root, sx], className)}
|
|
159
|
+
{...attrs([styles.root, narrow && styles.narrow, sx], className)}
|
|
134
160
|
>
|
|
135
161
|
{@render children?.()}
|
|
136
162
|
</div>
|
|
@@ -2,15 +2,17 @@ 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 AppShellRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
|
-
/** Whether the sidebar shows
|
|
5
|
+
/** Whether the sidebar shows; closed, the page takes its room and the rail stays. Bindable. */
|
|
6
6
|
sidebarOpen?: boolean;
|
|
7
|
-
/** The width of the sidebar
|
|
7
|
+
/** The width of the sidebar, in rem or px. */
|
|
8
8
|
sidebarWidth?: string;
|
|
9
|
-
/** Below this window width, in pixels, the sidebar
|
|
9
|
+
/** Below this window width, in pixels, the rail and the sidebar become a drawer over the page. */
|
|
10
10
|
narrowAt?: number;
|
|
11
11
|
/**
|
|
12
|
-
* Room kept clear at the
|
|
13
|
-
*
|
|
12
|
+
* Room kept clear at the start of the bar, for macOS's traffic lights in an Electron
|
|
13
|
+
* window with a hidden title bar. They grew in macOS 26, so set it from the system the
|
|
14
|
+
* app runs on, and to `0px` in full screen and wherever the window has no lights.
|
|
15
|
+
* In a shell with no bar, the sidebar's head keeps it, or the page's while the sidebar is away.
|
|
14
16
|
*/
|
|
15
17
|
windowInset?: string;
|
|
16
18
|
/**
|
|
@@ -20,7 +22,7 @@ export type AppShellRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'>
|
|
|
20
22
|
covered?: boolean;
|
|
21
23
|
sx?: Sx;
|
|
22
24
|
ref?: HTMLDivElement | null;
|
|
23
|
-
/** An AppShell.
|
|
25
|
+
/** An AppShell.Bar, an AppShell.Rail and an AppShell.Sheet. The bar and the rail are optional. */
|
|
24
26
|
children?: Snippet;
|
|
25
27
|
};
|
|
26
28
|
declare const AppShellRoot: import("svelte").Component<AppShellRootProps, {}, "ref" | "sidebarOpen">;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The one sheet the work is laid on: the sidebar, the page and a panel, side by
|
|
3
|
+
side, divided by hairlines.
|
|
4
|
+
|
|
5
|
+
Flush, it has no edge of its own and fills the window: the sidebar and the page
|
|
6
|
+
are then two columns of the window itself. That is for a shell with no bar.
|
|
7
|
+
-->
|
|
8
|
+
<script lang="ts" module>
|
|
9
|
+
import * as stylex from '@stylexjs/stylex';
|
|
10
|
+
import type { Snippet } from 'svelte';
|
|
11
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
12
|
+
import { shared } from '../../internal/shared.js';
|
|
13
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
14
|
+
import { colors, radius } from '../../tokens.stylex.js';
|
|
15
|
+
import { useAppShell } from './context.js';
|
|
16
|
+
|
|
17
|
+
export type AppShellSheetProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
18
|
+
/**
|
|
19
|
+
* Fills the window to its edges, with no gutter, corner or edge of its own. The
|
|
20
|
+
* sidebar takes the page's colour, and what is beside it stays raised.
|
|
21
|
+
*/
|
|
22
|
+
flush?: boolean;
|
|
23
|
+
sx?: Sx;
|
|
24
|
+
ref?: HTMLDivElement | null;
|
|
25
|
+
/** An AppShell.Sidebar, an AppShell.Main and, if you like, an AppShell.Panel. */
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const styles = stylex.create({
|
|
30
|
+
// A plain surface with a hairline round it. Nothing is lit and nothing is cast.
|
|
31
|
+
sheet: {
|
|
32
|
+
gridArea: 'sheet',
|
|
33
|
+
position: 'relative',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
// One of several in AppShell.Panes: they share the room equally
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
flexBasis: 0,
|
|
38
|
+
scrollSnapAlign: 'start',
|
|
39
|
+
minWidth: 0,
|
|
40
|
+
minHeight: 0,
|
|
41
|
+
overflow: 'clip',
|
|
42
|
+
// The window's corner less the gutter, near enough, so the two curves run together
|
|
43
|
+
borderRadius: radius.panel,
|
|
44
|
+
backgroundColor: colors.bgRaised,
|
|
45
|
+
boxShadow: `0 0 0 1px ${colors.border}`
|
|
46
|
+
},
|
|
47
|
+
// On a narrow window a pane is as wide as the window
|
|
48
|
+
narrow: { borderRadius: 0, boxShadow: 'none', flexShrink: 0, flexBasis: '100%' },
|
|
49
|
+
// Back over the shell's gutter, to the window's edges. The sidebar reads the colour
|
|
50
|
+
// it is given here; anywhere else it has none and shows the sheet.
|
|
51
|
+
flush: {
|
|
52
|
+
marginInline: '-0.375rem',
|
|
53
|
+
marginBottom: '-0.375rem',
|
|
54
|
+
borderRadius: 0,
|
|
55
|
+
boxShadow: 'none',
|
|
56
|
+
'--narvi-sidebar-surface': colors.bg
|
|
57
|
+
},
|
|
58
|
+
// With no bar above it, to the window's top as well
|
|
59
|
+
flushTop: { marginTop: '-0.375rem' },
|
|
60
|
+
// A narrow window has no gutter to reach over. Spelled out: a longhand outranks `margin`.
|
|
61
|
+
flushNarrow: { marginTop: 0, marginInline: 0, marginBottom: 0 }
|
|
62
|
+
});
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<script lang="ts">
|
|
66
|
+
let {
|
|
67
|
+
flush = false,
|
|
68
|
+
sx,
|
|
69
|
+
class: className,
|
|
70
|
+
ref = $bindable(null),
|
|
71
|
+
children,
|
|
72
|
+
...rest
|
|
73
|
+
}: AppShellSheetProps = $props();
|
|
74
|
+
|
|
75
|
+
const shell = useAppShell('Sheet');
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<div
|
|
79
|
+
bind:this={ref}
|
|
80
|
+
data-slot="app-shell-sheet"
|
|
81
|
+
data-flush={flush || undefined}
|
|
82
|
+
{...rest}
|
|
83
|
+
{...attrs(
|
|
84
|
+
[
|
|
85
|
+
styles.sheet,
|
|
86
|
+
shared.edged,
|
|
87
|
+
flush && [styles.flush, !shell.bar && styles.flushTop],
|
|
88
|
+
shell.narrow && [styles.narrow, flush && styles.flushNarrow],
|
|
89
|
+
sx
|
|
90
|
+
],
|
|
91
|
+
className
|
|
92
|
+
)}
|
|
93
|
+
>
|
|
94
|
+
{@render children?.()}
|
|
95
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Sx } from '../../internal/sx.js';
|
|
4
|
+
export type AppShellSheetProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Fills the window to its edges, with no gutter, corner or edge of its own. The
|
|
7
|
+
* sidebar takes the page's colour, and what is beside it stays raised.
|
|
8
|
+
*/
|
|
9
|
+
flush?: boolean;
|
|
10
|
+
sx?: Sx;
|
|
11
|
+
ref?: HTMLDivElement | null;
|
|
12
|
+
/** An AppShell.Sidebar, an AppShell.Main and, if you like, an AppShell.Panel. */
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
};
|
|
15
|
+
declare const AppShellSheet: import("svelte").Component<AppShellSheetProps, {}, "ref">;
|
|
16
|
+
type AppShellSheet = ReturnType<typeof AppShellSheet>;
|
|
17
|
+
export default AppShellSheet;
|