@ariakit/core 0.4.12 → 0.4.13

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 (76) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/cjs/__chunks/{WCFMOJKV.cjs → 726BNPQZ.cjs} +36 -2
  3. package/cjs/__chunks/{BSLRW6E7.cjs → ASR6PAFN.cjs} +1 -1
  4. package/cjs/__chunks/{G2NIRMCL.cjs → BUEPUCQL.cjs} +14 -42
  5. package/cjs/__chunks/{C5P5S22J.cjs → BVPEDDW6.cjs} +7 -7
  6. package/cjs/__chunks/{A47DWKLR.cjs → K7YTZVWC.cjs} +11 -6
  7. package/cjs/__chunks/{LSC6QXJ7.cjs → RL7DKHOF.cjs} +4 -4
  8. package/cjs/__chunks/{FGGZELG7.cjs → TFI7KVZO.cjs} +4 -4
  9. package/cjs/__chunks/{G2MFLTB2.cjs → V4YF2QA6.cjs} +11 -11
  10. package/cjs/__chunks/{TEPPO3KC.cjs → WOLZY4WC.cjs} +6 -6
  11. package/cjs/__chunks/{I2G6EN27.cjs → YMCSKJHR.cjs} +2 -2
  12. package/cjs/checkbox/checkbox-store.cjs +3 -3
  13. package/cjs/collection/collection-store.cjs +4 -4
  14. package/cjs/combobox/combobox-store.cjs +27 -27
  15. package/cjs/composite/composite-overflow-store.cjs +5 -5
  16. package/cjs/composite/composite-store.cjs +5 -5
  17. package/cjs/composite/composite-store.d.cts +7 -1
  18. package/cjs/composite/composite-store.d.ts +7 -1
  19. package/cjs/dialog/dialog-store.cjs +4 -4
  20. package/cjs/disclosure/disclosure-store.cjs +3 -3
  21. package/cjs/form/form-store.cjs +8 -8
  22. package/cjs/hovercard/hovercard-store.cjs +6 -6
  23. package/cjs/menu/menu-bar-store.cjs +6 -6
  24. package/cjs/menu/menu-store.cjs +19 -19
  25. package/cjs/menubar/menubar-store.cjs +6 -6
  26. package/cjs/popover/popover-store.cjs +5 -5
  27. package/cjs/radio/radio-store.cjs +6 -6
  28. package/cjs/select/select-store.cjs +21 -21
  29. package/cjs/tab/tab-store.cjs +24 -24
  30. package/cjs/tag/tag-store.cjs +8 -8
  31. package/cjs/toolbar/toolbar-store.cjs +5 -5
  32. package/cjs/tooltip/tooltip-store.cjs +7 -7
  33. package/cjs/utils/dom.cjs +4 -2
  34. package/cjs/utils/dom.d.cts +6 -2
  35. package/cjs/utils/dom.d.ts +6 -2
  36. package/cjs/utils/events.cjs +7 -7
  37. package/cjs/utils/focus.cjs +10 -10
  38. package/cjs/utils/platform.cjs +3 -3
  39. package/cjs/utils/store.cjs +2 -2
  40. package/esm/__chunks/{S22RJCNX.js → 7HRRFUKQ.js} +2 -2
  41. package/esm/__chunks/{IJ6VFLJG.js → AJZ4BYF3.js} +7 -2
  42. package/esm/__chunks/{EQQLU3CG.js → BCALMBPZ.js} +1 -1
  43. package/esm/__chunks/{7DTP4AQO.js → CYQWQL4J.js} +6 -34
  44. package/esm/__chunks/{PQP5VPTV.js → DTR5TSDJ.js} +36 -2
  45. package/esm/__chunks/{YOHCVXJB.js → FZZ2AVHF.js} +1 -1
  46. package/esm/__chunks/{EACLTACN.js → JTLIIJ4U.js} +2 -2
  47. package/esm/__chunks/{3UYWTADI.js → ME2CUF3F.js} +2 -2
  48. package/esm/__chunks/{3VBK76MS.js → QAGXQEUG.js} +1 -1
  49. package/esm/__chunks/{6E4KKOSB.js → RCQ5P4YE.js} +1 -1
  50. package/esm/checkbox/checkbox-store.js +1 -1
  51. package/esm/collection/collection-store.js +3 -3
  52. package/esm/combobox/combobox-store.js +8 -8
  53. package/esm/composite/composite-overflow-store.js +4 -4
  54. package/esm/composite/composite-store.d.ts +7 -1
  55. package/esm/composite/composite-store.js +4 -4
  56. package/esm/dialog/dialog-store.js +3 -3
  57. package/esm/disclosure/disclosure-store.js +2 -2
  58. package/esm/form/form-store.js +3 -3
  59. package/esm/hovercard/hovercard-store.js +5 -5
  60. package/esm/menu/menu-bar-store.js +5 -5
  61. package/esm/menu/menu-store.js +8 -8
  62. package/esm/menubar/menubar-store.js +5 -5
  63. package/esm/popover/popover-store.js +4 -4
  64. package/esm/radio/radio-store.js +4 -4
  65. package/esm/select/select-store.js +7 -7
  66. package/esm/tab/tab-store.js +4 -4
  67. package/esm/tag/tag-store.js +4 -4
  68. package/esm/toolbar/toolbar-store.js +4 -4
  69. package/esm/tooltip/tooltip-store.js +5 -5
  70. package/esm/utils/dom.d.ts +6 -2
  71. package/esm/utils/dom.js +5 -3
  72. package/esm/utils/events.js +4 -4
  73. package/esm/utils/focus.js +1 -1
  74. package/esm/utils/platform.js +2 -2
  75. package/esm/utils/store.js +1 -1
  76. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _A47DWKLRcjs = require('../__chunks/A47DWKLR.cjs');
4
- require('../__chunks/G2NIRMCL.cjs');
3
+ var _K7YTZVWCcjs = require('../__chunks/K7YTZVWC.cjs');
4
+ require('../__chunks/BUEPUCQL.cjs');
5
5
  require('../__chunks/GDZQUFNP.cjs');
6
6
 
7
7
 
@@ -10,12 +10,12 @@ var _SHOLYDNPcjs = require('../__chunks/SHOLYDNP.cjs');
10
10
 
11
11
 
12
12
 
13
- var _BSLRW6E7cjs = require('../__chunks/BSLRW6E7.cjs');
13
+ var _ASR6PAFNcjs = require('../__chunks/ASR6PAFN.cjs');
14
14
 
15
15
 
16
16
 
17
17
  var _MLCPLY2Pcjs = require('../__chunks/MLCPLY2P.cjs');
18
- require('../__chunks/WCFMOJKV.cjs');
18
+ require('../__chunks/726BNPQZ.cjs');
19
19
 
20
20
 
21
21
 
@@ -25,7 +25,7 @@ var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
25
25
  function createTagStore(props = {}) {
26
26
  var _a;
27
27
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
28
- const composite = _A47DWKLRcjs.createCompositeStore.call(void 0, props);
28
+ const composite = _K7YTZVWCcjs.createCompositeStore.call(void 0, props);
29
29
  const initialState = _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, composite.getState()), {
30
30
  inputElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.inputElement, null),
31
31
  labelElement: _MLCPLY2Pcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.labelElement, null),
@@ -37,10 +37,10 @@ function createTagStore(props = {}) {
37
37
  []
38
38
  )
39
39
  });
40
- const tag = _BSLRW6E7cjs.createStore.call(void 0, initialState, composite, props.store);
41
- _BSLRW6E7cjs.setup.call(void 0,
40
+ const tag = _ASR6PAFNcjs.createStore.call(void 0, initialState, composite, props.store);
41
+ _ASR6PAFNcjs.setup.call(void 0,
42
42
  tag,
43
- () => _BSLRW6E7cjs.sync.call(void 0, tag, ["inputElement", "activeId"], (state) => {
43
+ () => _ASR6PAFNcjs.sync.call(void 0, tag, ["inputElement", "activeId"], (state) => {
44
44
  if (!state.inputElement) return;
45
45
  if (state.activeId !== void 0) return;
46
46
  tag.setState("activeId", state.inputElement.id);
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _A47DWKLRcjs = require('../__chunks/A47DWKLR.cjs');
4
- require('../__chunks/G2NIRMCL.cjs');
3
+ var _K7YTZVWCcjs = require('../__chunks/K7YTZVWC.cjs');
4
+ require('../__chunks/BUEPUCQL.cjs');
5
5
  require('../__chunks/GDZQUFNP.cjs');
6
- require('../__chunks/BSLRW6E7.cjs');
6
+ require('../__chunks/ASR6PAFN.cjs');
7
7
 
8
8
 
9
9
  var _MLCPLY2Pcjs = require('../__chunks/MLCPLY2P.cjs');
10
- require('../__chunks/WCFMOJKV.cjs');
10
+ require('../__chunks/726BNPQZ.cjs');
11
11
 
12
12
 
13
13
 
@@ -17,7 +17,7 @@ var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
17
17
  function createToolbarStore(props = {}) {
18
18
  var _a;
19
19
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
- return _A47DWKLRcjs.createCompositeStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
20
+ return _K7YTZVWCcjs.createCompositeStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
21
21
  orientation: _MLCPLY2Pcjs.defaultValue.call(void 0,
22
22
  props.orientation,
23
23
  syncState == null ? void 0 : syncState.orientation,
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _LSC6QXJ7cjs = require('../__chunks/LSC6QXJ7.cjs');
4
- require('../__chunks/C5P5S22J.cjs');
5
- require('../__chunks/I2G6EN27.cjs');
6
- require('../__chunks/G2MFLTB2.cjs');
3
+ var _RL7DKHOFcjs = require('../__chunks/RL7DKHOF.cjs');
4
+ require('../__chunks/BVPEDDW6.cjs');
5
+ require('../__chunks/YMCSKJHR.cjs');
6
+ require('../__chunks/V4YF2QA6.cjs');
7
7
 
8
8
 
9
- var _BSLRW6E7cjs = require('../__chunks/BSLRW6E7.cjs');
9
+ var _ASR6PAFNcjs = require('../__chunks/ASR6PAFN.cjs');
10
10
 
11
11
 
12
12
  var _MLCPLY2Pcjs = require('../__chunks/MLCPLY2P.cjs');
@@ -28,7 +28,7 @@ function createTooltipStore(props = {}) {
28
28
  }
29
29
  }
30
30
  const syncState = (_a = props.store) == null ? void 0 : _a.getState();
31
- const hovercard = _LSC6QXJ7cjs.createHovercardStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
31
+ const hovercard = _RL7DKHOFcjs.createHovercardStore.call(void 0, _7EQBAZ46cjs.__spreadProps.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, props), {
32
32
  placement: _MLCPLY2Pcjs.defaultValue.call(void 0,
33
33
  props.placement,
34
34
  syncState == null ? void 0 : syncState.placement,
@@ -40,7 +40,7 @@ function createTooltipStore(props = {}) {
40
40
  type: _MLCPLY2Pcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
41
41
  skipTimeout: _MLCPLY2Pcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
42
42
  });
43
- const tooltip = _BSLRW6E7cjs.createStore.call(void 0, initialState, hovercard, props.store);
43
+ const tooltip = _ASR6PAFNcjs.createStore.call(void 0, initialState, hovercard, props.store);
44
44
  return _7EQBAZ46cjs.__spreadValues.call(void 0, _7EQBAZ46cjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
45
45
  }
46
46
 
package/cjs/utils/dom.cjs CHANGED
@@ -17,7 +17,8 @@
17
17
 
18
18
 
19
19
 
20
- var _WCFMOJKVcjs = require('../__chunks/WCFMOJKV.cjs');
20
+
21
+ var _726BNPQZcjs = require('../__chunks/726BNPQZ.cjs');
21
22
  require('../__chunks/7EQBAZ46.cjs');
22
23
 
23
24
 
@@ -38,4 +39,5 @@ require('../__chunks/7EQBAZ46.cjs');
38
39
 
39
40
 
40
41
 
41
- exports.canUseDOM = _WCFMOJKVcjs.canUseDOM; exports.contains = _WCFMOJKVcjs.contains; exports.getActiveElement = _WCFMOJKVcjs.getActiveElement; exports.getDocument = _WCFMOJKVcjs.getDocument; exports.getPopupItemRole = _WCFMOJKVcjs.getPopupItemRole; exports.getPopupRole = _WCFMOJKVcjs.getPopupRole; exports.getScrollingElement = _WCFMOJKVcjs.getScrollingElement; exports.getTextboxSelection = _WCFMOJKVcjs.getTextboxSelection; exports.getTextboxValue = _WCFMOJKVcjs.getTextboxValue; exports.getWindow = _WCFMOJKVcjs.getWindow; exports.isButton = _WCFMOJKVcjs.isButton; exports.isFrame = _WCFMOJKVcjs.isFrame; exports.isPartiallyHidden = _WCFMOJKVcjs.isPartiallyHidden; exports.isTextField = _WCFMOJKVcjs.isTextField; exports.isTextbox = _WCFMOJKVcjs.isTextbox; exports.isVisible = _WCFMOJKVcjs.isVisible; exports.scrollIntoViewIfNeeded = _WCFMOJKVcjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _WCFMOJKVcjs.setSelectionRange;
42
+
43
+ exports.canUseDOM = _726BNPQZcjs.canUseDOM; exports.contains = _726BNPQZcjs.contains; exports.getActiveElement = _726BNPQZcjs.getActiveElement; exports.getDocument = _726BNPQZcjs.getDocument; exports.getPopupItemRole = _726BNPQZcjs.getPopupItemRole; exports.getPopupRole = _726BNPQZcjs.getPopupRole; exports.getScrollingElement = _726BNPQZcjs.getScrollingElement; exports.getTextboxSelection = _726BNPQZcjs.getTextboxSelection; exports.getTextboxValue = _726BNPQZcjs.getTextboxValue; exports.getWindow = _726BNPQZcjs.getWindow; exports.isButton = _726BNPQZcjs.isButton; exports.isFrame = _726BNPQZcjs.isFrame; exports.isPartiallyHidden = _726BNPQZcjs.isPartiallyHidden; exports.isTextField = _726BNPQZcjs.isTextField; exports.isTextbox = _726BNPQZcjs.isTextbox; exports.isVisible = _726BNPQZcjs.isVisible; exports.scrollIntoViewIfNeeded = _726BNPQZcjs.scrollIntoViewIfNeeded; exports.setSelectionRange = _726BNPQZcjs.setSelectionRange; exports.sortBasedOnDOMPosition = _726BNPQZcjs.sortBasedOnDOMPosition;
@@ -9,11 +9,11 @@ export declare const canUseDOM: boolean;
9
9
  /**
10
10
  * Returns `element.ownerDocument || document`.
11
11
  */
12
- export declare function getDocument(node?: Node | null): Document;
12
+ export declare function getDocument(node?: Window | Document | Node | null): Document;
13
13
  /**
14
14
  * Returns `element.ownerDocument.defaultView || window`.
15
15
  */
16
- export declare function getWindow(node?: Node | null): Window;
16
+ export declare function getWindow(node?: Window | Document | Node | null): Window;
17
17
  /**
18
18
  * Returns `element.ownerDocument.activeElement`.
19
19
  */
@@ -106,3 +106,7 @@ export declare function isPartiallyHidden(element: Element): boolean;
106
106
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
107
107
  */
108
108
  export declare function setSelectionRange(element: HTMLInputElement | HTMLTextAreaElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
109
+ /**
110
+ * Sort the items based on their DOM position.
111
+ */
112
+ export declare function sortBasedOnDOMPosition<T>(items: T[], getElement: (item: T) => Element | null | undefined): T[];
@@ -9,11 +9,11 @@ export declare const canUseDOM: boolean;
9
9
  /**
10
10
  * Returns `element.ownerDocument || document`.
11
11
  */
12
- export declare function getDocument(node?: Node | null): Document;
12
+ export declare function getDocument(node?: Window | Document | Node | null): Document;
13
13
  /**
14
14
  * Returns `element.ownerDocument.defaultView || window`.
15
15
  */
16
- export declare function getWindow(node?: Node | null): Window;
16
+ export declare function getWindow(node?: Window | Document | Node | null): Window;
17
17
  /**
18
18
  * Returns `element.ownerDocument.activeElement`.
19
19
  */
@@ -106,3 +106,7 @@ export declare function isPartiallyHidden(element: Element): boolean;
106
106
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
107
107
  */
108
108
  export declare function setSelectionRange(element: HTMLInputElement | HTMLTextAreaElement, ...args: Parameters<typeof HTMLInputElement.prototype.setSelectionRange>): void;
109
+ /**
110
+ * Sort the items based on their DOM position.
111
+ */
112
+ export declare function sortBasedOnDOMPosition<T>(items: T[], getElement: (item: T) => Element | null | undefined): T[];
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _TEPPO3KCcjs = require('../__chunks/TEPPO3KC.cjs');
3
+ var _WOLZY4WCcjs = require('../__chunks/WOLZY4WC.cjs');
4
4
 
5
5
 
6
- var _WCFMOJKVcjs = require('../__chunks/WCFMOJKV.cjs');
6
+ var _726BNPQZcjs = require('../__chunks/726BNPQZ.cjs');
7
7
 
8
8
 
9
9
 
@@ -12,7 +12,7 @@ var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
12
12
  // src/utils/events.ts
13
13
  function isPortalEvent(event) {
14
14
  return Boolean(
15
- event.currentTarget && !_WCFMOJKVcjs.contains.call(void 0, event.currentTarget, event.target)
15
+ event.currentTarget && !_726BNPQZcjs.contains.call(void 0, event.currentTarget, event.target)
16
16
  );
17
17
  }
18
18
  function isSelfTarget(event) {
@@ -21,7 +21,7 @@ function isSelfTarget(event) {
21
21
  function isOpeningInNewTab(event) {
22
22
  const element = event.currentTarget;
23
23
  if (!element) return false;
24
- const isAppleDevice = _TEPPO3KCcjs.isApple.call(void 0, );
24
+ const isAppleDevice = _WOLZY4WCcjs.isApple.call(void 0, );
25
25
  if (isAppleDevice && !event.metaKey) return false;
26
26
  if (!isAppleDevice && !event.ctrlKey) return false;
27
27
  const tagName = element.tagName.toLowerCase();
@@ -69,7 +69,7 @@ function fireClickEvent(element, eventInit) {
69
69
  function isFocusEventOutside(event, container) {
70
70
  const containerElement = container || event.currentTarget;
71
71
  const relatedTarget = event.relatedTarget;
72
- return !relatedTarget || !_WCFMOJKVcjs.contains.call(void 0, containerElement, relatedTarget);
72
+ return !relatedTarget || !_726BNPQZcjs.contains.call(void 0, containerElement, relatedTarget);
73
73
  }
74
74
  function getInputType(event) {
75
75
  const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
@@ -101,7 +101,7 @@ function queueBeforeEvent(element, type, callback, timeout) {
101
101
  function addGlobalEventListener(type, listener, options, scope = window) {
102
102
  const children = [];
103
103
  try {
104
- scope.document.addEventListener(type, listener, options);
104
+ scope.addEventListener(type, listener, options);
105
105
  for (const frame of Array.from(scope.frames)) {
106
106
  children.push(addGlobalEventListener(type, listener, options, frame));
107
107
  }
@@ -109,7 +109,7 @@ function addGlobalEventListener(type, listener, options, scope = window) {
109
109
  }
110
110
  const removeEventListener = () => {
111
111
  try {
112
- scope.document.removeEventListener(type, listener, options);
112
+ scope.removeEventListener(type, listener, options);
113
113
  } catch (e) {
114
114
  }
115
115
  for (const remove of children) {
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _WCFMOJKVcjs = require('../__chunks/WCFMOJKV.cjs');
6
+ var _726BNPQZcjs = require('../__chunks/726BNPQZ.cjs');
7
7
 
8
8
 
9
9
  var _7EQBAZ46cjs = require('../__chunks/7EQBAZ46.cjs');
@@ -16,7 +16,7 @@ function hasNegativeTabIndex(element) {
16
16
  }
17
17
  function isFocusable(element) {
18
18
  if (!element.matches(selector)) return false;
19
- if (!_WCFMOJKVcjs.isVisible.call(void 0, element)) return false;
19
+ if (!_726BNPQZcjs.isVisible.call(void 0, element)) return false;
20
20
  if (element.closest("[inert]")) return false;
21
21
  return true;
22
22
  }
@@ -30,7 +30,7 @@ function isTabbable(element) {
30
30
  const radioGroup = element.form.elements.namedItem(element.name);
31
31
  if (!radioGroup) return true;
32
32
  if (!("length" in radioGroup)) return true;
33
- const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, element);
33
+ const activeElement = _726BNPQZcjs.getActiveElement.call(void 0, element);
34
34
  if (!activeElement) return true;
35
35
  if (activeElement === element) return true;
36
36
  if (!("form" in activeElement)) return true;
@@ -47,7 +47,7 @@ function getAllFocusableIn(container, includeContainer) {
47
47
  }
48
48
  const focusableElements = elements.filter(isFocusable);
49
49
  focusableElements.forEach((element, i) => {
50
- if (_WCFMOJKVcjs.isFrame.call(void 0, element) && element.contentDocument) {
50
+ if (_726BNPQZcjs.isFrame.call(void 0, element) && element.contentDocument) {
51
51
  const frameBody = element.contentDocument.body;
52
52
  focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
53
53
  }
@@ -73,7 +73,7 @@ function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
73
73
  tabbableElements.unshift(container);
74
74
  }
75
75
  tabbableElements.forEach((element, i) => {
76
- if (_WCFMOJKVcjs.isFrame.call(void 0, element) && element.contentDocument) {
76
+ if (_726BNPQZcjs.isFrame.call(void 0, element) && element.contentDocument) {
77
77
  const frameBody = element.contentDocument.body;
78
78
  const allFrameTabbable = getAllTabbableIn(
79
79
  frameBody,
@@ -114,7 +114,7 @@ function getLastTabbable(fallbackToFocusable) {
114
114
  return getLastTabbableIn(document.body, false, fallbackToFocusable);
115
115
  }
116
116
  function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
117
- const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, container);
117
+ const activeElement = _726BNPQZcjs.getActiveElement.call(void 0, container);
118
118
  const allFocusable = getAllFocusableIn(container, includeContainer);
119
119
  const activeIndex = allFocusable.indexOf(activeElement);
120
120
  const nextFocusableElements = allFocusable.slice(activeIndex + 1);
@@ -129,7 +129,7 @@ function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
129
129
  );
130
130
  }
131
131
  function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
132
- const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, container);
132
+ const activeElement = _726BNPQZcjs.getActiveElement.call(void 0, container);
133
133
  const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
134
134
  const activeIndex = allFocusable.indexOf(activeElement);
135
135
  const previousFocusableElements = allFocusable.slice(activeIndex + 1);
@@ -150,7 +150,7 @@ function getClosestFocusable(element) {
150
150
  return element || null;
151
151
  }
152
152
  function hasFocus(element) {
153
- const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, element);
153
+ const activeElement = _726BNPQZcjs.getActiveElement.call(void 0, element);
154
154
  if (!activeElement) return false;
155
155
  if (activeElement === element) return true;
156
156
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
@@ -158,9 +158,9 @@ function hasFocus(element) {
158
158
  return activeDescendant === element.id;
159
159
  }
160
160
  function hasFocusWithin(element) {
161
- const activeElement = _WCFMOJKVcjs.getActiveElement.call(void 0, element);
161
+ const activeElement = _726BNPQZcjs.getActiveElement.call(void 0, element);
162
162
  if (!activeElement) return false;
163
- if (_WCFMOJKVcjs.contains.call(void 0, element, activeElement)) return true;
163
+ if (_726BNPQZcjs.contains.call(void 0, element, activeElement)) return true;
164
164
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
165
165
  if (!activeDescendant) return false;
166
166
  if (!("id" in element)) return false;
@@ -4,8 +4,8 @@
4
4
 
5
5
 
6
6
 
7
- var _TEPPO3KCcjs = require('../__chunks/TEPPO3KC.cjs');
8
- require('../__chunks/WCFMOJKV.cjs');
7
+ var _WOLZY4WCcjs = require('../__chunks/WOLZY4WC.cjs');
8
+ require('../__chunks/726BNPQZ.cjs');
9
9
  require('../__chunks/7EQBAZ46.cjs');
10
10
 
11
11
 
@@ -13,4 +13,4 @@ require('../__chunks/7EQBAZ46.cjs');
13
13
 
14
14
 
15
15
 
16
- exports.isApple = _TEPPO3KCcjs.isApple; exports.isFirefox = _TEPPO3KCcjs.isFirefox; exports.isMac = _TEPPO3KCcjs.isMac; exports.isSafari = _TEPPO3KCcjs.isSafari; exports.isTouchDevice = _TEPPO3KCcjs.isTouchDevice;
16
+ exports.isApple = _WOLZY4WCcjs.isApple; exports.isFirefox = _WOLZY4WCcjs.isFirefox; exports.isMac = _WOLZY4WCcjs.isMac; exports.isSafari = _WOLZY4WCcjs.isSafari; exports.isTouchDevice = _WOLZY4WCcjs.isTouchDevice;
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _BSLRW6E7cjs = require('../__chunks/BSLRW6E7.cjs');
12
+ var _ASR6PAFNcjs = require('../__chunks/ASR6PAFN.cjs');
13
13
  require('../__chunks/MLCPLY2P.cjs');
14
14
  require('../__chunks/7EQBAZ46.cjs');
15
15
 
@@ -23,4 +23,4 @@ require('../__chunks/7EQBAZ46.cjs');
23
23
 
24
24
 
25
25
 
26
- exports.batch = _BSLRW6E7cjs.batch; exports.createStore = _BSLRW6E7cjs.createStore; exports.init = _BSLRW6E7cjs.init; exports.mergeStore = _BSLRW6E7cjs.mergeStore; exports.omit = _BSLRW6E7cjs.omit; exports.pick = _BSLRW6E7cjs.pick; exports.setup = _BSLRW6E7cjs.setup; exports.subscribe = _BSLRW6E7cjs.subscribe; exports.sync = _BSLRW6E7cjs.sync; exports.throwOnConflictingProps = _BSLRW6E7cjs.throwOnConflictingProps;
26
+ exports.batch = _ASR6PAFNcjs.batch; exports.createStore = _ASR6PAFNcjs.createStore; exports.init = _ASR6PAFNcjs.init; exports.mergeStore = _ASR6PAFNcjs.mergeStore; exports.omit = _ASR6PAFNcjs.omit; exports.pick = _ASR6PAFNcjs.pick; exports.setup = _ASR6PAFNcjs.setup; exports.subscribe = _ASR6PAFNcjs.subscribe; exports.sync = _ASR6PAFNcjs.sync; exports.throwOnConflictingProps = _ASR6PAFNcjs.throwOnConflictingProps;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "./IJ6VFLJG.js";
4
+ } from "./AJZ4BYF3.js";
5
5
  import {
6
6
  createStore
7
- } from "./EQQLU3CG.js";
7
+ } from "./BCALMBPZ.js";
8
8
  import {
9
9
  defaultValue
10
10
  } from "./PBFD2E7P.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "./7DTP4AQO.js";
4
+ } from "./CYQWQL4J.js";
5
5
  import {
6
6
  flatten2DArray,
7
7
  reverseArray
@@ -10,7 +10,7 @@ import {
10
10
  createStore,
11
11
  setup,
12
12
  sync
13
- } from "./EQQLU3CG.js";
13
+ } from "./BCALMBPZ.js";
14
14
  import {
15
15
  defaultValue
16
16
  } from "./PBFD2E7P.js";
@@ -124,6 +124,11 @@ function createCompositeStore(props = {}) {
124
124
  props.defaultActiveId
125
125
  );
126
126
  const initialState = __spreadProps(__spreadValues({}, collection.getState()), {
127
+ id: defaultValue(
128
+ props.id,
129
+ syncState == null ? void 0 : syncState.id,
130
+ `id-${Math.random().toString(36).slice(2, 8)}`
131
+ ),
127
132
  activeId,
128
133
  baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
129
134
  includesBaseElement: defaultValue(
@@ -184,7 +184,7 @@ function mergeStore(...stores) {
184
184
  return Object.assign(state, nextState);
185
185
  }, {});
186
186
  const store = createStore(initialState, ...stores);
187
- return store;
187
+ return Object.assign({}, ...stores, store);
188
188
  }
189
189
  function throwOnConflictingProps(props, store) {
190
190
  if (process.env.NODE_ENV === "production") return;
@@ -5,49 +5,21 @@ import {
5
5
  init,
6
6
  setup,
7
7
  throwOnConflictingProps
8
- } from "./EQQLU3CG.js";
8
+ } from "./BCALMBPZ.js";
9
9
  import {
10
10
  chain,
11
11
  defaultValue
12
12
  } from "./PBFD2E7P.js";
13
13
  import {
14
- getDocument
15
- } from "./PQP5VPTV.js";
14
+ getDocument,
15
+ sortBasedOnDOMPosition
16
+ } from "./DTR5TSDJ.js";
16
17
  import {
17
18
  __spreadProps,
18
19
  __spreadValues
19
20
  } from "./3YLGPPWQ.js";
20
21
 
21
22
  // src/collection/collection-store.ts
22
- function isElementPreceding(a, b) {
23
- return Boolean(
24
- b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
25
- );
26
- }
27
- function sortBasedOnDOMPosition(items) {
28
- const pairs = items.map((item, index) => [index, item]);
29
- let isOrderDifferent = false;
30
- pairs.sort(([indexA, a], [indexB, b]) => {
31
- const elementA = a.element;
32
- const elementB = b.element;
33
- if (elementA === elementB) return 0;
34
- if (!elementA || !elementB) return 0;
35
- if (isElementPreceding(elementA, elementB)) {
36
- if (indexA > indexB) {
37
- isOrderDifferent = true;
38
- }
39
- return -1;
40
- }
41
- if (indexA < indexB) {
42
- isOrderDifferent = true;
43
- }
44
- return 1;
45
- });
46
- if (isOrderDifferent) {
47
- return pairs.map(([_, item]) => item);
48
- }
49
- return items;
50
- }
51
23
  function getCommonParent(items) {
52
24
  var _a;
53
25
  const firstItem = items.find((item) => !!item.element);
@@ -87,7 +59,7 @@ function createCollectionStore(props = {}) {
87
59
  );
88
60
  const collection = createStore(initialState, props.store);
89
61
  const sortItems = (renderedItems) => {
90
- const sortedItems = sortBasedOnDOMPosition(renderedItems);
62
+ const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element);
91
63
  privateStore.setState("renderedItems", sortedItems);
92
64
  collection.setState("renderedItems", sortedItems);
93
65
  };
@@ -180,7 +152,7 @@ function createCollectionStore(props = {}) {
180
152
  if (!id) return null;
181
153
  let item = itemsMap.get(id);
182
154
  if (!item) {
183
- const { items: items2 } = collection.getState();
155
+ const { items: items2 } = privateStore.getState();
184
156
  item = items2.find((item2) => item2.id === id);
185
157
  if (item) {
186
158
  itemsMap.set(id, item);
@@ -7,9 +7,13 @@ function checkIsBrowser() {
7
7
  return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
8
8
  }
9
9
  function getDocument(node) {
10
- return node ? node.ownerDocument || node : document;
10
+ if (!node) return document;
11
+ if ("self" in node) return node.document;
12
+ return node.ownerDocument || document;
11
13
  }
12
14
  function getWindow(node) {
15
+ if (!node) return self;
16
+ if ("self" in node) return node.self;
13
17
  return getDocument(node).defaultView || window;
14
18
  }
15
19
  function getActiveElement(node, activeDescendant = false) {
@@ -168,6 +172,35 @@ function setSelectionRange(element, ...args) {
168
172
  element.setSelectionRange(...args);
169
173
  }
170
174
  }
175
+ function sortBasedOnDOMPosition(items, getElement) {
176
+ const pairs = items.map((item, index) => [index, item]);
177
+ let isOrderDifferent = false;
178
+ pairs.sort(([indexA, a], [indexB, b]) => {
179
+ const elementA = getElement(a);
180
+ const elementB = getElement(b);
181
+ if (elementA === elementB) return 0;
182
+ if (!elementA || !elementB) return 0;
183
+ if (isElementPreceding(elementA, elementB)) {
184
+ if (indexA > indexB) {
185
+ isOrderDifferent = true;
186
+ }
187
+ return -1;
188
+ }
189
+ if (indexA < indexB) {
190
+ isOrderDifferent = true;
191
+ }
192
+ return 1;
193
+ });
194
+ if (isOrderDifferent) {
195
+ return pairs.map(([_, item]) => item);
196
+ }
197
+ return items;
198
+ }
199
+ function isElementPreceding(a, b) {
200
+ return Boolean(
201
+ b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
202
+ );
203
+ }
171
204
 
172
205
  export {
173
206
  canUseDOM,
@@ -187,5 +220,6 @@ export {
187
220
  scrollIntoViewIfNeeded,
188
221
  getScrollingElement,
189
222
  isPartiallyHidden,
190
- setSelectionRange
223
+ setSelectionRange,
224
+ sortBasedOnDOMPosition
191
225
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createDisclosureStore
4
- } from "./6E4KKOSB.js";
4
+ } from "./RCQ5P4YE.js";
5
5
 
6
6
  // src/dialog/dialog-store.ts
7
7
  function createDialogStore(props = {}) {
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createPopoverStore
4
- } from "./3UYWTADI.js";
4
+ } from "./ME2CUF3F.js";
5
5
  import {
6
6
  createStore
7
- } from "./EQQLU3CG.js";
7
+ } from "./BCALMBPZ.js";
8
8
  import {
9
9
  defaultValue
10
10
  } from "./PBFD2E7P.js";
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createDialogStore
4
- } from "./YOHCVXJB.js";
4
+ } from "./FZZ2AVHF.js";
5
5
  import {
6
6
  createStore,
7
7
  mergeStore,
8
8
  omit,
9
9
  throwOnConflictingProps
10
- } from "./EQQLU3CG.js";
10
+ } from "./BCALMBPZ.js";
11
11
  import {
12
12
  defaultValue
13
13
  } from "./PBFD2E7P.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  canUseDOM
4
- } from "./PQP5VPTV.js";
4
+ } from "./DTR5TSDJ.js";
5
5
 
6
6
  // src/utils/platform.ts
7
7
  function isTouchDevice() {
@@ -7,7 +7,7 @@ import {
7
7
  subscribe,
8
8
  sync,
9
9
  throwOnConflictingProps
10
- } from "./EQQLU3CG.js";
10
+ } from "./BCALMBPZ.js";
11
11
  import {
12
12
  defaultValue
13
13
  } from "./PBFD2E7P.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createStore,
4
4
  throwOnConflictingProps
5
- } from "../__chunks/EQQLU3CG.js";
5
+ } from "../__chunks/BCALMBPZ.js";
6
6
  import {
7
7
  defaultValue
8
8
  } from "../__chunks/PBFD2E7P.js";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/7DTP4AQO.js";
5
- import "../__chunks/EQQLU3CG.js";
4
+ } from "../__chunks/CYQWQL4J.js";
5
+ import "../__chunks/BCALMBPZ.js";
6
6
  import "../__chunks/PBFD2E7P.js";
7
- import "../__chunks/PQP5VPTV.js";
7
+ import "../__chunks/DTR5TSDJ.js";
8
8
  import "../__chunks/3YLGPPWQ.js";
9
9
  export {
10
10
  createCollectionStore
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/IJ6VFLJG.js";
5
- import "../__chunks/7DTP4AQO.js";
4
+ } from "../__chunks/AJZ4BYF3.js";
5
+ import "../__chunks/CYQWQL4J.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
7
  import {
8
8
  createPopoverStore
9
- } from "../__chunks/3UYWTADI.js";
10
- import "../__chunks/YOHCVXJB.js";
11
- import "../__chunks/6E4KKOSB.js";
9
+ } from "../__chunks/ME2CUF3F.js";
10
+ import "../__chunks/FZZ2AVHF.js";
11
+ import "../__chunks/RCQ5P4YE.js";
12
12
  import {
13
13
  batch,
14
14
  createStore,
@@ -17,7 +17,7 @@ import {
17
17
  setup,
18
18
  sync,
19
19
  throwOnConflictingProps
20
- } from "../__chunks/EQQLU3CG.js";
20
+ } from "../__chunks/BCALMBPZ.js";
21
21
  import {
22
22
  chain,
23
23
  defaultValue
@@ -25,8 +25,8 @@ import {
25
25
  import {
26
26
  isSafari,
27
27
  isTouchDevice
28
- } from "../__chunks/3VBK76MS.js";
29
- import "../__chunks/PQP5VPTV.js";
28
+ } from "../__chunks/QAGXQEUG.js";
29
+ import "../__chunks/DTR5TSDJ.js";
30
30
  import {
31
31
  __objRest,
32
32
  __spreadProps,