@ariakit/core 0.4.10 → 0.4.12

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 (72) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cjs/__chunks/{3IVNQNIV.cjs → 7EQBAZ46.cjs} +1 -2
  3. package/cjs/__chunks/{PW36G76L.cjs → A47DWKLR.cjs} +76 -99
  4. package/cjs/__chunks/{3QF3ODTR.cjs → BSLRW6E7.cjs} +15 -16
  5. package/cjs/__chunks/{H6ZQSQQL.cjs → C5P5S22J.cjs} +17 -18
  6. package/cjs/__chunks/FGGZELG7.cjs +34 -0
  7. package/cjs/__chunks/{QLWAGBAQ.cjs → G2MFLTB2.cjs} +19 -20
  8. package/cjs/__chunks/{CCI5VM7E.cjs → G2NIRMCL.cjs} +19 -20
  9. package/cjs/__chunks/{ULSPM3Y3.cjs → GDZQUFNP.cjs} +1 -3
  10. package/cjs/__chunks/{N667HVED.cjs → I2G6EN27.cjs} +3 -4
  11. package/cjs/__chunks/LSC6QXJ7.cjs +41 -0
  12. package/cjs/__chunks/{BTUHABP4.cjs → MLCPLY2P.cjs} +3 -4
  13. package/cjs/__chunks/{7CES7GVE.cjs → SHOLYDNP.cjs} +1 -3
  14. package/cjs/__chunks/{KCEXELK7.cjs → TEPPO3KC.cjs} +7 -8
  15. package/cjs/__chunks/{7WYII4AN.cjs → WCFMOJKV.cjs} +8 -7
  16. package/cjs/checkbox/checkbox-store.cjs +8 -9
  17. package/cjs/collection/collection-store.cjs +7 -8
  18. package/cjs/combobox/combobox-store.cjs +46 -47
  19. package/cjs/composite/composite-overflow-store.cjs +8 -9
  20. package/cjs/composite/composite-store.cjs +9 -10
  21. package/cjs/composite/composite-store.d.cts +30 -12
  22. package/cjs/composite/composite-store.d.ts +30 -12
  23. package/cjs/dialog/dialog-store.cjs +7 -8
  24. package/cjs/disclosure/disclosure-store.cjs +6 -7
  25. package/cjs/form/form-store.cjs +29 -30
  26. package/cjs/form/types.cjs +1 -1
  27. package/cjs/hovercard/hovercard-store.cjs +9 -10
  28. package/cjs/index.cjs +1 -2
  29. package/cjs/menu/menu-bar-store.cjs +10 -11
  30. package/cjs/menu/menu-store.cjs +34 -35
  31. package/cjs/menubar/menubar-store.cjs +10 -11
  32. package/cjs/popover/popover-store.cjs +8 -9
  33. package/cjs/radio/radio-store.cjs +15 -16
  34. package/cjs/select/select-store.cjs +39 -40
  35. package/cjs/tab/tab-store.cjs +39 -40
  36. package/cjs/tag/tag-store.cjs +21 -22
  37. package/cjs/toolbar/toolbar-store.cjs +11 -12
  38. package/cjs/tooltip/tooltip-store.cjs +16 -17
  39. package/cjs/utils/array.cjs +4 -5
  40. package/cjs/utils/dom.cjs +4 -5
  41. package/cjs/utils/events.cjs +9 -10
  42. package/cjs/utils/focus.cjs +13 -14
  43. package/cjs/utils/misc.cjs +4 -5
  44. package/cjs/utils/platform.cjs +5 -6
  45. package/cjs/utils/store.cjs +5 -6
  46. package/cjs/utils/types.cjs +1 -1
  47. package/cjs/utils/undo.cjs +4 -5
  48. package/esm/__chunks/{US4USQPI.js → 3VBK76MS.js} +1 -1
  49. package/esm/__chunks/{6DHTHWXD.js → 7DTP4AQO.js} +1 -1
  50. package/esm/__chunks/{D7EIQZAU.js → IJ6VFLJG.js} +53 -75
  51. package/esm/__chunks/{HWOIWM4O.js → PQP5VPTV.js} +7 -4
  52. package/esm/__chunks/{PIWLWQMB.js → S22RJCNX.js} +1 -1
  53. package/esm/collection/collection-store.js +2 -2
  54. package/esm/combobox/combobox-store.js +4 -4
  55. package/esm/composite/composite-store.d.ts +30 -12
  56. package/esm/composite/composite-store.js +3 -3
  57. package/esm/form/form-store.js +2 -2
  58. package/esm/menu/menu-bar-store.js +4 -4
  59. package/esm/menu/menu-store.js +3 -3
  60. package/esm/menubar/menubar-store.js +4 -4
  61. package/esm/radio/radio-store.js +3 -3
  62. package/esm/select/select-store.js +3 -3
  63. package/esm/tab/tab-store.js +3 -3
  64. package/esm/tag/tag-store.js +3 -3
  65. package/esm/toolbar/toolbar-store.js +3 -3
  66. package/esm/utils/dom.js +1 -1
  67. package/esm/utils/events.js +2 -2
  68. package/esm/utils/focus.js +1 -1
  69. package/esm/utils/platform.js +2 -2
  70. package/package.json +1 -1
  71. package/cjs/__chunks/VJAE2Y4T.cjs +0 -35
  72. package/cjs/__chunks/XIZWLBI2.cjs +0 -42
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @ariakit/core
2
2
 
3
+ ## 0.4.12
4
+
5
+ - Fixed regression in [`focusShift`](https://ariakit.org/reference/composite-provider#focusshift).
6
+ - Improved JSDocs.
7
+
8
+ ## 0.4.11
9
+
10
+ ### Overriding composite state for specific methods
11
+
12
+ The [`next`](https://ariakit.org/reference/use-composite-store#next), [`previous`](https://ariakit.org/reference/use-composite-store#previous), [`up`](https://ariakit.org/reference/use-composite-store#up), and [`down`](https://ariakit.org/reference/use-composite-store#down) methods of the [composite store](https://ariakit.org/reference/use-composite-store) now accept an object as the first argument to override the composite state for that specific method. For example, you can pass a different [`activeId`](https://ariakit.org/reference/use-composite-store#activeid) value to the [`next`](https://ariakit.org/reference/use-composite-store#next) method so it returns the next item based on that value rather than the current active item in the composite store:
13
+
14
+ ```js
15
+ const store = useCompositeStore({ defaultActiveId: "item1" });
16
+ const item3 = store.next({ activeId: "item2" });
17
+ ```
18
+
19
+ It's important to note that the composite state is not modified when using this feature. The state passed to these methods is used solely for that specific method call.
20
+
21
+ ### Other updates
22
+
23
+ - Fixed CJS build on Next.js.
24
+ - Fixed `getScrollingElement` to consider `overflow: clip`.
25
+ - Improved JSDocs.
26
+
3
27
  ## 0.4.10
4
28
 
5
29
  ### Tabs inside animated Combobox or Select
@@ -1,5 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var __defProp = Object.defineProperty;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -1,23 +1,22 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _G2NIRMCLcjs = require('./G2NIRMCL.cjs');
3
4
 
4
- var _CCI5VM7Ecjs = require('./CCI5VM7E.cjs');
5
5
 
6
6
 
7
+ var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
7
8
 
8
- var _ULSPM3Y3cjs = require('./ULSPM3Y3.cjs');
9
9
 
10
10
 
11
11
 
12
+ var _BSLRW6E7cjs = require('./BSLRW6E7.cjs');
12
13
 
13
- var _3QF3ODTRcjs = require('./3QF3ODTR.cjs');
14
14
 
15
+ var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
15
16
 
16
- var _BTUHABP4cjs = require('./BTUHABP4.cjs');
17
17
 
18
18
 
19
-
20
- var _3IVNQNIVcjs = require('./3IVNQNIV.cjs');
19
+ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
21
20
 
22
21
  // src/composite/composite-store.ts
23
22
  var NULL_ITEM = { id: null };
@@ -37,11 +36,6 @@ function getEnabledItems(items, excludeId) {
37
36
  return !item.disabled;
38
37
  });
39
38
  }
40
- function getOppositeOrientation(orientation) {
41
- if (orientation === "vertical") return "horizontal";
42
- if (orientation === "horizontal") return "vertical";
43
- return;
44
- }
45
39
  function getItemsInRow(items, rowId) {
46
40
  return items.filter((item) => item.rowId === rowId);
47
41
  }
@@ -106,7 +100,7 @@ function verticalizeItems(items) {
106
100
  for (const row of rows) {
107
101
  const item = row[i];
108
102
  if (item) {
109
- verticalized.push(_3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, item), {
103
+ verticalized.push(_7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, item), {
110
104
  // If there's no rowId, it means that it's not a grid composite, but
111
105
  // a single row instead. So, instead of verticalizing it, that is,
112
106
  // assigning a different rowId based on the column index, we keep it
@@ -122,40 +116,40 @@ function verticalizeItems(items) {
122
116
  function createCompositeStore(props = {}) {
123
117
  var _a;
124
118
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
125
- const collection = _CCI5VM7Ecjs.createCollectionStore.call(void 0, props);
126
- const activeId = _BTUHABP4cjs.defaultValue.call(void 0,
119
+ const collection = _G2NIRMCLcjs.createCollectionStore.call(void 0, props);
120
+ const activeId = _MLCPLY2Pcjs.defaultValue.call(void 0,
127
121
  props.activeId,
128
122
  syncState == null ? void 0 : syncState.activeId,
129
123
  props.defaultActiveId
130
124
  );
131
- const initialState = _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, collection.getState()), {
125
+ const initialState = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, collection.getState()), {
132
126
  activeId,
133
- baseElement: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
134
- includesBaseElement: _BTUHABP4cjs.defaultValue.call(void 0,
127
+ baseElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
128
+ includesBaseElement: _MLCPLY2Pcjs.defaultValue.call(void 0,
135
129
  props.includesBaseElement,
136
130
  syncState == null ? void 0 : syncState.includesBaseElement,
137
131
  activeId === null
138
132
  ),
139
- moves: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
140
- orientation: _BTUHABP4cjs.defaultValue.call(void 0,
133
+ moves: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
134
+ orientation: _MLCPLY2Pcjs.defaultValue.call(void 0,
141
135
  props.orientation,
142
136
  syncState == null ? void 0 : syncState.orientation,
143
137
  "both"
144
138
  ),
145
- rtl: _BTUHABP4cjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
146
- virtualFocus: _BTUHABP4cjs.defaultValue.call(void 0,
139
+ rtl: _MLCPLY2Pcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
140
+ virtualFocus: _MLCPLY2Pcjs.defaultValue.call(void 0,
147
141
  props.virtualFocus,
148
142
  syncState == null ? void 0 : syncState.virtualFocus,
149
143
  false
150
144
  ),
151
- focusLoop: _BTUHABP4cjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
152
- focusWrap: _BTUHABP4cjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
153
- focusShift: _BTUHABP4cjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
145
+ focusLoop: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
146
+ focusWrap: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
147
+ focusShift: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
154
148
  });
155
- const composite = _3QF3ODTRcjs.createStore.call(void 0, initialState, collection, props.store);
156
- _3QF3ODTRcjs.setup.call(void 0,
149
+ const composite = _BSLRW6E7cjs.createStore.call(void 0, initialState, collection, props.store);
150
+ _BSLRW6E7cjs.setup.call(void 0,
157
151
  composite,
158
- () => _3QF3ODTRcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
152
+ () => _BSLRW6E7cjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
159
153
  composite.setState("activeId", (activeId2) => {
160
154
  var _a2;
161
155
  if (activeId2 !== void 0) return activeId2;
@@ -163,40 +157,50 @@ function createCompositeStore(props = {}) {
163
157
  });
164
158
  })
165
159
  );
166
- const getNextId = (items, orientation, hasNullItem, skip) => {
160
+ const getNextId = (direction = "next", options = {}) => {
167
161
  var _a2, _b;
168
- const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
169
- const isHorizontal = orientation !== "vertical";
170
- const isRTL = rtl && isHorizontal;
171
- const allItems = isRTL ? _ULSPM3Y3cjs.reverseArray.call(void 0, items) : items;
162
+ const defaultState = composite.getState();
163
+ const {
164
+ skip = 0,
165
+ activeId: activeId2 = defaultState.activeId,
166
+ focusShift = defaultState.focusShift,
167
+ focusLoop = defaultState.focusLoop,
168
+ focusWrap = defaultState.focusWrap,
169
+ includesBaseElement = defaultState.includesBaseElement,
170
+ renderedItems = defaultState.renderedItems,
171
+ rtl = defaultState.rtl
172
+ } = options;
173
+ const isVerticalDirection = direction === "up" || direction === "down";
174
+ const isNextDirection = direction === "next" || direction === "down";
175
+ const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
176
+ const canShift = focusShift && !skip;
177
+ let items = !isVerticalDirection ? renderedItems : _GDZQUFNPcjs.flatten2DArray.call(void 0,
178
+ normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)
179
+ );
180
+ items = canReverse ? _GDZQUFNPcjs.reverseArray.call(void 0, items) : items;
181
+ items = isVerticalDirection ? verticalizeItems(items) : items;
172
182
  if (activeId2 == null) {
173
- return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
183
+ return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id;
174
184
  }
175
- const activeItem = allItems.find((item) => item.id === activeId2);
185
+ const activeItem = items.find((item) => item.id === activeId2);
176
186
  if (!activeItem) {
177
- return (_b = findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
187
+ return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id;
178
188
  }
179
- const isGrid = !!activeItem.rowId;
180
- const activeIndex = allItems.indexOf(activeItem);
181
- const nextItems = allItems.slice(activeIndex + 1);
189
+ const isGrid = items.some((item) => item.rowId);
190
+ const activeIndex = items.indexOf(activeItem);
191
+ const nextItems = items.slice(activeIndex + 1);
182
192
  const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
183
- if (skip !== void 0) {
193
+ if (skip) {
184
194
  const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
185
195
  const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
186
196
  nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
187
197
  return nextItem2 == null ? void 0 : nextItem2.id;
188
198
  }
189
- const oppositeOrientation = getOppositeOrientation(
190
- // If it's a grid and orientation is not set, it's a next/previous call,
191
- // which is inherently horizontal. up/down will call next with orientation
192
- // set to vertical by default (see below on up/down methods).
193
- isGrid ? orientation || "horizontal" : orientation
194
- );
195
- const canLoop = focusLoop && focusLoop !== oppositeOrientation;
196
- const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation;
197
- hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
199
+ const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
200
+ const canWrap = isGrid && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
201
+ const hasNullItem = isNextDirection ? (!isGrid || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
198
202
  if (canLoop) {
199
- const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
203
+ const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
200
204
  const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
201
205
  const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
202
206
  return nextItem2 == null ? void 0 : nextItem2.id;
@@ -221,7 +225,7 @@ function createCompositeStore(props = {}) {
221
225
  }
222
226
  return nextItem == null ? void 0 : nextItem.id;
223
227
  };
224
- return _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, collection), composite), {
228
+ return _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, collection), composite), {
225
229
  setBaseElement: (element) => composite.setState("baseElement", element),
226
230
  setActiveId: (id) => composite.setState("activeId", id),
227
231
  move: (id) => {
@@ -235,58 +239,31 @@ function createCompositeStore(props = {}) {
235
239
  },
236
240
  last: () => {
237
241
  var _a2;
238
- return (_a2 = findFirstEnabledItem(_ULSPM3Y3cjs.reverseArray.call(void 0, composite.getState().renderedItems))) == null ? void 0 : _a2.id;
242
+ return (_a2 = findFirstEnabledItem(_GDZQUFNPcjs.reverseArray.call(void 0, composite.getState().renderedItems))) == null ? void 0 : _a2.id;
239
243
  },
240
- next: (skip) => {
241
- const { renderedItems, orientation } = composite.getState();
242
- return getNextId(renderedItems, orientation, false, skip);
244
+ next: (options) => {
245
+ if (options !== void 0 && typeof options === "number") {
246
+ options = { skip: options };
247
+ }
248
+ return getNextId("next", options);
243
249
  },
244
- previous: (skip) => {
245
- var _a2;
246
- const { renderedItems, orientation, includesBaseElement } = composite.getState();
247
- const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
248
- const hasNullItem = !isGrid && includesBaseElement;
249
- return getNextId(
250
- _ULSPM3Y3cjs.reverseArray.call(void 0, renderedItems),
251
- orientation,
252
- hasNullItem,
253
- skip
254
- );
250
+ previous: (options) => {
251
+ if (options !== void 0 && typeof options === "number") {
252
+ options = { skip: options };
253
+ }
254
+ return getNextId("previous", options);
255
255
  },
256
- down: (skip) => {
257
- const {
258
- activeId: activeId2,
259
- renderedItems,
260
- focusShift,
261
- focusLoop,
262
- includesBaseElement
263
- } = composite.getState();
264
- const shouldShift = focusShift && !skip;
265
- const verticalItems = verticalizeItems(
266
- _ULSPM3Y3cjs.flatten2DArray.call(void 0,
267
- normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift)
268
- )
269
- );
270
- const canLoop = focusLoop && focusLoop !== "horizontal";
271
- const hasNullItem = canLoop && includesBaseElement;
272
- return getNextId(verticalItems, "vertical", hasNullItem, skip);
256
+ down: (options) => {
257
+ if (options !== void 0 && typeof options === "number") {
258
+ options = { skip: options };
259
+ }
260
+ return getNextId("down", options);
273
261
  },
274
- up: (skip) => {
275
- const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
276
- const shouldShift = focusShift && !skip;
277
- const verticalItems = verticalizeItems(
278
- _ULSPM3Y3cjs.reverseArray.call(void 0,
279
- _ULSPM3Y3cjs.flatten2DArray.call(void 0,
280
- normalizeRows(
281
- groupItemsByRows(renderedItems),
282
- activeId2,
283
- shouldShift
284
- )
285
- )
286
- )
287
- );
288
- const hasNullItem = includesBaseElement;
289
- return getNextId(verticalItems, "vertical", hasNullItem, skip);
262
+ up: (options) => {
263
+ if (options !== void 0 && typeof options === "number") {
264
+ options = { skip: options };
265
+ }
266
+ return getNextId("up", options);
290
267
  }
291
268
  });
292
269
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -7,24 +7,23 @@
7
7
 
8
8
 
9
9
 
10
+ var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
10
11
 
11
- var _BTUHABP4cjs = require('./BTUHABP4.cjs');
12
12
 
13
13
 
14
-
15
- var _3IVNQNIVcjs = require('./3IVNQNIV.cjs');
14
+ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
16
15
 
17
16
  // src/utils/store.ts
18
17
  function getInternal(store, key) {
19
18
  const internals = store.__unstableInternals;
20
- _BTUHABP4cjs.invariant.call(void 0, internals, "Invalid store");
19
+ _MLCPLY2Pcjs.invariant.call(void 0, internals, "Invalid store");
21
20
  return internals[key];
22
21
  }
23
22
  function createStore(initialState, ...stores) {
24
23
  let state = initialState;
25
24
  let prevStateBatch = state;
26
25
  let lastUpdate = Symbol();
27
- let destroy = _BTUHABP4cjs.noop;
26
+ let destroy = _MLCPLY2Pcjs.noop;
28
27
  const instances = /* @__PURE__ */ new Set();
29
28
  const updatedKeys = /* @__PURE__ */ new Set();
30
29
  const setups = /* @__PURE__ */ new Set();
@@ -46,13 +45,13 @@ function createStore(initialState, ...stores) {
46
45
  destroy();
47
46
  };
48
47
  if (initialized) return maybeDestroy;
49
- const desyncs = _BTUHABP4cjs.getKeys.call(void 0, state).map(
50
- (key) => _BTUHABP4cjs.chain.call(void 0,
48
+ const desyncs = _MLCPLY2Pcjs.getKeys.call(void 0, state).map(
49
+ (key) => _MLCPLY2Pcjs.chain.call(void 0,
51
50
  ...stores.map((store) => {
52
51
  var _a;
53
52
  const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
54
53
  if (!storeState) return;
55
- if (!_BTUHABP4cjs.hasOwnProperty.call(void 0, storeState, key)) return;
54
+ if (!_MLCPLY2Pcjs.hasOwnProperty.call(void 0, storeState, key)) return;
56
55
  return sync(store, [key], (state2) => {
57
56
  setState(
58
57
  key,
@@ -70,7 +69,7 @@ function createStore(initialState, ...stores) {
70
69
  teardowns.push(setup2());
71
70
  }
72
71
  const cleanups = stores.map(init);
73
- destroy = _BTUHABP4cjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
72
+ destroy = _MLCPLY2Pcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
74
73
  return maybeDestroy;
75
74
  };
76
75
  const sub = (keys, listener, set = listeners) => {
@@ -93,13 +92,13 @@ function createStore(initialState, ...stores) {
93
92
  disposables.set(listener, listener(state, prevStateBatch));
94
93
  return sub(keys, listener, batchListeners);
95
94
  };
96
- const storePick = (keys) => createStore(_BTUHABP4cjs.pick.call(void 0, state, keys), finalStore);
97
- const storeOmit = (keys) => createStore(_BTUHABP4cjs.omit.call(void 0, state, keys), finalStore);
95
+ const storePick = (keys) => createStore(_MLCPLY2Pcjs.pick.call(void 0, state, keys), finalStore);
96
+ const storeOmit = (keys) => createStore(_MLCPLY2Pcjs.omit.call(void 0, state, keys), finalStore);
98
97
  const getState = () => state;
99
98
  const setState = (key, value, fromStores = false) => {
100
99
  var _a;
101
- if (!_BTUHABP4cjs.hasOwnProperty.call(void 0, state, key)) return;
102
- const nextValue = _BTUHABP4cjs.applyState.call(void 0, value, state[key]);
100
+ if (!_MLCPLY2Pcjs.hasOwnProperty.call(void 0, state, key)) return;
101
+ const nextValue = _MLCPLY2Pcjs.applyState.call(void 0, value, state[key]);
103
102
  if (nextValue === state[key]) return;
104
103
  if (!fromStores) {
105
104
  for (const store of stores) {
@@ -107,7 +106,7 @@ function createStore(initialState, ...stores) {
107
106
  }
108
107
  }
109
108
  const prevState = state;
110
- state = _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
109
+ state = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
111
110
  const thisUpdate = Symbol();
112
111
  lastUpdate = thisUpdate;
113
112
  updatedKeys.add(key);
@@ -197,7 +196,7 @@ function throwOnConflictingProps(props, store) {
197
196
  if (!defaultKeys.length) return;
198
197
  const storeState = store.getState();
199
198
  const conflictingProps = defaultKeys.filter(
200
- (key) => _BTUHABP4cjs.hasOwnProperty.call(void 0, storeState, key)
199
+ (key) => _MLCPLY2Pcjs.hasOwnProperty.call(void 0, storeState, key)
201
200
  );
202
201
  if (!conflictingProps.length) return;
203
202
  throw new Error(
@@ -1,32 +1,31 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _I2G6EN27cjs = require('./I2G6EN27.cjs');
3
4
 
4
- var _N667HVEDcjs = require('./N667HVED.cjs');
5
5
 
6
6
 
7
7
 
8
8
 
9
+ var _BSLRW6E7cjs = require('./BSLRW6E7.cjs');
9
10
 
10
- var _3QF3ODTRcjs = require('./3QF3ODTR.cjs');
11
11
 
12
+ var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
12
13
 
13
- var _BTUHABP4cjs = require('./BTUHABP4.cjs');
14
14
 
15
15
 
16
16
 
17
-
18
- var _3IVNQNIVcjs = require('./3IVNQNIV.cjs');
17
+ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
19
18
 
20
19
  // src/popover/popover-store.ts
21
20
  function createPopoverStore(_a = {}) {
22
21
  var _b = _a, {
23
22
  popover: otherPopover
24
- } = _b, props = _3IVNQNIVcjs.__objRest.call(void 0, _b, [
23
+ } = _b, props = _7EQBAZ46cjs.__objRest.call(void 0, _b, [
25
24
  "popover"
26
25
  ]);
27
- const store = _3QF3ODTRcjs.mergeStore.call(void 0,
26
+ const store = _BSLRW6E7cjs.mergeStore.call(void 0,
28
27
  props.store,
29
- _3QF3ODTRcjs.omit.call(void 0, otherPopover, [
28
+ _BSLRW6E7cjs.omit.call(void 0, otherPopover, [
30
29
  "arrowElement",
31
30
  "anchorElement",
32
31
  "contentElement",
@@ -34,24 +33,24 @@ function createPopoverStore(_a = {}) {
34
33
  "disclosureElement"
35
34
  ])
36
35
  );
37
- _3QF3ODTRcjs.throwOnConflictingProps.call(void 0, props, store);
36
+ _BSLRW6E7cjs.throwOnConflictingProps.call(void 0, props, store);
38
37
  const syncState = store == null ? void 0 : store.getState();
39
- const dialog = _N667HVEDcjs.createDialogStore.call(void 0, _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, props), { store }));
40
- const placement = _BTUHABP4cjs.defaultValue.call(void 0,
38
+ const dialog = _I2G6EN27cjs.createDialogStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), { store }));
39
+ const placement = _MLCPLY2Pcjs.defaultValue.call(void 0,
41
40
  props.placement,
42
41
  syncState == null ? void 0 : syncState.placement,
43
42
  "bottom"
44
43
  );
45
- const initialState = _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
44
+ const initialState = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, dialog.getState()), {
46
45
  placement,
47
46
  currentPlacement: placement,
48
- anchorElement: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
49
- popoverElement: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
50
- arrowElement: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
47
+ anchorElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
48
+ popoverElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
49
+ arrowElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
51
50
  rendered: Symbol("rendered")
52
51
  });
53
- const popover = _3QF3ODTRcjs.createStore.call(void 0, initialState, dialog, store);
54
- return _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, dialog), popover), {
52
+ const popover = _BSLRW6E7cjs.createStore.call(void 0, initialState, dialog, store);
53
+ return _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, dialog), popover), {
55
54
  setAnchorElement: (element) => popover.setState("anchorElement", element),
56
55
  setPopoverElement: (element) => popover.setState("popoverElement", element),
57
56
  setArrowElement: (element) => popover.setState("arrowElement", element),
@@ -0,0 +1,34 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _A47DWKLRcjs = require('./A47DWKLR.cjs');
4
+
5
+
6
+ var _BSLRW6E7cjs = require('./BSLRW6E7.cjs');
7
+
8
+
9
+ var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
10
+
11
+
12
+
13
+ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
14
+
15
+ // src/menubar/menubar-store.ts
16
+ function createMenubarStore(props = {}) {
17
+ var _a;
18
+ const syncState = (_a = props.store) == null ? void 0 : _a.getState();
19
+ const composite = _A47DWKLRcjs.createCompositeStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
20
+ orientation: _MLCPLY2Pcjs.defaultValue.call(void 0,
21
+ props.orientation,
22
+ syncState == null ? void 0 : syncState.orientation,
23
+ "horizontal"
24
+ ),
25
+ focusLoop: _MLCPLY2Pcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
26
+ }));
27
+ const initialState = _7EQBAZ46cjs.__spreadValues.call(void 0, {}, composite.getState());
28
+ const menubar = _BSLRW6E7cjs.createStore.call(void 0, initialState, composite, props.store);
29
+ return _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, composite), menubar);
30
+ }
31
+
32
+
33
+
34
+ exports.createMenubarStore = createMenubarStore;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -6,61 +6,60 @@
6
6
 
7
7
 
8
8
 
9
+ var _BSLRW6E7cjs = require('./BSLRW6E7.cjs');
9
10
 
10
- var _3QF3ODTRcjs = require('./3QF3ODTR.cjs');
11
11
 
12
+ var _MLCPLY2Pcjs = require('./MLCPLY2P.cjs');
12
13
 
13
- var _BTUHABP4cjs = require('./BTUHABP4.cjs');
14
14
 
15
15
 
16
-
17
- var _3IVNQNIVcjs = require('./3IVNQNIV.cjs');
16
+ var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
18
17
 
19
18
  // src/disclosure/disclosure-store.ts
20
19
  function createDisclosureStore(props = {}) {
21
- const store = _3QF3ODTRcjs.mergeStore.call(void 0,
20
+ const store = _BSLRW6E7cjs.mergeStore.call(void 0,
22
21
  props.store,
23
- _3QF3ODTRcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
22
+ _BSLRW6E7cjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
24
23
  );
25
- _3QF3ODTRcjs.throwOnConflictingProps.call(void 0, props, store);
24
+ _BSLRW6E7cjs.throwOnConflictingProps.call(void 0, props, store);
26
25
  const syncState = store == null ? void 0 : store.getState();
27
- const open = _BTUHABP4cjs.defaultValue.call(void 0,
26
+ const open = _MLCPLY2Pcjs.defaultValue.call(void 0,
28
27
  props.open,
29
28
  syncState == null ? void 0 : syncState.open,
30
29
  props.defaultOpen,
31
30
  false
32
31
  );
33
- const animated = _BTUHABP4cjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
32
+ const animated = _MLCPLY2Pcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
34
33
  const initialState = {
35
34
  open,
36
35
  animated,
37
36
  animating: !!animated && open,
38
37
  mounted: open,
39
- contentElement: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
40
- disclosureElement: _BTUHABP4cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
38
+ contentElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
39
+ disclosureElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
41
40
  };
42
- const disclosure = _3QF3ODTRcjs.createStore.call(void 0, initialState, store);
43
- _3QF3ODTRcjs.setup.call(void 0,
41
+ const disclosure = _BSLRW6E7cjs.createStore.call(void 0, initialState, store);
42
+ _BSLRW6E7cjs.setup.call(void 0,
44
43
  disclosure,
45
- () => _3QF3ODTRcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
44
+ () => _BSLRW6E7cjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
46
45
  if (state.animated) return;
47
46
  disclosure.setState("animating", false);
48
47
  })
49
48
  );
50
- _3QF3ODTRcjs.setup.call(void 0,
49
+ _BSLRW6E7cjs.setup.call(void 0,
51
50
  disclosure,
52
- () => _3QF3ODTRcjs.subscribe.call(void 0, disclosure, ["open"], () => {
51
+ () => _BSLRW6E7cjs.subscribe.call(void 0, disclosure, ["open"], () => {
53
52
  if (!disclosure.getState().animated) return;
54
53
  disclosure.setState("animating", true);
55
54
  })
56
55
  );
57
- _3QF3ODTRcjs.setup.call(void 0,
56
+ _BSLRW6E7cjs.setup.call(void 0,
58
57
  disclosure,
59
- () => _3QF3ODTRcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
58
+ () => _BSLRW6E7cjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
60
59
  disclosure.setState("mounted", state.open || state.animating);
61
60
  })
62
61
  );
63
- return _3IVNQNIVcjs.__spreadProps.call(void 0, _3IVNQNIVcjs.__spreadValues.call(void 0, {}, disclosure), {
62
+ return _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, disclosure), {
64
63
  disclosure: props.disclosure,
65
64
  setOpen: (value) => disclosure.setState("open", value),
66
65
  show: () => disclosure.setState("open", true),