@ariakit/core 0.3.3 → 0.3.5
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 +16 -0
- package/cjs/__chunks/{RCYVACJO.cjs → 3UT5FE6K.cjs} +9 -4
- package/cjs/__chunks/{TTWS4MDC.cjs → AR2VJ37F.cjs} +30 -29
- package/cjs/__chunks/{72I2GWXF.cjs → AV6KTKLE.cjs} +2 -1
- package/cjs/__chunks/F5YZIIEA.cjs +29 -0
- package/cjs/__chunks/{A7K3KZJL.cjs → F6Q5QSXF.cjs} +20 -19
- package/cjs/__chunks/{W5IQT6Z2.cjs → FFY2GSOG.cjs} +17 -16
- package/cjs/__chunks/{A4GDJCZB.cjs → FJSZTIOU.cjs} +18 -17
- package/cjs/__chunks/{EXM2AW52.cjs → FTB5CXVB.cjs} +3 -1
- package/cjs/__chunks/{EIRIJC7T.cjs → G5EW4WED.cjs} +8 -7
- package/cjs/__chunks/{ZYIEFAMB.cjs → HOEZKRUM.cjs} +18 -17
- package/cjs/__chunks/{DFFIYGBS.cjs → MYTMMWXI.cjs} +4 -3
- package/cjs/__chunks/{GDZQUFNP.cjs → ULSPM3Y3.cjs} +3 -1
- package/cjs/__chunks/XVR5QRC3.cjs +42 -0
- package/cjs/checkbox/checkbox-store.cjs +9 -8
- package/cjs/checkbox/checkbox-store.d.cts +41 -0
- package/cjs/collection/collection-store.cjs +8 -7
- package/cjs/collection/collection-store.d.cts +65 -0
- package/cjs/combobox/combobox-store.cjs +37 -36
- package/cjs/combobox/combobox-store.d.cts +77 -0
- package/cjs/composite/composite-overflow-store.cjs +9 -8
- package/cjs/composite/composite-overflow-store.d.cts +10 -0
- package/cjs/composite/composite-store.cjs +10 -9
- package/cjs/composite/composite-store.d.cts +206 -0
- package/cjs/dialog/dialog-store.cjs +8 -7
- package/cjs/dialog/dialog-store.d.cts +10 -0
- package/cjs/disclosure/disclosure-store.cjs +7 -6
- package/cjs/disclosure/disclosure-store.d.cts +125 -0
- package/cjs/form/form-store.cjs +30 -29
- package/cjs/form/form-store.d.cts +236 -0
- package/cjs/form/types.cjs +1 -1
- package/cjs/form/types.d.cts +38 -0
- package/cjs/hovercard/hovercard-store.cjs +10 -9
- package/cjs/hovercard/hovercard-store.d.cts +46 -0
- package/cjs/index.cjs +2 -1
- package/cjs/index.d.cts +2 -0
- package/cjs/menu/menu-bar-store.cjs +10 -22
- package/cjs/menu/menu-bar-store.d.cts +10 -0
- package/cjs/menu/menu-bar-store.d.ts +6 -6
- package/cjs/menu/menu-store.cjs +35 -34
- package/cjs/menu/menu-store.d.cts +78 -0
- package/cjs/menubar/menubar-store.cjs +14 -0
- package/cjs/menubar/menubar-store.d.cts +10 -0
- package/cjs/menubar/menubar-store.d.ts +10 -0
- package/cjs/popover/popover-store.cjs +9 -8
- package/cjs/popover/popover-store.d.cts +69 -0
- package/cjs/radio/radio-store.cjs +16 -15
- package/cjs/radio/radio-store.d.cts +36 -0
- package/cjs/select/select-store.cjs +37 -36
- package/cjs/select/select-store.d.cts +93 -0
- package/cjs/tab/tab-store.cjs +28 -27
- package/cjs/tab/tab-store.d.cts +87 -0
- package/cjs/toolbar/toolbar-store.cjs +12 -11
- package/cjs/toolbar/toolbar-store.d.cts +21 -0
- package/cjs/tooltip/tooltip-store.cjs +17 -16
- package/cjs/tooltip/tooltip-store.d.cts +29 -0
- package/cjs/utils/array.cjs +5 -4
- package/cjs/utils/array.d.cts +29 -0
- package/cjs/utils/dom.cjs +5 -4
- package/cjs/utils/dom.d.cts +105 -0
- package/cjs/utils/events.cjs +10 -9
- package/cjs/utils/events.d.cts +70 -0
- package/cjs/utils/focus.cjs +17 -16
- package/cjs/utils/focus.d.cts +117 -0
- package/cjs/utils/misc.cjs +7 -4
- package/cjs/utils/misc.d.cts +124 -0
- package/cjs/utils/misc.d.ts +7 -0
- package/cjs/utils/platform.cjs +6 -5
- package/cjs/utils/platform.d.cts +20 -0
- package/cjs/utils/store.cjs +6 -5
- package/cjs/utils/store.d.cts +71 -0
- package/cjs/utils/types.cjs +1 -1
- package/cjs/utils/types.d.cts +74 -0
- package/esm/__chunks/{PNRLI7OV.js → 4R3V3JGP.js} +1 -0
- package/esm/__chunks/{E6THWJ7N.js → 5BWT4GY2.js} +6 -5
- package/esm/__chunks/{UCFCIHEU.js → 5UJPJ37G.js} +2 -1
- package/esm/__chunks/{C57Q2UMF.js → 6EMNXRG3.js} +5 -4
- package/esm/__chunks/6LSGADQM.js +29 -0
- package/esm/__chunks/{5XEKIOCW.js → 7PRQYBBV.js} +2 -0
- package/esm/__chunks/{HN27WCTM.js → DREIYIMP.js} +2 -1
- package/esm/__chunks/{L4QLJSLG.js → EIFVU736.js} +5 -4
- package/esm/__chunks/{Y5SJEQQJ.js → HJS6GJT4.js} +3 -2
- package/esm/__chunks/{WVTCK5PV.js → I2VQ3XGR.js} +6 -1
- package/esm/__chunks/{JLNC5RR2.js → MRBDYBGO.js} +5 -4
- package/esm/__chunks/{O35LWD4W.js → NIF7E7VE.js} +2 -0
- package/esm/__chunks/{A2MHRHOV.js → PCA5ARZU.js} +4 -3
- package/esm/checkbox/checkbox-store.js +4 -3
- package/esm/collection/collection-store.js +6 -5
- package/esm/combobox/combobox-store.js +12 -11
- package/esm/composite/composite-overflow-store.js +7 -6
- package/esm/composite/composite-store.js +8 -7
- package/esm/dialog/dialog-store.js +6 -5
- package/esm/disclosure/disclosure-store.js +5 -4
- package/esm/form/form-store.js +6 -5
- package/esm/form/types.js +1 -0
- package/esm/hovercard/hovercard-store.js +8 -7
- package/esm/index.js +2 -1
- package/esm/menu/menu-bar-store.d.ts +6 -6
- package/esm/menu/menu-bar-store.js +11 -23
- package/esm/menu/menu-store.js +12 -11
- package/esm/menubar/menubar-store.d.ts +10 -0
- package/esm/menubar/menubar-store.js +14 -0
- package/esm/popover/popover-store.js +7 -6
- package/esm/radio/radio-store.js +8 -7
- package/esm/select/select-store.js +11 -10
- package/esm/tab/tab-store.js +8 -7
- package/esm/toolbar/toolbar-store.js +8 -7
- package/esm/tooltip/tooltip-store.js +8 -7
- package/esm/utils/array.js +3 -2
- package/esm/utils/dom.js +3 -2
- package/esm/utils/events.js +4 -3
- package/esm/utils/focus.js +3 -2
- package/esm/utils/misc.d.ts +7 -0
- package/esm/utils/misc.js +5 -2
- package/esm/utils/platform.js +4 -3
- package/esm/utils/store.js +4 -3
- package/esm/utils/types.js +1 -0
- package/menubar/menubar-store/package.json +8 -0
- package/package.json +116 -28
- package/cjs/__chunks/NEBQQIUX.cjs +0 -41
- package/cjs/tsconfig.build.tsbuildinfo +0 -1
- package/esm/tsconfig.build.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.3.5
|
|
4
|
+
|
|
5
|
+
- Added new `menubar` module.
|
|
6
|
+
|
|
7
|
+
## 0.3.4
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`#2935`](https://github.com/ariakit/ariakit/pull/2935) Fixed TypeScript declaration files in CommonJS projects using `NodeNext` for `moduleResolution`.
|
|
12
|
+
|
|
13
|
+
- [`#2945`](https://github.com/ariakit/ariakit/pull/2945) Added new `disabledFromProps` function to `@ariakit/core/utils/misc`.
|
|
14
|
+
|
|
15
|
+
- [`#2948`](https://github.com/ariakit/ariakit/pull/2948) Added `"use client"` directive to all modules.
|
|
16
|
+
|
|
17
|
+
- Improved JSDocs.
|
|
18
|
+
|
|
3
19
|
## 0.3.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
4
5
|
|
|
5
6
|
// src/utils/misc.ts
|
|
6
7
|
function noop(..._) {
|
|
@@ -80,7 +81,7 @@ function normalizeString(str) {
|
|
|
80
81
|
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
81
82
|
}
|
|
82
83
|
function omit(object, keys) {
|
|
83
|
-
const result =
|
|
84
|
+
const result = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, object);
|
|
84
85
|
for (const key of keys) {
|
|
85
86
|
if (hasOwnProperty(result, key)) {
|
|
86
87
|
delete result[key];
|
|
@@ -126,6 +127,9 @@ function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
|
126
127
|
return false;
|
|
127
128
|
return !result;
|
|
128
129
|
}
|
|
130
|
+
function disabledFromProps(props) {
|
|
131
|
+
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
132
|
+
}
|
|
129
133
|
function defaultValue(...values) {
|
|
130
134
|
for (const value of values) {
|
|
131
135
|
if (value !== void 0)
|
|
@@ -154,4 +158,5 @@ function defaultValue(...values) {
|
|
|
154
158
|
|
|
155
159
|
|
|
156
160
|
|
|
157
|
-
|
|
161
|
+
|
|
162
|
+
exports.noop = noop; exports.shallowEqual = shallowEqual; exports.applyState = applyState; exports.isObject = isObject; exports.isEmpty = isEmpty; exports.isInteger = isInteger; exports.hasOwnProperty = hasOwnProperty; exports.chain = chain; exports.cx = cx; exports.normalizeString = normalizeString; exports.omit = omit; exports.pick = pick; exports.identity = identity; exports.beforePaint = beforePaint; exports.afterPaint = afterPaint; exports.invariant = invariant; exports.getKeys = getKeys; exports.isFalsyBooleanCallback = isFalsyBooleanCallback; exports.disabledFromProps = disabledFromProps; exports.defaultValue = defaultValue;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
var _W5IQT6Z2cjs = require('./W5IQT6Z2.cjs');
|
|
4
3
|
|
|
4
|
+
var _FFY2GSOGcjs = require('./FFY2GSOG.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _A4GDJCZBcjs = require('./A4GDJCZB.cjs');
|
|
9
8
|
|
|
9
|
+
var _FJSZTIOUcjs = require('./FJSZTIOU.cjs');
|
|
10
10
|
|
|
11
|
-
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
12
11
|
|
|
12
|
+
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var _GDZQUFNPcjs = require('./GDZQUFNP.cjs');
|
|
16
15
|
|
|
16
|
+
var _ULSPM3Y3cjs = require('./ULSPM3Y3.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
20
21
|
|
|
21
22
|
// src/composite/composite-store.ts
|
|
22
23
|
var NULL_ITEM = { id: null };
|
|
@@ -107,7 +108,7 @@ function verticalizeItems(items) {
|
|
|
107
108
|
for (const row of rows) {
|
|
108
109
|
const item = row[i];
|
|
109
110
|
if (item) {
|
|
110
|
-
verticalized.push(
|
|
111
|
+
verticalized.push(_AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, item), {
|
|
111
112
|
// If there's no rowId, it means that it's not a grid composite, but
|
|
112
113
|
// a single row instead. So, instead of verticalizing it, that is,
|
|
113
114
|
// assigning a different rowId based on the column index, we keep it
|
|
@@ -123,40 +124,40 @@ function verticalizeItems(items) {
|
|
|
123
124
|
function createCompositeStore(props = {}) {
|
|
124
125
|
var _a;
|
|
125
126
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
126
|
-
const collection =
|
|
127
|
-
const activeId =
|
|
127
|
+
const collection = _FFY2GSOGcjs.createCollectionStore.call(void 0, props);
|
|
128
|
+
const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
128
129
|
props.activeId,
|
|
129
130
|
syncState == null ? void 0 : syncState.activeId,
|
|
130
131
|
props.defaultActiveId
|
|
131
132
|
);
|
|
132
|
-
const initialState =
|
|
133
|
+
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection.getState()), {
|
|
133
134
|
activeId,
|
|
134
|
-
baseElement:
|
|
135
|
-
includesBaseElement:
|
|
135
|
+
baseElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.baseElement, null),
|
|
136
|
+
includesBaseElement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
136
137
|
props.includesBaseElement,
|
|
137
138
|
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
138
139
|
activeId === null
|
|
139
140
|
),
|
|
140
|
-
moves:
|
|
141
|
-
orientation:
|
|
141
|
+
moves: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.moves, 0),
|
|
142
|
+
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
142
143
|
props.orientation,
|
|
143
144
|
syncState == null ? void 0 : syncState.orientation,
|
|
144
145
|
"both"
|
|
145
146
|
),
|
|
146
|
-
rtl:
|
|
147
|
-
virtualFocus:
|
|
147
|
+
rtl: _3UT5FE6Kcjs.defaultValue.call(void 0, props.rtl, syncState == null ? void 0 : syncState.rtl, false),
|
|
148
|
+
virtualFocus: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
148
149
|
props.virtualFocus,
|
|
149
150
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
150
151
|
false
|
|
151
152
|
),
|
|
152
|
-
focusLoop:
|
|
153
|
-
focusWrap:
|
|
154
|
-
focusShift:
|
|
153
|
+
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
|
|
154
|
+
focusWrap: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
155
|
+
focusShift: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
155
156
|
});
|
|
156
|
-
const composite =
|
|
157
|
-
|
|
157
|
+
const composite = _FJSZTIOUcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
158
|
+
_FJSZTIOUcjs.setup.call(void 0,
|
|
158
159
|
composite,
|
|
159
|
-
() =>
|
|
160
|
+
() => _FJSZTIOUcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
160
161
|
composite.setState("activeId", (activeId2) => {
|
|
161
162
|
var _a2;
|
|
162
163
|
if (activeId2 !== void 0)
|
|
@@ -170,7 +171,7 @@ function createCompositeStore(props = {}) {
|
|
|
170
171
|
const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
|
|
171
172
|
const isHorizontal = orientation !== "vertical";
|
|
172
173
|
const isRTL = rtl && isHorizontal;
|
|
173
|
-
const allItems = isRTL ?
|
|
174
|
+
const allItems = isRTL ? _ULSPM3Y3cjs.reverseArray.call(void 0, items) : items;
|
|
174
175
|
if (activeId2 == null) {
|
|
175
176
|
return (_a2 = findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
|
|
176
177
|
}
|
|
@@ -223,7 +224,7 @@ function createCompositeStore(props = {}) {
|
|
|
223
224
|
}
|
|
224
225
|
return nextItem == null ? void 0 : nextItem.id;
|
|
225
226
|
};
|
|
226
|
-
return
|
|
227
|
+
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), composite), {
|
|
227
228
|
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
228
229
|
setActiveId: (id) => composite.setState("activeId", id),
|
|
229
230
|
move: (id) => {
|
|
@@ -238,7 +239,7 @@ function createCompositeStore(props = {}) {
|
|
|
238
239
|
},
|
|
239
240
|
last: () => {
|
|
240
241
|
var _a2;
|
|
241
|
-
return (_a2 = findFirstEnabledItem(
|
|
242
|
+
return (_a2 = findFirstEnabledItem(_ULSPM3Y3cjs.reverseArray.call(void 0, composite.getState().renderedItems))) == null ? void 0 : _a2.id;
|
|
242
243
|
},
|
|
243
244
|
next: (skip) => {
|
|
244
245
|
const { renderedItems, orientation } = composite.getState();
|
|
@@ -250,7 +251,7 @@ function createCompositeStore(props = {}) {
|
|
|
250
251
|
const isGrid = !!((_a2 = findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
|
|
251
252
|
const hasNullItem = !isGrid && includesBaseElement;
|
|
252
253
|
return getNextId(
|
|
253
|
-
|
|
254
|
+
_ULSPM3Y3cjs.reverseArray.call(void 0, renderedItems),
|
|
254
255
|
orientation,
|
|
255
256
|
hasNullItem,
|
|
256
257
|
skip
|
|
@@ -266,7 +267,7 @@ function createCompositeStore(props = {}) {
|
|
|
266
267
|
} = composite.getState();
|
|
267
268
|
const shouldShift = focusShift && !skip;
|
|
268
269
|
const verticalItems = verticalizeItems(
|
|
269
|
-
|
|
270
|
+
_ULSPM3Y3cjs.flatten2DArray.call(void 0,
|
|
270
271
|
normalizeRows(groupItemsByRows(renderedItems), activeId2, shouldShift)
|
|
271
272
|
)
|
|
272
273
|
);
|
|
@@ -278,8 +279,8 @@ function createCompositeStore(props = {}) {
|
|
|
278
279
|
const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
|
|
279
280
|
const shouldShift = focusShift && !skip;
|
|
280
281
|
const verticalItems = verticalizeItems(
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
_ULSPM3Y3cjs.reverseArray.call(void 0,
|
|
283
|
+
_ULSPM3Y3cjs.flatten2DArray.call(void 0,
|
|
283
284
|
normalizeRows(
|
|
284
285
|
groupItemsByRows(renderedItems),
|
|
285
286
|
activeId2,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
2
3
|
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _AR2VJ37Fcjs = require('./AR2VJ37F.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
12
|
+
|
|
13
|
+
// src/menubar/menubar-store.ts
|
|
14
|
+
function createMenubarStore(props = {}) {
|
|
15
|
+
var _a;
|
|
16
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
17
|
+
return _AR2VJ37Fcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
18
|
+
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
19
|
+
props.orientation,
|
|
20
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
21
|
+
"horizontal"
|
|
22
|
+
),
|
|
23
|
+
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
exports.createMenubarStore = createMenubarStore;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -6,62 +6,63 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var _A4GDJCZBcjs = require('./A4GDJCZB.cjs');
|
|
10
9
|
|
|
10
|
+
var _FJSZTIOUcjs = require('./FJSZTIOU.cjs');
|
|
11
11
|
|
|
12
|
-
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
13
12
|
|
|
13
|
+
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
17
18
|
|
|
18
19
|
// src/disclosure/disclosure-store.ts
|
|
19
20
|
function createDisclosureStore(props = {}) {
|
|
20
|
-
const store =
|
|
21
|
+
const store = _FJSZTIOUcjs.mergeStore.call(void 0,
|
|
21
22
|
props.store,
|
|
22
|
-
|
|
23
|
+
_FJSZTIOUcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
23
24
|
);
|
|
24
|
-
|
|
25
|
+
_FJSZTIOUcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
25
26
|
const syncState = store == null ? void 0 : store.getState();
|
|
26
|
-
const open =
|
|
27
|
+
const open = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
27
28
|
props.open,
|
|
28
29
|
syncState == null ? void 0 : syncState.open,
|
|
29
30
|
props.defaultOpen,
|
|
30
31
|
false
|
|
31
32
|
);
|
|
32
|
-
const animated =
|
|
33
|
+
const animated = _3UT5FE6Kcjs.defaultValue.call(void 0, props.animated, syncState == null ? void 0 : syncState.animated, false);
|
|
33
34
|
const initialState = {
|
|
34
35
|
open,
|
|
35
36
|
animated,
|
|
36
37
|
animating: !!animated && open,
|
|
37
38
|
mounted: open,
|
|
38
|
-
contentElement:
|
|
39
|
-
disclosureElement:
|
|
39
|
+
contentElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
40
|
+
disclosureElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
40
41
|
};
|
|
41
|
-
const disclosure =
|
|
42
|
-
|
|
42
|
+
const disclosure = _FJSZTIOUcjs.createStore.call(void 0, initialState, store);
|
|
43
|
+
_FJSZTIOUcjs.setup.call(void 0,
|
|
43
44
|
disclosure,
|
|
44
|
-
() =>
|
|
45
|
+
() => _FJSZTIOUcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
45
46
|
if (state.animated)
|
|
46
47
|
return;
|
|
47
48
|
disclosure.setState("animating", false);
|
|
48
49
|
})
|
|
49
50
|
);
|
|
50
|
-
|
|
51
|
+
_FJSZTIOUcjs.setup.call(void 0,
|
|
51
52
|
disclosure,
|
|
52
|
-
() =>
|
|
53
|
+
() => _FJSZTIOUcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
53
54
|
if (!disclosure.getState().animated)
|
|
54
55
|
return;
|
|
55
56
|
disclosure.setState("animating", true);
|
|
56
57
|
})
|
|
57
58
|
);
|
|
58
|
-
|
|
59
|
+
_FJSZTIOUcjs.setup.call(void 0,
|
|
59
60
|
disclosure,
|
|
60
|
-
() =>
|
|
61
|
+
() => _FJSZTIOUcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
61
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
62
63
|
})
|
|
63
64
|
);
|
|
64
|
-
return
|
|
65
|
+
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, disclosure), {
|
|
65
66
|
setOpen: (value) => disclosure.setState("open", value),
|
|
66
67
|
show: () => disclosure.setState("open", true),
|
|
67
68
|
hide: () => disclosure.setState("open", false),
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _A4GDJCZBcjs = require('./A4GDJCZB.cjs');
|
|
7
6
|
|
|
7
|
+
var _FJSZTIOUcjs = require('./FJSZTIOU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
11
10
|
|
|
11
|
+
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
12
12
|
|
|
13
|
-
var _EXM2AW52cjs = require('./EXM2AW52.cjs');
|
|
14
13
|
|
|
14
|
+
var _FTB5CXVBcjs = require('./FTB5CXVB.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
18
19
|
|
|
19
20
|
// src/collection/collection-store.ts
|
|
20
21
|
function isElementPreceding(a, b) {
|
|
@@ -60,13 +61,13 @@ function getCommonParent(items) {
|
|
|
60
61
|
}
|
|
61
62
|
parentElement = parentElement.parentElement;
|
|
62
63
|
}
|
|
63
|
-
return
|
|
64
|
+
return _FTB5CXVBcjs.getDocument.call(void 0, parentElement).body;
|
|
64
65
|
}
|
|
65
66
|
function createCollectionStore(props = {}) {
|
|
66
67
|
var _a;
|
|
67
|
-
|
|
68
|
+
_FJSZTIOUcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
68
69
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
69
|
-
const items =
|
|
70
|
+
const items = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
70
71
|
props.items,
|
|
71
72
|
syncState == null ? void 0 : syncState.items,
|
|
72
73
|
props.defaultItems,
|
|
@@ -75,20 +76,20 @@ function createCollectionStore(props = {}) {
|
|
|
75
76
|
const itemsMap = new Map(items.map((item) => [item.id, item]));
|
|
76
77
|
const initialState = {
|
|
77
78
|
items,
|
|
78
|
-
renderedItems:
|
|
79
|
+
renderedItems: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
79
80
|
};
|
|
80
|
-
const privateStore =
|
|
81
|
+
const privateStore = _FJSZTIOUcjs.createStore.call(void 0, {
|
|
81
82
|
renderedItems: initialState.renderedItems
|
|
82
83
|
});
|
|
83
|
-
const collection =
|
|
84
|
+
const collection = _FJSZTIOUcjs.createStore.call(void 0, initialState, props.store);
|
|
84
85
|
const sortItems = () => {
|
|
85
86
|
const state = privateStore.getState();
|
|
86
87
|
const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
|
|
87
88
|
privateStore.setState("renderedItems", renderedItems);
|
|
88
89
|
collection.setState("renderedItems", renderedItems);
|
|
89
90
|
};
|
|
90
|
-
|
|
91
|
-
return
|
|
91
|
+
_FJSZTIOUcjs.setup.call(void 0, collection, () => {
|
|
92
|
+
return _FJSZTIOUcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
92
93
|
let firstRun = true;
|
|
93
94
|
let raf = requestAnimationFrame(sortItems);
|
|
94
95
|
if (typeof IntersectionObserver !== "function")
|
|
@@ -121,7 +122,7 @@ function createCollectionStore(props = {}) {
|
|
|
121
122
|
const nextItems = items2.slice();
|
|
122
123
|
if (index !== -1) {
|
|
123
124
|
prevItem = items2[index];
|
|
124
|
-
const nextItem =
|
|
125
|
+
const nextItem = _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, prevItem), item);
|
|
125
126
|
nextItems[index] = nextItem;
|
|
126
127
|
itemsMap.set(item.id, nextItem);
|
|
127
128
|
} else {
|
|
@@ -150,9 +151,9 @@ function createCollectionStore(props = {}) {
|
|
|
150
151
|
return unmergeItem;
|
|
151
152
|
};
|
|
152
153
|
const registerItem = (item) => mergeItem(item, (getItems) => collection.setState("items", getItems), true);
|
|
153
|
-
return
|
|
154
|
+
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, collection), {
|
|
154
155
|
registerItem,
|
|
155
|
-
renderItem: (item) =>
|
|
156
|
+
renderItem: (item) => _3UT5FE6Kcjs.chain.call(void 0,
|
|
156
157
|
registerItem(item),
|
|
157
158
|
mergeItem(
|
|
158
159
|
item,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
11
10
|
|
|
11
|
+
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
15
16
|
|
|
16
17
|
// src/utils/store.ts
|
|
17
18
|
function getInternal(store, key) {
|
|
18
19
|
const internals = store.__unstableInternals;
|
|
19
|
-
|
|
20
|
+
_3UT5FE6Kcjs.invariant.call(void 0, internals, "Invalid store");
|
|
20
21
|
return internals[key];
|
|
21
22
|
}
|
|
22
23
|
function createStore(initialState, ...stores) {
|
|
@@ -36,18 +37,18 @@ function createStore(initialState, ...stores) {
|
|
|
36
37
|
};
|
|
37
38
|
const storeInit = () => {
|
|
38
39
|
if (initialized)
|
|
39
|
-
return
|
|
40
|
+
return _3UT5FE6Kcjs.noop;
|
|
40
41
|
if (!stores.length)
|
|
41
|
-
return
|
|
42
|
+
return _3UT5FE6Kcjs.noop;
|
|
42
43
|
initialized = true;
|
|
43
|
-
const desyncs =
|
|
44
|
-
(key) =>
|
|
44
|
+
const desyncs = _3UT5FE6Kcjs.getKeys.call(void 0, state).map(
|
|
45
|
+
(key) => _3UT5FE6Kcjs.chain.call(void 0,
|
|
45
46
|
...stores.map((store) => {
|
|
46
47
|
var _a;
|
|
47
48
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
48
49
|
if (!storeState)
|
|
49
50
|
return;
|
|
50
|
-
if (!
|
|
51
|
+
if (!_3UT5FE6Kcjs.hasOwnProperty.call(void 0, storeState, key))
|
|
51
52
|
return;
|
|
52
53
|
return sync(
|
|
53
54
|
store,
|
|
@@ -66,7 +67,7 @@ function createStore(initialState, ...stores) {
|
|
|
66
67
|
const teardowns = [];
|
|
67
68
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
68
69
|
const cleanups = stores.map(init);
|
|
69
|
-
return
|
|
70
|
+
return _3UT5FE6Kcjs.chain.call(void 0, ...desyncs, ...teardowns, ...cleanups, () => {
|
|
70
71
|
initialized = false;
|
|
71
72
|
});
|
|
72
73
|
};
|
|
@@ -90,13 +91,13 @@ function createStore(initialState, ...stores) {
|
|
|
90
91
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
91
92
|
return sub(keys, listener, batchListeners);
|
|
92
93
|
};
|
|
93
|
-
const storePick = (keys) => createStore(
|
|
94
|
-
const storeOmit = (keys) => createStore(
|
|
94
|
+
const storePick = (keys) => createStore(_3UT5FE6Kcjs.pick.call(void 0, state, keys), finalStore);
|
|
95
|
+
const storeOmit = (keys) => createStore(_3UT5FE6Kcjs.omit.call(void 0, state, keys), finalStore);
|
|
95
96
|
const getState = () => state;
|
|
96
97
|
const setState = (key, value, fromStores = false) => {
|
|
97
|
-
if (!
|
|
98
|
+
if (!_3UT5FE6Kcjs.hasOwnProperty.call(void 0, state, key))
|
|
98
99
|
return;
|
|
99
|
-
const nextValue =
|
|
100
|
+
const nextValue = _3UT5FE6Kcjs.applyState.call(void 0, value, state[key]);
|
|
100
101
|
if (nextValue === state[key])
|
|
101
102
|
return;
|
|
102
103
|
if (!fromStores) {
|
|
@@ -106,7 +107,7 @@ function createStore(initialState, ...stores) {
|
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
const prevState = state;
|
|
109
|
-
state =
|
|
110
|
+
state = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, state), { [key]: nextValue });
|
|
110
111
|
const thisUpdate = Symbol();
|
|
111
112
|
lastUpdate = thisUpdate;
|
|
112
113
|
updatedKeys.add(key);
|
|
@@ -189,7 +190,7 @@ function mergeStore(...stores) {
|
|
|
189
190
|
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
|
|
190
191
|
if (!nextState)
|
|
191
192
|
return state;
|
|
192
|
-
return
|
|
193
|
+
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, state), nextState);
|
|
193
194
|
}, {});
|
|
194
195
|
const store = createStore(initialState, ...stores);
|
|
195
196
|
return store;
|
|
@@ -208,7 +209,7 @@ function throwOnConflictingProps(props, store) {
|
|
|
208
209
|
return;
|
|
209
210
|
const storeState = store.getState();
|
|
210
211
|
const conflictingProps = defaultKeys.filter(
|
|
211
|
-
(key) =>
|
|
212
|
+
(key) => _3UT5FE6Kcjs.hasOwnProperty.call(void 0, storeState, key)
|
|
212
213
|
);
|
|
213
214
|
if (!conflictingProps.length)
|
|
214
215
|
return;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
// src/utils/dom.ts
|
|
2
4
|
var canUseDOM = checkIsBrowser();
|
|
3
5
|
function checkIsBrowser() {
|
|
4
6
|
var _a;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _FTB5CXVBcjs = require('./FTB5CXVB.cjs');
|
|
4
5
|
|
|
5
6
|
// src/utils/platform.ts
|
|
6
7
|
function isTouchDevice() {
|
|
7
|
-
return
|
|
8
|
+
return _FTB5CXVBcjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
8
9
|
}
|
|
9
10
|
function isApple() {
|
|
10
|
-
if (!
|
|
11
|
+
if (!_FTB5CXVBcjs.canUseDOM)
|
|
11
12
|
return false;
|
|
12
13
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
13
14
|
}
|
|
14
15
|
function isSafari() {
|
|
15
|
-
return
|
|
16
|
+
return _FTB5CXVBcjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
16
17
|
}
|
|
17
18
|
function isFirefox() {
|
|
18
|
-
return
|
|
19
|
+
return _FTB5CXVBcjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
19
20
|
}
|
|
20
21
|
function isMac() {
|
|
21
|
-
return
|
|
22
|
+
return _FTB5CXVBcjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
|
-
var _DFFIYGBScjs = require('./DFFIYGBS.cjs');
|
|
4
3
|
|
|
4
|
+
var _MYTMMWXIcjs = require('./MYTMMWXI.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var _A4GDJCZBcjs = require('./A4GDJCZB.cjs');
|
|
10
9
|
|
|
10
|
+
var _FJSZTIOUcjs = require('./FJSZTIOU.cjs');
|
|
11
11
|
|
|
12
|
-
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
13
12
|
|
|
13
|
+
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
18
19
|
|
|
19
20
|
// src/popover/popover-store.ts
|
|
20
21
|
function createPopoverStore(_a = {}) {
|
|
21
22
|
var _b = _a, {
|
|
22
23
|
popover: otherPopover
|
|
23
|
-
} = _b, props =
|
|
24
|
+
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
24
25
|
"popover"
|
|
25
26
|
]);
|
|
26
|
-
const store =
|
|
27
|
+
const store = _FJSZTIOUcjs.mergeStore.call(void 0,
|
|
27
28
|
props.store,
|
|
28
|
-
|
|
29
|
+
_FJSZTIOUcjs.omit.call(void 0, otherPopover, [
|
|
29
30
|
"arrowElement",
|
|
30
31
|
"anchorElement",
|
|
31
32
|
"contentElement",
|
|
@@ -33,24 +34,24 @@ function createPopoverStore(_a = {}) {
|
|
|
33
34
|
"disclosureElement"
|
|
34
35
|
])
|
|
35
36
|
);
|
|
36
|
-
|
|
37
|
+
_FJSZTIOUcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
37
38
|
const syncState = store == null ? void 0 : store.getState();
|
|
38
|
-
const dialog =
|
|
39
|
-
const placement =
|
|
39
|
+
const dialog = _MYTMMWXIcjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
40
|
+
const placement = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
40
41
|
props.placement,
|
|
41
42
|
syncState == null ? void 0 : syncState.placement,
|
|
42
43
|
"bottom"
|
|
43
44
|
);
|
|
44
|
-
const initialState =
|
|
45
|
+
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog.getState()), {
|
|
45
46
|
placement,
|
|
46
47
|
currentPlacement: placement,
|
|
47
|
-
anchorElement:
|
|
48
|
-
popoverElement:
|
|
49
|
-
arrowElement:
|
|
48
|
+
anchorElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.anchorElement, null),
|
|
49
|
+
popoverElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.popoverElement, null),
|
|
50
|
+
arrowElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
50
51
|
rendered: Symbol("rendered")
|
|
51
52
|
});
|
|
52
|
-
const popover =
|
|
53
|
-
return
|
|
53
|
+
const popover = _FJSZTIOUcjs.createStore.call(void 0, initialState, dialog, store);
|
|
54
|
+
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
54
55
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
55
56
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
56
57
|
setArrowElement: (element) => popover.setState("arrowElement", element),
|