@ark-ui/svelte 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,16 +89,4 @@ export interface UseListSelectionReturn {
89
89
  * Returns true if at least one item from the collection is selected.
90
90
  */
91
91
  isSomeSelected: () => boolean;
92
- /**
93
- * Set the selection to a specific array of items.
94
- */
95
- setSelection: (selection: string[]) => void;
96
- /**
97
- * Set the selection mode.
98
- */
99
- setSelectionMode: (mode: SelectionMode) => void;
100
- /**
101
- * Set whether the selection is deselectable.
102
- */
103
- setDeselectable: (deselectable: boolean) => void;
104
92
  }
@@ -1,5 +1,6 @@
1
1
  import { Selection } from '@zag-js/collection';
2
2
  import { runIfFn } from '@zag-js/utils';
3
+ import { untrack } from 'svelte';
3
4
  export function useListSelection(props) {
4
5
  const localProps = $derived.by(() => {
5
6
  const { collection, selectionMode = 'single', deselectable = true, initialSelectedValues = [], resetOnCollectionChange = false, } = runIfFn(props);
@@ -17,7 +18,8 @@ export function useListSelection(props) {
17
18
  selection.deselectable = localProps.deselectable;
18
19
  return selection;
19
20
  };
20
- let selection = $state(createSelection(localProps.initialSelectedValues));
21
+ const initialSelectedValues = untrack(() => localProps.initialSelectedValues);
22
+ let selection = $state(createSelection(initialSelectedValues));
21
23
  // Watch for collection changes and reset selection if needed
22
24
  $effect(() => {
23
25
  const { collection, resetOnCollectionChange } = localProps;
@@ -74,18 +76,5 @@ export function useListSelection(props) {
74
76
  resetSelection: () => {
75
77
  selection = createSelection();
76
78
  },
77
- setSelection: (newSelection) => {
78
- selection = selection.setSelection(newSelection);
79
- },
80
- setSelectionMode: (mode) => {
81
- const newSelection = selection.copy();
82
- newSelection.selectionMode = mode;
83
- selection = newSelection;
84
- },
85
- setDeselectable: (deselectable) => {
86
- const newSelection = selection.copy();
87
- newSelection.deselectable = deselectable;
88
- selection = newSelection;
89
- },
90
79
  };
91
80
  }
@@ -1,5 +1,5 @@
1
- <script module lang="ts">
2
- import type { Snippet } from 'svelte'
1
+ <script lang="ts">
2
+ import { type Snippet, getAllContexts, mount, tick, unmount } from 'svelte'
3
3
 
4
4
  export interface PortalProps {
5
5
  /**
@@ -15,42 +15,30 @@
15
15
  */
16
16
  children: Snippet
17
17
  }
18
- </script>
19
18
 
20
- <script lang="ts">
21
- /**
22
- * @see https://github.com/sveltejs/svelte/issues/7082
23
- */
24
- import { getAllContexts, mount, unmount } from 'svelte'
25
- import PortalConsumer from './portal-consumer.svelte'
26
-
27
- const { container = globalThis?.document?.body, children, disabled = false }: PortalProps = $props()
19
+ let { children, container = globalThis.document?.body, disabled = false }: PortalProps = $props()
28
20
 
29
21
  const context = getAllContexts()
30
22
 
31
- let instance: ReturnType<typeof mount> | null = null
32
-
33
- const unmountInstance = () => {
34
- if (instance) {
35
- unmount(instance)
36
- instance = null
23
+ let instance: any = null
24
+ $effect(() => {
25
+ const cleanup = () => {
26
+ if (instance) {
27
+ void unmount(instance)
28
+ instance = null
29
+ }
37
30
  }
38
- }
39
31
 
40
- $effect(() => {
41
- if (disabled || !container) {
42
- unmountInstance()
32
+ if (disabled) {
33
+ cleanup()
43
34
  return
44
35
  }
45
36
 
46
- instance = mount(PortalConsumer, {
47
- target: container,
48
- props: { children },
49
- context,
37
+ tick().then(() => {
38
+ instance = mount(children, { target: container, context })
50
39
  })
51
-
52
40
  return () => {
53
- unmountInstance()
41
+ cleanup()
54
42
  }
55
43
  })
56
44
  </script>
@@ -1,4 +1,4 @@
1
- import type { Snippet } from 'svelte';
1
+ import { type Snippet } from 'svelte';
2
2
  export interface PortalProps {
3
3
  /**
4
4
  * If true, the portal will not be rendered.
@@ -1 +1 @@
1
- export declare const tourAnatomy: import("@zag-js/anatomy").AnatomyInstance<"title" | "content" | "control" | "positioner" | "arrow" | "description" | "actionTrigger" | "closeTrigger" | "progressText" | "arrowTip" | "backdrop" | "spotlight">;
1
+ export declare const tourAnatomy: import("@zag-js/anatomy").AnatomyInstance<"title" | "content" | "control" | "positioner" | "description" | "arrow" | "actionTrigger" | "closeTrigger" | "progressText" | "arrowTip" | "backdrop" | "spotlight">;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ark-ui/svelte",
3
3
  "type": "module",
4
- "version": "5.3.0",
4
+ "version": "5.3.1",
5
5
  "description": "A collection of unstyled, accessible UI components for Svelte",
6
6
  "keywords": [
7
7
  "accordion",
@@ -120,64 +120,64 @@
120
120
  "sideEffects": false,
121
121
  "dependencies": {
122
122
  "@internationalized/date": "3.8.2",
123
- "@zag-js/accordion": "1.20.0",
124
- "@zag-js/angle-slider": "1.20.0",
125
- "@zag-js/anatomy": "1.20.0",
126
- "@zag-js/auto-resize": "1.20.0",
127
- "@zag-js/avatar": "1.20.0",
128
- "@zag-js/carousel": "1.20.0",
129
- "@zag-js/checkbox": "1.20.0",
130
- "@zag-js/clipboard": "1.20.0",
131
- "@zag-js/collapsible": "1.20.0",
132
- "@zag-js/collection": "1.20.0",
133
- "@zag-js/color-picker": "1.20.0",
134
- "@zag-js/color-utils": "1.20.0",
135
- "@zag-js/combobox": "1.20.0",
136
- "@zag-js/core": "1.20.0",
137
- "@zag-js/date-picker": "1.20.0",
138
- "@zag-js/date-utils": "1.20.0",
139
- "@zag-js/dialog": "1.20.0",
140
- "@zag-js/dom-query": "1.20.0",
141
- "@zag-js/editable": "1.20.0",
142
- "@zag-js/file-upload": "1.20.0",
143
- "@zag-js/file-utils": "1.20.0",
144
- "@zag-js/focus-trap": "1.20.0",
145
- "@zag-js/floating-panel": "1.20.0",
146
- "@zag-js/highlight-word": "1.20.0",
147
- "@zag-js/hover-card": "1.20.0",
148
- "@zag-js/i18n-utils": "1.20.0",
149
- "@zag-js/json-tree-utils": "1.20.0",
150
- "@zag-js/listbox": "1.20.0",
151
- "@zag-js/menu": "1.20.0",
152
- "@zag-js/number-input": "1.20.0",
153
- "@zag-js/pagination": "1.20.0",
154
- "@zag-js/password-input": "1.20.0",
155
- "@zag-js/pin-input": "1.20.0",
156
- "@zag-js/popover": "1.20.0",
157
- "@zag-js/presence": "1.20.0",
158
- "@zag-js/progress": "1.20.0",
159
- "@zag-js/qr-code": "1.20.0",
160
- "@zag-js/radio-group": "1.20.0",
161
- "@zag-js/rating-group": "1.20.0",
162
- "@zag-js/svelte": "1.20.0",
163
- "@zag-js/select": "1.20.0",
164
- "@zag-js/signature-pad": "1.20.0",
165
- "@zag-js/slider": "1.20.0",
166
- "@zag-js/splitter": "1.20.0",
167
- "@zag-js/steps": "1.20.0",
168
- "@zag-js/switch": "1.20.0",
169
- "@zag-js/tabs": "1.20.0",
170
- "@zag-js/tags-input": "1.20.0",
171
- "@zag-js/time-picker": "1.20.0",
172
- "@zag-js/timer": "1.20.0",
173
- "@zag-js/toast": "1.20.0",
174
- "@zag-js/toggle": "1.20.0",
175
- "@zag-js/toggle-group": "1.20.0",
176
- "@zag-js/tooltip": "1.20.0",
177
- "@zag-js/tour": "1.20.0",
178
- "@zag-js/tree-view": "1.20.0",
179
- "@zag-js/types": "1.20.0",
180
- "@zag-js/utils": "1.20.0"
123
+ "@zag-js/accordion": "1.20.1",
124
+ "@zag-js/angle-slider": "1.20.1",
125
+ "@zag-js/anatomy": "1.20.1",
126
+ "@zag-js/auto-resize": "1.20.1",
127
+ "@zag-js/avatar": "1.20.1",
128
+ "@zag-js/carousel": "1.20.1",
129
+ "@zag-js/checkbox": "1.20.1",
130
+ "@zag-js/clipboard": "1.20.1",
131
+ "@zag-js/collapsible": "1.20.1",
132
+ "@zag-js/collection": "1.20.1",
133
+ "@zag-js/color-picker": "1.20.1",
134
+ "@zag-js/color-utils": "1.20.1",
135
+ "@zag-js/combobox": "1.20.1",
136
+ "@zag-js/core": "1.20.1",
137
+ "@zag-js/date-picker": "1.20.1",
138
+ "@zag-js/date-utils": "1.20.1",
139
+ "@zag-js/dialog": "1.20.1",
140
+ "@zag-js/dom-query": "1.20.1",
141
+ "@zag-js/editable": "1.20.1",
142
+ "@zag-js/file-upload": "1.20.1",
143
+ "@zag-js/file-utils": "1.20.1",
144
+ "@zag-js/focus-trap": "1.20.1",
145
+ "@zag-js/floating-panel": "1.20.1",
146
+ "@zag-js/highlight-word": "1.20.1",
147
+ "@zag-js/hover-card": "1.20.1",
148
+ "@zag-js/i18n-utils": "1.20.1",
149
+ "@zag-js/json-tree-utils": "1.20.1",
150
+ "@zag-js/listbox": "1.20.1",
151
+ "@zag-js/menu": "1.20.1",
152
+ "@zag-js/number-input": "1.20.1",
153
+ "@zag-js/pagination": "1.20.1",
154
+ "@zag-js/password-input": "1.20.1",
155
+ "@zag-js/pin-input": "1.20.1",
156
+ "@zag-js/popover": "1.20.1",
157
+ "@zag-js/presence": "1.20.1",
158
+ "@zag-js/progress": "1.20.1",
159
+ "@zag-js/qr-code": "1.20.1",
160
+ "@zag-js/radio-group": "1.20.1",
161
+ "@zag-js/rating-group": "1.20.1",
162
+ "@zag-js/svelte": "1.20.1",
163
+ "@zag-js/select": "1.20.1",
164
+ "@zag-js/signature-pad": "1.20.1",
165
+ "@zag-js/slider": "1.20.1",
166
+ "@zag-js/splitter": "1.20.1",
167
+ "@zag-js/steps": "1.20.1",
168
+ "@zag-js/switch": "1.20.1",
169
+ "@zag-js/tabs": "1.20.1",
170
+ "@zag-js/tags-input": "1.20.1",
171
+ "@zag-js/time-picker": "1.20.1",
172
+ "@zag-js/timer": "1.20.1",
173
+ "@zag-js/toast": "1.20.1",
174
+ "@zag-js/toggle": "1.20.1",
175
+ "@zag-js/toggle-group": "1.20.1",
176
+ "@zag-js/tooltip": "1.20.1",
177
+ "@zag-js/tour": "1.20.1",
178
+ "@zag-js/tree-view": "1.20.1",
179
+ "@zag-js/types": "1.20.1",
180
+ "@zag-js/utils": "1.20.1"
181
181
  },
182
182
  "devDependencies": {
183
183
  "@storybook/addon-a11y": "9.0.18",
@@ -1,9 +0,0 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte'
3
-
4
- const { children }: { children: Snippet } = $props()
5
- </script>
6
-
7
- {#if children}
8
- {@render children()}
9
- {/if}
@@ -1,7 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- type $$ComponentProps = {
3
- children: Snippet;
4
- };
5
- declare const PortalConsumer: import("svelte").Component<$$ComponentProps, {}, "">;
6
- type PortalConsumer = ReturnType<typeof PortalConsumer>;
7
- export default PortalConsumer;