@ariakit/core 0.2.6 → 0.2.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 +14 -0
- package/cjs/__chunks/{4Q3ZC7KF.cjs → DPHJ32KR.cjs} +17 -16
- package/cjs/__chunks/{O7U3LRFL.cjs → F5DMXFQ2.cjs} +37 -38
- package/cjs/__chunks/{5LY57557.cjs → FS2K2N7U.cjs} +84 -37
- package/cjs/__chunks/MCCIH6SG.cjs +41 -0
- package/cjs/__chunks/{WUNFMQBI.cjs → OQIG5VE3.cjs} +31 -31
- package/cjs/__chunks/{7JIMFSGQ.cjs → PIEJYPN7.cjs} +2 -2
- package/cjs/__chunks/{M6ZA7XUP.cjs → RCYVACJO.cjs} +2 -2
- package/cjs/__chunks/V7OHZPBO.cjs +76 -0
- package/cjs/checkbox/checkbox-store.cjs +6 -6
- package/cjs/collection/collection-store.cjs +5 -5
- package/cjs/combobox/combobox-store.cjs +67 -70
- package/cjs/combobox/combobox-store.d.ts +1 -1
- package/cjs/composite/composite-overflow-store.cjs +7 -7
- package/cjs/composite/composite-store.cjs +6 -6
- package/cjs/dialog/dialog-store.cjs +6 -6
- package/cjs/disclosure/disclosure-store.cjs +5 -5
- package/cjs/form/form-store.cjs +24 -24
- package/cjs/hovercard/hovercard-store.cjs +8 -8
- package/cjs/index.cjs +1 -1
- package/cjs/menu/menu-bar-store.cjs +8 -8
- package/cjs/menu/menu-store.cjs +35 -34
- package/cjs/popover/popover-store.cjs +7 -7
- package/cjs/radio/radio-store.cjs +12 -12
- package/cjs/select/select-store.cjs +80 -82
- package/cjs/tab/tab-store.cjs +63 -64
- package/cjs/toolbar/toolbar-store.cjs +8 -8
- package/cjs/tooltip/tooltip-store.cjs +15 -15
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/array.cjs +1 -1
- package/cjs/utils/dom.cjs +1 -1
- package/cjs/utils/events.cjs +3 -3
- package/cjs/utils/focus.cjs +2 -2
- package/cjs/utils/misc.cjs +3 -3
- package/cjs/utils/platform.cjs +1 -1
- package/cjs/utils/store.cjs +18 -4
- package/cjs/utils/store.d.ts +19 -59
- package/cjs/utils/types.d.ts +4 -0
- package/esm/__chunks/{QEFBF7I4.js → A7IMXABC.js} +31 -32
- package/esm/__chunks/{TBCDDKVT.js → COUCUJML.js} +4 -4
- package/esm/__chunks/{4F3NSHNZ.js → LNMWV6UV.js} +1 -1
- package/esm/__chunks/{LK6LFO7X.js → OGOHEUXI.js} +73 -26
- package/esm/__chunks/{WFO54Y6U.js → ROY5BBHL.js} +17 -17
- package/esm/__chunks/{U5NFQJHX.js → SOCHV2LZ.js} +8 -7
- package/esm/__chunks/{3HOKSVPG.js → WSKDP2MG.js} +29 -33
- package/esm/__chunks/{NWU4GBZ6.js → WVTCK5PV.js} +1 -1
- package/esm/checkbox/checkbox-store.js +3 -3
- package/esm/collection/collection-store.js +4 -4
- package/esm/combobox/combobox-store.d.ts +1 -1
- package/esm/combobox/combobox-store.js +52 -55
- package/esm/composite/composite-overflow-store.js +6 -6
- package/esm/composite/composite-store.js +5 -5
- package/esm/dialog/dialog-store.js +5 -5
- package/esm/disclosure/disclosure-store.js +4 -4
- package/esm/form/form-store.js +4 -4
- package/esm/hovercard/hovercard-store.js +7 -7
- package/esm/index.js +1 -1
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.js +22 -21
- package/esm/popover/popover-store.js +6 -6
- package/esm/radio/radio-store.js +5 -5
- package/esm/select/select-store.js +64 -66
- package/esm/tab/tab-store.js +55 -56
- package/esm/toolbar/toolbar-store.js +5 -5
- package/esm/tooltip/tooltip-store.js +7 -7
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/array.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/events.js +1 -1
- package/esm/utils/focus.js +1 -1
- package/esm/utils/misc.js +2 -2
- package/esm/utils/platform.js +1 -1
- package/esm/utils/store.d.ts +19 -59
- package/esm/utils/store.js +19 -5
- package/esm/utils/types.d.ts +4 -0
- package/package.json +1 -1
- package/cjs/__chunks/IRBRPEUG.cjs +0 -80
- package/cjs/__chunks/XBF2IZLR.cjs +0 -41
- /package/cjs/__chunks/{6455U47T.cjs → 72I2GWXF.cjs} +0 -0
- /package/esm/__chunks/{4BKCJXBM.js → PNRLI7OV.js} +0 -0
package/cjs/utils/platform.cjs
CHANGED
package/cjs/utils/store.cjs
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _5LY57557cjs = require('../__chunks/5LY57557.cjs');
|
|
5
|
-
require('../__chunks/M6ZA7XUP.cjs');
|
|
6
|
-
require('../__chunks/6455U47T.cjs');
|
|
7
4
|
|
|
8
5
|
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _FS2K2N7Ucjs = require('../__chunks/FS2K2N7U.cjs');
|
|
12
|
+
require('../__chunks/RCYVACJO.cjs');
|
|
13
|
+
require('../__chunks/72I2GWXF.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.batch = _FS2K2N7Ucjs.batch; exports.createStore = _FS2K2N7Ucjs.createStore; exports.init = _FS2K2N7Ucjs.init; exports.mergeStore = _FS2K2N7Ucjs.mergeStore; exports.omit = _FS2K2N7Ucjs.omit; exports.pick = _FS2K2N7Ucjs.pick; exports.setup = _FS2K2N7Ucjs.setup; exports.subscribe = _FS2K2N7Ucjs.subscribe; exports.sync = _FS2K2N7Ucjs.sync;
|
package/cjs/utils/store.d.ts
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import type { AnyObject, SetStateAction } from "./types.js";
|
|
2
|
+
type Listener<S> = (state: S, prevState: S) => void | (() => void);
|
|
3
|
+
type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
|
|
4
|
+
type StoreSetup = (callback: () => void | (() => void)) => () => void;
|
|
5
|
+
type StoreInit = () => () => void;
|
|
6
|
+
type StoreSubscribe<S = State, K extends keyof S = keyof S> = Sync<S, K>;
|
|
7
|
+
type StoreSync<S = State, K extends keyof S = keyof S> = Sync<S, K>;
|
|
8
|
+
type StoreBatch<S = State, K extends keyof S = keyof S> = Sync<S, K>;
|
|
9
|
+
type StorePick<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Pick<S, K[number]>>;
|
|
10
|
+
type StoreOmit<S = State, K extends ReadonlyArray<keyof S> = ReadonlyArray<keyof S>> = (keys: K) => Store<Omit<S, K[number]>>;
|
|
2
11
|
/**
|
|
3
12
|
* Creates a store.
|
|
4
13
|
* @param initialState Initial state.
|
|
5
14
|
* @param stores Stores to extend.
|
|
6
15
|
*/
|
|
7
|
-
export declare function createStore<S extends State>(initialState: S, ...stores: Array<
|
|
16
|
+
export declare function createStore<S extends State>(initialState: S, ...stores: Array<Store<Partial<S>> | undefined>): Store<S>;
|
|
17
|
+
export declare function setup<T extends Store>(store?: T, ...args: Parameters<StoreSetup>): T extends Store ? ReturnType<StoreSetup> : void;
|
|
18
|
+
export declare function init<T extends Store>(store?: T, ...args: Parameters<StoreInit>): T extends Store ? ReturnType<StoreInit> : void;
|
|
19
|
+
export declare function subscribe<T extends Store, K extends keyof StoreState<T>>(store?: T, ...args: Parameters<StoreSubscribe<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSubscribe<StoreState<T>, K>> : void;
|
|
20
|
+
export declare function sync<T extends Store, K extends keyof StoreState<T>>(store?: T, ...args: Parameters<StoreSync<StoreState<T>, K>>): T extends Store ? ReturnType<StoreSync<StoreState<T>, K>> : void;
|
|
21
|
+
export declare function batch<T extends Store, K extends keyof StoreState<T>>(store?: T, ...args: Parameters<StoreBatch<StoreState<T>, K>>): T extends Store ? ReturnType<StoreBatch<StoreState<T>, K>> : void;
|
|
22
|
+
export declare function omit<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T, ...args: Parameters<StoreOmit<StoreState<T>, K>>): T extends Store ? ReturnType<StoreOmit<StoreState<T>, K>> : void;
|
|
23
|
+
export declare function pick<T extends Store, K extends ReadonlyArray<keyof StoreState<T>>>(store?: T, ...args: Parameters<StorePick<StoreState<T>, K>>): T extends Store ? ReturnType<StorePick<StoreState<T>, K>> : void;
|
|
8
24
|
/**
|
|
9
25
|
* Merges multiple stores into a single store.
|
|
10
26
|
*/
|
|
11
|
-
export declare function mergeStore<S extends State>(...stores: Array<
|
|
27
|
+
export declare function mergeStore<S extends State>(...stores: Array<Store<S> | undefined>): Store<S>;
|
|
12
28
|
/**
|
|
13
29
|
* Store state type.
|
|
14
30
|
*/
|
|
@@ -33,23 +49,6 @@ export type StoreProps<S extends State = State> = {
|
|
|
33
49
|
export type StoreState<T> = T extends {
|
|
34
50
|
getState(): infer S;
|
|
35
51
|
} ? S : never;
|
|
36
|
-
/**
|
|
37
|
-
* Store listener type.
|
|
38
|
-
* @template S State type.
|
|
39
|
-
*/
|
|
40
|
-
export type Listener<S> = (state: S, prevState: S) => void | (() => void);
|
|
41
|
-
/**
|
|
42
|
-
* Subscriber function type used by `sync`, `subscribe` and `effect`.
|
|
43
|
-
* @template S State type.
|
|
44
|
-
*/
|
|
45
|
-
export type Sync<S = State> = {
|
|
46
|
-
/**
|
|
47
|
-
* @param listener The listener function. It's called with the current state
|
|
48
|
-
* and the previous state as arguments and may return a cleanup function.
|
|
49
|
-
* @param keys Optional array of state keys to listen to.
|
|
50
|
-
*/
|
|
51
|
-
<K extends keyof S = keyof S>(listener: Listener<Pick<S, K>>, keys?: K[]): () => void;
|
|
52
|
-
};
|
|
53
52
|
/**
|
|
54
53
|
* Store.
|
|
55
54
|
* @template S State type.
|
|
@@ -63,44 +62,5 @@ export interface Store<S = State> {
|
|
|
63
62
|
* Sets a state value.
|
|
64
63
|
*/
|
|
65
64
|
setState<K extends keyof S>(key: K, value: SetStateAction<S[K]>): void;
|
|
66
|
-
/**
|
|
67
|
-
* Register a callback function that's called when the store is initialized.
|
|
68
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
69
|
-
*/
|
|
70
|
-
setup: (callback: () => void | (() => void)) => () => void;
|
|
71
|
-
/**
|
|
72
|
-
* Function that should be called when the store is initialized.
|
|
73
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
74
|
-
*/
|
|
75
|
-
init: () => () => void;
|
|
76
|
-
/**
|
|
77
|
-
* Registers a listener function that's called immediately and synchronously
|
|
78
|
-
* whenever the store state changes.
|
|
79
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
80
|
-
*/
|
|
81
|
-
sync: Sync<S>;
|
|
82
|
-
/**
|
|
83
|
-
* Registers a listener function that's called after state changes in the
|
|
84
|
-
* store.
|
|
85
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
86
|
-
*/
|
|
87
|
-
subscribe: Sync<S>;
|
|
88
|
-
/**
|
|
89
|
-
* Registers a listener function that's called immediately and after a batch
|
|
90
|
-
* of state changes in the store.
|
|
91
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
92
|
-
*/
|
|
93
|
-
syncBatch: Sync<S>;
|
|
94
|
-
/**
|
|
95
|
-
* Creates a new store with a subset of the current store state and keeps them
|
|
96
|
-
* in sync.
|
|
97
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
98
|
-
*/
|
|
99
|
-
pick<K extends Array<keyof S>>(...keys: K): Store<Pick<S, K[number]>>;
|
|
100
|
-
/**
|
|
101
|
-
* Creates a new store with a subset of the current store state and keeps them
|
|
102
|
-
* in sync.
|
|
103
|
-
* @deprecated Experimental. This API may change in minor or patch releases.
|
|
104
|
-
*/
|
|
105
|
-
omit<K extends Array<keyof S>>(...keys: K): Store<Omit<S, K[number]>>;
|
|
106
65
|
}
|
|
66
|
+
export {};
|
package/cjs/utils/types.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
batch,
|
|
3
|
+
createStore,
|
|
4
|
+
setup
|
|
5
|
+
} from "./OGOHEUXI.js";
|
|
4
6
|
import {
|
|
5
7
|
chain,
|
|
6
8
|
defaultValue
|
|
7
|
-
} from "./
|
|
9
|
+
} from "./WVTCK5PV.js";
|
|
8
10
|
import {
|
|
9
11
|
getDocument
|
|
10
12
|
} from "./O35LWD4W.js";
|
|
11
13
|
import {
|
|
12
14
|
__spreadProps,
|
|
13
15
|
__spreadValues
|
|
14
|
-
} from "./
|
|
16
|
+
} from "./PNRLI7OV.js";
|
|
15
17
|
|
|
16
18
|
// src/collection/collection-store.ts
|
|
17
19
|
function isElementPreceding(a, b) {
|
|
@@ -83,35 +85,32 @@ function createCollectionStore(props = {}) {
|
|
|
83
85
|
privateStore.setState("renderedItems", renderedItems);
|
|
84
86
|
collection.setState("renderedItems", renderedItems);
|
|
85
87
|
};
|
|
86
|
-
|
|
87
|
-
return privateStore
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
setup(collection, () => {
|
|
89
|
+
return batch(privateStore, ["renderedItems"], (state) => {
|
|
90
|
+
let firstRun = true;
|
|
91
|
+
let raf = requestAnimationFrame(sortItems);
|
|
92
|
+
if (typeof IntersectionObserver !== "function")
|
|
93
|
+
return;
|
|
94
|
+
const callback = () => {
|
|
95
|
+
if (firstRun) {
|
|
96
|
+
firstRun = false;
|
|
92
97
|
return;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
cancelAnimationFrame(raf);
|
|
110
|
-
observer.disconnect();
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
["renderedItems"]
|
|
114
|
-
);
|
|
98
|
+
}
|
|
99
|
+
cancelAnimationFrame(raf);
|
|
100
|
+
raf = requestAnimationFrame(sortItems);
|
|
101
|
+
};
|
|
102
|
+
const root = getCommonParent(state.renderedItems);
|
|
103
|
+
const observer = new IntersectionObserver(callback, { root });
|
|
104
|
+
state.renderedItems.forEach((item) => {
|
|
105
|
+
if (!item.element)
|
|
106
|
+
return;
|
|
107
|
+
observer.observe(item.element);
|
|
108
|
+
});
|
|
109
|
+
return () => {
|
|
110
|
+
cancelAnimationFrame(raf);
|
|
111
|
+
observer.disconnect();
|
|
112
|
+
};
|
|
113
|
+
});
|
|
115
114
|
});
|
|
116
115
|
const mergeItem = (item, setItems, canDeleteFromMap = false) => {
|
|
117
116
|
let prevItem;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./SOCHV2LZ.js";
|
|
4
4
|
import {
|
|
5
5
|
createStore
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./OGOHEUXI.js";
|
|
7
7
|
import {
|
|
8
8
|
defaultValue
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./WVTCK5PV.js";
|
|
10
10
|
import {
|
|
11
11
|
__spreadProps,
|
|
12
12
|
__spreadValues
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./PNRLI7OV.js";
|
|
14
14
|
|
|
15
15
|
// src/hovercard/hovercard-store.ts
|
|
16
16
|
function createHovercardStore(props = {}) {
|
|
@@ -3,16 +3,22 @@ import {
|
|
|
3
3
|
chain,
|
|
4
4
|
getKeys,
|
|
5
5
|
hasOwnProperty,
|
|
6
|
+
invariant,
|
|
6
7
|
noop,
|
|
7
8
|
omit,
|
|
8
9
|
pick
|
|
9
|
-
} from "./
|
|
10
|
+
} from "./WVTCK5PV.js";
|
|
10
11
|
import {
|
|
11
12
|
__spreadProps,
|
|
12
13
|
__spreadValues
|
|
13
|
-
} from "./
|
|
14
|
+
} from "./PNRLI7OV.js";
|
|
14
15
|
|
|
15
16
|
// src/utils/store.ts
|
|
17
|
+
function getInternal(store, key) {
|
|
18
|
+
const internals = store.__unstableInternals;
|
|
19
|
+
invariant(internals, "Invalid store");
|
|
20
|
+
return internals[key];
|
|
21
|
+
}
|
|
16
22
|
function createStore(initialState, ...stores) {
|
|
17
23
|
let state = initialState;
|
|
18
24
|
let prevStateBatch = state;
|
|
@@ -24,11 +30,11 @@ function createStore(initialState, ...stores) {
|
|
|
24
30
|
const listenersBatch = /* @__PURE__ */ new Set();
|
|
25
31
|
const disposables = /* @__PURE__ */ new WeakMap();
|
|
26
32
|
const listenerKeys = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
const
|
|
33
|
+
const storeSetup = (callback) => {
|
|
28
34
|
setups.add(callback);
|
|
29
35
|
return () => setups.delete(callback);
|
|
30
36
|
};
|
|
31
|
-
const
|
|
37
|
+
const storeInit = () => {
|
|
32
38
|
if (initialized)
|
|
33
39
|
return noop;
|
|
34
40
|
if (!stores.length)
|
|
@@ -37,28 +43,25 @@ function createStore(initialState, ...stores) {
|
|
|
37
43
|
const desyncs = getKeys(state).map(
|
|
38
44
|
(key) => chain(
|
|
39
45
|
...stores.map((store) => {
|
|
40
|
-
var _a
|
|
46
|
+
var _a;
|
|
41
47
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
42
48
|
if (!storeState)
|
|
43
49
|
return;
|
|
44
50
|
if (!hasOwnProperty(storeState, key))
|
|
45
51
|
return;
|
|
46
|
-
return
|
|
52
|
+
return sync(store, [key], (state2) => setState(key, state2[key]));
|
|
47
53
|
})
|
|
48
54
|
)
|
|
49
55
|
);
|
|
50
56
|
const teardowns = [];
|
|
51
57
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
52
|
-
const cleanups = stores.map(
|
|
53
|
-
var _a;
|
|
54
|
-
return (_a = store == null ? void 0 : store.init) == null ? void 0 : _a.call(store);
|
|
55
|
-
});
|
|
58
|
+
const cleanups = stores.map(init);
|
|
56
59
|
return chain(...desyncs, ...teardowns, ...cleanups, () => {
|
|
57
60
|
initialized = false;
|
|
58
61
|
});
|
|
59
62
|
};
|
|
60
|
-
const sub = (
|
|
61
|
-
const set =
|
|
63
|
+
const sub = (keys, listener, batch2 = false) => {
|
|
64
|
+
const set = batch2 ? listenersBatch : listeners;
|
|
62
65
|
set.add(listener);
|
|
63
66
|
listenerKeys.set(listener, keys);
|
|
64
67
|
return () => {
|
|
@@ -69,15 +72,17 @@ function createStore(initialState, ...stores) {
|
|
|
69
72
|
set.delete(listener);
|
|
70
73
|
};
|
|
71
74
|
};
|
|
72
|
-
const
|
|
73
|
-
const
|
|
75
|
+
const storeSubscribe = (keys, listener) => sub(keys, listener);
|
|
76
|
+
const storeSync = (keys, listener) => {
|
|
74
77
|
disposables.set(listener, listener(state, state));
|
|
75
|
-
return sub(
|
|
78
|
+
return sub(keys, listener);
|
|
76
79
|
};
|
|
77
|
-
const
|
|
80
|
+
const storeBatch = (keys, listener) => {
|
|
78
81
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
79
|
-
return sub(
|
|
82
|
+
return sub(keys, listener, true);
|
|
80
83
|
};
|
|
84
|
+
const storePick = (keys) => createStore(pick(state, keys), finalStore);
|
|
85
|
+
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
|
|
81
86
|
const getState = () => state;
|
|
82
87
|
const setState = (key, value) => {
|
|
83
88
|
if (!hasOwnProperty(state, key))
|
|
@@ -115,21 +120,56 @@ function createStore(initialState, ...stores) {
|
|
|
115
120
|
updatedKeys.clear();
|
|
116
121
|
});
|
|
117
122
|
};
|
|
118
|
-
const pick2 = (...keys) => createStore(pick(state, keys), finalStore);
|
|
119
|
-
const omit2 = (...keys) => createStore(omit(state, keys), finalStore);
|
|
120
123
|
const finalStore = {
|
|
121
|
-
setup,
|
|
122
|
-
init,
|
|
123
|
-
subscribe,
|
|
124
|
-
sync,
|
|
125
|
-
syncBatch,
|
|
126
124
|
getState,
|
|
127
125
|
setState,
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
__unstableInternals: {
|
|
127
|
+
setup: storeSetup,
|
|
128
|
+
init: storeInit,
|
|
129
|
+
subscribe: storeSubscribe,
|
|
130
|
+
sync: storeSync,
|
|
131
|
+
batch: storeBatch,
|
|
132
|
+
pick: storePick,
|
|
133
|
+
omit: storeOmit
|
|
134
|
+
}
|
|
130
135
|
};
|
|
131
136
|
return finalStore;
|
|
132
137
|
}
|
|
138
|
+
function setup(store, ...args) {
|
|
139
|
+
if (!store)
|
|
140
|
+
return;
|
|
141
|
+
return getInternal(store, "setup")(...args);
|
|
142
|
+
}
|
|
143
|
+
function init(store, ...args) {
|
|
144
|
+
if (!store)
|
|
145
|
+
return;
|
|
146
|
+
return getInternal(store, "init")(...args);
|
|
147
|
+
}
|
|
148
|
+
function subscribe(store, ...args) {
|
|
149
|
+
if (!store)
|
|
150
|
+
return;
|
|
151
|
+
return getInternal(store, "subscribe")(...args);
|
|
152
|
+
}
|
|
153
|
+
function sync(store, ...args) {
|
|
154
|
+
if (!store)
|
|
155
|
+
return;
|
|
156
|
+
return getInternal(store, "sync")(...args);
|
|
157
|
+
}
|
|
158
|
+
function batch(store, ...args) {
|
|
159
|
+
if (!store)
|
|
160
|
+
return;
|
|
161
|
+
return getInternal(store, "batch")(...args);
|
|
162
|
+
}
|
|
163
|
+
function omit2(store, ...args) {
|
|
164
|
+
if (!store)
|
|
165
|
+
return;
|
|
166
|
+
return getInternal(store, "omit")(...args);
|
|
167
|
+
}
|
|
168
|
+
function pick2(store, ...args) {
|
|
169
|
+
if (!store)
|
|
170
|
+
return;
|
|
171
|
+
return getInternal(store, "pick")(...args);
|
|
172
|
+
}
|
|
133
173
|
function mergeStore(...stores) {
|
|
134
174
|
const initialState = stores.reduce((state, store2) => {
|
|
135
175
|
var _a;
|
|
@@ -144,5 +184,12 @@ function mergeStore(...stores) {
|
|
|
144
184
|
|
|
145
185
|
export {
|
|
146
186
|
createStore,
|
|
187
|
+
setup,
|
|
188
|
+
init,
|
|
189
|
+
subscribe,
|
|
190
|
+
sync,
|
|
191
|
+
batch,
|
|
192
|
+
omit2 as omit,
|
|
193
|
+
pick2 as pick,
|
|
147
194
|
mergeStore
|
|
148
195
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCollectionStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./A7IMXABC.js";
|
|
4
4
|
import {
|
|
5
|
-
createStore
|
|
6
|
-
|
|
5
|
+
createStore,
|
|
6
|
+
setup,
|
|
7
|
+
sync
|
|
8
|
+
} from "./OGOHEUXI.js";
|
|
7
9
|
import {
|
|
8
10
|
defaultValue
|
|
9
|
-
} from "./
|
|
11
|
+
} from "./WVTCK5PV.js";
|
|
10
12
|
import {
|
|
11
13
|
flatten2DArray,
|
|
12
14
|
reverseArray
|
|
@@ -14,7 +16,7 @@ import {
|
|
|
14
16
|
import {
|
|
15
17
|
__spreadProps,
|
|
16
18
|
__spreadValues
|
|
17
|
-
} from "./
|
|
19
|
+
} from "./PNRLI7OV.js";
|
|
18
20
|
|
|
19
21
|
// src/composite/composite-store.ts
|
|
20
22
|
var NULL_ITEM = { id: null };
|
|
@@ -152,18 +154,16 @@ function createCompositeStore(props = {}) {
|
|
|
152
154
|
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
153
155
|
});
|
|
154
156
|
const composite = createStore(initialState, collection, props.store);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
["renderedItems", "activeId"]
|
|
166
|
-
)
|
|
157
|
+
setup(
|
|
158
|
+
composite,
|
|
159
|
+
() => sync(composite, ["renderedItems", "activeId"], (state) => {
|
|
160
|
+
composite.setState("activeId", (activeId2) => {
|
|
161
|
+
var _a2;
|
|
162
|
+
if (activeId2 !== void 0)
|
|
163
|
+
return activeId2;
|
|
164
|
+
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
165
|
+
});
|
|
166
|
+
})
|
|
167
167
|
);
|
|
168
168
|
const getNextId = (items, orientation, hasNullItem, skip) => {
|
|
169
169
|
var _a2, _b;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDialogStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./LNMWV6UV.js";
|
|
4
4
|
import {
|
|
5
5
|
createStore,
|
|
6
|
-
mergeStore
|
|
7
|
-
|
|
6
|
+
mergeStore,
|
|
7
|
+
omit
|
|
8
|
+
} from "./OGOHEUXI.js";
|
|
8
9
|
import {
|
|
9
10
|
defaultValue
|
|
10
|
-
} from "./
|
|
11
|
+
} from "./WVTCK5PV.js";
|
|
11
12
|
import {
|
|
12
13
|
__objRest,
|
|
13
14
|
__spreadProps,
|
|
14
15
|
__spreadValues
|
|
15
|
-
} from "./
|
|
16
|
+
} from "./PNRLI7OV.js";
|
|
16
17
|
|
|
17
18
|
// src/popover/popover-store.ts
|
|
18
19
|
function createPopoverStore(_a = {}) {
|
|
@@ -23,13 +24,13 @@ function createPopoverStore(_a = {}) {
|
|
|
23
24
|
]);
|
|
24
25
|
const store = mergeStore(
|
|
25
26
|
props.store,
|
|
26
|
-
otherPopover
|
|
27
|
+
omit(otherPopover, [
|
|
27
28
|
"arrowElement",
|
|
28
29
|
"anchorElement",
|
|
29
30
|
"contentElement",
|
|
30
31
|
"popoverElement",
|
|
31
32
|
"disclosureElement"
|
|
32
|
-
)
|
|
33
|
+
])
|
|
33
34
|
);
|
|
34
35
|
const syncState = store == null ? void 0 : store.getState();
|
|
35
36
|
const dialog = createDialogStore(__spreadProps(__spreadValues({}, props), { store }));
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createStore,
|
|
3
|
-
mergeStore
|
|
4
|
-
|
|
3
|
+
mergeStore,
|
|
4
|
+
omit,
|
|
5
|
+
setup,
|
|
6
|
+
sync
|
|
7
|
+
} from "./OGOHEUXI.js";
|
|
5
8
|
import {
|
|
6
9
|
defaultValue
|
|
7
|
-
} from "./
|
|
10
|
+
} from "./WVTCK5PV.js";
|
|
8
11
|
import {
|
|
9
12
|
__spreadProps,
|
|
10
13
|
__spreadValues
|
|
11
|
-
} from "./
|
|
14
|
+
} from "./PNRLI7OV.js";
|
|
12
15
|
|
|
13
16
|
// src/disclosure/disclosure-store.ts
|
|
14
17
|
function createDisclosureStore(props = {}) {
|
|
15
|
-
var _a;
|
|
16
18
|
const store = mergeStore(
|
|
17
19
|
props.store,
|
|
18
|
-
(
|
|
20
|
+
omit(props.disclosure, ["contentElement", "disclosureElement"])
|
|
19
21
|
);
|
|
20
22
|
const syncState = store == null ? void 0 : store.getState();
|
|
21
23
|
const open = defaultValue(
|
|
@@ -34,35 +36,29 @@ function createDisclosureStore(props = {}) {
|
|
|
34
36
|
disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
35
37
|
};
|
|
36
38
|
const disclosure = createStore(initialState, store);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
["animated", "animating"]
|
|
45
|
-
)
|
|
39
|
+
setup(
|
|
40
|
+
disclosure,
|
|
41
|
+
() => sync(disclosure, ["animated", "animating"], (state) => {
|
|
42
|
+
if (state.animated)
|
|
43
|
+
return;
|
|
44
|
+
disclosure.setState("animating", false);
|
|
45
|
+
})
|
|
46
46
|
);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
["open", "animated"]
|
|
57
|
-
)
|
|
47
|
+
setup(
|
|
48
|
+
disclosure,
|
|
49
|
+
() => sync(disclosure, ["open", "animated"], (state, prev) => {
|
|
50
|
+
if (!state.animated)
|
|
51
|
+
return;
|
|
52
|
+
const mounting = state === prev;
|
|
53
|
+
const animating = mounting ? state.open : state.open !== prev.open;
|
|
54
|
+
disclosure.setState("animating", animating);
|
|
55
|
+
})
|
|
58
56
|
);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
["open", "animating"]
|
|
65
|
-
)
|
|
57
|
+
setup(
|
|
58
|
+
disclosure,
|
|
59
|
+
() => sync(disclosure, ["open", "animating"], (state) => {
|
|
60
|
+
disclosure.setState("mounted", state.open || state.animating);
|
|
61
|
+
})
|
|
66
62
|
);
|
|
67
63
|
return __spreadProps(__spreadValues({}, disclosure), {
|
|
68
64
|
setOpen: (value) => disclosure.setState("open", value),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createStore
|
|
3
|
-
} from "../__chunks/
|
|
3
|
+
} from "../__chunks/OGOHEUXI.js";
|
|
4
4
|
import {
|
|
5
5
|
defaultValue
|
|
6
|
-
} from "../__chunks/
|
|
6
|
+
} from "../__chunks/WVTCK5PV.js";
|
|
7
7
|
import {
|
|
8
8
|
__spreadProps,
|
|
9
9
|
__spreadValues
|
|
10
|
-
} from "../__chunks/
|
|
10
|
+
} from "../__chunks/PNRLI7OV.js";
|
|
11
11
|
|
|
12
12
|
// src/checkbox/checkbox-store.ts
|
|
13
13
|
function createCheckboxStore(props = {}) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCollectionStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/A7IMXABC.js";
|
|
4
|
+
import "../__chunks/OGOHEUXI.js";
|
|
5
|
+
import "../__chunks/WVTCK5PV.js";
|
|
6
6
|
import "../__chunks/O35LWD4W.js";
|
|
7
|
-
import "../__chunks/
|
|
7
|
+
import "../__chunks/PNRLI7OV.js";
|
|
8
8
|
export {
|
|
9
9
|
createCollectionStore
|
|
10
10
|
};
|