@ariakit/core 0.4.17 → 0.4.19
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.
- package/CHANGELOG.md +9 -0
- package/cjs/__chunks/{MJNGPYVQ.cjs → 2RUCRSRF.cjs} +16 -16
- package/cjs/__chunks/{6BYUUR4M.cjs → 4TRESXTO.cjs} +7 -1
- package/cjs/__chunks/{AOXAROPF.cjs → 75F3RDBE.cjs} +14 -14
- package/cjs/__chunks/{SHOLYDNP.cjs → CTEQSOKZ.cjs} +2 -2
- package/cjs/__chunks/{T247D7JS.cjs → CVLMIMPT.cjs} +2 -2
- package/cjs/__chunks/{CPH45Z4I.cjs → G2CSOTWZ.cjs} +7 -7
- package/cjs/__chunks/{VZPNI7C2.cjs → I4CBIWTX.cjs} +4 -4
- package/cjs/__chunks/{6REHCF5T.cjs → LS2SNHDM.cjs} +6 -6
- package/cjs/__chunks/{UROTDZFK.cjs → R37KOEUW.cjs} +10 -10
- package/cjs/__chunks/{NNJG45OF.cjs → UGAVMSQJ.cjs} +18 -18
- package/cjs/__chunks/{LT33CJGT.cjs → VC22SYOD.cjs} +24 -21
- package/cjs/__chunks/{WPBYRKFQ.cjs → WMTGHDLE.cjs} +15 -15
- package/cjs/checkbox/checkbox-store.cjs +5 -5
- package/cjs/checkbox/checkbox-store.d.cts +5 -5
- package/cjs/checkbox/checkbox-store.d.ts +5 -5
- package/cjs/collection/collection-store.cjs +5 -5
- package/cjs/collection/collection-store.d.cts +5 -5
- package/cjs/collection/collection-store.d.ts +5 -5
- package/cjs/combobox/combobox-store.cjs +40 -40
- package/cjs/combobox/combobox-store.d.cts +26 -26
- package/cjs/combobox/combobox-store.d.ts +26 -26
- package/cjs/composite/composite-overflow-store.cjs +6 -6
- package/cjs/composite/composite-store.cjs +6 -6
- package/cjs/composite/composite-store.d.cts +62 -54
- package/cjs/composite/composite-store.d.ts +62 -54
- package/cjs/dialog/dialog-store.cjs +5 -5
- package/cjs/disclosure/disclosure-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.d.cts +22 -22
- package/cjs/disclosure/disclosure-store.d.ts +22 -22
- package/cjs/form/form-store.cjs +41 -37
- package/cjs/form/form-store.d.cts +14 -14
- package/cjs/form/form-store.d.ts +14 -14
- package/cjs/hovercard/hovercard-store.cjs +7 -7
- package/cjs/hovercard/hovercard-store.d.cts +10 -10
- package/cjs/hovercard/hovercard-store.d.ts +10 -10
- package/cjs/menu/menu-bar-store.cjs +7 -7
- package/cjs/menu/menu-store.cjs +27 -27
- package/cjs/menu/menu-store.d.cts +10 -10
- package/cjs/menu/menu-store.d.ts +10 -10
- package/cjs/menubar/menubar-store.cjs +7 -7
- package/cjs/popover/popover-store.cjs +6 -6
- package/cjs/popover/popover-store.d.cts +17 -17
- package/cjs/popover/popover-store.d.ts +17 -17
- package/cjs/radio/radio-store.cjs +9 -9
- package/cjs/radio/radio-store.d.cts +1 -1
- package/cjs/radio/radio-store.d.ts +1 -1
- package/cjs/select/select-store.cjs +32 -32
- package/cjs/select/select-store.d.cts +17 -17
- package/cjs/select/select-store.d.ts +17 -17
- package/cjs/tab/tab-store.cjs +32 -32
- package/cjs/tab/tab-store.d.cts +20 -20
- package/cjs/tab/tab-store.d.ts +20 -20
- package/cjs/tag/tag-store.cjs +16 -16
- package/cjs/tag/tag-store.d.cts +5 -5
- package/cjs/tag/tag-store.d.ts +5 -5
- package/cjs/toolbar/toolbar-store.cjs +8 -8
- package/cjs/tooltip/tooltip-store.cjs +13 -13
- package/cjs/utils/dom.cjs +2 -2
- package/cjs/utils/events.cjs +6 -6
- package/cjs/utils/focus.cjs +25 -24
- package/cjs/utils/misc.cjs +4 -2
- package/cjs/utils/misc.d.cts +4 -0
- package/cjs/utils/misc.d.ts +4 -0
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.cjs +3 -3
- package/cjs/utils/store.d.cts +1 -1
- package/cjs/utils/store.d.ts +1 -1
- package/cjs/utils/undo.cjs +2 -2
- package/esm/__chunks/{KMAUV3TY.js → 7KNZCZ55.js} +1 -1
- package/esm/__chunks/{37JWRFYW.js → G7XPWBXK.js} +3 -3
- package/esm/__chunks/{O6E4ZWCP.js → GMGLSF2B.js} +1 -1
- package/esm/__chunks/{PSMDSJUH.js → H7R2CY4Q.js} +3 -3
- package/esm/__chunks/{75BJEVSH.js → IHNLLH3I.js} +2 -2
- package/esm/__chunks/{AMRA5WUK.js → KZX46JDB.js} +11 -8
- package/esm/__chunks/{BFGNM53A.js → MJ4ZJEIM.js} +5 -5
- package/esm/__chunks/{TIQDSBWP.js → TEVO2DMI.js} +3 -3
- package/esm/__chunks/{7LM4Q2XB.js → U4NM2NCP.js} +1 -1
- package/esm/__chunks/{73UNQSFO.js → UNDE2QJS.js} +3 -3
- package/esm/__chunks/{XMCVU3LR.js → UWJK2WK2.js} +6 -0
- package/esm/__chunks/{SXKM4CGU.js → XTZ53NXG.js} +4 -4
- package/esm/checkbox/checkbox-store.d.ts +5 -5
- package/esm/checkbox/checkbox-store.js +2 -2
- package/esm/collection/collection-store.d.ts +5 -5
- package/esm/collection/collection-store.js +4 -4
- package/esm/combobox/combobox-store.d.ts +26 -26
- package/esm/combobox/combobox-store.js +9 -9
- package/esm/composite/composite-overflow-store.js +5 -5
- package/esm/composite/composite-store.d.ts +62 -54
- package/esm/composite/composite-store.js +5 -5
- package/esm/dialog/dialog-store.js +4 -4
- package/esm/disclosure/disclosure-store.d.ts +22 -22
- package/esm/disclosure/disclosure-store.js +3 -3
- package/esm/form/form-store.d.ts +14 -14
- package/esm/form/form-store.js +19 -15
- package/esm/hovercard/hovercard-store.d.ts +10 -10
- package/esm/hovercard/hovercard-store.js +6 -6
- package/esm/menu/menu-bar-store.js +6 -6
- package/esm/menu/menu-store.d.ts +10 -10
- package/esm/menu/menu-store.js +9 -9
- package/esm/menubar/menubar-store.js +6 -6
- package/esm/popover/popover-store.d.ts +17 -17
- package/esm/popover/popover-store.js +5 -5
- package/esm/radio/radio-store.d.ts +1 -1
- package/esm/radio/radio-store.js +5 -5
- package/esm/select/select-store.d.ts +17 -17
- package/esm/select/select-store.js +8 -8
- package/esm/tab/tab-store.d.ts +20 -20
- package/esm/tab/tab-store.js +5 -5
- package/esm/tag/tag-store.d.ts +5 -5
- package/esm/tag/tag-store.js +7 -7
- package/esm/toolbar/toolbar-store.js +5 -5
- package/esm/tooltip/tooltip-store.js +7 -7
- package/esm/utils/dom.js +1 -1
- package/esm/utils/events.js +4 -4
- package/esm/utils/focus.js +17 -16
- package/esm/utils/misc.d.ts +4 -0
- package/esm/utils/misc.js +3 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.d.ts +1 -1
- package/esm/utils/store.js +2 -2
- package/esm/utils/undo.js +1 -1
- package/package.json +20 -21
- package/tsconfig.build.json +7 -2
- package/tsconfig.node.json +5 -0
- package/tsconfig.test.json +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.19
|
|
4
|
+
|
|
5
|
+
- Added `disabledFromElement` to `@ariakit/core/utils/misc`.
|
|
6
|
+
- Fixed [`formStore.setError()`](https://ariakit.org/reference/use-form-store#seterror) and [`formStore.setFieldTouched()`](https://ariakit.org/reference/use-form-store#setfieldtouched) failing to set values on nested array field paths such as `items.0.name`.
|
|
7
|
+
|
|
8
|
+
## 0.4.18
|
|
9
|
+
|
|
10
|
+
- Fixed an error when trying to reach focusable elements within iframes.
|
|
11
|
+
|
|
3
12
|
## 0.4.17
|
|
4
13
|
|
|
5
14
|
- Updated packages to target ES2018 (previously ES2017).
|
|
@@ -6,52 +6,52 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _WMTGHDLEcjs = require('./WMTGHDLE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
13
13
|
|
|
14
14
|
// src/disclosure/disclosure-store.ts
|
|
15
15
|
function createDisclosureStore(props = {}) {
|
|
16
|
-
const store =
|
|
16
|
+
const store = _WMTGHDLEcjs.mergeStore.call(void 0,
|
|
17
17
|
props.store,
|
|
18
|
-
|
|
18
|
+
_WMTGHDLEcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
19
19
|
);
|
|
20
|
-
|
|
20
|
+
_WMTGHDLEcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
21
21
|
const syncState = store == null ? void 0 : store.getState();
|
|
22
|
-
const open =
|
|
22
|
+
const open = _4TRESXTOcjs.defaultValue.call(void 0,
|
|
23
23
|
props.open,
|
|
24
24
|
syncState == null ? void 0 : syncState.open,
|
|
25
25
|
props.defaultOpen,
|
|
26
26
|
false
|
|
27
27
|
);
|
|
28
|
-
const animated =
|
|
28
|
+
const animated = _4TRESXTOcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
29
29
|
const initialState = {
|
|
30
30
|
open,
|
|
31
31
|
animated,
|
|
32
32
|
animating: !!animated && open,
|
|
33
33
|
mounted: open,
|
|
34
|
-
contentElement:
|
|
35
|
-
disclosureElement:
|
|
34
|
+
contentElement: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
35
|
+
disclosureElement: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
36
36
|
};
|
|
37
|
-
const disclosure =
|
|
38
|
-
|
|
37
|
+
const disclosure = _WMTGHDLEcjs.createStore.call(void 0, initialState, store);
|
|
38
|
+
_WMTGHDLEcjs.setup.call(void 0,
|
|
39
39
|
disclosure,
|
|
40
|
-
() =>
|
|
40
|
+
() => _WMTGHDLEcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
41
41
|
if (state.animated) return;
|
|
42
42
|
disclosure.setState("animating", false);
|
|
43
43
|
})
|
|
44
44
|
);
|
|
45
|
-
|
|
45
|
+
_WMTGHDLEcjs.setup.call(void 0,
|
|
46
46
|
disclosure,
|
|
47
|
-
() =>
|
|
47
|
+
() => _WMTGHDLEcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
48
48
|
if (!disclosure.getState().animated) return;
|
|
49
49
|
disclosure.setState("animating", true);
|
|
50
50
|
})
|
|
51
51
|
);
|
|
52
|
-
|
|
52
|
+
_WMTGHDLEcjs.setup.call(void 0,
|
|
53
53
|
disclosure,
|
|
54
|
-
() =>
|
|
54
|
+
() => _WMTGHDLEcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
55
55
|
disclosure.setState("mounted", state.open || state.animating);
|
|
56
56
|
})
|
|
57
57
|
);
|
|
@@ -115,6 +115,11 @@ function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
|
115
115
|
function disabledFromProps(props) {
|
|
116
116
|
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
117
117
|
}
|
|
118
|
+
function disabledFromElement(element) {
|
|
119
|
+
if (element.getAttribute("aria-disabled") === "true") return true;
|
|
120
|
+
if ("disabled" in element && element.disabled === true) return true;
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
118
123
|
function removeUndefinedValues(obj) {
|
|
119
124
|
const result = {};
|
|
120
125
|
for (const key in obj) {
|
|
@@ -153,4 +158,5 @@ function defaultValue(...values) {
|
|
|
153
158
|
|
|
154
159
|
|
|
155
160
|
|
|
156
|
-
|
|
161
|
+
|
|
162
|
+
exports.noop = noop; exports.shallowEqual = shallowEqual; exports.applyState = applyState; exports.isObject = isObject; exports.isEmpty = isEmpty; exports.isInteger = isInteger; exports.hasOwnProperty = hasOwnProperty; exports.chain = chain; exports.cx = cx; exports.normalizeString = normalizeString; exports.omit = omit; exports.pick = pick; exports.identity = identity; exports.beforePaint = beforePaint; exports.afterPaint = afterPaint; exports.invariant = invariant; exports.getKeys = getKeys; exports.isFalsyBooleanCallback = isFalsyBooleanCallback; exports.disabledFromProps = disabledFromProps; exports.disabledFromElement = disabledFromElement; exports.removeUndefinedValues = removeUndefinedValues; exports.defaultValue = defaultValue;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _CVLMIMPTcjs = require('./CVLMIMPT.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _WMTGHDLEcjs = require('./WMTGHDLE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
13
13
|
|
|
14
14
|
// src/popover/popover-store.ts
|
|
15
15
|
function createPopoverStore({
|
|
16
16
|
popover: otherPopover,
|
|
17
17
|
...props
|
|
18
18
|
} = {}) {
|
|
19
|
-
const store =
|
|
19
|
+
const store = _WMTGHDLEcjs.mergeStore.call(void 0,
|
|
20
20
|
props.store,
|
|
21
|
-
|
|
21
|
+
_WMTGHDLEcjs.omit.call(void 0, otherPopover, [
|
|
22
22
|
"arrowElement",
|
|
23
23
|
"anchorElement",
|
|
24
24
|
"contentElement",
|
|
@@ -26,10 +26,10 @@ function createPopoverStore({
|
|
|
26
26
|
"disclosureElement"
|
|
27
27
|
])
|
|
28
28
|
);
|
|
29
|
-
|
|
29
|
+
_WMTGHDLEcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
30
30
|
const syncState = store == null ? void 0 : store.getState();
|
|
31
|
-
const dialog =
|
|
32
|
-
const placement =
|
|
31
|
+
const dialog = _CVLMIMPTcjs.createDialogStore.call(void 0, { ...props, store });
|
|
32
|
+
const placement = _4TRESXTOcjs.defaultValue.call(void 0,
|
|
33
33
|
props.placement,
|
|
34
34
|
syncState == null ? void 0 : syncState.placement,
|
|
35
35
|
"bottom"
|
|
@@ -38,19 +38,19 @@ function createPopoverStore({
|
|
|
38
38
|
...dialog.getState(),
|
|
39
39
|
placement,
|
|
40
40
|
currentPlacement: placement,
|
|
41
|
-
anchorElement:
|
|
42
|
-
popoverElement:
|
|
43
|
-
arrowElement:
|
|
44
|
-
rendered: Symbol("rendered")
|
|
41
|
+
anchorElement: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
|
|
42
|
+
popoverElement: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
|
|
43
|
+
arrowElement: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
44
|
+
rendered: /* @__PURE__ */ Symbol("rendered")
|
|
45
45
|
};
|
|
46
|
-
const popover =
|
|
46
|
+
const popover = _WMTGHDLEcjs.createStore.call(void 0, initialState, dialog, store);
|
|
47
47
|
return {
|
|
48
48
|
...dialog,
|
|
49
49
|
...popover,
|
|
50
50
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
51
51
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
52
52
|
setArrowElement: (element) => popover.setState("arrowElement", element),
|
|
53
|
-
render: () => popover.setState("rendered", Symbol("rendered"))
|
|
53
|
+
render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered"))
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utils/undo.ts
|
|
2
2
|
function createUndoCallback(callback) {
|
|
3
3
|
return async () => {
|
|
4
4
|
const redo = await (callback == null ? void 0 : callback());
|
|
@@ -35,7 +35,7 @@ function createUndoManager({
|
|
|
35
35
|
undoStack.shift();
|
|
36
36
|
}
|
|
37
37
|
const sameGroup = group === currentGroup;
|
|
38
|
-
currentGroup = group
|
|
38
|
+
currentGroup = _nullishCoalesce(group, () => ( null));
|
|
39
39
|
const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length;
|
|
40
40
|
const undoCallback = await callback();
|
|
41
41
|
if (!undoCallback) return;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _2RUCRSRFcjs = require('./2RUCRSRF.cjs');
|
|
4
4
|
|
|
5
5
|
// src/dialog/dialog-store.ts
|
|
6
6
|
function createDialogStore(props = {}) {
|
|
7
|
-
return
|
|
7
|
+
return _2RUCRSRFcjs.createDisclosureStore.call(void 0, props);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _UGAVMSQJcjs = require('./UGAVMSQJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _WMTGHDLEcjs = require('./WMTGHDLE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
10
10
|
|
|
11
11
|
// src/menubar/menubar-store.ts
|
|
12
12
|
function createMenubarStore(props = {}) {
|
|
13
13
|
var _a;
|
|
14
14
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
15
|
-
const composite =
|
|
15
|
+
const composite = _UGAVMSQJcjs.createCompositeStore.call(void 0, {
|
|
16
16
|
...props,
|
|
17
|
-
orientation:
|
|
17
|
+
orientation: _4TRESXTOcjs.defaultValue.call(void 0,
|
|
18
18
|
props.orientation,
|
|
19
19
|
syncState == null ? void 0 : syncState.orientation,
|
|
20
20
|
"horizontal"
|
|
21
21
|
),
|
|
22
|
-
focusLoop:
|
|
22
|
+
focusLoop: _4TRESXTOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
23
23
|
});
|
|
24
24
|
const initialState = {
|
|
25
25
|
...composite.getState()
|
|
26
26
|
};
|
|
27
|
-
const menubar =
|
|
27
|
+
const menubar = _WMTGHDLEcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
28
28
|
return {
|
|
29
29
|
...composite,
|
|
30
30
|
...menubar
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utils/dom.ts
|
|
2
2
|
var canUseDOM = checkIsBrowser();
|
|
3
3
|
function checkIsBrowser() {
|
|
4
4
|
var _a;
|
|
@@ -15,11 +15,12 @@ function getWindow(node) {
|
|
|
15
15
|
return getDocument(node).defaultView || window;
|
|
16
16
|
}
|
|
17
17
|
function getActiveElement(node, activeDescendant = false) {
|
|
18
|
+
var _a;
|
|
18
19
|
const { activeElement } = getDocument(node);
|
|
19
20
|
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
if (isFrame(activeElement) && activeElement.contentDocument) {
|
|
23
|
+
if (isFrame(activeElement) && ((_a = activeElement.contentDocument) == null ? void 0 : _a.body)) {
|
|
23
24
|
return getActiveElement(
|
|
24
25
|
activeElement.contentDocument.body,
|
|
25
26
|
activeDescendant
|
|
@@ -117,7 +118,6 @@ function getPopupRole(element, fallback) {
|
|
|
117
118
|
return fallback;
|
|
118
119
|
}
|
|
119
120
|
function getPopupItemRole(element, fallback) {
|
|
120
|
-
var _a;
|
|
121
121
|
const itemRoleByPopupRole = {
|
|
122
122
|
menu: "menuitem",
|
|
123
123
|
listbox: "option",
|
|
@@ -126,7 +126,7 @@ function getPopupItemRole(element, fallback) {
|
|
|
126
126
|
const popupRole = getPopupRole(element);
|
|
127
127
|
if (!popupRole) return fallback;
|
|
128
128
|
const key = popupRole;
|
|
129
|
-
return (
|
|
129
|
+
return _nullishCoalesce(itemRoleByPopupRole[key], () => ( fallback));
|
|
130
130
|
}
|
|
131
131
|
function scrollIntoViewIfNeeded(element, arg) {
|
|
132
132
|
if (isPartiallyHidden(element) && "scrollIntoView" in element) {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _I4CBIWTXcjs = require('./I4CBIWTX.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utils/platform.ts
|
|
6
6
|
function isTouchDevice() {
|
|
7
|
-
return
|
|
7
|
+
return _I4CBIWTXcjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
8
8
|
}
|
|
9
9
|
function isApple() {
|
|
10
|
-
if (!
|
|
10
|
+
if (!_I4CBIWTXcjs.canUseDOM) return false;
|
|
11
11
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
12
12
|
}
|
|
13
13
|
function isSafari() {
|
|
14
|
-
return
|
|
14
|
+
return _I4CBIWTXcjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
15
15
|
}
|
|
16
16
|
function isFirefox() {
|
|
17
|
-
return
|
|
17
|
+
return _I4CBIWTXcjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
18
18
|
}
|
|
19
19
|
function isMac() {
|
|
20
|
-
return
|
|
20
|
+
return _I4CBIWTXcjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _75F3RDBEcjs = require('./75F3RDBE.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _WMTGHDLEcjs = require('./WMTGHDLE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
10
10
|
|
|
11
11
|
// src/hovercard/hovercard-store.ts
|
|
12
12
|
function createHovercardStore(props = {}) {
|
|
13
13
|
var _a;
|
|
14
14
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
15
|
-
const popover =
|
|
15
|
+
const popover = _75F3RDBEcjs.createPopoverStore.call(void 0, {
|
|
16
16
|
...props,
|
|
17
|
-
placement:
|
|
17
|
+
placement: _4TRESXTOcjs.defaultValue.call(void 0,
|
|
18
18
|
props.placement,
|
|
19
19
|
syncState == null ? void 0 : syncState.placement,
|
|
20
20
|
"bottom"
|
|
21
21
|
)
|
|
22
22
|
});
|
|
23
|
-
const timeout =
|
|
23
|
+
const timeout = _4TRESXTOcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
|
|
24
24
|
const initialState = {
|
|
25
25
|
...popover.getState(),
|
|
26
26
|
timeout,
|
|
27
|
-
showTimeout:
|
|
28
|
-
hideTimeout:
|
|
29
|
-
autoFocusOnShow:
|
|
27
|
+
showTimeout: _4TRESXTOcjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
|
|
28
|
+
hideTimeout: _4TRESXTOcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
29
|
+
autoFocusOnShow: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
30
30
|
};
|
|
31
|
-
const hovercard =
|
|
31
|
+
const hovercard = _WMTGHDLEcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
32
32
|
return {
|
|
33
33
|
...popover,
|
|
34
34
|
...hovercard,
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _VC22SYODcjs = require('./VC22SYOD.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _WMTGHDLEcjs = require('./WMTGHDLE.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
16
16
|
|
|
17
17
|
// src/composite/composite-store.ts
|
|
18
18
|
var NULL_ITEM = { id: null };
|
|
@@ -113,46 +113,46 @@ function verticalizeItems(items) {
|
|
|
113
113
|
function createCompositeStore(props = {}) {
|
|
114
114
|
var _a;
|
|
115
115
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
116
|
-
const collection =
|
|
117
|
-
const activeId =
|
|
116
|
+
const collection = _VC22SYODcjs.createCollectionStore.call(void 0, props);
|
|
117
|
+
const activeId = _4TRESXTOcjs.defaultValue.call(void 0,
|
|
118
118
|
props.activeId,
|
|
119
119
|
syncState == null ? void 0 : syncState.activeId,
|
|
120
120
|
props.defaultActiveId
|
|
121
121
|
);
|
|
122
122
|
const initialState = {
|
|
123
123
|
...collection.getState(),
|
|
124
|
-
id:
|
|
124
|
+
id: _4TRESXTOcjs.defaultValue.call(void 0,
|
|
125
125
|
props.id,
|
|
126
126
|
syncState == null ? void 0 : syncState.id,
|
|
127
127
|
`id-${Math.random().toString(36).slice(2, 8)}`
|
|
128
128
|
),
|
|
129
129
|
activeId,
|
|
130
|
-
baseElement:
|
|
131
|
-
includesBaseElement:
|
|
130
|
+
baseElement: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
131
|
+
includesBaseElement: _4TRESXTOcjs.defaultValue.call(void 0,
|
|
132
132
|
props.includesBaseElement,
|
|
133
133
|
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
134
134
|
activeId === null
|
|
135
135
|
),
|
|
136
|
-
moves:
|
|
137
|
-
orientation:
|
|
136
|
+
moves: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
|
|
137
|
+
orientation: _4TRESXTOcjs.defaultValue.call(void 0,
|
|
138
138
|
props.orientation,
|
|
139
139
|
syncState == null ? void 0 : syncState.orientation,
|
|
140
140
|
"both"
|
|
141
141
|
),
|
|
142
|
-
rtl:
|
|
143
|
-
virtualFocus:
|
|
142
|
+
rtl: _4TRESXTOcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
143
|
+
virtualFocus: _4TRESXTOcjs.defaultValue.call(void 0,
|
|
144
144
|
props.virtualFocus,
|
|
145
145
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
146
146
|
false
|
|
147
147
|
),
|
|
148
|
-
focusLoop:
|
|
149
|
-
focusWrap:
|
|
150
|
-
focusShift:
|
|
148
|
+
focusLoop: _4TRESXTOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
149
|
+
focusWrap: _4TRESXTOcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
150
|
+
focusShift: _4TRESXTOcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
151
151
|
};
|
|
152
|
-
const composite =
|
|
153
|
-
|
|
152
|
+
const composite = _WMTGHDLEcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
153
|
+
_WMTGHDLEcjs.setup.call(void 0,
|
|
154
154
|
composite,
|
|
155
|
-
() =>
|
|
155
|
+
() => _WMTGHDLEcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
156
156
|
composite.setState("activeId", (activeId2) => {
|
|
157
157
|
var _a2;
|
|
158
158
|
if (activeId2 !== void 0) return activeId2;
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _I4CBIWTXcjs = require('./I4CBIWTX.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _WMTGHDLEcjs = require('./WMTGHDLE.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
16
16
|
|
|
17
17
|
// src/collection/collection-store.ts
|
|
18
18
|
function getCommonParent(items) {
|
|
19
|
-
var _a;
|
|
19
|
+
var _a, _b;
|
|
20
20
|
const firstItem = items.find((item) => !!item.element);
|
|
21
|
-
const
|
|
22
|
-
let parentElement = (
|
|
23
|
-
|
|
21
|
+
const lastElement = (_a = [...items].reverse().find((item) => !!item.element)) == null ? void 0 : _a.element;
|
|
22
|
+
let parentElement = (_b = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _b.parentElement;
|
|
23
|
+
if (!lastElement) {
|
|
24
|
+
return _I4CBIWTXcjs.getDocument.call(void 0, parentElement).body;
|
|
25
|
+
}
|
|
26
|
+
while (parentElement) {
|
|
24
27
|
const parent = parentElement;
|
|
25
|
-
if (
|
|
28
|
+
if (parent.contains(lastElement)) {
|
|
26
29
|
return parentElement;
|
|
27
30
|
}
|
|
28
31
|
parentElement = parentElement.parentElement;
|
|
29
32
|
}
|
|
30
|
-
return
|
|
33
|
+
return _I4CBIWTXcjs.getDocument.call(void 0, parentElement).body;
|
|
31
34
|
}
|
|
32
35
|
function getPrivateStore(store) {
|
|
33
36
|
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
34
37
|
}
|
|
35
38
|
function createCollectionStore(props = {}) {
|
|
36
39
|
var _a;
|
|
37
|
-
|
|
40
|
+
_WMTGHDLEcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
38
41
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
39
|
-
const items =
|
|
42
|
+
const items = _4TRESXTOcjs.defaultValue.call(void 0,
|
|
40
43
|
props.items,
|
|
41
44
|
syncState == null ? void 0 : syncState.items,
|
|
42
45
|
props.defaultItems,
|
|
@@ -45,27 +48,27 @@ function createCollectionStore(props = {}) {
|
|
|
45
48
|
const itemsMap = new Map(items.map((item) => [item.id, item]));
|
|
46
49
|
const initialState = {
|
|
47
50
|
items,
|
|
48
|
-
renderedItems:
|
|
51
|
+
renderedItems: _4TRESXTOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
49
52
|
};
|
|
50
53
|
const syncPrivateStore = getPrivateStore(props.store);
|
|
51
|
-
const privateStore =
|
|
54
|
+
const privateStore = _WMTGHDLEcjs.createStore.call(void 0,
|
|
52
55
|
{ items, renderedItems: initialState.renderedItems },
|
|
53
56
|
syncPrivateStore
|
|
54
57
|
);
|
|
55
|
-
const collection =
|
|
58
|
+
const collection = _WMTGHDLEcjs.createStore.call(void 0, initialState, props.store);
|
|
56
59
|
const sortItems = (renderedItems) => {
|
|
57
|
-
const sortedItems =
|
|
60
|
+
const sortedItems = _I4CBIWTXcjs.sortBasedOnDOMPosition.call(void 0, renderedItems, (i) => i.element);
|
|
58
61
|
privateStore.setState("renderedItems", sortedItems);
|
|
59
62
|
collection.setState("renderedItems", sortedItems);
|
|
60
63
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
+
_WMTGHDLEcjs.setup.call(void 0, collection, () => _WMTGHDLEcjs.init.call(void 0, privateStore));
|
|
65
|
+
_WMTGHDLEcjs.setup.call(void 0, privateStore, () => {
|
|
66
|
+
return _WMTGHDLEcjs.batch.call(void 0, privateStore, ["items"], (state) => {
|
|
64
67
|
collection.setState("items", state.items);
|
|
65
68
|
});
|
|
66
69
|
});
|
|
67
|
-
|
|
68
|
-
return
|
|
70
|
+
_WMTGHDLEcjs.setup.call(void 0, privateStore, () => {
|
|
71
|
+
return _WMTGHDLEcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
69
72
|
let firstRun = true;
|
|
70
73
|
let raf = requestAnimationFrame(() => {
|
|
71
74
|
const { renderedItems } = collection.getState();
|
|
@@ -137,7 +140,7 @@ function createCollectionStore(props = {}) {
|
|
|
137
140
|
return {
|
|
138
141
|
...collection,
|
|
139
142
|
registerItem,
|
|
140
|
-
renderItem: (item) =>
|
|
143
|
+
renderItem: (item) => _4TRESXTOcjs.chain.call(void 0,
|
|
141
144
|
registerItem(item),
|
|
142
145
|
mergeItem(
|
|
143
146
|
item,
|
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _4TRESXTOcjs = require('./4TRESXTO.cjs');
|
|
11
11
|
|
|
12
12
|
// src/utils/store.ts
|
|
13
13
|
function getInternal(store, key) {
|
|
14
14
|
const internals = store.__unstableInternals;
|
|
15
|
-
|
|
15
|
+
_4TRESXTOcjs.invariant.call(void 0, internals, "Invalid store");
|
|
16
16
|
return internals[key];
|
|
17
17
|
}
|
|
18
18
|
function createStore(initialState, ...stores) {
|
|
19
19
|
let state = initialState;
|
|
20
20
|
let prevStateBatch = state;
|
|
21
|
-
let lastUpdate = Symbol();
|
|
22
|
-
let destroy =
|
|
21
|
+
let lastUpdate = /* @__PURE__ */ Symbol();
|
|
22
|
+
let destroy = _4TRESXTOcjs.noop;
|
|
23
23
|
const instances = /* @__PURE__ */ new Set();
|
|
24
24
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
25
25
|
const setups = /* @__PURE__ */ new Set();
|
|
@@ -33,7 +33,7 @@ function createStore(initialState, ...stores) {
|
|
|
33
33
|
};
|
|
34
34
|
const storeInit = () => {
|
|
35
35
|
const initialized = instances.size;
|
|
36
|
-
const instance = Symbol();
|
|
36
|
+
const instance = /* @__PURE__ */ Symbol();
|
|
37
37
|
instances.add(instance);
|
|
38
38
|
const maybeDestroy = () => {
|
|
39
39
|
instances.delete(instance);
|
|
@@ -41,13 +41,13 @@ function createStore(initialState, ...stores) {
|
|
|
41
41
|
destroy();
|
|
42
42
|
};
|
|
43
43
|
if (initialized) return maybeDestroy;
|
|
44
|
-
const desyncs =
|
|
45
|
-
(key) =>
|
|
44
|
+
const desyncs = _4TRESXTOcjs.getKeys.call(void 0, state).map(
|
|
45
|
+
(key) => _4TRESXTOcjs.chain.call(void 0,
|
|
46
46
|
...stores.map((store) => {
|
|
47
47
|
var _a;
|
|
48
48
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
49
49
|
if (!storeState) return;
|
|
50
|
-
if (!
|
|
50
|
+
if (!_4TRESXTOcjs.hasOwnProperty.call(void 0, storeState, key)) return;
|
|
51
51
|
return sync(store, [key], (state2) => {
|
|
52
52
|
setState(
|
|
53
53
|
key,
|
|
@@ -65,7 +65,7 @@ function createStore(initialState, ...stores) {
|
|
|
65
65
|
teardowns.push(setup2());
|
|
66
66
|
}
|
|
67
67
|
const cleanups = stores.map(init);
|
|
68
|
-
destroy =
|
|
68
|
+
destroy = _4TRESXTOcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
|
|
69
69
|
return maybeDestroy;
|
|
70
70
|
};
|
|
71
71
|
const sub = (keys, listener, set = listeners) => {
|
|
@@ -88,13 +88,13 @@ function createStore(initialState, ...stores) {
|
|
|
88
88
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
89
89
|
return sub(keys, listener, batchListeners);
|
|
90
90
|
};
|
|
91
|
-
const storePick = (keys) => createStore(
|
|
92
|
-
const storeOmit = (keys) => createStore(
|
|
91
|
+
const storePick = (keys) => createStore(_4TRESXTOcjs.pick.call(void 0, state, keys), finalStore);
|
|
92
|
+
const storeOmit = (keys) => createStore(_4TRESXTOcjs.omit.call(void 0, state, keys), finalStore);
|
|
93
93
|
const getState = () => state;
|
|
94
94
|
const setState = (key, value, fromStores = false) => {
|
|
95
95
|
var _a;
|
|
96
|
-
if (!
|
|
97
|
-
const nextValue =
|
|
96
|
+
if (!_4TRESXTOcjs.hasOwnProperty.call(void 0, state, key)) return;
|
|
97
|
+
const nextValue = _4TRESXTOcjs.applyState.call(void 0, value, state[key]);
|
|
98
98
|
if (nextValue === state[key]) return;
|
|
99
99
|
if (!fromStores) {
|
|
100
100
|
for (const store of stores) {
|
|
@@ -103,7 +103,7 @@ function createStore(initialState, ...stores) {
|
|
|
103
103
|
}
|
|
104
104
|
const prevState = state;
|
|
105
105
|
state = { ...state, [key]: nextValue };
|
|
106
|
-
const thisUpdate = Symbol();
|
|
106
|
+
const thisUpdate = /* @__PURE__ */ Symbol();
|
|
107
107
|
lastUpdate = thisUpdate;
|
|
108
108
|
updatedKeys.add(key);
|
|
109
109
|
const run = (listener, prev, uKeys) => {
|
|
@@ -194,7 +194,7 @@ function throwOnConflictingProps(props, store) {
|
|
|
194
194
|
if (!defaultKeys.length) return;
|
|
195
195
|
const storeState = store.getState();
|
|
196
196
|
const conflictingProps = defaultKeys.filter(
|
|
197
|
-
(key) =>
|
|
197
|
+
(key) => _4TRESXTOcjs.hasOwnProperty.call(void 0, storeState, key)
|
|
198
198
|
);
|
|
199
199
|
if (!conflictingProps.length) return;
|
|
200
200
|
throw new Error(
|