@ariakit/core 0.3.6 → 0.3.8
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 +20 -0
- package/cjs/__chunks/{GZDVJEID.cjs → 2LS4JJ4S.cjs} +2 -2
- package/cjs/__chunks/{46BH65MC.cjs → 2UK5WUJX.cjs} +15 -7
- package/cjs/__chunks/{GXIZMD53.cjs → 3J44Z7YH.cjs} +4 -4
- 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 → QAZ4PF7S.cjs} +6 -6
- package/cjs/__chunks/{JLC5A6WF.cjs → ZQTYFYRS.cjs} +18 -9
- 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 +18 -12
- package/cjs/collection/collection-store.d.ts +18 -12
- package/cjs/combobox/combobox-store.cjs +45 -23
- package/cjs/combobox/combobox-store.d.cts +66 -23
- package/cjs/combobox/combobox-store.d.ts +66 -23
- 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 +24 -16
- package/cjs/composite/composite-store.d.ts +24 -16
- 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 +6 -2
- package/cjs/disclosure/disclosure-store.d.ts +6 -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 -3
- package/cjs/hovercard/hovercard-store.d.ts +11 -3
- 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 +8 -8
- package/cjs/menu/menu-store.d.ts +8 -8
- 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 +8 -3
- package/cjs/popover/popover-store.d.ts +8 -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 +39 -31
- package/cjs/select/select-store.d.ts +39 -31
- 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/cjs/utils/store.d.cts +3 -0
- package/cjs/utils/store.d.ts +3 -0
- package/esm/__chunks/{ANO6WJO4.js → A2AGSVJO.js} +2 -2
- package/esm/__chunks/{E7OQVGGY.js → A2J4XZ5T.js} +15 -7
- package/esm/__chunks/{OGMLJYDV.js → CTZ2GQIZ.js} +2 -2
- package/esm/__chunks/{CCU5UHQ2.js → HMQYEBKF.js} +15 -6
- 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/checkbox/checkbox-store.d.ts +9 -9
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +18 -12
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +66 -23
- package/esm/combobox/combobox-store.js +33 -11
- 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 +24 -16
- 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 +6 -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 -3
- 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 +8 -8
- 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 +8 -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 +39 -31
- 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.d.ts +3 -0
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _ZQTYFYRScjs = require('../__chunks/ZQTYFYRS.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -25,7 +25,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
25
25
|
function createTabStore(props = {}) {
|
|
26
26
|
var _a;
|
|
27
27
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
28
|
-
const composite =
|
|
28
|
+
const composite = _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
29
29
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
30
30
|
props.orientation,
|
|
31
31
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -33,7 +33,7 @@ function createTabStore(props = {}) {
|
|
|
33
33
|
),
|
|
34
34
|
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
35
35
|
}));
|
|
36
|
-
const panels =
|
|
36
|
+
const panels = _ZQTYFYRScjs.createCollectionStore.call(void 0, );
|
|
37
37
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
38
38
|
selectedId: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
39
39
|
props.selectedId,
|
|
@@ -47,10 +47,10 @@ function createTabStore(props = {}) {
|
|
|
47
47
|
true
|
|
48
48
|
)
|
|
49
49
|
});
|
|
50
|
-
const tab =
|
|
51
|
-
|
|
50
|
+
const tab = _2UK5WUJXcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
51
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
52
52
|
tab,
|
|
53
|
-
() =>
|
|
53
|
+
() => _2UK5WUJXcjs.sync.call(void 0, tab, ["moves"], () => {
|
|
54
54
|
const { activeId, selectOnMove } = tab.getState();
|
|
55
55
|
if (!selectOnMove)
|
|
56
56
|
return;
|
|
@@ -66,17 +66,17 @@ function createTabStore(props = {}) {
|
|
|
66
66
|
tab.setState("selectedId", tabItem.id);
|
|
67
67
|
})
|
|
68
68
|
);
|
|
69
|
-
|
|
69
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
70
70
|
tab,
|
|
71
|
-
() =>
|
|
71
|
+
() => _2UK5WUJXcjs.batch.call(void 0,
|
|
72
72
|
tab,
|
|
73
73
|
["selectedId"],
|
|
74
74
|
(state) => tab.setState("activeId", state.selectedId)
|
|
75
75
|
)
|
|
76
76
|
);
|
|
77
|
-
|
|
77
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
78
78
|
tab,
|
|
79
|
-
() =>
|
|
79
|
+
() => _2UK5WUJXcjs.sync.call(void 0, tab, ["selectedId", "renderedItems"], (state) => {
|
|
80
80
|
if (state.selectedId !== void 0)
|
|
81
81
|
return;
|
|
82
82
|
const { activeId, renderedItems } = tab.getState();
|
|
@@ -91,13 +91,13 @@ function createTabStore(props = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
|
-
|
|
94
|
+
_2UK5WUJXcjs.setup.call(void 0,
|
|
95
95
|
tab,
|
|
96
|
-
() =>
|
|
96
|
+
() => _2UK5WUJXcjs.sync.call(void 0, tab, ["renderedItems"], (state) => {
|
|
97
97
|
const tabs = state.renderedItems;
|
|
98
98
|
if (!tabs.length)
|
|
99
99
|
return;
|
|
100
|
-
return
|
|
100
|
+
return _2UK5WUJXcjs.sync.call(void 0, panels, ["renderedItems"], (state2) => {
|
|
101
101
|
const items = state2.renderedItems;
|
|
102
102
|
const hasOrphanPanels = items.some((panel) => !panel.tabId);
|
|
103
103
|
if (!hasOrphanPanels)
|
package/cjs/tab/tab-store.d.cts
CHANGED
|
@@ -2,24 +2,22 @@ import type { CollectionStore, CollectionStoreItem } from "../collection/collect
|
|
|
2
2
|
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
4
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
|
|
5
|
+
export declare function createTabStore(props?: TabStoreProps): TabStore;
|
|
6
|
+
export interface TabStoreItem extends CompositeStoreItem {
|
|
6
7
|
dimmed?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
8
|
+
}
|
|
9
|
+
export interface TabStorePanel extends CollectionStoreItem {
|
|
9
10
|
tabId?: string | null;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
12
|
-
export type TabStoreItem = Item;
|
|
13
|
-
export type TabStorePanel = Panel;
|
|
14
|
-
export interface TabStoreState extends CompositeStoreState<Item> {
|
|
11
|
+
}
|
|
12
|
+
export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
15
13
|
/**
|
|
16
14
|
* @default "horizontal"
|
|
17
15
|
*/
|
|
18
|
-
orientation: CompositeStoreState<
|
|
16
|
+
orientation: CompositeStoreState<TabStoreItem>["orientation"];
|
|
19
17
|
/**
|
|
20
18
|
* @default true
|
|
21
19
|
*/
|
|
22
|
-
focusLoop: CompositeStoreState<
|
|
20
|
+
focusLoop: CompositeStoreState<TabStoreItem>["focusLoop"];
|
|
23
21
|
/**
|
|
24
22
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
25
23
|
* will be automatically set to the first enabled tab.
|
|
@@ -38,7 +36,7 @@ export interface TabStoreState extends CompositeStoreState<Item> {
|
|
|
38
36
|
*/
|
|
39
37
|
selectOnMove?: boolean;
|
|
40
38
|
}
|
|
41
|
-
export interface TabStoreFunctions extends CompositeStoreFunctions<
|
|
39
|
+
export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem> {
|
|
42
40
|
/**
|
|
43
41
|
* Sets the `selectedId` state without moving focus. If you want to move focus,
|
|
44
42
|
* use the `select` function instead.
|
|
@@ -59,7 +57,7 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
|
|
|
59
57
|
/**
|
|
60
58
|
* A collection store containing the tab panels.
|
|
61
59
|
*/
|
|
62
|
-
panels: CollectionStore<
|
|
60
|
+
panels: CollectionStore<TabStorePanel>;
|
|
63
61
|
/**
|
|
64
62
|
* Selects the tab for the given id and moves focus to it. If you want to set
|
|
65
63
|
* the `selectedId` state without moving focus, use the `setSelectedId`
|
|
@@ -75,13 +73,14 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
|
|
|
75
73
|
*/
|
|
76
74
|
select: TabStore["move"];
|
|
77
75
|
}
|
|
78
|
-
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<
|
|
76
|
+
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
77
|
/**
|
|
80
78
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
81
79
|
* will be automatically set to the first enabled tab.
|
|
82
80
|
*/
|
|
83
81
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
84
82
|
}
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
export {
|
|
83
|
+
export interface TabStoreProps extends TabStoreOptions, StoreProps<TabStoreState> {
|
|
84
|
+
}
|
|
85
|
+
export interface TabStore extends TabStoreFunctions, Store<TabStoreState> {
|
|
86
|
+
}
|
package/cjs/tab/tab-store.d.ts
CHANGED
|
@@ -2,24 +2,22 @@ import type { CollectionStore, CollectionStoreItem } from "../collection/collect
|
|
|
2
2
|
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
4
|
import type { SetState } from "../utils/types.js";
|
|
5
|
-
|
|
5
|
+
export declare function createTabStore(props?: TabStoreProps): TabStore;
|
|
6
|
+
export interface TabStoreItem extends CompositeStoreItem {
|
|
6
7
|
dimmed?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
8
|
+
}
|
|
9
|
+
export interface TabStorePanel extends CollectionStoreItem {
|
|
9
10
|
tabId?: string | null;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
12
|
-
export type TabStoreItem = Item;
|
|
13
|
-
export type TabStorePanel = Panel;
|
|
14
|
-
export interface TabStoreState extends CompositeStoreState<Item> {
|
|
11
|
+
}
|
|
12
|
+
export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
15
13
|
/**
|
|
16
14
|
* @default "horizontal"
|
|
17
15
|
*/
|
|
18
|
-
orientation: CompositeStoreState<
|
|
16
|
+
orientation: CompositeStoreState<TabStoreItem>["orientation"];
|
|
19
17
|
/**
|
|
20
18
|
* @default true
|
|
21
19
|
*/
|
|
22
|
-
focusLoop: CompositeStoreState<
|
|
20
|
+
focusLoop: CompositeStoreState<TabStoreItem>["focusLoop"];
|
|
23
21
|
/**
|
|
24
22
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
25
23
|
* will be automatically set to the first enabled tab.
|
|
@@ -38,7 +36,7 @@ export interface TabStoreState extends CompositeStoreState<Item> {
|
|
|
38
36
|
*/
|
|
39
37
|
selectOnMove?: boolean;
|
|
40
38
|
}
|
|
41
|
-
export interface TabStoreFunctions extends CompositeStoreFunctions<
|
|
39
|
+
export interface TabStoreFunctions extends CompositeStoreFunctions<TabStoreItem> {
|
|
42
40
|
/**
|
|
43
41
|
* Sets the `selectedId` state without moving focus. If you want to move focus,
|
|
44
42
|
* use the `select` function instead.
|
|
@@ -59,7 +57,7 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
|
|
|
59
57
|
/**
|
|
60
58
|
* A collection store containing the tab panels.
|
|
61
59
|
*/
|
|
62
|
-
panels: CollectionStore<
|
|
60
|
+
panels: CollectionStore<TabStorePanel>;
|
|
63
61
|
/**
|
|
64
62
|
* Selects the tab for the given id and moves focus to it. If you want to set
|
|
65
63
|
* the `selectedId` state without moving focus, use the `setSelectedId`
|
|
@@ -75,13 +73,14 @@ export interface TabStoreFunctions extends CompositeStoreFunctions<Item> {
|
|
|
75
73
|
*/
|
|
76
74
|
select: TabStore["move"];
|
|
77
75
|
}
|
|
78
|
-
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<
|
|
76
|
+
export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientation" | "focusLoop" | "selectedId" | "selectOnMove">, CompositeStoreOptions<TabStoreItem> {
|
|
79
77
|
/**
|
|
80
78
|
* The id of the tab whose panel is currently visible. If it's `undefined`, it
|
|
81
79
|
* will be automatically set to the first enabled tab.
|
|
82
80
|
*/
|
|
83
81
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
84
82
|
}
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
export {
|
|
83
|
+
export interface TabStoreProps extends TabStoreOptions, StoreProps<TabStoreState> {
|
|
84
|
+
}
|
|
85
|
+
export interface TabStore extends TabStoreFunctions, Store<TabStoreState> {
|
|
86
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
4
|
+
var _QAZ4PF7Scjs = require('../__chunks/QAZ4PF7S.cjs');
|
|
5
|
+
require('../__chunks/ZQTYFYRS.cjs');
|
|
6
|
+
require('../__chunks/2UK5WUJX.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -18,7 +18,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
18
18
|
function createToolbarStore(props = {}) {
|
|
19
19
|
var _a;
|
|
20
20
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
21
|
-
return
|
|
21
|
+
return _QAZ4PF7Scjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
22
22
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
23
23
|
props.orientation,
|
|
24
24
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StoreOptions } from "../utils/store.js";
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a toolbar store.
|
|
5
5
|
*/
|
|
@@ -14,8 +14,11 @@ export interface ToolbarStoreState extends CompositeStoreState {
|
|
|
14
14
|
*/
|
|
15
15
|
focusLoop: CompositeStoreState["focusLoop"];
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
17
|
+
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
|
|
18
|
+
}
|
|
19
|
+
export interface ToolbarStoreOptions extends CompositeStoreOptions, StoreOptions<ToolbarStoreState, "orientation" | "focusLoop"> {
|
|
20
|
+
}
|
|
21
|
+
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
|
|
22
|
+
}
|
|
23
|
+
export interface ToolbarStore extends ToolbarStoreFunctions, Store<ToolbarStoreState> {
|
|
19
24
|
}
|
|
20
|
-
export type ToolbarStore = CompositeStore;
|
|
21
|
-
export type ToolbarStoreProps = CompositeStoreProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StoreOptions } from "../utils/store.js";
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a toolbar store.
|
|
5
5
|
*/
|
|
@@ -14,8 +14,11 @@ export interface ToolbarStoreState extends CompositeStoreState {
|
|
|
14
14
|
*/
|
|
15
15
|
focusLoop: CompositeStoreState["focusLoop"];
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
17
|
+
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
|
|
18
|
+
}
|
|
19
|
+
export interface ToolbarStoreOptions extends CompositeStoreOptions, StoreOptions<ToolbarStoreState, "orientation" | "focusLoop"> {
|
|
20
|
+
}
|
|
21
|
+
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
|
|
22
|
+
}
|
|
23
|
+
export interface ToolbarStore extends ToolbarStoreFunctions, Store<ToolbarStoreState> {
|
|
19
24
|
}
|
|
20
|
-
export type ToolbarStore = CompositeStore;
|
|
21
|
-
export type ToolbarStoreProps = CompositeStoreProps;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
4
|
+
var _5SIVMOIDcjs = require('../__chunks/5SIVMOID.cjs');
|
|
5
|
+
require('../__chunks/EFIT5L4X.cjs');
|
|
6
|
+
require('../__chunks/2LS4JJ4S.cjs');
|
|
7
|
+
require('../__chunks/GJFZ5ZPP.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -20,7 +20,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
20
20
|
function createTooltipStore(props = {}) {
|
|
21
21
|
var _a;
|
|
22
22
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
23
|
-
const hovercard =
|
|
23
|
+
const hovercard = _5SIVMOIDcjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
24
24
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
25
25
|
props.placement,
|
|
26
26
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -32,7 +32,7 @@ function createTooltipStore(props = {}) {
|
|
|
32
32
|
type: _3UT5FE6Kcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
33
33
|
skipTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
34
34
|
});
|
|
35
|
-
const tooltip =
|
|
35
|
+
const tooltip = _2UK5WUJXcjs.createStore.call(void 0, initialState, hovercard, props.store);
|
|
36
36
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -23,7 +23,9 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
23
23
|
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
24
24
|
}
|
|
25
25
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
26
|
-
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"
|
|
26
|
+
export interface TooltipStoreOptions extends HovercardStoreOptions, StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"> {
|
|
27
|
+
}
|
|
28
|
+
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
29
|
+
}
|
|
30
|
+
export interface TooltipStore extends TooltipStoreFunctions, Store<TooltipStoreState> {
|
|
27
31
|
}
|
|
28
|
-
export type TooltipStoreProps = TooltipStoreOptions & StoreProps<TooltipStoreState>;
|
|
29
|
-
export type TooltipStore = TooltipStoreFunctions & Store<TooltipStoreState>;
|
|
@@ -23,7 +23,9 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
23
23
|
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
24
24
|
}
|
|
25
25
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
26
|
-
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"
|
|
26
|
+
export interface TooltipStoreOptions extends HovercardStoreOptions, StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"> {
|
|
27
|
+
}
|
|
28
|
+
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
29
|
+
}
|
|
30
|
+
export interface TooltipStore extends TooltipStoreFunctions, Store<TooltipStoreState> {
|
|
27
31
|
}
|
|
28
|
-
export type TooltipStoreProps = TooltipStoreOptions & StoreProps<TooltipStoreState>;
|
|
29
|
-
export type TooltipStore = TooltipStoreFunctions & Store<TooltipStoreState>;
|
package/cjs/utils/store.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
|
|
14
14
|
require('../__chunks/3UT5FE6K.cjs');
|
|
15
15
|
require('../__chunks/AV6KTKLE.cjs');
|
|
16
16
|
|
|
@@ -24,4 +24,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
exports.batch =
|
|
27
|
+
exports.batch = _2UK5WUJXcjs.batch; exports.createStore = _2UK5WUJXcjs.createStore; exports.init = _2UK5WUJXcjs.init; exports.mergeStore = _2UK5WUJXcjs.mergeStore; exports.omit = _2UK5WUJXcjs.omit; exports.pick = _2UK5WUJXcjs.pick; exports.setup = _2UK5WUJXcjs.setup; exports.subscribe = _2UK5WUJXcjs.subscribe; exports.sync = _2UK5WUJXcjs.sync; exports.throwOnConflictingProps = _2UK5WUJXcjs.throwOnConflictingProps;
|
package/cjs/utils/store.d.cts
CHANGED
|
@@ -46,6 +46,9 @@ export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K
|
|
|
46
46
|
export type StoreProps<S extends State = State> = {
|
|
47
47
|
/**
|
|
48
48
|
* Another store object that will be kept in sync with the original store.
|
|
49
|
+
*
|
|
50
|
+
* Live examples:
|
|
51
|
+
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
49
52
|
*/
|
|
50
53
|
store?: Store<Partial<S>>;
|
|
51
54
|
};
|
package/cjs/utils/store.d.ts
CHANGED
|
@@ -46,6 +46,9 @@ export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K
|
|
|
46
46
|
export type StoreProps<S extends State = State> = {
|
|
47
47
|
/**
|
|
48
48
|
* Another store object that will be kept in sync with the original store.
|
|
49
|
+
*
|
|
50
|
+
* Live examples:
|
|
51
|
+
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
49
52
|
*/
|
|
50
53
|
store?: Store<Partial<S>>;
|
|
51
54
|
};
|
|
@@ -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 = 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 noop;
|
|
41
40
|
if (!stores.length)
|
|
42
41
|
return 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 = getKeys(state).map(
|
|
45
54
|
(key) => chain(
|
|
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 = chain(...desyncs, ...teardowns, ...cleanups);
|
|
78
|
+
return maybeDestroy;
|
|
71
79
|
};
|
|
72
80
|
const sub = (keys, listener, set = listeners) => {
|
|
73
81
|
set.add(listener);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./HMQYEBKF.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
setup,
|
|
8
8
|
sync
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./A2J4XZ5T.js";
|
|
10
10
|
import {
|
|
11
11
|
defaultValue
|
|
12
12
|
} from "./I2VQ3XGR.js";
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
batch,
|
|
4
4
|
createStore,
|
|
5
|
+
init,
|
|
5
6
|
setup,
|
|
6
7
|
throwOnConflictingProps
|
|
7
|
-
} from "./
|
|
8
|
+
} from "./A2J4XZ5T.js";
|
|
8
9
|
import {
|
|
9
10
|
chain,
|
|
10
11
|
defaultValue
|
|
@@ -63,6 +64,9 @@ function getCommonParent(items) {
|
|
|
63
64
|
}
|
|
64
65
|
return getDocument(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
|
throwOnConflictingProps(props, props.store);
|
|
@@ -78,9 +82,11 @@ function createCollectionStore(props = {}) {
|
|
|
78
82
|
items,
|
|
79
83
|
renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
|
|
80
84
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
const syncPrivateStore = getPrivateStore(props.store);
|
|
86
|
+
const privateStore = createStore(
|
|
87
|
+
{ renderedItems: initialState.renderedItems },
|
|
88
|
+
syncPrivateStore
|
|
89
|
+
);
|
|
84
90
|
const collection = createStore(initialState, props.store);
|
|
85
91
|
const sortItems = () => {
|
|
86
92
|
const state = privateStore.getState();
|
|
@@ -88,7 +94,8 @@ function createCollectionStore(props = {}) {
|
|
|
88
94
|
privateStore.setState("renderedItems", renderedItems);
|
|
89
95
|
collection.setState("renderedItems", renderedItems);
|
|
90
96
|
};
|
|
91
|
-
setup(collection, () =>
|
|
97
|
+
setup(collection, () => init(privateStore));
|
|
98
|
+
setup(privateStore, () => {
|
|
92
99
|
return batch(privateStore, ["renderedItems"], (state) => {
|
|
93
100
|
let firstRun = true;
|
|
94
101
|
let raf = requestAnimationFrame(sortItems);
|
|
@@ -172,7 +179,9 @@ function createCollectionStore(props = {}) {
|
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
181
|
return item || null;
|
|
175
|
-
}
|
|
182
|
+
},
|
|
183
|
+
// @ts-expect-error Internal
|
|
184
|
+
__unstablePrivateStore: privateStore
|
|
176
185
|
});
|
|
177
186
|
}
|
|
178
187
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./LT2OYWRD.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
mergeStore,
|
|
8
8
|
omit,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./A2J4XZ5T.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
13
|
} from "./I2VQ3XGR.js";
|
|
@@ -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
|
+
}
|