@diegopluna/narvi 0.3.1 → 0.3.3
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/dist/components/activity/ActivityIcon.svelte +54 -0
- package/dist/components/activity/ActivityIcon.svelte.d.ts +24 -0
- package/dist/components/activity/ActivityStep.svelte +47 -13
- package/dist/components/activity/ActivityStep.svelte.d.ts +13 -4
- package/dist/components/activity/ActivityThought.svelte +24 -5
- package/dist/components/activity/ActivityThought.svelte.d.ts +12 -2
- package/dist/components/activity/index.d.ts +3 -1
- package/dist/components/activity/index.js +2 -1
- package/dist/components/app-shell/AppShellHeader.svelte +18 -4
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +5 -0
- package/dist/components/app-shell/AppShellMain.svelte +5 -1
- package/dist/components/approval/Approval.svelte +14 -1
- package/dist/components/approval/Approval.svelte.d.ts +5 -0
- package/dist/components/badge/Badge.svelte +19 -2
- package/dist/components/badge/Badge.svelte.d.ts +4 -1
- package/dist/components/button/Button.svelte +63 -13
- package/dist/components/composer/ComposerModelPicker.svelte +80 -13
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +23 -6
- package/dist/components/composer/ComposerRoot.svelte +51 -12
- package/dist/components/composer/ComposerRoot.svelte.d.ts +16 -0
- package/dist/components/composer/ComposerSubmit.svelte +19 -5
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +3 -1
- package/dist/components/composer/ComposerToggle.svelte +18 -4
- package/dist/components/composer/ComposerToggle.svelte.d.ts +2 -0
- package/dist/components/composer/ComposerTray.svelte +17 -3
- package/dist/components/composer/ComposerTray.svelte.d.ts +5 -0
- package/dist/components/composer/context.d.ts +4 -1
- package/dist/components/dialog/DialogContent.svelte +22 -12
- package/dist/components/dialog/DialogContent.svelte.d.ts +10 -0
- package/dist/components/divider/Divider.svelte +56 -14
- package/dist/components/divider/Divider.svelte.d.ts +13 -3
- package/dist/components/empty-state/EmptyState.svelte +12 -2
- package/dist/components/empty-state/EmptyState.svelte.d.ts +6 -0
- package/dist/components/heading/Heading.svelte +15 -0
- package/dist/components/heading/Heading.svelte.d.ts +6 -0
- package/dist/components/hover-card/HoverCardContent.svelte +19 -3
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -0
- package/dist/components/input/Input.svelte +13 -3
- package/dist/components/input/Input.svelte.d.ts +10 -2
- package/dist/components/markdown/Markdown.svelte +22 -2
- package/dist/components/markdown/MarkdownDiagram.svelte +33 -2
- package/dist/components/markdown/MarkdownFile.svelte +56 -10
- package/dist/components/markdown/MarkdownMath.svelte +6 -0
- package/dist/components/markdown/MarkdownTable.svelte +3 -4
- package/dist/components/markdown/context.d.ts +6 -0
- package/dist/components/markdown/labels.d.ts +7 -0
- package/dist/components/markdown/labels.js +2 -0
- package/dist/components/menu/ContextMenuTrigger.svelte +14 -2
- package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +10 -0
- package/dist/components/menu/MenuCheckboxItem.svelte +50 -7
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +16 -0
- package/dist/components/menu/MenuContent.svelte +10 -2
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuGroup.svelte +16 -0
- package/dist/components/menu/MenuGroup.svelte.d.ts +6 -0
- package/dist/components/menu/MenuItem.svelte +17 -2
- package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
- package/dist/components/menu/MenuLabel.svelte +22 -8
- package/dist/components/menu/MenuRadioGroup.svelte +16 -0
- package/dist/components/menu/MenuRadioGroup.svelte.d.ts +6 -0
- package/dist/components/menu/MenuSubContent.svelte +10 -2
- package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuSubTrigger.svelte +19 -2
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -0
- package/dist/components/menu/group.d.ts +2 -0
- package/dist/components/menu/group.js +9 -0
- package/dist/components/menu/index.d.ts +4 -2
- package/dist/components/menu/index.js +2 -2
- package/dist/components/message/MessageBubble.svelte +40 -0
- package/dist/components/message/MessageBubble.svelte.d.ts +12 -0
- package/dist/components/message/MessageContent.svelte +23 -14
- package/dist/components/message/MessageContent.svelte.d.ts +6 -0
- package/dist/components/message/MessageCopy.svelte +27 -15
- package/dist/components/message/MessageCopy.svelte.d.ts +9 -2
- package/dist/components/message/MessageRoot.svelte +20 -3
- package/dist/components/message/MessageRoot.svelte.d.ts +6 -0
- package/dist/components/message/context.d.ts +2 -0
- package/dist/components/message/index.d.ts +4 -1
- package/dist/components/message/index.js +3 -2
- package/dist/components/message/styles.d.ts +30 -0
- package/dist/components/message/styles.js +24 -0
- package/dist/components/notice/Notice.svelte +3 -3
- package/dist/components/popover/PopoverContent.svelte +27 -3
- package/dist/components/popover/PopoverContent.svelte.d.ts +18 -0
- package/dist/components/questionnaire/Questionnaire.svelte +103 -19
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +13 -1
- package/dist/components/queued-message/QueuedMessage.svelte +44 -6
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +12 -1
- package/dist/components/select/Select.svelte +18 -2
- package/dist/components/select/Select.svelte.d.ts +7 -0
- package/dist/components/sidebar/SidebarContent.svelte +59 -13
- package/dist/components/sidebar/SidebarContent.svelte.d.ts +6 -0
- package/dist/components/sidebar/SidebarFolder.svelte +29 -2
- package/dist/components/sidebar/SidebarGroup.svelte +50 -7
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +10 -1
- package/dist/components/sidebar/SidebarItem.svelte +136 -21
- package/dist/components/sidebar/SidebarItem.svelte.d.ts +22 -2
- package/dist/components/sidebar/SidebarSwitcher.svelte +18 -2
- package/dist/components/sidebar/SidebarSwitcher.svelte.d.ts +2 -0
- package/dist/components/sidebar/fold.d.ts +12 -0
- package/dist/components/sidebar/fold.js +8 -0
- package/dist/components/status-indicator/StatusDot.svelte +90 -0
- package/dist/components/status-indicator/StatusDot.svelte.d.ts +18 -0
- package/dist/components/toast/Toaster.svelte +1 -1
- package/dist/components/toggle/Toggle.svelte +12 -2
- package/dist/components/toggle/Toggle.svelte.d.ts +11 -1
- package/dist/components/toggle-group/ToggleGroupItem.svelte +10 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +7 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +3 -1
- package/dist/components/toggle-group/context.d.ts +2 -1
- package/dist/components/tooltip/TooltipContent.svelte +13 -1
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +10 -0
- package/dist/components/work-fold/WorkFold.svelte +13 -4
- package/dist/components/work-fold/WorkFold.svelte.d.ts +2 -1
- package/dist/focus-ring.d.ts +29 -0
- package/dist/focus-ring.js +42 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -2
- package/dist/internal/Collapse.svelte +15 -2
- package/dist/internal/Glyph.svelte +28 -0
- package/dist/internal/Glyph.svelte.d.ts +5 -0
- package/dist/internal/Tile.svelte +3 -2
- package/dist/internal/layer.d.ts +23 -0
- package/dist/internal/layer.js +19 -0
- package/dist/internal/toggle.d.ts +8 -1
- package/dist/internal/toggle.js +20 -2
- package/dist/markdown/file-paths.d.ts +7 -0
- package/dist/markdown/file-paths.js +29 -0
- package/dist/markdown/files.d.ts +22 -2
- package/dist/markdown/files.js +45 -14
- package/dist/tokens.stylex.d.ts +3 -0
- package/dist/tokens.stylex.js +5 -1
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +87 -8
- package/skills/building-ui/references/components.md +39 -38
- package/skills/markdown/SKILL.md +22 -6
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +10 -3
- package/skills/theming/SKILL.md +11 -4
|
@@ -38,6 +38,34 @@
|
|
|
38
38
|
steer: ['M3.5 3v5.5a2 2 0 0 0 2 2h7', 'M10 8l2.5 2.5L10 13'],
|
|
39
39
|
search: ['M11.5 7a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Z', 'm10.5 10.5 3 3'],
|
|
40
40
|
file: ['M4.25 2.25h4.5l3 3v8.5h-7.5Z', 'M8.75 2.25v3h3'],
|
|
41
|
+
// Files by kind: the page, with what it holds on it
|
|
42
|
+
fileCode: [
|
|
43
|
+
'M4.25 2.25h4.5l3 3v8.5h-7.5Z',
|
|
44
|
+
'M8.75 2.25v3h3',
|
|
45
|
+
'M7 8.5 5.75 9.75 7 11',
|
|
46
|
+
'M9 8.5l1.25 1.25L9 11'
|
|
47
|
+
],
|
|
48
|
+
fileText: [
|
|
49
|
+
'M4.25 2.25h4.5l3 3v8.5h-7.5Z',
|
|
50
|
+
'M8.75 2.25v3h3',
|
|
51
|
+
'M6.25 8.5h3.5',
|
|
52
|
+
'M6.25 10.75h3.5'
|
|
53
|
+
],
|
|
54
|
+
fileData: [
|
|
55
|
+
'M4.25 2.25h4.5l3 3v8.5h-7.5Z',
|
|
56
|
+
'M8.75 2.25v3h3',
|
|
57
|
+
'M7 8c-.5 0-.75.3-.75.75v.4c0 .4-.25.6-.6.6.35 0 .6.2.6.6v.4c0 .45.25.75.75.75',
|
|
58
|
+
'M9 8c.5 0 .75.3.75.75v.4c0 .4.25.6.6.6-.35 0-.6.2-.6.6v.4c0 .45-.25.75-.75.75'
|
|
59
|
+
],
|
|
60
|
+
fileImage: [
|
|
61
|
+
'M4.25 2.25h4.5l3 3v8.5h-7.5Z',
|
|
62
|
+
'M8.75 2.25v3h3',
|
|
63
|
+
'm4.25 12.5 2.25-2.25 1.75 1.75 1.25-1.25 2.25 2.25',
|
|
64
|
+
'M6.75 7.75h.01'
|
|
65
|
+
],
|
|
66
|
+
folder: [
|
|
67
|
+
'M2.25 4.5c0-.69.56-1.25 1.25-1.25h2.6c.4 0 .77.19 1 .51l.75 1.04c.24.32.61.5 1 .5h3.65c.69 0 1.25.56 1.25 1.25v5.7c0 .69-.56 1.25-1.25 1.25h-9c-.69 0-1.25-.56-1.25-1.25Z'
|
|
68
|
+
],
|
|
41
69
|
selector: ['M5.25 6 8 3.25 10.75 6', 'M5.25 10 8 12.75 10.75 10'],
|
|
42
70
|
// A thought: a bulb with its filament
|
|
43
71
|
bulb: [
|
|
@@ -21,6 +21,11 @@ declare const paths: {
|
|
|
21
21
|
readonly steer: readonly ["M3.5 3v5.5a2 2 0 0 0 2 2h7", "M10 8l2.5 2.5L10 13"];
|
|
22
22
|
readonly search: readonly ["M11.5 7a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Z", "m10.5 10.5 3 3"];
|
|
23
23
|
readonly file: readonly ["M4.25 2.25h4.5l3 3v8.5h-7.5Z", "M8.75 2.25v3h3"];
|
|
24
|
+
readonly fileCode: readonly ["M4.25 2.25h4.5l3 3v8.5h-7.5Z", "M8.75 2.25v3h3", "M7 8.5 5.75 9.75 7 11", "M9 8.5l1.25 1.25L9 11"];
|
|
25
|
+
readonly fileText: readonly ["M4.25 2.25h4.5l3 3v8.5h-7.5Z", "M8.75 2.25v3h3", "M6.25 8.5h3.5", "M6.25 10.75h3.5"];
|
|
26
|
+
readonly fileData: readonly ["M4.25 2.25h4.5l3 3v8.5h-7.5Z", "M8.75 2.25v3h3", "M7 8c-.5 0-.75.3-.75.75v.4c0 .4-.25.6-.6.6.35 0 .6.2.6.6v.4c0 .45.25.75.75.75", "M9 8c.5 0 .75.3.75.75v.4c0 .4.25.6.6.6-.35 0-.6.2-.6.6v.4c0 .45-.25.75-.75.75"];
|
|
27
|
+
readonly fileImage: readonly ["M4.25 2.25h4.5l3 3v8.5h-7.5Z", "M8.75 2.25v3h3", "m4.25 12.5 2.25-2.25 1.75 1.75 1.25-1.25 2.25 2.25", "M6.75 7.75h.01"];
|
|
28
|
+
readonly folder: readonly ["M2.25 4.5c0-.69.56-1.25 1.25-1.25h2.6c.4 0 .77.19 1 .51l.75 1.04c.24.32.61.5 1 .5h3.65c.69 0 1.25.56 1.25 1.25v5.7c0 .69-.56 1.25-1.25 1.25h-9c-.69 0-1.25-.56-1.25-1.25Z"];
|
|
24
29
|
readonly selector: readonly ["M5.25 6 8 3.25 10.75 6", "M5.25 10 8 12.75 10.75 10"];
|
|
25
30
|
readonly bulb: readonly ["M6.25 13.75h3.5", "M8 2.25a4 4 0 0 0-2.4 7.2c.42.32.65.7.65 1.15v.65h3.5v-.65c0-.45.23-.83.65-1.15A4 4 0 0 0 8 2.25Z"];
|
|
26
31
|
readonly layers: readonly ["M8 2.75 13.25 5.5 8 8.25 2.75 5.5Z", "M2.75 8.25 8 11l5.25-2.75", "M2.75 11 8 13.75 13.25 11"];
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
transitionDuration: motion.slow,
|
|
26
26
|
transitionTimingFunction: 'ease'
|
|
27
27
|
},
|
|
28
|
-
md: { width: '1rem', height: '1.5rem' },
|
|
29
|
-
sm: { width: '1rem', height: '1.25rem' },
|
|
28
|
+
md: { '--narvi-icon-size': '1rem', width: '1rem', height: '1.5rem' },
|
|
29
|
+
sm: { '--narvi-icon-size': '0.875rem', width: '1rem', height: '1.25rem' },
|
|
30
30
|
neutral: {},
|
|
31
31
|
live: { color: colors.accent },
|
|
32
32
|
success: { color: colors.success },
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
<span
|
|
56
56
|
aria-hidden="true"
|
|
57
|
+
data-icons
|
|
57
58
|
data-slot="tile"
|
|
58
59
|
data-tone={tone}
|
|
59
60
|
{...stylex.attrs(styles.tile, styles[size], styles[tone], sx)}
|
package/dist/internal/layer.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as stylex from '@stylexjs/stylex';
|
|
9
9
|
import './icons.css';
|
|
10
|
+
/** The `style` that gives a floating surface a `width` of its own, with any `style` given too. */
|
|
11
|
+
export declare function widthStyle(width: string | undefined, style: unknown): string | undefined;
|
|
10
12
|
export declare const layer: Readonly<{
|
|
11
13
|
readonly surface: Readonly<{
|
|
12
14
|
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
@@ -35,6 +37,16 @@ export declare const layer: Readonly<{
|
|
|
35
37
|
readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
|
|
36
38
|
readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
|
|
37
39
|
}>;
|
|
40
|
+
readonly sized: Readonly<{
|
|
41
|
+
readonly width: stylex.StyleXClassNameFor<"width", "min(var(--narvi-layer-width), var(--bits-floating-available-width, 100vw))">;
|
|
42
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
43
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "none">;
|
|
44
|
+
}>;
|
|
45
|
+
readonly column: Readonly<{
|
|
46
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
47
|
+
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
48
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", "0.625rem">;
|
|
49
|
+
}>;
|
|
38
50
|
readonly item: Readonly<{
|
|
39
51
|
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
40
52
|
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
@@ -72,6 +84,17 @@ export declare const layer: Readonly<{
|
|
|
72
84
|
readonly textOverflow: stylex.StyleXClassNameFor<"textOverflow", "ellipsis">;
|
|
73
85
|
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
74
86
|
}>;
|
|
87
|
+
readonly text: Readonly<{
|
|
88
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
89
|
+
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
90
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", "0.125rem">;
|
|
91
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
92
|
+
readonly flexGrow: stylex.StyleXClassNameFor<"flexGrow", 1>;
|
|
93
|
+
}>;
|
|
94
|
+
readonly description: Readonly<{
|
|
95
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
96
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
97
|
+
}>;
|
|
75
98
|
readonly trailing: Readonly<{
|
|
76
99
|
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
|
|
77
100
|
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
package/dist/internal/layer.js
CHANGED
|
@@ -12,6 +12,13 @@ import './icons.css';
|
|
|
12
12
|
const CLOSED = ':is([data-state="closed"])';
|
|
13
13
|
const HIGHLIGHTED = ':is([data-highlighted])';
|
|
14
14
|
const DISABLED = ':is([data-disabled])';
|
|
15
|
+
/** The `style` that gives a floating surface a `width` of its own, with any `style` given too. */
|
|
16
|
+
export function widthStyle(width, style) {
|
|
17
|
+
const own = typeof style === 'string' && style ? style : undefined;
|
|
18
|
+
if (!width)
|
|
19
|
+
return own;
|
|
20
|
+
return [`--narvi-layer-width: ${width}`, own].filter(Boolean).join('; ');
|
|
21
|
+
}
|
|
15
22
|
export const layer = stylex.create({
|
|
16
23
|
surface: {
|
|
17
24
|
boxSizing: 'border-box',
|
|
@@ -47,6 +54,15 @@ export const layer = stylex.create({
|
|
|
47
54
|
transitionDuration: { default: motion.fast, [CLOSED]: '80ms' },
|
|
48
55
|
transitionTimingFunction: motion.easeOut
|
|
49
56
|
},
|
|
57
|
+
// A width of its own (`--narvi-layer-width`), in place of fitting its items: still no wider
|
|
58
|
+
// than the room bits-ui measures for it
|
|
59
|
+
sized: {
|
|
60
|
+
width: 'min(var(--narvi-layer-width), var(--bits-floating-available-width, 100vw))',
|
|
61
|
+
minWidth: 0,
|
|
62
|
+
maxWidth: 'none'
|
|
63
|
+
},
|
|
64
|
+
// Content of its own, one part under another, with room between them
|
|
65
|
+
column: { display: 'flex', flexDirection: 'column', gap: '0.625rem' },
|
|
50
66
|
// A row in a menu, a select or the palette
|
|
51
67
|
item: {
|
|
52
68
|
position: 'relative',
|
|
@@ -95,6 +111,9 @@ export const layer = stylex.create({
|
|
|
95
111
|
textOverflow: 'ellipsis',
|
|
96
112
|
whiteSpace: 'nowrap'
|
|
97
113
|
},
|
|
114
|
+
// A label with a line under it, such as what a choice means
|
|
115
|
+
text: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0, flexGrow: 1 },
|
|
116
|
+
description: { color: colors.textMuted, fontSize: font.sizeCaption },
|
|
98
117
|
// A shortcut or a count, at the far end
|
|
99
118
|
trailing: {
|
|
100
119
|
display: 'inline-flex',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The look of a button that stays pressed: Toggle, and the items of a
|
|
3
3
|
* ToggleGroup. Off, it is as quiet as a ghost button; on, it is lit with
|
|
4
|
-
* the accent, the one colour that marks state, as Composer's toggles are
|
|
4
|
+
* the accent, the one colour that marks state, as Composer's toggles are, or, `neutral`, with
|
|
5
|
+
* the fill of what is chosen.
|
|
5
6
|
*/
|
|
6
7
|
import * as stylex from '@stylexjs/stylex';
|
|
7
8
|
export declare const toggle: Readonly<{
|
|
@@ -69,5 +70,11 @@ export declare const toggle: Readonly<{
|
|
|
69
70
|
readonly width: stylex.StyleXClassNameFor<"width", "2rem">;
|
|
70
71
|
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", 0>;
|
|
71
72
|
}>;
|
|
73
|
+
readonly neutral: Readonly<{
|
|
74
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string | null>;
|
|
75
|
+
readonly color: stylex.StyleXClassNameFor<"color", string | null>;
|
|
76
|
+
}>;
|
|
72
77
|
}>;
|
|
73
78
|
export type ToggleSize = 'sm' | 'md';
|
|
79
|
+
/** How a pressed toggle shows it: lit in the `accent`, or `neutral`, in the fill of what is chosen. */
|
|
80
|
+
export type ToggleTone = 'accent' | 'neutral';
|
package/dist/internal/toggle.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The look of a button that stays pressed: Toggle, and the items of a
|
|
3
3
|
* ToggleGroup. Off, it is as quiet as a ghost button; on, it is lit with
|
|
4
|
-
* the accent, the one colour that marks state, as Composer's toggles are
|
|
4
|
+
* the accent, the one colour that marks state, as Composer's toggles are, or, `neutral`, with
|
|
5
|
+
* the fill of what is chosen.
|
|
5
6
|
*/
|
|
6
7
|
import * as stylex from '@stylexjs/stylex';
|
|
7
8
|
import { colors, font, motion, radius } from '../tokens.stylex.js';
|
|
@@ -79,5 +80,22 @@ export const toggle = stylex.create({
|
|
|
79
80
|
'::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-4px' }
|
|
80
81
|
},
|
|
81
82
|
iconSm: { width: '1.75rem', paddingInline: 0 },
|
|
82
|
-
iconMd: { width: '2rem', paddingInline: 0 }
|
|
83
|
+
iconMd: { width: '2rem', paddingInline: 0 },
|
|
84
|
+
// On, without the accent: the fill of what is chosen, in the text's colour. For a toolbar's
|
|
85
|
+
// icons, such as a panel shown or hidden, where a lit one would read as something live.
|
|
86
|
+
neutral: {
|
|
87
|
+
backgroundColor: {
|
|
88
|
+
default: 'transparent',
|
|
89
|
+
':hover': { default: null, [media.hover]: colors.fillHover },
|
|
90
|
+
[ON]: {
|
|
91
|
+
default: colors.fillSelected,
|
|
92
|
+
':hover': { default: null, [media.hover]: colors.fillSelected }
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
color: {
|
|
96
|
+
default: colors.textMuted,
|
|
97
|
+
':hover': { default: null, [media.hover]: colors.text },
|
|
98
|
+
[ON]: { default: colors.text, [media.forcedColors]: 'Highlight' }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
83
101
|
});
|
|
@@ -16,6 +16,13 @@ export declare const reExtension: RegExp;
|
|
|
16
16
|
* "1/2", "v1.2.3" and "github.com/owner/repo" are not paths.
|
|
17
17
|
*/
|
|
18
18
|
export declare function looksLikePath(path: string, hasPosition?: boolean): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* What kind of thing a path names, by its name: a `folder` (it ends in a slash), `code`, an
|
|
21
|
+
* `image`, `text` to read, `data` (configuration and records), or any other `file`.
|
|
22
|
+
*/
|
|
23
|
+
export type FileKind = 'folder' | 'code' | 'image' | 'text' | 'data' | 'file';
|
|
24
|
+
/** What kind of thing a path names: see `FileKind`. */
|
|
25
|
+
export declare function fileKind(path: string): FileKind;
|
|
19
26
|
export declare function basename(path: string): string;
|
|
20
27
|
/**
|
|
21
28
|
* What a chip shows for a path: the file's name, or the whole path when it leaves the
|
|
@@ -50,6 +50,35 @@ export function looksLikePath(path, hasPosition = false) {
|
|
|
50
50
|
// `./.env` and `/etc/hosts` name files without an extension; `src/lib` alone could be anything
|
|
51
51
|
return hasExtension || rooted || segments.length > 2;
|
|
52
52
|
}
|
|
53
|
+
const KINDS = {
|
|
54
|
+
code: new Set(('ts tsx mts cts js jsx mjs cjs svelte vue astro py pyi rb go rs java kt kts swift c h cc ' +
|
|
55
|
+
'cpp cxx hpp hh m mm cs fs php sh bash zsh fish ps1 lua dart scala ex exs erl hrl clj ' +
|
|
56
|
+
'cljs elm hs ml mli zig nim jl r pl sql html htm css scss sass less styl wasm wat gleam').split(' ')),
|
|
57
|
+
image: new Set('png jpg jpeg gif webp avif svg ico bmp tif tiff heic heif'.split(' ')),
|
|
58
|
+
text: new Set('md mdx markdown txt rst adoc asciidoc org tex rtf log pdf'.split(' ')),
|
|
59
|
+
data: new Set(('json jsonc json5 jsonl ndjson yaml yml toml xml csv tsv ini cfg conf env lock plist ' +
|
|
60
|
+
'properties graphql gql proto prisma').split(' '))
|
|
61
|
+
};
|
|
62
|
+
// Files whose name is their kind: `Makefile`, `Dockerfile`, `.gitignore`
|
|
63
|
+
const CODE_NAMES = /^(?:[A-Z][a-z]*file|Dockerfile\..+|Containerfile)$/;
|
|
64
|
+
const DATA_NAMES = /^\.(?:[a-z]+rc|env(?:\..+)?|git(?:ignore|attributes|modules)|editorconfig|npmrc|nvmrc|prettierrc|eslintrc)$/;
|
|
65
|
+
/** What kind of thing a path names: see `FileKind`. */
|
|
66
|
+
export function fileKind(path) {
|
|
67
|
+
if (/[\\/]$/.test(path))
|
|
68
|
+
return 'folder';
|
|
69
|
+
const name = basename(path);
|
|
70
|
+
if (CODE_NAMES.test(name))
|
|
71
|
+
return 'code';
|
|
72
|
+
if (DATA_NAMES.test(name))
|
|
73
|
+
return 'data';
|
|
74
|
+
const extension = /\.([A-Za-z0-9]+)$/.exec(name)?.[1]?.toLowerCase();
|
|
75
|
+
if (!extension || extension === name.slice(1).toLowerCase())
|
|
76
|
+
return 'file';
|
|
77
|
+
for (const [kind, extensions] of Object.entries(KINDS))
|
|
78
|
+
if (extensions.has(extension))
|
|
79
|
+
return kind;
|
|
80
|
+
return 'file';
|
|
81
|
+
}
|
|
53
82
|
export function basename(path) {
|
|
54
83
|
const trimmed = path.replace(/[\\/]+$/, '');
|
|
55
84
|
const base = trimmed.slice(Math.max(trimmed.lastIndexOf('/'), trimmed.lastIndexOf('\\')) + 1);
|
package/dist/markdown/files.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import { formatPosition, looksLikePath, splitPosition, type FileReference } from './file-paths.js';
|
|
1
|
+
import { fileKind, formatPosition, looksLikePath, splitPosition, type FileKind, type FileReference } from './file-paths.js';
|
|
2
2
|
import { type MarkdownPlugin } from './plugin.js';
|
|
3
|
-
export { formatPosition, looksLikePath, splitPosition, type FileReference };
|
|
3
|
+
export { fileKind, formatPosition, looksLikePath, splitPosition, type FileKind, type FileReference };
|
|
4
|
+
/** A file named in a reply, as `icon` is asked about it: where it is, and what kind of thing. */
|
|
5
|
+
export type FileChipTarget = FileReference & {
|
|
6
|
+
kind: FileKind;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A chip's icon of the app's own: an SVG image, by its address (a `data:` URL, or one the
|
|
10
|
+
* page can load), drawn as a mask in `color`, so it takes the chip's colours unless given its
|
|
11
|
+
* own. `color` is any CSS colour, `light-dark()` too.
|
|
12
|
+
*/
|
|
13
|
+
export type FileIcon = {
|
|
14
|
+
url: string;
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
};
|
|
4
17
|
export type FilesOptions = {
|
|
5
18
|
/**
|
|
6
19
|
* Says whether a path names a file the app knows, and returns it as the app wants it (made
|
|
@@ -11,6 +24,13 @@ export type FilesOptions = {
|
|
|
11
24
|
resolve?: ((path: string) => string | null | undefined) | undefined;
|
|
12
25
|
/** Opens a file when its chip is activated. Without it, chips only show. */
|
|
13
26
|
open?: ((file: FileReference, event: MouseEvent) => void) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The icon a chip shows, from the app's own set: given the file and its kind (`folder`,
|
|
29
|
+
* `code`, `image`, `text`, `data` or `file`). Return null for Narvi's own icon for the kind.
|
|
30
|
+
* It is asked once per chip, as the reply is read, so finished replies are still written
|
|
31
|
+
* as markup (`static`).
|
|
32
|
+
*/
|
|
33
|
+
icon?: ((file: FileChipTarget) => FileIcon | null | undefined) | undefined;
|
|
14
34
|
};
|
|
15
35
|
/** The first-party file plugin. */
|
|
16
36
|
export declare function files(options?: FilesOptions): MarkdownPlugin;
|
package/dist/markdown/files.js
CHANGED
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
* are all read, as is `[the config](src/config.ts#L10)`.
|
|
10
10
|
*/
|
|
11
11
|
import MarkdownFile, { chipFile, fileHtml } from '../components/markdown/MarkdownFile.svelte';
|
|
12
|
-
import { displayName, formatPosition, looksLikePath, namesPath, reExtension, splitPosition } from './file-paths.js';
|
|
12
|
+
import { displayName, fileKind, formatPosition, looksLikePath, namesPath, reExtension, splitPosition } from './file-paths.js';
|
|
13
13
|
import { mapInlines, withProps } from './plugin.js';
|
|
14
14
|
import { inlineText } from './table.js';
|
|
15
|
-
export { formatPosition, looksLikePath, splitPosition };
|
|
15
|
+
export { fileKind, formatPosition, looksLikePath, splitPosition };
|
|
16
|
+
// What may go in a style attribute: no quote, backslash or line ending to break out of it
|
|
17
|
+
const reIconUrl = /^[^"\\\r\n]{1,20000}$/;
|
|
18
|
+
const reIconColor = /^[\w\s#%(),./-]{1,200}$/;
|
|
19
|
+
/** The words of a single-word link that name a file anyway: `README`, `Makefile`. */
|
|
20
|
+
const reNamedFile = /^(?:README|LICEN[CS]E|CHANGELOG|CHANGES|CONTRIBUTING|AUTHORS|NOTICE|COPYING|CODEOWNERS|TODO|VERSION|SECURITY|[A-Z][a-z]*file)$/;
|
|
16
21
|
function decode(url) {
|
|
17
22
|
try {
|
|
18
23
|
return decodeURIComponent(url);
|
|
@@ -23,7 +28,22 @@ function decode(url) {
|
|
|
23
28
|
}
|
|
24
29
|
/** The first-party file plugin. */
|
|
25
30
|
export function files(options = {}) {
|
|
26
|
-
const { resolve, open } = options;
|
|
31
|
+
const { resolve, open, icon } = options;
|
|
32
|
+
/** The app's icon for a chip, if it gives one that can be written safely. */
|
|
33
|
+
const iconOf = (target) => {
|
|
34
|
+
let given;
|
|
35
|
+
try {
|
|
36
|
+
given = icon?.(target);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// An icon that throws leaves the chip with Narvi's own
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
if (!given || !reIconUrl.test(given.url))
|
|
43
|
+
return undefined;
|
|
44
|
+
const color = given.color && reIconColor.test(given.color) ? given.color : undefined;
|
|
45
|
+
return color ? { url: given.url, color } : { url: given.url };
|
|
46
|
+
};
|
|
27
47
|
/**
|
|
28
48
|
* The file some text names, or null. `certain` is for a `file:` address, which names a
|
|
29
49
|
* file whatever it looks like, spaces and all.
|
|
@@ -69,21 +89,32 @@ export function files(options = {}) {
|
|
|
69
89
|
.replace(/[\p{Cc}\p{Cf}]/gu, '')
|
|
70
90
|
.trim();
|
|
71
91
|
const tokens = words.split(/\s+/).map((token) => token.replace(/[.,;:!?)\]]+$/, ''));
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
// What could be a file's name: a path, a name with an extension, a dotfile, one with an
|
|
93
|
+
// underscore (`id_rsa`), or a name files go by without an extension (`README`). A plain
|
|
94
|
+
// word, such as "here" or "this", is none of these, alone or among others.
|
|
95
|
+
const readsAsFile = (token) => /[\\/_]/.test(token) ||
|
|
96
|
+
token.startsWith('.') ||
|
|
97
|
+
reExtension.test(splitPosition(token).path) ||
|
|
98
|
+
reNamedFile.test(token);
|
|
99
|
+
const honest = tokens.length > 0 &&
|
|
100
|
+
tokens[0] !== '' &&
|
|
101
|
+
tokens.every((token) => !readsAsFile(token) || namesPath(splitPosition(token).path, file.path));
|
|
76
102
|
if (honest)
|
|
77
103
|
return children;
|
|
78
104
|
return [{ type: 'text', value: displayName(file.path) + formatPosition(file) }];
|
|
79
105
|
};
|
|
80
|
-
const chip = (file, source, children, link = false) =>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
const chip = (file, source, children, link = false) => {
|
|
107
|
+
// A folder is named with a slash at its end, as written or as the app resolves it
|
|
108
|
+
const kind = fileKind(/[\\/]$/.test(source.replace(/#.*$/, '')) ? `${file.path}/` : file.path);
|
|
109
|
+
const own = iconOf({ ...file, kind });
|
|
110
|
+
return {
|
|
111
|
+
type: 'custom',
|
|
112
|
+
name: 'file',
|
|
113
|
+
// `link` marks a chip whose label is the words of a link, not a path
|
|
114
|
+
data: { ...file, source, kind, ...(link ? { link } : {}), ...(own ? { icon: own } : {}) },
|
|
115
|
+
children
|
|
116
|
+
};
|
|
117
|
+
};
|
|
87
118
|
return {
|
|
88
119
|
name: 'files',
|
|
89
120
|
transform: (block) => mapInlines(block, (node, { inLink }) => {
|
package/dist/tokens.stylex.d.ts
CHANGED
|
@@ -43,12 +43,15 @@ export declare const colors: stylex.VarGroup<Readonly<{
|
|
|
43
43
|
success: string;
|
|
44
44
|
warning: string;
|
|
45
45
|
danger: string;
|
|
46
|
+
info: string;
|
|
46
47
|
successSoft: string;
|
|
47
48
|
warningSoft: string;
|
|
48
49
|
dangerSoft: string;
|
|
50
|
+
infoSoft: string;
|
|
49
51
|
successText: string;
|
|
50
52
|
warningText: string;
|
|
51
53
|
dangerText: string;
|
|
54
|
+
infoText: string;
|
|
52
55
|
codeKey: string;
|
|
53
56
|
codeString: string;
|
|
54
57
|
codeNumber: string;
|
package/dist/tokens.stylex.js
CHANGED
|
@@ -64,19 +64,23 @@ export const colors = stylex.defineVars({
|
|
|
64
64
|
primary: 'light-dark(#1c1e21, #eceff4)',
|
|
65
65
|
onPrimary: 'light-dark(#fafafa, #0b0d11)',
|
|
66
66
|
// Status: definite colours, each holding 4.5:1 as small text on a hovered row of the
|
|
67
|
-
// page, on every stone a preset offers
|
|
67
|
+
// page, on every stone a preset offers. `info` is for what is only to be known, such as a
|
|
68
|
+
// note or a comment: a blue of its own, which stays blue whatever accent a preset picks.
|
|
68
69
|
success: 'light-dark(#007835, #37d16c)',
|
|
69
70
|
warning: 'light-dark(#8b6001, #f5af20)',
|
|
70
71
|
danger: 'light-dark(#c92228, #ff7a70)',
|
|
72
|
+
info: 'light-dark(#0164cf, #72acfe)',
|
|
71
73
|
// Behind a status: a wash of its colour, stronger at night so it still reads
|
|
72
74
|
successSoft: 'light-dark(rgb(0 120 53 / 0.12), rgb(55 209 108 / 0.16))',
|
|
73
75
|
warningSoft: 'light-dark(rgb(139 96 1 / 0.12), rgb(245 175 32 / 0.16))',
|
|
74
76
|
dangerSoft: 'light-dark(rgb(201 34 40 / 0.12), rgb(255 122 112 / 0.16))',
|
|
77
|
+
infoSoft: 'light-dark(rgb(1 100 207 / 0.12), rgb(114 172 254 / 0.16))',
|
|
75
78
|
// Small text in a status colour: mixed toward the text colour, so a 12px label
|
|
76
79
|
// on its soft wash still holds 4.5:1
|
|
77
80
|
successText: 'light-dark(#195c2e, #a0dcac)',
|
|
78
81
|
warningText: 'light-dark(#674600, #f2ca8d)',
|
|
79
82
|
dangerText: 'light-dark(#7a342f, #ffb9b1)',
|
|
83
|
+
infoText: 'light-dark(#1a4f8c, #a9c8f8)',
|
|
80
84
|
// Code: keys in slate blue, strings in green, numbers in copper, literals in magenta, and
|
|
81
85
|
// punctuation in a grey that stands back. Each holds 4.5:1 on `fillSunken` in both
|
|
82
86
|
// schemes, punctuation too: a brace is text.
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
Grid, and Narvi's conventions for colour, labels and copy.
|
|
13
13
|
type: core
|
|
14
14
|
library: '@diegopluna/narvi'
|
|
15
|
-
library_version: '0.3.
|
|
15
|
+
library_version: '0.3.3'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -117,13 +117,19 @@ The same `child` pattern applies to `Menu.Trigger`, `Popover.Trigger`, `Tooltip.
|
|
|
117
117
|
`HoverCard.Trigger`, `Sheet.Trigger` and `Collapsible.Trigger`.
|
|
118
118
|
|
|
119
119
|
`Dialog.Content` takes `size`: `sm` 24rem, `md` 32 (the default), `lg` 36, `xl` 44 and `2xl` 56.
|
|
120
|
+
`as="form"` makes the dialog the form itself: give it `onsubmit`, and a footer button with
|
|
121
|
+
`type="submit"`; Enter in a field submits it.
|
|
120
122
|
A `Sheet.Content` along an edge takes the same names, from 20rem; from `lg` up, a dialog and a
|
|
121
123
|
sheet of one size are as wide. `Dialog.Body` takes a bindable `ref`, the element that scrolls.
|
|
122
124
|
A Select, Menu or Popover opened inside a dialog or a sheet opens over it.
|
|
123
125
|
|
|
124
126
|
A menu that picks one of several uses `Menu.RadioGroup` and `Menu.RadioItem`. Picking an item
|
|
125
127
|
closes the menu, as a select does (`closeOnSelect={false}` keeps it open), and an item takes
|
|
126
|
-
an `icon` snippet and a `shortcut`, as `Menu.Item` does.
|
|
128
|
+
an `icon` snippet and a `shortcut`, as `Menu.Item` does. `Menu.CheckboxItem` takes the same and
|
|
129
|
+
closes the menu too; pass `closeOnSelect={false}` for a menu of settings set several at a time.
|
|
130
|
+
A `Menu.Label` names the `Menu.Group` or `Menu.RadioGroup` it is in; on its own it is a heading
|
|
131
|
+
only to the eye, with no group needed. On a `ContextMenu.Trigger`, `menuKey={false}` leaves
|
|
132
|
+
Shift+F10 and the Menu key to a list whose own keys already open the menu.
|
|
127
133
|
|
|
128
134
|
For a yes/no confirmation, use `ConfirmDialog`. It takes a `title` that asks the question and a
|
|
129
135
|
`confirmLabel` that names the action. If `onconfirm` returns a promise, the dialog waits for it
|
|
@@ -153,7 +159,8 @@ wiring for them.
|
|
|
153
159
|
(radios, a start and an end). The help and the error describe the group; its controls take
|
|
154
160
|
no id from it.
|
|
155
161
|
- `Input` takes an `icon` snippet at its start, sized to the field:
|
|
156
|
-
`<Input>{#snippet icon()}<Search />{/snippet}</Input>`. Don't position an icon by hand.
|
|
162
|
+
`<Input>{#snippet icon()}<Search />{/snippet}</Input>`. Don't position an icon by hand. With
|
|
163
|
+
an icon, `sx` styles the element around the field; `inputSx` and `inputClass` style the field.
|
|
157
164
|
- For one choice among a few that each need a line of detail, use `ChoiceCards`
|
|
158
165
|
(`options: { value, label, detail?, icon?, disabled? }[]`, `bind:value`, `aria-label`).
|
|
159
166
|
|
|
@@ -289,19 +296,37 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
|
|
|
289
296
|
over a busy background, such as an image behind the composer),
|
|
290
297
|
`EmptyState` for an empty place, `Skeleton`, `Spinner` or `Progress` while loading, and
|
|
291
298
|
`StatusIndicator` (`status`: idle, working, waiting, done, failed, stopped, connecting) for where
|
|
292
|
-
a run stands.
|
|
299
|
+
a run stands. Where there is no room for its shapes, beside a name or on a mark's corner, use
|
|
300
|
+
`StatusDot` (`tone`; `shape`: dot, ring for on its way, diamond for failed; `size`, 6px; `label`).
|
|
301
|
+
Don't draw a dot as a span of your own.
|
|
293
302
|
|
|
294
303
|
### Lists, badges and folds
|
|
295
304
|
|
|
296
305
|
- Rows on one card with a line between each: `List.Root` (a `ul`, or `as="div"`) holding
|
|
297
306
|
`List.Item`s, or rows of your own. Don't redraw the card and its lines.
|
|
298
307
|
- `Badge` shows its tone as a dot; `plain` hides the dot and colours the words in the tone.
|
|
308
|
+
`size="sm"` is 18px, a sidebar row's line, so it sits in a row without growing it. An icon in
|
|
309
|
+
it is sized to 12px.
|
|
299
310
|
- `Collapsible.Trigger` takes `chevron="start"` to put the chevron before its label, as in a tree.
|
|
300
311
|
- `Tabs` and `SegmentedControl` options take an `icon` (a component, sized to fit) and a
|
|
301
312
|
`title` that names a short label in full, as a tooltip and the item's description.
|
|
302
|
-
- A `Button` that is loading hides its label under the spinner
|
|
313
|
+
- A `Button` that is loading hides its label under the spinner, which is as large as an icon in
|
|
314
|
+
a button of that size, icon-only ones too; `loadingLabel="Connecting…"`
|
|
303
315
|
says what it is doing beside the spinner instead. `variant="link"` sits in a sentence, at its
|
|
304
|
-
size, with no padding.
|
|
316
|
+
size, with no padding. A ghost, bare, secondary or floating Button that opens a menu or a
|
|
317
|
+
popover holds an open look while it shows, by the `aria-expanded` bits-ui sets: don't style
|
|
318
|
+
the open trigger yourself.
|
|
319
|
+
- `Toggle` and `ToggleGroup.Root` take `tone="neutral"` for a toolbar's icons that show or hide
|
|
320
|
+
something: pressed, they take the fill of what is chosen instead of lighting in the accent.
|
|
321
|
+
- `Menu.Item`, `Menu.SubTrigger` and `Menu.CheckboxItem` take a `description` (a line under the
|
|
322
|
+
label), and `Menu.Item` a `trailing` snippet after its shortcut. A `Menu.CheckboxItem` with an
|
|
323
|
+
`icon` puts its tick at the end, so its icon lines up with the others'. `Menu.Content` takes a
|
|
324
|
+
`width` (`'18rem'`) in place of fitting its items, up to 22rem.
|
|
325
|
+
- `Popover.Content` takes `padding="none"`, `layout="column"` and a `width`;
|
|
326
|
+
`HoverCard.Content` takes `layout="column"` and `padding`; `Tooltip.Content` takes
|
|
327
|
+
`layout="column"` for a title over a line that says more.
|
|
328
|
+
- `Select` takes an `optionIcon` snippet, given each option, for an icon with props of its own.
|
|
329
|
+
- `EmptyState`'s title is a heading (`level`, 2 by default). `Heading` takes a `weight`.
|
|
305
330
|
|
|
306
331
|
### App and chat screens
|
|
307
332
|
|
|
@@ -322,19 +347,73 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
|
|
|
322
347
|
- **A workspace switcher:** `Sidebar.Switcher` is a row with the workspace's mark (`leading`),
|
|
323
348
|
its name and a selector glyph. Put it in a `Menu.Trigger`'s `child` and spread the props:
|
|
324
349
|
`{#snippet child({ props })}<Sidebar.Switcher {...props}>…</Sidebar.Switcher>{/snippet}`.
|
|
350
|
+
An `aside` snippet sits just after the name, such as a `StatusDot`.
|
|
325
351
|
- **Rows in folders** are set in by their text, not their box. A folder's chevron comes first,
|
|
326
352
|
on the edge of the rows' icons; give its mark as `leading` and it follows the chevron. Its
|
|
327
353
|
rows line up on their own, their titles under the folder's name, with a mark or without.
|
|
328
354
|
Don't pad rows or folders yourself.
|
|
329
355
|
- **The open row** (`current`) is a flat fill; its title keeps its weight. Don't bold it
|
|
330
356
|
yourself: a heavier title is wider, so it cuts off at a different point as the person moves.
|
|
331
|
-
- **A listbox of results** from Sidebar rows: `<Sidebar.Item as="div" role="option"
|
|
332
|
-
inside your `role="listbox"`, so no list item stands between the box and its options
|
|
357
|
+
- **A listbox of results** from Sidebar rows: `<Sidebar.Item as="div" role="option" picked={…}>`
|
|
358
|
+
inside your `role="listbox"`, so no list item stands between the box and its options; with
|
|
359
|
+
`role="option"`, `picked` says so with `aria-selected`.
|
|
360
|
+
- **Rows the person picks** to act on together (⌘- and Shift-click, which the app handles):
|
|
361
|
+
`picked` gives the accent's soft fill, `data-picked`, and "Selected," before the title
|
|
362
|
+
(`pickedLabel`). A row that can't be used now takes `disabled`: dimmed, `aria-disabled`, still
|
|
363
|
+
in the arrows' path. Don't give a row a background in `sx` for either. A background in `sx` is
|
|
364
|
+
the row's resting fill, such as a drop target's; hover, open and picked show over it.
|
|
365
|
+
- **A row's menu and its preview:** a `ContextMenu.Trigger`'s props go on the element around the
|
|
366
|
+
row, with `itemProps={props}` (attachments too), and a `HoverCard.Trigger`'s on the row itself.
|
|
367
|
+
Don't wrap the row in an `li` of your own. The row stays lit while its context menu is open,
|
|
368
|
+
and its `actions` stay up while a menu opened from them is showing.
|
|
369
|
+
- **A group's list** takes the group's `label`, or its `aria-label`, as its name. Folded, a
|
|
370
|
+
`collapsible` group keeps the open row in view under its folder (`keepCurrent`, on by
|
|
371
|
+
default). Its `actions` end on the rows' trailing column, an icon button by its icon.
|
|
372
|
+
- **Shelves at the foot of the list:** `Sidebar.Content`'s `pinned` snippet holds groups below
|
|
373
|
+
what scrolls, in the same tab stop and arrow-key order. Don't add a second `Sidebar.Content`.
|
|
374
|
+
- **A mark with a badge** in a row's `meta` may overhang it; the line clips only far past its end.
|
|
375
|
+
- `AppShell.Main` is not focusable, so a press on text in the page leaves focus where it was.
|
|
333
376
|
- **TabStrip** tabs narrow to an ellipsis before the strip scrolls. With a `leading` icon, a
|
|
334
377
|
tab's close button takes the icon's place, so no room is kept at its end.
|
|
335
378
|
- **A Sheet** focuses itself as it opens (`focusOnOpen="sheet"`), so a Rail or a list in it
|
|
336
379
|
shows no focus ring until the keys move in. Pass `focusOnOpen="first"` for a sheet that
|
|
337
380
|
holds a form.
|
|
381
|
+
- `AppShell.Header` draws a line under itself; `divider={false}` leaves it out where the page
|
|
382
|
+
runs on under the header, as a conversation does.
|
|
383
|
+
|
|
384
|
+
Parts of a thread that are easy to redraw by hand, and shouldn't be:
|
|
385
|
+
|
|
386
|
+
- **An editor of your own in the composer** (a rich prompt field): put it where
|
|
387
|
+
`Composer.Textarea` goes and mark it `data-composer-field` (an editable element is found on
|
|
388
|
+
its own). The frame shows its focus edge and sends clicks to it. Set `hasContent` from the
|
|
389
|
+
editor, so `Composer.Submit` knows there is something to send, and `sending` while a message
|
|
390
|
+
is on its way and can't be stopped: Submit spins, says "Sending" (`sendingLabel`), and nothing
|
|
391
|
+
more is sent. `onfiles` receives picked, dropped and pasted files; return `false` to keep them
|
|
392
|
+
on a list of your own instead of the composer's.
|
|
393
|
+
- **Composer.ModelPicker** takes `bind:open`, and `multiple` with `value: string[]` to pick
|
|
394
|
+
several. `Composer.Toggle` works outside a `Composer.Root` too.
|
|
395
|
+
- **Composer.Tray** shows its shelf for a child that holds something and isn't `hidden`; pass
|
|
396
|
+
`waiting` when what is inside hides itself some other way.
|
|
397
|
+
- **A user's message with attachments:** `<Message.Content bubble={false}>` is a column at the
|
|
398
|
+
end of the line; put the attachments in it, then the words in a `Message.Bubble`, then any
|
|
399
|
+
cards. Its actions then sit under it. `textSize="body"` on `Message.Root` (and on
|
|
400
|
+
`QueuedMessage`) sets the words at the interface's 14px instead of 16.
|
|
401
|
+
- **QueuedMessage** takes `attachments` (a snippet over the bubble), draws no bubble without
|
|
402
|
+
words, and `disabled` holds its actions back (`true`, or the ones to hold by name).
|
|
403
|
+
- **A timeline row of your own** starts with `Activity.Icon` (`kind`, `tone`, `spinning`, or
|
|
404
|
+
your own icon as children), as the others' do. `Activity.Thought` takes a snippet, such as
|
|
405
|
+
Markdown, in place of `text`. `Activity.Step` takes `wrap` for a label that runs on, and
|
|
406
|
+
`status="neutral"` for a step that settled without going through or failing ("Skipped",
|
|
407
|
+
`statusLabels.neutral`); it and `WorkFold` pass `data-*` attributes on.
|
|
408
|
+
- **A divider with more than words:** `Divider` takes children (a link, a time) and
|
|
409
|
+
`role="status"` for words read out as they change. A long label wraps between the rules.
|
|
410
|
+
- **Answers on their way:** `Approval` and `Questionnaire` take `busy`, which spins the button
|
|
411
|
+
pressed and holds the rest. A `Question` takes a `description`, and `secret` for an answer
|
|
412
|
+
typed into a hidden field and never shown back. ⌘Enter sends only once every question is
|
|
413
|
+
answered or skipped.
|
|
414
|
+
- **Closed folds** (`WorkFold`, `Collapsible`, `Activity`, `Reasoning`, `Tool`) stop rendering
|
|
415
|
+
their content once shut, so `checkVisibility()`, find-in-page and Playwright see it as hidden.
|
|
416
|
+
Don't add `display: none` of your own.
|
|
338
417
|
|
|
339
418
|
## Conventions
|
|
340
419
|
|