ui-ingredients 0.0.66 → 0.0.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. package/README.md +0 -2
  2. package/dist/accordion/accordion-item-content.svelte +2 -2
  3. package/dist/accordion/avatar-context.svelte.d.ts +2 -2
  4. package/dist/avatar/avatar-context.svelte.d.ts +1 -1
  5. package/dist/carousel/carousel-context.svelte.d.ts +1 -1
  6. package/dist/checkbox/checkbox-context.svelte.d.ts +1 -1
  7. package/dist/clipboard/clipboard-context.svelte.d.ts +1 -1
  8. package/dist/collapsible/collapsible-content.svelte +19 -8
  9. package/dist/collapsible/collapsible-content.svelte.d.ts +2 -1
  10. package/dist/collapsible/collapsible-context.svelte.d.ts +1 -1
  11. package/dist/collapsible/collapsible-root.svelte +23 -4
  12. package/dist/collapsible/collapsible-root.svelte.d.ts +2 -1
  13. package/dist/collapsible/collapsible-trigger.svelte +0 -1
  14. package/dist/color-picker/color-picker-channel-slider-value-text.svelte +4 -1
  15. package/dist/color-picker/color-picker-content.svelte +2 -2
  16. package/dist/color-picker/color-picker-context.svelte.d.ts +6 -8
  17. package/dist/combobox/combobox-content.svelte +2 -2
  18. package/dist/combobox/combobox-context.svelte.d.ts +3 -3
  19. package/dist/create-context.svelte.d.ts +7 -4
  20. package/dist/create-context.svelte.js +26 -15
  21. package/dist/date-picker/date-picker-content.svelte +2 -2
  22. package/dist/date-picker/date-picker-context.svelte.d.ts +5 -5
  23. package/dist/dialog/dialog-backdrop.svelte +2 -2
  24. package/dist/dialog/dialog-content.svelte +2 -2
  25. package/dist/dialog/dialog-context.svelte.d.ts +1 -1
  26. package/dist/editable/editable-context.svelte.d.ts +1 -1
  27. package/dist/environment-provider/enviroment-provider-context.svelte.d.ts +1 -1
  28. package/dist/field/field-context.svelte.d.ts +1 -1
  29. package/dist/field/field-error-text.svelte +3 -1
  30. package/dist/field/field-helper-text.svelte +3 -1
  31. package/dist/field/field-input.svelte +1 -1
  32. package/dist/field/field-label.svelte +1 -1
  33. package/dist/field/field-select.svelte +1 -1
  34. package/dist/field/field-textarea.svelte +3 -1
  35. package/dist/file-upload/file-upload-context.svelte.d.ts +2 -2
  36. package/dist/floating-panel/floating-panel-content.svelte +2 -2
  37. package/dist/floating-panel/floating-panel-context.svelte.d.ts +1 -1
  38. package/dist/hover-card/hover-card-content.svelte +2 -2
  39. package/dist/hover-card/hover-card-context.svelte.d.ts +1 -1
  40. package/dist/is-pojo.d.ts +2 -0
  41. package/dist/{is-object.js → is-pojo.js} +1 -1
  42. package/dist/locale-provider/local-provider-context.svelte.d.ts +1 -1
  43. package/dist/menu/menu-arrow-tip.svelte +1 -1
  44. package/dist/menu/menu-arrow.svelte +1 -1
  45. package/dist/menu/menu-content.svelte +3 -3
  46. package/dist/menu/menu-context-trigger.svelte +1 -1
  47. package/dist/menu/menu-context.svelte.d.ts +4 -4
  48. package/dist/menu/menu-indicator.svelte +1 -1
  49. package/dist/menu/menu-item-group-label.svelte +1 -1
  50. package/dist/menu/menu-item-group.svelte +1 -1
  51. package/dist/menu/menu-item.svelte +2 -2
  52. package/dist/menu/menu-option-item-indicator.svelte +1 -1
  53. package/dist/menu/menu-option-item-text.svelte +1 -1
  54. package/dist/menu/menu-option-item.svelte +2 -2
  55. package/dist/menu/menu-positioner.svelte +1 -1
  56. package/dist/menu/menu-separator.svelte +1 -1
  57. package/dist/menu/menu-trigger.svelte +1 -1
  58. package/dist/merge-props.js +2 -2
  59. package/dist/number-input/number-input-context.svelte.d.ts +1 -1
  60. package/dist/pagination/pagination-context.svelte.d.ts +1 -1
  61. package/dist/pin-input/pin-input-context.svelte.d.ts +1 -1
  62. package/dist/popover/popover-content.svelte +2 -2
  63. package/dist/popover/popover-context.svelte.d.ts +1 -1
  64. package/dist/presence/create-presence.svelte.d.ts +1 -1
  65. package/dist/presence/create-presence.svelte.js +2 -2
  66. package/dist/presence/presence-context.svelte.d.ts +2 -2
  67. package/dist/presence/presence.svelte +2 -2
  68. package/dist/progress/progress-context.svelte.d.ts +1 -1
  69. package/dist/qr-code/qr-code-context.svelte.d.ts +1 -1
  70. package/dist/radio-group/radio-group-context.svelte.d.ts +2 -2
  71. package/dist/rating-group/rating-group-context.svelte.d.ts +1 -1
  72. package/dist/segment-group/segment-group-context.svelte.d.ts +2 -2
  73. package/dist/select/select-content.svelte +2 -2
  74. package/dist/select/select-context.svelte.d.ts +3 -3
  75. package/dist/signature-pad/signature-pad-context.svelte.d.ts +1 -1
  76. package/dist/slider/slider-context.svelte.d.ts +2 -2
  77. package/dist/splitter/splitter-context.svelte.d.ts +1 -1
  78. package/dist/steps/steps-context.svelte.d.ts +2 -2
  79. package/dist/switch/switch-context.svelte.d.ts +1 -1
  80. package/dist/tabs/tabs-context.svelte.d.ts +1 -1
  81. package/dist/tags-input/tags-input-context.svelte.d.ts +2 -2
  82. package/dist/time-picker/time-picker-content.svelte +2 -2
  83. package/dist/time-picker/time-picker-context.svelte.d.ts +1 -1
  84. package/dist/timer/timer-context.svelte.d.ts +2 -2
  85. package/dist/toast/toast-context.svelte.d.ts +1 -1
  86. package/dist/toggle-group/toggle-group-context.svelte.d.ts +1 -1
  87. package/dist/tooltip/tooltip-content.svelte +2 -2
  88. package/dist/tooltip/tooltip-context.svelte.d.ts +1 -1
  89. package/dist/tour/tour-content.svelte +1 -1
  90. package/dist/tour/tour-context.svelte.d.ts +1 -1
  91. package/dist/tour/tour-overlay.svelte +1 -1
  92. package/dist/tree-view/tree-view-context.svelte.d.ts +3 -3
  93. package/package.json +1 -1
  94. 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.ref, mergedProps)}
49
+ {@render asChild(presence.setReference, mergedProps)}
50
50
  {:else}
51
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => CreateAccordionReturn;
4
- export declare const getAccordionItemPropsContext: () => ItemProps, setAccordionItemPropsContext: (context: ItemProps | (() => 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)) => 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)) => 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)) => 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)) => 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(mergeProps(collapsible.getContentProps(), props));
24
+ let mergedProps = $derived(
25
+ mergeProps(
26
+ collapsible.getContentProps(),
27
+ presence.getPresenceProps(),
28
+ props,
29
+ ),
30
+ );
22
31
  </script>
23
32
 
24
- {#if asChild}
25
- {@render asChild(mergedProps)}
26
- {:else}
27
- <div bind:this={ref} {...mergedProps}>
28
- {@render children?.()}
29
- </div>
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
- export interface CollapsibleContentProps extends HtmlIngredientProps<'div', HTMLDivElement> {
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)) => 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
- HtmlIngredientProps<'div', HTMLDivElement, CreateCollapsibleReturn>,
11
- CreateCollapsibleProps
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
- ])(props),
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> & {
@@ -17,7 +17,6 @@
17
17
  }: CollapsibleTriggerProps = $props();
18
18
 
19
19
  let collapsible = getCollapsibleContext();
20
-
21
20
  let mergedProps = $derived(mergeProps(collapsible.getTriggerProps(), props));
22
21
  </script>
23
22
 
@@ -36,7 +36,10 @@
36
36
  {#if children}
37
37
  {@render children()}
38
38
  {:else}
39
- {colorPicker.getChannelValueText(channelProps.channel, locale.locale)}
39
+ {colorPicker.getChannelValueText(
40
+ channelProps.channel,
41
+ locale?.locale ?? 'en-US',
42
+ )}
40
43
  {/if}
41
44
  </div>
42
45
  {/if}
@@ -32,9 +32,9 @@
32
32
 
33
33
  {#if presence.mounted}
34
34
  {#if asChild}
35
- {@render asChild(presence.ref, mergedProps)}
35
+ {@render asChild(presence.setReference, mergedProps)}
36
36
  {:else}
37
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => CreateColorPickerReturn;
4
- export declare const getColorPickerAreaPropsContext: () => AreaProps, setColorPickerAreaPropsContext: (context: AreaProps | (() => AreaProps)) => AreaProps;
5
- export declare const getColorPickerSwatchPropsContext: () => SwatchProps, setColorPickerSwatchPropsContext: (context: SwatchProps | (() => 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
- format: ColorFormat;
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.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => CreateComboboxReturn;
4
- export declare const getComboboxItemPropsContext: () => ItemProps, setComboboxItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
5
- export declare const getComboboxItemGroupPropsContext: () => ItemGroupProps, setComboboxItemGroupPropsContext: (context: ItemGroupProps | (() => 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
- export declare function createContext<T extends GenericObject>(key: string, strict?: boolean): [
6
- getContext: GetContext<T>,
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(key, strict = true) {
4
- const has = () => hasContext(key);
5
- const set = (context) => {
6
- return setContext(key, typeof context === 'function' ? reflect(context) : context);
7
- };
8
- const get = () => {
9
- if (strict && !has())
10
- throw err(key);
11
- return getContext(key);
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 err(k) {
16
- const e = new Error();
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.ref, mergedProps)}
35
+ {@render asChild(presence.setReference, mergedProps)}
36
36
  {:else}
37
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => CreateDatePickerReturn;
4
- export declare const getDatePickerViewPropsContext: () => ViewProps, setDatePickerViewPropsContext: (context: ViewProps | (() => ViewProps)) => ViewProps;
5
- export declare const getDatePickerTablePropsContext: () => TableProps, setDatePickerTablePropsContext: (context: TableProps | (() => TableProps)) => TableProps;
6
- export declare const getDatePickerTableCellPropsContext: () => TableCellProps, setDatePickerTableCellPropsContext: (context: TableCellProps | (() => TableCellProps)) => TableCellProps;
7
- export declare const getDatePickerDayTableCellPropsContext: () => DayTableCellProps, setDatePickerDayTableCellPropsContext: (context: DayTableCellProps | (() => 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.ref, mergedProps)}
39
+ {@render asChild(presence.setReference, mergedProps)}
40
40
  {:else}
41
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => 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)) => 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)) => 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)) => CreateFieldReturn;
2
+ export declare const getFieldContext: () => CreateFieldReturn | undefined, setFieldContext: (context: CreateFieldReturn | (() => CreateFieldReturn)) => void;
@@ -18,7 +18,9 @@
18
18
 
19
19
  let field = getFieldContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(field.getErrorTextProps(), props));
21
+ let mergedProps = $derived(
22
+ mergeProps(field?.getErrorTextProps() ?? {}, props),
23
+ );
22
24
  </script>
23
25
 
24
26
  {#if asChild}
@@ -18,7 +18,9 @@
18
18
 
19
19
  let field = getFieldContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(field.getHelperTextProps(), props));
21
+ let mergedProps = $derived(
22
+ mergeProps(field?.getHelperTextProps() ?? {}, props),
23
+ );
22
24
  </script>
23
25
 
24
26
  {#if asChild}
@@ -13,7 +13,7 @@
13
13
 
14
14
  let field = getFieldContext();
15
15
 
16
- let mergedProps = $derived(mergeProps(field.getInputProps(), props));
16
+ let mergedProps = $derived(mergeProps(field?.getInputProps() ?? {}, props));
17
17
  </script>
18
18
 
19
19
  {#if asChild}
@@ -18,7 +18,7 @@
18
18
 
19
19
  let field = getFieldContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(field.getLabelProps(), props));
21
+ let mergedProps = $derived(mergeProps(field?.getLabelProps() ?? {}, props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -18,7 +18,7 @@
18
18
 
19
19
  let field = getFieldContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(field.getSelectProps(), props));
21
+ let mergedProps = $derived(mergeProps(field?.getSelectProps() ?? {}, props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -13,7 +13,9 @@
13
13
 
14
14
  let field = getFieldContext();
15
15
 
16
- let mergedProps = $derived(mergeProps(field.getTextareaProps(), props));
16
+ let mergedProps = $derived(
17
+ mergeProps(field?.getTextareaProps() ?? {}, props),
18
+ );
17
19
  </script>
18
20
 
19
21
  {#if asChild}
@@ -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)) => CreateFileUploadReturn;
4
- export declare const getFileUploadItemPropsContext: () => ItemProps, setFileUploadItemPropsContext: (context: ItemProps | (() => 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.ref, mergedProps)}
35
+ {@render asChild(presence.setReference, mergedProps)}
36
36
  {:else}
37
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => 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.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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)) => CreateHoverCardReturn;
2
+ export declare const getHoverCardContext: () => CreateHoverCardReturn, setHoverCardContext: (context: CreateHoverCardReturn | (() => CreateHoverCardReturn)) => void;
@@ -0,0 +1,2 @@
1
+ import type { GenericObject } from './types.js';
2
+ export declare function isPojo<T extends GenericObject>(value: unknown): value is T;
@@ -1,5 +1,5 @@
1
1
  /* Credits: https://github.com/lodash/lodash/blob/main/src/isPlainObject.ts */
2
- export function isObject(value) {
2
+ export function isPojo(value) {
3
3
  if (value === null) {
4
4
  return false;
5
5
  }
@@ -1,2 +1,2 @@
1
1
  import type { Locale } from '@zag-js/i18n-utils';
2
- export declare const getLocaleContext: () => Locale, setLocaleContext: (context: Locale | (() => Locale)) => Locale;
2
+ export declare const getLocaleContext: () => Locale | undefined, setLocaleContext: (context: Locale | (() => Locale)) => void;
@@ -18,7 +18,7 @@
18
18
 
19
19
  let menu = getMenuContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(menu.getArrowTipProps(), props));
21
+ let mergedProps = $derived(mergeProps(menu!.getArrowTipProps(), props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -18,7 +18,7 @@
18
18
 
19
19
  let menu = getMenuContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(menu.getArrowProps(), props));
21
+ let mergedProps = $derived(mergeProps(menu!.getArrowProps(), props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -22,15 +22,15 @@
22
22
  let presence = getPresenceContext();
23
23
 
24
24
  let mergedProps = $derived(
25
- mergeProps(menu.getContentProps(), presence.getPresenceProps(), props),
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.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
33
+ <div bind:this={ref} use:presence.setReference {...mergedProps}>
34
34
  {@render children?.()}
35
35
  </div>
36
36
  {/if}
@@ -18,7 +18,7 @@
18
18
 
19
19
  let menu = getMenuContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(menu.getContextTriggerProps(), props));
21
+ let mergedProps = $derived(mergeProps(menu!.getContextTriggerProps(), props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -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)) => CreateMenuReturn;
5
- export declare const getMenuItemGroupPropsContext: () => ItemGroupProps, setMenuItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) => ItemGroupProps;
6
- export declare const getMenuOptionItemPropsContext: () => OptionItemProps, setMenuOptionItemPropsContext: (context: OptionItemProps | (() => OptionItemProps)) => OptionItemProps;
7
- export declare const getMenuTriggerItemContext: () => HTMLButtonAttributes, setMenuTriggerItemContext: (context: HTMLButtonAttributes | (() => 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;
@@ -18,7 +18,7 @@
18
18
 
19
19
  let menu = getMenuContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(menu.getIndicatorProps(), props));
21
+ let mergedProps = $derived(mergeProps(menu!.getIndicatorProps(), props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -25,7 +25,7 @@
25
25
 
26
26
  let mergedProps = $derived(
27
27
  mergeProps(
28
- menu.getItemGroupLabelProps({
28
+ menu!.getItemGroupLabelProps({
29
29
  htmlFor: itemGroupProps.id,
30
30
  }),
31
31
  props,
@@ -30,7 +30,7 @@
30
30
  });
31
31
 
32
32
  let mergedProps = $derived(
33
- mergeProps(menu.getItemGroupProps(itemGroupProps), props),
33
+ mergeProps(menu!.getItemGroupProps(itemGroupProps), props),
34
34
  );
35
35
 
36
36
  setMenuItemGroupPropsContext(() => itemGroupProps);
@@ -32,9 +32,9 @@
32
32
  ])(props),
33
33
  );
34
34
 
35
- let itemState = $derived(menu.getItemState(itemProps));
35
+ let itemState = $derived(menu!.getItemState(itemProps));
36
36
  let mergedProps = $derived(
37
- mergeProps(menu.getItemProps(itemProps), localProps),
37
+ mergeProps(menu!.getItemProps(itemProps), localProps),
38
38
  );
39
39
  </script>
40
40
 
@@ -24,7 +24,7 @@
24
24
  let itemProps = getMenuOptionItemPropsContext();
25
25
 
26
26
  let mergedProps = $derived(
27
- mergeProps(menu.getItemIndicatorProps(itemProps), props),
27
+ mergeProps(menu!.getItemIndicatorProps(itemProps), props),
28
28
  );
29
29
  </script>
30
30
 
@@ -24,7 +24,7 @@
24
24
  let itemProps = getMenuOptionItemPropsContext();
25
25
 
26
26
  let mergedProps = $derived(
27
- mergeProps(menu.getItemTextProps(itemProps), props),
27
+ mergeProps(menu!.getItemTextProps(itemProps), props),
28
28
  );
29
29
  </script>
30
30
 
@@ -38,10 +38,10 @@
38
38
  ])(props),
39
39
  );
40
40
 
41
- let itemState = $derived(menu.getOptionItemState(itemProps));
41
+ let itemState = $derived(menu!.getOptionItemState(itemProps));
42
42
 
43
43
  let mergedProps = $derived(
44
- mergeProps(menu.getOptionItemProps(itemProps), localProps),
44
+ mergeProps(menu!.getOptionItemProps(itemProps), localProps),
45
45
  );
46
46
 
47
47
  setMenuOptionItemPropsContext(() => itemProps);
@@ -21,7 +21,7 @@
21
21
  let presence = getPresenceContext();
22
22
 
23
23
  let mergedProps = $derived(
24
- mergeProps(menu.getPositionerProps(), presence.getPresenceProps(), props),
24
+ mergeProps(menu!.getPositionerProps(), presence.getPresenceProps(), props),
25
25
  );
26
26
  </script>
27
27
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  let menu = getMenuContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(menu.getSeparatorProps(), props));
21
+ let mergedProps = $derived(mergeProps(menu!.getSeparatorProps(), props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -18,7 +18,7 @@
18
18
 
19
19
  let menu = getMenuContext();
20
20
 
21
- let mergedProps = $derived(mergeProps(menu.getTriggerProps(), props));
21
+ let mergedProps = $derived(mergeProps(menu!.getTriggerProps(), props));
22
22
  </script>
23
23
 
24
24
  {#if asChild}
@@ -1,9 +1,9 @@
1
1
  import { mergeProps as fn } from '@zag-js/svelte';
2
- import { isObject } from './is-object.js';
2
+ import { isPojo } from './is-pojo.js';
3
3
  export function mergeProps(...args) {
4
4
  const r = fn(...args);
5
5
  const i = 'style';
6
- if (r[i] && isObject(r[i])) {
6
+ if (r[i] && isPojo(r[i])) {
7
7
  let s = '';
8
8
  for (const k in r[i]) {
9
9
  const v = r[i][k];
@@ -1,2 +1,2 @@
1
1
  import type { CreateNumberInputReturn } from './create-number-input.svelte.js';
2
- export declare const getNumberInputContext: () => CreateNumberInputReturn, setNumberInputContext: (context: CreateNumberInputReturn | (() => CreateNumberInputReturn)) => CreateNumberInputReturn;
2
+ export declare const getNumberInputContext: () => CreateNumberInputReturn, setNumberInputContext: (context: CreateNumberInputReturn | (() => CreateNumberInputReturn)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreatePaginationReturn } from './create-pagination.svelte.js';
2
- export declare const getPaginationContext: () => CreatePaginationReturn, setPaginationContext: (context: CreatePaginationReturn | (() => CreatePaginationReturn)) => CreatePaginationReturn;
2
+ export declare const getPaginationContext: () => CreatePaginationReturn, setPaginationContext: (context: CreatePaginationReturn | (() => CreatePaginationReturn)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreatePinInputReturn } from './create-pin-input.svelte.js';
2
- export declare const getPinInputContext: () => CreatePinInputReturn, setPinInputContext: (context: CreatePinInputReturn | (() => CreatePinInputReturn)) => CreatePinInputReturn;
2
+ export declare const getPinInputContext: () => CreatePinInputReturn, setPinInputContext: (context: CreatePinInputReturn | (() => CreatePinInputReturn)) => void;
@@ -28,9 +28,9 @@
28
28
 
29
29
  {#if presence.mounted}
30
30
  {#if asChild}
31
- {@render asChild(presence.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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 { CreatePopoverReturn } from './create-popover.svelte.js';
2
- export declare const getPopoverContext: () => CreatePopoverReturn, setPopoverContext: (context: CreatePopoverReturn | (() => CreatePopoverReturn)) => CreatePopoverReturn;
2
+ export declare const getPopoverContext: () => CreatePopoverReturn, setPopoverContext: (context: CreatePopoverReturn | (() => CreatePopoverReturn)) => void;
@@ -10,7 +10,7 @@ export interface CreatePresenceProps extends PresenceStrategyProps {
10
10
  present: boolean;
11
11
  }
12
12
  export interface CreatePresenceReturn {
13
- ref: Action;
13
+ setReference: Action;
14
14
  getPresenceProps(): HTMLAttributes<HTMLElement>;
15
15
  mounted: boolean;
16
16
  }
@@ -34,11 +34,11 @@ export function createPresence(props) {
34
34
  return true;
35
35
  return false;
36
36
  });
37
- const ref = (node) => {
37
+ const setReference = (node) => {
38
38
  api.setNode(node);
39
39
  };
40
40
  return {
41
- ref,
41
+ setReference,
42
42
  getPresenceProps,
43
43
  get mounted() {
44
44
  return !unmounted;
@@ -1,3 +1,3 @@
1
1
  import type { CreatePresenceReturn, PresenceStrategyProps } from './create-presence.svelte.js';
2
- export declare const getPresenceContext: () => CreatePresenceReturn, setPresenceContext: (context: CreatePresenceReturn | (() => CreatePresenceReturn)) => CreatePresenceReturn;
3
- export declare const getPresenceStrategyPropsContext: () => PresenceStrategyProps, setPresenceStrategyPropsContext: (context: PresenceStrategyProps | (() => PresenceStrategyProps)) => PresenceStrategyProps;
2
+ export declare const getPresenceContext: () => CreatePresenceReturn, setPresenceContext: (context: CreatePresenceReturn | (() => CreatePresenceReturn)) => void;
3
+ export declare const getPresenceStrategyPropsContext: () => PresenceStrategyProps, setPresenceStrategyPropsContext: (context: PresenceStrategyProps | (() => PresenceStrategyProps)) => void;
@@ -35,9 +35,9 @@
35
35
 
36
36
  {#if presence.mounted}
37
37
  {#if asChild}
38
- {@render asChild(presence.ref, mergedProps)}
38
+ {@render asChild(presence.setReference, mergedProps)}
39
39
  {:else}
40
- <div use:presence.ref {...mergedProps}>
40
+ <div use:presence.setReference {...mergedProps}>
41
41
  {@render children?.()}
42
42
  </div>
43
43
  {/if}
@@ -1,2 +1,2 @@
1
1
  import type { CreateProgressReturn } from './create-progress.svelte.js';
2
- export declare const getProgressContext: () => CreateProgressReturn, setProgressContext: (context: CreateProgressReturn | (() => CreateProgressReturn)) => CreateProgressReturn;
2
+ export declare const getProgressContext: () => CreateProgressReturn, setProgressContext: (context: CreateProgressReturn | (() => CreateProgressReturn)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateQrCodeReturn } from './create-qr-code.svelte.js';
2
- export declare const getQrCodeContext: () => CreateQrCodeReturn, setQrCodeContext: (context: CreateQrCodeReturn | (() => CreateQrCodeReturn)) => CreateQrCodeReturn;
2
+ export declare const getQrCodeContext: () => CreateQrCodeReturn, setQrCodeContext: (context: CreateQrCodeReturn | (() => CreateQrCodeReturn)) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ItemProps } from '@zag-js/radio-group';
2
2
  import type { CreateRadioGroupReturn } from './create-radio-group.svelte.js';
3
- export declare const getRadioGroupContext: () => CreateRadioGroupReturn, setRadioGroupContext: (context: CreateRadioGroupReturn | (() => CreateRadioGroupReturn)) => CreateRadioGroupReturn;
4
- export declare const getRadioGroupItemPropsContext: () => ItemProps, setRadioGroupItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
3
+ export declare const getRadioGroupContext: () => CreateRadioGroupReturn, setRadioGroupContext: (context: CreateRadioGroupReturn | (() => CreateRadioGroupReturn)) => void;
4
+ export declare const getRadioGroupItemPropsContext: () => ItemProps, setRadioGroupItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateRatingGroupReturn } from './create-rating-group.svelte.js';
2
- export declare const getRatingGroupContext: () => CreateRatingGroupReturn, setRatingGroupContext: (context: CreateRatingGroupReturn | (() => CreateRatingGroupReturn)) => CreateRatingGroupReturn;
2
+ export declare const getRatingGroupContext: () => CreateRatingGroupReturn, setRatingGroupContext: (context: CreateRatingGroupReturn | (() => CreateRatingGroupReturn)) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ItemProps } from '@zag-js/radio-group';
2
2
  import type { CreateSegmentGroupReturn } from './create-segment-group.svelte.js';
3
- export declare const getSegmentGroupContext: () => CreateSegmentGroupReturn, setSegmentGroupContext: (context: CreateSegmentGroupReturn | (() => CreateSegmentGroupReturn)) => CreateSegmentGroupReturn;
4
- export declare const getSegmentGroupItemPropsContext: () => ItemProps, setSegmentGroupItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
3
+ export declare const getSegmentGroupContext: () => CreateSegmentGroupReturn, setSegmentGroupContext: (context: CreateSegmentGroupReturn | (() => CreateSegmentGroupReturn)) => void;
4
+ export declare const getSegmentGroupItemPropsContext: () => ItemProps, setSegmentGroupItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
@@ -28,9 +28,9 @@
28
28
 
29
29
  {#if presence.mounted}
30
30
  {#if asChild}
31
- {@render asChild(presence.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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/select';
2
2
  import type { CreateSelectReturn } from './create-select.svelte.js';
3
- export declare const getSelectContext: () => CreateSelectReturn, setSelectContext: (context: CreateSelectReturn | (() => CreateSelectReturn)) => CreateSelectReturn;
4
- export declare const getSelectItemPropsContext: () => ItemProps<any>, setSelectItemPropsContext: (context: ItemProps<any> | (() => ItemProps<any>)) => ItemProps<any>;
5
- export declare const getSelectItemGroupPropsContext: () => ItemGroupProps, setSelectItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) => ItemGroupProps;
3
+ export declare const getSelectContext: () => CreateSelectReturn, setSelectContext: (context: CreateSelectReturn | (() => CreateSelectReturn)) => void;
4
+ export declare const getSelectItemPropsContext: () => ItemProps<any>, setSelectItemPropsContext: (context: ItemProps<any> | (() => ItemProps<any>)) => void;
5
+ export declare const getSelectItemGroupPropsContext: () => ItemGroupProps, setSelectItemGroupPropsContext: (context: ItemGroupProps | (() => ItemGroupProps)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateSignaturePadReturn } from './create-signature-pad.svelte.js';
2
- export declare const getSignaturePadContext: () => CreateSignaturePadReturn, setSignaturePadContext: (context: CreateSignaturePadReturn | (() => CreateSignaturePadReturn)) => CreateSignaturePadReturn;
2
+ export declare const getSignaturePadContext: () => CreateSignaturePadReturn, setSignaturePadContext: (context: CreateSignaturePadReturn | (() => CreateSignaturePadReturn)) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ThumbProps } from '@zag-js/slider';
2
2
  import type { CreateSliderReturn } from './create-slider.svelte.js';
3
- export declare const getSliderContext: () => CreateSliderReturn, setSliderContext: (context: CreateSliderReturn | (() => CreateSliderReturn)) => CreateSliderReturn;
4
- export declare const getSliderThumbPropsContext: () => ThumbProps, setSliderThumbPropsContext: (context: ThumbProps | (() => ThumbProps)) => ThumbProps;
3
+ export declare const getSliderContext: () => CreateSliderReturn, setSliderContext: (context: CreateSliderReturn | (() => CreateSliderReturn)) => void;
4
+ export declare const getSliderThumbPropsContext: () => ThumbProps, setSliderThumbPropsContext: (context: ThumbProps | (() => ThumbProps)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateSplitterReturn } from './create-splitter.svelte.js';
2
- export declare const getSplitterContext: () => CreateSplitterReturn, setSplitterContext: (context: CreateSplitterReturn | (() => CreateSplitterReturn)) => CreateSplitterReturn;
2
+ export declare const getSplitterContext: () => CreateSplitterReturn, setSplitterContext: (context: CreateSplitterReturn | (() => CreateSplitterReturn)) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ItemProps } from '@zag-js/steps';
2
2
  import type { CreateStepsReturn } from './create-steps.svelte.js';
3
- export declare const getStepsContext: () => CreateStepsReturn, setStepsContext: (context: CreateStepsReturn | (() => CreateStepsReturn)) => CreateStepsReturn;
4
- export declare const getStepsItemPropsContext: () => ItemProps, setStepsItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
3
+ export declare const getStepsContext: () => CreateStepsReturn, setStepsContext: (context: CreateStepsReturn | (() => CreateStepsReturn)) => void;
4
+ export declare const getStepsItemPropsContext: () => ItemProps, setStepsItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateSwitchReturn } from './create-switch.svelte.js';
2
- export declare const getSwitchContext: () => CreateSwitchReturn, setSwitchContext: (context: CreateSwitchReturn | (() => CreateSwitchReturn)) => CreateSwitchReturn;
2
+ export declare const getSwitchContext: () => CreateSwitchReturn, setSwitchContext: (context: CreateSwitchReturn | (() => CreateSwitchReturn)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateTabsReturn } from './create-tabs.svelte.js';
2
- export declare const getTabsContext: () => CreateTabsReturn, setTabsContext: (context: CreateTabsReturn | (() => CreateTabsReturn)) => CreateTabsReturn;
2
+ export declare const getTabsContext: () => CreateTabsReturn, setTabsContext: (context: CreateTabsReturn | (() => CreateTabsReturn)) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ItemProps } from '@zag-js/tags-input';
2
2
  import type { CreateTagsInputReturn } from './create-tags-input.svelte.js';
3
- export declare const getTagsInputContext: () => CreateTagsInputReturn, setTagsInputContext: (context: CreateTagsInputReturn | (() => CreateTagsInputReturn)) => CreateTagsInputReturn;
4
- export declare const getTagsInputItemPropsContext: () => ItemProps, setTagsInputItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
3
+ export declare const getTagsInputContext: () => CreateTagsInputReturn, setTagsInputContext: (context: CreateTagsInputReturn | (() => CreateTagsInputReturn)) => void;
4
+ export declare const getTagsInputItemPropsContext: () => ItemProps, setTagsInputItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
@@ -31,9 +31,9 @@
31
31
  </script>
32
32
 
33
33
  {#if asChild}
34
- {@render asChild(presence.ref, mergedProps)}
34
+ {@render asChild(presence.setReference, mergedProps)}
35
35
  {:else}
36
- <div bind:this={ref} use:presence.ref {...mergedProps}>
36
+ <div bind:this={ref} use:presence.setReference {...mergedProps}>
37
37
  {@render children?.()}
38
38
  </div>
39
39
  {/if}
@@ -1,2 +1,2 @@
1
1
  import type { CreateTimePickerReturn } from './create-time-picker.svelte.js';
2
- export declare const getTimePickerContext: () => CreateTimePickerReturn, setTimePickerContext: (context: CreateTimePickerReturn | (() => CreateTimePickerReturn)) => CreateTimePickerReturn;
2
+ export declare const getTimePickerContext: () => CreateTimePickerReturn, setTimePickerContext: (context: CreateTimePickerReturn | (() => CreateTimePickerReturn)) => void;
@@ -1,4 +1,4 @@
1
1
  import type { ItemProps } from '@zag-js/timer';
2
2
  import type { CreateTimerReturn } from './create-timer.svelte.js';
3
- export declare const getTimerContext: () => CreateTimerReturn, setTimerContext: (context: CreateTimerReturn | (() => CreateTimerReturn)) => CreateTimerReturn;
4
- export declare const getTimerItemPropsContext: () => ItemProps, setTimerItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
3
+ export declare const getTimerContext: () => CreateTimerReturn, setTimerContext: (context: CreateTimerReturn | (() => CreateTimerReturn)) => void;
4
+ export declare const getTimerItemPropsContext: () => ItemProps, setTimerItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateToastReturn } from './create-toast.svelte.js';
2
- export declare const getToastContext: () => CreateToastReturn, setToastContext: (context: CreateToastReturn | (() => CreateToastReturn)) => CreateToastReturn;
2
+ export declare const getToastContext: () => CreateToastReturn, setToastContext: (context: CreateToastReturn | (() => CreateToastReturn)) => void;
@@ -1,2 +1,2 @@
1
1
  import type { CreateToggleGroupReturn } from './create-toggle-group.svelte.js';
2
- export declare const getToggleGroupContext: () => CreateToggleGroupReturn, setToggleGroupContext: (context: CreateToggleGroupReturn | (() => CreateToggleGroupReturn)) => CreateToggleGroupReturn;
2
+ export declare const getToggleGroupContext: () => CreateToggleGroupReturn, setToggleGroupContext: (context: CreateToggleGroupReturn | (() => CreateToggleGroupReturn)) => void;
@@ -28,9 +28,9 @@
28
28
 
29
29
  {#if presence.mounted}
30
30
  {#if asChild}
31
- {@render asChild(presence.ref, mergedProps)}
31
+ {@render asChild(presence.setReference, mergedProps)}
32
32
  {:else}
33
- <div bind:this={ref} use:presence.ref {...mergedProps}>
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 { CreateTooltipReturn } from './create-tooltip.svelte.js';
2
- export declare const getTooltipContext: () => CreateTooltipReturn, setTooltipContext: (context: CreateTooltipReturn | (() => CreateTooltipReturn)) => CreateTooltipReturn;
2
+ export declare const getTooltipContext: () => CreateTooltipReturn, setTooltipContext: (context: CreateTooltipReturn | (() => CreateTooltipReturn)) => void;
@@ -29,7 +29,7 @@
29
29
  {#if asChild}
30
30
  {@render asChild(mergedProps)}
31
31
  {:else}
32
- <div bind:this={ref} use:presence.ref {...mergedProps}>
32
+ <div bind:this={ref} use:presence.setReference {...mergedProps}>
33
33
  {@render children?.()}
34
34
  </div>
35
35
  {/if}
@@ -1,2 +1,2 @@
1
1
  import { type CreateTourReturn } from './create-tour.svelte.js';
2
- export declare const getTourContext: () => CreateTourReturn, setTourContext: (context: CreateTourReturn | (() => CreateTourReturn)) => CreateTourReturn;
2
+ export declare const getTourContext: () => CreateTourReturn, setTourContext: (context: CreateTourReturn | (() => CreateTourReturn)) => void;
@@ -37,7 +37,7 @@
37
37
  {#if asChild}
38
38
  {@render asChild(mergedProps)}
39
39
  {:else}
40
- <div bind:this={ref} use:presence.ref {...mergedProps}>
40
+ <div bind:this={ref} use:presence.setReference {...mergedProps}>
41
41
  {@render children?.()}
42
42
  </div>
43
43
  {/if}
@@ -1,5 +1,5 @@
1
1
  import type { BranchProps, ItemProps } from '@zag-js/tree-view';
2
2
  import type { CreateTreeViewReturn } from './create-tree-view.svelte.js';
3
- export declare const getTreeViewContext: () => CreateTreeViewReturn, setTreeViewContext: (context: CreateTreeViewReturn | (() => CreateTreeViewReturn)) => CreateTreeViewReturn;
4
- export declare const getTreeViewItemPropsContext: () => ItemProps, setTreeViewItemPropsContext: (context: ItemProps | (() => ItemProps)) => ItemProps;
5
- export declare const getTreeViewBranchPropsContext: () => BranchProps, setTreeViewBranchPropsContext: (context: BranchProps | (() => BranchProps)) => BranchProps;
3
+ export declare const getTreeViewContext: () => CreateTreeViewReturn, setTreeViewContext: (context: CreateTreeViewReturn | (() => CreateTreeViewReturn)) => void;
4
+ export declare const getTreeViewItemPropsContext: () => ItemProps, setTreeViewItemPropsContext: (context: ItemProps | (() => ItemProps)) => void;
5
+ export declare const getTreeViewBranchPropsContext: () => BranchProps, setTreeViewBranchPropsContext: (context: BranchProps | (() => BranchProps)) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.66",
4
+ "version": "0.0.67",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- import type { GenericObject } from './types.js';
2
- export declare function isObject<T extends GenericObject>(value: unknown): value is T;