@ariakit/core 0.2.6 → 0.2.8

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 (80) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/cjs/__chunks/{4Q3ZC7KF.cjs → DPHJ32KR.cjs} +17 -16
  3. package/cjs/__chunks/{O7U3LRFL.cjs → F5DMXFQ2.cjs} +37 -38
  4. package/cjs/__chunks/{5LY57557.cjs → FS2K2N7U.cjs} +84 -37
  5. package/cjs/__chunks/MCCIH6SG.cjs +41 -0
  6. package/cjs/__chunks/{WUNFMQBI.cjs → OQIG5VE3.cjs} +31 -31
  7. package/cjs/__chunks/{7JIMFSGQ.cjs → PIEJYPN7.cjs} +2 -2
  8. package/cjs/__chunks/{M6ZA7XUP.cjs → RCYVACJO.cjs} +2 -2
  9. package/cjs/__chunks/V7OHZPBO.cjs +76 -0
  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 +67 -70
  13. package/cjs/combobox/combobox-store.d.ts +1 -1
  14. package/cjs/composite/composite-overflow-store.cjs +7 -7
  15. package/cjs/composite/composite-store.cjs +6 -6
  16. package/cjs/dialog/dialog-store.cjs +6 -6
  17. package/cjs/disclosure/disclosure-store.cjs +5 -5
  18. package/cjs/form/form-store.cjs +24 -24
  19. package/cjs/hovercard/hovercard-store.cjs +8 -8
  20. package/cjs/index.cjs +1 -1
  21. package/cjs/menu/menu-bar-store.cjs +8 -8
  22. package/cjs/menu/menu-store.cjs +35 -34
  23. package/cjs/popover/popover-store.cjs +7 -7
  24. package/cjs/radio/radio-store.cjs +12 -12
  25. package/cjs/select/select-store.cjs +80 -82
  26. package/cjs/tab/tab-store.cjs +63 -64
  27. package/cjs/toolbar/toolbar-store.cjs +8 -8
  28. package/cjs/tooltip/tooltip-store.cjs +15 -15
  29. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  30. package/cjs/utils/array.cjs +1 -1
  31. package/cjs/utils/dom.cjs +1 -1
  32. package/cjs/utils/events.cjs +3 -3
  33. package/cjs/utils/focus.cjs +2 -2
  34. package/cjs/utils/misc.cjs +3 -3
  35. package/cjs/utils/platform.cjs +1 -1
  36. package/cjs/utils/store.cjs +18 -4
  37. package/cjs/utils/store.d.ts +19 -59
  38. package/cjs/utils/types.d.ts +4 -0
  39. package/esm/__chunks/{QEFBF7I4.js → A7IMXABC.js} +31 -32
  40. package/esm/__chunks/{TBCDDKVT.js → COUCUJML.js} +4 -4
  41. package/esm/__chunks/{4F3NSHNZ.js → LNMWV6UV.js} +1 -1
  42. package/esm/__chunks/{LK6LFO7X.js → OGOHEUXI.js} +73 -26
  43. package/esm/__chunks/{WFO54Y6U.js → ROY5BBHL.js} +17 -17
  44. package/esm/__chunks/{U5NFQJHX.js → SOCHV2LZ.js} +8 -7
  45. package/esm/__chunks/{3HOKSVPG.js → WSKDP2MG.js} +29 -33
  46. package/esm/__chunks/{NWU4GBZ6.js → WVTCK5PV.js} +1 -1
  47. package/esm/checkbox/checkbox-store.js +3 -3
  48. package/esm/collection/collection-store.js +4 -4
  49. package/esm/combobox/combobox-store.d.ts +1 -1
  50. package/esm/combobox/combobox-store.js +52 -55
  51. package/esm/composite/composite-overflow-store.js +6 -6
  52. package/esm/composite/composite-store.js +5 -5
  53. package/esm/dialog/dialog-store.js +5 -5
  54. package/esm/disclosure/disclosure-store.js +4 -4
  55. package/esm/form/form-store.js +4 -4
  56. package/esm/hovercard/hovercard-store.js +7 -7
  57. package/esm/index.js +1 -1
  58. package/esm/menu/menu-bar-store.js +5 -5
  59. package/esm/menu/menu-store.js +22 -21
  60. package/esm/popover/popover-store.js +6 -6
  61. package/esm/radio/radio-store.js +5 -5
  62. package/esm/select/select-store.js +64 -66
  63. package/esm/tab/tab-store.js +55 -56
  64. package/esm/toolbar/toolbar-store.js +5 -5
  65. package/esm/tooltip/tooltip-store.js +7 -7
  66. package/esm/tsconfig.build.tsbuildinfo +1 -1
  67. package/esm/utils/array.js +1 -1
  68. package/esm/utils/dom.js +1 -1
  69. package/esm/utils/events.js +1 -1
  70. package/esm/utils/focus.js +1 -1
  71. package/esm/utils/misc.js +2 -2
  72. package/esm/utils/platform.js +1 -1
  73. package/esm/utils/store.d.ts +19 -59
  74. package/esm/utils/store.js +19 -5
  75. package/esm/utils/types.d.ts +4 -0
  76. package/package.json +1 -1
  77. package/cjs/__chunks/IRBRPEUG.cjs +0 -80
  78. package/cjs/__chunks/XBF2IZLR.cjs +0 -41
  79. /package/cjs/__chunks/{6455U47T.cjs → 72I2GWXF.cjs} +0 -0
  80. /package/esm/__chunks/{4BKCJXBM.js → PNRLI7OV.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ariakit/core
2
2
 
3
+ ## 0.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Removed private properties from the store object. ([#2706](https://github.com/ariakit/ariakit/pull/2706))
8
+
9
+ Instead of accessing `store.setup`, `store.sync`, `store.subscribe`, etc. directly, use the equivalent functions exported by the `@ariakit/core/utils/store` module.
10
+
11
+ ## 0.2.7
12
+
13
+ ### Patch Changes
14
+
15
+ - Added new `EmptyObject` type export to `@ariakit/core/utils/types`. ([#2553](https://github.com/ariakit/ariakit/pull/2553))
16
+
3
17
  ## 0.2.6
4
18
 
5
19
  ### Patch Changes
@@ -1,53 +1,54 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _7JIMFSGQcjs = require('./7JIMFSGQ.cjs');
3
+ var _PIEJYPN7cjs = require('./PIEJYPN7.cjs');
4
4
 
5
5
 
6
6
 
7
- var _5LY57557cjs = require('./5LY57557.cjs');
8
7
 
8
+ var _FS2K2N7Ucjs = require('./FS2K2N7U.cjs');
9
9
 
10
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
11
10
 
11
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
12
12
 
13
13
 
14
14
 
15
- var _6455U47Tcjs = require('./6455U47T.cjs');
15
+
16
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
16
17
 
17
18
  // src/popover/popover-store.ts
18
19
  function createPopoverStore(_a = {}) {
19
20
  var _b = _a, {
20
21
  popover: otherPopover
21
- } = _b, props = _6455U47Tcjs.__objRest.call(void 0, _b, [
22
+ } = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
22
23
  "popover"
23
24
  ]);
24
- const store = _5LY57557cjs.mergeStore.call(void 0,
25
+ const store = _FS2K2N7Ucjs.mergeStore.call(void 0,
25
26
  props.store,
26
- otherPopover == null ? void 0 : otherPopover.omit(
27
+ _FS2K2N7Ucjs.omit.call(void 0, otherPopover, [
27
28
  "arrowElement",
28
29
  "anchorElement",
29
30
  "contentElement",
30
31
  "popoverElement",
31
32
  "disclosureElement"
32
- )
33
+ ])
33
34
  );
34
35
  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,
36
+ const dialog = _PIEJYPN7cjs.createDialogStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), { store }));
37
+ const placement = _RCYVACJOcjs.defaultValue.call(void 0,
37
38
  props.placement,
38
39
  syncState == null ? void 0 : syncState.placement,
39
40
  "bottom"
40
41
  );
41
- const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
42
+ const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
42
43
  placement,
43
44
  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),
45
+ anchorElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
46
+ popoverElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
47
+ arrowElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
47
48
  rendered: Symbol("rendered")
48
49
  });
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), {
50
+ const popover = _FS2K2N7Ucjs.createStore.call(void 0, initialState, dialog, store);
51
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, dialog), popover), {
51
52
  setAnchorElement: (element) => popover.setState("anchorElement", element),
52
53
  setPopoverElement: (element) => popover.setState("popoverElement", element),
53
54
  setArrowElement: (element) => popover.setState("arrowElement", element),
@@ -1,17 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _5LY57557cjs = require('./5LY57557.cjs');
4
3
 
5
4
 
5
+ var _FS2K2N7Ucjs = require('./FS2K2N7U.cjs');
6
6
 
7
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
7
+
8
+
9
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
8
10
 
9
11
 
10
12
  var _EXM2AW52cjs = require('./EXM2AW52.cjs');
11
13
 
12
14
 
13
15
 
14
- var _6455U47Tcjs = require('./6455U47T.cjs');
16
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
15
17
 
16
18
  // src/collection/collection-store.ts
17
19
  function isElementPreceding(a, b) {
@@ -62,7 +64,7 @@ function getCommonParent(items) {
62
64
  function createCollectionStore(props = {}) {
63
65
  var _a;
64
66
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
65
- const items = _M6ZA7XUPcjs.defaultValue.call(void 0,
67
+ const items = _RCYVACJOcjs.defaultValue.call(void 0,
66
68
  props.items,
67
69
  syncState == null ? void 0 : syncState.items,
68
70
  props.defaultItems,
@@ -71,47 +73,44 @@ function createCollectionStore(props = {}) {
71
73
  const itemsMap = new Map(items.map((item) => [item.id, item]));
72
74
  const initialState = {
73
75
  items,
74
- renderedItems: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
76
+ renderedItems: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
75
77
  };
76
- const privateStore = _5LY57557cjs.createStore.call(void 0, {
78
+ const privateStore = _FS2K2N7Ucjs.createStore.call(void 0, {
77
79
  renderedItems: initialState.renderedItems
78
80
  });
79
- const collection = _5LY57557cjs.createStore.call(void 0, initialState, props.store);
81
+ const collection = _FS2K2N7Ucjs.createStore.call(void 0, initialState, props.store);
80
82
  const sortItems = () => {
81
83
  const state = privateStore.getState();
82
84
  const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
83
85
  privateStore.setState("renderedItems", renderedItems);
84
86
  collection.setState("renderedItems", renderedItems);
85
87
  };
86
- collection.setup(() => {
87
- return privateStore.syncBatch(
88
- (state) => {
89
- let firstRun = true;
90
- let raf = requestAnimationFrame(sortItems);
91
- if (typeof IntersectionObserver !== "function")
88
+ _FS2K2N7Ucjs.setup.call(void 0, collection, () => {
89
+ return _FS2K2N7Ucjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
90
+ let firstRun = true;
91
+ let raf = requestAnimationFrame(sortItems);
92
+ if (typeof IntersectionObserver !== "function")
93
+ return;
94
+ const callback = () => {
95
+ if (firstRun) {
96
+ firstRun = false;
92
97
  return;
93
- const callback = () => {
94
- if (firstRun) {
95
- firstRun = false;
96
- return;
97
- }
98
- cancelAnimationFrame(raf);
99
- raf = requestAnimationFrame(sortItems);
100
- };
101
- const root = getCommonParent(state.renderedItems);
102
- const observer = new IntersectionObserver(callback, { root });
103
- state.renderedItems.forEach((item) => {
104
- if (item.element) {
105
- observer.observe(item.element);
106
- }
107
- });
108
- return () => {
109
- cancelAnimationFrame(raf);
110
- observer.disconnect();
111
- };
112
- },
113
- ["renderedItems"]
114
- );
98
+ }
99
+ cancelAnimationFrame(raf);
100
+ raf = requestAnimationFrame(sortItems);
101
+ };
102
+ const root = getCommonParent(state.renderedItems);
103
+ const observer = new IntersectionObserver(callback, { root });
104
+ state.renderedItems.forEach((item) => {
105
+ if (!item.element)
106
+ return;
107
+ observer.observe(item.element);
108
+ });
109
+ return () => {
110
+ cancelAnimationFrame(raf);
111
+ observer.disconnect();
112
+ };
113
+ });
115
114
  });
116
115
  const mergeItem = (item, setItems, canDeleteFromMap = false) => {
117
116
  let prevItem;
@@ -120,7 +119,7 @@ function createCollectionStore(props = {}) {
120
119
  const nextItems = items2.slice();
121
120
  if (index !== -1) {
122
121
  prevItem = items2[index];
123
- const nextItem = _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, prevItem), item);
122
+ const nextItem = _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, prevItem), item);
124
123
  nextItems[index] = nextItem;
125
124
  itemsMap.set(item.id, nextItem);
126
125
  } else {
@@ -149,9 +148,9 @@ function createCollectionStore(props = {}) {
149
148
  return unmergeItem;
150
149
  };
151
150
  const registerItem = (item) => mergeItem(item, (getItems) => collection.setState("items", getItems), true);
152
- return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection), {
151
+ return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, collection), {
153
152
  registerItem,
154
- renderItem: (item) => _M6ZA7XUPcjs.chain.call(void 0,
153
+ renderItem: (item) => _RCYVACJOcjs.chain.call(void 0,
155
154
  registerItem(item),
156
155
  mergeItem(
157
156
  item,
@@ -6,13 +6,19 @@
6
6
 
7
7
 
8
8
 
9
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
10
9
 
10
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
11
11
 
12
12
 
13
- var _6455U47Tcjs = require('./6455U47T.cjs');
13
+
14
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
14
15
 
15
16
  // src/utils/store.ts
17
+ function getInternal(store, key) {
18
+ const internals = store.__unstableInternals;
19
+ _RCYVACJOcjs.invariant.call(void 0, internals, "Invalid store");
20
+ return internals[key];
21
+ }
16
22
  function createStore(initialState, ...stores) {
17
23
  let state = initialState;
18
24
  let prevStateBatch = state;
@@ -24,41 +30,38 @@ function createStore(initialState, ...stores) {
24
30
  const listenersBatch = /* @__PURE__ */ new Set();
25
31
  const disposables = /* @__PURE__ */ new WeakMap();
26
32
  const listenerKeys = /* @__PURE__ */ new WeakMap();
27
- const setup = (callback) => {
33
+ const storeSetup = (callback) => {
28
34
  setups.add(callback);
29
35
  return () => setups.delete(callback);
30
36
  };
31
- const init = () => {
37
+ const storeInit = () => {
32
38
  if (initialized)
33
- return _M6ZA7XUPcjs.noop;
39
+ return _RCYVACJOcjs.noop;
34
40
  if (!stores.length)
35
- return _M6ZA7XUPcjs.noop;
41
+ return _RCYVACJOcjs.noop;
36
42
  initialized = true;
37
- const desyncs = _M6ZA7XUPcjs.getKeys.call(void 0, state).map(
38
- (key) => _M6ZA7XUPcjs.chain.call(void 0,
43
+ const desyncs = _RCYVACJOcjs.getKeys.call(void 0, state).map(
44
+ (key) => _RCYVACJOcjs.chain.call(void 0,
39
45
  ...stores.map((store) => {
40
- var _a, _b;
46
+ var _a;
41
47
  const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
42
48
  if (!storeState)
43
49
  return;
44
- if (!_M6ZA7XUPcjs.hasOwnProperty.call(void 0, storeState, key))
50
+ if (!_RCYVACJOcjs.hasOwnProperty.call(void 0, storeState, key))
45
51
  return;
46
- return (_b = store == null ? void 0 : store.sync) == null ? void 0 : _b.call(store, (state2) => setState(key, state2[key]), [key]);
52
+ return sync(store, [key], (state2) => setState(key, state2[key]));
47
53
  })
48
54
  )
49
55
  );
50
56
  const teardowns = [];
51
57
  setups.forEach((setup2) => teardowns.push(setup2()));
52
- const cleanups = stores.map((store) => {
53
- var _a;
54
- return (_a = store == null ? void 0 : store.init) == null ? void 0 : _a.call(store);
55
- });
56
- return _M6ZA7XUPcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups, () => {
58
+ const cleanups = stores.map(init);
59
+ return _RCYVACJOcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups, () => {
57
60
  initialized = false;
58
61
  });
59
62
  };
60
- const sub = (listener, keys, batch = false) => {
61
- const set = batch ? listenersBatch : listeners;
63
+ const sub = (keys, listener, batch2 = false) => {
64
+ const set = batch2 ? listenersBatch : listeners;
62
65
  set.add(listener);
63
66
  listenerKeys.set(listener, keys);
64
67
  return () => {
@@ -69,20 +72,22 @@ function createStore(initialState, ...stores) {
69
72
  set.delete(listener);
70
73
  };
71
74
  };
72
- const subscribe = (listener, keys) => sub(listener, keys);
73
- const sync = (listener, keys) => {
75
+ const storeSubscribe = (keys, listener) => sub(keys, listener);
76
+ const storeSync = (keys, listener) => {
74
77
  disposables.set(listener, listener(state, state));
75
- return sub(listener, keys);
78
+ return sub(keys, listener);
76
79
  };
77
- const syncBatch = (listener, keys) => {
80
+ const storeBatch = (keys, listener) => {
78
81
  disposables.set(listener, listener(state, prevStateBatch));
79
- return sub(listener, keys, true);
82
+ return sub(keys, listener, true);
80
83
  };
84
+ const storePick = (keys) => createStore(_RCYVACJOcjs.pick.call(void 0, state, keys), finalStore);
85
+ const storeOmit = (keys) => createStore(_RCYVACJOcjs.omit.call(void 0, state, keys), finalStore);
81
86
  const getState = () => state;
82
87
  const setState = (key, value) => {
83
- if (!_M6ZA7XUPcjs.hasOwnProperty.call(void 0, state, key))
88
+ if (!_RCYVACJOcjs.hasOwnProperty.call(void 0, state, key))
84
89
  return;
85
- const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, state[key]);
90
+ const nextValue = _RCYVACJOcjs.applyState.call(void 0, value, state[key]);
86
91
  if (nextValue === state[key])
87
92
  return;
88
93
  stores.forEach((store) => {
@@ -90,7 +95,7 @@ function createStore(initialState, ...stores) {
90
95
  (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
91
96
  });
92
97
  const prevState = state;
93
- state = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
98
+ state = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
94
99
  const thisUpdate = Symbol();
95
100
  lastUpdate = thisUpdate;
96
101
  updatedKeys.add(key);
@@ -115,28 +120,63 @@ function createStore(initialState, ...stores) {
115
120
  updatedKeys.clear();
116
121
  });
117
122
  };
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);
120
123
  const finalStore = {
121
- setup,
122
- init,
123
- subscribe,
124
- sync,
125
- syncBatch,
126
124
  getState,
127
125
  setState,
128
- pick: pick2,
129
- omit: omit2
126
+ __unstableInternals: {
127
+ setup: storeSetup,
128
+ init: storeInit,
129
+ subscribe: storeSubscribe,
130
+ sync: storeSync,
131
+ batch: storeBatch,
132
+ pick: storePick,
133
+ omit: storeOmit
134
+ }
130
135
  };
131
136
  return finalStore;
132
137
  }
138
+ function setup(store, ...args) {
139
+ if (!store)
140
+ return;
141
+ return getInternal(store, "setup")(...args);
142
+ }
143
+ function init(store, ...args) {
144
+ if (!store)
145
+ return;
146
+ return getInternal(store, "init")(...args);
147
+ }
148
+ function subscribe(store, ...args) {
149
+ if (!store)
150
+ return;
151
+ return getInternal(store, "subscribe")(...args);
152
+ }
153
+ function sync(store, ...args) {
154
+ if (!store)
155
+ return;
156
+ return getInternal(store, "sync")(...args);
157
+ }
158
+ function batch(store, ...args) {
159
+ if (!store)
160
+ return;
161
+ return getInternal(store, "batch")(...args);
162
+ }
163
+ function omit2(store, ...args) {
164
+ if (!store)
165
+ return;
166
+ return getInternal(store, "omit")(...args);
167
+ }
168
+ function pick2(store, ...args) {
169
+ if (!store)
170
+ return;
171
+ return getInternal(store, "pick")(...args);
172
+ }
133
173
  function mergeStore(...stores) {
134
174
  const initialState = stores.reduce((state, store2) => {
135
175
  var _a;
136
176
  const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
137
177
  if (!nextState)
138
178
  return state;
139
- return _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, state), nextState);
179
+ return _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, state), nextState);
140
180
  }, {});
141
181
  const store = createStore(initialState, ...stores);
142
182
  return store;
@@ -145,4 +185,11 @@ function mergeStore(...stores) {
145
185
 
146
186
 
147
187
 
148
- exports.createStore = createStore; exports.mergeStore = mergeStore;
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+ exports.createStore = createStore; exports.setup = setup; exports.init = init; exports.subscribe = subscribe; exports.sync = sync; exports.batch = batch; exports.omit = omit2; exports.pick = pick2; exports.mergeStore = mergeStore;
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _DPHJ32KRcjs = require('./DPHJ32KR.cjs');
4
+
5
+
6
+ var _FS2K2N7Ucjs = require('./FS2K2N7U.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 = _DPHJ32KRcjs.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 = _FS2K2N7Ucjs.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,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _O7U3LRFLcjs = require('./O7U3LRFL.cjs');
3
+ var _F5DMXFQ2cjs = require('./F5DMXFQ2.cjs');
4
4
 
5
5
 
6
- var _5LY57557cjs = require('./5LY57557.cjs');
7
6
 
8
7
 
9
- var _M6ZA7XUPcjs = require('./M6ZA7XUP.cjs');
8
+ var _FS2K2N7Ucjs = require('./FS2K2N7U.cjs');
9
+
10
+
11
+ var _RCYVACJOcjs = require('./RCYVACJO.cjs');
10
12
 
11
13
 
12
14
 
@@ -14,7 +16,7 @@ var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
14
16
 
15
17
 
16
18
 
17
- var _6455U47Tcjs = require('./6455U47T.cjs');
19
+ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
18
20
 
19
21
  // src/composite/composite-store.ts
20
22
  var NULL_ITEM = { id: null };
@@ -105,7 +107,7 @@ function verticalizeItems(items) {
105
107
  for (const row of rows) {
106
108
  const item = row[i];
107
109
  if (item) {
108
- verticalized.push(_6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, item), {
110
+ verticalized.push(_72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, item), {
109
111
  // If there's no rowId, it means that it's not a grid composite, but
110
112
  // a single row instead. So, instead of verticalizing it, that is,
111
113
  // assigning a different rowId based on the column index, we keep it
@@ -121,49 +123,47 @@ function verticalizeItems(items) {
121
123
  function createCompositeStore(props = {}) {
122
124
  var _a;
123
125
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
124
- const collection = _O7U3LRFLcjs.createCollectionStore.call(void 0, props);
125
- const activeId = _M6ZA7XUPcjs.defaultValue.call(void 0,
126
+ const collection = _F5DMXFQ2cjs.createCollectionStore.call(void 0, props);
127
+ const activeId = _RCYVACJOcjs.defaultValue.call(void 0,
126
128
  props.activeId,
127
129
  syncState == null ? void 0 : syncState.activeId,
128
130
  props.defaultActiveId
129
131
  );
130
- const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection.getState()), {
132
+ const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, collection.getState()), {
131
133
  activeId,
132
- baseElement: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
133
- includesBaseElement: _M6ZA7XUPcjs.defaultValue.call(void 0,
134
+ baseElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
135
+ includesBaseElement: _RCYVACJOcjs.defaultValue.call(void 0,
134
136
  props.includesBaseElement,
135
137
  syncState == null ? void 0 : syncState.includesBaseElement,
136
138
  activeId === null
137
139
  ),
138
- moves: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
139
- orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
140
+ moves: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
141
+ orientation: _RCYVACJOcjs.defaultValue.call(void 0,
140
142
  props.orientation,
141
143
  syncState == null ? void 0 : syncState.orientation,
142
144
  "both"
143
145
  ),
144
- rtl: _M6ZA7XUPcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
145
- virtualFocus: _M6ZA7XUPcjs.defaultValue.call(void 0,
146
+ rtl: _RCYVACJOcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
147
+ virtualFocus: _RCYVACJOcjs.defaultValue.call(void 0,
146
148
  props.virtualFocus,
147
149
  syncState == null ? void 0 : syncState.virtualFocus,
148
150
  false
149
151
  ),
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)
152
+ focusLoop: _RCYVACJOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
153
+ focusWrap: _RCYVACJOcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
154
+ focusShift: _RCYVACJOcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
153
155
  });
154
- const composite = _5LY57557cjs.createStore.call(void 0, initialState, collection, props.store);
155
- composite.setup(
156
- () => composite.sync(
157
- (state) => {
158
- composite.setState("activeId", (activeId2) => {
159
- var _a2;
160
- if (activeId2 !== void 0)
161
- return activeId2;
162
- return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
163
- });
164
- },
165
- ["renderedItems", "activeId"]
166
- )
156
+ const composite = _FS2K2N7Ucjs.createStore.call(void 0, initialState, collection, props.store);
157
+ _FS2K2N7Ucjs.setup.call(void 0,
158
+ composite,
159
+ () => _FS2K2N7Ucjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
160
+ composite.setState("activeId", (activeId2) => {
161
+ var _a2;
162
+ if (activeId2 !== void 0)
163
+ return activeId2;
164
+ return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
165
+ });
166
+ })
167
167
  );
168
168
  const getNextId = (items, orientation, hasNullItem, skip) => {
169
169
  var _a2, _b;
@@ -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,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _IRBRPEUGcjs = require('./IRBRPEUG.cjs');
3
+ var _V7OHZPBOcjs = require('./V7OHZPBO.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 _V7OHZPBOcjs.createDisclosureStore.call(void 0, props);
8
8
  }
9
9
 
10
10
 
@@ -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];