@diegopluna/narvi 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +3 -1
  2. package/dist/base.css +3 -0
  3. package/dist/components/button/Button.svelte +29 -17
  4. package/dist/components/checkbox/Checkbox.svelte +106 -54
  5. package/dist/components/checkbox/Checkbox.svelte.d.ts +22 -8
  6. package/dist/components/choice-cards/ChoiceCards.svelte +68 -39
  7. package/dist/components/choice-cards/ChoiceCards.svelte.d.ts +12 -8
  8. package/dist/components/collapsible/CollapsibleContent.svelte +71 -17
  9. package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +14 -10
  10. package/dist/components/collapsible/CollapsibleRoot.svelte +13 -9
  11. package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +8 -9
  12. package/dist/components/collapsible/CollapsibleTrigger.svelte +24 -15
  13. package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +10 -14
  14. package/dist/components/color-field/ColorField.svelte +13 -7
  15. package/dist/components/command/CommandDialog.svelte +30 -20
  16. package/dist/components/command/CommandDialog.svelte.d.ts +4 -3
  17. package/dist/components/command/CommandEmpty.svelte +11 -9
  18. package/dist/components/command/CommandEmpty.svelte.d.ts +6 -17
  19. package/dist/components/command/CommandGroup.svelte +32 -11
  20. package/dist/components/command/CommandGroup.svelte.d.ts +7 -11
  21. package/dist/components/command/CommandInput.svelte +25 -10
  22. package/dist/components/command/CommandInput.svelte.d.ts +8 -12
  23. package/dist/components/command/CommandItem.svelte +67 -29
  24. package/dist/components/command/CommandItem.svelte.d.ts +6 -32
  25. package/dist/components/command/CommandList.svelte +8 -10
  26. package/dist/components/command/CommandList.svelte.d.ts +6 -8
  27. package/dist/components/command/CommandRoot.svelte +247 -57
  28. package/dist/components/command/CommandRoot.svelte.d.ts +14 -28
  29. package/dist/components/command/CommandSeparator.svelte +18 -0
  30. package/dist/components/command/CommandSeparator.svelte.d.ts +7 -0
  31. package/dist/components/command/context.d.ts +27 -0
  32. package/dist/components/command/context.js +16 -0
  33. package/dist/components/command/index.d.ts +6 -4
  34. package/dist/components/command/index.js +5 -4
  35. package/dist/components/command/score.d.ts +27 -0
  36. package/dist/components/command/score.js +77 -0
  37. package/dist/components/command/styles.d.ts +32 -9
  38. package/dist/components/command/styles.js +42 -14
  39. package/dist/components/composer/ComposerModelPicker.svelte +365 -347
  40. package/dist/components/composer/ComposerModelPicker.svelte.d.ts +6 -3
  41. package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
  42. package/dist/components/dialog/ConfirmDialog.svelte +73 -53
  43. package/dist/components/dialog/DialogClose.svelte +17 -0
  44. package/dist/components/dialog/DialogClose.svelte.d.ts +10 -0
  45. package/dist/components/dialog/DialogContent.svelte +35 -33
  46. package/dist/components/dialog/DialogContent.svelte.d.ts +6 -20
  47. package/dist/components/dialog/DialogDescription.svelte +9 -12
  48. package/dist/components/dialog/DialogDescription.svelte.d.ts +6 -8
  49. package/dist/components/dialog/DialogRoot.svelte +20 -0
  50. package/dist/components/dialog/DialogRoot.svelte.d.ts +7 -0
  51. package/dist/components/dialog/DialogTitle.svelte +12 -8
  52. package/dist/components/dialog/DialogTitle.svelte.d.ts +8 -8
  53. package/dist/components/dialog/DialogTrigger.svelte +17 -0
  54. package/dist/components/dialog/DialogTrigger.svelte.d.ts +10 -0
  55. package/dist/components/dialog/index.d.ts +6 -5
  56. package/dist/components/dialog/index.js +3 -6
  57. package/dist/components/dialog/styles.d.ts +1 -2
  58. package/dist/components/dialog/styles.js +11 -8
  59. package/dist/components/hover-card/HoverCardContent.svelte +35 -29
  60. package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -12
  61. package/dist/components/hover-card/HoverCardRoot.svelte +7 -7
  62. package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -4
  63. package/dist/components/hover-card/HoverCardTrigger.svelte +18 -0
  64. package/dist/components/hover-card/HoverCardTrigger.svelte.d.ts +10 -0
  65. package/dist/components/hover-card/index.d.ts +2 -3
  66. package/dist/components/hover-card/index.js +1 -5
  67. package/dist/components/input/Input.svelte.d.ts +1 -1
  68. package/dist/components/markdown/MarkdownBlock.svelte +6 -3
  69. package/dist/components/markdown/MarkdownTable.svelte +15 -7
  70. package/dist/components/menu/ContextMenuContent.svelte +15 -15
  71. package/dist/components/menu/ContextMenuContent.svelte.d.ts +6 -9
  72. package/dist/components/menu/ContextMenuTrigger.svelte +14 -16
  73. package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +8 -14
  74. package/dist/components/menu/MenuCheckboxItem.svelte +22 -11
  75. package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +8 -22
  76. package/dist/components/menu/MenuContent.svelte +16 -18
  77. package/dist/components/menu/MenuContent.svelte.d.ts +6 -18
  78. package/dist/components/menu/MenuGroup.svelte +4 -4
  79. package/dist/components/menu/MenuGroup.svelte.d.ts +5 -4
  80. package/dist/components/menu/MenuItem.svelte +25 -12
  81. package/dist/components/menu/MenuItem.svelte.d.ts +6 -21
  82. package/dist/components/menu/MenuLabel.svelte +7 -11
  83. package/dist/components/menu/MenuLabel.svelte.d.ts +6 -8
  84. package/dist/components/menu/MenuRadioGroup.svelte +4 -4
  85. package/dist/components/menu/MenuRadioGroup.svelte.d.ts +5 -4
  86. package/dist/components/menu/MenuRadioItem.svelte +16 -14
  87. package/dist/components/menu/MenuRadioItem.svelte.d.ts +6 -19
  88. package/dist/components/menu/MenuSeparator.svelte +6 -10
  89. package/dist/components/menu/MenuSeparator.svelte.d.ts +6 -7
  90. package/dist/components/menu/MenuSubContent.svelte +22 -19
  91. package/dist/components/menu/MenuSubContent.svelte.d.ts +8 -15
  92. package/dist/components/menu/MenuSubTrigger.svelte +7 -11
  93. package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -15
  94. package/dist/components/menu/MenuTrigger.svelte +17 -0
  95. package/dist/components/menu/MenuTrigger.svelte.d.ts +10 -0
  96. package/dist/components/menu/context-menu.d.ts +2 -2
  97. package/dist/components/menu/context-menu.js +3 -2
  98. package/dist/components/menu/group.js +1 -1
  99. package/dist/components/menu/index.d.ts +5 -4
  100. package/dist/components/menu/index.js +5 -5
  101. package/dist/components/menu/row.d.ts +20 -0
  102. package/dist/components/menu/row.js +12 -0
  103. package/dist/components/popover/PopoverClose.svelte +17 -0
  104. package/dist/components/popover/PopoverClose.svelte.d.ts +10 -0
  105. package/dist/components/popover/PopoverContent.svelte +30 -29
  106. package/dist/components/popover/PopoverContent.svelte.d.ts +6 -17
  107. package/dist/components/popover/PopoverTrigger.svelte +17 -0
  108. package/dist/components/popover/PopoverTrigger.svelte.d.ts +10 -0
  109. package/dist/components/popover/index.d.ts +6 -4
  110. package/dist/components/popover/index.js +6 -5
  111. package/dist/components/progress/Progress.svelte +16 -22
  112. package/dist/components/progress/Progress.svelte.d.ts +6 -5
  113. package/dist/components/queued-message/QueuedMessage.svelte +10 -3
  114. package/dist/components/queued-message/QueuedMessage.svelte.d.ts +2 -1
  115. package/dist/components/rail/RailItem.svelte +20 -6
  116. package/dist/components/reasoning/ReasoningRoot.svelte.d.ts +1 -1
  117. package/dist/components/segmented/SegmentedControl.svelte +100 -91
  118. package/dist/components/segmented/SegmentedControl.svelte.d.ts +6 -4
  119. package/dist/components/select/Select.svelte +97 -59
  120. package/dist/components/select/Select.svelte.d.ts +3 -2
  121. package/dist/components/sheet/SheetContent.svelte +31 -38
  122. package/dist/components/sheet/SheetContent.svelte.d.ts +7 -22
  123. package/dist/components/sheet/index.d.ts +3 -5
  124. package/dist/components/sheet/index.js +3 -5
  125. package/dist/components/sheet/styles.js +26 -5
  126. package/dist/components/sidebar/SidebarItem.svelte +10 -6
  127. package/dist/components/slider/Slider.svelte +86 -65
  128. package/dist/components/slider/Slider.svelte.d.ts +9 -8
  129. package/dist/components/split-button/SplitButton.svelte +20 -3
  130. package/dist/components/split-button/SplitButton.svelte.d.ts +1 -1
  131. package/dist/components/switch/Switch.svelte +77 -49
  132. package/dist/components/switch/Switch.svelte.d.ts +15 -8
  133. package/dist/components/tab-strip/TabStrip.svelte +110 -76
  134. package/dist/components/tab-strip/TabStrip.svelte.d.ts +7 -2
  135. package/dist/components/tabs/Tabs.svelte +129 -99
  136. package/dist/components/tabs/Tabs.svelte.d.ts +6 -4
  137. package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
  138. package/dist/components/toast/Toaster.svelte +132 -115
  139. package/dist/components/toast/Toaster.svelte.d.ts +5 -0
  140. package/dist/components/toast/toasts.svelte.d.ts +10 -23
  141. package/dist/components/toast/toasts.svelte.js +62 -40
  142. package/dist/components/toggle/Toggle.svelte +15 -9
  143. package/dist/components/toggle/Toggle.svelte.d.ts +8 -17
  144. package/dist/components/toggle-group/ToggleGroupItem.svelte +20 -9
  145. package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +10 -10
  146. package/dist/components/toggle-group/ToggleGroupRoot.svelte +33 -18
  147. package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +4 -4
  148. package/dist/components/tool/ToolRoot.svelte.d.ts +1 -1
  149. package/dist/components/tooltip/TooltipContent.svelte +38 -28
  150. package/dist/components/tooltip/TooltipContent.svelte.d.ts +6 -15
  151. package/dist/components/tooltip/TooltipProvider.svelte +34 -10
  152. package/dist/components/tooltip/TooltipProvider.svelte.d.ts +18 -4
  153. package/dist/components/tooltip/TooltipRoot.svelte +52 -23
  154. package/dist/components/tooltip/TooltipRoot.svelte.d.ts +10 -10
  155. package/dist/components/tooltip/TooltipTrigger.svelte +14 -17
  156. package/dist/components/tooltip/TooltipTrigger.svelte.d.ts +10 -4
  157. package/dist/components/tooltip/index.d.ts +1 -1
  158. package/dist/components/tooltip/index.js +1 -1
  159. package/dist/components/work-fold/WorkFold.svelte +14 -5
  160. package/dist/index.d.ts +5 -5
  161. package/dist/index.js +1 -1
  162. package/dist/internal/TooltipScope.svelte +4 -4
  163. package/dist/internal/layer.d.ts +11 -9
  164. package/dist/internal/layer.js +21 -15
  165. package/dist/internal/loose.d.ts +30 -5
  166. package/dist/internal/loose.js +1 -1
  167. package/dist/internal/markers.stylex.d.ts +0 -4
  168. package/dist/internal/markers.stylex.js +0 -2
  169. package/dist/internal/toggle.d.ts +3 -0
  170. package/dist/internal/toggle.js +6 -2
  171. package/dist/internal/tooltip-trigger.d.ts +7 -6
  172. package/dist/internal/tooltip-trigger.js +9 -12
  173. package/dist/typography.d.ts +5 -0
  174. package/dist/typography.js +5 -0
  175. package/dist/vite.d.ts +7 -1
  176. package/dist/vite.js +20 -5
  177. package/package.json +3 -2
  178. package/skills/building-ui/SKILL.md +21 -21
  179. package/skills/building-ui/references/components.md +22 -7
  180. package/skills/markdown/SKILL.md +1 -1
  181. package/skills/setup/SKILL.md +4 -8
  182. package/skills/styling/SKILL.md +4 -2
  183. package/skills/theming/SKILL.md +3 -7
@@ -1,9 +1,11 @@
1
- import type { Loose } from '../../internal/loose.js';
2
- import { DropdownMenu } from 'bits-ui';
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 type MenuCheckboxItemProps = Loose<Omit<DropdownMenu.CheckboxItemProps, 'children' | 'child'> & {
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
- declare const MenuCheckboxItem: import("svelte").Component<Loose<Omit<DropdownMenu.CheckboxItemProps, "children" | "child"> & {
25
- /** The keys that do the same, shown at the end, such as "⌘D". */
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 { DropdownMenu } from 'bits-ui';
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 type MenuContentProps = Loose<
9
- Omit<DropdownMenu.ContentProps, 'children' | 'child'> & {
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
- <DropdownMenu.Portal>
42
- <DropdownMenu.Content
43
- {sideOffset}
44
- {collisionPadding}
45
- {align}
46
- data-slot="menu-content"
47
- {...rest}
48
- style={widthStyle(width, style, minWidth)}
49
- {...attrs([layer.surface, !!width && layer.sized, sx], className)}
50
- >
51
- {@render children?.()}
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 { DropdownMenu } from 'bits-ui';
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 type MenuContentProps = Loose<Omit<DropdownMenu.ContentProps, 'children' | 'child'> & {
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
- declare const MenuContent: import("svelte").Component<Loose<Omit<DropdownMenu.ContentProps, "children" | "child"> & {
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 { DropdownMenu } from 'bits-ui';
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 type MenuGroupProps = Loose<DropdownMenu.GroupProps>;
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
- <DropdownMenu.Group {...rest}>{@render children?.()}</DropdownMenu.Group>
16
+ <UiMenuGroup {...rest} {children} />
@@ -1,6 +1,7 @@
1
- import type { Loose } from '../../internal/loose.js';
2
- import { DropdownMenu } from 'bits-ui';
3
- export type MenuGroupProps = Loose<DropdownMenu.GroupProps>;
4
- declare const MenuGroup: import("svelte").Component<Loose<DropdownMenu.GroupProps>, {}, "">;
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 { DropdownMenu } from 'bits-ui';
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 type MenuItemProps = Loose<
13
- Omit<DropdownMenu.ItemProps, 'children' | 'child'> & {
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: bits-ui shares its items -->
48
- <DropdownMenu.Item
49
- data-slot="menu-item"
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([layer.item, tone === 'danger' && layer.danger, sx], className)}
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 shortcut || trailing}
63
- <span {...stylex.attrs(layer.trailing)}>{shortcut}{@render trailing?.()}</span>
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
- </DropdownMenu.Item>
78
+ </UiMenuItem>
@@ -1,9 +1,9 @@
1
- import type { Loose } from '../../internal/loose.js';
2
- import { DropdownMenu } from 'bits-ui';
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 type MenuItemProps = Loose<Omit<DropdownMenu.ItemProps, 'children' | 'child'> & {
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
- declare const MenuItem: import("svelte").Component<Loose<Omit<DropdownMenu.ItemProps, "children" | "child"> & {
24
- /** `danger` for an action that destroys or cannot be undone. */
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 { DropdownMenu } from 'bits-ui';
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 type MenuLabelProps = Loose<
10
- Omit<DropdownMenu.GroupHeadingProps, 'children' | 'child'> & {
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
- <DropdownMenu.GroupHeading
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
- </DropdownMenu.GroupHeading>
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 { DropdownMenu } from 'bits-ui';
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 type MenuLabelProps = Loose<Omit<DropdownMenu.GroupHeadingProps, 'children' | 'child'> & {
5
+ export interface MenuLabelProps extends Loose<Omit<PartProps<typeof MenuGroupLabel>, 'children' | 'render'> & {
6
6
  sx?: Sx | undefined;
7
7
  children?: Snippet | undefined;
8
- }>;
9
- declare const MenuLabel: import("svelte").Component<Loose<Omit<DropdownMenu.GroupHeadingProps, "children" | "child"> & {
10
- sx?: Sx | undefined;
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 { DropdownMenu } from 'bits-ui';
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 type MenuRadioGroupProps = Loose<DropdownMenu.RadioGroupProps>;
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
- <DropdownMenu.RadioGroup bind:value {...rest}>{@render children?.()}</DropdownMenu.RadioGroup>
16
+ <UiMenuRadioGroup bind:value {...rest} {children} />
@@ -1,6 +1,7 @@
1
- import type { Loose } from '../../internal/loose.js';
2
- import { DropdownMenu } from 'bits-ui';
3
- export type MenuRadioGroupProps = Loose<DropdownMenu.RadioGroupProps>;
4
- declare const MenuRadioGroup: import("svelte").Component<Loose<DropdownMenu.RadioGroupProps>, {}, "value">;
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 { DropdownMenu } from 'bits-ui';
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 type MenuRadioItemProps = Loose<
14
- Omit<DropdownMenu.RadioItemProps, 'children' | 'child'> & {
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
- <DropdownMenu.RadioItem
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 shortcut || trailing}
75
- <span {...stylex.attrs(layer.trailing)}>{shortcut}{@render trailing?.()}</span>
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
- </DropdownMenu.RadioItem>
80
+ </UiMenuRadioItem>
@@ -1,9 +1,9 @@
1
- import type { Loose } from '../../internal/loose.js';
2
- import { DropdownMenu } from 'bits-ui';
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 type MenuRadioItemProps = Loose<Omit<DropdownMenu.RadioItemProps, 'children' | 'child'> & {
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
- declare const MenuRadioItem: import("svelte").Component<Loose<Omit<DropdownMenu.RadioItemProps, "children" | "child"> & {
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 { DropdownMenu } from 'bits-ui';
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 type MenuSeparatorProps = Loose<
8
- Omit<DropdownMenu.SeparatorProps, 'children' | 'child'> & {
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
- <DropdownMenu.Separator
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 { DropdownMenu } from 'bits-ui';
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 type MenuSeparatorProps = Loose<Omit<DropdownMenu.SeparatorProps, 'children' | 'child'> & {
4
+ export interface MenuSeparatorProps extends Loose<Omit<PartProps<typeof UiMenuSeparator>, 'children' | 'render'> & {
5
5
  sx?: Sx | undefined;
6
- }>;
7
- declare const MenuSeparator: import("svelte").Component<Loose<Omit<DropdownMenu.SeparatorProps, "children" | "child"> & {
8
- sx?: Sx | undefined;
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 { DropdownMenu } from 'bits-ui';
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 type MenuSubContentProps = Loose<
9
- Omit<DropdownMenu.SubContentProps, 'children' | 'child'> & {
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, or
12
- * the trigger's width, up to 22rem). It is still no wider than the window has room for.
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
- <DropdownMenu.Portal>
35
- <DropdownMenu.SubContent
36
- {sideOffset}
37
- {collisionPadding}
38
- data-slot="menu-sub-content"
39
- {...rest}
40
- style={widthStyle(width, style)}
41
- {...attrs([layer.surface, !!width && layer.sized, sx], className)}
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 { DropdownMenu } from 'bits-ui';
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 type MenuSubContentProps = Loose<Omit<DropdownMenu.SubContentProps, 'children' | 'child'> & {
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, or
8
- * the trigger's width, up to 22rem). It is still no wider than the window has room for.
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
- declare const MenuSubContent: import("svelte").Component<Loose<Omit<DropdownMenu.SubContentProps, "children" | "child"> & {
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;