@ariakit/core 0.4.16 → 0.4.18
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 +8 -0
- package/cjs/__chunks/{VZPNI7C2.cjs → 4ITB54IT.cjs} +2 -1
- package/cjs/__chunks/{MLCPLY2P.cjs → 6BYUUR4M.cjs} +2 -6
- package/cjs/__chunks/AOXAROPF.cjs +59 -0
- package/cjs/__chunks/{E5AYFGW2.cjs → HGVIF2R4.cjs} +20 -23
- package/cjs/__chunks/JNPL5IHP.cjs +36 -0
- package/cjs/__chunks/{6REHCF5T.cjs → JNYCP2QO.cjs} +6 -6
- package/cjs/__chunks/{L5GSFUJU.cjs → MJNGPYVQ.cjs} +19 -22
- package/cjs/__chunks/{7WVAUIME.cjs → OYTZFOIJ.cjs} +28 -28
- package/cjs/__chunks/{VR2FVDSU.cjs → T247D7JS.cjs} +2 -2
- package/cjs/__chunks/UROTDZFK.cjs +41 -0
- package/cjs/__chunks/{EKSEHA55.cjs → WPBYRKFQ.cjs} +13 -17
- package/cjs/checkbox/checkbox-store.cjs +8 -11
- package/cjs/collection/collection-store.cjs +5 -6
- package/cjs/combobox/combobox-store.cjs +57 -57
- package/cjs/composite/composite-overflow-store.cjs +6 -7
- package/cjs/composite/composite-store.cjs +6 -7
- package/cjs/dialog/dialog-store.cjs +5 -6
- package/cjs/disclosure/disclosure-store.cjs +4 -5
- package/cjs/form/form-store.cjs +34 -35
- package/cjs/hovercard/hovercard-store.cjs +7 -8
- package/cjs/index.cjs +1 -3
- package/cjs/menu/menu-bar-store.cjs +7 -8
- package/cjs/menu/menu-store.cjs +49 -50
- package/cjs/menubar/menubar-store.cjs +7 -8
- package/cjs/popover/popover-store.cjs +6 -7
- package/cjs/radio/radio-store.cjs +23 -23
- package/cjs/select/select-store.cjs +49 -49
- package/cjs/tab/tab-store.cjs +47 -51
- package/cjs/tag/tag-store.cjs +21 -22
- package/cjs/toolbar/toolbar-store.cjs +10 -13
- package/cjs/tooltip/tooltip-store.cjs +20 -19
- package/cjs/utils/array.cjs +0 -1
- package/cjs/utils/dom.cjs +2 -3
- package/cjs/utils/events.cjs +7 -11
- package/cjs/utils/focus.cjs +24 -25
- package/cjs/utils/misc.cjs +2 -3
- package/cjs/utils/platform.cjs +3 -4
- package/cjs/utils/store.cjs +3 -4
- package/cjs/utils/undo.cjs +0 -1
- package/esm/__chunks/{37JWRFYW.js → 3DNM6L6E.js} +2 -1
- package/esm/__chunks/{43IPP2F4.js → 75BJEVSH.js} +5 -8
- package/esm/__chunks/{MD3RIO2T.js → BFGNM53A.js} +15 -19
- package/esm/__chunks/{RZDDWCDV.js → KMAUV3TY.js} +1 -1
- package/esm/__chunks/{K2KIGYQU.js → N5XGANPW.js} +7 -10
- package/esm/__chunks/{C34RJTDU.js → RVTIKFRL.js} +13 -13
- package/esm/__chunks/{O6E4ZWCP.js → SNHYQNEZ.js} +1 -1
- package/esm/__chunks/{EWA2WL6G.js → SXKM4CGU.js} +2 -6
- package/esm/__chunks/{X2ASWIQW.js → TIQDSBWP.js} +13 -13
- package/esm/__chunks/{76UM5ZLT.js → WSDJ6ZRB.js} +13 -11
- package/esm/__chunks/{PBFD2E7P.js → XMCVU3LR.js} +1 -4
- package/esm/checkbox/checkbox-store.js +5 -8
- package/esm/collection/collection-store.js +4 -5
- package/esm/combobox/combobox-store.js +28 -28
- package/esm/composite/composite-overflow-store.js +5 -6
- package/esm/composite/composite-store.js +5 -6
- package/esm/dialog/dialog-store.js +4 -5
- package/esm/disclosure/disclosure-store.js +3 -4
- package/esm/form/form-store.js +12 -13
- package/esm/hovercard/hovercard-store.js +6 -7
- package/esm/index.js +0 -1
- package/esm/menu/menu-bar-store.js +6 -7
- package/esm/menu/menu-store.js +33 -34
- package/esm/menubar/menubar-store.js +6 -7
- package/esm/popover/popover-store.js +5 -6
- package/esm/radio/radio-store.js +20 -20
- package/esm/select/select-store.js +27 -27
- package/esm/tab/tab-store.js +21 -25
- package/esm/tag/tag-store.js +12 -13
- package/esm/toolbar/toolbar-store.js +8 -11
- package/esm/tooltip/tooltip-store.js +16 -15
- package/esm/utils/array.js +0 -1
- package/esm/utils/dom.js +1 -2
- package/esm/utils/events.js +4 -8
- package/esm/utils/focus.js +17 -18
- package/esm/utils/misc.js +1 -2
- package/esm/utils/platform.js +2 -3
- package/esm/utils/store.js +2 -3
- package/esm/utils/undo.js +0 -1
- package/package.json +1 -1
- package/cjs/__chunks/34NK2NPD.cjs +0 -41
- package/cjs/__chunks/7EQBAZ46.cjs +0 -37
- package/cjs/__chunks/OGYYHXPP.cjs +0 -63
- package/cjs/__chunks/XVG7OFIP.cjs +0 -34
- package/esm/__chunks/3YLGPPWQ.js +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.18
|
|
4
|
+
|
|
5
|
+
- Fixed an error when trying to reach focusable elements within iframes.
|
|
6
|
+
|
|
7
|
+
## 0.4.17
|
|
8
|
+
|
|
9
|
+
- Updated packages to target ES2018 (previously ES2017).
|
|
10
|
+
|
|
3
11
|
## 0.4.16
|
|
4
12
|
|
|
5
13
|
- Updated `Array` types to `ReadonlyArray` for better compatibility.
|
|
@@ -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
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
|
|
3
|
-
var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
4
|
-
|
|
5
|
-
// src/utils/misc.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/misc.ts
|
|
6
2
|
function noop(..._) {
|
|
7
3
|
}
|
|
8
4
|
function shallowEqual(a, b) {
|
|
@@ -73,7 +69,7 @@ function normalizeString(str) {
|
|
|
73
69
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
74
70
|
}
|
|
75
71
|
function omit(object, keys) {
|
|
76
|
-
const result =
|
|
72
|
+
const result = { ...object };
|
|
77
73
|
for (const key of keys) {
|
|
78
74
|
if (hasOwnProperty(result, key)) {
|
|
79
75
|
delete result[key];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _T247D7JScjs = require('./T247D7JS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _WPBYRKFQcjs = require('./WPBYRKFQ.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
13
|
+
|
|
14
|
+
// src/popover/popover-store.ts
|
|
15
|
+
function createPopoverStore({
|
|
16
|
+
popover: otherPopover,
|
|
17
|
+
...props
|
|
18
|
+
} = {}) {
|
|
19
|
+
const store = _WPBYRKFQcjs.mergeStore.call(void 0,
|
|
20
|
+
props.store,
|
|
21
|
+
_WPBYRKFQcjs.omit.call(void 0, otherPopover, [
|
|
22
|
+
"arrowElement",
|
|
23
|
+
"anchorElement",
|
|
24
|
+
"contentElement",
|
|
25
|
+
"popoverElement",
|
|
26
|
+
"disclosureElement"
|
|
27
|
+
])
|
|
28
|
+
);
|
|
29
|
+
_WPBYRKFQcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
30
|
+
const syncState = store == null ? void 0 : store.getState();
|
|
31
|
+
const dialog = _T247D7JScjs.createDialogStore.call(void 0, { ...props, store });
|
|
32
|
+
const placement = _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
33
|
+
props.placement,
|
|
34
|
+
syncState == null ? void 0 : syncState.placement,
|
|
35
|
+
"bottom"
|
|
36
|
+
);
|
|
37
|
+
const initialState = {
|
|
38
|
+
...dialog.getState(),
|
|
39
|
+
placement,
|
|
40
|
+
currentPlacement: placement,
|
|
41
|
+
anchorElement: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
|
|
42
|
+
popoverElement: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
|
|
43
|
+
arrowElement: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
44
|
+
rendered: Symbol("rendered")
|
|
45
|
+
};
|
|
46
|
+
const popover = _WPBYRKFQcjs.createStore.call(void 0, initialState, dialog, store);
|
|
47
|
+
return {
|
|
48
|
+
...dialog,
|
|
49
|
+
...popover,
|
|
50
|
+
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
51
|
+
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
52
|
+
setArrowElement: (element) => popover.setState("arrowElement", element),
|
|
53
|
+
render: () => popover.setState("rendered", Symbol("rendered"))
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
exports.createPopoverStore = createPopoverStore;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _4ITB54ITcjs = require('./4ITB54IT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _WPBYRKFQcjs = require('./WPBYRKFQ.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
15
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
20
16
|
|
|
21
17
|
// src/collection/collection-store.ts
|
|
22
18
|
function getCommonParent(items) {
|
|
@@ -31,16 +27,16 @@ function getCommonParent(items) {
|
|
|
31
27
|
}
|
|
32
28
|
parentElement = parentElement.parentElement;
|
|
33
29
|
}
|
|
34
|
-
return
|
|
30
|
+
return _4ITB54ITcjs.getDocument.call(void 0, parentElement).body;
|
|
35
31
|
}
|
|
36
32
|
function getPrivateStore(store) {
|
|
37
33
|
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
38
34
|
}
|
|
39
35
|
function createCollectionStore(props = {}) {
|
|
40
36
|
var _a;
|
|
41
|
-
|
|
37
|
+
_WPBYRKFQcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
42
38
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
43
|
-
const items =
|
|
39
|
+
const items = _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
44
40
|
props.items,
|
|
45
41
|
syncState == null ? void 0 : syncState.items,
|
|
46
42
|
props.defaultItems,
|
|
@@ -49,27 +45,27 @@ function createCollectionStore(props = {}) {
|
|
|
49
45
|
const itemsMap = new Map(items.map((item) => [item.id, item]));
|
|
50
46
|
const initialState = {
|
|
51
47
|
items,
|
|
52
|
-
renderedItems:
|
|
48
|
+
renderedItems: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
53
49
|
};
|
|
54
50
|
const syncPrivateStore = getPrivateStore(props.store);
|
|
55
|
-
const privateStore =
|
|
51
|
+
const privateStore = _WPBYRKFQcjs.createStore.call(void 0,
|
|
56
52
|
{ items, renderedItems: initialState.renderedItems },
|
|
57
53
|
syncPrivateStore
|
|
58
54
|
);
|
|
59
|
-
const collection =
|
|
55
|
+
const collection = _WPBYRKFQcjs.createStore.call(void 0, initialState, props.store);
|
|
60
56
|
const sortItems = (renderedItems) => {
|
|
61
|
-
const sortedItems =
|
|
57
|
+
const sortedItems = _4ITB54ITcjs.sortBasedOnDOMPosition.call(void 0, renderedItems, (i) => i.element);
|
|
62
58
|
privateStore.setState("renderedItems", sortedItems);
|
|
63
59
|
collection.setState("renderedItems", sortedItems);
|
|
64
60
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return
|
|
61
|
+
_WPBYRKFQcjs.setup.call(void 0, collection, () => _WPBYRKFQcjs.init.call(void 0, privateStore));
|
|
62
|
+
_WPBYRKFQcjs.setup.call(void 0, privateStore, () => {
|
|
63
|
+
return _WPBYRKFQcjs.batch.call(void 0, privateStore, ["items"], (state) => {
|
|
68
64
|
collection.setState("items", state.items);
|
|
69
65
|
});
|
|
70
66
|
});
|
|
71
|
-
|
|
72
|
-
return
|
|
67
|
+
_WPBYRKFQcjs.setup.call(void 0, privateStore, () => {
|
|
68
|
+
return _WPBYRKFQcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
73
69
|
let firstRun = true;
|
|
74
70
|
let raf = requestAnimationFrame(() => {
|
|
75
71
|
const { renderedItems } = collection.getState();
|
|
@@ -106,7 +102,7 @@ function createCollectionStore(props = {}) {
|
|
|
106
102
|
const nextItems = items2.slice();
|
|
107
103
|
if (index !== -1) {
|
|
108
104
|
prevItem = items2[index];
|
|
109
|
-
const nextItem =
|
|
105
|
+
const nextItem = { ...prevItem, ...item };
|
|
110
106
|
nextItems[index] = nextItem;
|
|
111
107
|
itemsMap.set(item.id, nextItem);
|
|
112
108
|
} else {
|
|
@@ -138,9 +134,10 @@ function createCollectionStore(props = {}) {
|
|
|
138
134
|
(getItems) => privateStore.setState("items", getItems),
|
|
139
135
|
true
|
|
140
136
|
);
|
|
141
|
-
return
|
|
137
|
+
return {
|
|
138
|
+
...collection,
|
|
142
139
|
registerItem,
|
|
143
|
-
renderItem: (item) =>
|
|
140
|
+
renderItem: (item) => _6BYUUR4Mcjs.chain.call(void 0,
|
|
144
141
|
registerItem(item),
|
|
145
142
|
mergeItem(
|
|
146
143
|
item,
|
|
@@ -161,7 +158,7 @@ function createCollectionStore(props = {}) {
|
|
|
161
158
|
},
|
|
162
159
|
// @ts-expect-error Internal
|
|
163
160
|
__unstablePrivateStore: privateStore
|
|
164
|
-
}
|
|
161
|
+
};
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _OYTZFOIJcjs = require('./OYTZFOIJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _WPBYRKFQcjs = require('./WPBYRKFQ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
10
|
+
|
|
11
|
+
// src/menubar/menubar-store.ts
|
|
12
|
+
function createMenubarStore(props = {}) {
|
|
13
|
+
var _a;
|
|
14
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
15
|
+
const composite = _OYTZFOIJcjs.createCompositeStore.call(void 0, {
|
|
16
|
+
...props,
|
|
17
|
+
orientation: _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
18
|
+
props.orientation,
|
|
19
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
20
|
+
"horizontal"
|
|
21
|
+
),
|
|
22
|
+
focusLoop: _6BYUUR4Mcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
23
|
+
});
|
|
24
|
+
const initialState = {
|
|
25
|
+
...composite.getState()
|
|
26
|
+
};
|
|
27
|
+
const menubar = _WPBYRKFQcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
28
|
+
return {
|
|
29
|
+
...composite,
|
|
30
|
+
...menubar
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
exports.createMenubarStore = createMenubarStore;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4ITB54ITcjs = require('./4ITB54IT.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utils/platform.ts
|
|
6
6
|
function isTouchDevice() {
|
|
7
|
-
return
|
|
7
|
+
return _4ITB54ITcjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
8
8
|
}
|
|
9
9
|
function isApple() {
|
|
10
|
-
if (!
|
|
10
|
+
if (!_4ITB54ITcjs.canUseDOM) return false;
|
|
11
11
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
12
12
|
}
|
|
13
13
|
function isSafari() {
|
|
14
|
-
return
|
|
14
|
+
return _4ITB54ITcjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
15
15
|
}
|
|
16
16
|
function isFirefox() {
|
|
17
|
-
return
|
|
17
|
+
return _4ITB54ITcjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
18
18
|
}
|
|
19
19
|
function isMac() {
|
|
20
|
-
return
|
|
20
|
+
return _4ITB54ITcjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
|
|
@@ -6,60 +6,57 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _WPBYRKFQcjs = require('./WPBYRKFQ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
12
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
17
13
|
|
|
18
14
|
// src/disclosure/disclosure-store.ts
|
|
19
15
|
function createDisclosureStore(props = {}) {
|
|
20
|
-
const store =
|
|
16
|
+
const store = _WPBYRKFQcjs.mergeStore.call(void 0,
|
|
21
17
|
props.store,
|
|
22
|
-
|
|
18
|
+
_WPBYRKFQcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
23
19
|
);
|
|
24
|
-
|
|
20
|
+
_WPBYRKFQcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
25
21
|
const syncState = store == null ? void 0 : store.getState();
|
|
26
|
-
const open =
|
|
22
|
+
const open = _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
27
23
|
props.open,
|
|
28
24
|
syncState == null ? void 0 : syncState.open,
|
|
29
25
|
props.defaultOpen,
|
|
30
26
|
false
|
|
31
27
|
);
|
|
32
|
-
const animated =
|
|
28
|
+
const animated = _6BYUUR4Mcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
33
29
|
const initialState = {
|
|
34
30
|
open,
|
|
35
31
|
animated,
|
|
36
32
|
animating: !!animated && open,
|
|
37
33
|
mounted: open,
|
|
38
|
-
contentElement:
|
|
39
|
-
disclosureElement:
|
|
34
|
+
contentElement: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
35
|
+
disclosureElement: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
40
36
|
};
|
|
41
|
-
const disclosure =
|
|
42
|
-
|
|
37
|
+
const disclosure = _WPBYRKFQcjs.createStore.call(void 0, initialState, store);
|
|
38
|
+
_WPBYRKFQcjs.setup.call(void 0,
|
|
43
39
|
disclosure,
|
|
44
|
-
() =>
|
|
40
|
+
() => _WPBYRKFQcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
45
41
|
if (state.animated) return;
|
|
46
42
|
disclosure.setState("animating", false);
|
|
47
43
|
})
|
|
48
44
|
);
|
|
49
|
-
|
|
45
|
+
_WPBYRKFQcjs.setup.call(void 0,
|
|
50
46
|
disclosure,
|
|
51
|
-
() =>
|
|
47
|
+
() => _WPBYRKFQcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
52
48
|
if (!disclosure.getState().animated) return;
|
|
53
49
|
disclosure.setState("animating", true);
|
|
54
50
|
})
|
|
55
51
|
);
|
|
56
|
-
|
|
52
|
+
_WPBYRKFQcjs.setup.call(void 0,
|
|
57
53
|
disclosure,
|
|
58
|
-
() =>
|
|
54
|
+
() => _WPBYRKFQcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
59
55
|
disclosure.setState("mounted", state.open || state.animating);
|
|
60
56
|
})
|
|
61
57
|
);
|
|
62
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
...disclosure,
|
|
63
60
|
disclosure: props.disclosure,
|
|
64
61
|
setOpen: (value) => disclosure.setState("open", value),
|
|
65
62
|
show: () => disclosure.setState("open", true),
|
|
@@ -68,7 +65,7 @@ function createDisclosureStore(props = {}) {
|
|
|
68
65
|
stopAnimation: () => disclosure.setState("animating", false),
|
|
69
66
|
setContentElement: (value) => disclosure.setState("contentElement", value),
|
|
70
67
|
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
|
|
71
|
-
}
|
|
68
|
+
};
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
|
|
@@ -4,19 +4,15 @@
|
|
|
4
4
|
var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _HGVIF2R4cjs = require('./HGVIF2R4.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _WPBYRKFQcjs = require('./WPBYRKFQ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
15
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
20
16
|
|
|
21
17
|
// src/composite/composite-store.ts
|
|
22
18
|
var NULL_ITEM = { id: null };
|
|
@@ -100,14 +96,15 @@ function verticalizeItems(items) {
|
|
|
100
96
|
for (const row of rows) {
|
|
101
97
|
const item = row[i];
|
|
102
98
|
if (item) {
|
|
103
|
-
verticalized.push(
|
|
99
|
+
verticalized.push({
|
|
100
|
+
...item,
|
|
104
101
|
// If there's no rowId, it means that it's not a grid composite, but
|
|
105
102
|
// a single row instead. So, instead of verticalizing it, that is,
|
|
106
103
|
// assigning a different rowId based on the column index, we keep it
|
|
107
104
|
// undefined so they will be part of the same row. This is useful
|
|
108
105
|
// when using up/down on one-dimensional composites.
|
|
109
106
|
rowId: item.rowId ? `${i}` : void 0
|
|
110
|
-
})
|
|
107
|
+
});
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
}
|
|
@@ -116,45 +113,46 @@ function verticalizeItems(items) {
|
|
|
116
113
|
function createCompositeStore(props = {}) {
|
|
117
114
|
var _a;
|
|
118
115
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
119
|
-
const collection =
|
|
120
|
-
const activeId =
|
|
116
|
+
const collection = _HGVIF2R4cjs.createCollectionStore.call(void 0, props);
|
|
117
|
+
const activeId = _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
121
118
|
props.activeId,
|
|
122
119
|
syncState == null ? void 0 : syncState.activeId,
|
|
123
120
|
props.defaultActiveId
|
|
124
121
|
);
|
|
125
|
-
const initialState =
|
|
126
|
-
|
|
122
|
+
const initialState = {
|
|
123
|
+
...collection.getState(),
|
|
124
|
+
id: _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
127
125
|
props.id,
|
|
128
126
|
syncState == null ? void 0 : syncState.id,
|
|
129
127
|
`id-${Math.random().toString(36).slice(2, 8)}`
|
|
130
128
|
),
|
|
131
129
|
activeId,
|
|
132
|
-
baseElement:
|
|
133
|
-
includesBaseElement:
|
|
130
|
+
baseElement: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
131
|
+
includesBaseElement: _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
134
132
|
props.includesBaseElement,
|
|
135
133
|
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
136
134
|
activeId === null
|
|
137
135
|
),
|
|
138
|
-
moves:
|
|
139
|
-
orientation:
|
|
136
|
+
moves: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
|
|
137
|
+
orientation: _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
140
138
|
props.orientation,
|
|
141
139
|
syncState == null ? void 0 : syncState.orientation,
|
|
142
140
|
"both"
|
|
143
141
|
),
|
|
144
|
-
rtl:
|
|
145
|
-
virtualFocus:
|
|
142
|
+
rtl: _6BYUUR4Mcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
143
|
+
virtualFocus: _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
146
144
|
props.virtualFocus,
|
|
147
145
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
148
146
|
false
|
|
149
147
|
),
|
|
150
|
-
focusLoop:
|
|
151
|
-
focusWrap:
|
|
152
|
-
focusShift:
|
|
153
|
-
}
|
|
154
|
-
const composite =
|
|
155
|
-
|
|
148
|
+
focusLoop: _6BYUUR4Mcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
149
|
+
focusWrap: _6BYUUR4Mcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
150
|
+
focusShift: _6BYUUR4Mcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
151
|
+
};
|
|
152
|
+
const composite = _WPBYRKFQcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
153
|
+
_WPBYRKFQcjs.setup.call(void 0,
|
|
156
154
|
composite,
|
|
157
|
-
() =>
|
|
155
|
+
() => _WPBYRKFQcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
158
156
|
composite.setState("activeId", (activeId2) => {
|
|
159
157
|
var _a2;
|
|
160
158
|
if (activeId2 !== void 0) return activeId2;
|
|
@@ -230,7 +228,9 @@ function createCompositeStore(props = {}) {
|
|
|
230
228
|
}
|
|
231
229
|
return nextItem == null ? void 0 : nextItem.id;
|
|
232
230
|
};
|
|
233
|
-
return
|
|
231
|
+
return {
|
|
232
|
+
...collection,
|
|
233
|
+
...composite,
|
|
234
234
|
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
235
235
|
setActiveId: (id) => composite.setState("activeId", id),
|
|
236
236
|
move: (id) => {
|
|
@@ -270,7 +270,7 @@ function createCompositeStore(props = {}) {
|
|
|
270
270
|
}
|
|
271
271
|
return getNextId("up", options);
|
|
272
272
|
}
|
|
273
|
-
}
|
|
273
|
+
};
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _MJNGPYVQcjs = require('./MJNGPYVQ.cjs');
|
|
4
4
|
|
|
5
5
|
// src/dialog/dialog-store.ts
|
|
6
6
|
function createDialogStore(props = {}) {
|
|
7
|
-
return
|
|
7
|
+
return _MJNGPYVQcjs.createDisclosureStore.call(void 0, props);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _AOXAROPFcjs = require('./AOXAROPF.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _WPBYRKFQcjs = require('./WPBYRKFQ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
10
|
+
|
|
11
|
+
// src/hovercard/hovercard-store.ts
|
|
12
|
+
function createHovercardStore(props = {}) {
|
|
13
|
+
var _a;
|
|
14
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
15
|
+
const popover = _AOXAROPFcjs.createPopoverStore.call(void 0, {
|
|
16
|
+
...props,
|
|
17
|
+
placement: _6BYUUR4Mcjs.defaultValue.call(void 0,
|
|
18
|
+
props.placement,
|
|
19
|
+
syncState == null ? void 0 : syncState.placement,
|
|
20
|
+
"bottom"
|
|
21
|
+
)
|
|
22
|
+
});
|
|
23
|
+
const timeout = _6BYUUR4Mcjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
|
|
24
|
+
const initialState = {
|
|
25
|
+
...popover.getState(),
|
|
26
|
+
timeout,
|
|
27
|
+
showTimeout: _6BYUUR4Mcjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
|
|
28
|
+
hideTimeout: _6BYUUR4Mcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
29
|
+
autoFocusOnShow: _6BYUUR4Mcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
30
|
+
};
|
|
31
|
+
const hovercard = _WPBYRKFQcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
32
|
+
return {
|
|
33
|
+
...popover,
|
|
34
|
+
...hovercard,
|
|
35
|
+
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.createHovercardStore = createHovercardStore;
|
|
@@ -7,23 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _7EQBAZ46cjs = require('./7EQBAZ46.cjs');
|
|
10
|
+
var _6BYUUR4Mcjs = require('./6BYUUR4M.cjs');
|
|
15
11
|
|
|
16
12
|
// src/utils/store.ts
|
|
17
13
|
function getInternal(store, key) {
|
|
18
14
|
const internals = store.__unstableInternals;
|
|
19
|
-
|
|
15
|
+
_6BYUUR4Mcjs.invariant.call(void 0, internals, "Invalid store");
|
|
20
16
|
return internals[key];
|
|
21
17
|
}
|
|
22
18
|
function createStore(initialState, ...stores) {
|
|
23
19
|
let state = initialState;
|
|
24
20
|
let prevStateBatch = state;
|
|
25
21
|
let lastUpdate = Symbol();
|
|
26
|
-
let destroy =
|
|
22
|
+
let destroy = _6BYUUR4Mcjs.noop;
|
|
27
23
|
const instances = /* @__PURE__ */ new Set();
|
|
28
24
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
29
25
|
const setups = /* @__PURE__ */ new Set();
|
|
@@ -45,13 +41,13 @@ function createStore(initialState, ...stores) {
|
|
|
45
41
|
destroy();
|
|
46
42
|
};
|
|
47
43
|
if (initialized) return maybeDestroy;
|
|
48
|
-
const desyncs =
|
|
49
|
-
(key) =>
|
|
44
|
+
const desyncs = _6BYUUR4Mcjs.getKeys.call(void 0, state).map(
|
|
45
|
+
(key) => _6BYUUR4Mcjs.chain.call(void 0,
|
|
50
46
|
...stores.map((store) => {
|
|
51
47
|
var _a;
|
|
52
48
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
53
49
|
if (!storeState) return;
|
|
54
|
-
if (!
|
|
50
|
+
if (!_6BYUUR4Mcjs.hasOwnProperty.call(void 0, storeState, key)) return;
|
|
55
51
|
return sync(store, [key], (state2) => {
|
|
56
52
|
setState(
|
|
57
53
|
key,
|
|
@@ -69,7 +65,7 @@ function createStore(initialState, ...stores) {
|
|
|
69
65
|
teardowns.push(setup2());
|
|
70
66
|
}
|
|
71
67
|
const cleanups = stores.map(init);
|
|
72
|
-
destroy =
|
|
68
|
+
destroy = _6BYUUR4Mcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
|
|
73
69
|
return maybeDestroy;
|
|
74
70
|
};
|
|
75
71
|
const sub = (keys, listener, set = listeners) => {
|
|
@@ -92,13 +88,13 @@ function createStore(initialState, ...stores) {
|
|
|
92
88
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
93
89
|
return sub(keys, listener, batchListeners);
|
|
94
90
|
};
|
|
95
|
-
const storePick = (keys) => createStore(
|
|
96
|
-
const storeOmit = (keys) => createStore(
|
|
91
|
+
const storePick = (keys) => createStore(_6BYUUR4Mcjs.pick.call(void 0, state, keys), finalStore);
|
|
92
|
+
const storeOmit = (keys) => createStore(_6BYUUR4Mcjs.omit.call(void 0, state, keys), finalStore);
|
|
97
93
|
const getState = () => state;
|
|
98
94
|
const setState = (key, value, fromStores = false) => {
|
|
99
95
|
var _a;
|
|
100
|
-
if (!
|
|
101
|
-
const nextValue =
|
|
96
|
+
if (!_6BYUUR4Mcjs.hasOwnProperty.call(void 0, state, key)) return;
|
|
97
|
+
const nextValue = _6BYUUR4Mcjs.applyState.call(void 0, value, state[key]);
|
|
102
98
|
if (nextValue === state[key]) return;
|
|
103
99
|
if (!fromStores) {
|
|
104
100
|
for (const store of stores) {
|
|
@@ -106,7 +102,7 @@ function createStore(initialState, ...stores) {
|
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
const prevState = state;
|
|
109
|
-
state =
|
|
105
|
+
state = { ...state, [key]: nextValue };
|
|
110
106
|
const thisUpdate = Symbol();
|
|
111
107
|
lastUpdate = thisUpdate;
|
|
112
108
|
updatedKeys.add(key);
|
|
@@ -198,7 +194,7 @@ function throwOnConflictingProps(props, store) {
|
|
|
198
194
|
if (!defaultKeys.length) return;
|
|
199
195
|
const storeState = store.getState();
|
|
200
196
|
const conflictingProps = defaultKeys.filter(
|
|
201
|
-
(key) =>
|
|
197
|
+
(key) => _6BYUUR4Mcjs.hasOwnProperty.call(void 0, storeState, key)
|
|
202
198
|
);
|
|
203
199
|
if (!conflictingProps.length) return;
|
|
204
200
|
throw new Error(
|