@ariakit/core 0.3.7 → 0.3.9
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 +11 -0
- package/cjs/__chunks/{GZDVJEID.cjs → 2LS4JJ4S.cjs} +2 -2
- package/cjs/__chunks/{46BH65MC.cjs → 2UK5WUJX.cjs} +15 -7
- package/cjs/__chunks/{PD7XZBXC.cjs → 5SIVMOID.cjs} +4 -4
- package/cjs/__chunks/{7ZUFMSXJ.cjs → EFIT5L4X.cjs} +7 -7
- package/cjs/__chunks/{MEHGRTJ3.cjs → GJFZ5ZPP.cjs} +11 -11
- package/cjs/__chunks/{6WBY3ZZM.cjs → JNFZSNOI.cjs} +6 -6
- package/cjs/__chunks/{JLC5A6WF.cjs → UCLKUBNP.cjs} +35 -25
- package/cjs/__chunks/{GXIZMD53.cjs → UTICNXST.cjs} +4 -4
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +9 -9
- package/cjs/checkbox/checkbox-store.d.ts +9 -9
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/collection/collection-store.d.cts +16 -12
- package/cjs/collection/collection-store.d.ts +16 -12
- package/cjs/combobox/combobox-store.cjs +20 -20
- package/cjs/combobox/combobox-store.d.cts +14 -14
- package/cjs/combobox/combobox-store.d.ts +14 -14
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-overflow-store.d.cts +13 -7
- package/cjs/composite/composite-overflow-store.d.ts +13 -7
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +31 -14
- package/cjs/composite/composite-store.d.ts +31 -14
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/dialog/dialog-store.d.cts +12 -6
- package/cjs/dialog/dialog-store.d.ts +12 -6
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +4 -2
- package/cjs/disclosure/disclosure-store.d.ts +4 -2
- package/cjs/form/form-store.cjs +7 -7
- package/cjs/form/form-store.d.cts +15 -15
- package/cjs/form/form-store.d.ts +15 -15
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard-store.d.cts +11 -5
- package/cjs/hovercard/hovercard-store.d.ts +11 -5
- package/cjs/menu/menu-bar-store.cjs +5 -5
- package/cjs/menu/menu-bar-store.d.cts +12 -6
- package/cjs/menu/menu-bar-store.d.ts +12 -6
- package/cjs/menu/menu-store.cjs +18 -18
- package/cjs/menu/menu-store.d.cts +20 -10
- package/cjs/menu/menu-store.d.ts +20 -10
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/menubar/menubar-store.d.cts +1 -1
- package/cjs/menubar/menubar-store.d.ts +1 -1
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +7 -3
- package/cjs/popover/popover-store.d.ts +7 -3
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/radio/radio-store.d.cts +5 -3
- package/cjs/radio/radio-store.d.ts +5 -3
- package/cjs/select/select-store.cjs +18 -18
- package/cjs/select/select-store.d.cts +14 -16
- package/cjs/select/select-store.d.ts +14 -16
- package/cjs/tab/tab-store.cjs +15 -15
- package/cjs/tab/tab-store.d.cts +15 -16
- package/cjs/tab/tab-store.d.ts +15 -16
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/toolbar/toolbar-store.d.cts +9 -6
- package/cjs/toolbar/toolbar-store.d.ts +9 -6
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/tooltip/tooltip-store.d.cts +5 -3
- package/cjs/tooltip/tooltip-store.d.ts +5 -3
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{E7OQVGGY.js → A2J4XZ5T.js} +15 -7
- package/esm/__chunks/{OGMLJYDV.js → DLX2AS6C.js} +2 -2
- package/esm/__chunks/{ANO6WJO4.js → EZ2TTBAQ.js} +2 -2
- package/esm/__chunks/{WY3EMTH6.js → J6JIOWCS.js} +2 -2
- package/esm/__chunks/{CL47ZAPY.js → LT2OYWRD.js} +1 -1
- package/esm/__chunks/{DYD4YNLE.js → NKLTHWCR.js} +1 -1
- package/esm/__chunks/{BXH3I7ML.js → T3DVYGXI.js} +2 -2
- package/esm/__chunks/{CCU5UHQ2.js → TLN4ALYH.js} +32 -22
- package/esm/checkbox/checkbox-store.d.ts +9 -9
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +16 -12
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +14 -14
- package/esm/combobox/combobox-store.js +6 -6
- package/esm/composite/composite-overflow-store.d.ts +13 -7
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +31 -14
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.d.ts +12 -6
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +4 -2
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +15 -15
- package/esm/form/form-store.js +2 -2
- package/esm/hovercard/hovercard-store.d.ts +11 -5
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.d.ts +12 -6
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-store.d.ts +20 -10
- package/esm/menu/menu-store.js +7 -7
- package/esm/menubar/menubar-store.d.ts +1 -1
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/popover/popover-store.d.ts +7 -3
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.d.ts +5 -3
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.d.ts +14 -16
- package/esm/select/select-store.js +6 -6
- package/esm/tab/tab-store.d.ts +15 -16
- package/esm/tab/tab-store.js +3 -3
- package/esm/toolbar/toolbar-store.d.ts +9 -6
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.d.ts +5 -3
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.3.9
|
|
4
|
+
|
|
5
|
+
- Fixed `Maximum update depth exceeded` warning when rendering multiple collection items on the page.
|
|
6
|
+
- Improved JSDocs.
|
|
7
|
+
|
|
8
|
+
## 0.3.8
|
|
9
|
+
|
|
10
|
+
- Fixed [`CollectionItem`](https://ariakit.org/reference/collection-item) elements getting out of order when composing stores.
|
|
11
|
+
- Fixed unmounted [`SelectPopover`](https://ariakit.org/reference/select-popover) not re-opening when its [`open`](https://ariakit.org/reference/select-provider#open) state is initially set to `true`.
|
|
12
|
+
- Fixed TypeScript build errors.
|
|
13
|
+
|
|
3
14
|
## 0.3.7
|
|
4
15
|
|
|
5
16
|
### Multi-selectable Combobox
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _GJFZ5ZPPcjs = require('./GJFZ5ZPP.cjs');
|
|
5
5
|
|
|
6
6
|
// src/dialog/dialog-store.ts
|
|
7
7
|
function createDialogStore(props = {}) {
|
|
8
|
-
return
|
|
8
|
+
return _GJFZ5ZPPcjs.createDisclosureStore.call(void 0, props);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
|
|
@@ -24,7 +24,8 @@ function createStore(initialState, ...stores) {
|
|
|
24
24
|
let state = initialState;
|
|
25
25
|
let prevStateBatch = state;
|
|
26
26
|
let lastUpdate = Symbol();
|
|
27
|
-
let
|
|
27
|
+
let destroy = _3UT5FE6Kcjs.noop;
|
|
28
|
+
const instances = /* @__PURE__ */ new Set();
|
|
28
29
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
29
30
|
const setups = /* @__PURE__ */ new Set();
|
|
30
31
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -36,11 +37,19 @@ function createStore(initialState, ...stores) {
|
|
|
36
37
|
return () => setups.delete(callback);
|
|
37
38
|
};
|
|
38
39
|
const storeInit = () => {
|
|
39
|
-
if (initialized)
|
|
40
|
-
return _3UT5FE6Kcjs.noop;
|
|
41
40
|
if (!stores.length)
|
|
42
41
|
return _3UT5FE6Kcjs.noop;
|
|
43
|
-
initialized =
|
|
42
|
+
const initialized = instances.size;
|
|
43
|
+
const instance = Symbol();
|
|
44
|
+
instances.add(instance);
|
|
45
|
+
const maybeDestroy = () => {
|
|
46
|
+
instances.delete(instance);
|
|
47
|
+
if (instances.size)
|
|
48
|
+
return;
|
|
49
|
+
destroy();
|
|
50
|
+
};
|
|
51
|
+
if (initialized)
|
|
52
|
+
return maybeDestroy;
|
|
44
53
|
const desyncs = _3UT5FE6Kcjs.getKeys.call(void 0, state).map(
|
|
45
54
|
(key) => _3UT5FE6Kcjs.chain.call(void 0,
|
|
46
55
|
...stores.map((store) => {
|
|
@@ -65,9 +74,8 @@ function createStore(initialState, ...stores) {
|
|
|
65
74
|
const teardowns = [];
|
|
66
75
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
67
76
|
const cleanups = stores.map(init);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
77
|
+
destroy = _3UT5FE6Kcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups);
|
|
78
|
+
return maybeDestroy;
|
|
71
79
|
};
|
|
72
80
|
const sub = (keys, listener, set = listeners) => {
|
|
73
81
|
set.add(listener);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _EFIT5L4Xcjs = require('./EFIT5L4X.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createHovercardStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const popover =
|
|
20
|
+
const popover = _EFIT5L4Xcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
22
22
|
props.placement,
|
|
23
23
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -31,7 +31,7 @@ function createHovercardStore(props = {}) {
|
|
|
31
31
|
hideTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
32
32
|
autoFocusOnShow: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
33
33
|
});
|
|
34
|
-
const hovercard =
|
|
34
|
+
const hovercard = _2UK5WUJXcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
35
35
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
36
36
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
37
37
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _2LS4JJ4Scjs = require('./2LS4JJ4S.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -24,9 +24,9 @@ function createPopoverStore(_a = {}) {
|
|
|
24
24
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
25
25
|
"popover"
|
|
26
26
|
]);
|
|
27
|
-
const store =
|
|
27
|
+
const store = _2UK5WUJXcjs.mergeStore.call(void 0,
|
|
28
28
|
props.store,
|
|
29
|
-
|
|
29
|
+
_2UK5WUJXcjs.omit.call(void 0, otherPopover, [
|
|
30
30
|
"arrowElement",
|
|
31
31
|
"anchorElement",
|
|
32
32
|
"contentElement",
|
|
@@ -34,9 +34,9 @@ function createPopoverStore(_a = {}) {
|
|
|
34
34
|
"disclosureElement"
|
|
35
35
|
])
|
|
36
36
|
);
|
|
37
|
-
|
|
37
|
+
_2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
38
38
|
const syncState = store == null ? void 0 : store.getState();
|
|
39
|
-
const dialog =
|
|
39
|
+
const dialog = _2LS4JJ4Scjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
40
40
|
const placement = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
41
41
|
props.placement,
|
|
42
42
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -50,7 +50,7 @@ function createPopoverStore(_a = {}) {
|
|
|
50
50
|
arrowElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
51
51
|
rendered: Symbol("rendered")
|
|
52
52
|
});
|
|
53
|
-
const popover =
|
|
53
|
+
const popover = _2UK5WUJXcjs.createStore.call(void 0, initialState, dialog, store);
|
|
54
54
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
55
55
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
56
56
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -18,11 +18,11 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
18
18
|
|
|
19
19
|
// src/disclosure/disclosure-store.ts
|
|
20
20
|
function createDisclosureStore(props = {}) {
|
|
21
|
-
const store =
|
|
21
|
+
const store = _2UK5WUJXcjs.mergeStore.call(void 0,
|
|
22
22
|
props.store,
|
|
23
|
-
|
|
23
|
+
_2UK5WUJXcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
24
24
|
);
|
|
25
|
-
|
|
25
|
+
_2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
26
26
|
const syncState = store == null ? void 0 : store.getState();
|
|
27
27
|
const open = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
28
28
|
props.open,
|
|
@@ -39,26 +39,26 @@ function createDisclosureStore(props = {}) {
|
|
|
39
39
|
contentElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
40
40
|
disclosureElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
41
41
|
};
|
|
42
|
-
const disclosure =
|
|
43
|
-
|
|
42
|
+
const disclosure = _2UK5WUJXcjs.createStore.call(void 0, initialState, store);
|
|
43
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
44
44
|
disclosure,
|
|
45
|
-
() =>
|
|
45
|
+
() => _2UK5WUJXcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
46
46
|
if (state.animated)
|
|
47
47
|
return;
|
|
48
48
|
disclosure.setState("animating", false);
|
|
49
49
|
})
|
|
50
50
|
);
|
|
51
|
-
|
|
51
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
52
52
|
disclosure,
|
|
53
|
-
() =>
|
|
53
|
+
() => _2UK5WUJXcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
54
54
|
if (!disclosure.getState().animated)
|
|
55
55
|
return;
|
|
56
56
|
disclosure.setState("animating", true);
|
|
57
57
|
})
|
|
58
58
|
);
|
|
59
|
-
|
|
59
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
60
60
|
disclosure,
|
|
61
|
-
() =>
|
|
61
|
+
() => _2UK5WUJXcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
62
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
63
63
|
})
|
|
64
64
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _UCLKUBNPcjs = require('./UCLKUBNP.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -124,7 +124,7 @@ function verticalizeItems(items) {
|
|
|
124
124
|
function createCompositeStore(props = {}) {
|
|
125
125
|
var _a;
|
|
126
126
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
127
|
-
const collection =
|
|
127
|
+
const collection = _UCLKUBNPcjs.createCollectionStore.call(void 0, props);
|
|
128
128
|
const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
129
129
|
props.activeId,
|
|
130
130
|
syncState == null ? void 0 : syncState.activeId,
|
|
@@ -154,10 +154,10 @@ function createCompositeStore(props = {}) {
|
|
|
154
154
|
focusWrap: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
155
155
|
focusShift: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
156
156
|
});
|
|
157
|
-
const composite =
|
|
158
|
-
|
|
157
|
+
const composite = _2UK5WUJXcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
158
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
159
159
|
composite,
|
|
160
|
-
() =>
|
|
160
|
+
() => _2UK5WUJXcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
161
161
|
composite.setState("activeId", (activeId2) => {
|
|
162
162
|
var _a2;
|
|
163
163
|
if (activeId2 !== void 0)
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
@@ -63,9 +64,12 @@ function getCommonParent(items) {
|
|
|
63
64
|
}
|
|
64
65
|
return _5F4DVUNScjs.getDocument.call(void 0, parentElement).body;
|
|
65
66
|
}
|
|
67
|
+
function getPrivateStore(store) {
|
|
68
|
+
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
69
|
+
}
|
|
66
70
|
function createCollectionStore(props = {}) {
|
|
67
71
|
var _a;
|
|
68
|
-
|
|
72
|
+
_2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
69
73
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
70
74
|
const items = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
71
75
|
props.items,
|
|
@@ -78,37 +82,41 @@ function createCollectionStore(props = {}) {
|
|
|
78
82
|
items,
|
|
79
83
|
renderedItems: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
80
84
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
91
|
-
_46BH65MCcjs.setup.call(void 0, collection, () => {
|
|
92
|
-
return _46BH65MCcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
85
|
+
const syncPrivateStore = getPrivateStore(props.store);
|
|
86
|
+
const privateStore = _2UK5WUJXcjs.createStore.call(void 0,
|
|
87
|
+
{ renderedItems: initialState.renderedItems },
|
|
88
|
+
syncPrivateStore
|
|
89
|
+
);
|
|
90
|
+
const collection = _2UK5WUJXcjs.createStore.call(void 0, initialState, props.store);
|
|
91
|
+
_2UK5WUJXcjs.setup.call(void 0, collection, () => _2UK5WUJXcjs.init.call(void 0, privateStore));
|
|
92
|
+
_2UK5WUJXcjs.setup.call(void 0, privateStore, () => {
|
|
93
|
+
return _2UK5WUJXcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
93
94
|
let firstRun = true;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const raf = requestAnimationFrame(() => {
|
|
96
|
+
const { renderedItems } = collection.getState();
|
|
97
|
+
if (state.renderedItems === renderedItems)
|
|
98
|
+
return;
|
|
99
|
+
const sortedItems = sortBasedOnDOMPosition(state.renderedItems);
|
|
100
|
+
privateStore.setState("renderedItems", sortedItems);
|
|
101
|
+
collection.setState("renderedItems", sortedItems);
|
|
102
|
+
});
|
|
103
|
+
if (typeof IntersectionObserver !== "function") {
|
|
104
|
+
return () => cancelAnimationFrame(raf);
|
|
105
|
+
}
|
|
106
|
+
const ioCallback = () => {
|
|
98
107
|
if (firstRun) {
|
|
99
108
|
firstRun = false;
|
|
100
109
|
return;
|
|
101
110
|
}
|
|
102
|
-
|
|
103
|
-
raf = requestAnimationFrame(sortItems);
|
|
111
|
+
privateStore.setState("renderedItems", [...state.renderedItems]);
|
|
104
112
|
};
|
|
105
113
|
const root = getCommonParent(state.renderedItems);
|
|
106
|
-
const observer = new IntersectionObserver(
|
|
107
|
-
state.renderedItems
|
|
114
|
+
const observer = new IntersectionObserver(ioCallback, { root });
|
|
115
|
+
for (const item of state.renderedItems) {
|
|
108
116
|
if (!item.element)
|
|
109
|
-
|
|
117
|
+
continue;
|
|
110
118
|
observer.observe(item.element);
|
|
111
|
-
}
|
|
119
|
+
}
|
|
112
120
|
return () => {
|
|
113
121
|
cancelAnimationFrame(raf);
|
|
114
122
|
observer.disconnect();
|
|
@@ -172,7 +180,9 @@ function createCollectionStore(props = {}) {
|
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
182
|
return item || null;
|
|
175
|
-
}
|
|
183
|
+
},
|
|
184
|
+
// @ts-expect-error Internal
|
|
185
|
+
__unstablePrivateStore: privateStore
|
|
176
186
|
});
|
|
177
187
|
}
|
|
178
188
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _JNFZSNOIcjs = require('./JNFZSNOI.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _2UK5WUJXcjs = require('./2UK5WUJX.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createMenubarStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const composite =
|
|
20
|
+
const composite = _JNFZSNOIcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
23
23
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -26,7 +26,7 @@ function createMenubarStore(props = {}) {
|
|
|
26
26
|
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
27
|
}));
|
|
28
28
|
const initialState = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState());
|
|
29
|
-
const menubar =
|
|
29
|
+
const menubar = _2UK5WUJXcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
30
30
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), menubar);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -14,7 +14,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
14
14
|
// src/checkbox/checkbox-store.ts
|
|
15
15
|
function createCheckboxStore(props = {}) {
|
|
16
16
|
var _a;
|
|
17
|
-
|
|
17
|
+
_2UK5WUJXcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
18
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
19
|
const initialState = {
|
|
20
20
|
value: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
@@ -24,7 +24,7 @@ function createCheckboxStore(props = {}) {
|
|
|
24
24
|
false
|
|
25
25
|
)
|
|
26
26
|
};
|
|
27
|
-
const checkbox =
|
|
27
|
+
const checkbox = _2UK5WUJXcjs.createStore.call(void 0, initialState, props.store);
|
|
28
28
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
29
29
|
setValue: (value) => checkbox.setState("value", value)
|
|
30
30
|
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
|
|
3
|
-
type Value = boolean | string | number | Array<string | number>;
|
|
4
3
|
/**
|
|
5
4
|
* Creates a checkbox store.
|
|
6
5
|
*/
|
|
7
|
-
export declare function createCheckboxStore<T extends
|
|
6
|
+
export declare function createCheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
|
|
8
7
|
export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
|
|
9
|
-
export type CheckboxStoreValue =
|
|
10
|
-
export interface CheckboxStoreState<T extends
|
|
8
|
+
export type CheckboxStoreValue = boolean | string | number | Array<string | number>;
|
|
9
|
+
export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
11
10
|
/**
|
|
12
11
|
* The checked state of the checkbox.
|
|
13
12
|
*
|
|
@@ -16,7 +15,7 @@ export interface CheckboxStoreState<T extends Value = Value> {
|
|
|
16
15
|
*/
|
|
17
16
|
value: ToPrimitive<T>;
|
|
18
17
|
}
|
|
19
|
-
export interface CheckboxStoreFunctions<T extends
|
|
18
|
+
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
20
19
|
/**
|
|
21
20
|
* Sets the `value` state.
|
|
22
21
|
* @example
|
|
@@ -25,7 +24,7 @@ export interface CheckboxStoreFunctions<T extends Value = Value> {
|
|
|
25
24
|
*/
|
|
26
25
|
setValue: SetState<CheckboxStoreState<T>["value"]>;
|
|
27
26
|
}
|
|
28
|
-
export interface CheckboxStoreOptions<T extends
|
|
27
|
+
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
29
28
|
/**
|
|
30
29
|
* The default value of the checkbox.
|
|
31
30
|
*
|
|
@@ -36,6 +35,7 @@ export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOpti
|
|
|
36
35
|
*/
|
|
37
36
|
defaultValue?: CheckboxStoreState<T>["value"];
|
|
38
37
|
}
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
export {
|
|
38
|
+
export interface CheckboxStoreProps<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreOptions<T>, StoreProps<CheckboxStoreState<T>> {
|
|
39
|
+
}
|
|
40
|
+
export interface CheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreFunctions<T>, Store<CheckboxStoreState<T>> {
|
|
41
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
|
|
3
|
-
type Value = boolean | string | number | Array<string | number>;
|
|
4
3
|
/**
|
|
5
4
|
* Creates a checkbox store.
|
|
6
5
|
*/
|
|
7
|
-
export declare function createCheckboxStore<T extends
|
|
6
|
+
export declare function createCheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
|
|
8
7
|
export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
|
|
9
|
-
export type CheckboxStoreValue =
|
|
10
|
-
export interface CheckboxStoreState<T extends
|
|
8
|
+
export type CheckboxStoreValue = boolean | string | number | Array<string | number>;
|
|
9
|
+
export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
11
10
|
/**
|
|
12
11
|
* The checked state of the checkbox.
|
|
13
12
|
*
|
|
@@ -16,7 +15,7 @@ export interface CheckboxStoreState<T extends Value = Value> {
|
|
|
16
15
|
*/
|
|
17
16
|
value: ToPrimitive<T>;
|
|
18
17
|
}
|
|
19
|
-
export interface CheckboxStoreFunctions<T extends
|
|
18
|
+
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
20
19
|
/**
|
|
21
20
|
* Sets the `value` state.
|
|
22
21
|
* @example
|
|
@@ -25,7 +24,7 @@ export interface CheckboxStoreFunctions<T extends Value = Value> {
|
|
|
25
24
|
*/
|
|
26
25
|
setValue: SetState<CheckboxStoreState<T>["value"]>;
|
|
27
26
|
}
|
|
28
|
-
export interface CheckboxStoreOptions<T extends
|
|
27
|
+
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
29
28
|
/**
|
|
30
29
|
* The default value of the checkbox.
|
|
31
30
|
*
|
|
@@ -36,6 +35,7 @@ export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOpti
|
|
|
36
35
|
*/
|
|
37
36
|
defaultValue?: CheckboxStoreState<T>["value"];
|
|
38
37
|
}
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
export {
|
|
38
|
+
export interface CheckboxStoreProps<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreOptions<T>, StoreProps<CheckboxStoreState<T>> {
|
|
39
|
+
}
|
|
40
|
+
export interface CheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreFunctions<T>, Store<CheckboxStoreState<T>> {
|
|
41
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _UCLKUBNPcjs = require('../__chunks/UCLKUBNP.cjs');
|
|
5
|
+
require('../__chunks/2UK5WUJX.cjs');
|
|
6
6
|
require('../__chunks/3UT5FE6K.cjs');
|
|
7
7
|
require('../__chunks/5F4DVUNS.cjs');
|
|
8
8
|
require('../__chunks/AV6KTKLE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.createCollectionStore =
|
|
11
|
+
exports.createCollectionStore = _UCLKUBNPcjs.createCollectionStore;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { BivariantCallback } from "../utils/types.js";
|
|
3
|
-
interface Item {
|
|
4
|
-
id: string;
|
|
5
|
-
element?: HTMLElement | null;
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* Creates a collection store.
|
|
9
5
|
*/
|
|
10
|
-
export declare function createCollectionStore<T extends
|
|
11
|
-
export
|
|
12
|
-
|
|
6
|
+
export declare function createCollectionStore<T extends CollectionStoreItem = CollectionStoreItem>(props?: CollectionStoreProps<T>): CollectionStore<T>;
|
|
7
|
+
export interface CollectionStoreItem {
|
|
8
|
+
/**
|
|
9
|
+
* The id of the item.
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* The item HTML element. This is automatically set when the item is rendered.
|
|
14
|
+
*/
|
|
15
|
+
element?: HTMLElement | null;
|
|
16
|
+
}
|
|
17
|
+
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
13
18
|
/**
|
|
14
19
|
* Lists all the items with their meta data. This state is automatically
|
|
15
20
|
* updated when an item is registered or unregistered with the `registerItem`
|
|
@@ -24,7 +29,7 @@ export interface CollectionStoreState<T extends Item = Item> {
|
|
|
24
29
|
*/
|
|
25
30
|
renderedItems: T[];
|
|
26
31
|
}
|
|
27
|
-
export interface CollectionStoreFunctions<T extends
|
|
32
|
+
export interface CollectionStoreFunctions<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
28
33
|
/**
|
|
29
34
|
* Registers an item in the collection. This function returns a cleanup
|
|
30
35
|
* function that unregisters the item.
|
|
@@ -53,15 +58,14 @@ export interface CollectionStoreFunctions<T extends Item = Item> {
|
|
|
53
58
|
*/
|
|
54
59
|
item: (id: string | null | undefined) => T | null;
|
|
55
60
|
}
|
|
56
|
-
export interface CollectionStoreOptions<T extends
|
|
61
|
+
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
57
62
|
/**
|
|
58
63
|
* The defaut value for the `items` state.
|
|
59
64
|
* @default []
|
|
60
65
|
*/
|
|
61
66
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
62
67
|
}
|
|
63
|
-
export interface CollectionStoreProps<T extends
|
|
68
|
+
export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
|
|
64
69
|
}
|
|
65
|
-
export interface CollectionStore<T extends
|
|
70
|
+
export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
|
|
66
71
|
}
|
|
67
|
-
export {};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { BivariantCallback } from "../utils/types.js";
|
|
3
|
-
interface Item {
|
|
4
|
-
id: string;
|
|
5
|
-
element?: HTMLElement | null;
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* Creates a collection store.
|
|
9
5
|
*/
|
|
10
|
-
export declare function createCollectionStore<T extends
|
|
11
|
-
export
|
|
12
|
-
|
|
6
|
+
export declare function createCollectionStore<T extends CollectionStoreItem = CollectionStoreItem>(props?: CollectionStoreProps<T>): CollectionStore<T>;
|
|
7
|
+
export interface CollectionStoreItem {
|
|
8
|
+
/**
|
|
9
|
+
* The id of the item.
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* The item HTML element. This is automatically set when the item is rendered.
|
|
14
|
+
*/
|
|
15
|
+
element?: HTMLElement | null;
|
|
16
|
+
}
|
|
17
|
+
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
13
18
|
/**
|
|
14
19
|
* Lists all the items with their meta data. This state is automatically
|
|
15
20
|
* updated when an item is registered or unregistered with the `registerItem`
|
|
@@ -24,7 +29,7 @@ export interface CollectionStoreState<T extends Item = Item> {
|
|
|
24
29
|
*/
|
|
25
30
|
renderedItems: T[];
|
|
26
31
|
}
|
|
27
|
-
export interface CollectionStoreFunctions<T extends
|
|
32
|
+
export interface CollectionStoreFunctions<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
28
33
|
/**
|
|
29
34
|
* Registers an item in the collection. This function returns a cleanup
|
|
30
35
|
* function that unregisters the item.
|
|
@@ -53,15 +58,14 @@ export interface CollectionStoreFunctions<T extends Item = Item> {
|
|
|
53
58
|
*/
|
|
54
59
|
item: (id: string | null | undefined) => T | null;
|
|
55
60
|
}
|
|
56
|
-
export interface CollectionStoreOptions<T extends
|
|
61
|
+
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
57
62
|
/**
|
|
58
63
|
* The defaut value for the `items` state.
|
|
59
64
|
* @default []
|
|
60
65
|
*/
|
|
61
66
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
62
67
|
}
|
|
63
|
-
export interface CollectionStoreProps<T extends
|
|
68
|
+
export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
|
|
64
69
|
}
|
|
65
|
-
export interface CollectionStore<T extends
|
|
70
|
+
export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
|
|
66
71
|
}
|
|
67
|
-
export {};
|