@ark-ui/svelte 5.7.0 → 5.8.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.
- package/dist/components/combobox/combobox-root-provider.svelte +4 -0
- package/dist/components/combobox/combobox-root-provider.svelte.d.ts +1 -0
- package/dist/components/combobox/combobox-root.svelte +5 -0
- package/dist/components/combobox/combobox-root.svelte.d.ts +2 -0
- package/dist/components/combobox/combobox.d.ts +2 -2
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/field/use-field.svelte.js +1 -0
- package/dist/components/listbox/index.d.ts +2 -2
- package/dist/components/listbox/index.js +1 -1
- package/dist/components/listbox/listbox-root-provider.svelte +6 -0
- package/dist/components/listbox/listbox-root-provider.svelte.d.ts +2 -0
- package/dist/components/listbox/listbox-root.svelte +16 -6
- package/dist/components/listbox/listbox-root.svelte.d.ts +3 -1
- package/dist/components/listbox/listbox.d.ts +2 -2
- package/dist/components/menu/menu-trigger-item.svelte +3 -0
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/select-root-provider.svelte +5 -0
- package/dist/components/select/select-root-provider.svelte.d.ts +2 -0
- package/dist/components/select/select-root.svelte +3 -0
- package/dist/components/select/select-root.svelte.d.ts +2 -0
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/tree-view/index.d.ts +2 -2
- package/dist/components/tree-view/index.js +1 -1
- package/dist/components/tree-view/tree-view-root-provider.svelte +5 -0
- package/dist/components/tree-view/tree-view-root-provider.svelte.d.ts +2 -0
- package/dist/components/tree-view/tree-view-root.svelte +3 -0
- package/dist/components/tree-view/tree-view-root.svelte.d.ts +2 -0
- package/dist/components/tree-view/tree-view.d.ts +2 -2
- package/dist/lucide-optimize.d.ts +34 -0
- package/dist/lucide-optimize.js +89 -0
- package/package.json +5 -2
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
}
|
|
19
19
|
export interface ComboboxRootProviderProps<T extends CollectionItem>
|
|
20
20
|
extends Assign<HTMLProps<'div'>, ComboboxRootProviderBaseProps<T>> {}
|
|
21
|
+
|
|
22
|
+
export type ComboboxRootProviderComponent<P = {}> = <T extends CollectionItem>(
|
|
23
|
+
props: Assign<ComboboxRootProviderProps<T>, P>,
|
|
24
|
+
) => Snippet
|
|
21
25
|
</script>
|
|
22
26
|
|
|
23
27
|
<script lang="ts" generics="T extends CollectionItem">
|
|
@@ -11,6 +11,7 @@ export interface ComboboxRootProviderBaseProps<T extends CollectionItem> extends
|
|
|
11
11
|
}
|
|
12
12
|
export interface ComboboxRootProviderProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ComboboxRootProviderBaseProps<T>> {
|
|
13
13
|
}
|
|
14
|
+
export type ComboboxRootProviderComponent<P = {}> = <T extends CollectionItem>(props: Assign<ComboboxRootProviderProps<T>, P>) => Snippet;
|
|
14
15
|
declare function $$render<T extends CollectionItem>(): {
|
|
15
16
|
props: ComboboxRootProviderProps<T>;
|
|
16
17
|
exports: {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
3
4
|
import type { CollectionItem } from '../collection'
|
|
4
5
|
import type { UsePresenceProps } from '../presence'
|
|
5
6
|
import type { UseComboboxProps } from './use-combobox.svelte'
|
|
@@ -12,6 +13,10 @@
|
|
|
12
13
|
|
|
13
14
|
export interface ComboboxRootProps<T extends CollectionItem>
|
|
14
15
|
extends Assign<HTMLProps<'div'>, ComboboxRootBaseProps<T>> {}
|
|
16
|
+
|
|
17
|
+
export type ComboboxRootComponent<P = {}> = <T extends CollectionItem>(
|
|
18
|
+
props: Assign<ComboboxRootProps<T>, P>,
|
|
19
|
+
) => Snippet
|
|
15
20
|
</script>
|
|
16
21
|
|
|
17
22
|
<script lang="ts" generics="T extends CollectionItem">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { CollectionItem } from '../collection';
|
|
3
4
|
import type { UsePresenceProps } from '../presence';
|
|
4
5
|
import type { UseComboboxProps } from './use-combobox.svelte';
|
|
@@ -6,6 +7,7 @@ export interface ComboboxRootBaseProps<T extends CollectionItem> extends UseComb
|
|
|
6
7
|
}
|
|
7
8
|
export interface ComboboxRootProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ComboboxRootBaseProps<T>> {
|
|
8
9
|
}
|
|
10
|
+
export type ComboboxRootComponent<P = {}> = <T extends CollectionItem>(props: Assign<ComboboxRootProps<T>, P>) => Snippet;
|
|
9
11
|
declare function $$render<T extends CollectionItem>(): {
|
|
10
12
|
props: ComboboxRootProps<T>;
|
|
11
13
|
exports: {};
|
|
@@ -14,6 +14,6 @@ export { default as ItemText, type ComboboxItemTextProps as ItemTextProps, type
|
|
|
14
14
|
export { default as Label, type ComboboxLabelProps as LabelProps, type ComboboxLabelBaseProps as LabelBaseProps, } from './combobox-label.svelte';
|
|
15
15
|
export { default as List, type ComboboxListProps as ListProps, type ComboboxListBaseProps as ListBaseProps, } from './combobox-list.svelte';
|
|
16
16
|
export { default as Positioner, type ComboboxPositionerProps, type ComboboxPositionerBaseProps, } from './combobox-positioner.svelte';
|
|
17
|
-
export { default as Root, type ComboboxRootBaseProps as RootBaseProps, type ComboboxRootProps as RootProps, } from './combobox-root.svelte';
|
|
18
|
-
export { default as RootProvider, type ComboboxRootProviderBaseProps as RootProviderBaseProps, type ComboboxRootProviderProps as RootProviderProps, } from './combobox-root-provider.svelte';
|
|
17
|
+
export { default as Root, type ComboboxRootBaseProps as RootBaseProps, type ComboboxRootProps as RootProps, type ComboboxRootComponent as RootComponent, } from './combobox-root.svelte';
|
|
18
|
+
export { default as RootProvider, type ComboboxRootProviderBaseProps as RootProviderBaseProps, type ComboboxRootProviderProps as RootProviderProps, type ComboboxRootProviderComponent as RootProviderComponent, } from './combobox-root-provider.svelte';
|
|
19
19
|
export { default as Trigger, type ComboboxTriggerProps as TriggerProps, type ComboboxTriggerBaseProps as TriggerBaseProps, } from './combobox-trigger.svelte';
|
|
@@ -15,8 +15,8 @@ export { default as ComboboxItemText, type ComboboxItemTextProps, type ComboboxI
|
|
|
15
15
|
export { default as ComboboxLabel, type ComboboxLabelProps, type ComboboxLabelBaseProps } from './combobox-label.svelte';
|
|
16
16
|
export { default as ComboboxList, type ComboboxListProps, type ComboboxListBaseProps } from './combobox-list.svelte';
|
|
17
17
|
export { default as ComboboxPositioner, type ComboboxPositionerProps, type ComboboxPositionerBaseProps, } from './combobox-positioner.svelte';
|
|
18
|
-
export { default as ComboboxRoot, type ComboboxRootBaseProps, type ComboboxRootProps } from './combobox-root.svelte';
|
|
19
|
-
export { default as ComboboxRootProvider, type ComboboxRootProviderBaseProps, type ComboboxRootProviderProps, } from './combobox-root-provider.svelte';
|
|
18
|
+
export { default as ComboboxRoot, type ComboboxRootBaseProps, type ComboboxRootProps, type ComboboxRootComponent, } from './combobox-root.svelte';
|
|
19
|
+
export { default as ComboboxRootProvider, type ComboboxRootProviderBaseProps, type ComboboxRootProviderProps, type ComboboxRootProviderComponent, } from './combobox-root-provider.svelte';
|
|
20
20
|
export { default as ComboboxTrigger, type ComboboxTriggerProps, type ComboboxTriggerBaseProps, } from './combobox-trigger.svelte';
|
|
21
21
|
export { comboboxAnatomy } from './combobox.anatomy';
|
|
22
22
|
export { useCombobox, type UseComboboxProps, type UseComboboxReturn } from './use-combobox.svelte';
|
|
@@ -14,7 +14,7 @@ export { default as ComboboxItemText, } from './combobox-item-text.svelte';
|
|
|
14
14
|
export { default as ComboboxLabel } from './combobox-label.svelte';
|
|
15
15
|
export { default as ComboboxList } from './combobox-list.svelte';
|
|
16
16
|
export { default as ComboboxPositioner, } from './combobox-positioner.svelte';
|
|
17
|
-
export { default as ComboboxRoot } from './combobox-root.svelte';
|
|
17
|
+
export { default as ComboboxRoot, } from './combobox-root.svelte';
|
|
18
18
|
export { default as ComboboxRootProvider, } from './combobox-root-provider.svelte';
|
|
19
19
|
export { default as ComboboxTrigger, } from './combobox-trigger.svelte';
|
|
20
20
|
export { comboboxAnatomy } from './combobox.anatomy';
|
|
@@ -67,6 +67,7 @@ export const useField = (inProps = {}) => {
|
|
|
67
67
|
'data-disabled': dataAttr(disabled),
|
|
68
68
|
'data-invalid': dataAttr(invalid),
|
|
69
69
|
'data-readonly': dataAttr(readOnly),
|
|
70
|
+
'data-required': dataAttr(required),
|
|
70
71
|
for: controlId,
|
|
71
72
|
});
|
|
72
73
|
const getControlProps = () => ({
|
|
@@ -11,8 +11,8 @@ export { default as ListboxItemGroupLabel, type ListboxItemGroupLabelBaseProps,
|
|
|
11
11
|
export { default as ListboxItemIndicator, type ListboxItemIndicatorBaseProps, type ListboxItemIndicatorProps, } from './listbox-item-indicator.svelte';
|
|
12
12
|
export { default as ListboxItemText, type ListboxItemTextBaseProps, type ListboxItemTextProps, } from './listbox-item-text.svelte';
|
|
13
13
|
export { default as ListboxLabel, type ListboxLabelBaseProps, type ListboxLabelProps } from './listbox-label.svelte';
|
|
14
|
-
export { default as ListboxRoot, type ListboxRootBaseProps, type ListboxRootProps } from './listbox-root.svelte';
|
|
15
|
-
export { default as ListboxRootProvider, type ListboxRootProviderBaseProps, type ListboxRootProviderProps, } from './listbox-root-provider.svelte';
|
|
14
|
+
export { default as ListboxRoot, type ListboxRootBaseProps, type ListboxRootProps, type ListboxRootComponent, } from './listbox-root.svelte';
|
|
15
|
+
export { default as ListboxRootProvider, type ListboxRootProviderBaseProps, type ListboxRootProviderProps, type ListboxRootProviderComponent, } from './listbox-root-provider.svelte';
|
|
16
16
|
export { default as ListboxValueText, type ListboxValueTextBaseProps, type ListboxValueTextProps, } from './listbox-value-text.svelte';
|
|
17
17
|
export { listboxAnatomy } from './listbox.anatomy.js';
|
|
18
18
|
export { useListbox, type UseListboxProps, type UseListboxReturn } from './use-listbox.svelte.js';
|
|
@@ -10,7 +10,7 @@ export { default as ListboxItemGroupLabel, } from './listbox-item-group-label.sv
|
|
|
10
10
|
export { default as ListboxItemIndicator, } from './listbox-item-indicator.svelte';
|
|
11
11
|
export { default as ListboxItemText, } from './listbox-item-text.svelte';
|
|
12
12
|
export { default as ListboxLabel } from './listbox-label.svelte';
|
|
13
|
-
export { default as ListboxRoot } from './listbox-root.svelte';
|
|
13
|
+
export { default as ListboxRoot, } from './listbox-root.svelte';
|
|
14
14
|
export { default as ListboxRootProvider, } from './listbox-root-provider.svelte';
|
|
15
15
|
export { default as ListboxValueText, } from './listbox-value-text.svelte';
|
|
16
16
|
export { listboxAnatomy } from './listbox.anatomy.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
2
4
|
interface RootProviderProps<T extends CollectionItem> {
|
|
3
5
|
value: UseListboxReturn<T>
|
|
4
6
|
}
|
|
@@ -8,6 +10,10 @@
|
|
|
8
10
|
RootProviderProps<T> {}
|
|
9
11
|
export interface ListboxRootProviderProps<T extends CollectionItem>
|
|
10
12
|
extends Assign<HTMLProps<'div'>, ListboxRootProviderBaseProps<T>> {}
|
|
13
|
+
|
|
14
|
+
export type ListboxRootProviderComponent<P = {}> = <T extends CollectionItem>(
|
|
15
|
+
props: Assign<ListboxRootProviderProps<T>, P>,
|
|
16
|
+
) => Snippet
|
|
11
17
|
</script>
|
|
12
18
|
|
|
13
19
|
<script lang="ts" generics="T extends CollectionItem">
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
1
2
|
interface RootProviderProps<T extends CollectionItem> {
|
|
2
3
|
value: UseListboxReturn<T>;
|
|
3
4
|
}
|
|
@@ -5,6 +6,7 @@ export interface ListboxRootProviderBaseProps<T extends CollectionItem> extends
|
|
|
5
6
|
}
|
|
6
7
|
export interface ListboxRootProviderProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ListboxRootProviderBaseProps<T>> {
|
|
7
8
|
}
|
|
9
|
+
export type ListboxRootProviderComponent<P = {}> = <T extends CollectionItem>(props: Assign<ListboxRootProviderProps<T>, P>) => Snippet;
|
|
8
10
|
import type { Assign, HTMLProps, PolymorphicProps } from '../../types.js';
|
|
9
11
|
import type { CollectionItem } from '../collection/index.js';
|
|
10
12
|
import type { UseListboxReturn } from './use-listbox.svelte.js';
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
<script lang="ts"
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
2
4
|
import type { Assign, HTMLProps, PolymorphicProps } from '../../types.js'
|
|
3
|
-
import { mergeProps } from '@zag-js/svelte'
|
|
4
5
|
import type { CollectionItem } from '../collection/index.js'
|
|
5
|
-
import {
|
|
6
|
-
import { ListboxProvider } from './use-listbox-context.js'
|
|
7
|
-
import { type UseListboxProps, useListbox } from './use-listbox.svelte.js'
|
|
8
|
-
import { createSplitProps } from '../../utils/create-split-props.js'
|
|
6
|
+
import type { UseListboxProps } from './use-listbox.svelte.js'
|
|
9
7
|
|
|
10
8
|
export interface ListboxRootBaseProps<T extends CollectionItem> extends UseListboxProps<T>, PolymorphicProps<'div'> {}
|
|
11
9
|
export interface ListboxRootProps<T extends CollectionItem>
|
|
12
10
|
extends Assign<HTMLProps<'div'>, ListboxRootBaseProps<T>> {}
|
|
13
11
|
|
|
12
|
+
export type ListboxRootComponent<P = {}> = <T extends CollectionItem>(
|
|
13
|
+
props: Assign<ListboxRootProps<T>, P>,
|
|
14
|
+
) => Snippet
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts" generics="T extends CollectionItem">
|
|
18
|
+
import { mergeProps } from '@zag-js/svelte'
|
|
19
|
+
import { Ark } from '../factory/index.js'
|
|
20
|
+
import { ListboxProvider } from './use-listbox-context.js'
|
|
21
|
+
import { useListbox } from './use-listbox.svelte.js'
|
|
22
|
+
import { createSplitProps } from '../../utils/create-split-props.js'
|
|
23
|
+
|
|
14
24
|
let { highlightedValue = $bindable(), value = $bindable(), ...props }: ListboxRootProps<T> = $props()
|
|
15
25
|
const providedId = $props.id()
|
|
16
26
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
1
2
|
import type { Assign, HTMLProps, PolymorphicProps } from '../../types.js';
|
|
2
3
|
import type { CollectionItem } from '../collection/index.js';
|
|
3
|
-
import {
|
|
4
|
+
import type { UseListboxProps } from './use-listbox.svelte.js';
|
|
4
5
|
export interface ListboxRootBaseProps<T extends CollectionItem> extends UseListboxProps<T>, PolymorphicProps<'div'> {
|
|
5
6
|
}
|
|
6
7
|
export interface ListboxRootProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ListboxRootBaseProps<T>> {
|
|
7
8
|
}
|
|
9
|
+
export type ListboxRootComponent<P = {}> = <T extends CollectionItem>(props: Assign<ListboxRootProps<T>, P>) => Snippet;
|
|
8
10
|
declare function $$render<T extends CollectionItem>(): {
|
|
9
11
|
props: ListboxRootProps<T>;
|
|
10
12
|
exports: {};
|
|
@@ -9,6 +9,6 @@ export { default as ItemGroupLabel, type ListboxItemGroupLabelBaseProps as ItemG
|
|
|
9
9
|
export { default as ItemIndicator, type ListboxItemIndicatorBaseProps as ItemIndicatorBaseProps, type ListboxItemIndicatorProps as ItemIndicatorProps, } from './listbox-item-indicator.svelte';
|
|
10
10
|
export { default as ItemText, type ListboxItemTextBaseProps as ItemTextBaseProps, type ListboxItemTextProps as ItemTextProps, } from './listbox-item-text.svelte';
|
|
11
11
|
export { default as Label, type ListboxLabelBaseProps as LabelBaseProps, type ListboxLabelProps as LabelProps, } from './listbox-label.svelte';
|
|
12
|
-
export { default as Root, type ListboxRootBaseProps as RootBaseProps, type ListboxRootProps as RootProps, } from './listbox-root.svelte';
|
|
13
|
-
export { default as RootProvider, type ListboxRootProviderBaseProps as RootProviderBaseProps, type ListboxRootProviderProps as RootProviderProps, } from './listbox-root-provider.svelte';
|
|
12
|
+
export { default as Root, type ListboxRootBaseProps as RootBaseProps, type ListboxRootProps as RootProps, type ListboxRootComponent as RootComponent, } from './listbox-root.svelte';
|
|
13
|
+
export { default as RootProvider, type ListboxRootProviderBaseProps as RootProviderBaseProps, type ListboxRootProviderProps as RootProviderProps, type ListboxRootProviderComponent as RootProviderComponent, } from './listbox-root-provider.svelte';
|
|
14
14
|
export { default as ValueText, type ListboxValueTextBaseProps as ValueTextBaseProps, type ListboxValueTextProps as ValueTextProps, } from './listbox-value-text.svelte';
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
import { mergeProps } from '@zag-js/svelte'
|
|
10
10
|
import { Ark } from '../factory'
|
|
11
11
|
import { useMenuTriggerItemContext } from './use-menu-trigger-item-context'
|
|
12
|
+
import { MenuItemPropsProvider } from './use-menu-option-item-props-context'
|
|
12
13
|
|
|
13
14
|
let { ref = $bindable(null), ...props }: MenuTriggerItemProps = $props()
|
|
14
15
|
|
|
15
16
|
const getTriggerItemProps = useMenuTriggerItemContext()
|
|
16
17
|
const mergedProps = $derived(mergeProps(getTriggerItemProps?.() ?? {}, props))
|
|
18
|
+
|
|
19
|
+
MenuItemPropsProvider(() => ({ value: mergedProps['data-value'] }))
|
|
17
20
|
</script>
|
|
18
21
|
|
|
19
22
|
<Ark as="div" bind:ref {...mergedProps} />
|
|
@@ -15,8 +15,8 @@ export { default as SelectItemText, type SelectItemTextBaseProps, type SelectIte
|
|
|
15
15
|
export { default as SelectLabel, type SelectLabelBaseProps, type SelectLabelProps } from './select-label.svelte';
|
|
16
16
|
export { default as SelectList, type SelectListBaseProps, type SelectListProps } from './select-list.svelte';
|
|
17
17
|
export { default as SelectPositioner, type SelectPositionerBaseProps, type SelectPositionerProps, } from './select-positioner.svelte';
|
|
18
|
-
export { default as SelectRoot, type SelectRootBaseProps, type SelectRootProps } from './select-root.svelte';
|
|
19
|
-
export { default as SelectRootProvider, type SelectRootProviderBaseProps, type SelectRootProviderProps, } from './select-root-provider.svelte';
|
|
18
|
+
export { default as SelectRoot, type SelectRootBaseProps, type SelectRootProps, type SelectRootComponent, } from './select-root.svelte';
|
|
19
|
+
export { default as SelectRootProvider, type SelectRootProviderBaseProps, type SelectRootProviderProps, type SelectRootProviderComponent, } from './select-root-provider.svelte';
|
|
20
20
|
export { default as SelectTrigger, type SelectTriggerBaseProps, type SelectTriggerProps } from './select-trigger.svelte';
|
|
21
21
|
export { default as SelectValueText, type SelectValueTextBaseProps, type SelectValueTextProps, } from './select-value-text.svelte';
|
|
22
22
|
export { selectAnatomy } from './select.anatomy';
|
|
@@ -14,7 +14,7 @@ export { default as SelectItemText, } from './select-item-text.svelte';
|
|
|
14
14
|
export { default as SelectLabel } from './select-label.svelte';
|
|
15
15
|
export { default as SelectList } from './select-list.svelte';
|
|
16
16
|
export { default as SelectPositioner, } from './select-positioner.svelte';
|
|
17
|
-
export { default as SelectRoot } from './select-root.svelte';
|
|
17
|
+
export { default as SelectRoot, } from './select-root.svelte';
|
|
18
18
|
export { default as SelectRootProvider, } from './select-root-provider.svelte';
|
|
19
19
|
export { default as SelectTrigger } from './select-trigger.svelte';
|
|
20
20
|
export { default as SelectValueText, } from './select-value-text.svelte';
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
export interface SelectRootProviderProps<T extends CollectionItem = CollectionItem>
|
|
14
14
|
extends Assign<HTMLProps<'div'>, SelectRootProviderBaseProps<T>> {}
|
|
15
|
+
|
|
16
|
+
export type SelectRootProviderComponent<P = {}> = <T extends CollectionItem>(
|
|
17
|
+
props: Assign<SelectRootProviderProps<T>, P>,
|
|
18
|
+
) => Snippet
|
|
15
19
|
</script>
|
|
16
20
|
|
|
17
21
|
<script lang="ts" generics="T extends CollectionItem = CollectionItem">
|
|
@@ -19,6 +23,7 @@
|
|
|
19
23
|
import { Ark } from '../factory'
|
|
20
24
|
import { SelectProvider } from './use-select-context'
|
|
21
25
|
import { PresenceProvider, splitPresenceProps, usePresence, type UsePresenceProps } from '../presence'
|
|
26
|
+
import type { Snippet } from 'svelte'
|
|
22
27
|
|
|
23
28
|
let { ref = $bindable(null), ...props }: SelectRootProviderProps<T> = $props()
|
|
24
29
|
|
|
@@ -6,7 +6,9 @@ export interface SelectRootProviderBaseProps<T extends CollectionItem = Collecti
|
|
|
6
6
|
}
|
|
7
7
|
export interface SelectRootProviderProps<T extends CollectionItem = CollectionItem> extends Assign<HTMLProps<'div'>, SelectRootProviderBaseProps<T>> {
|
|
8
8
|
}
|
|
9
|
+
export type SelectRootProviderComponent<P = {}> = <T extends CollectionItem>(props: Assign<SelectRootProviderProps<T>, P>) => Snippet;
|
|
9
10
|
import { type UsePresenceProps } from '../presence';
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
10
12
|
declare function $$render<T extends CollectionItem = CollectionItem>(): {
|
|
11
13
|
props: SelectRootProviderProps<T>;
|
|
12
14
|
exports: {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
3
4
|
import type { CollectionItem } from '../collection'
|
|
4
5
|
import type { UseSelectProps } from './use-select.svelte'
|
|
5
6
|
|
|
@@ -11,6 +12,8 @@
|
|
|
11
12
|
|
|
12
13
|
export interface SelectRootProps<T extends CollectionItem = CollectionItem>
|
|
13
14
|
extends Assign<HTMLProps<'div'>, SelectRootBaseProps<T>> {}
|
|
15
|
+
|
|
16
|
+
export type SelectRootComponent<P = {}> = <T extends CollectionItem>(props: Assign<SelectRootProps<T>, P>) => Snippet
|
|
14
17
|
</script>
|
|
15
18
|
|
|
16
19
|
<script lang="ts" generics="T extends CollectionItem = CollectionItem">
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { CollectionItem } from '../collection';
|
|
3
4
|
import type { UseSelectProps } from './use-select.svelte';
|
|
4
5
|
export interface SelectRootBaseProps<T extends CollectionItem = CollectionItem> extends UseSelectProps<T>, UsePresenceProps, PolymorphicProps<'div'>, RefAttribute {
|
|
5
6
|
}
|
|
6
7
|
export interface SelectRootProps<T extends CollectionItem = CollectionItem> extends Assign<HTMLProps<'div'>, SelectRootBaseProps<T>> {
|
|
7
8
|
}
|
|
9
|
+
export type SelectRootComponent<P = {}> = <T extends CollectionItem>(props: Assign<SelectRootProps<T>, P>) => Snippet;
|
|
8
10
|
import { type UsePresenceProps } from '../presence';
|
|
9
11
|
declare function $$render<T extends CollectionItem = CollectionItem>(): {
|
|
10
12
|
props: SelectRootProps<T>;
|
|
@@ -15,7 +15,7 @@ export { default as Item, type SelectItemProps as ItemProps } from './select-ite
|
|
|
15
15
|
export { default as Label, type SelectLabelProps as LabelProps } from './select-label.svelte';
|
|
16
16
|
export { default as List, type SelectListProps as ListProps } from './select-list.svelte';
|
|
17
17
|
export { default as Positioner, type SelectPositionerProps as PositionerProps } from './select-positioner.svelte';
|
|
18
|
-
export { default as RootProvider, type SelectRootProviderBaseProps as RootProviderBaseProps, type SelectRootProviderProps as RootProviderProps, } from './select-root-provider.svelte';
|
|
19
|
-
export { default as Root, type SelectRootBaseProps as RootBaseProps, type SelectRootProps as RootProps, } from './select-root.svelte';
|
|
18
|
+
export { default as RootProvider, type SelectRootProviderBaseProps as RootProviderBaseProps, type SelectRootProviderProps as RootProviderProps, type SelectRootProviderComponent as RootProviderComponent, } from './select-root-provider.svelte';
|
|
19
|
+
export { default as Root, type SelectRootBaseProps as RootBaseProps, type SelectRootProps as RootProps, type SelectRootComponent as RootComponent, } from './select-root.svelte';
|
|
20
20
|
export { default as Trigger, type SelectTriggerProps as TriggerProps } from './select-trigger.svelte';
|
|
21
21
|
export { default as ValueText, type SelectValueTextProps as ValueTextProps } from './select-value-text.svelte';
|
|
@@ -16,8 +16,8 @@ export { default as TreeViewNodeContext, type TreeViewNodeContextProps } from '.
|
|
|
16
16
|
export { default as TreeViewNodeCheckbox, type TreeViewNodeCheckboxBaseProps, type TreeViewNodeCheckboxProps, } from './tree-view-node-checkbox.svelte';
|
|
17
17
|
export { default as TreeViewNodeCheckboxIndicator, type TreeViewNodeCheckboxIndicatorBaseProps, type TreeViewNodeCheckboxIndicatorProps, } from './tree-view-node-checkbox-indicator.svelte';
|
|
18
18
|
export { default as TreeViewNodeProvider, type TreeViewNodeProviderBaseProps, type TreeViewNodeProviderProps, } from './tree-view-node-provider.svelte';
|
|
19
|
-
export { default as TreeViewRoot, type TreeViewRootBaseProps, type TreeViewRootProps } from './tree-view-root.svelte';
|
|
20
|
-
export { default as TreeViewRootProvider, type TreeViewRootProviderBaseProps, type TreeViewRootProviderProps, } from './tree-view-root-provider.svelte';
|
|
19
|
+
export { default as TreeViewRoot, type TreeViewRootBaseProps, type TreeViewRootComponent, type TreeViewRootProps, } from './tree-view-root.svelte';
|
|
20
|
+
export { default as TreeViewRootProvider, type TreeViewRootProviderBaseProps, type TreeViewRootProviderComponent, type TreeViewRootProviderProps, } from './tree-view-root-provider.svelte';
|
|
21
21
|
export { default as TreeViewTree, type TreeViewTreeBaseProps, type TreeViewTreeProps } from './tree-view-tree.svelte';
|
|
22
22
|
export { treeViewAnatomy } from './tree-view.anatomy';
|
|
23
23
|
export { useTreeViewContext } from './use-tree-view-context';
|
|
@@ -15,7 +15,7 @@ export { default as TreeViewNodeContext } from './tree-view-node-context.svelte'
|
|
|
15
15
|
export { default as TreeViewNodeCheckbox, } from './tree-view-node-checkbox.svelte';
|
|
16
16
|
export { default as TreeViewNodeCheckboxIndicator, } from './tree-view-node-checkbox-indicator.svelte';
|
|
17
17
|
export { default as TreeViewNodeProvider, } from './tree-view-node-provider.svelte';
|
|
18
|
-
export { default as TreeViewRoot } from './tree-view-root.svelte';
|
|
18
|
+
export { default as TreeViewRoot, } from './tree-view-root.svelte';
|
|
19
19
|
export { default as TreeViewRootProvider, } from './tree-view-root-provider.svelte';
|
|
20
20
|
export { default as TreeViewTree } from './tree-view-tree.svelte';
|
|
21
21
|
export { treeViewAnatomy } from './tree-view.anatomy';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
3
4
|
import type { TreeNode } from '../collection'
|
|
4
5
|
import type { UseTreeViewReturn } from './use-tree-view.svelte'
|
|
5
6
|
|
|
@@ -11,6 +12,10 @@
|
|
|
11
12
|
}
|
|
12
13
|
export interface TreeViewRootProviderProps<T extends TreeNode>
|
|
13
14
|
extends Assign<HTMLProps<'div'>, TreeViewRootProviderBaseProps<T>> {}
|
|
15
|
+
|
|
16
|
+
export type TreeViewRootProviderComponent<P = {}> = <T extends TreeNode>(
|
|
17
|
+
props: Assign<TreeViewRootProviderProps<T>, P>,
|
|
18
|
+
) => Snippet
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
<script lang="ts" generics="T extends TreeNode">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { TreeNode } from '../collection';
|
|
3
4
|
import type { UseTreeViewReturn } from './use-tree-view.svelte';
|
|
4
5
|
export interface TreeViewRootProviderBaseProps<T extends TreeNode> extends RenderStrategyProps, PolymorphicProps<'div'>, RefAttribute {
|
|
@@ -6,6 +7,7 @@ export interface TreeViewRootProviderBaseProps<T extends TreeNode> extends Rende
|
|
|
6
7
|
}
|
|
7
8
|
export interface TreeViewRootProviderProps<T extends TreeNode> extends Assign<HTMLProps<'div'>, TreeViewRootProviderBaseProps<T>> {
|
|
8
9
|
}
|
|
10
|
+
export type TreeViewRootProviderComponent<P = {}> = <T extends TreeNode>(props: Assign<TreeViewRootProviderProps<T>, P>) => Snippet;
|
|
9
11
|
import { type RenderStrategyProps } from '../../utils/render-strategy';
|
|
10
12
|
declare function $$render<T extends TreeNode>(): {
|
|
11
13
|
props: TreeViewRootProviderProps<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
3
4
|
import type { TreeNode } from '../collection'
|
|
4
5
|
import type { UseTreeViewProps } from './use-tree-view.svelte'
|
|
5
6
|
|
|
@@ -10,6 +11,8 @@
|
|
|
10
11
|
RefAttribute {}
|
|
11
12
|
|
|
12
13
|
export interface TreeViewRootProps<T extends TreeNode> extends Assign<HTMLProps<'div'>, TreeViewRootBaseProps<T>> {}
|
|
14
|
+
|
|
15
|
+
export type TreeViewRootComponent<P = {}> = <T extends TreeNode>(props: Assign<TreeViewRootProps<T>, P>) => Snippet
|
|
13
16
|
</script>
|
|
14
17
|
|
|
15
18
|
<script lang="ts" generics="T extends TreeNode">
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
2
3
|
import type { TreeNode } from '../collection';
|
|
3
4
|
import type { UseTreeViewProps } from './use-tree-view.svelte';
|
|
4
5
|
export interface TreeViewRootBaseProps<T extends TreeNode> extends UseTreeViewProps<T>, RenderStrategyProps, PolymorphicProps<'div'>, RefAttribute {
|
|
5
6
|
}
|
|
6
7
|
export interface TreeViewRootProps<T extends TreeNode> extends Assign<HTMLProps<'div'>, TreeViewRootBaseProps<T>> {
|
|
7
8
|
}
|
|
9
|
+
export type TreeViewRootComponent<P = {}> = <T extends TreeNode>(props: Assign<TreeViewRootProps<T>, P>) => Snippet;
|
|
8
10
|
import { type RenderStrategyProps } from '../../utils/render-strategy';
|
|
9
11
|
declare function $$render<T extends TreeNode>(): {
|
|
10
12
|
props: TreeViewRootProps<T>;
|
|
@@ -15,6 +15,6 @@ export { default as NodeCheckbox, type TreeViewNodeCheckboxBaseProps as NodeChec
|
|
|
15
15
|
export { default as NodeCheckboxIndicator, type TreeViewNodeCheckboxIndicatorBaseProps as NodeCheckboxIndicatorBaseProps, type TreeViewNodeCheckboxIndicatorProps as NodeCheckboxIndicatorProps, } from './tree-view-node-checkbox-indicator.svelte';
|
|
16
16
|
export { default as NodeContext, type TreeViewNodeContextProps as NodeContextProps, } from './tree-view-node-context.svelte';
|
|
17
17
|
export { default as NodeProvider, type TreeViewNodeProviderBaseProps as NodeProviderBaseProps, type TreeViewNodeProviderProps as NodeProviderProps, } from './tree-view-node-provider.svelte';
|
|
18
|
-
export { default as Root, type TreeViewRootBaseProps as RootBaseProps, type TreeViewRootProps as RootProps, } from './tree-view-root.svelte';
|
|
19
|
-
export { default as RootProvider, type TreeViewRootProviderBaseProps as RootProviderBaseProps, type TreeViewRootProviderProps as RootProviderProps, } from './tree-view-root-provider.svelte';
|
|
18
|
+
export { default as Root, type TreeViewRootBaseProps as RootBaseProps, type TreeViewRootComponent as RootComponent, type TreeViewRootProps as RootProps, } from './tree-view-root.svelte';
|
|
19
|
+
export { default as RootProvider, type TreeViewRootProviderBaseProps as RootProviderBaseProps, type TreeViewRootProviderComponent as RootProviderComponent, type TreeViewRootProviderProps as RootProviderProps, } from './tree-view-root-provider.svelte';
|
|
20
20
|
export { default as Tree, type TreeViewTreeBaseProps as TreeBaseProps, type TreeViewTreeProps as TreeProps, } from './tree-view-tree.svelte';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SourceMap interface for transformation output
|
|
3
|
+
*/
|
|
4
|
+
interface SourceMap {
|
|
5
|
+
version: number;
|
|
6
|
+
sources: string[];
|
|
7
|
+
names: string[];
|
|
8
|
+
sourceRoot?: string;
|
|
9
|
+
sourcesContent?: string[];
|
|
10
|
+
mappings: string;
|
|
11
|
+
file: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Plugin interface matching Vite/Rollup plugin structure
|
|
15
|
+
*/
|
|
16
|
+
interface SveltePlugin {
|
|
17
|
+
name: string;
|
|
18
|
+
transform: (code: string, id: string) => TransformResult | null | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Result of the transform operation
|
|
22
|
+
*/
|
|
23
|
+
interface TransformResult {
|
|
24
|
+
code: string;
|
|
25
|
+
map?: SourceMap | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a Vite/Svelte plugin that optimizes lucide-svelte imports by converting
|
|
29
|
+
* destructured imports to direct imports for better tree-shaking
|
|
30
|
+
*
|
|
31
|
+
* @returns A Svelte plugin that transforms lucide-svelte imports
|
|
32
|
+
*/
|
|
33
|
+
export declare function lucideOptimizeImports(): SveltePlugin;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Pre-compile regex for better performance
|
|
2
|
+
const LUCIDE_IMPORT_PATTERN = /([ \t]*)import\s+\{\s*([^}]+)\s*\}\s+from\s+['"]lucide-svelte['"]/g;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Vite/Svelte plugin that optimizes lucide-svelte imports by converting
|
|
5
|
+
* destructured imports to direct imports for better tree-shaking
|
|
6
|
+
*
|
|
7
|
+
* @returns A Svelte plugin that transforms lucide-svelte imports
|
|
8
|
+
*/
|
|
9
|
+
export function lucideOptimizeImports() {
|
|
10
|
+
return {
|
|
11
|
+
name: 'lucide-svelte-optimizer',
|
|
12
|
+
transform(sourceCode, filePath) {
|
|
13
|
+
if (!isValidInput(sourceCode, filePath))
|
|
14
|
+
return null;
|
|
15
|
+
try {
|
|
16
|
+
// Quick check if the file contains lucide-svelte imports
|
|
17
|
+
if (!sourceCode.includes('lucide-svelte'))
|
|
18
|
+
return null;
|
|
19
|
+
const { transformedCode, hasChanges } = transformLucideImports(sourceCode);
|
|
20
|
+
if (hasChanges) {
|
|
21
|
+
return {
|
|
22
|
+
code: transformedCode,
|
|
23
|
+
map: null, // No source maps in this implementation
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
handleTransformError(error);
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validates the input parameters for processing
|
|
37
|
+
*/
|
|
38
|
+
function isValidInput(code, id) {
|
|
39
|
+
return Boolean(code && id);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Transforms lucide-svelte imports from destructured to individual imports
|
|
43
|
+
*/
|
|
44
|
+
function transformLucideImports(sourceCode) {
|
|
45
|
+
let hasChanges = false;
|
|
46
|
+
const transformedCode = sourceCode.replace(LUCIDE_IMPORT_PATTERN, (match, indentation, importNames) => {
|
|
47
|
+
if (!importNames.trim())
|
|
48
|
+
return match;
|
|
49
|
+
const semicolonAtEnd = match.endsWith(';');
|
|
50
|
+
const individualImports = convertToIndividualImports(importNames, indentation, semicolonAtEnd);
|
|
51
|
+
if (individualImports) {
|
|
52
|
+
hasChanges = true;
|
|
53
|
+
return individualImports;
|
|
54
|
+
}
|
|
55
|
+
return match;
|
|
56
|
+
});
|
|
57
|
+
return { transformedCode, hasChanges };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Converts a comma-separated list of imports to individual import statements
|
|
61
|
+
*/
|
|
62
|
+
function convertToIndividualImports(importNames, indentation, withSemicolon) {
|
|
63
|
+
return importNames
|
|
64
|
+
.split(',')
|
|
65
|
+
.map((name) => name.trim())
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.map((name) => {
|
|
68
|
+
const kebabCasePath = convertToKebabCase(name);
|
|
69
|
+
const semicolon = withSemicolon ? ';' : '';
|
|
70
|
+
return `${indentation}import ${name} from 'lucide-svelte/icons/${kebabCasePath}'${semicolon}`;
|
|
71
|
+
})
|
|
72
|
+
.join('\n');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Converts a camelCase or PascalCase string to kebab-case
|
|
76
|
+
*/
|
|
77
|
+
function convertToKebabCase(str) {
|
|
78
|
+
return str
|
|
79
|
+
.replace(/Icon$/, '') // Remove 'Icon' suffix
|
|
80
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
81
|
+
.toLowerCase();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Handles and logs transformation errors
|
|
85
|
+
*/
|
|
86
|
+
function handleTransformError(error) {
|
|
87
|
+
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
88
|
+
console.error('Error in lucide-svelte-optimizer plugin:', typedError);
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.8.0",
|
|
5
5
|
"description": "A collection of unstyled, accessible UI components for Svelte",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"accordion",
|
|
@@ -189,12 +189,14 @@
|
|
|
189
189
|
"@sveltejs/package": "2.5.0",
|
|
190
190
|
"@sveltejs/vite-plugin-svelte": "6.1.3",
|
|
191
191
|
"@tanstack/svelte-form": "1.19.2",
|
|
192
|
+
"@testing-library/dom": "10.4.1",
|
|
192
193
|
"@testing-library/jest-dom": "6.8.0",
|
|
193
194
|
"@testing-library/svelte": "5.2.8",
|
|
194
195
|
"@testing-library/user-event": "14.6.1",
|
|
195
196
|
"@vitest/coverage-v8": "3.2.4",
|
|
196
197
|
"clean-package": "2.2.0",
|
|
197
198
|
"image-conversion": "2.1.1",
|
|
199
|
+
"jsdom": "26.1.0",
|
|
198
200
|
"lucide-svelte": "0.541.0",
|
|
199
201
|
"storybook": "9.1.3",
|
|
200
202
|
"svelte": "5.38.3",
|
|
@@ -202,7 +204,8 @@
|
|
|
202
204
|
"tslib": "2.8.1",
|
|
203
205
|
"typescript": "5.9.2",
|
|
204
206
|
"vite": "7.1.3",
|
|
205
|
-
"vitest": "3.2.4"
|
|
207
|
+
"vitest": "3.2.4",
|
|
208
|
+
"vitest-axe": "1.0.0-pre.5"
|
|
206
209
|
},
|
|
207
210
|
"peerDependencies": {
|
|
208
211
|
"svelte": ">=5.20.0"
|