@diegopluna/narvi 0.3.6 → 0.3.8
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/ActivityStep.svelte +86 -6
- package/dist/components/activity/ActivityStep.svelte.d.ts +17 -2
- package/dist/components/activity/index.d.ts +1 -1
- package/dist/components/app-shell/AppShellMain.svelte +62 -2
- package/dist/components/app-shell/AppShellMain.svelte.d.ts +1 -1
- package/dist/components/app-shell/AppShellPanel.svelte +37 -11
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +13 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +30 -10
- package/dist/components/command/CommandDialog.svelte +9 -2
- package/dist/components/command/CommandDialog.svelte.d.ts +4 -0
- package/dist/components/command/CommandEmpty.svelte +38 -4
- package/dist/components/command/CommandEmpty.svelte.d.ts +18 -2
- package/dist/components/command/CommandFooter.svelte +5 -7
- package/dist/components/command/CommandFooter.svelte.d.ts +4 -1
- package/dist/components/command/CommandInput.svelte +13 -1
- package/dist/components/command/CommandInput.svelte.d.ts +11 -0
- package/dist/components/command/CommandItem.svelte +32 -6
- package/dist/components/command/CommandItem.svelte.d.ts +20 -0
- package/dist/components/command/CommandRoot.svelte +68 -9
- package/dist/components/command/CommandRoot.svelte.d.ts +13 -3
- package/dist/components/command/styles.d.ts +50 -8
- package/dist/components/command/styles.js +50 -8
- package/dist/components/markdown/Markdown.svelte +14 -4
- package/dist/components/menu/MenuContent.svelte +7 -1
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/sidebar/SidebarFolder.svelte +2 -1
- package/dist/components/sidebar/SidebarGroup.svelte +2 -1
- package/dist/components/sidebar/SidebarItem.svelte +34 -4
- package/dist/components/split-button/SplitButton.svelte +54 -15
- package/dist/components/split-button/SplitButton.svelte.d.ts +21 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/internal/Collapse.svelte +16 -1
- package/dist/internal/Collapse.svelte.d.ts +2 -0
- package/dist/internal/fold-shown.d.ts +3 -0
- package/dist/internal/fold-shown.js +14 -0
- package/dist/internal/layer.d.ts +6 -3
- package/dist/internal/layer.js +13 -6
- package/dist/internal/visible.d.ts +24 -1
- package/dist/internal/visible.js +25 -1
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +15 -15
- package/skills/building-ui/references/components.md +79 -15
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +7 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
export type CommandFooterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
8
8
|
sx?: Sx | undefined;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Hints for the keys, such as "↑↓ to move", a note, or buttons such as Back. It is read
|
|
11
|
+
* out with the rest; pass `aria-hidden="true"` for hints alone, which the keys already say.
|
|
12
|
+
*/
|
|
10
13
|
children?: Snippet | undefined;
|
|
11
14
|
};
|
|
12
15
|
</script>
|
|
@@ -15,11 +18,6 @@
|
|
|
15
18
|
let { sx, class: className, children, ...rest }: CommandFooterProps = $props();
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
|
-
<div
|
|
19
|
-
data-slot="command-footer"
|
|
20
|
-
aria-hidden="true"
|
|
21
|
-
{...rest}
|
|
22
|
-
{...attrs([command.footer, sx], className)}
|
|
23
|
-
>
|
|
21
|
+
<div data-slot="command-footer" {...rest} {...attrs([command.footer, sx], className)}>
|
|
24
22
|
{@render children?.()}
|
|
25
23
|
</div>
|
|
@@ -3,7 +3,10 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
3
3
|
import { type Sx } from '../../internal/sx.js';
|
|
4
4
|
export type CommandFooterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
5
5
|
sx?: Sx | undefined;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Hints for the keys, such as "↑↓ to move", a note, or buttons such as Back. It is read
|
|
8
|
+
* out with the rest; pass `aria-hidden="true"` for hints alone, which the keys already say.
|
|
9
|
+
*/
|
|
7
10
|
children?: Snippet | undefined;
|
|
8
11
|
};
|
|
9
12
|
declare const CommandFooter: import("svelte").Component<CommandFooterProps, {}, "">;
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
import type { Loose } from '../../internal/loose.js';
|
|
3
3
|
import { Command } from 'bits-ui';
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
5
6
|
import Glyph from '../../internal/Glyph.svelte';
|
|
6
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
8
|
import { command } from './styles.js';
|
|
8
9
|
|
|
9
10
|
export type CommandInputProps = Loose<
|
|
10
|
-
Omit<Command.InputProps, 'child'> & {
|
|
11
|
+
Omit<Command.InputProps, 'child'> & {
|
|
12
|
+
/**
|
|
13
|
+
* After the field, in its row: a button or two, such as a filter or how to search, or a
|
|
14
|
+
* Spinner while results are on their way.
|
|
15
|
+
*/
|
|
16
|
+
end?: Snippet | undefined;
|
|
17
|
+
sx?: Sx | undefined;
|
|
18
|
+
}
|
|
11
19
|
>;
|
|
12
20
|
</script>
|
|
13
21
|
|
|
@@ -15,6 +23,7 @@
|
|
|
15
23
|
let {
|
|
16
24
|
value = $bindable(''),
|
|
17
25
|
placeholder = 'Search for a command…',
|
|
26
|
+
end,
|
|
18
27
|
sx,
|
|
19
28
|
class: className,
|
|
20
29
|
...rest
|
|
@@ -33,4 +42,7 @@
|
|
|
33
42
|
{...rest}
|
|
34
43
|
{...attrs([command.input, sx], className)}
|
|
35
44
|
/>
|
|
45
|
+
{#if end}<div data-slot="command-input-end" {...stylex.attrs(command.end)}>
|
|
46
|
+
{@render end()}
|
|
47
|
+
</div>{/if}
|
|
36
48
|
</div>
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { Loose } from '../../internal/loose.js';
|
|
2
2
|
import { Command } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
3
4
|
import { type Sx } from '../../internal/sx.js';
|
|
4
5
|
export type CommandInputProps = Loose<Omit<Command.InputProps, 'child'> & {
|
|
6
|
+
/**
|
|
7
|
+
* After the field, in its row: a button or two, such as a filter or how to search, or a
|
|
8
|
+
* Spinner while results are on their way.
|
|
9
|
+
*/
|
|
10
|
+
end?: Snippet | undefined;
|
|
5
11
|
sx?: Sx | undefined;
|
|
6
12
|
}>;
|
|
7
13
|
declare const CommandInput: import("svelte").Component<Loose<Omit<Command.InputProps, "child"> & {
|
|
14
|
+
/**
|
|
15
|
+
* After the field, in its row: a button or two, such as a filter or how to search, or a
|
|
16
|
+
* Spinner while results are on their way.
|
|
17
|
+
*/
|
|
18
|
+
end?: Snippet | undefined;
|
|
8
19
|
sx?: Sx | undefined;
|
|
9
20
|
}>, {}, "value">;
|
|
10
21
|
type CommandInput = ReturnType<typeof CommandInput>;
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
* such as one with the words that match the search marked.
|
|
18
18
|
*/
|
|
19
19
|
detail?: string | Snippet | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Lets the detail wrap to a second line, rather than be cut short, where its end
|
|
22
|
+
* matters: a path. It gives way before the label does.
|
|
23
|
+
*/
|
|
24
|
+
wrapDetail?: boolean | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Right after the label, before the detail: a mark such as a connected service's, or a
|
|
27
|
+
* Badge. An icon in it is 14px.
|
|
28
|
+
*/
|
|
29
|
+
badge?: Snippet | undefined;
|
|
20
30
|
/**
|
|
21
31
|
* What the key cap on the highlighted item says Enter does. `↵` by default; words such
|
|
22
32
|
* as "Open" for an item that does something of its own, or `null` for none.
|
|
@@ -34,6 +44,8 @@
|
|
|
34
44
|
let {
|
|
35
45
|
icon,
|
|
36
46
|
detail,
|
|
47
|
+
wrapDetail = false,
|
|
48
|
+
badge,
|
|
37
49
|
shortcut,
|
|
38
50
|
hint = '↵',
|
|
39
51
|
sx,
|
|
@@ -47,12 +59,17 @@
|
|
|
47
59
|
{#snippet child({ props })}
|
|
48
60
|
<div {...props}>
|
|
49
61
|
{#if icon}<span data-icons {...stylex.attrs(layer.icon)}>{@render icon()}</span>{/if}
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
{#if wrapDetail && detail}
|
|
63
|
+
<span {...stylex.attrs(command.wrapRow)}>
|
|
64
|
+
<span {...stylex.attrs(command.wrapLabel)}>{@render label()}</span>
|
|
65
|
+
<span {...stylex.attrs(command.wrapped)}>{@render detailText()}</span>
|
|
66
|
+
</span>
|
|
67
|
+
{:else}
|
|
68
|
+
<span {...stylex.attrs(layer.label)}>
|
|
69
|
+
{@render label()}
|
|
70
|
+
{#if detail}<span {...stylex.attrs(command.detail)}>{@render detailText()}</span>{/if}
|
|
71
|
+
</span>
|
|
72
|
+
{/if}
|
|
56
73
|
<span {...stylex.attrs(layer.trailing)}>
|
|
57
74
|
{#if shortcut}{shortcut}{/if}
|
|
58
75
|
<!-- Enter is the way to choose, shown only on the highlighted row -->
|
|
@@ -61,3 +78,12 @@
|
|
|
61
78
|
</div>
|
|
62
79
|
{/snippet}
|
|
63
80
|
</Command.Item>
|
|
81
|
+
|
|
82
|
+
{#snippet label()}
|
|
83
|
+
{@render children?.()}
|
|
84
|
+
{#if badge}<span data-icons {...stylex.attrs(command.badge)}>{@render badge()}</span>{/if}
|
|
85
|
+
{/snippet}
|
|
86
|
+
|
|
87
|
+
{#snippet detailText()}
|
|
88
|
+
{#if typeof detail === 'function'}{@render detail()}{:else}{detail}{/if}
|
|
89
|
+
{/snippet}
|
|
@@ -10,6 +10,16 @@ export type CommandItemProps = Loose<Omit<Command.ItemProps, 'children' | 'child
|
|
|
10
10
|
* such as one with the words that match the search marked.
|
|
11
11
|
*/
|
|
12
12
|
detail?: string | Snippet | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Lets the detail wrap to a second line, rather than be cut short, where its end
|
|
15
|
+
* matters: a path. It gives way before the label does.
|
|
16
|
+
*/
|
|
17
|
+
wrapDetail?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Right after the label, before the detail: a mark such as a connected service's, or a
|
|
20
|
+
* Badge. An icon in it is 14px.
|
|
21
|
+
*/
|
|
22
|
+
badge?: Snippet | undefined;
|
|
13
23
|
/**
|
|
14
24
|
* What the key cap on the highlighted item says Enter does. `↵` by default; words such
|
|
15
25
|
* as "Open" for an item that does something of its own, or `null` for none.
|
|
@@ -28,6 +38,16 @@ declare const CommandItem: import("svelte").Component<Loose<Omit<Command.ItemPro
|
|
|
28
38
|
* such as one with the words that match the search marked.
|
|
29
39
|
*/
|
|
30
40
|
detail?: string | Snippet | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Lets the detail wrap to a second line, rather than be cut short, where its end
|
|
43
|
+
* matters: a path. It gives way before the label does.
|
|
44
|
+
*/
|
|
45
|
+
wrapDetail?: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Right after the label, before the detail: a mark such as a connected service's, or a
|
|
48
|
+
* Badge. An icon in it is 14px.
|
|
49
|
+
*/
|
|
50
|
+
badge?: Snippet | undefined;
|
|
31
51
|
/**
|
|
32
52
|
* What the key cap on the highlighted item says Enter does. `↵` by default; words such
|
|
33
53
|
* as "Open" for an item that does something of its own, or `null` for none.
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A list to search and choose from with the keys: the arrows, Page Up and Page
|
|
3
|
+
Down move the highlight, Home and End reach its ends, and Enter chooses.
|
|
4
|
+
|
|
5
|
+
The keys are the list's only where the person is in it: on the root, or in its
|
|
6
|
+
Command.Input. A button, a field or a form of the caller's own inside the root
|
|
7
|
+
keeps its keys, Enter among them, and the search field keeps Home and End to
|
|
8
|
+
move its caret.
|
|
9
|
+
-->
|
|
1
10
|
<script lang="ts" module>
|
|
2
11
|
import type { Loose } from '../../internal/loose.js';
|
|
3
12
|
import { Command } from 'bits-ui';
|
|
@@ -9,7 +18,7 @@
|
|
|
9
18
|
Omit<Command.RootProps, 'children' | 'child'> & {
|
|
10
19
|
/**
|
|
11
20
|
* The value of the highlighted item. Bindable: set it to move the highlight from
|
|
12
|
-
* outside
|
|
21
|
+
* outside. When the highlighted item goes, the highlight goes back to the first.
|
|
13
22
|
*/
|
|
14
23
|
value?: string | undefined;
|
|
15
24
|
/**
|
|
@@ -17,6 +26,11 @@
|
|
|
17
26
|
* to rank them yourself and list only those that match: results from a server, say.
|
|
18
27
|
*/
|
|
19
28
|
shouldFilter?: boolean | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Whether Ctrl with J and N, or K and P, moves the highlight too, as in Vim and Emacs.
|
|
31
|
+
* Off, those keys are left to the app's own shortcuts.
|
|
32
|
+
*/
|
|
33
|
+
vimBindings?: boolean | undefined;
|
|
20
34
|
sx?: Sx | undefined;
|
|
21
35
|
/** A Command.Input, a Command.List and, if you like, a Command.Footer. */
|
|
22
36
|
children?: Snippet | undefined;
|
|
@@ -25,12 +39,17 @@
|
|
|
25
39
|
|
|
26
40
|
// Page Up and Page Down move the highlight this many items
|
|
27
41
|
const PAGE = 8;
|
|
42
|
+
|
|
43
|
+
// What a caret moves through, where Home and End are the field's
|
|
44
|
+
const FIELD = '[data-command-input]';
|
|
28
45
|
</script>
|
|
29
46
|
|
|
30
47
|
<script lang="ts">
|
|
31
48
|
let {
|
|
32
49
|
value = $bindable(''),
|
|
50
|
+
ref = $bindable(null),
|
|
33
51
|
loop = true,
|
|
52
|
+
vimBindings = false,
|
|
34
53
|
sx,
|
|
35
54
|
class: className,
|
|
36
55
|
children,
|
|
@@ -57,22 +76,62 @@
|
|
|
57
76
|
const at = items.findIndex((item) => item.hasAttribute('data-selected'));
|
|
58
77
|
highlight(Math.min(Math.max((at === -1 ? 0 : at) + step, 0), items.length - 1));
|
|
59
78
|
}
|
|
79
|
+
|
|
80
|
+
const keydown = (
|
|
81
|
+
event: KeyboardEvent & { currentTarget: HTMLDivElement },
|
|
82
|
+
list: ((event: KeyboardEvent) => void) | undefined
|
|
83
|
+
) => {
|
|
84
|
+
onkeydown?.(event);
|
|
85
|
+
// A word being composed keeps its keys (229: Safari's Japanese input, which sends no
|
|
86
|
+
// `isComposing`)
|
|
87
|
+
if (event.defaultPrevented || event.isComposing || event.keyCode === 229) return;
|
|
88
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
89
|
+
const inField = !!target?.matches(FIELD);
|
|
90
|
+
if (target !== event.currentTarget && !inField) return;
|
|
91
|
+
if (inField && (event.key === 'Home' || event.key === 'End')) return;
|
|
92
|
+
if (event.key === 'PageDown' || event.key === 'PageUp') {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
move(event.key === 'PageDown' ? PAGE : -PAGE);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
list?.(event);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// bits-ui means to move the highlight as its item goes, but compares the item's value with
|
|
101
|
+
// the element's id, so it never does. Here, once the items change, a highlight left on one
|
|
102
|
+
// that is gone goes back to the first.
|
|
103
|
+
$effect(() => {
|
|
104
|
+
const node = ref;
|
|
105
|
+
if (!node) return;
|
|
106
|
+
const observer = new MutationObserver(() => {
|
|
107
|
+
const items = getValidItems();
|
|
108
|
+
if (!items.length || items.some((item) => item.dataset.value === value)) return;
|
|
109
|
+
highlight(0);
|
|
110
|
+
});
|
|
111
|
+
observer.observe(node, { childList: true, subtree: true });
|
|
112
|
+
return () => observer.disconnect();
|
|
113
|
+
});
|
|
60
114
|
</script>
|
|
61
115
|
|
|
62
116
|
<Command.Root
|
|
63
117
|
bind:this={root}
|
|
64
118
|
bind:value
|
|
119
|
+
bind:ref
|
|
65
120
|
{loop}
|
|
121
|
+
{vimBindings}
|
|
66
122
|
data-slot="command"
|
|
67
123
|
{...rest}
|
|
68
|
-
onkeydown={(event: KeyboardEvent & { currentTarget: HTMLDivElement }) => {
|
|
69
|
-
onkeydown?.(event);
|
|
70
|
-
if (event.defaultPrevented || event.isComposing) return;
|
|
71
|
-
if (event.key !== 'PageDown' && event.key !== 'PageUp') return;
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
move(event.key === 'PageDown' ? PAGE : -PAGE);
|
|
74
|
-
}}
|
|
75
124
|
{...attrs([command.root, sx], className)}
|
|
76
125
|
>
|
|
77
|
-
{
|
|
126
|
+
{#snippet child({ props })}
|
|
127
|
+
{@const { onkeydown: list, ...own } = props as typeof props & {
|
|
128
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
129
|
+
}}
|
|
130
|
+
<div
|
|
131
|
+
{...own}
|
|
132
|
+
onkeydown={(event: KeyboardEvent & { currentTarget: HTMLDivElement }) => keydown(event, list)}
|
|
133
|
+
>
|
|
134
|
+
{@render children?.()}
|
|
135
|
+
</div>
|
|
136
|
+
{/snippet}
|
|
78
137
|
</Command.Root>
|
|
@@ -5,7 +5,7 @@ import { type Sx } from '../../internal/sx.js';
|
|
|
5
5
|
export type CommandRootProps = Loose<Omit<Command.RootProps, 'children' | 'child'> & {
|
|
6
6
|
/**
|
|
7
7
|
* The value of the highlighted item. Bindable: set it to move the highlight from
|
|
8
|
-
* outside
|
|
8
|
+
* outside. When the highlighted item goes, the highlight goes back to the first.
|
|
9
9
|
*/
|
|
10
10
|
value?: string | undefined;
|
|
11
11
|
/**
|
|
@@ -13,6 +13,11 @@ export type CommandRootProps = Loose<Omit<Command.RootProps, 'children' | 'child
|
|
|
13
13
|
* to rank them yourself and list only those that match: results from a server, say.
|
|
14
14
|
*/
|
|
15
15
|
shouldFilter?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Whether Ctrl with J and N, or K and P, moves the highlight too, as in Vim and Emacs.
|
|
18
|
+
* Off, those keys are left to the app's own shortcuts.
|
|
19
|
+
*/
|
|
20
|
+
vimBindings?: boolean | undefined;
|
|
16
21
|
sx?: Sx | undefined;
|
|
17
22
|
/** A Command.Input, a Command.List and, if you like, a Command.Footer. */
|
|
18
23
|
children?: Snippet | undefined;
|
|
@@ -20,7 +25,7 @@ export type CommandRootProps = Loose<Omit<Command.RootProps, 'children' | 'child
|
|
|
20
25
|
declare const CommandRoot: import("svelte").Component<Loose<Omit<Command.RootProps, "children" | "child"> & {
|
|
21
26
|
/**
|
|
22
27
|
* The value of the highlighted item. Bindable: set it to move the highlight from
|
|
23
|
-
* outside
|
|
28
|
+
* outside. When the highlighted item goes, the highlight goes back to the first.
|
|
24
29
|
*/
|
|
25
30
|
value?: string | undefined;
|
|
26
31
|
/**
|
|
@@ -28,6 +33,11 @@ declare const CommandRoot: import("svelte").Component<Loose<Omit<Command.RootPro
|
|
|
28
33
|
* to rank them yourself and list only those that match: results from a server, say.
|
|
29
34
|
*/
|
|
30
35
|
shouldFilter?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Whether Ctrl with J and N, or K and P, moves the highlight too, as in Vim and Emacs.
|
|
38
|
+
* Off, those keys are left to the app's own shortcuts.
|
|
39
|
+
*/
|
|
40
|
+
vimBindings?: boolean | undefined;
|
|
31
41
|
sx?: Sx | undefined;
|
|
32
42
|
/** A Command.Input, a Command.List and, if you like, a Command.Footer. */
|
|
33
43
|
children?: Snippet | undefined;
|
|
@@ -35,6 +45,6 @@ declare const CommandRoot: import("svelte").Component<Loose<Omit<Command.RootPro
|
|
|
35
45
|
getValidItems: () => HTMLElement[];
|
|
36
46
|
highlight: (index: number) => void;
|
|
37
47
|
move: (step: number) => void;
|
|
38
|
-
}, "value">;
|
|
48
|
+
}, "ref" | "value">;
|
|
39
49
|
type CommandRoot = ReturnType<typeof CommandRoot>;
|
|
40
50
|
export default CommandRoot;
|
|
@@ -65,11 +65,61 @@ export declare const command: Readonly<{
|
|
|
65
65
|
readonly textOverflow: stylex.StyleXClassNameFor<"textOverflow", "ellipsis">;
|
|
66
66
|
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
67
67
|
}>;
|
|
68
|
+
readonly end: Readonly<{
|
|
69
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
70
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
71
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", "0.125rem">;
|
|
72
|
+
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
|
|
73
|
+
readonly marginInlineEnd: stylex.StyleXClassNameFor<"marginInlineEnd", "-0.5rem">;
|
|
74
|
+
}>;
|
|
75
|
+
readonly badge: Readonly<{
|
|
76
|
+
readonly '--narvi-icon-size': stylex.StyleXClassNameFor<"--narvi-icon-size", "0.875rem">;
|
|
77
|
+
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
|
|
78
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
79
|
+
readonly marginInlineStart: stylex.StyleXClassNameFor<"marginInlineStart", string>;
|
|
80
|
+
readonly verticalAlign: stylex.StyleXClassNameFor<"verticalAlign", "middle">;
|
|
81
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
82
|
+
}>;
|
|
83
|
+
readonly wrapRow: Readonly<{
|
|
84
|
+
readonly flexGrow: stylex.StyleXClassNameFor<"flexGrow", 1>;
|
|
85
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
86
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
87
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
88
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
89
|
+
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", "0.375rem">;
|
|
90
|
+
}>;
|
|
91
|
+
readonly wrapLabel: Readonly<{
|
|
92
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
93
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
94
|
+
readonly textOverflow: stylex.StyleXClassNameFor<"textOverflow", "ellipsis">;
|
|
95
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
96
|
+
}>;
|
|
97
|
+
readonly wrapped: Readonly<{
|
|
98
|
+
readonly display: stylex.StyleXClassNameFor<"display", "-webkit-box">;
|
|
99
|
+
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 1000>;
|
|
100
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
101
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
102
|
+
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
103
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
104
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
105
|
+
readonly WebkitBoxOrient: stylex.StyleXClassNameFor<"WebkitBoxOrient", "vertical">;
|
|
106
|
+
readonly WebkitLineClamp: stylex.StyleXClassNameFor<"WebkitLineClamp", 2>;
|
|
107
|
+
}>;
|
|
68
108
|
readonly empty: Readonly<{
|
|
69
109
|
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
|
|
110
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
70
111
|
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
71
112
|
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "center">;
|
|
72
113
|
}>;
|
|
114
|
+
readonly emptyLoading: Readonly<{
|
|
115
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
116
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
117
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
118
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
119
|
+
}>;
|
|
120
|
+
readonly emptyError: Readonly<{
|
|
121
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
122
|
+
}>;
|
|
73
123
|
readonly footer: Readonly<{
|
|
74
124
|
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
75
125
|
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
@@ -107,12 +157,4 @@ export declare const command: Readonly<{
|
|
|
107
157
|
readonly zIndex: stylex.StyleXClassNameFor<"zIndex", 50>;
|
|
108
158
|
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", `color-mix(in oklab, ${stylex.StyleXVar<string>} 70%, transparent)`>;
|
|
109
159
|
}>;
|
|
110
|
-
readonly hidden: Readonly<{
|
|
111
|
-
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
112
|
-
readonly width: stylex.StyleXClassNameFor<"width", "1px">;
|
|
113
|
-
readonly height: stylex.StyleXClassNameFor<"height", "1px">;
|
|
114
|
-
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
115
|
-
readonly clipPath: stylex.StyleXClassNameFor<"clipPath", "inset(50%)">;
|
|
116
|
-
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
117
|
-
}>;
|
|
118
160
|
}>;
|
|
@@ -69,11 +69,61 @@ export const command = stylex.create({
|
|
|
69
69
|
textOverflow: 'ellipsis',
|
|
70
70
|
whiteSpace: 'nowrap'
|
|
71
71
|
},
|
|
72
|
+
// Controls after the field, a little nearer the edge than the words start
|
|
73
|
+
end: {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
gap: '0.125rem',
|
|
77
|
+
flexShrink: 0,
|
|
78
|
+
marginInlineEnd: '-0.5rem'
|
|
79
|
+
},
|
|
80
|
+
badge: {
|
|
81
|
+
'--narvi-icon-size': '0.875rem',
|
|
82
|
+
display: 'inline-flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
marginInlineStart: space.x2,
|
|
85
|
+
verticalAlign: 'middle',
|
|
86
|
+
color: colors.textMuted
|
|
87
|
+
},
|
|
88
|
+
// A detail that wraps: beside the label, up to two lines, and the first to give way
|
|
89
|
+
wrapRow: {
|
|
90
|
+
flexGrow: 1,
|
|
91
|
+
display: 'flex',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: space.x2,
|
|
94
|
+
minWidth: 0,
|
|
95
|
+
paddingBlock: '0.375rem'
|
|
96
|
+
},
|
|
97
|
+
wrapLabel: {
|
|
98
|
+
minWidth: 0,
|
|
99
|
+
overflow: 'hidden',
|
|
100
|
+
textOverflow: 'ellipsis',
|
|
101
|
+
whiteSpace: 'nowrap'
|
|
102
|
+
},
|
|
103
|
+
wrapped: {
|
|
104
|
+
display: '-webkit-box',
|
|
105
|
+
flexShrink: 1000,
|
|
106
|
+
minWidth: 0,
|
|
107
|
+
overflow: 'hidden',
|
|
108
|
+
overflowWrap: 'anywhere',
|
|
109
|
+
color: colors.textSubtle,
|
|
110
|
+
fontSize: font.sizeMeta,
|
|
111
|
+
WebkitBoxOrient: 'vertical',
|
|
112
|
+
WebkitLineClamp: 2
|
|
113
|
+
},
|
|
72
114
|
empty: {
|
|
73
115
|
paddingBlock: space.x8,
|
|
116
|
+
paddingInline: space.x4,
|
|
74
117
|
color: colors.textMuted,
|
|
75
118
|
textAlign: 'center'
|
|
76
119
|
},
|
|
120
|
+
emptyLoading: {
|
|
121
|
+
display: 'flex',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
gap: space.x2
|
|
125
|
+
},
|
|
126
|
+
emptyError: { color: colors.dangerText },
|
|
77
127
|
footer: {
|
|
78
128
|
display: 'flex',
|
|
79
129
|
alignItems: 'center',
|
|
@@ -112,13 +162,5 @@ export const command = stylex.create({
|
|
|
112
162
|
zIndex: 50,
|
|
113
163
|
// Lighter than a dialog's: the page behind is what is being searched
|
|
114
164
|
backgroundColor: `color-mix(in oklab, ${colors.scrim} 70%, transparent)`
|
|
115
|
-
},
|
|
116
|
-
hidden: {
|
|
117
|
-
position: 'absolute',
|
|
118
|
-
width: '1px',
|
|
119
|
-
height: '1px',
|
|
120
|
-
overflow: 'hidden',
|
|
121
|
-
clipPath: 'inset(50%)',
|
|
122
|
-
whiteSpace: 'nowrap'
|
|
123
165
|
}
|
|
124
166
|
});
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
import * as stylex from '@stylexjs/stylex';
|
|
26
26
|
import { attrs, classes, type Sx } from '../../internal/sx.js';
|
|
27
27
|
import { media } from '../../media.stylex.js';
|
|
28
|
-
import { colors } from '../../tokens.stylex.js';
|
|
28
|
+
import { colors, play } from '../../tokens.stylex.js';
|
|
29
|
+
import { whileVisible } from '../../internal/visible.js';
|
|
29
30
|
import { resolvePlugins, setMarkdownContext, type MarkdownContext } from './context.js';
|
|
30
31
|
import MarkdownBlocks from './MarkdownBlocks.svelte';
|
|
31
32
|
import MarkdownFootnotes from './MarkdownFootnotes.svelte';
|
|
@@ -134,7 +135,9 @@
|
|
|
134
135
|
WebkitUserSelect: 'none',
|
|
135
136
|
animationName: { default: null, [media.motion]: blink },
|
|
136
137
|
animationDuration: '1.1s',
|
|
137
|
-
animationIterationCount: 'infinite'
|
|
138
|
+
animationIterationCount: 'infinite',
|
|
139
|
+
// It blinks only while it can be seen
|
|
140
|
+
animationPlayState: play.whileVisible
|
|
138
141
|
},
|
|
139
142
|
block: { boxShadow: '0.36em 0 0 0.28em currentColor', borderRadius: '1px' },
|
|
140
143
|
circle: {
|
|
@@ -556,10 +559,16 @@
|
|
|
556
559
|
|
|
557
560
|
// The caret is one element, put at the end of the text after each update (see `caret.ts`)
|
|
558
561
|
let caretElement: HTMLSpanElement | null = null;
|
|
562
|
+
let stopWatchingCaret: (() => void) | void = undefined;
|
|
563
|
+
const removeCaret = () => {
|
|
564
|
+
caretElement?.remove();
|
|
565
|
+
stopWatchingCaret?.();
|
|
566
|
+
stopWatchingCaret = undefined;
|
|
567
|
+
};
|
|
559
568
|
$effect(() => {
|
|
560
569
|
if (!root) return;
|
|
561
570
|
if (!streaming || !caret) {
|
|
562
|
-
|
|
571
|
+
removeCaret();
|
|
563
572
|
return;
|
|
564
573
|
}
|
|
565
574
|
// Read, so that this runs again after every change to what is drawn
|
|
@@ -573,8 +582,9 @@
|
|
|
573
582
|
}
|
|
574
583
|
caretElement.className = caret === 'circle' ? caretClasses.circle : caretClasses.block;
|
|
575
584
|
placeCaret(root, caretElement);
|
|
585
|
+
stopWatchingCaret ??= whileVisible(caretElement);
|
|
576
586
|
});
|
|
577
|
-
$effect(() =>
|
|
587
|
+
$effect(() => removeCaret);
|
|
578
588
|
|
|
579
589
|
let mounted = false;
|
|
580
590
|
$effect(() => {
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
13
13
|
*/
|
|
14
14
|
width?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* How wide it is at least, such as `16rem`, in place of 12rem: it still fits its items,
|
|
17
|
+
* up to 22rem, and is at least as wide as its trigger.
|
|
18
|
+
*/
|
|
19
|
+
minWidth?: string | undefined;
|
|
15
20
|
sx?: Sx | undefined;
|
|
16
21
|
children?: Snippet | undefined;
|
|
17
22
|
}
|
|
@@ -23,6 +28,7 @@
|
|
|
23
28
|
sideOffset = 6,
|
|
24
29
|
collisionPadding = 8,
|
|
25
30
|
width,
|
|
31
|
+
minWidth,
|
|
26
32
|
style,
|
|
27
33
|
align = 'start',
|
|
28
34
|
sx,
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
{align}
|
|
40
46
|
data-slot="menu-content"
|
|
41
47
|
{...rest}
|
|
42
|
-
style={widthStyle(width, style)}
|
|
48
|
+
style={widthStyle(width, style, minWidth)}
|
|
43
49
|
{...attrs([layer.surface, !!width && layer.sized, sx], className)}
|
|
44
50
|
>
|
|
45
51
|
{@render children?.()}
|
|
@@ -8,6 +8,11 @@ export type MenuContentProps = Loose<Omit<DropdownMenu.ContentProps, 'children'
|
|
|
8
8
|
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
9
9
|
*/
|
|
10
10
|
width?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* How wide it is at least, such as `16rem`, in place of 12rem: it still fits its items,
|
|
13
|
+
* up to 22rem, and is at least as wide as its trigger.
|
|
14
|
+
*/
|
|
15
|
+
minWidth?: string | undefined;
|
|
11
16
|
sx?: Sx | undefined;
|
|
12
17
|
children?: Snippet | undefined;
|
|
13
18
|
}>;
|
|
@@ -17,6 +22,11 @@ declare const MenuContent: import("svelte").Component<Loose<Omit<DropdownMenu.Co
|
|
|
17
22
|
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
18
23
|
*/
|
|
19
24
|
width?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* How wide it is at least, such as `16rem`, in place of 12rem: it still fits its items,
|
|
27
|
+
* up to 22rem, and is at least as wide as its trigger.
|
|
28
|
+
*/
|
|
29
|
+
minWidth?: string | undefined;
|
|
20
30
|
sx?: Sx | undefined;
|
|
21
31
|
children?: Snippet | undefined;
|
|
22
32
|
}>, {}, "">;
|
|
@@ -173,7 +173,8 @@
|
|
|
173
173
|
<span {...stylex.attrs(styles.grow)}></span>
|
|
174
174
|
{#if trailing}<span {...stylex.attrs(styles.trail)}>{@render trailing()}</span>{/if}
|
|
175
175
|
</button>
|
|
176
|
-
|
|
176
|
+
<!-- Built while shut: a current row in it holds it open, and has to be there to -->
|
|
177
|
+
<Collapse open={shown} lazy={false} id="{uid}-rows">
|
|
177
178
|
<ul aria-label={label} {...stylex.attrs(styles.list)}>{@render children?.()}</ul>
|
|
178
179
|
</Collapse>
|
|
179
180
|
</li>
|
|
@@ -163,7 +163,8 @@
|
|
|
163
163
|
</div>
|
|
164
164
|
{/if}
|
|
165
165
|
{#if collapsible && label}
|
|
166
|
-
|
|
166
|
+
<!-- Built while shut: a current row in it holds it open, and has to be there to -->
|
|
167
|
+
<Collapse open={shown} lazy={false} id="{uid}-list">
|
|
167
168
|
<ul {...listName} {...stylex.attrs(styles.list)}>{@render children?.()}</ul>
|
|
168
169
|
</Collapse>
|
|
169
170
|
{:else}
|