@diegopluna/narvi 0.1.0 → 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 +102 -41
- package/dist/base.css +2 -2
- 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 +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 +17 -16
- 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 +37 -61
- 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 +91 -19
- 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 +219 -40
- package/dist/components/button/Button.svelte.d.ts +38 -2
- package/dist/components/card/Card.svelte +15 -26
- package/dist/components/change-stats/ChangeStats.svelte +1 -2
- package/dist/components/changes-summary/ChangesSummary.svelte +14 -15
- package/dist/components/checkbox/Checkbox.svelte +18 -15
- package/dist/components/checkbox/Checkbox.svelte.d.ts +5 -0
- package/dist/components/code/Code.svelte +1 -2
- package/dist/components/collapsible/CollapsibleTrigger.svelte +2 -2
- package/dist/components/command/CommandItem.svelte +1 -1
- package/dist/components/command/styles.d.ts +3 -2
- package/dist/components/command/styles.js +13 -10
- package/dist/components/composer/ComposerAttachButton.svelte +1 -1
- package/dist/components/composer/ComposerAttachment.svelte +9 -12
- package/dist/components/composer/ComposerModelPicker.svelte +18 -20
- package/dist/components/composer/ComposerRoot.svelte +8 -7
- package/dist/components/composer/ComposerSubmit.svelte +8 -15
- package/dist/components/composer/ComposerTextarea.svelte +1 -1
- package/dist/components/composer/ComposerToggle.svelte +9 -11
- 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 +3 -3
- package/dist/components/dialog/ConfirmDialog.svelte +1 -1
- package/dist/components/dialog/styles.d.ts +2 -3
- package/dist/components/dialog/styles.js +5 -6
- 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/heading/Heading.svelte +2 -2
- package/dist/components/kbd/Kbd.svelte +12 -7
- package/dist/components/link/Link.svelte +7 -3
- 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 +22 -2
- package/dist/components/message/MessageAction.svelte.d.ts +9 -0
- package/dist/components/message/MessageContent.svelte +2 -3
- package/dist/components/message/MessageCopy.svelte +62 -3
- 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/MessageTime.svelte +1 -1
- package/dist/components/notice/Notice.svelte +14 -10
- package/dist/components/plan/Plan.svelte +22 -17
- package/dist/components/progress/Progress.svelte +31 -33
- package/dist/components/questionnaire/Questionnaire.svelte +19 -22
- package/dist/components/queued-message/QueuedMessage.svelte +14 -7
- package/dist/components/rail/RailItem.svelte +37 -34
- 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 +2 -2
- package/dist/components/resize-handle/ResizeHandle.svelte +2 -3
- package/dist/components/segmented/SegmentedControl.svelte +7 -8
- 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/shimmer/Shimmer.svelte +34 -21
- 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 +36 -32
- 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 +26 -32
- 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 +11 -10
- package/dist/components/spinner/Spinner.svelte +4 -11
- package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
- package/dist/components/suggestions/SuggestionsItem.svelte +5 -5
- package/dist/components/switch/Switch.svelte +9 -14
- 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 +13 -9
- package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
- package/dist/components/text/Text.svelte +31 -23
- package/dist/components/text/Text.svelte.d.ts +8 -4
- package/dist/components/toast/Toaster.svelte +5 -5
- package/dist/components/tool/ToolContent.svelte +3 -8
- package/dist/components/tool/ToolSection.svelte +4 -5
- package/dist/components/tool/ToolTrigger.svelte +10 -9
- package/dist/components/tooltip/TooltipContent.svelte +3 -3
- package/dist/components/work-fold/WorkFold.svelte +5 -9
- package/dist/index.d.ts +16 -8
- package/dist/index.js +17 -10
- package/dist/internal/Code.svelte +3 -4
- 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 +20 -17
- package/dist/internal/layer.d.ts +3 -5
- package/dist/internal/layer.js +10 -12
- 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/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 +1 -1
- package/dist/internal/toggle.d.ts +1 -2
- package/dist/internal/toggle.js +8 -12
- 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/preset.d.ts +40 -16
- package/dist/preset.js +169 -51
- package/dist/tokens.stylex.d.ts +55 -37
- package/dist/tokens.stylex.js +107 -62
- package/dist/typography.d.ts +48 -0
- package/dist/typography.js +55 -0
- package/dist/vite.d.ts +7 -1
- package/dist/vite.js +27 -2
- package/package.json +53 -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
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The first column of the sheet: a Sidebar.Header, the list and a footer. Folded
|
|
3
|
+
away, it gives its room to the page and the rail stays. On a narrow window it
|
|
4
|
+
is a drawer over the page, beside the rail.
|
|
5
|
+
-->
|
|
1
6
|
<script lang="ts" module>
|
|
2
7
|
import * as stylex from '@stylexjs/stylex';
|
|
3
8
|
import { tick, type Snippet } from 'svelte';
|
|
@@ -10,12 +15,8 @@
|
|
|
10
15
|
export type AppShellSidebarProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
11
16
|
/** Names the region: "Threads", "Projects". */
|
|
12
17
|
label?: string;
|
|
13
|
-
/** A Sidebar.Header, across the full width, above the rail. */
|
|
14
|
-
header?: Snippet;
|
|
15
|
-
/** A Rail, the narrow column of icons that stays when the sidebar collapses. */
|
|
16
|
-
rail?: Snippet;
|
|
17
18
|
sx?: Sx;
|
|
18
|
-
/** Sidebar.Content and Sidebar.Footer. */
|
|
19
|
+
/** A Sidebar.Header, a Sidebar.Content and a Sidebar.Footer. */
|
|
19
20
|
children?: Snippet;
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -27,35 +28,39 @@
|
|
|
27
28
|
position: 'relative',
|
|
28
29
|
zIndex: 1,
|
|
29
30
|
display: 'flex',
|
|
30
|
-
flexDirection: 'column',
|
|
31
31
|
flexShrink: 0,
|
|
32
|
+
minHeight: 0,
|
|
32
33
|
overflow: 'clip',
|
|
33
34
|
color: colors.text
|
|
34
35
|
},
|
|
35
36
|
wide: {
|
|
36
|
-
width: '
|
|
37
|
+
width: 'var(--narvi-sidebar-width)',
|
|
38
|
+
// A flush sheet gives it the page's colour; on a sheet with an edge it has none
|
|
39
|
+
backgroundColor: 'var(--narvi-sidebar-surface, transparent)',
|
|
37
40
|
transitionProperty: { default: 'none', [media.motion]: 'width' },
|
|
38
41
|
transitionDuration: motion.slow,
|
|
39
42
|
transitionTimingFunction: motion.easeInOut
|
|
40
43
|
},
|
|
41
44
|
collapsed: { width: 0 },
|
|
42
|
-
|
|
43
|
-
// Narrow: a drawer over the page, from the start edge
|
|
45
|
+
// Narrow: a drawer over the page, from the start edge, after the rail
|
|
44
46
|
drawer: {
|
|
45
47
|
position: 'fixed',
|
|
46
48
|
insetBlock: 0,
|
|
47
|
-
insetInlineStart:
|
|
49
|
+
insetInlineStart: 'var(--narvi-rail-current, 0px)',
|
|
48
50
|
zIndex: 40,
|
|
49
|
-
width: 'min(
|
|
50
|
-
backgroundColor: colors.
|
|
51
|
-
boxShadow: `0 24px 64px -12px
|
|
52
|
-
translate: {
|
|
51
|
+
width: 'min(var(--narvi-sidebar-width), calc(86vw - var(--narvi-rail-current, 0px)))',
|
|
52
|
+
backgroundColor: colors.bgRaised,
|
|
53
|
+
boxShadow: `0 24px 64px -12px ${colors.shadow}`,
|
|
54
|
+
translate: {
|
|
55
|
+
default: 'calc(-100% - var(--narvi-rail-current, 0px)) 0',
|
|
56
|
+
':dir(rtl)': 'calc(100% + var(--narvi-rail-current, 0px)) 0'
|
|
57
|
+
},
|
|
53
58
|
// Hidden only once it has slid away; shown at once when it opens, so
|
|
54
59
|
// focus can move into it on the first frame
|
|
55
60
|
visibility: 'hidden',
|
|
56
61
|
transitionProperty: { default: 'visibility', [media.motion]: 'translate, visibility' },
|
|
57
|
-
transitionDuration: { default: '0s', [media.motion]:
|
|
58
|
-
transitionDelay: { default: '0s', [media.motion]:
|
|
62
|
+
transitionDuration: { default: '0s', [media.motion]: `${motion.slow}, 0s` },
|
|
63
|
+
transitionDelay: { default: '0s', [media.motion]: `0s, ${motion.slow}` },
|
|
59
64
|
transitionTimingFunction: DRAWER
|
|
60
65
|
},
|
|
61
66
|
drawerOpen: {
|
|
@@ -67,38 +72,33 @@
|
|
|
67
72
|
position: 'fixed',
|
|
68
73
|
inset: 0,
|
|
69
74
|
zIndex: 39,
|
|
70
|
-
backgroundColor:
|
|
75
|
+
backgroundColor: colors.scrim,
|
|
71
76
|
opacity: { default: 1, '@starting-style': 0 },
|
|
72
77
|
transitionProperty: 'opacity',
|
|
73
78
|
transitionDuration: motion.slow,
|
|
74
79
|
transitionTimingFunction: motion.easeOut
|
|
75
80
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
transitionDuration: motion.fast,
|
|
80
|
-
transitionTimingFunction: 'ease'
|
|
81
|
-
},
|
|
82
|
-
// Folded to the rail, the header has no room; it steps out rather than being cut
|
|
83
|
-
headerHidden: { opacity: 0, visibility: 'hidden' },
|
|
84
|
-
body: { display: 'flex', flexGrow: 1, minHeight: 0 },
|
|
85
|
-
rail: { display: 'flex', flexShrink: 0, width: 'var(--narvi-rail-width)' },
|
|
86
|
-
// The column keeps its width while the sidebar narrows, so its rows are
|
|
87
|
-
// clipped rather than squeezed and reflowed on every frame
|
|
81
|
+
// The column keeps its width while the sidebar narrows, so its rows are clipped
|
|
82
|
+
// rather than squeezed and reflowed on every frame. The hairline that divides it
|
|
83
|
+
// from the page is on the column, so it goes when the sidebar does.
|
|
88
84
|
column: {
|
|
85
|
+
boxSizing: 'border-box',
|
|
89
86
|
display: 'flex',
|
|
90
87
|
flexDirection: 'column',
|
|
91
88
|
flexShrink: 0,
|
|
92
|
-
minHeight: 0
|
|
93
|
-
|
|
89
|
+
minHeight: 0,
|
|
90
|
+
width: 'var(--narvi-sidebar-width)',
|
|
91
|
+
borderInlineEndWidth: '1px',
|
|
92
|
+
borderInlineEndStyle: 'solid',
|
|
93
|
+
borderInlineEndColor: colors.border
|
|
94
|
+
},
|
|
95
|
+
columnDrawer: { width: '100%', borderInlineEndWidth: 0 }
|
|
94
96
|
});
|
|
95
97
|
</script>
|
|
96
98
|
|
|
97
99
|
<script lang="ts">
|
|
98
100
|
let {
|
|
99
101
|
label = 'Sidebar',
|
|
100
|
-
header,
|
|
101
|
-
rail,
|
|
102
102
|
sx,
|
|
103
103
|
class: className,
|
|
104
104
|
children,
|
|
@@ -108,11 +108,6 @@
|
|
|
108
108
|
const shell = useAppShell('Sidebar');
|
|
109
109
|
let element = $state<HTMLElement | null>(null);
|
|
110
110
|
|
|
111
|
-
$effect(() => {
|
|
112
|
-
shell.setRail(!!rail);
|
|
113
|
-
return () => shell.setRail(false);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
111
|
// A drawer takes focus when it opens and gives it back when it closes
|
|
117
112
|
let returnTo: HTMLElement | null = null;
|
|
118
113
|
$effect(() => {
|
|
@@ -137,8 +132,6 @@
|
|
|
137
132
|
returnTo = null;
|
|
138
133
|
}
|
|
139
134
|
});
|
|
140
|
-
|
|
141
|
-
const hidden = $derived(shell.narrow ? !shell.open : !shell.open && !rail);
|
|
142
135
|
</script>
|
|
143
136
|
|
|
144
137
|
<svelte:window
|
|
@@ -155,7 +148,7 @@
|
|
|
155
148
|
bind:this={element}
|
|
156
149
|
id={shell.sidebarId}
|
|
157
150
|
aria-label={label}
|
|
158
|
-
inert={
|
|
151
|
+
inert={!shell.open || undefined}
|
|
159
152
|
data-slot="app-shell-sidebar"
|
|
160
153
|
{...rest}
|
|
161
154
|
{...attrs(
|
|
@@ -163,30 +156,13 @@
|
|
|
163
156
|
styles.sidebar,
|
|
164
157
|
shell.narrow
|
|
165
158
|
? [styles.drawer, shell.open && styles.drawerOpen]
|
|
166
|
-
: [styles.wide, !shell.open &&
|
|
159
|
+
: [styles.wide, !shell.open && styles.collapsed],
|
|
167
160
|
sx
|
|
168
161
|
],
|
|
169
162
|
className
|
|
170
163
|
)}
|
|
171
164
|
>
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
{...stylex.attrs(styles.header, !shell.open && !shell.narrow && styles.headerHidden)}
|
|
175
|
-
inert={!shell.open && !shell.narrow ? true : undefined}
|
|
176
|
-
>
|
|
177
|
-
{@render header()}
|
|
178
|
-
</div>
|
|
179
|
-
{/if}
|
|
180
|
-
<div {...stylex.attrs(styles.body)}>
|
|
181
|
-
{#if rail}
|
|
182
|
-
<div {...stylex.attrs(styles.rail)}>{@render rail()}</div>
|
|
183
|
-
{/if}
|
|
184
|
-
<div
|
|
185
|
-
{...stylex.attrs(styles.column)}
|
|
186
|
-
style:width="var(--narvi-sidebar-width)"
|
|
187
|
-
inert={!shell.open && !shell.narrow ? true : undefined}
|
|
188
|
-
>
|
|
189
|
-
{@render children?.()}
|
|
190
|
-
</div>
|
|
165
|
+
<div {...stylex.attrs(styles.column, shell.narrow && styles.columnDrawer)}>
|
|
166
|
+
{@render children?.()}
|
|
191
167
|
</div>
|
|
192
168
|
</aside>
|
|
@@ -4,12 +4,8 @@ import { type Sx } from '../../internal/sx.js';
|
|
|
4
4
|
export type AppShellSidebarProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
5
5
|
/** Names the region: "Threads", "Projects". */
|
|
6
6
|
label?: string;
|
|
7
|
-
/** A Sidebar.Header, across the full width, above the rail. */
|
|
8
|
-
header?: Snippet;
|
|
9
|
-
/** A Rail, the narrow column of icons that stays when the sidebar collapses. */
|
|
10
|
-
rail?: Snippet;
|
|
11
7
|
sx?: Sx;
|
|
12
|
-
/** Sidebar.Content and Sidebar.Footer. */
|
|
8
|
+
/** A Sidebar.Header, a Sidebar.Content and a Sidebar.Footer. */
|
|
13
9
|
children?: Snippet;
|
|
14
10
|
};
|
|
15
11
|
declare const AppShellSidebar: import("svelte").Component<AppShellSidebarProps, {}, "">;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Shows and hides the sidebar. Put one in the AppShell.Bar. In a shell with no
|
|
3
|
+
bar, put one in the sidebar's head and another, `when="closed"`, in the page's
|
|
4
|
+
header: that one shows only while the sidebar is away, and focus passes
|
|
5
|
+
between the two as the sidebar comes and goes.
|
|
6
|
+
-->
|
|
1
7
|
<script lang="ts" module>
|
|
8
|
+
import { tick, untrack } from 'svelte';
|
|
2
9
|
import type { Sx } from '../../internal/sx.js';
|
|
3
10
|
import Button, { type ButtonProps } from '../button/Button.svelte';
|
|
4
11
|
import { useAppShell } from './context.js';
|
|
@@ -7,6 +14,8 @@
|
|
|
7
14
|
ButtonProps,
|
|
8
15
|
'children' | 'variant' | 'iconOnly' | 'href' | 'ref' | 'onclick'
|
|
9
16
|
> & {
|
|
17
|
+
/** `closed` shows the button only while the sidebar is away: for the page's header in a shell with no bar. */
|
|
18
|
+
when?: 'always' | 'closed';
|
|
10
19
|
showLabel?: string;
|
|
11
20
|
hideLabel?: string;
|
|
12
21
|
sx?: Sx;
|
|
@@ -15,6 +24,7 @@
|
|
|
15
24
|
|
|
16
25
|
<script lang="ts">
|
|
17
26
|
let {
|
|
27
|
+
when = 'always',
|
|
18
28
|
showLabel = 'Show the sidebar',
|
|
19
29
|
hideLabel = 'Hide the sidebar',
|
|
20
30
|
size = 'sm',
|
|
@@ -22,29 +32,58 @@
|
|
|
22
32
|
}: AppShellToggleProps = $props();
|
|
23
33
|
|
|
24
34
|
const shell = useAppShell('Toggle');
|
|
35
|
+
const shown = $derived(when === 'always' || !shell.open);
|
|
36
|
+
let ref = $state<HTMLButtonElement | HTMLAnchorElement | null>(null);
|
|
37
|
+
|
|
38
|
+
// The button that was pressed goes with the sidebar, or goes when it comes back, and
|
|
39
|
+
// focus would fall to the page. The one that takes its place picks it up: the page's
|
|
40
|
+
// when the sidebar closes, the sidebar's own when it opens. Only when the person moved
|
|
41
|
+
// the sidebar: a window that becomes narrow hides it too, and must not move the focus.
|
|
42
|
+
let before: number | undefined;
|
|
43
|
+
$effect(() => {
|
|
44
|
+
const moves = shell.moves;
|
|
45
|
+
const moved = before !== undefined && before !== moves;
|
|
46
|
+
before = moves;
|
|
47
|
+
if (!moved) return;
|
|
48
|
+
const open = untrack(() => shell.open);
|
|
49
|
+
const takes =
|
|
50
|
+
when === 'closed' ? !open : open && !!ref?.closest('[data-slot="app-shell-sidebar"]');
|
|
51
|
+
if (!takes) return;
|
|
52
|
+
tick().then(() =>
|
|
53
|
+
requestAnimationFrame(() => {
|
|
54
|
+
// Lost: on the body, or still on a button the browser has yet to take it from
|
|
55
|
+
const active = document.activeElement;
|
|
56
|
+
if (!active || active === document.body || !active.isConnected || active.closest('[inert]'))
|
|
57
|
+
ref?.focus();
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
});
|
|
25
61
|
</script>
|
|
26
62
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
width="16"
|
|
40
|
-
height="16"
|
|
41
|
-
viewBox="0 0 16 16"
|
|
42
|
-
fill="none"
|
|
43
|
-
stroke="currentColor"
|
|
44
|
-
stroke-width="1.5"
|
|
45
|
-
aria-hidden="true"
|
|
63
|
+
{#if shown}
|
|
64
|
+
<Button
|
|
65
|
+
bind:ref
|
|
66
|
+
variant="ghost"
|
|
67
|
+
{size}
|
|
68
|
+
iconOnly
|
|
69
|
+
aria-label={shell.open ? hideLabel : showLabel}
|
|
70
|
+
aria-expanded={shell.open}
|
|
71
|
+
aria-controls={shell.sidebarId}
|
|
72
|
+
data-slot="app-shell-toggle"
|
|
73
|
+
{...rest}
|
|
74
|
+
onclick={() => shell.toggle()}
|
|
46
75
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
76
|
+
<svg
|
|
77
|
+
width="16"
|
|
78
|
+
height="16"
|
|
79
|
+
viewBox="0 0 16 16"
|
|
80
|
+
fill="none"
|
|
81
|
+
stroke="currentColor"
|
|
82
|
+
stroke-width="1.5"
|
|
83
|
+
aria-hidden="true"
|
|
84
|
+
>
|
|
85
|
+
<rect x="2.25" y="2.75" width="11.5" height="10.5" rx="2" />
|
|
86
|
+
<path d="M6.25 2.75v10.5" />
|
|
87
|
+
</svg>
|
|
88
|
+
</Button>
|
|
89
|
+
{/if}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Sx } from '../../internal/sx.js';
|
|
2
2
|
import { type ButtonProps } from '../button/Button.svelte';
|
|
3
3
|
export type AppShellToggleProps = Omit<ButtonProps, 'children' | 'variant' | 'iconOnly' | 'href' | 'ref' | 'onclick'> & {
|
|
4
|
+
/** `closed` shows the button only while the sidebar is away: for the page's header in a shell with no bar. */
|
|
5
|
+
when?: 'always' | 'closed';
|
|
4
6
|
showLabel?: string;
|
|
5
7
|
hideLabel?: string;
|
|
6
8
|
sx?: Sx;
|
|
@@ -6,8 +6,14 @@ export type AppShellContext = {
|
|
|
6
6
|
readonly sidebarId: string;
|
|
7
7
|
toggle(): void;
|
|
8
8
|
close(): void;
|
|
9
|
+
/** True while the shell has an AppShell.Bar. Without one, the first column's head is the window's. */
|
|
10
|
+
readonly bar: boolean;
|
|
11
|
+
/** @internal Counts the times the person showed or hid the sidebar, as against the window changing size. */
|
|
12
|
+
readonly moves: number;
|
|
9
13
|
/** @internal The sidebar says whether it has a rail, which stays when it collapses. */
|
|
10
14
|
setRail(present: boolean): void;
|
|
15
|
+
/** @internal The bar says it is there, so nothing under it keeps room for the traffic lights. */
|
|
16
|
+
setBar(present: boolean): void;
|
|
11
17
|
};
|
|
12
18
|
export declare function setAppShellContext(context: AppShellContext): void;
|
|
13
19
|
/** The surrounding AppShell, for building parts of your own. */
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
+
import Bar from './AppShellBar.svelte';
|
|
1
2
|
import Header from './AppShellHeader.svelte';
|
|
2
3
|
import Main from './AppShellMain.svelte';
|
|
3
4
|
import Panel from './AppShellPanel.svelte';
|
|
5
|
+
import Panes from './AppShellPanes.svelte';
|
|
6
|
+
import Rail from './AppShellRail.svelte';
|
|
4
7
|
import Root from './AppShellRoot.svelte';
|
|
8
|
+
import Sheet from './AppShellSheet.svelte';
|
|
5
9
|
import Sidebar from './AppShellSidebar.svelte';
|
|
6
10
|
import Toggle from './AppShellToggle.svelte';
|
|
7
|
-
export { Root, Sidebar, Main, Header, Panel, Toggle };
|
|
11
|
+
export { Root, Bar, Rail, Panes, Sheet, Sidebar, Main, Header, Panel, Toggle };
|
|
8
12
|
export { getAppShellContext } from './context.js';
|
|
9
13
|
export type { AppShellContext } from './context.js';
|
|
14
|
+
export type { AppShellBarProps } from './AppShellBar.svelte';
|
|
10
15
|
export type { AppShellHeaderProps } from './AppShellHeader.svelte';
|
|
11
16
|
export type { AppShellMainProps } from './AppShellMain.svelte';
|
|
12
17
|
export type { AppShellPanelProps } from './AppShellPanel.svelte';
|
|
18
|
+
export type { AppShellPanesProps } from './AppShellPanes.svelte';
|
|
19
|
+
export type { AppShellRailProps } from './AppShellRail.svelte';
|
|
13
20
|
export type { AppShellRootProps } from './AppShellRoot.svelte';
|
|
21
|
+
export type { AppShellSheetProps } from './AppShellSheet.svelte';
|
|
14
22
|
export type { AppShellSidebarProps } from './AppShellSidebar.svelte';
|
|
15
23
|
export type { AppShellToggleProps } from './AppShellToggle.svelte';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import Bar from './AppShellBar.svelte';
|
|
1
2
|
import Header from './AppShellHeader.svelte';
|
|
2
3
|
import Main from './AppShellMain.svelte';
|
|
3
4
|
import Panel from './AppShellPanel.svelte';
|
|
5
|
+
import Panes from './AppShellPanes.svelte';
|
|
6
|
+
import Rail from './AppShellRail.svelte';
|
|
4
7
|
import Root from './AppShellRoot.svelte';
|
|
8
|
+
import Sheet from './AppShellSheet.svelte';
|
|
5
9
|
import Sidebar from './AppShellSidebar.svelte';
|
|
6
10
|
import Toggle from './AppShellToggle.svelte';
|
|
7
|
-
export { Root, Sidebar, Main, Header, Panel, Toggle };
|
|
11
|
+
export { Root, Bar, Rail, Panes, Sheet, Sidebar, Main, Header, Panel, Toggle };
|
|
8
12
|
export { getAppShellContext } from './context.js';
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
-->
|
|
7
7
|
<script lang="ts" module>
|
|
8
8
|
import * as stylex from '@stylexjs/stylex';
|
|
9
|
-
import { tick, type Snippet } from 'svelte';
|
|
9
|
+
import { onMount, tick, type Snippet } from 'svelte';
|
|
10
10
|
import Glyph from '../../internal/Glyph.svelte';
|
|
11
11
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
12
12
|
import { colors, font, motion, radius, space } from '../../tokens.stylex.js';
|
|
13
13
|
import { media } from '../../media.stylex.js';
|
|
14
14
|
import Button from '../button/Button.svelte';
|
|
15
|
+
import Kbd from '../kbd/Kbd.svelte';
|
|
15
16
|
|
|
16
17
|
export type ApprovalChoice = {
|
|
17
18
|
value: string;
|
|
@@ -20,6 +21,27 @@
|
|
|
20
21
|
primary?: boolean;
|
|
21
22
|
/** For a choice that refuses, or refuses and stops. */
|
|
22
23
|
tone?: 'default' | 'danger';
|
|
24
|
+
/**
|
|
25
|
+
* Keys that make this choice, shown on its button. `mod` is ⌘ on Apple systems and Ctrl
|
|
26
|
+
* elsewhere, and works from anywhere on the page; `enter` and `escape` on their own work
|
|
27
|
+
* only while focus is in the card, so they never take a key from the composer.
|
|
28
|
+
*/
|
|
29
|
+
shortcut?: ApprovalShortcut;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ApprovalShortcut = 'mod+enter' | 'mod+backspace' | 'enter' | 'escape';
|
|
33
|
+
|
|
34
|
+
const KEY: Record<ApprovalShortcut, string> = {
|
|
35
|
+
'mod+enter': 'Enter',
|
|
36
|
+
'mod+backspace': 'Backspace',
|
|
37
|
+
enter: 'Enter',
|
|
38
|
+
escape: 'Escape'
|
|
39
|
+
};
|
|
40
|
+
const CAP: Record<ApprovalShortcut, string> = {
|
|
41
|
+
'mod+enter': '⏎',
|
|
42
|
+
'mod+backspace': '⌫',
|
|
43
|
+
enter: '⏎',
|
|
44
|
+
escape: 'Esc'
|
|
23
45
|
};
|
|
24
46
|
|
|
25
47
|
export type ApprovalAnswer = {
|
|
@@ -55,9 +77,8 @@
|
|
|
55
77
|
flexDirection: 'column',
|
|
56
78
|
gap: space.x3,
|
|
57
79
|
padding: '0.875rem',
|
|
58
|
-
borderRadius: radius.
|
|
80
|
+
borderRadius: radius.panel,
|
|
59
81
|
backgroundColor: `color-mix(in oklab, ${colors.warning} 7%, ${colors.bgRaised})`,
|
|
60
|
-
boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.warning} 40%, transparent)`,
|
|
61
82
|
opacity: { default: 1, '@starting-style': 0 },
|
|
62
83
|
translate: {
|
|
63
84
|
default: null,
|
|
@@ -67,11 +88,11 @@
|
|
|
67
88
|
transitionDuration: motion.slow,
|
|
68
89
|
transitionTimingFunction: motion.easeOut
|
|
69
90
|
},
|
|
70
|
-
title: { margin: 0, fontSize: font.
|
|
91
|
+
title: { margin: 0, fontSize: font.sizeBody, fontWeight: font.weightSemibold },
|
|
71
92
|
reason: {
|
|
72
93
|
margin: 0,
|
|
73
94
|
color: colors.textMuted,
|
|
74
|
-
fontSize: font.
|
|
95
|
+
fontSize: font.sizeBody,
|
|
75
96
|
lineHeight: font.leadingNormal
|
|
76
97
|
},
|
|
77
98
|
command: {
|
|
@@ -79,11 +100,10 @@
|
|
|
79
100
|
paddingBlock: '0.5rem',
|
|
80
101
|
paddingInline: '0.625rem',
|
|
81
102
|
overflowX: 'auto',
|
|
82
|
-
borderRadius: radius.
|
|
83
|
-
backgroundColor: colors.
|
|
84
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}`,
|
|
103
|
+
borderRadius: radius.control,
|
|
104
|
+
backgroundColor: colors.fillSunken,
|
|
85
105
|
fontFamily: font.mono,
|
|
86
|
-
fontSize: font.
|
|
106
|
+
fontSize: font.sizeMeta,
|
|
87
107
|
whiteSpace: 'pre-wrap',
|
|
88
108
|
overflowWrap: 'anywhere',
|
|
89
109
|
userSelect: 'text'
|
|
@@ -95,8 +115,7 @@
|
|
|
95
115
|
// Stated, not left to the browser: a reset such as base.css removes markers
|
|
96
116
|
listStyleType: 'disc',
|
|
97
117
|
color: colors.textMuted,
|
|
98
|
-
|
|
99
|
-
fontSize: font.sizeXs,
|
|
118
|
+
fontSize: font.sizeCaption,
|
|
100
119
|
lineHeight: 1.7
|
|
101
120
|
},
|
|
102
121
|
actions: { display: 'flex', flexWrap: 'wrap', gap: space.x2 },
|
|
@@ -106,8 +125,8 @@
|
|
|
106
125
|
gap: '0.5rem',
|
|
107
126
|
minWidth: 0,
|
|
108
127
|
color: colors.textMuted,
|
|
109
|
-
fontSize: font.
|
|
110
|
-
borderRadius: radius.
|
|
128
|
+
fontSize: font.sizeMeta,
|
|
129
|
+
borderRadius: radius.chip,
|
|
111
130
|
outlineStyle: 'solid',
|
|
112
131
|
outlineWidth: { default: 0, ':focus-visible': '2px' },
|
|
113
132
|
outlineColor: colors.focusRing,
|
|
@@ -121,8 +140,9 @@
|
|
|
121
140
|
overflow: 'hidden',
|
|
122
141
|
textOverflow: 'ellipsis',
|
|
123
142
|
whiteSpace: 'nowrap',
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
// A `<code>`, in the text's own face
|
|
144
|
+
fontFamily: 'inherit',
|
|
145
|
+
fontSize: font.sizeCaption
|
|
126
146
|
}
|
|
127
147
|
});
|
|
128
148
|
</script>
|
|
@@ -158,6 +178,41 @@
|
|
|
158
178
|
keepFocus = false;
|
|
159
179
|
tick().then(() => line?.focus());
|
|
160
180
|
});
|
|
181
|
+
|
|
182
|
+
// ⌘ where there is one, Ctrl elsewhere. Found once the page is in a browser.
|
|
183
|
+
let apple = $state(true);
|
|
184
|
+
onMount(() => {
|
|
185
|
+
apple = /Mac|iPhone|iPad/.test(navigator.platform);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
function onkeydown(event: KeyboardEvent) {
|
|
189
|
+
if (answer || event.defaultPrevented || event.repeat || !card) return;
|
|
190
|
+
// With several cards waiting, the first one on the page answers
|
|
191
|
+
if (document.querySelector('[data-slot="approval"][data-shortcuts]') !== card) return;
|
|
192
|
+
const mod = event.metaKey || event.ctrlKey;
|
|
193
|
+
const inside = card.contains(document.activeElement);
|
|
194
|
+
// Words already typed are being sent: the key is the field's, not the card's
|
|
195
|
+
const target = event.target;
|
|
196
|
+
const typed =
|
|
197
|
+
(target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement) &&
|
|
198
|
+
target.value.trim() !== '';
|
|
199
|
+
const choice = choices.find((choice) => {
|
|
200
|
+
if (!choice.shortcut || event.key !== KEY[choice.shortcut]) return false;
|
|
201
|
+
return choice.shortcut.startsWith('mod+') ? mod && !typed : !mod && inside;
|
|
202
|
+
});
|
|
203
|
+
if (!choice) return;
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
choose(choice.value);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Heard before the composer hears it: with nothing typed, ⌘⏎ answers the card and
|
|
210
|
+
// does not also send an empty message
|
|
211
|
+
$effect(() => {
|
|
212
|
+
if (answer || !choices.some((choice) => choice.shortcut)) return;
|
|
213
|
+
window.addEventListener('keydown', onkeydown, true);
|
|
214
|
+
return () => window.removeEventListener('keydown', onkeydown, true);
|
|
215
|
+
});
|
|
161
216
|
</script>
|
|
162
217
|
|
|
163
218
|
{#if answer}
|
|
@@ -178,9 +233,7 @@
|
|
|
178
233
|
/>{/if}
|
|
179
234
|
</span>
|
|
180
235
|
<span>{answer.label}</span>
|
|
181
|
-
{#if subject ?? command}<
|
|
182
|
-
>{subject ?? command}</code
|
|
183
|
-
>{/if}
|
|
236
|
+
{#if subject ?? command}<code {...stylex.attrs(styles.subject)}>{subject ?? command}</code>{/if}
|
|
184
237
|
</p>
|
|
185
238
|
{:else}
|
|
186
239
|
<section
|
|
@@ -188,6 +241,7 @@
|
|
|
188
241
|
role="group"
|
|
189
242
|
aria-labelledby="{uid}-title"
|
|
190
243
|
data-slot="approval"
|
|
244
|
+
data-shortcuts={choices.some((choice) => choice.shortcut) || undefined}
|
|
191
245
|
{...attrs([styles.card, sx], className)}
|
|
192
246
|
>
|
|
193
247
|
<p id="{uid}-title" {...stylex.attrs(styles.title)}>{title}</p>
|
|
@@ -206,10 +260,28 @@
|
|
|
206
260
|
{#each choices as choice (choice.value)}
|
|
207
261
|
<Button
|
|
208
262
|
size="sm"
|
|
209
|
-
variant={choice.primary
|
|
263
|
+
variant={choice.primary
|
|
264
|
+
? 'primary'
|
|
265
|
+
: choice.tone === 'danger'
|
|
266
|
+
? 'danger-outline'
|
|
267
|
+
: 'ghost'}
|
|
268
|
+
aria-keyshortcuts={choice.shortcut
|
|
269
|
+
? choice.shortcut
|
|
270
|
+
.replace('mod', apple ? 'Meta' : 'Control')
|
|
271
|
+
.replace('escape', 'Escape')
|
|
272
|
+
.replace('enter', 'Enter')
|
|
273
|
+
.replace('backspace', 'Backspace')
|
|
274
|
+
: undefined}
|
|
210
275
|
onclick={() => choose(choice.value)}
|
|
211
276
|
>
|
|
212
277
|
{choice.label}
|
|
278
|
+
{#if choice.shortcut}
|
|
279
|
+
<Kbd aria-hidden="true"
|
|
280
|
+
>{choice.shortcut.startsWith('mod+') ? (apple ? '⌘' : 'Ctrl ') : ''}{CAP[
|
|
281
|
+
choice.shortcut
|
|
282
|
+
]}</Kbd
|
|
283
|
+
>
|
|
284
|
+
{/if}
|
|
213
285
|
</Button>
|
|
214
286
|
{/each}
|
|
215
287
|
</div>
|
|
@@ -7,7 +7,14 @@ export type ApprovalChoice = {
|
|
|
7
7
|
primary?: boolean;
|
|
8
8
|
/** For a choice that refuses, or refuses and stops. */
|
|
9
9
|
tone?: 'default' | 'danger';
|
|
10
|
+
/**
|
|
11
|
+
* Keys that make this choice, shown on its button. `mod` is ⌘ on Apple systems and Ctrl
|
|
12
|
+
* elsewhere, and works from anywhere on the page; `enter` and `escape` on their own work
|
|
13
|
+
* only while focus is in the card, so they never take a key from the composer.
|
|
14
|
+
*/
|
|
15
|
+
shortcut?: ApprovalShortcut;
|
|
10
16
|
};
|
|
17
|
+
export type ApprovalShortcut = 'mod+enter' | 'mod+backspace' | 'enter' | 'escape';
|
|
11
18
|
export type ApprovalAnswer = {
|
|
12
19
|
/** What was decided, in words: "Approved", "Declined". */
|
|
13
20
|
label: string;
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
// Initials sit on the person's own colour: dark enough for white text at every hue
|
|
23
23
|
initials: {
|
|
24
|
-
|
|
25
|
-
'linear-gradient(140deg, oklch(0.56 0.075 var(--narvi-avatar-hue, 255)), oklch(0.3 0.06 var(--narvi-avatar-hue, 255)))',
|
|
24
|
+
backgroundColor: 'oklch(0.44 0.07 var(--narvi-avatar-hue, 255))',
|
|
26
25
|
color: '#fff',
|
|
27
26
|
forcedColorAdjust: 'none'
|
|
28
27
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
display: 'inline-grid',
|
|
28
28
|
flexShrink: 0,
|
|
29
29
|
overflow: 'hidden',
|
|
30
|
-
borderRadius: radius.
|
|
30
|
+
borderRadius: radius.pill,
|
|
31
31
|
fontFamily: font.body,
|
|
32
32
|
fontWeight: font.weightSemibold,
|
|
33
33
|
lineHeight: 1,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
const sizes = stylex.create({
|
|
55
55
|
sm: { width: '1.5rem', height: '1.5rem', fontSize: '0.625rem' },
|
|
56
56
|
md: { width: '1.75rem', height: '1.75rem', fontSize: '0.6875rem' },
|
|
57
|
-
lg: { width: '2.25rem', height: '2.25rem', fontSize: font.
|
|
57
|
+
lg: { width: '2.25rem', height: '2.25rem', fontSize: font.sizeMeta },
|
|
58
58
|
xl: { width: '3.5rem', height: '3.5rem', fontSize: '1.125rem' }
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
minHeight: '1.375rem',
|
|
27
27
|
paddingInline: '0.5rem',
|
|
28
28
|
// A pill at the default scale, squarer when it is sharp
|
|
29
|
-
borderRadius: radius.
|
|
30
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
29
|
+
borderRadius: radius.card,
|
|
30
|
+
boxShadow: `inset 0 0 0 1px ${colors.borderStrong}`,
|
|
31
31
|
color: colors.textMuted,
|
|
32
32
|
fontFamily: font.body,
|
|
33
|
-
fontSize: font.
|
|
33
|
+
fontSize: font.sizeCaption,
|
|
34
34
|
fontWeight: font.weightMedium,
|
|
35
35
|
fontVariantNumeric: 'tabular-nums',
|
|
36
36
|
lineHeight: 1,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
flexShrink: 0,
|
|
42
42
|
width: '0.375rem',
|
|
43
43
|
height: '0.375rem',
|
|
44
|
-
borderRadius: radius.
|
|
44
|
+
borderRadius: radius.pill,
|
|
45
45
|
forcedColorAdjust: 'none'
|
|
46
46
|
},
|
|
47
47
|
lit: { color: colors.text }
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
const dots = stylex.create({
|
|
51
51
|
neutral: { backgroundColor: colors.textSubtle },
|
|
52
|
-
accent: { backgroundColor: colors.
|
|
52
|
+
accent: { backgroundColor: colors.accent },
|
|
53
53
|
success: { backgroundColor: colors.success },
|
|
54
54
|
warning: { backgroundColor: colors.warning },
|
|
55
55
|
danger: { backgroundColor: colors.danger }
|