svelora 3.0.0 → 3.0.2

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 (109) hide show
  1. package/dist/Accordion/Accordion.svelte +66 -97
  2. package/dist/Alert/Alert.svelte +39 -64
  3. package/dist/Alert/Alert.svelte.d.ts +1 -1
  4. package/dist/Avatar/Avatar.svelte +35 -75
  5. package/dist/AvatarGroup/AvatarGroup.svelte +38 -55
  6. package/dist/Badge/Badge.svelte +28 -50
  7. package/dist/Banner/Banner.svelte +46 -41
  8. package/dist/Banner/Banner.svelte.d.ts +1 -1
  9. package/dist/Breadcrumb/Breadcrumb.svelte +32 -26
  10. package/dist/Button/Button.svelte +70 -138
  11. package/dist/Calendar/Calendar.svelte +94 -157
  12. package/dist/Calendar/Calendar.svelte.d.ts +1 -1
  13. package/dist/Card/Card.svelte +18 -31
  14. package/dist/Carousel/Carousel.svelte +118 -173
  15. package/dist/Checkbox/Checkbox.svelte +52 -97
  16. package/dist/CheckboxGroup/CheckboxGroup.svelte +62 -107
  17. package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +1 -1
  18. package/dist/Chip/Chip.svelte +22 -34
  19. package/dist/CodeBlock/CodeBlock.svelte +42 -59
  20. package/dist/Collapsible/Collapsible.svelte +22 -38
  21. package/dist/Collapsible/Collapsible.svelte.d.ts +1 -1
  22. package/dist/Collapsible/CollapsibleTestWrapper.svelte +2 -5
  23. package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +1 -1
  24. package/dist/Command/Command.svelte +40 -77
  25. package/dist/Command/Command.svelte.d.ts +1 -1
  26. package/dist/Command/CommandTestWrapper.svelte +2 -10
  27. package/dist/Command/CommandTestWrapper.svelte.d.ts +1 -1
  28. package/dist/Container/Container.svelte +11 -14
  29. package/dist/ContextMenu/ContextMenu.svelte +51 -114
  30. package/dist/ContextMenu/ContextMenu.svelte.d.ts +1 -1
  31. package/dist/Drawer/Drawer.svelte +72 -110
  32. package/dist/Drawer/DrawerTriggerTestWrapper.svelte +1 -2
  33. package/dist/DropdownMenu/DropdownMenu.svelte +63 -124
  34. package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +1 -1
  35. package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte +2 -5
  36. package/dist/Editor/Editor.svelte +441 -576
  37. package/dist/Editor/Editor.svelte.d.ts +1 -1
  38. package/dist/Editor/EditorUrlPrompt.svelte +40 -53
  39. package/dist/Editor/SlashPopup.svelte +12 -24
  40. package/dist/Empty/Empty.svelte +32 -63
  41. package/dist/FieldGroup/FieldGroup.svelte +23 -38
  42. package/dist/FileUpload/FileUpload.svelte +242 -320
  43. package/dist/FileUpload/FileUpload.svelte.d.ts +1 -1
  44. package/dist/Fonts/Fonts.svelte +15 -37
  45. package/dist/Form/Form.svelte +112 -170
  46. package/dist/FormField/FormField.svelte +102 -135
  47. package/dist/Icon/Icon.svelte +7 -32
  48. package/dist/Input/Input.svelte +71 -141
  49. package/dist/Input/Input.svelte.d.ts +2 -2
  50. package/dist/Kbd/Kbd.svelte +18 -34
  51. package/dist/Link/Link.svelte +129 -196
  52. package/dist/LocaleButton/LocaleButton.svelte +165 -0
  53. package/dist/LocaleButton/LocaleButton.svelte.d.ts +5 -0
  54. package/dist/LocaleButton/index.d.ts +2 -0
  55. package/dist/LocaleButton/index.js +1 -0
  56. package/dist/LocaleButton/locale-button.types.d.ts +182 -0
  57. package/dist/LocaleButton/locale-button.types.js +1 -0
  58. package/dist/LocaleButton/locale-button.variants.d.ts +61 -0
  59. package/dist/LocaleButton/locale-button.variants.js +34 -0
  60. package/dist/Modal/Modal.svelte +52 -106
  61. package/dist/Modal/ModalTriggerTestWrapper.svelte +1 -2
  62. package/dist/Pagination/Pagination.svelte +48 -92
  63. package/dist/Pagination/pagination.variants.d.ts +1 -1
  64. package/dist/PinInput/PinInput.svelte +57 -111
  65. package/dist/PinInput/PinInput.svelte.d.ts +1 -1
  66. package/dist/Popover/Popover.svelte +28 -61
  67. package/dist/Popover/Popover.svelte.d.ts +1 -1
  68. package/dist/Progress/Progress.svelte +75 -94
  69. package/dist/RadioGroup/RadioGroup.svelte +54 -99
  70. package/dist/RadioGroup/RadioGroup.svelte.d.ts +1 -1
  71. package/dist/Select/Select.svelte +112 -269
  72. package/dist/Select/Select.svelte.d.ts +1 -1
  73. package/dist/SelectMenu/SelectMenu.svelte +211 -409
  74. package/dist/SelectMenu/SelectMenu.svelte.d.ts +1 -1
  75. package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte +3 -6
  76. package/dist/Separator/Separator.svelte +29 -44
  77. package/dist/Skeleton/Skeleton.svelte +11 -23
  78. package/dist/Slideover/Slideover.svelte +52 -106
  79. package/dist/Slideover/SlideoverTriggerTestWrapper.svelte +1 -2
  80. package/dist/Slider/Slider.svelte +48 -84
  81. package/dist/Slider/Slider.svelte.d.ts +1 -1
  82. package/dist/Stepper/Stepper.svelte +139 -132
  83. package/dist/Stepper/Stepper.svelte.d.ts +1 -1
  84. package/dist/Switch/Switch.svelte +62 -98
  85. package/dist/Table/Table.svelte +232 -283
  86. package/dist/Table/table.variants.d.ts +1 -1
  87. package/dist/Tabs/Tabs.svelte +96 -129
  88. package/dist/Tabs/Tabs.svelte.d.ts +1 -1
  89. package/dist/Textarea/Textarea.svelte +90 -173
  90. package/dist/Textarea/Textarea.svelte.d.ts +1 -1
  91. package/dist/ThemeModeButton/ThemeModeButton.svelte +16 -38
  92. package/dist/Timeline/Timeline.svelte +75 -54
  93. package/dist/Toast/Toaster.svelte +8 -25
  94. package/dist/Tooltip/Tooltip.svelte +34 -66
  95. package/dist/Tooltip/Tooltip.svelte.d.ts +1 -1
  96. package/dist/Tooltip/TooltipTestWrapper.svelte +2 -5
  97. package/dist/User/User.svelte +33 -49
  98. package/dist/docs/navigation.d.ts +1 -1
  99. package/dist/docs/navigation.js +8 -1
  100. package/dist/hooks/HookContextProbe.svelte +2 -4
  101. package/dist/hooks/HookContextProvider.svelte +8 -6
  102. package/dist/hooks/HookEmitProbe.svelte +8 -11
  103. package/dist/i18n.d.ts +2 -0
  104. package/dist/i18n.js +19 -0
  105. package/dist/index.d.ts +1 -0
  106. package/dist/index.js +1 -0
  107. package/dist/mcp/svelora-docs.data.json +4 -2
  108. package/dist/theme.css +1 -1
  109. package/package.json +16 -8
@@ -1,82 +1,45 @@
1
- <script lang="ts" module>
2
- import type { CommandProps } from './command.types.js'
3
-
4
- export type Props = CommandProps
1
+ <script lang="ts" module>export {};
5
2
  </script>
6
3
 
7
- <script lang="ts">
8
- import { Command } from 'bits-ui'
9
- import { getComponentConfig, iconsDefaults } from '../config.js'
10
- import Icon from '../Icon/Icon.svelte'
11
- import { commandDefaults, commandVariants } from './command.variants.js'
12
-
13
- const config = getComponentConfig('command', commandDefaults)
14
- const icons = getComponentConfig('icons', iconsDefaults)
15
-
16
- let {
17
- ref = $bindable(null),
18
- value = $bindable(''),
19
- search = $bindable(''),
20
- onValueChange,
21
- groups = [],
22
- placeholder = 'Type a command or search...',
23
- loading = false,
24
- emptyText = 'No results found.',
25
- icon,
26
- label,
27
- filter,
28
- shouldFilter = true,
29
- loop = false,
30
- vimBindings = true,
31
- size = config.defaultVariants.size,
32
- item: itemSlot,
33
- itemLeading: itemLeadingSlot,
34
- itemLabel: itemLabelSlot,
35
- itemTrailing: itemTrailingSlot,
36
- empty: emptySlot,
37
- footer: footerSlot,
38
- ui,
39
- class: className,
40
- ...restProps
41
- }: Props = $props()
42
-
43
- const slots = $derived(commandVariants({ size }))
44
- const classes = $derived.by(() => {
45
- const u = ui ?? {}
46
- return {
47
- root: slots.root({ class: [config.slots.root, className, u.root] }),
48
- inputWrapper: slots.inputWrapper({
49
- class: [config.slots.inputWrapper, u.inputWrapper]
50
- }),
51
- inputIcon: slots.inputIcon({ class: [config.slots.inputIcon, u.inputIcon] }),
52
- input: slots.input({ class: [config.slots.input, u.input] }),
53
- list: slots.list({ class: [config.slots.list, u.list] }),
54
- empty: slots.empty({ class: [config.slots.empty, u.empty] }),
55
- loading: slots.loading({ class: [config.slots.loading, u.loading] }),
56
- group: slots.group({ class: [config.slots.group, u.group] }),
57
- groupHeading: slots.groupHeading({
58
- class: [config.slots.groupHeading, u.groupHeading]
59
- }),
60
- groupItems: slots.groupItems({ class: [config.slots.groupItems, u.groupItems] }),
61
- separator: slots.separator({ class: [config.slots.separator, u.separator] }),
62
- item: slots.item({ class: [config.slots.item, u.item] }),
63
- itemIcon: slots.itemIcon({ class: [config.slots.itemIcon, u.itemIcon] }),
64
- itemWrapper: slots.itemWrapper({ class: [config.slots.itemWrapper, u.itemWrapper] }),
65
- itemLabel: slots.itemLabel({ class: [config.slots.itemLabel, u.itemLabel] }),
66
- itemDescription: slots.itemDescription({
67
- class: [config.slots.itemDescription, u.itemDescription]
68
- }),
69
- itemTrailing: slots.itemTrailing({
70
- class: [config.slots.itemTrailing, u.itemTrailing]
71
- }),
72
- footer: slots.footer({ class: [config.slots.footer, u.footer] })
73
- }
74
- })
75
-
76
- function handleValueChange(v: string) {
77
- value = v
78
- onValueChange?.(v)
79
- }
4
+ <script lang="ts">import { Command } from "bits-ui";
5
+ import { getComponentConfig, iconsDefaults } from "../config.js";
6
+ import Icon from "../Icon/Icon.svelte";
7
+ import { commandDefaults, commandVariants } from "./command.variants.js";
8
+ const config = getComponentConfig("command", commandDefaults);
9
+ const icons = getComponentConfig("icons", iconsDefaults);
10
+ let { ref = $bindable(null), value = $bindable(""), search = $bindable(""), onValueChange, groups = [], placeholder = "Type a command or search...", loading = false, emptyText = "No results found.", icon, label, filter, shouldFilter = true, loop = false, vimBindings = true, size = config.defaultVariants.size, item: itemSlot, itemLeading: itemLeadingSlot, itemLabel: itemLabelSlot, itemTrailing: itemTrailingSlot, empty: emptySlot, footer: footerSlot, ui, class: className, ...restProps } = $props();
11
+ const slots = $derived(commandVariants({ size }));
12
+ const classes = $derived.by(() => {
13
+ const u = ui ?? {};
14
+ return {
15
+ root: slots.root({ class: [
16
+ config.slots.root,
17
+ className,
18
+ u.root
19
+ ] }),
20
+ inputWrapper: slots.inputWrapper({ class: [config.slots.inputWrapper, u.inputWrapper] }),
21
+ inputIcon: slots.inputIcon({ class: [config.slots.inputIcon, u.inputIcon] }),
22
+ input: slots.input({ class: [config.slots.input, u.input] }),
23
+ list: slots.list({ class: [config.slots.list, u.list] }),
24
+ empty: slots.empty({ class: [config.slots.empty, u.empty] }),
25
+ loading: slots.loading({ class: [config.slots.loading, u.loading] }),
26
+ group: slots.group({ class: [config.slots.group, u.group] }),
27
+ groupHeading: slots.groupHeading({ class: [config.slots.groupHeading, u.groupHeading] }),
28
+ groupItems: slots.groupItems({ class: [config.slots.groupItems, u.groupItems] }),
29
+ separator: slots.separator({ class: [config.slots.separator, u.separator] }),
30
+ item: slots.item({ class: [config.slots.item, u.item] }),
31
+ itemIcon: slots.itemIcon({ class: [config.slots.itemIcon, u.itemIcon] }),
32
+ itemWrapper: slots.itemWrapper({ class: [config.slots.itemWrapper, u.itemWrapper] }),
33
+ itemLabel: slots.itemLabel({ class: [config.slots.itemLabel, u.itemLabel] }),
34
+ itemDescription: slots.itemDescription({ class: [config.slots.itemDescription, u.itemDescription] }),
35
+ itemTrailing: slots.itemTrailing({ class: [config.slots.itemTrailing, u.itemTrailing] }),
36
+ footer: slots.footer({ class: [config.slots.footer, u.footer] })
37
+ };
38
+ });
39
+ function handleValueChange(v) {
40
+ value = v;
41
+ onValueChange?.(v);
42
+ }
80
43
  </script>
81
44
 
82
45
  <Command.Root
@@ -1,6 +1,6 @@
1
1
  import type { CommandProps } from './command.types.js';
2
2
  export type Props = CommandProps;
3
3
  import { Command } from 'bits-ui';
4
- declare const Command: import("svelte").Component<CommandProps, {}, "search" | "value" | "ref">;
4
+ declare const Command: import("svelte").Component<CommandProps, {}, "search" | "ref" | "value">;
5
5
  type Command = ReturnType<typeof Command>;
6
6
  export default Command;
@@ -1,13 +1,5 @@
1
- <script lang="ts">
2
- import Command from './Command.svelte'
3
- import type { CommandProps } from './command.types.js'
4
-
5
- let {
6
- ...props
7
- }: Omit<
8
- CommandProps,
9
- 'item' | 'itemLeading' | 'itemLabel' | 'itemTrailing' | 'empty' | 'footer'
10
- > = $props()
1
+ <script lang="ts">import Command from "./Command.svelte";
2
+ let { ...props } = $props();
11
3
  </script>
12
4
 
13
5
  <Command {...props} />
@@ -1,4 +1,4 @@
1
1
  import type { CommandProps } from './command.types.js';
2
- declare const CommandTestWrapper: import("svelte").Component<Omit<CommandProps, "item" | "footer" | "empty" | "itemLabel" | "itemTrailing" | "itemLeading">, {}, "">;
2
+ declare const CommandTestWrapper: import("svelte").Component<Omit<CommandProps, "itemLeading" | "itemLabel" | "item" | "footer" | "itemTrailing" | "empty">, {}, "">;
3
3
  type CommandTestWrapper = ReturnType<typeof CommandTestWrapper>;
4
4
  export default CommandTestWrapper;
@@ -1,19 +1,16 @@
1
- <script lang="ts" module>
2
- import type { ContainerProps } from './container.types.js'
3
-
4
- export type Props = ContainerProps
1
+ <script lang="ts" module>export {};
5
2
  </script>
6
3
 
7
- <script lang="ts">
8
- import { getComponentConfig } from '../config.js'
9
- import { containerDefaults, containerVariants } from './container.variants.js'
10
-
11
- const config = getComponentConfig('container', containerDefaults)
12
- const slots = containerVariants()
13
-
14
- let { as = 'div', ui, class: className, children, ...restProps }: Props = $props()
15
-
16
- const rootClass = $derived(slots.root({ class: [config.slots.root, className, ui?.root] }))
4
+ <script lang="ts">import { getComponentConfig } from "../config.js";
5
+ import { containerDefaults, containerVariants } from "./container.variants.js";
6
+ const config = getComponentConfig("container", containerDefaults);
7
+ const slots = containerVariants();
8
+ let { as = "div", ui, class: className, children, ...restProps } = $props();
9
+ const rootClass = $derived(slots.root({ class: [
10
+ config.slots.root,
11
+ className,
12
+ ui?.root
13
+ ] }));
17
14
  </script>
18
15
 
19
16
  <svelte:element this={as} class={rootClass} {...restProps}>
@@ -1,119 +1,56 @@
1
- <script lang="ts" module>
2
- import type {
3
- ContextMenuItem,
4
- ContextMenuItemAction,
5
- ContextMenuItemCheckbox,
6
- ContextMenuItemRadio,
7
- ContextMenuItemSub,
8
- ContextMenuProps
9
- } from './context-menu.types.js'
10
-
11
- export type Props = ContextMenuProps
1
+ <script lang="ts" module>export {};
12
2
  </script>
13
3
 
14
- <script lang="ts">
15
- import { ContextMenu } from 'bits-ui'
16
- import { getComponentConfig, iconsDefaults } from '../config.js'
17
- import Icon from '../Icon/Icon.svelte'
18
- import Kbd from '../Kbd/Kbd.svelte'
19
- import {
20
- contextMenuDefaults,
21
- contextMenuVariants,
22
- itemColorClasses
23
- } from './context-menu.variants.js'
24
-
25
- const config = getComponentConfig('contextMenu', contextMenuDefaults)
26
- const icons = getComponentConfig('icons', iconsDefaults)
27
-
28
- let {
29
- ref = $bindable(null),
30
- open = $bindable(false),
31
- onOpenChange,
32
- items = [],
33
- radioGroups = [],
34
- checkedIcon = icons.check,
35
- submenuIcon = icons.chevronRight,
36
- sideOffset = 4,
37
- alignOffset = 0,
38
- avoidCollisions = true,
39
- collisionBoundary,
40
- collisionPadding = 8,
41
- hideWhenDetached = false,
42
- onEscapeKeydown,
43
- onInteractOutside,
44
- onCloseAutoFocus,
45
- forceMount,
46
- loop = true,
47
- transition = config.defaultVariants.transition ?? true,
48
- portal = true,
49
- size = config.defaultVariants.size ?? 'md',
50
- ui,
51
- class: className,
52
- children,
53
- header,
54
- footer,
55
- item: itemSlot,
56
- itemLeading,
57
- itemLabel,
58
- itemTrailing,
59
- content: contentSlot
60
- }: Props = $props()
61
-
62
- const hasRadioItems = $derived(items.some((i) => i.type === 'radio'))
63
- const firstRadioGroup = $derived(radioGroups[0])
64
-
65
- const variantSlots = $derived(contextMenuVariants({ transition, size }))
66
- const classes = $derived({
67
- content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
68
- group: variantSlots.group({ class: [config.slots.group, ui?.group] }),
69
- separator: variantSlots.separator({ class: [config.slots.separator, ui?.separator] }),
70
- label: variantSlots.label({ class: [config.slots.label, ui?.label] }),
71
- item: variantSlots.item({ class: [config.slots.item, ui?.item] }),
72
- itemLeadingIcon: variantSlots.itemLeadingIcon({
73
- class: [config.slots.itemLeadingIcon, ui?.itemLeadingIcon]
74
- }),
75
- itemLabel: variantSlots.itemLabel({ class: [config.slots.itemLabel, ui?.itemLabel] }),
76
- itemTrailingKbds: variantSlots.itemTrailingKbds({
77
- class: [config.slots.itemTrailingKbds, ui?.itemTrailingKbds]
78
- }),
79
- itemIndicator: variantSlots.itemIndicator({
80
- class: [config.slots.itemIndicator, ui?.itemIndicator]
81
- }),
82
- subTrigger: variantSlots.subTrigger({ class: [config.slots.subTrigger, ui?.subTrigger] }),
83
- subTriggerIcon: variantSlots.subTriggerIcon({
84
- class: [config.slots.subTriggerIcon, ui?.subTriggerIcon]
85
- }),
86
- subContent: variantSlots.subContent({ class: [config.slots.subContent, ui?.subContent] })
87
- })
88
-
89
- function close() {
90
- open = false
91
- }
92
-
93
- // Type guards
94
- function isActionItem(item: ContextMenuItem): item is ContextMenuItemAction {
95
- return !item.type || item.type === 'item'
96
- }
97
-
98
- function isCheckboxItem(item: ContextMenuItem): item is ContextMenuItemCheckbox {
99
- return item.type === 'checkbox'
100
- }
101
-
102
- function isRadioItem(item: ContextMenuItem): item is ContextMenuItemRadio {
103
- return item.type === 'radio'
104
- }
105
-
106
- function isSubItem(item: ContextMenuItem): item is ContextMenuItemSub {
107
- return item.type === 'sub'
108
- }
109
-
110
- function isSeparator(item: ContextMenuItem): item is { type: 'separator' } {
111
- return item.type === 'separator'
112
- }
113
-
114
- function isLabel(item: ContextMenuItem): item is { type: 'label'; label: string } {
115
- return item.type === 'label'
116
- }
4
+ <script lang="ts">import { ContextMenu } from "bits-ui";
5
+ import { getComponentConfig, iconsDefaults } from "../config.js";
6
+ import Icon from "../Icon/Icon.svelte";
7
+ import Kbd from "../Kbd/Kbd.svelte";
8
+ import { contextMenuDefaults, contextMenuVariants, itemColorClasses } from "./context-menu.variants.js";
9
+ const config = getComponentConfig("contextMenu", contextMenuDefaults);
10
+ const icons = getComponentConfig("icons", iconsDefaults);
11
+ let { ref = $bindable(null), open = $bindable(false), onOpenChange, items = [], radioGroups = [], checkedIcon = icons.check, submenuIcon = icons.chevronRight, sideOffset = 4, alignOffset = 0, avoidCollisions = true, collisionBoundary, collisionPadding = 8, hideWhenDetached = false, onEscapeKeydown, onInteractOutside, onCloseAutoFocus, forceMount, loop = true, transition = config.defaultVariants.transition ?? true, portal = true, size = config.defaultVariants.size ?? "md", ui, class: className, children, header, footer, item: itemSlot, itemLeading, itemLabel, itemTrailing, content: contentSlot } = $props();
12
+ const hasRadioItems = $derived(items.some((i) => i.type === "radio"));
13
+ const firstRadioGroup = $derived(radioGroups[0]);
14
+ const variantSlots = $derived(contextMenuVariants({
15
+ transition,
16
+ size
17
+ }));
18
+ const classes = $derived({
19
+ content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
20
+ group: variantSlots.group({ class: [config.slots.group, ui?.group] }),
21
+ separator: variantSlots.separator({ class: [config.slots.separator, ui?.separator] }),
22
+ label: variantSlots.label({ class: [config.slots.label, ui?.label] }),
23
+ item: variantSlots.item({ class: [config.slots.item, ui?.item] }),
24
+ itemLeadingIcon: variantSlots.itemLeadingIcon({ class: [config.slots.itemLeadingIcon, ui?.itemLeadingIcon] }),
25
+ itemLabel: variantSlots.itemLabel({ class: [config.slots.itemLabel, ui?.itemLabel] }),
26
+ itemTrailingKbds: variantSlots.itemTrailingKbds({ class: [config.slots.itemTrailingKbds, ui?.itemTrailingKbds] }),
27
+ itemIndicator: variantSlots.itemIndicator({ class: [config.slots.itemIndicator, ui?.itemIndicator] }),
28
+ subTrigger: variantSlots.subTrigger({ class: [config.slots.subTrigger, ui?.subTrigger] }),
29
+ subTriggerIcon: variantSlots.subTriggerIcon({ class: [config.slots.subTriggerIcon, ui?.subTriggerIcon] }),
30
+ subContent: variantSlots.subContent({ class: [config.slots.subContent, ui?.subContent] })
31
+ });
32
+ function close() {
33
+ open = false;
34
+ }
35
+ // Type guards
36
+ function isActionItem(item) {
37
+ return !item.type || item.type === "item";
38
+ }
39
+ function isCheckboxItem(item) {
40
+ return item.type === "checkbox";
41
+ }
42
+ function isRadioItem(item) {
43
+ return item.type === "radio";
44
+ }
45
+ function isSubItem(item) {
46
+ return item.type === "sub";
47
+ }
48
+ function isSeparator(item) {
49
+ return item.type === "separator";
50
+ }
51
+ function isLabel(item) {
52
+ return item.type === "label";
53
+ }
117
54
  </script>
118
55
 
119
56
  {#snippet renderKbds(kbds: ContextMenuItemAction['kbds'])}
@@ -1,6 +1,6 @@
1
1
  import type { ContextMenuProps } from './context-menu.types.js';
2
2
  export type Props = ContextMenuProps;
3
3
  import { ContextMenu } from 'bits-ui';
4
- declare const ContextMenu: import("svelte").Component<ContextMenuProps, {}, "ref" | "open">;
4
+ declare const ContextMenu: import("svelte").Component<ContextMenuProps, {}, "open" | "ref">;
5
5
  type ContextMenu = ReturnType<typeof ContextMenu>;
6
6
  export default ContextMenu;
@@ -1,115 +1,77 @@
1
- <script lang="ts" module>
2
- import type { DrawerProps } from './drawer.types.js'
3
-
4
- export type Props = DrawerProps
1
+ <script lang="ts" module>export {};
5
2
  </script>
6
3
 
7
- <script lang="ts">
8
- import { Drawer } from 'vaul-svelte'
9
- import { getComponentConfig } from '../config.js'
10
- import { drawerDefaults, drawerVariants } from './drawer.variants.js'
11
-
12
- const config = getComponentConfig('drawer', drawerDefaults)
13
-
14
- let {
15
- open = $bindable(false),
16
- onOpenChange,
17
- direction = config.defaultVariants.direction ?? 'bottom',
18
- inset = config.defaultVariants.inset ?? false,
19
- title,
20
- description,
21
- overlay: showOverlay = true,
22
- handle: showHandle = true,
23
- portal = true,
24
- dismissible = true,
25
- modal = true,
26
- nested = false,
27
- shouldScaleBackground = false,
28
- closeThreshold,
29
- scrollLockTimeout,
30
- snapPoints,
31
- fadeFromIndex,
32
- activeSnapPoint = $bindable(undefined),
33
- onActiveSnapPointChange,
34
- handleOnly = false,
35
- noBodyStyles,
36
- onDrag,
37
- onRelease,
38
- onClose,
39
- ui,
40
- class: className,
41
- children,
42
- content: contentSlot,
43
- header: headerSlot,
44
- titleSlot,
45
- descriptionSlot,
46
- body: bodySlot,
47
- footer: footerSlot,
48
- ...rest
49
- }: Props = $props()
50
-
51
- const hasTitle = $derived(!!title || !!titleSlot)
52
- const hasDescription = $derived(!!description || !!descriptionSlot)
53
- const hasHeading = $derived(hasTitle || hasDescription)
54
- const hasHeader = $derived(!!headerSlot || hasHeading)
55
- const hasSnapPoints = $derived(!!snapPoints?.length)
56
-
57
- const variantSlots = $derived(drawerVariants({ direction, inset, snapPoints: hasSnapPoints }))
58
-
59
- const classes = $derived({
60
- overlay: variantSlots.overlay({ class: [config.slots.overlay, ui?.overlay] }),
61
- content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
62
- handle: variantSlots.handle({ class: [config.slots.handle, ui?.handle] }),
63
- container: variantSlots.container({ class: [config.slots.container, ui?.container] }),
64
- header: variantSlots.header({ class: [config.slots.header, ui?.header] }),
65
- title: variantSlots.title({ class: [config.slots.title, ui?.title] }),
66
- description: variantSlots.description({
67
- class: [config.slots.description, ui?.description]
68
- }),
69
- body: variantSlots.body({ class: [config.slots.body, ui?.body] }),
70
- footer: variantSlots.footer({ class: [config.slots.footer, ui?.footer] })
71
- })
72
-
73
- function handleOpenChange(value: boolean) {
74
- open = value
75
- onOpenChange?.(value)
76
- }
77
-
78
- function handleActiveSnapPointChange(value: number | string | null) {
79
- activeSnapPoint = value
80
- onActiveSnapPointChange?.(value)
81
- }
82
-
83
- const rootProps = $derived.by(() => {
84
- const base: Record<string, unknown> = {
85
- ...rest,
86
- open,
87
- onOpenChange: handleOpenChange,
88
- direction,
89
- dismissible,
90
- modal,
91
- shouldScaleBackground,
92
- closeThreshold,
93
- scrollLockTimeout,
94
- activeSnapPoint,
95
- onActiveSnapPointChange: handleActiveSnapPointChange,
96
- handleOnly,
97
- noBodyStyles,
98
- onDrag,
99
- onRelease,
100
- onClose
101
- }
102
- if (rest.container) {
103
- base.container = rest.container
104
- }
105
- if (snapPoints && fadeFromIndex !== null) {
106
- return { ...base, snapPoints, fadeFromIndex }
107
- }
108
- if (snapPoints) {
109
- return { ...base, snapPoints }
110
- }
111
- return base
112
- })
4
+ <script lang="ts">import { Drawer } from "vaul-svelte";
5
+ import { getComponentConfig } from "../config.js";
6
+ import { drawerDefaults, drawerVariants } from "./drawer.variants.js";
7
+ const config = getComponentConfig("drawer", drawerDefaults);
8
+ let { open = $bindable(false), onOpenChange, direction = config.defaultVariants.direction ?? "bottom", inset = config.defaultVariants.inset ?? false, title, description, overlay: showOverlay = true, handle: showHandle = true, portal = true, dismissible = true, modal = true, nested = false, shouldScaleBackground = false, closeThreshold, scrollLockTimeout, snapPoints, fadeFromIndex, activeSnapPoint = $bindable(undefined), onActiveSnapPointChange, handleOnly = false, noBodyStyles, onDrag, onRelease, onClose, ui, class: className, children, content: contentSlot, header: headerSlot, titleSlot, descriptionSlot, body: bodySlot, footer: footerSlot, ...rest } = $props();
9
+ const hasTitle = $derived(!!title || !!titleSlot);
10
+ const hasDescription = $derived(!!description || !!descriptionSlot);
11
+ const hasHeading = $derived(hasTitle || hasDescription);
12
+ const hasHeader = $derived(!!headerSlot || hasHeading);
13
+ const hasSnapPoints = $derived(!!snapPoints?.length);
14
+ const variantSlots = $derived(drawerVariants({
15
+ direction,
16
+ inset,
17
+ snapPoints: hasSnapPoints
18
+ }));
19
+ const classes = $derived({
20
+ overlay: variantSlots.overlay({ class: [config.slots.overlay, ui?.overlay] }),
21
+ content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
22
+ handle: variantSlots.handle({ class: [config.slots.handle, ui?.handle] }),
23
+ container: variantSlots.container({ class: [config.slots.container, ui?.container] }),
24
+ header: variantSlots.header({ class: [config.slots.header, ui?.header] }),
25
+ title: variantSlots.title({ class: [config.slots.title, ui?.title] }),
26
+ description: variantSlots.description({ class: [config.slots.description, ui?.description] }),
27
+ body: variantSlots.body({ class: [config.slots.body, ui?.body] }),
28
+ footer: variantSlots.footer({ class: [config.slots.footer, ui?.footer] })
29
+ });
30
+ function handleOpenChange(value) {
31
+ open = value;
32
+ onOpenChange?.(value);
33
+ }
34
+ function handleActiveSnapPointChange(value) {
35
+ activeSnapPoint = value;
36
+ onActiveSnapPointChange?.(value);
37
+ }
38
+ const rootProps = $derived.by(() => {
39
+ const base = {
40
+ ...rest,
41
+ open,
42
+ onOpenChange: handleOpenChange,
43
+ direction,
44
+ dismissible,
45
+ modal,
46
+ shouldScaleBackground,
47
+ closeThreshold,
48
+ scrollLockTimeout,
49
+ activeSnapPoint,
50
+ onActiveSnapPointChange: handleActiveSnapPointChange,
51
+ handleOnly,
52
+ noBodyStyles,
53
+ onDrag,
54
+ onRelease,
55
+ onClose
56
+ };
57
+ if (rest.container) {
58
+ base.container = rest.container;
59
+ }
60
+ if (snapPoints && fadeFromIndex !== null) {
61
+ return {
62
+ ...base,
63
+ snapPoints,
64
+ fadeFromIndex
65
+ };
66
+ }
67
+ if (snapPoints) {
68
+ return {
69
+ ...base,
70
+ snapPoints
71
+ };
72
+ }
73
+ return base;
74
+ });
113
75
  </script>
114
76
 
115
77
  {#snippet drawerInner()}
@@ -1,5 +1,4 @@
1
- <script lang="ts">
2
- import Drawer from './Drawer.svelte'
1
+ <script lang="ts">import Drawer from "./Drawer.svelte";
3
2
  </script>
4
3
 
5
4
  <Drawer>