ui-ingredients 0.0.43 → 0.0.45
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/dist/accordion/create-accordion.svelte.js +3 -4
- package/dist/accordion/item-content.svelte +7 -11
- package/dist/accordion/item.svelte +2 -2
- package/dist/accordion/root.svelte +4 -6
- package/dist/avatar/create-avatar.svelte.js +3 -4
- package/dist/avatar/root.svelte +2 -2
- package/dist/carousel/create-carousel.svelte.js +3 -4
- package/dist/carousel/indicator.svelte +2 -2
- package/dist/carousel/item.svelte +2 -2
- package/dist/carousel/root.svelte +2 -2
- package/dist/checkbox/create-checkbox.svelte.js +4 -5
- package/dist/checkbox/root.svelte +2 -2
- package/dist/clipboard/create-clipboard.svelte.js +3 -4
- package/dist/clipboard/root.svelte +2 -2
- package/dist/collapsible/create-collapsible.svelte.js +3 -4
- package/dist/collapsible/root.svelte +2 -2
- package/dist/color-picker/create-color-picker.svelte.js +3 -4
- package/dist/color-picker/root.svelte +2 -2
- package/dist/combobox/create-combobox.svelte.js +4 -5
- package/dist/combobox/item.svelte +2 -2
- package/dist/combobox/root.svelte +10 -16
- package/dist/create-context.svelte.js +1 -9
- package/dist/date-picker/create-date-picker.svelte.js +2 -3
- package/dist/date-picker/day-table-cell.svelte +2 -2
- package/dist/date-picker/month-table-cell.svelte +2 -2
- package/dist/date-picker/root.svelte +10 -18
- package/dist/date-picker/year-table-cell.svelte +2 -2
- package/dist/dialog/backdrop.svelte +7 -12
- package/dist/dialog/create-dialog.svelte.js +3 -4
- package/dist/dialog/root.svelte +6 -12
- package/dist/editable/create-editable.svelte.js +4 -5
- package/dist/editable/root.svelte +2 -2
- package/dist/environment-provider/root.svelte +5 -8
- package/dist/field/create-field.svelte.d.ts +1 -22
- package/dist/field/create-field.svelte.js +9 -20
- package/dist/field/root.svelte +2 -2
- package/dist/file-upload/create-file-upload.svelte.js +4 -5
- package/dist/file-upload/item.svelte +2 -2
- package/dist/file-upload/root.svelte +2 -2
- package/dist/floating-panel/body.svelte +24 -0
- package/dist/floating-panel/body.svelte.d.ts +18 -0
- package/dist/floating-panel/close-trigger.svelte +27 -0
- package/dist/floating-panel/close-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/content.svelte +36 -0
- package/dist/floating-panel/content.svelte.d.ts +18 -0
- package/dist/floating-panel/context.svelte.d.ts +2 -0
- package/dist/floating-panel/context.svelte.js +2 -0
- package/dist/floating-panel/create-floating-panel.svelte.d.ts +2 -1
- package/dist/floating-panel/create-floating-panel.svelte.js +4 -4
- package/dist/floating-panel/drag-trigger.svelte +27 -0
- package/dist/floating-panel/drag-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/floating-panel.d.ts +13 -0
- package/dist/floating-panel/floating-panel.js +13 -0
- package/dist/floating-panel/header.svelte +25 -0
- package/dist/floating-panel/header.svelte.d.ts +18 -0
- package/dist/floating-panel/index.d.ts +16 -0
- package/dist/floating-panel/index.js +3 -0
- package/dist/floating-panel/maximize-trigger.svelte +28 -0
- package/dist/floating-panel/maximize-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/minimize-trigger.svelte +28 -0
- package/dist/floating-panel/minimize-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/positioner.svelte +35 -0
- package/dist/floating-panel/positioner.svelte.d.ts +18 -0
- package/dist/floating-panel/resize-trigger.svelte +36 -0
- package/dist/floating-panel/resize-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/restore-trigger.svelte +28 -0
- package/dist/floating-panel/restore-trigger.svelte.d.ts +18 -0
- package/dist/floating-panel/root.svelte +45 -0
- package/dist/floating-panel/root.svelte.d.ts +18 -0
- package/dist/floating-panel/title.svelte +25 -0
- package/dist/floating-panel/title.svelte.d.ts +18 -0
- package/dist/floating-panel/trigger.svelte +27 -0
- package/dist/floating-panel/trigger.svelte.d.ts +18 -0
- package/dist/highlight/highlight.svelte +42 -0
- package/dist/highlight/highlight.svelte.d.ts +18 -0
- package/dist/highlight/index.d.ts +1 -0
- package/dist/highlight/index.js +1 -0
- package/dist/hover-card/create-hover-card.svelte.js +3 -4
- package/dist/hover-card/root.svelte +6 -11
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/is-object.d.ts +2 -0
- package/dist/is-object.js +4 -0
- package/dist/locale-provider/root.svelte +8 -6
- package/dist/menu/create-menu.svelte.js +3 -4
- package/dist/menu/item.svelte +2 -2
- package/dist/menu/option-item.svelte +2 -2
- package/dist/menu/root.svelte +6 -12
- package/dist/merge-props.js +1 -4
- package/dist/number-input/create-number-input.svelte.js +4 -5
- package/dist/number-input/root.svelte +2 -2
- package/dist/pagination/create-pagination.svelte.js +3 -4
- package/dist/pagination/root.svelte +2 -2
- package/dist/pin-input/create-pin-input.svelte.js +4 -5
- package/dist/pin-input/root.svelte +2 -2
- package/dist/popover/create-popover.svelte.js +3 -4
- package/dist/popover/root.svelte +6 -11
- package/dist/presence/root.svelte +7 -3
- package/dist/progress/create-progress.svelte.js +3 -4
- package/dist/progress/root.svelte +2 -2
- package/dist/qr-code/create-qr-code.svelte.js +3 -4
- package/dist/qr-code/root.svelte +2 -2
- package/dist/radio-group/create-radio-group.svelte.js +3 -4
- package/dist/radio-group/item.svelte +2 -2
- package/dist/radio-group/root.svelte +2 -2
- package/dist/rating-group/create-rating-group.svelte.js +4 -5
- package/dist/rating-group/root.svelte +2 -2
- package/dist/segment-group/create-segment-group.svelte.js +3 -4
- package/dist/segment-group/item.svelte +2 -2
- package/dist/segment-group/root.svelte +2 -2
- package/dist/select/create-select.svelte.js +2 -3
- package/dist/select/item.svelte +2 -2
- package/dist/select/root.svelte +11 -19
- package/dist/signature-pad/create-signature-pad.svelte.js +3 -4
- package/dist/signature-pad/root.svelte +2 -2
- package/dist/slider/create-slider.svelte.js +3 -4
- package/dist/slider/root.svelte +2 -2
- package/dist/slider/thumb.svelte +2 -2
- package/dist/splitter/create-splitter.svelte.js +3 -4
- package/dist/splitter/panel.svelte +2 -2
- package/dist/splitter/resize-trigger.svelte +2 -2
- package/dist/splitter/root.svelte +2 -2
- package/dist/steps/create-steps.svelte.js +3 -4
- package/dist/steps/item.svelte +2 -2
- package/dist/steps/root.svelte +2 -2
- package/dist/switch/create-switch.svelte.js +4 -5
- package/dist/switch/root.svelte +2 -2
- package/dist/tabs/content.svelte +2 -2
- package/dist/tabs/create-tabs.svelte.js +3 -4
- package/dist/tabs/root.svelte +2 -2
- package/dist/tabs/trigger.svelte +2 -2
- package/dist/tags-input/create-tags-input.svelte.js +4 -5
- package/dist/tags-input/item.svelte +2 -2
- package/dist/tags-input/root.svelte +2 -2
- package/dist/time-picker/create-time-picker.svelte.js +3 -4
- package/dist/time-picker/root.svelte +11 -21
- package/dist/timer/create-timer.svelte.js +3 -4
- package/dist/timer/item.svelte +2 -2
- package/dist/timer/root.svelte +2 -2
- package/dist/toast/create-toast.svelte.js +1 -2
- package/dist/toast/create-toaster.svelte.js +2 -3
- package/dist/toggle-group/create-toggle-group.svelte.js +3 -4
- package/dist/toggle-group/item.svelte +2 -2
- package/dist/toggle-group/root.svelte +2 -2
- package/dist/tooltip/create-tooltip.svelte.js +3 -4
- package/dist/tooltip/root.svelte +6 -12
- package/dist/tour/arrow-tip.svelte +24 -0
- package/dist/tour/arrow-tip.svelte.d.ts +18 -0
- package/dist/tour/arrow.svelte +24 -0
- package/dist/tour/arrow.svelte.d.ts +18 -0
- package/dist/tour/close-trigger.svelte +25 -0
- package/dist/tour/close-trigger.svelte.d.ts +18 -0
- package/dist/tour/content.svelte +30 -0
- package/dist/tour/content.svelte.d.ts +18 -0
- package/dist/tour/context.svelte.d.ts +2 -0
- package/dist/tour/context.svelte.js +3 -0
- package/dist/tour/create-tour.svelte.js +4 -4
- package/dist/tour/description.svelte +24 -0
- package/dist/tour/description.svelte.d.ts +18 -0
- package/dist/tour/index.d.ts +17 -0
- package/dist/tour/index.js +3 -0
- package/dist/tour/next-trigger.svelte +24 -0
- package/dist/tour/next-trigger.svelte.d.ts +18 -0
- package/dist/tour/overlay.svelte +38 -0
- package/dist/tour/overlay.svelte.d.ts +18 -0
- package/dist/tour/positioner.svelte +30 -0
- package/dist/tour/positioner.svelte.d.ts +18 -0
- package/dist/tour/prev-trigger.svelte +24 -0
- package/dist/tour/prev-trigger.svelte.d.ts +18 -0
- package/dist/tour/progress-text.svelte +28 -0
- package/dist/tour/progress-text.svelte.d.ts +18 -0
- package/dist/tour/root.svelte +47 -0
- package/dist/tour/root.svelte.d.ts +18 -0
- package/dist/tour/skip-trigger.svelte +24 -0
- package/dist/tour/skip-trigger.svelte.d.ts +18 -0
- package/dist/tour/spotlight.svelte +24 -0
- package/dist/tour/spotlight.svelte.d.ts +18 -0
- package/dist/tour/title.svelte +24 -0
- package/dist/tour/title.svelte.d.ts +18 -0
- package/dist/tour/tour.d.ts +14 -0
- package/dist/tour/tour.js +14 -0
- package/dist/tree-view/branch.svelte +2 -2
- package/dist/tree-view/create-tree-view.svelte.js +3 -4
- package/dist/tree-view/item.svelte +2 -2
- package/dist/tree-view/root.svelte +2 -2
- package/dist/types.d.ts +10 -16
- package/package.json +2 -1
@@ -7,13 +7,12 @@ export function createTreeView(props) {
|
|
7
7
|
const locale = getLocaleContext();
|
8
8
|
const environment = getEnvironmentContext();
|
9
9
|
const id = uid();
|
10
|
-
const context =
|
10
|
+
const context = reflect(() => ({
|
11
11
|
...props,
|
12
12
|
id: props.id ?? id,
|
13
13
|
dir: locale?.dir,
|
14
14
|
getRootNode: environment?.getRootNode,
|
15
|
-
}))
|
15
|
+
}));
|
16
16
|
const [state, send] = useMachine(treeView.machine(context), { context });
|
17
|
-
|
18
|
-
return api;
|
17
|
+
return reflect(() => treeView.connect(state, send, normalizeProps));
|
19
18
|
}
|
@@ -18,14 +18,14 @@
|
|
18
18
|
|
19
19
|
let treeView = getTreeViewContext();
|
20
20
|
|
21
|
-
let [itemProps,
|
21
|
+
let [itemProps, localProps] = $derived(
|
22
22
|
createSplitProps<ItemProps>(['depth', 'value', 'disabled'])(props),
|
23
23
|
);
|
24
24
|
|
25
25
|
let itemState = $derived(treeView.getItemState(itemProps));
|
26
26
|
|
27
27
|
let mergedProps = $derived(
|
28
|
-
mergeProps(
|
28
|
+
mergeProps(localProps, treeView.getItemProps(itemProps)),
|
29
29
|
);
|
30
30
|
|
31
31
|
setTreeViewItemPropsContext(() => itemProps);
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {asChild, children, ...props}: TreeViewProps = $props();
|
23
23
|
|
24
|
-
let [treeViewProps,
|
24
|
+
let [treeViewProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateTreeViewProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -39,7 +39,7 @@
|
|
39
39
|
|
40
40
|
let treeView = createTreeView(reflect(() => treeViewProps));
|
41
41
|
|
42
|
-
let mergedProps = $derived(mergeProps(
|
42
|
+
let mergedProps = $derived(mergeProps(localProps, treeView.getRootProps()));
|
43
43
|
|
44
44
|
setTreeViewContext(treeView);
|
45
45
|
</script>
|
package/dist/types.d.ts
CHANGED
@@ -1,27 +1,21 @@
|
|
1
1
|
import type { Snippet } from 'svelte';
|
2
2
|
import type { Action } from 'svelte/action';
|
3
3
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
4
|
-
import type { TransitionConfig } from 'svelte/transition';
|
5
4
|
export type GenericObject = Record<string, any>;
|
6
5
|
export type Assign<Target extends GenericObject, Source extends GenericObject> = Source & Omit<Target, keyof Source>;
|
7
|
-
export type
|
6
|
+
export type IntrinsicElement = keyof {
|
8
7
|
[K in keyof SvelteHTMLElements as string extends K ? never : number extends K ? never : K]: string;
|
9
8
|
};
|
10
|
-
export type HtmlProps<T extends
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
transition?: TransitionFunction;
|
16
|
-
}
|
17
|
-
export type AsChildWithRef<Ref extends Action, Context = never> = [
|
18
|
-
Context
|
19
|
-
] extends [never] ? Snippet<[ref: Ref, attrs: GenericObject]> : Snippet<[ref: Ref, attrs: GenericObject, context: Context]>;
|
20
|
-
export type AsChildWithoutRef<Context = never> = [Context] extends [never] ? Snippet<[attrs: GenericObject]> : Snippet<[attrs: GenericObject, context: Context]>;
|
9
|
+
export type HtmlProps<T extends IntrinsicElement> = SvelteHTMLElements[T];
|
10
|
+
type AsChildWithRef<Ref extends Action, Context = never> = [Context] extends [
|
11
|
+
never
|
12
|
+
] ? Snippet<[ref: Ref, attrs: GenericObject]> : Snippet<[ref: Ref, attrs: GenericObject, context: Context]>;
|
13
|
+
type AsChildWithoutRef<Context = never> = [Context] extends [never] ? Snippet<[attrs: GenericObject]> : Snippet<[attrs: GenericObject, context: Context]>;
|
21
14
|
export type AsChild<Ref extends Action, Context = never> = [Ref] extends [never] ? AsChildWithoutRef<Context> : AsChildWithRef<Ref, Context>;
|
22
|
-
|
23
|
-
|
24
|
-
export type HtmlIngredientProps<Element extends
|
15
|
+
type Children<T = never> = [T] extends [never] ? Snippet : Snippet<[context: T]>;
|
16
|
+
type PropsWithoutChildren<T> = Omit<T, 'children'>;
|
17
|
+
export type HtmlIngredientProps<Element extends IntrinsicElement, Context = never, Ref extends Action = never> = PropsWithoutChildren<HtmlProps<Element>> & {
|
25
18
|
children?: Children<Context>;
|
26
19
|
asChild?: AsChild<Ref, Context>;
|
27
20
|
};
|
21
|
+
export {};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "ui-ingredients",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.45",
|
5
5
|
"packageManager": "pnpm@9.7.0",
|
6
6
|
"svelte": "./dist/index.js",
|
7
7
|
"types": "./dist/index.d.ts",
|
@@ -100,6 +100,7 @@
|
|
100
100
|
"@zag-js/editable": "0.67.0",
|
101
101
|
"@zag-js/file-upload": "0.67.0",
|
102
102
|
"@zag-js/floating-panel": "0.67.0",
|
103
|
+
"@zag-js/highlight-word": "0.67.0",
|
103
104
|
"@zag-js/hover-card": "0.67.0",
|
104
105
|
"@zag-js/i18n-utils": "0.67.0",
|
105
106
|
"@zag-js/menu": "0.67.0",
|