ui-ingredients 0.0.66 → 0.0.68
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -2
- package/dist/accordion/accordion-item-content.svelte +2 -2
- package/dist/accordion/avatar-context.svelte.d.ts +2 -2
- package/dist/avatar/avatar-context.svelte.d.ts +1 -1
- package/dist/carousel/carousel-context.svelte.d.ts +1 -1
- package/dist/checkbox/checkbox-context.svelte.d.ts +1 -1
- package/dist/clipboard/clipboard-context.svelte.d.ts +1 -1
- package/dist/collapsible/collapsible-content.svelte +19 -8
- package/dist/collapsible/collapsible-content.svelte.d.ts +2 -1
- package/dist/collapsible/collapsible-context.svelte.d.ts +1 -1
- package/dist/collapsible/collapsible-root.svelte +23 -4
- package/dist/collapsible/collapsible-root.svelte.d.ts +2 -1
- package/dist/collapsible/collapsible-trigger.svelte +0 -1
- package/dist/color-picker/color-picker-channel-slider-value-text.svelte +4 -1
- package/dist/color-picker/color-picker-content.svelte +2 -2
- package/dist/color-picker/color-picker-context.svelte.d.ts +6 -8
- package/dist/combobox/combobox-content.svelte +2 -2
- package/dist/combobox/combobox-context.svelte.d.ts +3 -3
- package/dist/create-context.svelte.d.ts +7 -4
- package/dist/create-context.svelte.js +26 -15
- package/dist/date-picker/date-picker-content.svelte +2 -2
- package/dist/date-picker/date-picker-context.svelte.d.ts +5 -5
- package/dist/dialog/dialog-backdrop.svelte +2 -2
- package/dist/dialog/dialog-content.svelte +2 -2
- package/dist/dialog/dialog-context.svelte.d.ts +1 -1
- package/dist/editable/editable-context.svelte.d.ts +1 -1
- package/dist/environment-provider/enviroment-provider-context.svelte.d.ts +1 -1
- package/dist/field/field-context.svelte.d.ts +1 -1
- package/dist/field/field-error-text.svelte +3 -1
- package/dist/field/field-helper-text.svelte +3 -1
- package/dist/field/field-input.svelte +1 -1
- package/dist/field/field-label.svelte +1 -1
- package/dist/field/field-select.svelte +1 -1
- package/dist/field/field-textarea.svelte +3 -1
- package/dist/file-upload/file-upload-context.svelte.d.ts +2 -2
- package/dist/floating-panel/floating-panel-content.svelte +2 -2
- package/dist/floating-panel/floating-panel-context.svelte.d.ts +1 -1
- package/dist/hover-card/hover-card-content.svelte +2 -2
- package/dist/hover-card/hover-card-context.svelte.d.ts +1 -1
- package/dist/is-pojo.d.ts +2 -0
- package/dist/{is-object.js → is-pojo.js} +1 -1
- package/dist/locale-provider/local-provider-context.svelte.d.ts +1 -1
- package/dist/menu/menu-arrow-tip.svelte +1 -1
- package/dist/menu/menu-arrow.svelte +1 -1
- package/dist/menu/menu-content.svelte +3 -3
- package/dist/menu/menu-context-trigger.svelte +1 -1
- package/dist/menu/menu-context.svelte.d.ts +4 -4
- package/dist/menu/menu-indicator.svelte +1 -1
- package/dist/menu/menu-item-group-label.svelte +1 -1
- package/dist/menu/menu-item-group.svelte +1 -1
- package/dist/menu/menu-item.svelte +2 -2
- package/dist/menu/menu-option-item-indicator.svelte +1 -1
- package/dist/menu/menu-option-item-text.svelte +1 -1
- package/dist/menu/menu-option-item.svelte +2 -2
- package/dist/menu/menu-positioner.svelte +1 -1
- package/dist/menu/menu-separator.svelte +1 -1
- package/dist/menu/menu-trigger.svelte +1 -1
- package/dist/merge-props.js +2 -2
- package/dist/number-input/number-input-context.svelte.d.ts +1 -1
- package/dist/pagination/pagination-context.svelte.d.ts +1 -1
- package/dist/pin-input/pin-input-context.svelte.d.ts +1 -1
- package/dist/popover/popover-content.svelte +2 -2
- package/dist/popover/popover-context.svelte.d.ts +1 -1
- package/dist/presence/create-presence.svelte.d.ts +1 -1
- package/dist/presence/create-presence.svelte.js +2 -2
- package/dist/presence/presence-context.svelte.d.ts +2 -2
- package/dist/presence/presence.svelte +2 -2
- package/dist/progress/progress-context.svelte.d.ts +1 -1
- package/dist/qr-code/qr-code-context.svelte.d.ts +1 -1
- package/dist/radio-group/radio-group-context.svelte.d.ts +2 -2
- package/dist/rating-group/rating-group-context.svelte.d.ts +1 -1
- package/dist/segment-group/segment-group-context.svelte.d.ts +2 -2
- package/dist/select/select-content.svelte +2 -2
- package/dist/select/select-context.svelte.d.ts +3 -3
- package/dist/signature-pad/signature-pad-context.svelte.d.ts +1 -1
- package/dist/slider/slider-context.svelte.d.ts +2 -2
- package/dist/splitter/splitter-context.svelte.d.ts +1 -1
- package/dist/steps/steps-context.svelte.d.ts +2 -2
- package/dist/switch/switch-context.svelte.d.ts +1 -1
- package/dist/tabs/tabs-context.svelte.d.ts +1 -1
- package/dist/tags-input/tags-input-context.svelte.d.ts +2 -2
- package/dist/time-picker/time-picker-content.svelte +2 -2
- package/dist/time-picker/time-picker-context.svelte.d.ts +1 -1
- package/dist/timer/timer-context.svelte.d.ts +2 -2
- package/dist/toast/toast-context.svelte.d.ts +1 -1
- package/dist/toggle-group/toggle-group-context.svelte.d.ts +1 -1
- package/dist/tooltip/tooltip-content.svelte +2 -2
- package/dist/tooltip/tooltip-context.svelte.d.ts +1 -1
- package/dist/tour/tour-content.svelte +1 -1
- package/dist/tour/tour-context.svelte.d.ts +1 -1
- package/dist/tour/tour-overlay.svelte +1 -1
- package/dist/tree-view/tree-view-branch-content.svelte +27 -8
- package/dist/tree-view/tree-view-branch-content.svelte.d.ts +2 -1
- package/dist/tree-view/tree-view-context.svelte.d.ts +3 -3
- package/dist/tree-view/tree-view-root.svelte +14 -5
- package/dist/tree-view/tree-view-root.svelte.d.ts +2 -1
- package/package.json +1 -1
- package/dist/is-object.d.ts +0 -2
package/README.md
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
Headless component library for [Svelte](https://svelte.dev/) powered by [zag](https://zagjs.com/)
|
4
4
|
|
5
|
-
> ⚠️ This project is currently in the early stages of development. You're welcome to use it and we encourage contributions. Please use with caution as it is still evolving!
|
6
|
-
|
7
5
|
## Installation
|
8
6
|
|
9
7
|
```bash
|
@@ -46,9 +46,9 @@
|
|
46
46
|
|
47
47
|
{#if presence.mounted}
|
48
48
|
{#if asChild}
|
49
|
-
{@render asChild(presence.
|
49
|
+
{@render asChild(presence.setReference, mergedProps)}
|
50
50
|
{:else}
|
51
|
-
<div bind:this={ref} use:presence.
|
51
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
52
52
|
{@render children?.()}
|
53
53
|
</div>
|
54
54
|
{/if}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { ItemProps } from '@zag-js/accordion';
|
2
2
|
import type { CreateAccordionReturn } from './create-accordion.svelte.js';
|
3
|
-
export declare const getAccordionContext: () => CreateAccordionReturn, setAccordionContext: (context: CreateAccordionReturn | (() => CreateAccordionReturn)) =>
|
4
|
-
export declare const getAccordionItemPropsContext: () => ItemProps, setAccordionItemPropsContext: (context: ItemProps | (() => ItemProps)) =>
|
3
|
+
export declare const getAccordionContext: () => CreateAccordionReturn, setAccordionContext: (context: CreateAccordionReturn | (() => CreateAccordionReturn)) => void;
|
4
|
+
export declare const getAccordionItemPropsContext: () => ItemProps, setAccordionItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateAvatarReturn } from './create-avatar.svelte.js';
|
2
|
-
export declare const getAvatarContext: () => CreateAvatarReturn, setAvatarContext: (context: CreateAvatarReturn | (() => CreateAvatarReturn)) =>
|
2
|
+
export declare const getAvatarContext: () => CreateAvatarReturn, setAvatarContext: (context: CreateAvatarReturn | (() => CreateAvatarReturn)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateCarouselReturn } from './create-carousel.svelte.js';
|
2
|
-
export declare const getCarouselContext: () => CreateCarouselReturn, setCarouselContext: (context: CreateCarouselReturn | (() => CreateCarouselReturn)) =>
|
2
|
+
export declare const getCarouselContext: () => CreateCarouselReturn, setCarouselContext: (context: CreateCarouselReturn | (() => CreateCarouselReturn)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateCheckboxReturn } from './create-checkbox.svelte.js';
|
2
|
-
export declare const getCheckboxContext: () => CreateCheckboxReturn, setCheckboxContext: (context: CreateCheckboxReturn | (() => CreateCheckboxReturn)) =>
|
2
|
+
export declare const getCheckboxContext: () => CreateCheckboxReturn, setCheckboxContext: (context: CreateCheckboxReturn | (() => CreateCheckboxReturn)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateClipboardReturn } from './create-clipboard.svelte.js';
|
2
|
-
export declare const getClipboardContext: () => CreateClipboardReturn, setClipboardContext: (context: CreateClipboardReturn | (() => CreateClipboardReturn)) =>
|
2
|
+
export declare const getClipboardContext: () => CreateClipboardReturn, setClipboardContext: (context: CreateClipboardReturn | (() => CreateClipboardReturn)) => void;
|
@@ -1,12 +1,14 @@
|
|
1
1
|
<script lang="ts" module>
|
2
2
|
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {Action} from 'svelte/action';
|
3
4
|
|
4
5
|
export interface CollapsibleContentProps
|
5
|
-
extends HtmlIngredientProps<'div', HTMLDivElement> {}
|
6
|
+
extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
|
6
7
|
</script>
|
7
8
|
|
8
9
|
<script lang="ts">
|
9
10
|
import {mergeProps} from '../merge-props.js';
|
11
|
+
import {getPresenceContext} from '../presence/presence-context.svelte.js';
|
10
12
|
import {getCollapsibleContext} from './collapsible-context.svelte.js';
|
11
13
|
|
12
14
|
let {
|
@@ -17,14 +19,23 @@
|
|
17
19
|
}: CollapsibleContentProps = $props();
|
18
20
|
|
19
21
|
let collapsible = getCollapsibleContext();
|
22
|
+
let presence = getPresenceContext();
|
20
23
|
|
21
|
-
let mergedProps = $derived(
|
24
|
+
let mergedProps = $derived(
|
25
|
+
mergeProps(
|
26
|
+
collapsible.getContentProps(),
|
27
|
+
presence.getPresenceProps(),
|
28
|
+
props,
|
29
|
+
),
|
30
|
+
);
|
22
31
|
</script>
|
23
32
|
|
24
|
-
{#if
|
25
|
-
{
|
26
|
-
{
|
27
|
-
|
28
|
-
{
|
29
|
-
|
33
|
+
{#if presence.mounted}
|
34
|
+
{#if asChild}
|
35
|
+
{@render asChild(presence.setReference, mergedProps)}
|
36
|
+
{:else}
|
37
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
38
|
+
{@render children?.()}
|
39
|
+
</div>
|
40
|
+
{/if}
|
30
41
|
{/if}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { HtmlIngredientProps } from '../types.js';
|
2
|
-
|
2
|
+
import type { Action } from 'svelte/action';
|
3
|
+
export interface CollapsibleContentProps extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {
|
3
4
|
}
|
4
5
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
5
6
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateCollapsibleReturn } from './create-collapsible.svelte.js';
|
2
|
-
export declare const getCollapsibleContext: () => CreateCollapsibleReturn, setCollapsibleContext: (context: CreateCollapsibleReturn | (() => CreateCollapsibleReturn)) =>
|
2
|
+
export declare const getCollapsibleContext: () => CreateCollapsibleReturn, setCollapsibleContext: (context: CreateCollapsibleReturn | (() => CreateCollapsibleReturn)) => void;
|
@@ -1,4 +1,8 @@
|
|
1
1
|
<script lang="ts" module>
|
2
|
+
import {
|
3
|
+
createPresence,
|
4
|
+
type PresenceStrategyProps,
|
5
|
+
} from '../presence/create-presence.svelte.js';
|
2
6
|
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
7
|
import type {
|
4
8
|
CreateCollapsibleProps,
|
@@ -7,13 +11,15 @@
|
|
7
11
|
|
8
12
|
export interface CollapsibleProps
|
9
13
|
extends Assign<
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateCollapsibleReturn>,
|
15
|
+
CreateCollapsibleProps
|
16
|
+
>,
|
17
|
+
PresenceStrategyProps {}
|
13
18
|
</script>
|
14
19
|
|
15
20
|
<script lang="ts">
|
16
21
|
import {mergeProps} from '../merge-props.js';
|
22
|
+
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
17
23
|
import {reflect} from '@zag-js/svelte';
|
18
24
|
import {createSplitProps} from '@zag-js/utils';
|
19
25
|
import {setCollapsibleContext} from './collapsible-context.svelte.js';
|
@@ -26,6 +32,12 @@
|
|
26
32
|
...props
|
27
33
|
}: CollapsibleProps = $props();
|
28
34
|
|
35
|
+
let [presenceStrategyProps, rest] = $derived(
|
36
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
37
|
+
props,
|
38
|
+
),
|
39
|
+
);
|
40
|
+
|
29
41
|
let [createCollapsibleProps, localProps] = $derived(
|
30
42
|
createSplitProps<CreateCollapsibleProps>([
|
31
43
|
'id',
|
@@ -35,16 +47,23 @@
|
|
35
47
|
'disabled',
|
36
48
|
'onOpenChange',
|
37
49
|
'onExitComplete',
|
38
|
-
])(
|
50
|
+
])(rest),
|
39
51
|
);
|
40
52
|
|
41
53
|
let collapsible = createCollapsible(reflect(() => createCollapsibleProps));
|
54
|
+
let presence = createPresence(
|
55
|
+
reflect(() => ({
|
56
|
+
present: collapsible.open,
|
57
|
+
...presenceStrategyProps,
|
58
|
+
})),
|
59
|
+
);
|
42
60
|
|
43
61
|
let mergedProps = $derived(
|
44
62
|
mergeProps(collapsible.getRootProps(), localProps),
|
45
63
|
);
|
46
64
|
|
47
65
|
setCollapsibleContext(collapsible);
|
66
|
+
setPresenceContext(presence);
|
48
67
|
</script>
|
49
68
|
|
50
69
|
{#if asChild}
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { type PresenceStrategyProps } from '../presence/create-presence.svelte.js';
|
1
2
|
import type { Assign, HtmlIngredientProps } from '../types.js';
|
2
3
|
import type { CreateCollapsibleProps, CreateCollapsibleReturn } from './create-collapsible.svelte.js';
|
3
|
-
export interface CollapsibleProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, CreateCollapsibleReturn>, CreateCollapsibleProps
|
4
|
+
export interface CollapsibleProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, CreateCollapsibleReturn>, CreateCollapsibleProps>, PresenceStrategyProps {
|
4
5
|
}
|
5
6
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
6
7
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
@@ -32,9 +32,9 @@
|
|
32
32
|
|
33
33
|
{#if presence.mounted}
|
34
34
|
{#if asChild}
|
35
|
-
{@render asChild(presence.
|
35
|
+
{@render asChild(presence.setReference, mergedProps)}
|
36
36
|
{:else}
|
37
|
-
<div bind:this={ref} use:presence.
|
37
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
38
38
|
{@render children?.()}
|
39
39
|
</div>
|
40
40
|
{/if}
|
@@ -1,15 +1,13 @@
|
|
1
1
|
import type { AreaProps, ChannelProps, ColorFormat, SwatchProps } from '@zag-js/color-picker';
|
2
2
|
import type { CreateColorPickerReturn } from './create-color-picker.svelte.js';
|
3
|
-
export declare const getColorPickerContext: () => CreateColorPickerReturn, setColorPickerContext: (context: CreateColorPickerReturn | (() => CreateColorPickerReturn)) =>
|
4
|
-
export declare const getColorPickerAreaPropsContext: () => AreaProps, setColorPickerAreaPropsContext: (context: AreaProps | (() => AreaProps)) =>
|
5
|
-
export declare const getColorPickerSwatchPropsContext: () => SwatchProps, setColorPickerSwatchPropsContext: (context: SwatchProps | (() => SwatchProps)) =>
|
3
|
+
export declare const getColorPickerContext: () => CreateColorPickerReturn, setColorPickerContext: (context: CreateColorPickerReturn | (() => CreateColorPickerReturn)) => void;
|
4
|
+
export declare const getColorPickerAreaPropsContext: () => AreaProps, setColorPickerAreaPropsContext: (context: AreaProps | (() => AreaProps)) => void;
|
5
|
+
export declare const getColorPickerSwatchPropsContext: () => SwatchProps, setColorPickerSwatchPropsContext: (context: SwatchProps | (() => SwatchProps)) => void;
|
6
6
|
export declare const getColorPickerFormatPropsContext: () => {
|
7
7
|
format: ColorFormat;
|
8
|
-
}, setColorPickerFormatPropsContext: (context: {
|
8
|
+
} | undefined, setColorPickerFormatPropsContext: (context: {
|
9
9
|
format: ColorFormat;
|
10
10
|
} | (() => {
|
11
11
|
format: ColorFormat;
|
12
|
-
})) =>
|
13
|
-
|
14
|
-
};
|
15
|
-
export declare const getColorPickerChannelPropsContext: () => ChannelProps, setColorPickerChannelPropsContext: (context: ChannelProps | (() => ChannelProps)) => ChannelProps;
|
12
|
+
})) => void;
|
13
|
+
export declare const getColorPickerChannelPropsContext: () => ChannelProps, setColorPickerChannelPropsContext: (context: ChannelProps | (() => ChannelProps)) => void;
|
@@ -28,9 +28,9 @@
|
|
28
28
|
|
29
29
|
{#if presence.mounted}
|
30
30
|
{#if asChild}
|
31
|
-
{@render asChild(presence.
|
31
|
+
{@render asChild(presence.setReference, mergedProps)}
|
32
32
|
{:else}
|
33
|
-
<div bind:this={ref} use:presence.
|
33
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
34
34
|
{@render children?.()}
|
35
35
|
</div>
|
36
36
|
{/if}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ItemGroupProps, ItemProps } from '@zag-js/combobox';
|
2
2
|
import type { CreateComboboxReturn } from './create-combobox.svelte.js';
|
3
|
-
export declare const getComboboxContext: () => CreateComboboxReturn, setComboboxContext: (context: CreateComboboxReturn | (() => CreateComboboxReturn)) =>
|
4
|
-
export declare const getComboboxItemPropsContext: () => ItemProps, setComboboxItemPropsContext: (context: ItemProps | (() => ItemProps)) =>
|
5
|
-
export declare const getComboboxItemGroupPropsContext: () => ItemGroupProps, setComboboxItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) =>
|
3
|
+
export declare const getComboboxContext: () => CreateComboboxReturn, setComboboxContext: (context: CreateComboboxReturn | (() => CreateComboboxReturn)) => void;
|
4
|
+
export declare const getComboboxItemPropsContext: () => ItemProps, setComboboxItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
|
5
|
+
export declare const getComboboxItemGroupPropsContext: () => ItemGroupProps, setComboboxItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) => void;
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import type { GenericObject } from './types.js';
|
2
|
-
type GetContext<T extends GenericObject> = () => T;
|
3
|
-
type SetContext<T extends GenericObject> = (context: T | (() => T)) => T;
|
4
2
|
type HasContext = () => boolean;
|
5
|
-
|
6
|
-
|
3
|
+
type SetContext<T> = (context: T | (() => T)) => void;
|
4
|
+
type GetContext<T, Strict extends boolean> = () => [Strict] extends [true] ? T : T | undefined;
|
5
|
+
type CreateContextReturn<T, Strict extends boolean> = [
|
6
|
+
getContext: GetContext<T, Strict>,
|
7
7
|
setContext: SetContext<T>,
|
8
8
|
hasContext: HasContext
|
9
9
|
];
|
10
|
+
export declare function createContext<T extends GenericObject>(key: string): CreateContextReturn<T, true>;
|
11
|
+
export declare function createContext<T extends GenericObject>(key: string, strict: true): CreateContextReturn<T, true>;
|
12
|
+
export declare function createContext<T extends GenericObject>(key: string, strict: false): CreateContextReturn<T, false>;
|
10
13
|
export {};
|
@@ -1,20 +1,31 @@
|
|
1
1
|
import { reflect } from '@zag-js/svelte';
|
2
2
|
import { getContext, hasContext, setContext } from 'svelte';
|
3
|
-
export function createContext(
|
4
|
-
const
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
export function createContext(...args) {
|
4
|
+
const k = args[0];
|
5
|
+
const s = args[1] ?? true;
|
6
|
+
if (k.trim().length < 1) {
|
7
|
+
const e = new Error();
|
8
|
+
e.name = 'ContextError';
|
9
|
+
e.message = 'Context key cannot be empty';
|
10
|
+
throw e;
|
11
|
+
}
|
12
|
+
function has() {
|
13
|
+
return hasContext(k);
|
14
|
+
}
|
15
|
+
function set(v) {
|
16
|
+
setContext(k, isFn(v) ? reflect(v) : v);
|
17
|
+
}
|
18
|
+
function get() {
|
19
|
+
if (s && !has()) {
|
20
|
+
const e = new Error();
|
21
|
+
e.name = 'ContextError';
|
22
|
+
e.message = "No context found for '%s'".replace('%s', k);
|
23
|
+
throw e;
|
24
|
+
}
|
25
|
+
return getContext(k);
|
26
|
+
}
|
13
27
|
return [get, set, has];
|
14
28
|
}
|
15
|
-
function
|
16
|
-
|
17
|
-
e.name = 'ContextError';
|
18
|
-
e.message = "No context found for '%s'".replace('%s', k);
|
19
|
-
throw e;
|
29
|
+
function isFn(v) {
|
30
|
+
return typeof v === 'function';
|
20
31
|
}
|
@@ -32,9 +32,9 @@
|
|
32
32
|
|
33
33
|
{#if presence.mounted}
|
34
34
|
{#if asChild}
|
35
|
-
{@render asChild(presence.
|
35
|
+
{@render asChild(presence.setReference, mergedProps)}
|
36
36
|
{:else}
|
37
|
-
<div bind:this={ref} use:presence.
|
37
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
38
38
|
{@render children?.()}
|
39
39
|
</div>
|
40
40
|
{/if}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { DayTableCellProps, TableCellProps, TableProps, ViewProps } from '@zag-js/date-picker';
|
2
2
|
import type { CreateDatePickerReturn } from './create-date-picker.svelte.js';
|
3
|
-
export declare const getDatePickerContext: () => CreateDatePickerReturn, setDatePickerContext: (context: CreateDatePickerReturn | (() => CreateDatePickerReturn)) =>
|
4
|
-
export declare const getDatePickerViewPropsContext: () => ViewProps, setDatePickerViewPropsContext: (context: ViewProps | (() => ViewProps)) =>
|
5
|
-
export declare const getDatePickerTablePropsContext: () => TableProps, setDatePickerTablePropsContext: (context: TableProps | (() => TableProps)) =>
|
6
|
-
export declare const getDatePickerTableCellPropsContext: () => TableCellProps, setDatePickerTableCellPropsContext: (context: TableCellProps | (() => TableCellProps)) =>
|
7
|
-
export declare const getDatePickerDayTableCellPropsContext: () => DayTableCellProps, setDatePickerDayTableCellPropsContext: (context: DayTableCellProps | (() => DayTableCellProps)) =>
|
3
|
+
export declare const getDatePickerContext: () => CreateDatePickerReturn, setDatePickerContext: (context: CreateDatePickerReturn | (() => CreateDatePickerReturn)) => void;
|
4
|
+
export declare const getDatePickerViewPropsContext: () => ViewProps, setDatePickerViewPropsContext: (context: ViewProps | (() => ViewProps)) => void;
|
5
|
+
export declare const getDatePickerTablePropsContext: () => TableProps, setDatePickerTablePropsContext: (context: TableProps | (() => TableProps)) => void;
|
6
|
+
export declare const getDatePickerTableCellPropsContext: () => TableCellProps, setDatePickerTableCellPropsContext: (context: TableCellProps | (() => TableCellProps)) => void;
|
7
|
+
export declare const getDatePickerDayTableCellPropsContext: () => DayTableCellProps, setDatePickerDayTableCellPropsContext: (context: DayTableCellProps | (() => DayTableCellProps)) => void;
|
@@ -36,9 +36,9 @@
|
|
36
36
|
|
37
37
|
{#if presence.mounted}
|
38
38
|
{#if asChild}
|
39
|
-
{@render asChild(presence.
|
39
|
+
{@render asChild(presence.setReference, mergedProps)}
|
40
40
|
{:else}
|
41
|
-
<div bind:this={ref} use:presence.
|
41
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
42
42
|
{@render children?.()}
|
43
43
|
</div>
|
44
44
|
{/if}
|
@@ -28,9 +28,9 @@
|
|
28
28
|
|
29
29
|
{#if presence.mounted}
|
30
30
|
{#if asChild}
|
31
|
-
{@render asChild(presence.
|
31
|
+
{@render asChild(presence.setReference, mergedProps)}
|
32
32
|
{:else}
|
33
|
-
<div bind:this={ref} use:presence.
|
33
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
34
34
|
{@render children?.()}
|
35
35
|
</div>
|
36
36
|
{/if}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateDialogReturn } from './create-dialog.svelte.js';
|
2
|
-
export declare const getDialogContext: () => CreateDialogReturn, setDialogContext: (context: CreateDialogReturn | (() => CreateDialogReturn)) =>
|
2
|
+
export declare const getDialogContext: () => CreateDialogReturn, setDialogContext: (context: CreateDialogReturn | (() => CreateDialogReturn)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateEditableReturn } from './create-editable.svelte.js';
|
2
|
-
export declare const getEditableContext: () => CreateEditableReturn, setEditableContext: (context: CreateEditableReturn | (() => CreateEditableReturn)) =>
|
2
|
+
export declare const getEditableContext: () => CreateEditableReturn, setEditableContext: (context: CreateEditableReturn | (() => CreateEditableReturn)) => void;
|
@@ -3,4 +3,4 @@ export interface Environment {
|
|
3
3
|
getDocument: () => Document;
|
4
4
|
getWindow: () => Window & typeof globalThis;
|
5
5
|
}
|
6
|
-
export declare const getEnvironmentContext: () => Environment, setEnvironmentContext: (context: Environment | (() => Environment)) =>
|
6
|
+
export declare const getEnvironmentContext: () => Environment | undefined, setEnvironmentContext: (context: Environment | (() => Environment)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateFieldReturn } from './create-field.svelte.js';
|
2
|
-
export declare const getFieldContext: () => CreateFieldReturn, setFieldContext: (context: CreateFieldReturn | (() => CreateFieldReturn)) =>
|
2
|
+
export declare const getFieldContext: () => CreateFieldReturn | undefined, setFieldContext: (context: CreateFieldReturn | (() => CreateFieldReturn)) => void;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { ItemProps } from '@zag-js/file-upload';
|
2
2
|
import type { CreateFileUploadReturn } from './create-file-upload.svelte.js';
|
3
|
-
export declare const getFileUploadContext: () => CreateFileUploadReturn, setFileUploadContext: (context: CreateFileUploadReturn | (() => CreateFileUploadReturn)) =>
|
4
|
-
export declare const getFileUploadItemPropsContext: () => ItemProps, setFileUploadItemPropsContext: (context: ItemProps | (() => ItemProps)) =>
|
3
|
+
export declare const getFileUploadContext: () => CreateFileUploadReturn, setFileUploadContext: (context: CreateFileUploadReturn | (() => CreateFileUploadReturn)) => void;
|
4
|
+
export declare const getFileUploadItemPropsContext: () => ItemProps, setFileUploadItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
|
@@ -32,9 +32,9 @@
|
|
32
32
|
|
33
33
|
{#if presence.mounted}
|
34
34
|
{#if asChild}
|
35
|
-
{@render asChild(presence.
|
35
|
+
{@render asChild(presence.setReference, mergedProps)}
|
36
36
|
{:else}
|
37
|
-
<div bind:this={ref} use:presence.
|
37
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
38
38
|
{@render children?.()}
|
39
39
|
</div>
|
40
40
|
{/if}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateFloatingPanelReturn } from './create-floating-panel.svelte.js';
|
2
|
-
export declare const getFloatingPanelContext: () => CreateFloatingPanelReturn, setFloatingPanelContext: (context: CreateFloatingPanelReturn | (() => CreateFloatingPanelReturn)) =>
|
2
|
+
export declare const getFloatingPanelContext: () => CreateFloatingPanelReturn, setFloatingPanelContext: (context: CreateFloatingPanelReturn | (() => CreateFloatingPanelReturn)) => void;
|
@@ -28,9 +28,9 @@
|
|
28
28
|
|
29
29
|
{#if presence.mounted}
|
30
30
|
{#if asChild}
|
31
|
-
{@render asChild(presence.
|
31
|
+
{@render asChild(presence.setReference, mergedProps)}
|
32
32
|
{:else}
|
33
|
-
<div bind:this={ref} use:presence.
|
33
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
34
34
|
{@render children?.()}
|
35
35
|
</div>
|
36
36
|
{/if}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { CreateHoverCardReturn } from './create-hover-card.svelte.js';
|
2
|
-
export declare const getHoverCardContext: () => CreateHoverCardReturn, setHoverCardContext: (context: CreateHoverCardReturn | (() => CreateHoverCardReturn)) =>
|
2
|
+
export declare const getHoverCardContext: () => CreateHoverCardReturn, setHoverCardContext: (context: CreateHoverCardReturn | (() => CreateHoverCardReturn)) => void;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import type { Locale } from '@zag-js/i18n-utils';
|
2
|
-
export declare const getLocaleContext: () => Locale, setLocaleContext: (context: Locale | (() => Locale)) =>
|
2
|
+
export declare const getLocaleContext: () => Locale | undefined, setLocaleContext: (context: Locale | (() => Locale)) => void;
|
@@ -22,15 +22,15 @@
|
|
22
22
|
let presence = getPresenceContext();
|
23
23
|
|
24
24
|
let mergedProps = $derived(
|
25
|
-
mergeProps(menu
|
25
|
+
mergeProps(menu!.getContentProps(), presence.getPresenceProps(), props),
|
26
26
|
);
|
27
27
|
</script>
|
28
28
|
|
29
29
|
{#if presence.mounted}
|
30
30
|
{#if asChild}
|
31
|
-
{@render asChild(presence.
|
31
|
+
{@render asChild(presence.setReference, mergedProps)}
|
32
32
|
{:else}
|
33
|
-
<div bind:this={ref} use:presence.
|
33
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
34
34
|
{@render children?.()}
|
35
35
|
</div>
|
36
36
|
{/if}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { ItemGroupProps, OptionItemProps } from '@zag-js/menu';
|
2
2
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
3
3
|
import type { CreateMenuReturn } from './create-menu.svelte.js';
|
4
|
-
export declare const getMenuContext: () => CreateMenuReturn, setMenuContext: (context: CreateMenuReturn | (() => CreateMenuReturn)) =>
|
5
|
-
export declare const getMenuItemGroupPropsContext: () => ItemGroupProps, setMenuItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) =>
|
6
|
-
export declare const getMenuOptionItemPropsContext: () => OptionItemProps, setMenuOptionItemPropsContext: (context: OptionItemProps | (() => OptionItemProps)) =>
|
7
|
-
export declare const getMenuTriggerItemContext: () => HTMLButtonAttributes, setMenuTriggerItemContext: (context: HTMLButtonAttributes | (() => HTMLButtonAttributes)) =>
|
4
|
+
export declare const getMenuContext: () => CreateMenuReturn | undefined, setMenuContext: (context: CreateMenuReturn | (() => CreateMenuReturn)) => void;
|
5
|
+
export declare const getMenuItemGroupPropsContext: () => ItemGroupProps, setMenuItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) => void;
|
6
|
+
export declare const getMenuOptionItemPropsContext: () => OptionItemProps, setMenuOptionItemPropsContext: (context: OptionItemProps | (() => OptionItemProps)) => void;
|
7
|
+
export declare const getMenuTriggerItemContext: () => HTMLButtonAttributes, setMenuTriggerItemContext: (context: HTMLButtonAttributes | (() => HTMLButtonAttributes)) => void;
|