@diegopluna/narvi 0.3.3 → 0.3.5
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/app-shell/AppShellMain.svelte +14 -2
- package/dist/components/app-shell/AppShellPanel.svelte +108 -12
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +11 -1
- package/dist/components/app-shell/AppShellSheet.svelte +11 -1
- package/dist/components/app-shell/context.d.ts +8 -0
- package/dist/components/app-shell/context.js +7 -0
- package/dist/components/avatar/AvatarRoot.svelte +20 -7
- package/dist/components/avatar/AvatarRoot.svelte.d.ts +10 -3
- package/dist/components/badge/Badge.svelte +13 -1
- package/dist/components/badge/Badge.svelte.d.ts +6 -0
- package/dist/components/button/Button.svelte +71 -32
- package/dist/components/button/Button.svelte.d.ts +13 -0
- package/dist/components/command/CommandDialog.svelte +24 -2
- package/dist/components/command/CommandDialog.svelte.d.ts +12 -0
- package/dist/components/command/CommandItem.svelte +15 -4
- package/dist/components/command/CommandItem.svelte.d.ts +20 -4
- package/dist/components/command/CommandRoot.svelte +57 -2
- package/dist/components/command/CommandRoot.svelte.d.ts +25 -1
- package/dist/components/composer/ComposerModelPicker.svelte +608 -53
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +56 -1
- package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
- package/dist/components/composer/ComposerSubmit.svelte +12 -2
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +6 -0
- package/dist/components/composer/index.d.ts +1 -1
- package/dist/components/input/Input.svelte.d.ts +1 -1
- package/dist/components/menu/MenuCheckboxItem.svelte +14 -5
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +15 -4
- package/dist/components/menu/MenuItem.svelte +9 -3
- package/dist/components/menu/MenuItem.svelte.d.ts +11 -4
- package/dist/components/menu/MenuRadioItem.svelte +18 -9
- package/dist/components/menu/MenuRadioItem.svelte.d.ts +15 -4
- package/dist/components/menu/MenuSubTrigger.svelte +9 -3
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +11 -4
- package/dist/components/questionnaire/Questionnaire.svelte +100 -9
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +11 -0
- package/dist/components/segmented/SegmentedControl.svelte +12 -1
- package/dist/components/segmented/SegmentedControl.svelte.d.ts +3 -1
- package/dist/components/select/Select.svelte +36 -5
- package/dist/components/select/Select.svelte.d.ts +12 -0
- package/dist/components/settings-row/SettingsRow.svelte +87 -37
- package/dist/components/settings-row/SettingsRow.svelte.d.ts +13 -0
- package/dist/components/slider/Slider.svelte.d.ts +2 -2
- package/dist/components/split-button/SplitButton.svelte +147 -0
- package/dist/components/split-button/SplitButton.svelte.d.ts +36 -0
- package/dist/components/tab-strip/TabStrip.svelte +410 -109
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +51 -3
- package/dist/components/tab-strip/drag.svelte.d.ts +31 -0
- package/dist/components/tab-strip/drag.svelte.js +148 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/internal/ItemDescription.svelte +34 -0
- package/dist/internal/ItemDescription.svelte.d.ts +10 -0
- package/dist/internal/roving.d.ts +3 -1
- package/dist/internal/roving.js +6 -3
- package/dist/media.stylex.d.ts +6 -0
- package/dist/media.stylex.js +6 -0
- package/dist/vite.js +4 -0
- package/package.json +20 -1
- package/skills/building-ui/SKILL.md +48 -20
- package/skills/building-ui/references/components.md +43 -42
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +11 -2
- package/skills/theming/SKILL.md +1 -1
|
@@ -12,8 +12,16 @@
|
|
|
12
12
|
Omit<Command.ItemProps, 'children' | 'child'> & {
|
|
13
13
|
/** A 16px icon before the label. */
|
|
14
14
|
icon?: Snippet | undefined;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A quieter note after the label, such as where a thread lives: words, or a snippet,
|
|
17
|
+
* such as one with the words that match the search marked.
|
|
18
|
+
*/
|
|
19
|
+
detail?: string | Snippet | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* What the key cap on the highlighted item says Enter does. `↵` by default; words such
|
|
22
|
+
* as "Open" for an item that does something of its own, or `null` for none.
|
|
23
|
+
*/
|
|
24
|
+
hint?: string | null | undefined;
|
|
17
25
|
/** The keys that do the same from anywhere, such as "⌘N". */
|
|
18
26
|
shortcut?: string | undefined;
|
|
19
27
|
sx?: Sx | undefined;
|
|
@@ -27,6 +35,7 @@
|
|
|
27
35
|
icon,
|
|
28
36
|
detail,
|
|
29
37
|
shortcut,
|
|
38
|
+
hint = '↵',
|
|
30
39
|
sx,
|
|
31
40
|
class: className,
|
|
32
41
|
children,
|
|
@@ -40,12 +49,14 @@
|
|
|
40
49
|
{#if icon}<span data-icons {...stylex.attrs(layer.icon)}>{@render icon()}</span>{/if}
|
|
41
50
|
<span {...stylex.attrs(layer.label)}>
|
|
42
51
|
{@render children?.()}
|
|
43
|
-
{#if detail}<span {...stylex.attrs(command.detail)}
|
|
52
|
+
{#if detail}<span {...stylex.attrs(command.detail)}
|
|
53
|
+
>{#if typeof detail === 'function'}{@render detail()}{:else}{detail}{/if}</span
|
|
54
|
+
>{/if}
|
|
44
55
|
</span>
|
|
45
56
|
<span {...stylex.attrs(layer.trailing)}>
|
|
46
57
|
{#if shortcut}{shortcut}{/if}
|
|
47
58
|
<!-- Enter is the way to choose, shown only on the highlighted row -->
|
|
48
|
-
{#if props['data-selected'] !== undefined}<Kbd
|
|
59
|
+
{#if hint !== null && props['data-selected'] !== undefined}<Kbd>{hint}</Kbd>{/if}
|
|
49
60
|
</span>
|
|
50
61
|
</div>
|
|
51
62
|
{/snippet}
|
|
@@ -5,8 +5,16 @@ import { type Sx } from '../../internal/sx.js';
|
|
|
5
5
|
export type CommandItemProps = Loose<Omit<Command.ItemProps, 'children' | 'child'> & {
|
|
6
6
|
/** A 16px icon before the label. */
|
|
7
7
|
icon?: Snippet | undefined;
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A quieter note after the label, such as where a thread lives: words, or a snippet,
|
|
10
|
+
* such as one with the words that match the search marked.
|
|
11
|
+
*/
|
|
12
|
+
detail?: string | Snippet | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* What the key cap on the highlighted item says Enter does. `↵` by default; words such
|
|
15
|
+
* as "Open" for an item that does something of its own, or `null` for none.
|
|
16
|
+
*/
|
|
17
|
+
hint?: string | null | undefined;
|
|
10
18
|
/** The keys that do the same from anywhere, such as "⌘N". */
|
|
11
19
|
shortcut?: string | undefined;
|
|
12
20
|
sx?: Sx | undefined;
|
|
@@ -15,8 +23,16 @@ export type CommandItemProps = Loose<Omit<Command.ItemProps, 'children' | 'child
|
|
|
15
23
|
declare const CommandItem: import("svelte").Component<Loose<Omit<Command.ItemProps, "children" | "child"> & {
|
|
16
24
|
/** A 16px icon before the label. */
|
|
17
25
|
icon?: Snippet | undefined;
|
|
18
|
-
/**
|
|
19
|
-
|
|
26
|
+
/**
|
|
27
|
+
* A quieter note after the label, such as where a thread lives: words, or a snippet,
|
|
28
|
+
* such as one with the words that match the search marked.
|
|
29
|
+
*/
|
|
30
|
+
detail?: string | Snippet | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* What the key cap on the highlighted item says Enter does. `↵` by default; words such
|
|
33
|
+
* as "Open" for an item that does something of its own, or `null` for none.
|
|
34
|
+
*/
|
|
35
|
+
hint?: string | null | undefined;
|
|
20
36
|
/** The keys that do the same from anywhere, such as "⌘N". */
|
|
21
37
|
shortcut?: string | undefined;
|
|
22
38
|
sx?: Sx | undefined;
|
|
@@ -7,17 +7,72 @@
|
|
|
7
7
|
|
|
8
8
|
export type CommandRootProps = Loose<
|
|
9
9
|
Omit<Command.RootProps, 'children' | 'child'> & {
|
|
10
|
+
/**
|
|
11
|
+
* The value of the highlighted item. Bindable: set it to move the highlight from
|
|
12
|
+
* outside, such as back to the first result as the app's own results change.
|
|
13
|
+
*/
|
|
14
|
+
value?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Whether it filters and sorts the items itself, as the search changes. Pass `false`
|
|
17
|
+
* to rank them yourself and list only those that match: results from a server, say.
|
|
18
|
+
*/
|
|
19
|
+
shouldFilter?: boolean | undefined;
|
|
10
20
|
sx?: Sx | undefined;
|
|
11
21
|
/** A Command.Input, a Command.List and, if you like, a Command.Footer. */
|
|
12
22
|
children?: Snippet | undefined;
|
|
13
23
|
}
|
|
14
24
|
>;
|
|
25
|
+
|
|
26
|
+
// Page Up and Page Down move the highlight this many items
|
|
27
|
+
const PAGE = 8;
|
|
15
28
|
</script>
|
|
16
29
|
|
|
17
30
|
<script lang="ts">
|
|
18
|
-
let {
|
|
31
|
+
let {
|
|
32
|
+
value = $bindable(''),
|
|
33
|
+
loop = true,
|
|
34
|
+
sx,
|
|
35
|
+
class: className,
|
|
36
|
+
children,
|
|
37
|
+
onkeydown,
|
|
38
|
+
...rest
|
|
39
|
+
}: CommandRootProps = $props();
|
|
40
|
+
|
|
41
|
+
let root = $state<ReturnType<typeof Command.Root> | null>(null);
|
|
42
|
+
|
|
43
|
+
/** The items that can be highlighted, in order: not disabled, and not filtered out. */
|
|
44
|
+
export function getValidItems(): HTMLElement[] {
|
|
45
|
+
return root?.getValidItems() ?? [];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Highlights the item at `index` among the valid items. */
|
|
49
|
+
export function highlight(index: number): void {
|
|
50
|
+
root?.updateSelectedToIndex(index);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Moves the highlight by `step` items, stopping at the ends. */
|
|
54
|
+
export function move(step: number): void {
|
|
55
|
+
const items = getValidItems();
|
|
56
|
+
if (!items.length) return;
|
|
57
|
+
const at = items.findIndex((item) => item.hasAttribute('data-selected'));
|
|
58
|
+
highlight(Math.min(Math.max((at === -1 ? 0 : at) + step, 0), items.length - 1));
|
|
59
|
+
}
|
|
19
60
|
</script>
|
|
20
61
|
|
|
21
|
-
<Command.Root
|
|
62
|
+
<Command.Root
|
|
63
|
+
bind:this={root}
|
|
64
|
+
bind:value
|
|
65
|
+
{loop}
|
|
66
|
+
data-slot="command"
|
|
67
|
+
{...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
|
+
{...attrs([command.root, sx], className)}
|
|
76
|
+
>
|
|
22
77
|
{@render children?.()}
|
|
23
78
|
</Command.Root>
|
|
@@ -3,14 +3,38 @@ import { Command } from 'bits-ui';
|
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type Sx } from '../../internal/sx.js';
|
|
5
5
|
export type CommandRootProps = Loose<Omit<Command.RootProps, 'children' | 'child'> & {
|
|
6
|
+
/**
|
|
7
|
+
* The value of the highlighted item. Bindable: set it to move the highlight from
|
|
8
|
+
* outside, such as back to the first result as the app's own results change.
|
|
9
|
+
*/
|
|
10
|
+
value?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Whether it filters and sorts the items itself, as the search changes. Pass `false`
|
|
13
|
+
* to rank them yourself and list only those that match: results from a server, say.
|
|
14
|
+
*/
|
|
15
|
+
shouldFilter?: boolean | undefined;
|
|
6
16
|
sx?: Sx | undefined;
|
|
7
17
|
/** A Command.Input, a Command.List and, if you like, a Command.Footer. */
|
|
8
18
|
children?: Snippet | undefined;
|
|
9
19
|
}>;
|
|
10
20
|
declare const CommandRoot: import("svelte").Component<Loose<Omit<Command.RootProps, "children" | "child"> & {
|
|
21
|
+
/**
|
|
22
|
+
* The value of the highlighted item. Bindable: set it to move the highlight from
|
|
23
|
+
* outside, such as back to the first result as the app's own results change.
|
|
24
|
+
*/
|
|
25
|
+
value?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Whether it filters and sorts the items itself, as the search changes. Pass `false`
|
|
28
|
+
* to rank them yourself and list only those that match: results from a server, say.
|
|
29
|
+
*/
|
|
30
|
+
shouldFilter?: boolean | undefined;
|
|
11
31
|
sx?: Sx | undefined;
|
|
12
32
|
/** A Command.Input, a Command.List and, if you like, a Command.Footer. */
|
|
13
33
|
children?: Snippet | undefined;
|
|
14
|
-
}>, {
|
|
34
|
+
}>, {
|
|
35
|
+
getValidItems: () => HTMLElement[];
|
|
36
|
+
highlight: (index: number) => void;
|
|
37
|
+
move: (step: number) => void;
|
|
38
|
+
}, "value">;
|
|
15
39
|
type CommandRoot = ReturnType<typeof CommandRoot>;
|
|
16
40
|
export default CommandRoot;
|