@ariakit/core 0.2.5 → 0.2.7

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 (75) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cjs/__chunks/{5LY57557.cjs → 5AWPMH4S.cjs} +14 -14
  3. package/cjs/__chunks/{7JIMFSGQ.cjs → K2LZWNNX.cjs} +2 -2
  4. package/cjs/__chunks/NVEPU4WA.cjs +41 -0
  5. package/cjs/__chunks/{LRIRZ7WW.cjs → PR7FUI5D.cjs} +19 -19
  6. package/cjs/__chunks/{M6ZA7XUP.cjs → RCYVACJO.cjs} +2 -2
  7. package/cjs/__chunks/{IRBRPEUG.cjs → RS4LBZRZ.cjs} +10 -10
  8. package/cjs/__chunks/{KMOWCPL4.cjs → SXMUYOXB.cjs} +32 -26
  9. package/cjs/__chunks/{4Q3ZC7KF.cjs → ZXPKRPGY.cjs} +14 -14
  10. package/cjs/checkbox/checkbox-store.cjs +6 -6
  11. package/cjs/collection/collection-store.cjs +5 -5
  12. package/cjs/combobox/combobox-store.cjs +24 -24
  13. package/cjs/composite/composite-overflow-store.cjs +7 -7
  14. package/cjs/composite/composite-store.cjs +6 -6
  15. package/cjs/dialog/dialog-store.cjs +6 -6
  16. package/cjs/disclosure/disclosure-store.cjs +5 -5
  17. package/cjs/form/form-store.cjs +24 -24
  18. package/cjs/hovercard/hovercard-store.cjs +8 -8
  19. package/cjs/index.cjs +1 -1
  20. package/cjs/menu/menu-bar-store.cjs +8 -8
  21. package/cjs/menu/menu-store.cjs +23 -23
  22. package/cjs/popover/popover-store.cjs +7 -7
  23. package/cjs/radio/radio-store.cjs +12 -12
  24. package/cjs/select/select-store.cjs +25 -25
  25. package/cjs/tab/tab-store.cjs +15 -15
  26. package/cjs/toolbar/toolbar-store.cjs +8 -8
  27. package/cjs/tooltip/tooltip-store.cjs +15 -15
  28. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  29. package/cjs/utils/array.cjs +1 -1
  30. package/cjs/utils/dom.cjs +1 -1
  31. package/cjs/utils/events.cjs +3 -3
  32. package/cjs/utils/focus.cjs +2 -2
  33. package/cjs/utils/misc.cjs +3 -3
  34. package/cjs/utils/platform.cjs +1 -1
  35. package/cjs/utils/store.cjs +4 -4
  36. package/cjs/utils/types.d.ts +4 -0
  37. package/esm/__chunks/{LK6LFO7X.js → FQL4TRMX.js} +2 -2
  38. package/esm/__chunks/{3HOKSVPG.js → L5RO76KW.js} +3 -3
  39. package/esm/__chunks/{U5NFQJHX.js → LM4QG55U.js} +4 -4
  40. package/esm/__chunks/{IWUEUGOJ.js → NRXA5QTV.js} +4 -4
  41. package/esm/__chunks/{WCRCSMN5.js → SHUO6V52.js} +26 -20
  42. package/esm/__chunks/{4F3NSHNZ.js → UWW2ZP3K.js} +1 -1
  43. package/esm/__chunks/{NWU4GBZ6.js → WVTCK5PV.js} +1 -1
  44. package/esm/__chunks/{TBCDDKVT.js → XJGRXN57.js} +4 -4
  45. package/esm/checkbox/checkbox-store.js +3 -3
  46. package/esm/collection/collection-store.js +4 -4
  47. package/esm/combobox/combobox-store.js +8 -8
  48. package/esm/composite/composite-overflow-store.js +6 -6
  49. package/esm/composite/composite-store.js +5 -5
  50. package/esm/dialog/dialog-store.js +5 -5
  51. package/esm/disclosure/disclosure-store.js +4 -4
  52. package/esm/form/form-store.js +4 -4
  53. package/esm/hovercard/hovercard-store.js +7 -7
  54. package/esm/index.js +1 -1
  55. package/esm/menu/menu-bar-store.js +5 -5
  56. package/esm/menu/menu-store.js +9 -9
  57. package/esm/popover/popover-store.js +6 -6
  58. package/esm/radio/radio-store.js +5 -5
  59. package/esm/select/select-store.js +8 -8
  60. package/esm/tab/tab-store.js +5 -5
  61. package/esm/toolbar/toolbar-store.js +5 -5
  62. package/esm/tooltip/tooltip-store.js +7 -7
  63. package/esm/tsconfig.build.tsbuildinfo +1 -1
  64. package/esm/utils/array.js +1 -1
  65. package/esm/utils/dom.js +1 -1
  66. package/esm/utils/events.js +1 -1
  67. package/esm/utils/focus.js +1 -1
  68. package/esm/utils/misc.js +2 -2
  69. package/esm/utils/platform.js +1 -1
  70. package/esm/utils/store.js +3 -3
  71. package/esm/utils/types.d.ts +4 -0
  72. package/package.json +1 -1
  73. package/cjs/__chunks/XBF2IZLR.cjs +0 -41
  74. /package/cjs/__chunks/{6455U47T.cjs → 72I2GWXF.cjs} +0 -0
  75. /package/esm/__chunks/{4BKCJXBM.js → PNRLI7OV.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ariakit/core
2
2
 
3
+ ## 0.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Added new `EmptyObject` type export to `@ariakit/core/utils/types`. ([#2553](https://github.com/ariakit/ariakit/pull/2553))
8
+
9
+ ## 0.2.6
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed `defaultItems` passed to the collection store being overriden when new items are added. ([#2559](https://github.com/ariakit/ariakit/pull/2559))
14
+
3
15
  ## 0.2.5
4
16
 
5
17
  ### Patch Changes
@@ -6,11 +6,11 @@
6
6
 
7
7
 
8
8
 
9
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
9
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
10
10
 
11
11
 
12
12
 
13
- var _6455U47Tcjs = require('./6455U47T.cjs');
13
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
14
14
 
15
15
  // src/utils/store.ts
16
16
  function createStore(initialState, ...stores) {
@@ -30,18 +30,18 @@ function createStore(initialState, ...stores) {
30
30
  };
31
31
  const init = () => {
32
32
  if (initialized)
33
- return _M6ZA7XUPcjs.noop;
33
+ return _RCYVACJOcjs.noop;
34
34
  if (!stores.length)
35
- return _M6ZA7XUPcjs.noop;
35
+ return _RCYVACJOcjs.noop;
36
36
  initialized = true;
37
- const desyncs = _M6ZA7XUPcjs.getKeys.call(void 0, state).map(
38
- (key) => _M6ZA7XUPcjs.chain.call(void 0,
37
+ const desyncs = _RCYVACJOcjs.getKeys.call(void 0, state).map(
38
+ (key) => _RCYVACJOcjs.chain.call(void 0,
39
39
  ...stores.map((store) => {
40
40
  var _a, _b;
41
41
  const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
42
42
  if (!storeState)
43
43
  return;
44
- if (!_M6ZA7XUPcjs.hasOwnProperty.call(void 0, storeState, key))
44
+ if (!_RCYVACJOcjs.hasOwnProperty.call(void 0, storeState, key))
45
45
  return;
46
46
  return (_b = store == null ? void 0 : store.sync) == null ? void 0 : _b.call(store, (state2) => setState(key, state2[key]), [key]);
47
47
  })
@@ -53,7 +53,7 @@ function createStore(initialState, ...stores) {
53
53
  var _a;
54
54
  return (_a = store == null ? void 0 : store.init) == null ? void 0 : _a.call(store);
55
55
  });
56
- return _M6ZA7XUPcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups, () => {
56
+ return _RCYVACJOcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups, () => {
57
57
  initialized = false;
58
58
  });
59
59
  };
@@ -80,9 +80,9 @@ function createStore(initialState, ...stores) {
80
80
  };
81
81
  const getState = () => state;
82
82
  const setState = (key, value) => {
83
- if (!_M6ZA7XUPcjs.hasOwnProperty.call(void 0, state, key))
83
+ if (!_RCYVACJOcjs.hasOwnProperty.call(void 0, state, key))
84
84
  return;
85
- const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, state[key]);
85
+ const nextValue = _RCYVACJOcjs.applyState.call(void 0, value, state[key]);
86
86
  if (nextValue === state[key])
87
87
  return;
88
88
  stores.forEach((store) => {
@@ -90,7 +90,7 @@ function createStore(initialState, ...stores) {
90
90
  (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
91
91
  });
92
92
  const prevState = state;
93
- state = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
93
+ state = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
94
94
  const thisUpdate = Symbol();
95
95
  lastUpdate = thisUpdate;
96
96
  updatedKeys.add(key);
@@ -115,8 +115,8 @@ function createStore(initialState, ...stores) {
115
115
  updatedKeys.clear();
116
116
  });
117
117
  };
118
- const pick2 = (...keys) => createStore(_M6ZA7XUPcjs.pick.call(void 0, state, keys), finalStore);
119
- const omit2 = (...keys) => createStore(_M6ZA7XUPcjs.omit.call(void 0, state, keys), finalStore);
118
+ const pick2 = (...keys) => createStore(_RCYVACJOcjs.pick.call(void 0, state, keys), finalStore);
119
+ const omit2 = (...keys) => createStore(_RCYVACJOcjs.omit.call(void 0, state, keys), finalStore);
120
120
  const finalStore = {
121
121
  setup,
122
122
  init,
@@ -136,7 +136,7 @@ function mergeStore(...stores) {
136
136
  const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
137
137
  if (!nextState)
138
138
  return state;
139
- return _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), nextState);
139
+ return _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, state), nextState);
140
140
  }, {});
141
141
  const store = createStore(initialState, ...stores);
142
142
  return store;
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _IRBRPEUGcjs = require('./IRBRPEUG.cjs');
3
+ var _RS4LBZRZcjs = require('./RS4LBZRZ.cjs');
4
4
 
5
5
  // src/dialog/dialog-store.ts
6
6
  function createDialogStore(props = {}) {
7
- return _IRBRPEUGcjs.createDisclosureStore.call(void 0, props);
7
+ return _RS4LBZRZcjs.createDisclosureStore.call(void 0, props);
8
8
  }
9
9
 
10
10
 
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _ZXPKRPGYcjs = require('./ZXPKRPGY.cjs');
4
+
5
+
6
+ var _5AWPMH4Scjs = require('./5AWPMH4S.cjs');
7
+
8
+
9
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
10
+
11
+
12
+
13
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
14
+
15
+ // src/hovercard/hovercard-store.ts
16
+ function createHovercardStore(props = {}) {
17
+ var _a;
18
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
19
+ const popover = _ZXPKRPGYcjs.createPopoverStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
20
+ placement: _RCYVACJOcjs.defaultValue.call(void 0,
21
+ props.placement,
22
+ syncState == null ? void 0 : syncState.placement,
23
+ "bottom"
24
+ )
25
+ }));
26
+ const timeout = _RCYVACJOcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
27
+ const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, popover.getState()), {
28
+ timeout,
29
+ showTimeout: _RCYVACJOcjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
30
+ hideTimeout: _RCYVACJOcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
31
+ autoFocusOnShow: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
32
+ });
33
+ const hovercard = _5AWPMH4Scjs.createStore.call(void 0, initialState, popover, props.store);
34
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
35
+ setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
36
+ });
37
+ }
38
+
39
+
40
+
41
+ exports.createHovercardStore = createHovercardStore;
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _KMOWCPL4cjs = require('./KMOWCPL4.cjs');
3
+ var _SXMUYOXBcjs = require('./SXMUYOXB.cjs');
4
4
 
5
5
 
6
- var _5LY57557cjs = require('./5LY57557.cjs');
6
+ var _5AWPMH4Scjs = require('./5AWPMH4S.cjs');
7
7
 
8
8
 
9
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
9
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
10
10
 
11
11
 
12
12
 
@@ -14,7 +14,7 @@ var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
14
14
 
15
15
 
16
16
 
17
- var _6455U47Tcjs = require('./6455U47T.cjs');
17
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
18
18
 
19
19
  // src/composite/composite-store.ts
20
20
  var NULL_ITEM = { id: null };
@@ -105,7 +105,7 @@ function verticalizeItems(items) {
105
105
  for (const row of rows) {
106
106
  const item = row[i];
107
107
  if (item) {
108
- verticalized.push(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, item), {
108
+ verticalized.push(_72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, item), {
109
109
  // If there's no rowId, it means that it's not a grid composite, but
110
110
  // a single row instead. So, instead of verticalizing it, that is,
111
111
  // assigning a different rowId based on the column index, we keep it
@@ -121,37 +121,37 @@ function verticalizeItems(items) {
121
121
  function createCompositeStore(props = {}) {
122
122
  var _a;
123
123
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
124
- const collection = _KMOWCPL4cjs.createCollectionStore.call(void 0, props);
125
- const activeId = _M6ZA7XUPcjs.defaultValue.call(void 0,
124
+ const collection = _SXMUYOXBcjs.createCollectionStore.call(void 0, props);
125
+ const activeId = _RCYVACJOcjs.defaultValue.call(void 0,
126
126
  props.activeId,
127
127
  syncState == null ? void 0 : syncState.activeId,
128
128
  props.defaultActiveId
129
129
  );
130
- const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection.getState()), {
130
+ const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, collection.getState()), {
131
131
  activeId,
132
- baseElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
133
- includesBaseElement: _M6ZA7XUPcjs.defaultValue.call(void 0,
132
+ baseElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
133
+ includesBaseElement: _RCYVACJOcjs.defaultValue.call(void 0,
134
134
  props.includesBaseElement,
135
135
  syncState == null ? void 0 : syncState.includesBaseElement,
136
136
  activeId === null
137
137
  ),
138
- moves: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
139
- orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
138
+ moves: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
139
+ orientation: _RCYVACJOcjs.defaultValue.call(void 0,
140
140
  props.orientation,
141
141
  syncState == null ? void 0 : syncState.orientation,
142
142
  "both"
143
143
  ),
144
- rtl: _M6ZA7XUPcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
145
- virtualFocus: _M6ZA7XUPcjs.defaultValue.call(void 0,
144
+ rtl: _RCYVACJOcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
145
+ virtualFocus: _RCYVACJOcjs.defaultValue.call(void 0,
146
146
  props.virtualFocus,
147
147
  syncState == null ? void 0 : syncState.virtualFocus,
148
148
  false
149
149
  ),
150
- focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
151
- focusWrap: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
152
- focusShift: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
150
+ focusLoop: _RCYVACJOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
151
+ focusWrap: _RCYVACJOcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
152
+ focusShift: _RCYVACJOcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
153
153
  });
154
- const composite = _5LY57557cjs.createStore.call(void 0, initialState, collection, props.store);
154
+ const composite = _5AWPMH4Scjs.createStore.call(void 0, initialState, collection, props.store);
155
155
  composite.setup(
156
156
  () => composite.sync(
157
157
  (state) => {
@@ -223,7 +223,7 @@ function createCompositeStore(props = {}) {
223
223
  }
224
224
  return nextItem == null ? void 0 : nextItem.id;
225
225
  };
226
- return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection), composite), {
226
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, collection), composite), {
227
227
  setBaseElement: (element) => composite.setState("baseElement", element),
228
228
  setActiveId: (id) => composite.setState("activeId", id),
229
229
  move: (id) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _6455U47Tcjs = require('./6455U47T.cjs');
3
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
4
4
 
5
5
  // src/utils/misc.ts
6
6
  function noop(..._) {
@@ -80,7 +80,7 @@ function normalizeString(str) {
80
80
  return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
81
81
  }
82
82
  function omit(object, keys) {
83
- const result = _6455U47Tcjs.__spreadValues.call(void 0, {}, object);
83
+ const result = _72I2GWXFcjs.__spreadValues.call(void 0, {}, object);
84
84
  for (const key of keys) {
85
85
  if (hasOwnProperty(result, key)) {
86
86
  delete result[key];
@@ -1,39 +1,39 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _5LY57557cjs = require('./5LY57557.cjs');
4
+ var _5AWPMH4Scjs = require('./5AWPMH4S.cjs');
5
5
 
6
6
 
7
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
7
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
8
8
 
9
9
 
10
10
 
11
- var _6455U47Tcjs = require('./6455U47T.cjs');
11
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
12
12
 
13
13
  // src/disclosure/disclosure-store.ts
14
14
  function createDisclosureStore(props = {}) {
15
15
  var _a;
16
- const store = _5LY57557cjs.mergeStore.call(void 0,
16
+ const store = _5AWPMH4Scjs.mergeStore.call(void 0,
17
17
  props.store,
18
18
  (_a = props.disclosure) == null ? void 0 : _a.omit("contentElement", "disclosureElement")
19
19
  );
20
20
  const syncState = store == null ? void 0 : store.getState();
21
- const open = _M6ZA7XUPcjs.defaultValue.call(void 0,
21
+ const open = _RCYVACJOcjs.defaultValue.call(void 0,
22
22
  props.open,
23
23
  syncState == null ? void 0 : syncState.open,
24
24
  props.defaultOpen,
25
25
  false
26
26
  );
27
- const animated = _M6ZA7XUPcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
27
+ const animated = _RCYVACJOcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
28
28
  const initialState = {
29
29
  open,
30
30
  animated,
31
31
  animating: !!animated && open,
32
32
  mounted: open,
33
- contentElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
34
- disclosureElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
33
+ contentElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
34
+ disclosureElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
35
35
  };
36
- const disclosure = _5LY57557cjs.createStore.call(void 0, initialState, store);
36
+ const disclosure = _5AWPMH4Scjs.createStore.call(void 0, initialState, store);
37
37
  disclosure.setup(
38
38
  () => disclosure.sync(
39
39
  (state) => {
@@ -64,7 +64,7 @@ function createDisclosureStore(props = {}) {
64
64
  ["open", "animating"]
65
65
  )
66
66
  );
67
- return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, disclosure), {
67
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, disclosure), {
68
68
  setOpen: (value) => disclosure.setState("open", value),
69
69
  show: () => disclosure.setState("open", true),
70
70
  hide: () => disclosure.setState("open", false),
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _5LY57557cjs = require('./5LY57557.cjs');
3
+ var _5AWPMH4Scjs = require('./5AWPMH4S.cjs');
4
4
 
5
5
 
6
6
 
7
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
7
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
8
8
 
9
9
 
10
10
  var _EXM2AW52cjs = require('./EXM2AW52.cjs');
11
11
 
12
12
 
13
13
 
14
- var _6455U47Tcjs = require('./6455U47T.cjs');
14
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
15
15
 
16
16
  // src/collection/collection-store.ts
17
17
  function isElementPreceding(a, b) {
@@ -61,16 +61,22 @@ function getCommonParent(items) {
61
61
  }
62
62
  function createCollectionStore(props = {}) {
63
63
  var _a;
64
- const itemsMap = /* @__PURE__ */ new Map();
65
64
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
65
+ const items = _RCYVACJOcjs.defaultValue.call(void 0,
66
+ props.items,
67
+ syncState == null ? void 0 : syncState.items,
68
+ props.defaultItems,
69
+ []
70
+ );
71
+ const itemsMap = new Map(items.map((item) => [item.id, item]));
66
72
  const initialState = {
67
- items: _M6ZA7XUPcjs.defaultValue.call(void 0, props.items, syncState == null ? void 0 : syncState.items, props.defaultItems, []),
68
- renderedItems: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
73
+ items,
74
+ renderedItems: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
69
75
  };
70
- const privateStore = _5LY57557cjs.createStore.call(void 0, {
76
+ const privateStore = _5AWPMH4Scjs.createStore.call(void 0, {
71
77
  renderedItems: initialState.renderedItems
72
78
  });
73
- const collection = _5LY57557cjs.createStore.call(void 0, initialState, props.store);
79
+ const collection = _5AWPMH4Scjs.createStore.call(void 0, initialState, props.store);
74
80
  const sortItems = () => {
75
81
  const state = privateStore.getState();
76
82
  const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
@@ -95,9 +101,9 @@ function createCollectionStore(props = {}) {
95
101
  const root = getCommonParent(state.renderedItems);
96
102
  const observer = new IntersectionObserver(callback, { root });
97
103
  state.renderedItems.forEach((item) => {
98
- if (item.element) {
99
- observer.observe(item.element);
100
- }
104
+ if (!item.element)
105
+ return;
106
+ observer.observe(item.element);
101
107
  });
102
108
  return () => {
103
109
  cancelAnimationFrame(raf);
@@ -109,12 +115,12 @@ function createCollectionStore(props = {}) {
109
115
  });
110
116
  const mergeItem = (item, setItems, canDeleteFromMap = false) => {
111
117
  let prevItem;
112
- setItems((items) => {
113
- const index = itemsMap.get(item.id) && items.findIndex(({ id }) => id === item.id);
114
- const nextItems = items.slice();
115
- if (index && index >= 0) {
116
- prevItem = items[index];
117
- const nextItem = _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, prevItem), item);
118
+ setItems((items2) => {
119
+ const index = items2.findIndex(({ id }) => id === item.id);
120
+ const nextItems = items2.slice();
121
+ if (index !== -1) {
122
+ prevItem = items2[index];
123
+ const nextItem = _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, prevItem), item);
118
124
  nextItems[index] = nextItem;
119
125
  itemsMap.set(item.id, nextItem);
120
126
  } else {
@@ -124,17 +130,17 @@ function createCollectionStore(props = {}) {
124
130
  return nextItems;
125
131
  });
126
132
  const unmergeItem = () => {
127
- setItems((items) => {
133
+ setItems((items2) => {
128
134
  if (!prevItem) {
129
135
  if (canDeleteFromMap) {
130
136
  itemsMap.delete(item.id);
131
137
  }
132
- return items.filter(({ id }) => id !== item.id);
138
+ return items2.filter(({ id }) => id !== item.id);
133
139
  }
134
- const index = items.findIndex(({ id }) => id === item.id);
140
+ const index = items2.findIndex(({ id }) => id === item.id);
135
141
  if (index === -1)
136
- return items;
137
- const nextItems = items.slice();
142
+ return items2;
143
+ const nextItems = items2.slice();
138
144
  nextItems[index] = prevItem;
139
145
  itemsMap.set(item.id, prevItem);
140
146
  return nextItems;
@@ -143,9 +149,9 @@ function createCollectionStore(props = {}) {
143
149
  return unmergeItem;
144
150
  };
145
151
  const registerItem = (item) => mergeItem(item, (getItems) => collection.setState("items", getItems), true);
146
- return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection), {
152
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, collection), {
147
153
  registerItem,
148
- renderItem: (item) => _M6ZA7XUPcjs.chain.call(void 0,
154
+ renderItem: (item) => _RCYVACJOcjs.chain.call(void 0,
149
155
  registerItem(item),
150
156
  mergeItem(
151
157
  item,
@@ -157,8 +163,8 @@ function createCollectionStore(props = {}) {
157
163
  return null;
158
164
  let item = itemsMap.get(id);
159
165
  if (!item) {
160
- const { items } = collection.getState();
161
- item = items.find((item2) => item2.id === id);
166
+ const { items: items2 } = collection.getState();
167
+ item = items2.find((item2) => item2.id === id);
162
168
  if (item) {
163
169
  itemsMap.set(id, item);
164
170
  }
@@ -1,27 +1,27 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _7JIMFSGQcjs = require('./7JIMFSGQ.cjs');
3
+ var _K2LZWNNXcjs = require('./K2LZWNNX.cjs');
4
4
 
5
5
 
6
6
 
7
- var _5LY57557cjs = require('./5LY57557.cjs');
7
+ var _5AWPMH4Scjs = require('./5AWPMH4S.cjs');
8
8
 
9
9
 
10
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
10
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
11
11
 
12
12
 
13
13
 
14
14
 
15
- var _6455U47Tcjs = require('./6455U47T.cjs');
15
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
16
16
 
17
17
  // src/popover/popover-store.ts
18
18
  function createPopoverStore(_a = {}) {
19
19
  var _b = _a, {
20
20
  popover: otherPopover
21
- } = _b, props = _6455U47Tcjs.__objRest.call(void 0, _b, [
21
+ } = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
22
22
  "popover"
23
23
  ]);
24
- const store = _5LY57557cjs.mergeStore.call(void 0,
24
+ const store = _5AWPMH4Scjs.mergeStore.call(void 0,
25
25
  props.store,
26
26
  otherPopover == null ? void 0 : otherPopover.omit(
27
27
  "arrowElement",
@@ -32,22 +32,22 @@ function createPopoverStore(_a = {}) {
32
32
  )
33
33
  );
34
34
  const syncState = store == null ? void 0 : store.getState();
35
- const dialog = _7JIMFSGQcjs.createDialogStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), { store }));
36
- const placement = _M6ZA7XUPcjs.defaultValue.call(void 0,
35
+ const dialog = _K2LZWNNXcjs.createDialogStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), { store }));
36
+ const placement = _RCYVACJOcjs.defaultValue.call(void 0,
37
37
  props.placement,
38
38
  syncState == null ? void 0 : syncState.placement,
39
39
  "bottom"
40
40
  );
41
- const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
41
+ const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
42
42
  placement,
43
43
  currentPlacement: placement,
44
- anchorElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
45
- popoverElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
46
- arrowElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
44
+ anchorElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
45
+ popoverElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
46
+ arrowElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
47
47
  rendered: Symbol("rendered")
48
48
  });
49
- const popover = _5LY57557cjs.createStore.call(void 0, initialState, dialog, store);
50
- return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, dialog), popover), {
49
+ const popover = _5AWPMH4Scjs.createStore.call(void 0, initialState, dialog, store);
50
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, dialog), popover), {
51
51
  setAnchorElement: (element) => popover.setState("anchorElement", element),
52
52
  setPopoverElement: (element) => popover.setState("popoverElement", element),
53
53
  setArrowElement: (element) => popover.setState("arrowElement", element),
@@ -1,28 +1,28 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _5LY57557cjs = require('../__chunks/5LY57557.cjs');
3
+ var _5AWPMH4Scjs = require('../__chunks/5AWPMH4S.cjs');
4
4
 
5
5
 
6
- var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
6
+ var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
7
7
 
8
8
 
9
9
 
10
- var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
10
+ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
11
11
 
12
12
  // src/checkbox/checkbox-store.ts
13
13
  function createCheckboxStore(props = {}) {
14
14
  var _a;
15
15
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
16
16
  const initialState = {
17
- value: _M6ZA7XUPcjs.defaultValue.call(void 0,
17
+ value: _RCYVACJOcjs.defaultValue.call(void 0,
18
18
  props.value,
19
19
  syncState == null ? void 0 : syncState.value,
20
20
  props.defaultValue,
21
21
  false
22
22
  )
23
23
  };
24
- const checkbox = _5LY57557cjs.createStore.call(void 0, initialState, props.store);
25
- return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, checkbox), {
24
+ const checkbox = _5AWPMH4Scjs.createStore.call(void 0, initialState, props.store);
25
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, checkbox), {
26
26
  setValue: (value) => checkbox.setState("value", value)
27
27
  });
28
28
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _KMOWCPL4cjs = require('../__chunks/KMOWCPL4.cjs');
4
- require('../__chunks/5LY57557.cjs');
5
- require('../__chunks/M6ZA7XUP.cjs');
3
+ var _SXMUYOXBcjs = require('../__chunks/SXMUYOXB.cjs');
4
+ require('../__chunks/5AWPMH4S.cjs');
5
+ require('../__chunks/RCYVACJO.cjs');
6
6
  require('../__chunks/EXM2AW52.cjs');
7
- require('../__chunks/6455U47T.cjs');
7
+ require('../__chunks/72I2GWXF.cjs');
8
8
 
9
9
 
10
- exports.createCollectionStore = _KMOWCPL4cjs.createCollectionStore;
10
+ exports.createCollectionStore = _SXMUYOXBcjs.createCollectionStore;