@diegopluna/narvi 0.4.1 → 0.5.1
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 +3 -1
- package/dist/base.css +3 -0
- package/dist/components/app-shell/AppShellPanel.svelte +3 -2
- package/dist/components/button/Button.svelte +29 -17
- package/dist/components/checkbox/Checkbox.svelte +106 -54
- package/dist/components/checkbox/Checkbox.svelte.d.ts +22 -8
- package/dist/components/choice-cards/ChoiceCards.svelte +68 -39
- package/dist/components/choice-cards/ChoiceCards.svelte.d.ts +12 -8
- package/dist/components/collapsible/CollapsibleContent.svelte +71 -17
- package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +14 -10
- package/dist/components/collapsible/CollapsibleRoot.svelte +13 -9
- package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +8 -9
- package/dist/components/collapsible/CollapsibleTrigger.svelte +24 -15
- package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +10 -14
- package/dist/components/color-field/ColorField.svelte +13 -7
- package/dist/components/command/CommandDialog.svelte +30 -20
- package/dist/components/command/CommandDialog.svelte.d.ts +4 -3
- package/dist/components/command/CommandEmpty.svelte +11 -9
- package/dist/components/command/CommandEmpty.svelte.d.ts +6 -17
- package/dist/components/command/CommandGroup.svelte +32 -11
- package/dist/components/command/CommandGroup.svelte.d.ts +7 -11
- package/dist/components/command/CommandInput.svelte +25 -10
- package/dist/components/command/CommandInput.svelte.d.ts +8 -12
- package/dist/components/command/CommandItem.svelte +67 -29
- package/dist/components/command/CommandItem.svelte.d.ts +6 -32
- package/dist/components/command/CommandList.svelte +8 -10
- package/dist/components/command/CommandList.svelte.d.ts +6 -8
- package/dist/components/command/CommandRoot.svelte +247 -57
- package/dist/components/command/CommandRoot.svelte.d.ts +14 -28
- package/dist/components/command/CommandSeparator.svelte +18 -0
- package/dist/components/command/CommandSeparator.svelte.d.ts +7 -0
- package/dist/components/command/context.d.ts +27 -0
- package/dist/components/command/context.js +16 -0
- package/dist/components/command/index.d.ts +6 -4
- package/dist/components/command/index.js +5 -4
- package/dist/components/command/score.d.ts +27 -0
- package/dist/components/command/score.js +77 -0
- package/dist/components/command/styles.d.ts +32 -9
- package/dist/components/command/styles.js +42 -14
- package/dist/components/composer/ComposerModelPicker.svelte +350 -346
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +6 -3
- package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
- package/dist/components/dialog/ConfirmDialog.svelte +73 -53
- package/dist/components/dialog/DialogClose.svelte +17 -0
- package/dist/components/dialog/DialogClose.svelte.d.ts +10 -0
- package/dist/components/dialog/DialogContent.svelte +35 -33
- package/dist/components/dialog/DialogContent.svelte.d.ts +6 -20
- package/dist/components/dialog/DialogDescription.svelte +9 -12
- package/dist/components/dialog/DialogDescription.svelte.d.ts +6 -8
- package/dist/components/dialog/DialogRoot.svelte +20 -0
- package/dist/components/dialog/DialogRoot.svelte.d.ts +7 -0
- package/dist/components/dialog/DialogTitle.svelte +12 -8
- package/dist/components/dialog/DialogTitle.svelte.d.ts +8 -8
- package/dist/components/dialog/DialogTrigger.svelte +17 -0
- package/dist/components/dialog/DialogTrigger.svelte.d.ts +10 -0
- package/dist/components/dialog/index.d.ts +6 -5
- package/dist/components/dialog/index.js +3 -6
- package/dist/components/dialog/styles.d.ts +1 -2
- package/dist/components/dialog/styles.js +11 -8
- package/dist/components/hover-card/HoverCardContent.svelte +35 -29
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -12
- package/dist/components/hover-card/HoverCardRoot.svelte +7 -7
- package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -4
- package/dist/components/hover-card/HoverCardTrigger.svelte +18 -0
- package/dist/components/hover-card/HoverCardTrigger.svelte.d.ts +10 -0
- package/dist/components/hover-card/index.d.ts +2 -3
- package/dist/components/hover-card/index.js +1 -5
- package/dist/components/input/Input.svelte.d.ts +1 -1
- package/dist/components/markdown/MarkdownBlock.svelte +6 -3
- package/dist/components/markdown/MarkdownTable.svelte +15 -7
- package/dist/components/menu/ContextMenuContent.svelte +15 -15
- package/dist/components/menu/ContextMenuContent.svelte.d.ts +6 -9
- package/dist/components/menu/ContextMenuTrigger.svelte +14 -16
- package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +8 -14
- package/dist/components/menu/MenuCheckboxItem.svelte +22 -11
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +8 -22
- package/dist/components/menu/MenuContent.svelte +16 -18
- package/dist/components/menu/MenuContent.svelte.d.ts +6 -18
- package/dist/components/menu/MenuGroup.svelte +4 -4
- package/dist/components/menu/MenuGroup.svelte.d.ts +5 -4
- package/dist/components/menu/MenuItem.svelte +25 -12
- package/dist/components/menu/MenuItem.svelte.d.ts +6 -21
- package/dist/components/menu/MenuLabel.svelte +7 -11
- package/dist/components/menu/MenuLabel.svelte.d.ts +6 -8
- package/dist/components/menu/MenuRadioGroup.svelte +4 -4
- package/dist/components/menu/MenuRadioGroup.svelte.d.ts +5 -4
- package/dist/components/menu/MenuRadioItem.svelte +16 -14
- package/dist/components/menu/MenuRadioItem.svelte.d.ts +6 -19
- package/dist/components/menu/MenuSeparator.svelte +6 -10
- package/dist/components/menu/MenuSeparator.svelte.d.ts +6 -7
- package/dist/components/menu/MenuSubContent.svelte +22 -19
- package/dist/components/menu/MenuSubContent.svelte.d.ts +8 -15
- package/dist/components/menu/MenuSubTrigger.svelte +7 -11
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -15
- package/dist/components/menu/MenuTrigger.svelte +17 -0
- package/dist/components/menu/MenuTrigger.svelte.d.ts +10 -0
- package/dist/components/menu/context-menu.d.ts +2 -2
- package/dist/components/menu/context-menu.js +3 -2
- package/dist/components/menu/group.js +1 -1
- package/dist/components/menu/index.d.ts +5 -4
- package/dist/components/menu/index.js +5 -5
- package/dist/components/menu/row.d.ts +20 -0
- package/dist/components/menu/row.js +12 -0
- package/dist/components/popover/PopoverClose.svelte +17 -0
- package/dist/components/popover/PopoverClose.svelte.d.ts +10 -0
- package/dist/components/popover/PopoverContent.svelte +30 -29
- package/dist/components/popover/PopoverContent.svelte.d.ts +6 -17
- package/dist/components/popover/PopoverTrigger.svelte +17 -0
- package/dist/components/popover/PopoverTrigger.svelte.d.ts +10 -0
- package/dist/components/popover/index.d.ts +6 -4
- package/dist/components/popover/index.js +6 -5
- package/dist/components/progress/Progress.svelte +16 -22
- package/dist/components/progress/Progress.svelte.d.ts +6 -5
- package/dist/components/reasoning/ReasoningRoot.svelte.d.ts +1 -1
- package/dist/components/resize-handle/ResizeHandle.svelte +80 -14
- package/dist/components/resize-handle/ResizeHandle.svelte.d.ts +15 -1
- package/dist/components/segmented/SegmentedControl.svelte +100 -91
- package/dist/components/segmented/SegmentedControl.svelte.d.ts +6 -4
- package/dist/components/select/Select.svelte +97 -59
- package/dist/components/select/Select.svelte.d.ts +3 -2
- package/dist/components/sheet/SheetContent.svelte +31 -38
- package/dist/components/sheet/SheetContent.svelte.d.ts +7 -22
- package/dist/components/sheet/index.d.ts +3 -5
- package/dist/components/sheet/index.js +3 -5
- package/dist/components/sheet/styles.js +26 -5
- package/dist/components/sidebar/SidebarItem.svelte +2 -3
- package/dist/components/slider/Slider.svelte +86 -65
- package/dist/components/slider/Slider.svelte.d.ts +9 -8
- package/dist/components/split-button/SplitButton.svelte +20 -3
- package/dist/components/split-button/SplitButton.svelte.d.ts +1 -1
- package/dist/components/switch/Switch.svelte +77 -49
- package/dist/components/switch/Switch.svelte.d.ts +15 -8
- package/dist/components/tab-strip/TabStrip.svelte +87 -68
- package/dist/components/tabs/Tabs.svelte +129 -99
- package/dist/components/tabs/Tabs.svelte.d.ts +6 -4
- package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
- package/dist/components/toast/Toaster.svelte +132 -115
- package/dist/components/toast/Toaster.svelte.d.ts +5 -0
- package/dist/components/toast/toasts.svelte.d.ts +10 -23
- package/dist/components/toast/toasts.svelte.js +62 -40
- package/dist/components/toggle/Toggle.svelte +15 -9
- package/dist/components/toggle/Toggle.svelte.d.ts +8 -17
- package/dist/components/toggle-group/ToggleGroupItem.svelte +20 -9
- package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +10 -10
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +33 -18
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +4 -4
- package/dist/components/tool/ToolRoot.svelte.d.ts +1 -1
- package/dist/components/tooltip/TooltipContent.svelte +38 -28
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +6 -15
- package/dist/components/tooltip/TooltipProvider.svelte +34 -10
- package/dist/components/tooltip/TooltipProvider.svelte.d.ts +18 -4
- package/dist/components/tooltip/TooltipRoot.svelte +52 -23
- package/dist/components/tooltip/TooltipRoot.svelte.d.ts +10 -10
- package/dist/components/tooltip/TooltipTrigger.svelte +14 -17
- package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +10 -4
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/work-fold/WorkFold.svelte +14 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/internal/TooltipScope.svelte +4 -4
- package/dist/internal/layer.d.ts +11 -9
- package/dist/internal/layer.js +21 -15
- package/dist/internal/loose.d.ts +30 -5
- package/dist/internal/loose.js +1 -1
- package/dist/internal/markers.stylex.d.ts +0 -4
- package/dist/internal/markers.stylex.js +0 -2
- package/dist/internal/toggle.d.ts +3 -0
- package/dist/internal/toggle.js +6 -2
- package/dist/internal/tooltip-trigger.d.ts +7 -6
- package/dist/internal/tooltip-trigger.js +9 -12
- package/dist/vite.d.ts +7 -1
- package/dist/vite.js +20 -5
- package/package.json +3 -2
- package/skills/building-ui/SKILL.md +22 -22
- package/skills/building-ui/references/components.md +30 -4
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +4 -8
- package/skills/styling/SKILL.md +1 -1
- package/skills/theming/SKILL.md +3 -7
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuCheckboxItem as UiMenuCheckboxItem } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
5
5
|
import { type Sx } from '../../internal/sx.js';
|
|
6
|
-
export
|
|
6
|
+
export interface MenuCheckboxItemProps extends Loose<Omit<PartProps<typeof UiMenuCheckboxItem>, 'children' | 'render' | 'value'> & {
|
|
7
|
+
/** Names the item to the menu's `onCheckedChange`. One is made up when it is left out. */
|
|
8
|
+
value?: string | undefined;
|
|
7
9
|
/** The keys that do the same, shown at the end, such as "⌘D". */
|
|
8
10
|
shortcut?: string | undefined;
|
|
9
11
|
/**
|
|
@@ -20,24 +22,8 @@ export type MenuCheckboxItemProps = Loose<Omit<DropdownMenu.CheckboxItemProps, '
|
|
|
20
22
|
trailing?: Snippet | undefined;
|
|
21
23
|
sx?: Sx | undefined;
|
|
22
24
|
children?: Snippet | undefined;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
shortcut?: string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* A 16px icon before the label, where the other items' icons are. The tick then goes
|
|
29
|
-
* to the end of the row, so the icons line up down the menu.
|
|
30
|
-
*/
|
|
31
|
-
icon?: Snippet | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* A line under the label, such as what the setting does. Words, or a snippet for words with an icon
|
|
34
|
-
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
35
|
-
*/
|
|
36
|
-
description?: ItemDescriptionContent | undefined;
|
|
37
|
-
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
38
|
-
trailing?: Snippet | undefined;
|
|
39
|
-
sx?: Sx | undefined;
|
|
40
|
-
children?: Snippet | undefined;
|
|
41
|
-
}>, {}, "checked">;
|
|
25
|
+
}> {
|
|
26
|
+
}
|
|
27
|
+
declare const MenuCheckboxItem: import("svelte").Component<MenuCheckboxItemProps, {}, "checked">;
|
|
42
28
|
type MenuCheckboxItem = ReturnType<typeof MenuCheckboxItem>;
|
|
43
29
|
export default MenuCheckboxItem;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuContent as UiMenuContent } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
import { layer, widthStyle } from '../../internal/layer.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
Omit<
|
|
8
|
+
export interface MenuContentProps extends Loose<
|
|
9
|
+
Omit<PartProps<typeof UiMenuContent>, 'children' | 'render'> & {
|
|
10
10
|
/**
|
|
11
11
|
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem, or
|
|
12
12
|
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
sx?: Sx | undefined;
|
|
21
21
|
children?: Snippet | undefined;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
> {}
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<script lang="ts">
|
|
@@ -38,16 +38,14 @@
|
|
|
38
38
|
}: MenuContentProps = $props();
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</DropdownMenu.Content>
|
|
53
|
-
</DropdownMenu.Portal>
|
|
41
|
+
<!-- In place, in the top layer: ui-sdk needs no portal -->
|
|
42
|
+
<UiMenuContent
|
|
43
|
+
{sideOffset}
|
|
44
|
+
{collisionPadding}
|
|
45
|
+
{align}
|
|
46
|
+
{...rest}
|
|
47
|
+
style={widthStyle(width, style, minWidth)}
|
|
48
|
+
{...attrs([layer.surface, !!width && layer.sized, sx], className)}
|
|
49
|
+
>
|
|
50
|
+
{@render children?.()}
|
|
51
|
+
</UiMenuContent>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuContent as UiMenuContent } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type Sx } from '../../internal/sx.js';
|
|
5
|
-
export
|
|
5
|
+
export interface MenuContentProps extends Loose<Omit<PartProps<typeof UiMenuContent>, 'children' | 'render'> & {
|
|
6
6
|
/**
|
|
7
7
|
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem, or
|
|
8
8
|
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
@@ -15,20 +15,8 @@ export type MenuContentProps = Loose<Omit<DropdownMenu.ContentProps, 'children'
|
|
|
15
15
|
minWidth?: string | undefined;
|
|
16
16
|
sx?: Sx | undefined;
|
|
17
17
|
children?: Snippet | undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem, or
|
|
22
|
-
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
23
|
-
*/
|
|
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;
|
|
30
|
-
sx?: Sx | undefined;
|
|
31
|
-
children?: Snippet | undefined;
|
|
32
|
-
}>, {}, "">;
|
|
18
|
+
}> {
|
|
19
|
+
}
|
|
20
|
+
declare const MenuContent: import("svelte").Component<MenuContentProps, {}, "">;
|
|
33
21
|
type MenuContent = ReturnType<typeof MenuContent>;
|
|
34
22
|
export default MenuContent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuGroup as UiMenuGroup } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import { markMenuGroup } from './group.js';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export interface MenuGroupProps extends Loose<PartProps<typeof UiMenuGroup>> {}
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
markMenuGroup();
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<
|
|
16
|
+
<UiMenuGroup {...rest} {children} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuGroup as UiMenuGroup } from '@ui-sdk/svelte/menu';
|
|
3
|
+
export interface MenuGroupProps extends Loose<PartProps<typeof UiMenuGroup>> {
|
|
4
|
+
}
|
|
5
|
+
declare const MenuGroup: import("svelte").Component<MenuGroupProps, {}, "">;
|
|
5
6
|
type MenuGroup = ReturnType<typeof MenuGroup>;
|
|
6
7
|
export default MenuGroup;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuItem as UiMenuItem } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import ItemDescription, {
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
} from '../../internal/ItemDescription.svelte';
|
|
9
9
|
import { layer } from '../../internal/layer.js';
|
|
10
10
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
11
|
+
import { row } from './row.js';
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
-
Omit<
|
|
13
|
+
export interface MenuItemProps extends Loose<
|
|
14
|
+
Omit<PartProps<typeof UiMenuItem>, 'children' | 'render' | 'shortcut'> & {
|
|
14
15
|
/** `danger` for an action that destroys or cannot be undone. */
|
|
15
16
|
tone?: 'default' | 'danger' | undefined;
|
|
16
17
|
/** The keys that do the same, shown at the end, such as "⌘D". */
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
sx?: Sx | undefined;
|
|
28
29
|
children?: Snippet | undefined;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
> {}
|
|
31
32
|
</script>
|
|
32
33
|
|
|
33
34
|
<script lang="ts">
|
|
@@ -37,18 +38,26 @@
|
|
|
37
38
|
icon,
|
|
38
39
|
description,
|
|
39
40
|
trailing,
|
|
41
|
+
disabled,
|
|
40
42
|
sx,
|
|
41
43
|
class: className,
|
|
42
44
|
children,
|
|
43
45
|
...rest
|
|
44
46
|
}: MenuItemProps = $props();
|
|
47
|
+
|
|
48
|
+
const ends = $derived(!!(shortcut || trailing));
|
|
45
49
|
</script>
|
|
46
50
|
|
|
47
|
-
<!-- Works in a Menu and in a ContextMenu alike:
|
|
48
|
-
<
|
|
49
|
-
|
|
51
|
+
<!-- Works in a Menu and in a ContextMenu alike: both are one ui-sdk Menu -->
|
|
52
|
+
<UiMenuItem
|
|
53
|
+
destructive={tone === 'danger'}
|
|
54
|
+
{disabled}
|
|
50
55
|
{...rest}
|
|
51
|
-
{...attrs(
|
|
56
|
+
{...attrs(
|
|
57
|
+
// Disabled, it is grey as any disabled item is: in red it would look as if it could be chosen
|
|
58
|
+
[layer.item, tone === 'danger' && !disabled && layer.danger, sx],
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
52
61
|
>
|
|
53
62
|
{#if icon}<span data-icons {...stylex.attrs(layer.icon)}>{@render icon()}</span>{/if}
|
|
54
63
|
{#if description}
|
|
@@ -59,7 +68,11 @@
|
|
|
59
68
|
{:else}
|
|
60
69
|
<span {...stylex.attrs(layer.label)}>{@render children?.()}</span>
|
|
61
70
|
{/if}
|
|
62
|
-
{#if
|
|
63
|
-
|
|
71
|
+
{#if ends}
|
|
72
|
+
<!-- Keys read left to right in a right-to-left menu too: "⌘B", not "B⌘" -->
|
|
73
|
+
<span {...stylex.attrs(layer.trailing, row.end)}
|
|
74
|
+
>{#if shortcut}<span dir="ltr" {...stylex.attrs(row.keys)}>{shortcut}</span
|
|
75
|
+
>{/if}{@render trailing?.()}</span
|
|
76
|
+
>
|
|
64
77
|
{/if}
|
|
65
|
-
</
|
|
78
|
+
</UiMenuItem>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuItem as UiMenuItem } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
5
5
|
import { type Sx } from '../../internal/sx.js';
|
|
6
|
-
export
|
|
6
|
+
export interface MenuItemProps extends Loose<Omit<PartProps<typeof UiMenuItem>, 'children' | 'render' | 'shortcut'> & {
|
|
7
7
|
/** `danger` for an action that destroys or cannot be undone. */
|
|
8
8
|
tone?: 'default' | 'danger' | undefined;
|
|
9
9
|
/** The keys that do the same, shown at the end, such as "⌘D". */
|
|
@@ -19,23 +19,8 @@ export type MenuItemProps = Loose<Omit<DropdownMenu.ItemProps, 'children' | 'chi
|
|
|
19
19
|
trailing?: Snippet | undefined;
|
|
20
20
|
sx?: Sx | undefined;
|
|
21
21
|
children?: Snippet | undefined;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
tone?: "default" | "danger" | undefined;
|
|
26
|
-
/** The keys that do the same, shown at the end, such as "⌘D". */
|
|
27
|
-
shortcut?: string | undefined;
|
|
28
|
-
/** A 16px icon before the label. */
|
|
29
|
-
icon?: Snippet | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* A line under the label, such as what the action does. Words, or a snippet for words with an icon
|
|
32
|
-
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
33
|
-
*/
|
|
34
|
-
description?: ItemDescriptionContent | undefined;
|
|
35
|
-
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
36
|
-
trailing?: Snippet | undefined;
|
|
37
|
-
sx?: Sx | undefined;
|
|
38
|
-
children?: Snippet | undefined;
|
|
39
|
-
}>, {}, "">;
|
|
22
|
+
}> {
|
|
23
|
+
}
|
|
24
|
+
declare const MenuItem: import("svelte").Component<MenuItemProps, {}, "">;
|
|
40
25
|
type MenuItem = ReturnType<typeof MenuItem>;
|
|
41
26
|
export default MenuItem;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuGroupLabel } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
import { layer } from '../../internal/layer.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import { inMenuGroup } from './group.js';
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
Omit<
|
|
9
|
+
export interface MenuLabelProps extends Loose<
|
|
10
|
+
Omit<PartProps<typeof MenuGroupLabel>, 'children' | 'render'> & {
|
|
11
11
|
sx?: Sx | undefined;
|
|
12
12
|
children?: Snippet | undefined;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
> {}
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<script lang="ts">
|
|
@@ -23,13 +23,9 @@
|
|
|
23
23
|
<!-- In a Menu.Group it names the group. On its own it is a heading only to the eye, with nothing
|
|
24
24
|
to name, so it is plain text there rather than an error. -->
|
|
25
25
|
{#if grouped}
|
|
26
|
-
<
|
|
27
|
-
data-slot="menu-label"
|
|
28
|
-
{...rest}
|
|
29
|
-
{...attrs([layer.heading, sx], className)}
|
|
30
|
-
>
|
|
26
|
+
<MenuGroupLabel {...rest} {...attrs([layer.heading, sx], className)}>
|
|
31
27
|
{@render children?.()}
|
|
32
|
-
</
|
|
28
|
+
</MenuGroupLabel>
|
|
33
29
|
{:else}
|
|
34
30
|
<div
|
|
35
31
|
data-slot="menu-label"
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuGroupLabel } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type Sx } from '../../internal/sx.js';
|
|
5
|
-
export
|
|
5
|
+
export interface MenuLabelProps extends Loose<Omit<PartProps<typeof MenuGroupLabel>, 'children' | 'render'> & {
|
|
6
6
|
sx?: Sx | undefined;
|
|
7
7
|
children?: Snippet | undefined;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children?: Snippet | undefined;
|
|
12
|
-
}>, {}, "">;
|
|
8
|
+
}> {
|
|
9
|
+
}
|
|
10
|
+
declare const MenuLabel: import("svelte").Component<MenuLabelProps, {}, "">;
|
|
13
11
|
type MenuLabel = ReturnType<typeof MenuLabel>;
|
|
14
12
|
export default MenuLabel;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuRadioGroup as UiMenuRadioGroup } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import { markMenuGroup } from './group.js';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export interface MenuRadioGroupProps extends Loose<PartProps<typeof UiMenuRadioGroup>> {}
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
markMenuGroup();
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<
|
|
16
|
+
<UiMenuRadioGroup bind:value {...rest} {children} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuRadioGroup as UiMenuRadioGroup } from '@ui-sdk/svelte/menu';
|
|
3
|
+
export interface MenuRadioGroupProps extends Loose<PartProps<typeof UiMenuRadioGroup>> {
|
|
4
|
+
}
|
|
5
|
+
declare const MenuRadioGroup: import("svelte").Component<MenuRadioGroupProps, {}, "value">;
|
|
5
6
|
type MenuRadioGroup = ReturnType<typeof MenuRadioGroup>;
|
|
6
7
|
export default MenuRadioGroup;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuRadioItem as UiMenuRadioItem } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import ItemDescription, {
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
} from '../../internal/ItemDescription.svelte';
|
|
9
9
|
import { layer } from '../../internal/layer.js';
|
|
10
10
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
11
|
+
import { row } from './row.js';
|
|
11
12
|
import { colors } from '../../tokens.stylex.js';
|
|
12
13
|
|
|
13
|
-
export
|
|
14
|
-
Omit<
|
|
14
|
+
export interface MenuRadioItemProps extends Loose<
|
|
15
|
+
Omit<PartProps<typeof UiMenuRadioItem>, 'children' | 'render'> & {
|
|
15
16
|
/**
|
|
16
17
|
* A line under the label, such as what the choice means. Words, or a snippet for words
|
|
17
18
|
* with an icon in them: the icon is 12px and lies in the line.
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
sx?: Sx | undefined;
|
|
27
28
|
children?: Snippet | undefined;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
> {}
|
|
30
31
|
|
|
31
32
|
const styles = stylex.create({
|
|
32
33
|
dot: {
|
|
@@ -54,14 +55,11 @@
|
|
|
54
55
|
children: label,
|
|
55
56
|
...rest
|
|
56
57
|
}: MenuRadioItemProps = $props();
|
|
58
|
+
|
|
59
|
+
const ends = $derived(!!(shortcut || trailing));
|
|
57
60
|
</script>
|
|
58
61
|
|
|
59
|
-
<
|
|
60
|
-
{closeOnSelect}
|
|
61
|
-
data-slot="menu-radio-item"
|
|
62
|
-
{...rest}
|
|
63
|
-
{...attrs([layer.item, sx], className)}
|
|
64
|
-
>
|
|
62
|
+
<UiMenuRadioItem {closeOnSelect} {...rest} {...attrs([layer.item, sx], className)}>
|
|
65
63
|
{#snippet children({ checked })}
|
|
66
64
|
<span {...stylex.attrs(layer.icon)}>
|
|
67
65
|
{#if checked}<span {...stylex.attrs(styles.dot)}></span>{/if}
|
|
@@ -71,8 +69,12 @@
|
|
|
71
69
|
<span {...stylex.attrs(layer.label, styles.label)}>{@render label?.()}</span>
|
|
72
70
|
{#if description}<ItemDescription {description} />{/if}
|
|
73
71
|
</span>
|
|
74
|
-
{#if
|
|
75
|
-
|
|
72
|
+
{#if ends}
|
|
73
|
+
<!-- Keys read left to right in a right-to-left menu too -->
|
|
74
|
+
<span {...stylex.attrs(layer.trailing, row.end)}
|
|
75
|
+
>{#if shortcut}<span dir="ltr" {...stylex.attrs(row.keys)}>{shortcut}</span
|
|
76
|
+
>{/if}{@render trailing?.()}</span
|
|
77
|
+
>
|
|
76
78
|
{/if}
|
|
77
79
|
{/snippet}
|
|
78
|
-
</
|
|
80
|
+
</UiMenuRadioItem>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuRadioItem as UiMenuRadioItem } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
5
5
|
import { type Sx } from '../../internal/sx.js';
|
|
6
|
-
export
|
|
6
|
+
export interface MenuRadioItemProps extends Loose<Omit<PartProps<typeof UiMenuRadioItem>, 'children' | 'render'> & {
|
|
7
7
|
/**
|
|
8
8
|
* A line under the label, such as what the choice means. Words, or a snippet for words
|
|
9
9
|
* with an icon in them: the icon is 12px and lies in the line.
|
|
@@ -17,21 +17,8 @@ export type MenuRadioItemProps = Loose<Omit<DropdownMenu.RadioItemProps, 'childr
|
|
|
17
17
|
trailing?: Snippet | undefined;
|
|
18
18
|
sx?: Sx | undefined;
|
|
19
19
|
children?: Snippet | undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* A line under the label, such as what the choice means. Words, or a snippet for words
|
|
24
|
-
* with an icon in them: the icon is 12px and lies in the line.
|
|
25
|
-
*/
|
|
26
|
-
description?: ItemDescriptionContent | undefined;
|
|
27
|
-
/** A 16px icon before the label. */
|
|
28
|
-
icon?: Snippet | undefined;
|
|
29
|
-
/** The keys that choose it, shown at the end, such as "⌘1". */
|
|
30
|
-
shortcut?: string | undefined;
|
|
31
|
-
/** Something at the end, after the shortcut: a badge, a count, a word such as "Default". */
|
|
32
|
-
trailing?: Snippet | undefined;
|
|
33
|
-
sx?: Sx | undefined;
|
|
34
|
-
children?: Snippet | undefined;
|
|
35
|
-
}>, {}, "">;
|
|
20
|
+
}> {
|
|
21
|
+
}
|
|
22
|
+
declare const MenuRadioItem: import("svelte").Component<MenuRadioItemProps, {}, "">;
|
|
36
23
|
type MenuRadioItem = ReturnType<typeof MenuRadioItem>;
|
|
37
24
|
export default MenuRadioItem;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuSeparator as UiMenuSeparator } from '@ui-sdk/svelte/menu';
|
|
4
4
|
import { layer } from '../../internal/layer.js';
|
|
5
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
Omit<
|
|
7
|
+
export interface MenuSeparatorProps extends Loose<
|
|
8
|
+
Omit<PartProps<typeof UiMenuSeparator>, 'children' | 'render'> & {
|
|
9
9
|
sx?: Sx | undefined;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
> {}
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<script lang="ts">
|
|
15
15
|
let { sx, class: className, ...rest }: MenuSeparatorProps = $props();
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<
|
|
19
|
-
data-slot="menu-separator"
|
|
20
|
-
{...rest}
|
|
21
|
-
{...attrs([layer.separator, sx], className)}
|
|
22
|
-
/>
|
|
18
|
+
<UiMenuSeparator {...rest} {...attrs([layer.separator, sx], className)} />
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuSeparator as UiMenuSeparator } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import { type Sx } from '../../internal/sx.js';
|
|
4
|
-
export
|
|
4
|
+
export interface MenuSeparatorProps extends Loose<Omit<PartProps<typeof UiMenuSeparator>, 'children' | 'render'> & {
|
|
5
5
|
sx?: Sx | undefined;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}>, {}, "">;
|
|
6
|
+
}> {
|
|
7
|
+
}
|
|
8
|
+
declare const MenuSeparator: import("svelte").Component<MenuSeparatorProps, {}, "">;
|
|
10
9
|
type MenuSeparator = ReturnType<typeof MenuSeparator>;
|
|
11
10
|
export default MenuSeparator;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Loose } from '../../internal/loose.js';
|
|
3
|
-
import {
|
|
2
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
3
|
+
import { MenuSubContent as UiMenuSubContent } from '@ui-sdk/svelte/menu';
|
|
4
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
5
|
import type { Snippet } from 'svelte';
|
|
5
6
|
import { layer, widthStyle } from '../../internal/layer.js';
|
|
6
7
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
-
Omit<
|
|
9
|
+
export interface MenuSubContentProps extends Loose<
|
|
10
|
+
Omit<PartProps<typeof UiMenuSubContent>, 'children' | 'render'> & {
|
|
10
11
|
/**
|
|
11
|
-
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem
|
|
12
|
-
*
|
|
12
|
+
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem up to
|
|
13
|
+
* 22rem). It is still no wider than the window has room for.
|
|
13
14
|
*/
|
|
14
15
|
width?: string | undefined;
|
|
15
16
|
sx?: Sx | undefined;
|
|
16
17
|
children?: Snippet | undefined;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
> {}
|
|
20
|
+
|
|
21
|
+
const styles = stylex.create({
|
|
22
|
+
// Its anchor is the item that opens it, as wide as the menu: it fits its own items instead
|
|
23
|
+
width: { minWidth: '12rem' }
|
|
24
|
+
});
|
|
19
25
|
</script>
|
|
20
26
|
|
|
21
27
|
<script lang="ts">
|
|
@@ -31,15 +37,12 @@
|
|
|
31
37
|
}: MenuSubContentProps = $props();
|
|
32
38
|
</script>
|
|
33
39
|
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{@render children?.()}
|
|
44
|
-
</DropdownMenu.SubContent>
|
|
45
|
-
</DropdownMenu.Portal>
|
|
40
|
+
<UiMenuSubContent
|
|
41
|
+
{sideOffset}
|
|
42
|
+
{collisionPadding}
|
|
43
|
+
{...rest}
|
|
44
|
+
style={widthStyle(width, style)}
|
|
45
|
+
{...attrs([layer.surface, styles.width, !!width && layer.sized, sx], className)}
|
|
46
|
+
>
|
|
47
|
+
{@render children?.()}
|
|
48
|
+
</UiMenuSubContent>
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import type { Loose } from '../../internal/loose.js';
|
|
2
|
-
import {
|
|
1
|
+
import type { Loose, PartProps } from '../../internal/loose.js';
|
|
2
|
+
import { MenuSubContent as UiMenuSubContent } from '@ui-sdk/svelte/menu';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type Sx } from '../../internal/sx.js';
|
|
5
|
-
export
|
|
5
|
+
export interface MenuSubContentProps extends Loose<Omit<PartProps<typeof UiMenuSubContent>, 'children' | 'render'> & {
|
|
6
6
|
/**
|
|
7
|
-
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem
|
|
8
|
-
*
|
|
7
|
+
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem up to
|
|
8
|
+
* 22rem). It is still no wider than the window has room for.
|
|
9
9
|
*/
|
|
10
10
|
width?: string | undefined;
|
|
11
11
|
sx?: Sx | undefined;
|
|
12
12
|
children?: Snippet | undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* A width of its own, such as `18rem`, in place of fitting its items (from 12rem, or
|
|
17
|
-
* the trigger's width, up to 22rem). It is still no wider than the window has room for.
|
|
18
|
-
*/
|
|
19
|
-
width?: string | undefined;
|
|
20
|
-
sx?: Sx | undefined;
|
|
21
|
-
children?: Snippet | undefined;
|
|
22
|
-
}>, {}, "">;
|
|
13
|
+
}> {
|
|
14
|
+
}
|
|
15
|
+
declare const MenuSubContent: import("svelte").Component<MenuSubContentProps, {}, "">;
|
|
23
16
|
type MenuSubContent = ReturnType<typeof MenuSubContent>;
|
|
24
17
|
export default MenuSubContent;
|