ui-ingredients 0.20.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/accordion/accordion-item-content.svelte +55 -55
- package/dist/accordion/accordion-root.svelte +66 -66
- package/dist/alert-dialog/alert-dialog-backdrop.svelte +49 -49
- package/dist/alert-dialog/alert-dialog-root.svelte +48 -48
- package/dist/avatar/avatar-root.svelte +46 -46
- package/dist/carousel/carousel-root.svelte +56 -56
- package/dist/checkbox/checkbox-root.svelte +59 -59
- package/dist/clipboard/clipboard-root.svelte +52 -52
- package/dist/collapsible/collapsible-root.svelte +75 -75
- package/dist/color-picker/color-picker-root.svelte +87 -87
- package/dist/combobox/combobox-root.svelte +101 -101
- package/dist/combobox/combobox-trigger.svelte +41 -41
- package/dist/date-picker/date-picker-root.svelte +89 -89
- package/dist/dialog/dialog-backdrop.svelte +45 -45
- package/dist/dialog/dialog-root.svelte +48 -48
- package/dist/drawer/drawer-backdrop.svelte +45 -45
- package/dist/drawer/drawer-root.svelte +48 -48
- package/dist/editable/editable-root.svelte +74 -74
- package/dist/field/field-error-text.svelte +50 -50
- package/dist/field/field-root.svelte +63 -63
- package/dist/file-upload/file-upload-root.svelte +66 -66
- package/dist/floating-panel/floating-panel-root.svelte +47 -47
- package/dist/hover-card/hover-card-root.svelte +52 -52
- package/dist/menu/menu-root.svelte +74 -74
- package/dist/number-input/number-input-root.svelte +74 -74
- package/dist/pagination/pagination-root.svelte +57 -57
- package/dist/pin-input/pin-input-root.svelte +68 -68
- package/dist/popover/popover-root.svelte +60 -60
- package/dist/presence/presence.svelte +48 -48
- package/dist/progress/progress-root.svelte +54 -54
- package/dist/qr-code/qr-code-root.svelte +48 -48
- package/dist/radio-group/radio-group-root.svelte +56 -56
- package/dist/rating-group/rating-group-root.svelte +63 -63
- package/dist/segment-group/segment-group-root.svelte +58 -58
- package/dist/select/select-root.svelte +88 -88
- package/dist/signature-pad/signature-pad-root.svelte +59 -59
- package/dist/slider/slider-root.svelte +69 -69
- package/dist/splitter/splitter-root.svelte +53 -53
- package/dist/steps/steps-completed-content.svelte +51 -37
- package/dist/steps/steps-completed-content.svelte.d.ts +2 -1
- package/dist/steps/steps-content.svelte +55 -32
- package/dist/steps/steps-content.svelte.d.ts +2 -1
- package/dist/steps/steps-root.svelte +65 -55
- package/dist/steps/steps-root.svelte.d.ts +2 -1
- package/dist/switch/switch-root.svelte +59 -59
- package/dist/tabs/tabs-root.svelte +57 -57
- package/dist/tags-input/tags-input-root.svelte +74 -74
- package/dist/time-picker/time-picker-root.svelte +81 -81
- package/dist/timer/timer-root.svelte +55 -55
- package/dist/toast/create-toaster.svelte.d.ts +1 -1
- package/dist/toast/toast-actor.svelte +19 -19
- package/dist/toast/toast-actor.svelte.d.ts +3 -3
- package/dist/toast/toaster.svelte +19 -21
- package/dist/toast/toaster.svelte.d.ts +1 -1
- package/dist/toggle/toggle-root.svelte +50 -50
- package/dist/toggle-group/toggle-group-root.svelte +58 -58
- package/dist/tooltip/tooltip-root.svelte +44 -44
- package/dist/tour/tour-backdrop.svelte +44 -44
- package/dist/tour/tour-root.svelte +47 -47
- package/dist/tree-view/tree-view-branch-content.svelte +55 -55
- package/dist/tree-view/tree-view-root.svelte +68 -68
- package/package.json +5 -5
@@ -1,19 +1,19 @@
|
|
1
|
-
<script lang="ts">
|
2
|
-
import
|
3
|
-
import type {Snippet} from 'svelte';
|
4
|
-
import {createToast, type CreateToastReturn} from './create-toast.svelte.js';
|
5
|
-
import {setToastContext} from './toast-context.svelte.js';
|
6
|
-
|
7
|
-
interface Props {
|
8
|
-
actor:
|
9
|
-
children
|
10
|
-
}
|
11
|
-
|
12
|
-
let {actor, children}: Props = $props();
|
13
|
-
|
14
|
-
let toast = createToast(actor);
|
15
|
-
|
16
|
-
setToastContext(toast);
|
17
|
-
</script>
|
18
|
-
|
19
|
-
{@render children(toast)}
|
1
|
+
<script lang="ts">
|
2
|
+
import type {Service} from '@zag-js/toast';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import {createToast, type CreateToastReturn} from './create-toast.svelte.js';
|
5
|
+
import {setToastContext} from './toast-context.svelte.js';
|
6
|
+
|
7
|
+
interface Props {
|
8
|
+
actor: Service;
|
9
|
+
children?: Snippet<[toast: CreateToastReturn]>;
|
10
|
+
}
|
11
|
+
|
12
|
+
let {actor, children}: Props = $props();
|
13
|
+
|
14
|
+
let toast = createToast(actor);
|
15
|
+
|
16
|
+
setToastContext(toast);
|
17
|
+
</script>
|
18
|
+
|
19
|
+
{@render children?.(toast)}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { Service } from '@zag-js/toast';
|
2
2
|
import type { Snippet } from 'svelte';
|
3
3
|
import { type CreateToastReturn } from './create-toast.svelte.js';
|
4
4
|
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> {
|
@@ -15,8 +15,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
15
15
|
z_$$bindings?: Bindings;
|
16
16
|
}
|
17
17
|
declare const ToastActor: $$__sveltets_2_IsomorphicComponent<{
|
18
|
-
actor:
|
19
|
-
children
|
18
|
+
actor: Service;
|
19
|
+
children?: Snippet<[toast: CreateToastReturn]>;
|
20
20
|
}, {
|
21
21
|
[evt: string]: CustomEvent<any>;
|
22
22
|
}, {}, {}, "">;
|
@@ -4,7 +4,10 @@
|
|
4
4
|
import type {CreateToasterReturn} from './create-toaster.svelte.js';
|
5
5
|
|
6
6
|
export interface ToasterProps
|
7
|
-
extends
|
7
|
+
extends Omit<
|
8
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateToastReturn>,
|
9
|
+
'asChild'
|
10
|
+
> {
|
8
11
|
toaster: CreateToasterReturn;
|
9
12
|
}
|
10
13
|
</script>
|
@@ -13,8 +16,7 @@
|
|
13
16
|
import {getEnvironmentContext} from '../environment-provider/enviroment-provider-context.svelte.js';
|
14
17
|
import {getLocaleContext} from '../locale-provider/local-provider-context.svelte.js';
|
15
18
|
import {mergeProps} from '../merge-props.js';
|
16
|
-
import {
|
17
|
-
import {normalizeProps, useMachine} from '@zag-js/svelte';
|
19
|
+
import {normalizeProps, portal, useMachine} from '@zag-js/svelte';
|
18
20
|
import * as toast from '@zag-js/toast';
|
19
21
|
import type {HTMLAttributes} from 'svelte/elements';
|
20
22
|
import ToastActor from './toast-actor.svelte';
|
@@ -22,22 +24,24 @@
|
|
22
24
|
let {
|
23
25
|
ref = $bindable(null),
|
24
26
|
toaster,
|
25
|
-
children
|
27
|
+
children,
|
26
28
|
...props
|
27
29
|
}: ToasterProps = $props();
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
+
let locale = getLocaleContext();
|
32
|
+
let environment = getEnvironmentContext();
|
31
33
|
|
32
|
-
let [
|
34
|
+
let [state, send] = useMachine(toaster.machine, {
|
33
35
|
context: {
|
34
|
-
dir
|
36
|
+
get dir() {
|
37
|
+
return locale?.dir;
|
38
|
+
},
|
35
39
|
getRootNode: environment?.getRootNode,
|
36
40
|
},
|
37
41
|
});
|
38
42
|
|
39
|
-
let placement = $derived(
|
40
|
-
let api = $derived(toast.group.connect(
|
43
|
+
let placement = $derived(state.context.placement);
|
44
|
+
let api = $derived(toast.group.connect(state, send, normalizeProps));
|
41
45
|
let toasts = $derived(api.getToastsByPlacement(placement));
|
42
46
|
let mergedProps = $derived(
|
43
47
|
mergeProps<HTMLAttributes<HTMLDivElement>>(
|
@@ -47,14 +51,8 @@
|
|
47
51
|
);
|
48
52
|
</script>
|
49
53
|
|
50
|
-
<
|
51
|
-
|
52
|
-
{
|
53
|
-
|
54
|
-
|
55
|
-
{@render children_?.(ctx)}
|
56
|
-
{/snippet}
|
57
|
-
</ToastActor>
|
58
|
-
{/each}
|
59
|
-
</div>
|
60
|
-
</Portal>
|
54
|
+
<div bind:this={ref} use:portal {...mergedProps}>
|
55
|
+
{#each toasts as toast (toast.id)}
|
56
|
+
<ToastActor actor={toast} {children} />
|
57
|
+
{/each}
|
58
|
+
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { HtmlIngredientProps } from '../types.js';
|
2
2
|
import type { CreateToastReturn } from './create-toast.svelte.js';
|
3
3
|
import type { CreateToasterReturn } from './create-toaster.svelte.js';
|
4
|
-
export interface ToasterProps extends HtmlIngredientProps<'div', HTMLDivElement, CreateToastReturn> {
|
4
|
+
export interface ToasterProps extends Omit<HtmlIngredientProps<'div', HTMLDivElement, CreateToastReturn>, 'asChild'> {
|
5
5
|
toaster: CreateToasterReturn;
|
6
6
|
}
|
7
7
|
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> {
|
@@ -1,50 +1,50 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {
|
4
|
-
CreateToggleProps,
|
5
|
-
CreateToggleReturn,
|
6
|
-
} from './create-toggle.svelte.js';
|
7
|
-
|
8
|
-
export interface ToggleProps
|
9
|
-
extends Assign<
|
10
|
-
HtmlIngredientProps<'button', HTMLButtonElement, CreateToggleReturn>,
|
11
|
-
CreateToggleProps
|
12
|
-
> {}
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script lang="ts">
|
16
|
-
import {mergeProps} from '../merge-props.js';
|
17
|
-
import {reflect} from '@zag-js/svelte';
|
18
|
-
import {createSplitProps} from '@zag-js/utils';
|
19
|
-
import {createToggle} from './create-toggle.svelte.js';
|
20
|
-
import {setToggleContext} from './toggle-context.svelte.js';
|
21
|
-
|
22
|
-
let {
|
23
|
-
ref = $bindable(null),
|
24
|
-
asChild,
|
25
|
-
children,
|
26
|
-
...props
|
27
|
-
}: ToggleProps = $props();
|
28
|
-
|
29
|
-
let [createToggleProps, localProps] = $derived(
|
30
|
-
createSplitProps<CreateToggleProps>([
|
31
|
-
'disabled',
|
32
|
-
'pressed',
|
33
|
-
'onPressedChange',
|
34
|
-
])(props),
|
35
|
-
);
|
36
|
-
|
37
|
-
let toggle = createToggle(reflect(() => createToggleProps));
|
38
|
-
|
39
|
-
let mergedProps = $derived(mergeProps(toggle.getRootProps(), localProps));
|
40
|
-
|
41
|
-
setToggleContext(toggle);
|
42
|
-
</script>
|
43
|
-
|
44
|
-
{#if asChild}
|
45
|
-
{@render asChild(mergedProps, toggle)}
|
46
|
-
{:else}
|
47
|
-
<button bind:this={ref} {...mergedProps}>
|
48
|
-
{@render children?.(toggle)}
|
49
|
-
</button>
|
50
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {
|
4
|
+
CreateToggleProps,
|
5
|
+
CreateToggleReturn,
|
6
|
+
} from './create-toggle.svelte.js';
|
7
|
+
|
8
|
+
export interface ToggleProps
|
9
|
+
extends Assign<
|
10
|
+
HtmlIngredientProps<'button', HTMLButtonElement, CreateToggleReturn>,
|
11
|
+
CreateToggleProps
|
12
|
+
> {}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script lang="ts">
|
16
|
+
import {mergeProps} from '../merge-props.js';
|
17
|
+
import {reflect} from '@zag-js/svelte';
|
18
|
+
import {createSplitProps} from '@zag-js/utils';
|
19
|
+
import {createToggle} from './create-toggle.svelte.js';
|
20
|
+
import {setToggleContext} from './toggle-context.svelte.js';
|
21
|
+
|
22
|
+
let {
|
23
|
+
ref = $bindable(null),
|
24
|
+
asChild,
|
25
|
+
children,
|
26
|
+
...props
|
27
|
+
}: ToggleProps = $props();
|
28
|
+
|
29
|
+
let [createToggleProps, localProps] = $derived(
|
30
|
+
createSplitProps<CreateToggleProps>([
|
31
|
+
'disabled',
|
32
|
+
'pressed',
|
33
|
+
'onPressedChange',
|
34
|
+
])(props),
|
35
|
+
);
|
36
|
+
|
37
|
+
let toggle = createToggle(reflect(() => createToggleProps));
|
38
|
+
|
39
|
+
let mergedProps = $derived(mergeProps(toggle.getRootProps(), localProps));
|
40
|
+
|
41
|
+
setToggleContext(toggle);
|
42
|
+
</script>
|
43
|
+
|
44
|
+
{#if asChild}
|
45
|
+
{@render asChild(mergedProps, toggle)}
|
46
|
+
{:else}
|
47
|
+
<button bind:this={ref} {...mergedProps}>
|
48
|
+
{@render children?.(toggle)}
|
49
|
+
</button>
|
50
|
+
{/if}
|
@@ -1,58 +1,58 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {
|
4
|
-
CreateToggleGroupProps,
|
5
|
-
CreateToggleGroupReturn,
|
6
|
-
} from './create-toggle-group.svelte.js';
|
7
|
-
|
8
|
-
export interface ToggleGroupProps
|
9
|
-
extends Assign<
|
10
|
-
HtmlIngredientProps<'div', HTMLDivElement, CreateToggleGroupReturn>,
|
11
|
-
CreateToggleGroupProps
|
12
|
-
> {}
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script lang="ts">
|
16
|
-
import {mergeProps} from '../merge-props.js';
|
17
|
-
import {reflect} from '@zag-js/svelte';
|
18
|
-
import {createSplitProps} from '@zag-js/utils';
|
19
|
-
import {createToggleGroup} from './create-toggle-group.svelte.js';
|
20
|
-
import {setToggleGroupContext} from './toggle-group-context.svelte.js';
|
21
|
-
|
22
|
-
let {
|
23
|
-
ref = $bindable(null),
|
24
|
-
asChild,
|
25
|
-
children,
|
26
|
-
...props
|
27
|
-
}: ToggleGroupProps = $props();
|
28
|
-
|
29
|
-
let [createToggleGroupProps, localProps] = $derived(
|
30
|
-
createSplitProps<CreateToggleGroupProps>([
|
31
|
-
'id',
|
32
|
-
'ids',
|
33
|
-
'value',
|
34
|
-
'disabled',
|
35
|
-
'multiple',
|
36
|
-
'loopFocus',
|
37
|
-
'rovingFocus',
|
38
|
-
'orientation',
|
39
|
-
'onValueChange',
|
40
|
-
])(props),
|
41
|
-
);
|
42
|
-
|
43
|
-
let toggleGroup = createToggleGroup(reflect(() => createToggleGroupProps));
|
44
|
-
|
45
|
-
let mergedProps = $derived(
|
46
|
-
mergeProps(toggleGroup.getRootProps(), localProps),
|
47
|
-
);
|
48
|
-
|
49
|
-
setToggleGroupContext(toggleGroup);
|
50
|
-
</script>
|
51
|
-
|
52
|
-
{#if asChild}
|
53
|
-
{@render asChild(mergedProps, toggleGroup)}
|
54
|
-
{:else}
|
55
|
-
<div bind:this={ref} {...mergedProps}>
|
56
|
-
{@render children?.(toggleGroup)}
|
57
|
-
</div>
|
58
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {
|
4
|
+
CreateToggleGroupProps,
|
5
|
+
CreateToggleGroupReturn,
|
6
|
+
} from './create-toggle-group.svelte.js';
|
7
|
+
|
8
|
+
export interface ToggleGroupProps
|
9
|
+
extends Assign<
|
10
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateToggleGroupReturn>,
|
11
|
+
CreateToggleGroupProps
|
12
|
+
> {}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script lang="ts">
|
16
|
+
import {mergeProps} from '../merge-props.js';
|
17
|
+
import {reflect} from '@zag-js/svelte';
|
18
|
+
import {createSplitProps} from '@zag-js/utils';
|
19
|
+
import {createToggleGroup} from './create-toggle-group.svelte.js';
|
20
|
+
import {setToggleGroupContext} from './toggle-group-context.svelte.js';
|
21
|
+
|
22
|
+
let {
|
23
|
+
ref = $bindable(null),
|
24
|
+
asChild,
|
25
|
+
children,
|
26
|
+
...props
|
27
|
+
}: ToggleGroupProps = $props();
|
28
|
+
|
29
|
+
let [createToggleGroupProps, localProps] = $derived(
|
30
|
+
createSplitProps<CreateToggleGroupProps>([
|
31
|
+
'id',
|
32
|
+
'ids',
|
33
|
+
'value',
|
34
|
+
'disabled',
|
35
|
+
'multiple',
|
36
|
+
'loopFocus',
|
37
|
+
'rovingFocus',
|
38
|
+
'orientation',
|
39
|
+
'onValueChange',
|
40
|
+
])(props),
|
41
|
+
);
|
42
|
+
|
43
|
+
let toggleGroup = createToggleGroup(reflect(() => createToggleGroupProps));
|
44
|
+
|
45
|
+
let mergedProps = $derived(
|
46
|
+
mergeProps(toggleGroup.getRootProps(), localProps),
|
47
|
+
);
|
48
|
+
|
49
|
+
setToggleGroupContext(toggleGroup);
|
50
|
+
</script>
|
51
|
+
|
52
|
+
{#if asChild}
|
53
|
+
{@render asChild(mergedProps, toggleGroup)}
|
54
|
+
{:else}
|
55
|
+
<div bind:this={ref} {...mergedProps}>
|
56
|
+
{@render children?.(toggleGroup)}
|
57
|
+
</div>
|
58
|
+
{/if}
|
@@ -1,44 +1,44 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
-
import type {Snippet} from 'svelte';
|
4
|
-
import type {
|
5
|
-
CreateTooltipProps,
|
6
|
-
CreateTooltipReturn,
|
7
|
-
} from './create-tooltip.svelte.js';
|
8
|
-
|
9
|
-
export interface TooltipProps
|
10
|
-
extends CreateTooltipProps,
|
11
|
-
PresenceStrategyProps {
|
12
|
-
children?: Snippet<[CreateTooltipReturn]>;
|
13
|
-
}
|
14
|
-
</script>
|
15
|
-
|
16
|
-
<script lang="ts">
|
17
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
18
|
-
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
19
|
-
import {reflect} from '@zag-js/svelte';
|
20
|
-
import {createSplitProps} from '@zag-js/utils';
|
21
|
-
import {createTooltip} from './create-tooltip.svelte.js';
|
22
|
-
import {setTooltipContext} from './tooltip-context.svelte.js';
|
23
|
-
|
24
|
-
let {children, ...props}: TooltipProps = $props();
|
25
|
-
|
26
|
-
let [presenceStrategyProps, createTooltipProps] = $derived(
|
27
|
-
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
28
|
-
props,
|
29
|
-
),
|
30
|
-
);
|
31
|
-
|
32
|
-
let tooltip = createTooltip(reflect(() => createTooltipProps));
|
33
|
-
let presence = createPresence(
|
34
|
-
reflect(() => ({
|
35
|
-
...presenceStrategyProps,
|
36
|
-
present: tooltip.open,
|
37
|
-
})),
|
38
|
-
);
|
39
|
-
|
40
|
-
setTooltipContext(tooltip);
|
41
|
-
setPresenceContext(presence);
|
42
|
-
</script>
|
43
|
-
|
44
|
-
{@render children?.(tooltip)}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {
|
5
|
+
CreateTooltipProps,
|
6
|
+
CreateTooltipReturn,
|
7
|
+
} from './create-tooltip.svelte.js';
|
8
|
+
|
9
|
+
export interface TooltipProps
|
10
|
+
extends CreateTooltipProps,
|
11
|
+
PresenceStrategyProps {
|
12
|
+
children?: Snippet<[CreateTooltipReturn]>;
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script lang="ts">
|
17
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
18
|
+
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
19
|
+
import {reflect} from '@zag-js/svelte';
|
20
|
+
import {createSplitProps} from '@zag-js/utils';
|
21
|
+
import {createTooltip} from './create-tooltip.svelte.js';
|
22
|
+
import {setTooltipContext} from './tooltip-context.svelte.js';
|
23
|
+
|
24
|
+
let {children, ...props}: TooltipProps = $props();
|
25
|
+
|
26
|
+
let [presenceStrategyProps, createTooltipProps] = $derived(
|
27
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
28
|
+
props,
|
29
|
+
),
|
30
|
+
);
|
31
|
+
|
32
|
+
let tooltip = createTooltip(reflect(() => createTooltipProps));
|
33
|
+
let presence = createPresence(
|
34
|
+
reflect(() => ({
|
35
|
+
...presenceStrategyProps,
|
36
|
+
present: tooltip.open,
|
37
|
+
})),
|
38
|
+
);
|
39
|
+
|
40
|
+
setTooltipContext(tooltip);
|
41
|
+
setPresenceContext(presence);
|
42
|
+
</script>
|
43
|
+
|
44
|
+
{@render children?.(tooltip)}
|
@@ -1,44 +1,44 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface TourBackdropProps
|
5
|
-
extends HtmlIngredientProps<'div', HTMLDivElement> {}
|
6
|
-
</script>
|
7
|
-
|
8
|
-
<script lang="ts">
|
9
|
-
import {mergeProps} from '../merge-props.js';
|
10
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
11
|
-
import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
|
12
|
-
import {reflect} from '@zag-js/svelte';
|
13
|
-
import {getTourContext} from './tour-context.svelte.js';
|
14
|
-
|
15
|
-
let {
|
16
|
-
ref = $bindable(null),
|
17
|
-
asChild,
|
18
|
-
children,
|
19
|
-
...props
|
20
|
-
}: TourBackdropProps = $props();
|
21
|
-
|
22
|
-
let tour = getTourContext();
|
23
|
-
let presenceStrategyProps = getPresenceStrategyPropsContext();
|
24
|
-
let presence = createPresence(
|
25
|
-
reflect(() => ({
|
26
|
-
...presenceStrategyProps,
|
27
|
-
present: tour.step?.backdrop ? tour.open : false,
|
28
|
-
})),
|
29
|
-
);
|
30
|
-
|
31
|
-
let mergedProps = $derived(
|
32
|
-
mergeProps(tour.getBackdropProps(), presence.getPresenceProps(), props),
|
33
|
-
);
|
34
|
-
</script>
|
35
|
-
|
36
|
-
{#if presence.mounted}
|
37
|
-
{#if asChild}
|
38
|
-
{@render asChild(mergedProps)}
|
39
|
-
{:else}
|
40
|
-
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
41
|
-
{@render children?.()}
|
42
|
-
</div>
|
43
|
-
{/if}
|
44
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface TourBackdropProps
|
5
|
+
extends HtmlIngredientProps<'div', HTMLDivElement> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '../merge-props.js';
|
10
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
11
|
+
import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
|
12
|
+
import {reflect} from '@zag-js/svelte';
|
13
|
+
import {getTourContext} from './tour-context.svelte.js';
|
14
|
+
|
15
|
+
let {
|
16
|
+
ref = $bindable(null),
|
17
|
+
asChild,
|
18
|
+
children,
|
19
|
+
...props
|
20
|
+
}: TourBackdropProps = $props();
|
21
|
+
|
22
|
+
let tour = getTourContext();
|
23
|
+
let presenceStrategyProps = getPresenceStrategyPropsContext();
|
24
|
+
let presence = createPresence(
|
25
|
+
reflect(() => ({
|
26
|
+
...presenceStrategyProps,
|
27
|
+
present: tour.step?.backdrop ? tour.open : false,
|
28
|
+
})),
|
29
|
+
);
|
30
|
+
|
31
|
+
let mergedProps = $derived(
|
32
|
+
mergeProps(tour.getBackdropProps(), presence.getPresenceProps(), props),
|
33
|
+
);
|
34
|
+
</script>
|
35
|
+
|
36
|
+
{#if presence.mounted}
|
37
|
+
{#if asChild}
|
38
|
+
{@render asChild(mergedProps)}
|
39
|
+
{:else}
|
40
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
41
|
+
{@render children?.()}
|
42
|
+
</div>
|
43
|
+
{/if}
|
44
|
+
{/if}
|
@@ -1,47 +1,47 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
-
import type {Snippet} from 'svelte';
|
4
|
-
import type {
|
5
|
-
CreateTourProps,
|
6
|
-
CreateTourReturn,
|
7
|
-
} from './create-tour.svelte.js';
|
8
|
-
|
9
|
-
export interface TourProps extends CreateTourProps, PresenceStrategyProps {
|
10
|
-
children?: Snippet<[CreateTourReturn]>;
|
11
|
-
}
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script lang="ts">
|
15
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
16
|
-
import {
|
17
|
-
setPresenceContext,
|
18
|
-
setPresenceStrategyPropsContext,
|
19
|
-
} from '../presence/presence-context.svelte.js';
|
20
|
-
import {reflect} from '@zag-js/svelte';
|
21
|
-
import {createSplitProps} from '@zag-js/utils';
|
22
|
-
import {createTour} from './create-tour.svelte.js';
|
23
|
-
import {setTourContext} from './tour-context.svelte.js';
|
24
|
-
|
25
|
-
let {children, ...props}: TourProps = $props();
|
26
|
-
|
27
|
-
let [presenceStrategyProps, createTourProps] = $derived(
|
28
|
-
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
29
|
-
props,
|
30
|
-
),
|
31
|
-
);
|
32
|
-
|
33
|
-
let tour = createTour(reflect(() => createTourProps));
|
34
|
-
|
35
|
-
let presence = createPresence(
|
36
|
-
reflect(() => ({
|
37
|
-
...presenceStrategyProps,
|
38
|
-
present: tour.open,
|
39
|
-
})),
|
40
|
-
);
|
41
|
-
|
42
|
-
setTourContext(tour);
|
43
|
-
setPresenceContext(presence);
|
44
|
-
setPresenceStrategyPropsContext(() => presenceStrategyProps);
|
45
|
-
</script>
|
46
|
-
|
47
|
-
{@render children?.(tour)}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {
|
5
|
+
CreateTourProps,
|
6
|
+
CreateTourReturn,
|
7
|
+
} from './create-tour.svelte.js';
|
8
|
+
|
9
|
+
export interface TourProps extends CreateTourProps, PresenceStrategyProps {
|
10
|
+
children?: Snippet<[CreateTourReturn]>;
|
11
|
+
}
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script lang="ts">
|
15
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
16
|
+
import {
|
17
|
+
setPresenceContext,
|
18
|
+
setPresenceStrategyPropsContext,
|
19
|
+
} from '../presence/presence-context.svelte.js';
|
20
|
+
import {reflect} from '@zag-js/svelte';
|
21
|
+
import {createSplitProps} from '@zag-js/utils';
|
22
|
+
import {createTour} from './create-tour.svelte.js';
|
23
|
+
import {setTourContext} from './tour-context.svelte.js';
|
24
|
+
|
25
|
+
let {children, ...props}: TourProps = $props();
|
26
|
+
|
27
|
+
let [presenceStrategyProps, createTourProps] = $derived(
|
28
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
29
|
+
props,
|
30
|
+
),
|
31
|
+
);
|
32
|
+
|
33
|
+
let tour = createTour(reflect(() => createTourProps));
|
34
|
+
|
35
|
+
let presence = createPresence(
|
36
|
+
reflect(() => ({
|
37
|
+
...presenceStrategyProps,
|
38
|
+
present: tour.open,
|
39
|
+
})),
|
40
|
+
);
|
41
|
+
|
42
|
+
setTourContext(tour);
|
43
|
+
setPresenceContext(presence);
|
44
|
+
setPresenceStrategyPropsContext(() => presenceStrategyProps);
|
45
|
+
</script>
|
46
|
+
|
47
|
+
{@render children?.(tour)}
|