@ariakit/core 0.3.9 → 0.3.11

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/cjs/__chunks/{JNFZSNOI.cjs → BFE5R4EZ.cjs} +17 -17
  3. package/cjs/__chunks/{EFIT5L4X.cjs → E53JW5BD.cjs} +12 -12
  4. package/cjs/__chunks/{2UK5WUJX.cjs → F6HPKLO2.cjs} +12 -14
  5. package/cjs/__chunks/{2LS4JJ4S.cjs → I3Y4EXEF.cjs} +2 -2
  6. package/cjs/__chunks/{3UT5FE6K.cjs → KBNYGXWI.cjs} +3 -0
  7. package/cjs/__chunks/{UCLKUBNP.cjs → MI6NUQYQ.cjs} +31 -18
  8. package/cjs/__chunks/{UTICNXST.cjs → NOFH2BLB.cjs} +7 -7
  9. package/cjs/__chunks/{GJFZ5ZPP.cjs → OTVLDMN2.cjs} +16 -16
  10. package/cjs/__chunks/{5SIVMOID.cjs → TQTGWD5K.cjs} +10 -10
  11. package/cjs/checkbox/checkbox-store.cjs +5 -5
  12. package/cjs/checkbox/checkbox-store.d.cts +5 -2
  13. package/cjs/checkbox/checkbox-store.d.ts +5 -2
  14. package/cjs/collection/collection-store.cjs +4 -4
  15. package/cjs/collection/collection-store.d.cts +11 -11
  16. package/cjs/collection/collection-store.d.ts +11 -11
  17. package/cjs/combobox/combobox-store.cjs +32 -32
  18. package/cjs/combobox/combobox-store.d.cts +3 -1
  19. package/cjs/combobox/combobox-store.d.ts +3 -1
  20. package/cjs/composite/composite-overflow-store.cjs +6 -6
  21. package/cjs/composite/composite-store.cjs +5 -5
  22. package/cjs/composite/composite-store.d.cts +128 -54
  23. package/cjs/composite/composite-store.d.ts +128 -54
  24. package/cjs/dialog/dialog-store.cjs +5 -5
  25. package/cjs/disclosure/disclosure-store.cjs +4 -4
  26. package/cjs/disclosure/disclosure-store.d.cts +33 -27
  27. package/cjs/disclosure/disclosure-store.d.ts +33 -27
  28. package/cjs/form/form-store.cjs +23 -23
  29. package/cjs/form/form-store.d.cts +35 -26
  30. package/cjs/form/form-store.d.ts +35 -26
  31. package/cjs/hovercard/hovercard-store.cjs +7 -7
  32. package/cjs/hovercard/hovercard-store.d.cts +14 -7
  33. package/cjs/hovercard/hovercard-store.d.ts +14 -7
  34. package/cjs/menu/menu-bar-store.cjs +6 -6
  35. package/cjs/menu/menu-store.cjs +26 -26
  36. package/cjs/menu/menu-store.d.cts +16 -7
  37. package/cjs/menu/menu-store.d.ts +16 -7
  38. package/cjs/menubar/menubar-store.cjs +6 -6
  39. package/cjs/popover/popover-store.cjs +6 -6
  40. package/cjs/popover/popover-store.d.cts +31 -6
  41. package/cjs/popover/popover-store.d.ts +31 -6
  42. package/cjs/radio/radio-store.cjs +8 -8
  43. package/cjs/radio/radio-store.d.cts +2 -1
  44. package/cjs/radio/radio-store.d.ts +2 -1
  45. package/cjs/select/select-store.cjs +28 -28
  46. package/cjs/select/select-store.d.cts +2 -1
  47. package/cjs/select/select-store.d.ts +2 -1
  48. package/cjs/tab/tab-store.cjs +20 -20
  49. package/cjs/tab/tab-store.d.cts +20 -15
  50. package/cjs/tab/tab-store.d.ts +20 -15
  51. package/cjs/toolbar/toolbar-store.cjs +7 -7
  52. package/cjs/toolbar/toolbar-store.d.cts +2 -6
  53. package/cjs/toolbar/toolbar-store.d.ts +2 -6
  54. package/cjs/tooltip/tooltip-store.cjs +12 -12
  55. package/cjs/tooltip/tooltip-store.d.cts +6 -4
  56. package/cjs/tooltip/tooltip-store.d.ts +6 -4
  57. package/cjs/utils/misc.cjs +2 -2
  58. package/cjs/utils/store.cjs +3 -3
  59. package/esm/__chunks/{TLN4ALYH.js → 22K762VQ.js} +22 -9
  60. package/esm/__chunks/{J6JIOWCS.js → AF6IUUFN.js} +3 -3
  61. package/esm/__chunks/{A2J4XZ5T.js → EAHJFCU4.js} +1 -3
  62. package/esm/__chunks/{DLX2AS6C.js → IERTEJ3A.js} +3 -3
  63. package/esm/__chunks/{T3DVYGXI.js → SOLWE6E5.js} +3 -3
  64. package/esm/__chunks/{LT2OYWRD.js → SX2XFD6A.js} +1 -1
  65. package/esm/__chunks/{EZ2TTBAQ.js → XU3EOSCU.js} +3 -3
  66. package/esm/__chunks/{I2VQ3XGR.js → Y3OOHFCN.js} +3 -0
  67. package/esm/__chunks/{NKLTHWCR.js → Z5IGYIPT.js} +2 -2
  68. package/esm/checkbox/checkbox-store.d.ts +5 -2
  69. package/esm/checkbox/checkbox-store.js +2 -2
  70. package/esm/collection/collection-store.d.ts +11 -11
  71. package/esm/collection/collection-store.js +3 -3
  72. package/esm/combobox/combobox-store.d.ts +3 -1
  73. package/esm/combobox/combobox-store.js +7 -7
  74. package/esm/composite/composite-overflow-store.js +5 -5
  75. package/esm/composite/composite-store.d.ts +128 -54
  76. package/esm/composite/composite-store.js +4 -4
  77. package/esm/dialog/dialog-store.js +4 -4
  78. package/esm/disclosure/disclosure-store.d.ts +33 -27
  79. package/esm/disclosure/disclosure-store.js +3 -3
  80. package/esm/form/form-store.d.ts +35 -26
  81. package/esm/form/form-store.js +3 -3
  82. package/esm/hovercard/hovercard-store.d.ts +14 -7
  83. package/esm/hovercard/hovercard-store.js +6 -6
  84. package/esm/menu/menu-bar-store.js +5 -5
  85. package/esm/menu/menu-store.d.ts +16 -7
  86. package/esm/menu/menu-store.js +8 -8
  87. package/esm/menubar/menubar-store.js +5 -5
  88. package/esm/popover/popover-store.d.ts +31 -6
  89. package/esm/popover/popover-store.js +5 -5
  90. package/esm/radio/radio-store.d.ts +2 -1
  91. package/esm/radio/radio-store.js +4 -4
  92. package/esm/select/select-store.d.ts +2 -1
  93. package/esm/select/select-store.js +7 -7
  94. package/esm/tab/tab-store.d.ts +20 -15
  95. package/esm/tab/tab-store.js +4 -4
  96. package/esm/toolbar/toolbar-store.d.ts +2 -6
  97. package/esm/toolbar/toolbar-store.js +4 -4
  98. package/esm/tooltip/tooltip-store.d.ts +6 -4
  99. package/esm/tooltip/tooltip-store.js +6 -6
  100. package/esm/utils/misc.js +1 -1
  101. package/esm/utils/store.js +2 -2
  102. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @ariakit/core
2
2
 
3
+ ## 0.3.11
4
+
5
+ ### Improved performance of large collections
6
+
7
+ Components like [`MenuItem`](https://ariakit.org/reference/menu-item), [`ComboboxItem`](https://ariakit.org/reference/combobox-item), and [`SelectItem`](https://ariakit.org/reference/select-item) should now offer improved performance when rendering large collections.
8
+
9
+ ### Other updates
10
+
11
+ - Improved JSDocs.
12
+
13
+ ## 0.3.10
14
+
15
+ - Fixed [`CompositeItem`](https://ariakit.org/reference/composite-item) triggering blur on focus.
16
+ - Improved JSDocs.
17
+
3
18
  ## 0.3.9
4
19
 
5
20
  - Fixed `Maximum update depth exceeded` warning when rendering multiple collection items on the page.
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _UCLKUBNPcjs = require('./UCLKUBNP.cjs');
4
+ var _MI6NUQYQcjs = require('./MI6NUQYQ.cjs');
5
5
 
6
6
 
7
7
 
8
8
 
9
- var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
9
+ var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
10
10
 
11
11
 
12
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
12
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
13
13
 
14
14
 
15
15
 
@@ -124,40 +124,40 @@ function verticalizeItems(items) {
124
124
  function createCompositeStore(props = {}) {
125
125
  var _a;
126
126
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
127
- const collection = _UCLKUBNPcjs.createCollectionStore.call(void 0, props);
128
- const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
127
+ const collection = _MI6NUQYQcjs.createCollectionStore.call(void 0, props);
128
+ const activeId = _KBNYGXWIcjs.defaultValue.call(void 0,
129
129
  props.activeId,
130
130
  syncState == null ? void 0 : syncState.activeId,
131
131
  props.defaultActiveId
132
132
  );
133
133
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection.getState()), {
134
134
  activeId,
135
- baseElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
136
- includesBaseElement: _3UT5FE6Kcjs.defaultValue.call(void 0,
135
+ baseElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
136
+ includesBaseElement: _KBNYGXWIcjs.defaultValue.call(void 0,
137
137
  props.includesBaseElement,
138
138
  syncState == null ? void 0 : syncState.includesBaseElement,
139
139
  activeId === null
140
140
  ),
141
- moves: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
142
- orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
141
+ moves: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
142
+ orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
143
143
  props.orientation,
144
144
  syncState == null ? void 0 : syncState.orientation,
145
145
  "both"
146
146
  ),
147
- rtl: _3UT5FE6Kcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
148
- virtualFocus: _3UT5FE6Kcjs.defaultValue.call(void 0,
147
+ rtl: _KBNYGXWIcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
148
+ virtualFocus: _KBNYGXWIcjs.defaultValue.call(void 0,
149
149
  props.virtualFocus,
150
150
  syncState == null ? void 0 : syncState.virtualFocus,
151
151
  false
152
152
  ),
153
- focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
154
- focusWrap: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
155
- focusShift: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
153
+ focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
154
+ focusWrap: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
155
+ focusShift: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
156
156
  });
157
- const composite = _2UK5WUJXcjs.createStore.call(void 0, initialState, collection, props.store);
158
- _2UK5WUJXcjs.setup.call(void 0,
157
+ const composite = _F6HPKLO2cjs.createStore.call(void 0, initialState, collection, props.store);
158
+ _F6HPKLO2cjs.setup.call(void 0,
159
159
  composite,
160
- () => _2UK5WUJXcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
160
+ () => _F6HPKLO2cjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
161
161
  composite.setState("activeId", (activeId2) => {
162
162
  var _a2;
163
163
  if (activeId2 !== void 0)
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _2LS4JJ4Scjs = require('./2LS4JJ4S.cjs');
4
+ var _I3Y4EXEFcjs = require('./I3Y4EXEF.cjs');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
- var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
10
+ var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
11
11
 
12
12
 
13
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
13
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
14
14
 
15
15
 
16
16
 
@@ -24,9 +24,9 @@ function createPopoverStore(_a = {}) {
24
24
  } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
25
25
  "popover"
26
26
  ]);
27
- const store = _2UK5WUJXcjs.mergeStore.call(void 0,
27
+ const store = _F6HPKLO2cjs.mergeStore.call(void 0,
28
28
  props.store,
29
- _2UK5WUJXcjs.omit.call(void 0, otherPopover, [
29
+ _F6HPKLO2cjs.omit.call(void 0, otherPopover, [
30
30
  "arrowElement",
31
31
  "anchorElement",
32
32
  "contentElement",
@@ -34,10 +34,10 @@ function createPopoverStore(_a = {}) {
34
34
  "disclosureElement"
35
35
  ])
36
36
  );
37
- _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, store);
37
+ _F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
38
38
  const syncState = store == null ? void 0 : store.getState();
39
- const dialog = _2LS4JJ4Scjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
40
- const placement = _3UT5FE6Kcjs.defaultValue.call(void 0,
39
+ const dialog = _I3Y4EXEFcjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
40
+ const placement = _KBNYGXWIcjs.defaultValue.call(void 0,
41
41
  props.placement,
42
42
  syncState == null ? void 0 : syncState.placement,
43
43
  "bottom"
@@ -45,12 +45,12 @@ function createPopoverStore(_a = {}) {
45
45
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
46
46
  placement,
47
47
  currentPlacement: placement,
48
- anchorElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
49
- popoverElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
50
- arrowElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
48
+ anchorElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
49
+ popoverElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
50
+ arrowElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
51
51
  rendered: Symbol("rendered")
52
52
  });
53
- const popover = _2UK5WUJXcjs.createStore.call(void 0, initialState, dialog, store);
53
+ const popover = _F6HPKLO2cjs.createStore.call(void 0, initialState, dialog, store);
54
54
  return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
55
55
  setAnchorElement: (element) => popover.setState("anchorElement", element),
56
56
  setPopoverElement: (element) => popover.setState("popoverElement", element),
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
11
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
12
12
 
13
13
 
14
14
 
@@ -17,14 +17,14 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
17
17
  // src/utils/store.ts
18
18
  function getInternal(store, key) {
19
19
  const internals = store.__unstableInternals;
20
- _3UT5FE6Kcjs.invariant.call(void 0, internals, "Invalid store");
20
+ _KBNYGXWIcjs.invariant.call(void 0, internals, "Invalid store");
21
21
  return internals[key];
22
22
  }
23
23
  function createStore(initialState, ...stores) {
24
24
  let state = initialState;
25
25
  let prevStateBatch = state;
26
26
  let lastUpdate = Symbol();
27
- let destroy = _3UT5FE6Kcjs.noop;
27
+ let destroy = _KBNYGXWIcjs.noop;
28
28
  const instances = /* @__PURE__ */ new Set();
29
29
  const updatedKeys = /* @__PURE__ */ new Set();
30
30
  const setups = /* @__PURE__ */ new Set();
@@ -37,8 +37,6 @@ function createStore(initialState, ...stores) {
37
37
  return () => setups.delete(callback);
38
38
  };
39
39
  const storeInit = () => {
40
- if (!stores.length)
41
- return _3UT5FE6Kcjs.noop;
42
40
  const initialized = instances.size;
43
41
  const instance = Symbol();
44
42
  instances.add(instance);
@@ -50,14 +48,14 @@ function createStore(initialState, ...stores) {
50
48
  };
51
49
  if (initialized)
52
50
  return maybeDestroy;
53
- const desyncs = _3UT5FE6Kcjs.getKeys.call(void 0, state).map(
54
- (key) => _3UT5FE6Kcjs.chain.call(void 0,
51
+ const desyncs = _KBNYGXWIcjs.getKeys.call(void 0, state).map(
52
+ (key) => _KBNYGXWIcjs.chain.call(void 0,
55
53
  ...stores.map((store) => {
56
54
  var _a;
57
55
  const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
58
56
  if (!storeState)
59
57
  return;
60
- if (!_3UT5FE6Kcjs.hasOwnProperty.call(void 0, storeState, key))
58
+ if (!_KBNYGXWIcjs.hasOwnProperty.call(void 0, storeState, key))
61
59
  return;
62
60
  return sync(store, [key], (state2) => {
63
61
  setState(
@@ -74,7 +72,7 @@ function createStore(initialState, ...stores) {
74
72
  const teardowns = [];
75
73
  setups.forEach((setup2) => teardowns.push(setup2()));
76
74
  const cleanups = stores.map(init);
77
- destroy = _3UT5FE6Kcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
75
+ destroy = _KBNYGXWIcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
78
76
  return maybeDestroy;
79
77
  };
80
78
  const sub = (keys, listener, set = listeners) => {
@@ -97,13 +95,13 @@ function createStore(initialState, ...stores) {
97
95
  disposables.set(listener, listener(state, prevStateBatch));
98
96
  return sub(keys, listener, batchListeners);
99
97
  };
100
- const storePick = (keys) => createStore(_3UT5FE6Kcjs.pick.call(void 0, state, keys), finalStore);
101
- const storeOmit = (keys) => createStore(_3UT5FE6Kcjs.omit.call(void 0, state, keys), finalStore);
98
+ const storePick = (keys) => createStore(_KBNYGXWIcjs.pick.call(void 0, state, keys), finalStore);
99
+ const storeOmit = (keys) => createStore(_KBNYGXWIcjs.omit.call(void 0, state, keys), finalStore);
102
100
  const getState = () => state;
103
101
  const setState = (key, value, fromStores = false) => {
104
- if (!_3UT5FE6Kcjs.hasOwnProperty.call(void 0, state, key))
102
+ if (!_KBNYGXWIcjs.hasOwnProperty.call(void 0, state, key))
105
103
  return;
106
- const nextValue = _3UT5FE6Kcjs.applyState.call(void 0, value, state[key]);
104
+ const nextValue = _KBNYGXWIcjs.applyState.call(void 0, value, state[key]);
107
105
  if (nextValue === state[key])
108
106
  return;
109
107
  if (!fromStores) {
@@ -215,7 +213,7 @@ function throwOnConflictingProps(props, store) {
215
213
  return;
216
214
  const storeState = store.getState();
217
215
  const conflictingProps = defaultKeys.filter(
218
- (key) => _3UT5FE6Kcjs.hasOwnProperty.call(void 0, storeState, key)
216
+ (key) => _KBNYGXWIcjs.hasOwnProperty.call(void 0, storeState, key)
219
217
  );
220
218
  if (!conflictingProps.length)
221
219
  return;
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _GJFZ5ZPPcjs = require('./GJFZ5ZPP.cjs');
4
+ var _OTVLDMN2cjs = require('./OTVLDMN2.cjs');
5
5
 
6
6
  // src/dialog/dialog-store.ts
7
7
  function createDialogStore(props = {}) {
8
- return _GJFZ5ZPPcjs.createDisclosureStore.call(void 0, props);
8
+ return _OTVLDMN2cjs.createDisclosureStore.call(void 0, props);
9
9
  }
10
10
 
11
11
 
@@ -63,6 +63,9 @@ function isInteger(arg) {
63
63
  return String(Math.floor(Number(arg))) === arg;
64
64
  }
65
65
  function hasOwnProperty(object, prop) {
66
+ if (typeof Object.hasOwn === "function") {
67
+ return Object.hasOwn(object, prop);
68
+ }
66
69
  return Object.prototype.hasOwnProperty.call(object, prop);
67
70
  }
68
71
  function chain(...fns) {
@@ -5,11 +5,11 @@
5
5
 
6
6
 
7
7
 
8
- var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
8
+ var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
9
9
 
10
10
 
11
11
 
12
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
12
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
13
13
 
14
14
 
15
15
  var _5F4DVUNScjs = require('./5F4DVUNS.cjs');
@@ -69,9 +69,9 @@ function getPrivateStore(store) {
69
69
  }
70
70
  function createCollectionStore(props = {}) {
71
71
  var _a;
72
- _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, props.store);
72
+ _F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, props.store);
73
73
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
74
- const items = _3UT5FE6Kcjs.defaultValue.call(void 0,
74
+ const items = _KBNYGXWIcjs.defaultValue.call(void 0,
75
75
  props.items,
76
76
  syncState == null ? void 0 : syncState.items,
77
77
  props.defaultItems,
@@ -80,25 +80,33 @@ function createCollectionStore(props = {}) {
80
80
  const itemsMap = new Map(items.map((item) => [item.id, item]));
81
81
  const initialState = {
82
82
  items,
83
- renderedItems: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
83
+ renderedItems: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
84
84
  };
85
85
  const syncPrivateStore = getPrivateStore(props.store);
86
- const privateStore = _2UK5WUJXcjs.createStore.call(void 0,
87
- { renderedItems: initialState.renderedItems },
86
+ const privateStore = _F6HPKLO2cjs.createStore.call(void 0,
87
+ { items, renderedItems: initialState.renderedItems },
88
88
  syncPrivateStore
89
89
  );
90
- const collection = _2UK5WUJXcjs.createStore.call(void 0, initialState, props.store);
91
- _2UK5WUJXcjs.setup.call(void 0, collection, () => _2UK5WUJXcjs.init.call(void 0, privateStore));
92
- _2UK5WUJXcjs.setup.call(void 0, privateStore, () => {
93
- return _2UK5WUJXcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
90
+ const collection = _F6HPKLO2cjs.createStore.call(void 0, initialState, props.store);
91
+ const sortItems = (renderedItems) => {
92
+ const sortedItems = sortBasedOnDOMPosition(renderedItems);
93
+ privateStore.setState("renderedItems", sortedItems);
94
+ collection.setState("renderedItems", sortedItems);
95
+ };
96
+ _F6HPKLO2cjs.setup.call(void 0, collection, () => _F6HPKLO2cjs.init.call(void 0, privateStore));
97
+ _F6HPKLO2cjs.setup.call(void 0, privateStore, () => {
98
+ return _F6HPKLO2cjs.batch.call(void 0, privateStore, ["items"], (state) => {
99
+ collection.setState("items", state.items);
100
+ });
101
+ });
102
+ _F6HPKLO2cjs.setup.call(void 0, privateStore, () => {
103
+ return _F6HPKLO2cjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
94
104
  let firstRun = true;
95
- const raf = requestAnimationFrame(() => {
105
+ let raf = requestAnimationFrame(() => {
96
106
  const { renderedItems } = collection.getState();
97
107
  if (state.renderedItems === renderedItems)
98
108
  return;
99
- const sortedItems = sortBasedOnDOMPosition(state.renderedItems);
100
- privateStore.setState("renderedItems", sortedItems);
101
- collection.setState("renderedItems", sortedItems);
109
+ sortItems(state.renderedItems);
102
110
  });
103
111
  if (typeof IntersectionObserver !== "function") {
104
112
  return () => cancelAnimationFrame(raf);
@@ -108,7 +116,8 @@ function createCollectionStore(props = {}) {
108
116
  firstRun = false;
109
117
  return;
110
118
  }
111
- privateStore.setState("renderedItems", [...state.renderedItems]);
119
+ cancelAnimationFrame(raf);
120
+ raf = requestAnimationFrame(() => sortItems(state.renderedItems));
112
121
  };
113
122
  const root = getCommonParent(state.renderedItems);
114
123
  const observer = new IntersectionObserver(ioCallback, { root });
@@ -158,10 +167,14 @@ function createCollectionStore(props = {}) {
158
167
  };
159
168
  return unmergeItem;
160
169
  };
161
- const registerItem = (item) => mergeItem(item, (getItems) => collection.setState("items", getItems), true);
170
+ const registerItem = (item) => mergeItem(
171
+ item,
172
+ (getItems) => privateStore.setState("items", getItems),
173
+ true
174
+ );
162
175
  return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), {
163
176
  registerItem,
164
- renderItem: (item) => _3UT5FE6Kcjs.chain.call(void 0,
177
+ renderItem: (item) => _KBNYGXWIcjs.chain.call(void 0,
165
178
  registerItem(item),
166
179
  mergeItem(
167
180
  item,
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _JNFZSNOIcjs = require('./JNFZSNOI.cjs');
4
+ var _BFE5R4EZcjs = require('./BFE5R4EZ.cjs');
5
5
 
6
6
 
7
- var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
7
+ var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
8
8
 
9
9
 
10
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
10
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
11
11
 
12
12
 
13
13
 
@@ -17,16 +17,16 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
17
17
  function createMenubarStore(props = {}) {
18
18
  var _a;
19
19
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
- const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
- orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
20
+ const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
+ orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
22
22
  props.orientation,
23
23
  syncState == null ? void 0 : syncState.orientation,
24
24
  "horizontal"
25
25
  ),
26
- focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
26
+ focusLoop: _KBNYGXWIcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
27
27
  }));
28
28
  const initialState = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState());
29
- const menubar = _2UK5WUJXcjs.createStore.call(void 0, initialState, composite, props.store);
29
+ const menubar = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, props.store);
30
30
  return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), menubar);
31
31
  }
32
32
 
@@ -7,10 +7,10 @@
7
7
 
8
8
 
9
9
 
10
- var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
10
+ var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
11
11
 
12
12
 
13
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
13
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
14
14
 
15
15
 
16
16
 
@@ -18,47 +18,47 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
18
18
 
19
19
  // src/disclosure/disclosure-store.ts
20
20
  function createDisclosureStore(props = {}) {
21
- const store = _2UK5WUJXcjs.mergeStore.call(void 0,
21
+ const store = _F6HPKLO2cjs.mergeStore.call(void 0,
22
22
  props.store,
23
- _2UK5WUJXcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
23
+ _F6HPKLO2cjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
24
24
  );
25
- _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, store);
25
+ _F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
26
26
  const syncState = store == null ? void 0 : store.getState();
27
- const open = _3UT5FE6Kcjs.defaultValue.call(void 0,
27
+ const open = _KBNYGXWIcjs.defaultValue.call(void 0,
28
28
  props.open,
29
29
  syncState == null ? void 0 : syncState.open,
30
30
  props.defaultOpen,
31
31
  false
32
32
  );
33
- const animated = _3UT5FE6Kcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
33
+ const animated = _KBNYGXWIcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
34
34
  const initialState = {
35
35
  open,
36
36
  animated,
37
37
  animating: !!animated && open,
38
38
  mounted: open,
39
- contentElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
40
- disclosureElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
39
+ contentElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
40
+ disclosureElement: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
41
41
  };
42
- const disclosure = _2UK5WUJXcjs.createStore.call(void 0, initialState, store);
43
- _2UK5WUJXcjs.setup.call(void 0,
42
+ const disclosure = _F6HPKLO2cjs.createStore.call(void 0, initialState, store);
43
+ _F6HPKLO2cjs.setup.call(void 0,
44
44
  disclosure,
45
- () => _2UK5WUJXcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
45
+ () => _F6HPKLO2cjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
46
46
  if (state.animated)
47
47
  return;
48
48
  disclosure.setState("animating", false);
49
49
  })
50
50
  );
51
- _2UK5WUJXcjs.setup.call(void 0,
51
+ _F6HPKLO2cjs.setup.call(void 0,
52
52
  disclosure,
53
- () => _2UK5WUJXcjs.subscribe.call(void 0, disclosure, ["open"], () => {
53
+ () => _F6HPKLO2cjs.subscribe.call(void 0, disclosure, ["open"], () => {
54
54
  if (!disclosure.getState().animated)
55
55
  return;
56
56
  disclosure.setState("animating", true);
57
57
  })
58
58
  );
59
- _2UK5WUJXcjs.setup.call(void 0,
59
+ _F6HPKLO2cjs.setup.call(void 0,
60
60
  disclosure,
61
- () => _2UK5WUJXcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
61
+ () => _F6HPKLO2cjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
62
62
  disclosure.setState("mounted", state.open || state.animating);
63
63
  })
64
64
  );
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _EFIT5L4Xcjs = require('./EFIT5L4X.cjs');
4
+ var _E53JW5BDcjs = require('./E53JW5BD.cjs');
5
5
 
6
6
 
7
- var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
7
+ var _F6HPKLO2cjs = require('./F6HPKLO2.cjs');
8
8
 
9
9
 
10
- var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
10
+ var _KBNYGXWIcjs = require('./KBNYGXWI.cjs');
11
11
 
12
12
 
13
13
 
@@ -17,21 +17,21 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
17
17
  function createHovercardStore(props = {}) {
18
18
  var _a;
19
19
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
- const popover = _EFIT5L4Xcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
- placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
20
+ const popover = _E53JW5BDcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
+ placement: _KBNYGXWIcjs.defaultValue.call(void 0,
22
22
  props.placement,
23
23
  syncState == null ? void 0 : syncState.placement,
24
24
  "bottom"
25
25
  )
26
26
  }));
27
- const timeout = _3UT5FE6Kcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
27
+ const timeout = _KBNYGXWIcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
28
28
  const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover.getState()), {
29
29
  timeout,
30
- showTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
31
- hideTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
32
- autoFocusOnShow: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
30
+ showTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
31
+ hideTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
32
+ autoFocusOnShow: _KBNYGXWIcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
33
33
  });
34
- const hovercard = _2UK5WUJXcjs.createStore.call(void 0, initialState, popover, props.store);
34
+ const hovercard = _F6HPKLO2cjs.createStore.call(void 0, initialState, popover, props.store);
35
35
  return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
36
36
  setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
37
37
  });
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
5
+ var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
6
6
 
7
7
 
8
- var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
8
+ var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
9
9
 
10
10
 
11
11
 
@@ -14,17 +14,17 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
14
14
  // src/checkbox/checkbox-store.ts
15
15
  function createCheckboxStore(props = {}) {
16
16
  var _a;
17
- _2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, props.store);
17
+ _F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, props.store);
18
18
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
19
19
  const initialState = {
20
- value: _3UT5FE6Kcjs.defaultValue.call(void 0,
20
+ value: _KBNYGXWIcjs.defaultValue.call(void 0,
21
21
  props.value,
22
22
  syncState == null ? void 0 : syncState.value,
23
23
  props.defaultValue,
24
24
  false
25
25
  )
26
26
  };
27
- const checkbox = _2UK5WUJXcjs.createStore.call(void 0, initialState, props.store);
27
+ const checkbox = _F6HPKLO2cjs.createStore.call(void 0, initialState, props.store);
28
28
  return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, checkbox), {
29
29
  setValue: (value) => checkbox.setState("value", value)
30
30
  });
@@ -17,7 +17,8 @@ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStore
17
17
  }
18
18
  export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
19
19
  /**
20
- * Sets the `value` state.
20
+ * Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
21
+ * state.
21
22
  * @example
22
23
  * store.setValue(true);
23
24
  * store.setValue((value) => !value);
@@ -26,7 +27,9 @@ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxS
26
27
  }
27
28
  export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
28
29
  /**
29
- * The default value of the checkbox.
30
+ * The default
31
+ * [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
32
+ * the checkbox.
30
33
  *
31
34
  * Live examples:
32
35
  * - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
@@ -17,7 +17,8 @@ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStore
17
17
  }
18
18
  export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
19
19
  /**
20
- * Sets the `value` state.
20
+ * Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
21
+ * state.
21
22
  * @example
22
23
  * store.setValue(true);
23
24
  * store.setValue((value) => !value);
@@ -26,7 +27,9 @@ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxS
26
27
  }
27
28
  export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
28
29
  /**
29
- * The default value of the checkbox.
30
+ * The default
31
+ * [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
32
+ * the checkbox.
30
33
  *
31
34
  * Live examples:
32
35
  * - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _UCLKUBNPcjs = require('../__chunks/UCLKUBNP.cjs');
5
- require('../__chunks/2UK5WUJX.cjs');
6
- require('../__chunks/3UT5FE6K.cjs');
4
+ var _MI6NUQYQcjs = require('../__chunks/MI6NUQYQ.cjs');
5
+ require('../__chunks/F6HPKLO2.cjs');
6
+ require('../__chunks/KBNYGXWI.cjs');
7
7
  require('../__chunks/5F4DVUNS.cjs');
8
8
  require('../__chunks/AV6KTKLE.cjs');
9
9
 
10
10
 
11
- exports.createCollectionStore = _UCLKUBNPcjs.createCollectionStore;
11
+ exports.createCollectionStore = _MI6NUQYQcjs.createCollectionStore;