svelora 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.svelte +66 -97
- package/dist/Alert/Alert.svelte +39 -64
- package/dist/Alert/Alert.svelte.d.ts +1 -1
- package/dist/Avatar/Avatar.svelte +35 -75
- package/dist/AvatarGroup/AvatarGroup.svelte +38 -55
- package/dist/Badge/Badge.svelte +28 -50
- package/dist/Banner/Banner.svelte +46 -41
- package/dist/Banner/Banner.svelte.d.ts +1 -1
- package/dist/Breadcrumb/Breadcrumb.svelte +32 -26
- package/dist/Button/Button.svelte +70 -138
- package/dist/Calendar/Calendar.svelte +94 -157
- package/dist/Calendar/Calendar.svelte.d.ts +1 -1
- package/dist/Card/Card.svelte +18 -31
- package/dist/Carousel/Carousel.svelte +118 -173
- package/dist/Checkbox/Checkbox.svelte +52 -97
- package/dist/CheckboxGroup/CheckboxGroup.svelte +62 -107
- package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +1 -1
- package/dist/Chip/Chip.svelte +22 -34
- package/dist/CodeBlock/CodeBlock.svelte +42 -59
- package/dist/Collapsible/Collapsible.svelte +22 -38
- package/dist/Collapsible/Collapsible.svelte.d.ts +1 -1
- package/dist/Collapsible/CollapsibleTestWrapper.svelte +2 -5
- package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +1 -1
- package/dist/Command/Command.svelte +40 -77
- package/dist/Command/Command.svelte.d.ts +1 -1
- package/dist/Command/CommandTestWrapper.svelte +2 -10
- package/dist/Command/CommandTestWrapper.svelte.d.ts +1 -1
- package/dist/Container/Container.svelte +11 -14
- package/dist/ContextMenu/ContextMenu.svelte +51 -114
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +1 -1
- package/dist/Drawer/Drawer.svelte +72 -110
- package/dist/Drawer/DrawerTriggerTestWrapper.svelte +1 -2
- package/dist/DropdownMenu/DropdownMenu.svelte +63 -124
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte +2 -5
- package/dist/Editor/Editor.svelte +441 -576
- package/dist/Editor/Editor.svelte.d.ts +1 -1
- package/dist/Editor/EditorUrlPrompt.svelte +40 -53
- package/dist/Editor/SlashPopup.svelte +12 -24
- package/dist/Empty/Empty.svelte +32 -63
- package/dist/FieldGroup/FieldGroup.svelte +23 -38
- package/dist/FileUpload/FileUpload.svelte +242 -320
- package/dist/FileUpload/FileUpload.svelte.d.ts +1 -1
- package/dist/Fonts/Fonts.svelte +15 -37
- package/dist/Form/Form.svelte +112 -170
- package/dist/FormField/FormField.svelte +102 -135
- package/dist/Icon/Icon.svelte +7 -32
- package/dist/Input/Input.svelte +71 -141
- package/dist/Input/Input.svelte.d.ts +2 -2
- package/dist/Kbd/Kbd.svelte +18 -34
- package/dist/Link/Link.svelte +129 -196
- package/dist/LocaleButton/LocaleButton.svelte +165 -0
- package/dist/LocaleButton/LocaleButton.svelte.d.ts +5 -0
- package/dist/LocaleButton/index.d.ts +2 -0
- package/dist/LocaleButton/index.js +1 -0
- package/dist/LocaleButton/locale-button.types.d.ts +182 -0
- package/dist/LocaleButton/locale-button.types.js +1 -0
- package/dist/LocaleButton/locale-button.variants.d.ts +61 -0
- package/dist/LocaleButton/locale-button.variants.js +34 -0
- package/dist/Modal/Modal.svelte +52 -106
- package/dist/Modal/ModalTriggerTestWrapper.svelte +1 -2
- package/dist/Pagination/Pagination.svelte +48 -92
- package/dist/Pagination/pagination.variants.d.ts +1 -1
- package/dist/PinInput/PinInput.svelte +57 -111
- package/dist/PinInput/PinInput.svelte.d.ts +1 -1
- package/dist/Popover/Popover.svelte +28 -61
- package/dist/Popover/Popover.svelte.d.ts +1 -1
- package/dist/Progress/Progress.svelte +75 -94
- package/dist/RadioGroup/RadioGroup.svelte +54 -99
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +1 -1
- package/dist/Select/Select.svelte +112 -269
- package/dist/Select/Select.svelte.d.ts +1 -1
- package/dist/SelectMenu/SelectMenu.svelte +211 -409
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +1 -1
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte +3 -6
- package/dist/Separator/Separator.svelte +29 -44
- package/dist/Skeleton/Skeleton.svelte +11 -23
- package/dist/Slideover/Slideover.svelte +52 -106
- package/dist/Slideover/SlideoverTriggerTestWrapper.svelte +1 -2
- package/dist/Slider/Slider.svelte +48 -84
- package/dist/Slider/Slider.svelte.d.ts +1 -1
- package/dist/Stepper/Stepper.svelte +139 -132
- package/dist/Stepper/Stepper.svelte.d.ts +1 -1
- package/dist/Switch/Switch.svelte +62 -98
- package/dist/Table/Table.svelte +232 -283
- package/dist/Table/table.variants.d.ts +1 -1
- package/dist/Tabs/Tabs.svelte +96 -129
- package/dist/Tabs/Tabs.svelte.d.ts +1 -1
- package/dist/Textarea/Textarea.svelte +90 -173
- package/dist/Textarea/Textarea.svelte.d.ts +1 -1
- package/dist/ThemeModeButton/ThemeModeButton.svelte +16 -38
- package/dist/Timeline/Timeline.svelte +75 -54
- package/dist/Toast/Toaster.svelte +8 -25
- package/dist/Tooltip/Tooltip.svelte +34 -66
- package/dist/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/Tooltip/TooltipTestWrapper.svelte +2 -5
- package/dist/User/User.svelte +33 -49
- package/dist/docs/navigation.js +6 -0
- package/dist/hooks/HookContextProbe.svelte +2 -4
- package/dist/hooks/HookContextProvider.svelte +8 -6
- package/dist/hooks/HookEmitProbe.svelte +8 -11
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/svelora-docs.data.json +4 -2
- package/dist/theme.css +2 -0
- 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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" | "
|
|
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
|
-
|
|
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, "
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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, {}, "
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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()}
|