@embedreach/components 0.1.15 → 0.1.17
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/dist/chunks/B4MFY5CR.js +252 -478
- package/dist/chunks/index.js +1212 -1396
- package/dist/index.d.ts +185 -12
- package/dist/index.umd.js +153 -120
- package/package.json +3 -3
package/dist/chunks/B4MFY5CR.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
1
|
import { b as createContext, d as createSignal, o as onMount, e as createEffect, c as createMemo, a as createComponent, P as Portal, S as Show, t as template, i as insert, f as createRenderEffect, h as className, j as clearDelegatedEvents, k as delegateEvents, u as useContext, l as onCleanup, s as sortFns, m as mutationSortFns, n as on, p as setAttribute, q as getSidedProp, r as use, v as createUniqueId, w as batch, x as getQueryStatusLabel, y as getMutationStatusColor, z as getQueryStatusColor, A as getQueryStatusColorByLabel, B as displayValue, F as For, C as convertRemToPixels, D as untrack, $ as $TRACK, E as useTransition, G as spread, H as mergeProps, I as createRoot, J as serialize, K as Index, L as updateNestedDataByPath, M as addEventListener, N as stringify, O as Match, Q as Switch, R as deleteNestedDataByPath, T as splitProps, U as Dynamic, V as createComputed } from "./index.js";
|
|
5
2
|
var isNonNullable = (i2) => i2 != null;
|
|
6
3
|
var filterNonNullable = (arr) => arr.filter(isNonNullable);
|
|
@@ -49,14 +46,14 @@ function handleDiffArray(current, prev, handleAdded, handleRemoved) {
|
|
|
49
46
|
}
|
|
50
47
|
function createStorage(props) {
|
|
51
48
|
const [error, setError] = createSignal();
|
|
52
|
-
const handleError =
|
|
49
|
+
const handleError = props?.throw ? (err, fallback) => {
|
|
53
50
|
setError(err instanceof Error ? err : new Error(fallback));
|
|
54
51
|
throw err;
|
|
55
52
|
} : (err, fallback) => {
|
|
56
53
|
setError(err instanceof Error ? err : new Error(fallback));
|
|
57
54
|
};
|
|
58
|
-
const apis =
|
|
59
|
-
const prefix =
|
|
55
|
+
const apis = props?.api ? Array.isArray(props.api) ? props.api : [props.api] : [globalThis.localStorage].filter(Boolean);
|
|
56
|
+
const prefix = props?.prefix ? `${props.prefix}.` : "";
|
|
60
57
|
const signals = /* @__PURE__ */ new Map();
|
|
61
58
|
const store = new Proxy(
|
|
62
59
|
{},
|
|
@@ -82,7 +79,7 @@ function createStorage(props) {
|
|
|
82
79
|
},
|
|
83
80
|
null
|
|
84
81
|
);
|
|
85
|
-
if (value !== null &&
|
|
82
|
+
if (value !== null && props?.deserializer) {
|
|
86
83
|
return props.deserializer(value, key, props.options);
|
|
87
84
|
}
|
|
88
85
|
return value;
|
|
@@ -90,7 +87,7 @@ function createStorage(props) {
|
|
|
90
87
|
}
|
|
91
88
|
);
|
|
92
89
|
const setter = (key, value, options) => {
|
|
93
|
-
const filteredValue =
|
|
90
|
+
const filteredValue = props?.serializer ? props.serializer(value, key, options ?? props.options) : value;
|
|
94
91
|
const apiKey = `${prefix}${key}`;
|
|
95
92
|
apis.forEach((api) => {
|
|
96
93
|
try {
|
|
@@ -120,7 +117,7 @@ function createStorage(props) {
|
|
|
120
117
|
const result = {};
|
|
121
118
|
const addValue = (key, value) => {
|
|
122
119
|
if (!result.hasOwnProperty(key)) {
|
|
123
|
-
const filteredValue = value &&
|
|
120
|
+
const filteredValue = value && props?.deserializer ? props.deserializer(value, key, props.options) : value;
|
|
124
121
|
if (filteredValue) {
|
|
125
122
|
result[key] = filteredValue;
|
|
126
123
|
}
|
|
@@ -152,9 +149,8 @@ function createStorage(props) {
|
|
|
152
149
|
});
|
|
153
150
|
return result;
|
|
154
151
|
};
|
|
155
|
-
|
|
152
|
+
props?.sync !== false && onMount(() => {
|
|
156
153
|
const listener = (ev) => {
|
|
157
|
-
var _a;
|
|
158
154
|
let changed = false;
|
|
159
155
|
apis.forEach((api) => {
|
|
160
156
|
try {
|
|
@@ -169,20 +165,14 @@ function createStorage(props) {
|
|
|
169
165
|
);
|
|
170
166
|
}
|
|
171
167
|
});
|
|
172
|
-
changed && ev.key &&
|
|
168
|
+
changed && ev.key && signals.get(ev.key)?.[1]();
|
|
173
169
|
};
|
|
174
170
|
if ("addEventListener" in globalThis) {
|
|
175
171
|
globalThis.addEventListener("storage", listener);
|
|
176
172
|
onCleanup(() => globalThis.removeEventListener("storage", listener));
|
|
177
173
|
} else {
|
|
178
|
-
apis.forEach((api) =>
|
|
179
|
-
|
|
180
|
-
return (_a = api.addEventListener) == null ? void 0 : _a.call(api, "storage", listener);
|
|
181
|
-
});
|
|
182
|
-
onCleanup(() => apis.forEach((api) => {
|
|
183
|
-
var _a;
|
|
184
|
-
return (_a = api.removeEventListener) == null ? void 0 : _a.call(api, "storage", listener);
|
|
185
|
-
}));
|
|
174
|
+
apis.forEach((api) => api.addEventListener?.("storage", listener));
|
|
175
|
+
onCleanup(() => apis.forEach((api) => api.removeEventListener?.("storage", listener)));
|
|
186
176
|
}
|
|
187
177
|
});
|
|
188
178
|
return [
|
|
@@ -225,10 +215,7 @@ var serializeCookieOptions = (options) => {
|
|
|
225
215
|
};
|
|
226
216
|
var cookieStorage = addClearMethod({
|
|
227
217
|
_cookies: [globalThis.document, "cookie"],
|
|
228
|
-
getItem: (key) =>
|
|
229
|
-
var _a, _b;
|
|
230
|
-
return (_b = (_a = cookieStorage._cookies[0][cookieStorage._cookies[1]].match("(^|;)\\s*" + key + "\\s*=\\s*([^;]+)")) == null ? void 0 : _a.pop()) != null ? _b : null;
|
|
231
|
-
},
|
|
218
|
+
getItem: (key) => cookieStorage._cookies[0][cookieStorage._cookies[1]].match("(^|;)\\s*" + key + "\\s*=\\s*([^;]+)")?.pop() ?? null,
|
|
232
219
|
setItem: (key, value, options) => {
|
|
233
220
|
const oldValue = cookieStorage.getItem(key);
|
|
234
221
|
cookieStorage._cookies[0][cookieStorage._cookies[1]] = `${key}=${value}${serializeCookieOptions(
|
|
@@ -355,8 +342,7 @@ var PiPProvider = (props) => {
|
|
|
355
342
|
setPipWindow(pip);
|
|
356
343
|
};
|
|
357
344
|
createEffect(() => {
|
|
358
|
-
|
|
359
|
-
const pip_open = (_a = props.localStore.pip_open) != null ? _a : "false";
|
|
345
|
+
const pip_open = props.localStore.pip_open ?? "false";
|
|
360
346
|
if (pip_open === "true" && !props.disabled) {
|
|
361
347
|
requestPipWindow(Number(window.innerWidth), Number(props.localStore.height || PIP_DEFAULT_HEIGHT));
|
|
362
348
|
}
|
|
@@ -384,15 +370,12 @@ var PiPProvider = (props) => {
|
|
|
384
370
|
});
|
|
385
371
|
}
|
|
386
372
|
});
|
|
387
|
-
const value = createMemo(() => {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
disabled: (_a = props.disabled) != null ? _a : false
|
|
394
|
-
};
|
|
395
|
-
});
|
|
373
|
+
const value = createMemo(() => ({
|
|
374
|
+
pipWindow: pipWindow(),
|
|
375
|
+
requestPipWindow,
|
|
376
|
+
closePipWindow,
|
|
377
|
+
disabled: props.disabled ?? false
|
|
378
|
+
}));
|
|
396
379
|
return createComponent(PiPContext.Provider, {
|
|
397
380
|
value,
|
|
398
381
|
get children() {
|
|
@@ -1196,13 +1179,13 @@ function nextFrame(fn) {
|
|
|
1196
1179
|
}
|
|
1197
1180
|
function enterTransition(classes, events, el, done) {
|
|
1198
1181
|
const { onBeforeEnter, onEnter, onAfterEnter } = events;
|
|
1199
|
-
onBeforeEnter
|
|
1182
|
+
onBeforeEnter?.(el);
|
|
1200
1183
|
el.classList.add(...classes.enter);
|
|
1201
1184
|
el.classList.add(...classes.enterActive);
|
|
1202
1185
|
queueMicrotask(() => {
|
|
1203
1186
|
if (!el.parentNode)
|
|
1204
|
-
return done
|
|
1205
|
-
onEnter
|
|
1187
|
+
return done?.();
|
|
1188
|
+
onEnter?.(el, () => endTransition());
|
|
1206
1189
|
});
|
|
1207
1190
|
nextFrame(() => {
|
|
1208
1191
|
el.classList.remove(...classes.enter);
|
|
@@ -1218,18 +1201,18 @@ function enterTransition(classes, events, el, done) {
|
|
|
1218
1201
|
el.removeEventListener("animationend", endTransition);
|
|
1219
1202
|
el.classList.remove(...classes.enterActive);
|
|
1220
1203
|
el.classList.remove(...classes.enterTo);
|
|
1221
|
-
onAfterEnter
|
|
1204
|
+
onAfterEnter?.(el);
|
|
1222
1205
|
}
|
|
1223
1206
|
}
|
|
1224
1207
|
}
|
|
1225
1208
|
function exitTransition(classes, events, el, done) {
|
|
1226
1209
|
const { onBeforeExit, onExit, onAfterExit } = events;
|
|
1227
1210
|
if (!el.parentNode)
|
|
1228
|
-
return done
|
|
1229
|
-
onBeforeExit
|
|
1211
|
+
return done?.();
|
|
1212
|
+
onBeforeExit?.(el);
|
|
1230
1213
|
el.classList.add(...classes.exit);
|
|
1231
1214
|
el.classList.add(...classes.exitActive);
|
|
1232
|
-
onExit
|
|
1215
|
+
onExit?.(el, () => endTransition());
|
|
1233
1216
|
nextFrame(() => {
|
|
1234
1217
|
el.classList.remove(...classes.exit);
|
|
1235
1218
|
el.classList.add(...classes.exitTo);
|
|
@@ -1240,12 +1223,12 @@ function exitTransition(classes, events, el, done) {
|
|
|
1240
1223
|
});
|
|
1241
1224
|
function endTransition(e2) {
|
|
1242
1225
|
if (!e2 || e2.target === el) {
|
|
1243
|
-
done
|
|
1226
|
+
done?.();
|
|
1244
1227
|
el.removeEventListener("transitionend", endTransition);
|
|
1245
1228
|
el.removeEventListener("animationend", endTransition);
|
|
1246
1229
|
el.classList.remove(...classes.exitActive);
|
|
1247
1230
|
el.classList.remove(...classes.exitTo);
|
|
1248
|
-
onAfterExit
|
|
1231
|
+
onAfterExit?.(el);
|
|
1249
1232
|
}
|
|
1250
1233
|
}
|
|
1251
1234
|
}
|
|
@@ -1307,7 +1290,6 @@ function keyArray(items, keyFn, mapFn, options = {}) {
|
|
|
1307
1290
|
const list = items() || [];
|
|
1308
1291
|
list[$TRACK];
|
|
1309
1292
|
return untrack(() => {
|
|
1310
|
-
var _a, _b;
|
|
1311
1293
|
if (!list.length) {
|
|
1312
1294
|
dispose(prev.values());
|
|
1313
1295
|
prev.clear();
|
|
@@ -1322,7 +1304,7 @@ function keyArray(items, keyFn, mapFn, options = {}) {
|
|
|
1322
1304
|
const result = new Array(list.length);
|
|
1323
1305
|
const fb = prev.get(FALLBACK);
|
|
1324
1306
|
if (!prev.size || fb) {
|
|
1325
|
-
fb
|
|
1307
|
+
fb?.dispose();
|
|
1326
1308
|
prev.delete(FALLBACK);
|
|
1327
1309
|
for (let i2 = 0; i2 < list.length; i2++) {
|
|
1328
1310
|
const item = list[i2];
|
|
@@ -1339,13 +1321,13 @@ function keyArray(items, keyFn, mapFn, options = {}) {
|
|
|
1339
1321
|
const lookup = prev.get(key);
|
|
1340
1322
|
if (lookup) {
|
|
1341
1323
|
result[i2] = lookup.mapped;
|
|
1342
|
-
|
|
1324
|
+
lookup.setIndex?.(i2);
|
|
1343
1325
|
lookup.setItem(() => item);
|
|
1344
1326
|
} else
|
|
1345
1327
|
addNewItem(result, item, i2, key);
|
|
1346
1328
|
}
|
|
1347
1329
|
for (const key of prevKeys) {
|
|
1348
|
-
|
|
1330
|
+
prev.get(key)?.dispose();
|
|
1349
1331
|
prev.delete(key);
|
|
1350
1332
|
}
|
|
1351
1333
|
return result;
|
|
@@ -1470,7 +1452,7 @@ function contains(parent, child) {
|
|
|
1470
1452
|
}
|
|
1471
1453
|
function getActiveElement(node, activeDescendant = false) {
|
|
1472
1454
|
const { activeElement } = getDocument(node);
|
|
1473
|
-
if (!
|
|
1455
|
+
if (!activeElement?.nodeName) {
|
|
1474
1456
|
return null;
|
|
1475
1457
|
}
|
|
1476
1458
|
if (isFrame(activeElement) && activeElement.contentDocument) {
|
|
@@ -1512,10 +1494,9 @@ var EventKey = /* @__PURE__ */ ((EventKey2) => {
|
|
|
1512
1494
|
return EventKey2;
|
|
1513
1495
|
})(EventKey || {});
|
|
1514
1496
|
function testPlatform(re) {
|
|
1515
|
-
var _a;
|
|
1516
1497
|
return typeof window !== "undefined" && window.navigator != null ? (
|
|
1517
1498
|
// @ts-ignore
|
|
1518
|
-
re.test(
|
|
1499
|
+
re.test(window.navigator["userAgentData"]?.platform || window.navigator.platform)
|
|
1519
1500
|
) : false;
|
|
1520
1501
|
}
|
|
1521
1502
|
function isMac() {
|
|
@@ -1542,7 +1523,7 @@ function callHandler(event, handler) {
|
|
|
1542
1523
|
handler[0](handler[1], event);
|
|
1543
1524
|
}
|
|
1544
1525
|
}
|
|
1545
|
-
return event
|
|
1526
|
+
return event?.defaultPrevented;
|
|
1546
1527
|
}
|
|
1547
1528
|
function composeEventHandlers(handlers) {
|
|
1548
1529
|
return (event) => {
|
|
@@ -1683,20 +1664,19 @@ function isAttributeVisible(element, childElement) {
|
|
|
1683
1664
|
return !element.hasAttribute("hidden") && (element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element.hasAttribute("open") : true);
|
|
1684
1665
|
}
|
|
1685
1666
|
function getFocusableTreeWalker(root, opts, scope) {
|
|
1686
|
-
const selector =
|
|
1667
|
+
const selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;
|
|
1687
1668
|
const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
1688
1669
|
acceptNode(node) {
|
|
1689
|
-
|
|
1690
|
-
if ((_a = opts == null ? void 0 : opts.from) == null ? void 0 : _a.contains(node)) {
|
|
1670
|
+
if (opts?.from?.contains(node)) {
|
|
1691
1671
|
return NodeFilter.FILTER_REJECT;
|
|
1692
1672
|
}
|
|
1693
|
-
if (node.matches(selector) && isElementVisible(node) && true && (!
|
|
1673
|
+
if (node.matches(selector) && isElementVisible(node) && true && (!opts?.accept || opts.accept(node))) {
|
|
1694
1674
|
return NodeFilter.FILTER_ACCEPT;
|
|
1695
1675
|
}
|
|
1696
1676
|
return NodeFilter.FILTER_SKIP;
|
|
1697
1677
|
}
|
|
1698
1678
|
});
|
|
1699
|
-
if (opts
|
|
1679
|
+
if (opts?.from) {
|
|
1700
1680
|
walker.currentNode = opts.from;
|
|
1701
1681
|
}
|
|
1702
1682
|
return walker;
|
|
@@ -1846,16 +1826,15 @@ function relativeOffset(ancestor, child, axis) {
|
|
|
1846
1826
|
return sum;
|
|
1847
1827
|
}
|
|
1848
1828
|
function scrollIntoViewport(targetElement, opts) {
|
|
1849
|
-
var _a, _b;
|
|
1850
1829
|
if (document.contains(targetElement)) {
|
|
1851
1830
|
const root = document.scrollingElement || document.documentElement;
|
|
1852
1831
|
const isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
|
|
1853
1832
|
if (!isScrollPrevented) {
|
|
1854
1833
|
const { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
1855
|
-
|
|
1834
|
+
targetElement?.scrollIntoView?.({ block: "nearest" });
|
|
1856
1835
|
const { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
1857
1836
|
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
1858
|
-
|
|
1837
|
+
targetElement.scrollIntoView?.({ block: "nearest" });
|
|
1859
1838
|
}
|
|
1860
1839
|
} else {
|
|
1861
1840
|
let scrollParent = getScrollParent(targetElement);
|
|
@@ -1886,10 +1865,9 @@ function createRegisterId(setter) {
|
|
|
1886
1865
|
};
|
|
1887
1866
|
}
|
|
1888
1867
|
function createTagName(ref, fallback) {
|
|
1889
|
-
const [tagName, setTagName] = createSignal(stringOrUndefined(fallback
|
|
1868
|
+
const [tagName, setTagName] = createSignal(stringOrUndefined(fallback?.()));
|
|
1890
1869
|
createEffect(() => {
|
|
1891
|
-
|
|
1892
|
-
setTagName(((_a = ref()) == null ? void 0 : _a.tagName.toLowerCase()) || stringOrUndefined(fallback == null ? void 0 : fallback()));
|
|
1870
|
+
setTagName(ref()?.tagName.toLowerCase() || stringOrUndefined(fallback?.()));
|
|
1893
1871
|
});
|
|
1894
1872
|
return tagName;
|
|
1895
1873
|
}
|
|
@@ -1946,10 +1924,7 @@ function createFormControl(props) {
|
|
|
1946
1924
|
"data-readonly": access(mergedProps.readOnly) ? "" : void 0
|
|
1947
1925
|
}));
|
|
1948
1926
|
const formControlContext = {
|
|
1949
|
-
name: () =>
|
|
1950
|
-
var _a;
|
|
1951
|
-
return (_a = access(mergedProps.name)) != null ? _a : access(mergedProps.id);
|
|
1952
|
-
},
|
|
1927
|
+
name: () => access(mergedProps.name) ?? access(mergedProps.id),
|
|
1953
1928
|
dataset,
|
|
1954
1929
|
validationState: () => access(mergedProps.validationState),
|
|
1955
1930
|
isRequired: () => access(mergedProps.required),
|
|
@@ -2057,25 +2032,17 @@ function isFormElement(element) {
|
|
|
2057
2032
|
return element.matches("textarea, input, select, button");
|
|
2058
2033
|
}
|
|
2059
2034
|
function createControllableSignal(props) {
|
|
2060
|
-
|
|
2061
|
-
const
|
|
2062
|
-
const
|
|
2063
|
-
var _a2;
|
|
2064
|
-
return ((_a2 = props.value) == null ? void 0 : _a2.call(props)) !== void 0;
|
|
2065
|
-
});
|
|
2066
|
-
const value = createMemo(() => {
|
|
2067
|
-
var _a2;
|
|
2068
|
-
return isControlled() ? (_a2 = props.value) == null ? void 0 : _a2.call(props) : _value();
|
|
2069
|
-
});
|
|
2035
|
+
const [_value, _setValue] = createSignal(props.defaultValue?.());
|
|
2036
|
+
const isControlled = createMemo(() => props.value?.() !== void 0);
|
|
2037
|
+
const value = createMemo(() => isControlled() ? props.value?.() : _value());
|
|
2070
2038
|
const setValue = (next) => {
|
|
2071
2039
|
untrack(() => {
|
|
2072
|
-
var _a2;
|
|
2073
2040
|
const nextValue = accessWith(next, value());
|
|
2074
2041
|
if (!Object.is(nextValue, value())) {
|
|
2075
2042
|
if (!isControlled()) {
|
|
2076
2043
|
_setValue(nextValue);
|
|
2077
2044
|
}
|
|
2078
|
-
|
|
2045
|
+
props.onChange?.(nextValue);
|
|
2079
2046
|
}
|
|
2080
2047
|
return nextValue;
|
|
2081
2048
|
});
|
|
@@ -2084,28 +2051,19 @@ function createControllableSignal(props) {
|
|
|
2084
2051
|
}
|
|
2085
2052
|
function createControllableBooleanSignal(props) {
|
|
2086
2053
|
const [_value, setValue] = createControllableSignal(props);
|
|
2087
|
-
const value = () =>
|
|
2088
|
-
var _a;
|
|
2089
|
-
return (_a = _value()) != null ? _a : false;
|
|
2090
|
-
};
|
|
2054
|
+
const value = () => _value() ?? false;
|
|
2091
2055
|
return [value, setValue];
|
|
2092
2056
|
}
|
|
2093
2057
|
function createControllableArraySignal(props) {
|
|
2094
2058
|
const [_value, setValue] = createControllableSignal(props);
|
|
2095
|
-
const value = () =>
|
|
2096
|
-
var _a;
|
|
2097
|
-
return (_a = _value()) != null ? _a : [];
|
|
2098
|
-
};
|
|
2059
|
+
const value = () => _value() ?? [];
|
|
2099
2060
|
return [value, setValue];
|
|
2100
2061
|
}
|
|
2101
2062
|
function createToggleState(props = {}) {
|
|
2102
2063
|
const [isSelected, _setIsSelected] = createControllableBooleanSignal({
|
|
2103
2064
|
value: () => access(props.isSelected),
|
|
2104
2065
|
defaultValue: () => !!access(props.defaultIsSelected),
|
|
2105
|
-
onChange: (value) =>
|
|
2106
|
-
var _a;
|
|
2107
|
-
return (_a = props.onSelectedChange) == null ? void 0 : _a.call(props, value);
|
|
2108
|
-
}
|
|
2066
|
+
onChange: (value) => props.onSelectedChange?.(value)
|
|
2109
2067
|
});
|
|
2110
2068
|
const setIsSelected = (value) => {
|
|
2111
2069
|
if (!access(props.isReadOnly) && !access(props.isDisabled)) {
|
|
@@ -2123,10 +2081,10 @@ function createToggleState(props = {}) {
|
|
|
2123
2081
|
toggle
|
|
2124
2082
|
};
|
|
2125
2083
|
}
|
|
2126
|
-
var
|
|
2084
|
+
var __defProp = Object.defineProperty;
|
|
2127
2085
|
var __export = (target, all) => {
|
|
2128
2086
|
for (var name in all)
|
|
2129
|
-
|
|
2087
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2130
2088
|
};
|
|
2131
2089
|
var DomCollectionContext = createContext();
|
|
2132
2090
|
function useOptionalDomCollectionContext() {
|
|
@@ -2147,7 +2105,6 @@ function isElementPreceding(a2, b2) {
|
|
|
2147
2105
|
);
|
|
2148
2106
|
}
|
|
2149
2107
|
function findDOMIndex(items, item) {
|
|
2150
|
-
var _a;
|
|
2151
2108
|
const itemEl = item.ref();
|
|
2152
2109
|
if (!itemEl) {
|
|
2153
2110
|
return -1;
|
|
@@ -2157,7 +2114,7 @@ function findDOMIndex(items, item) {
|
|
|
2157
2114
|
return -1;
|
|
2158
2115
|
}
|
|
2159
2116
|
while (length--) {
|
|
2160
|
-
const currentItemEl =
|
|
2117
|
+
const currentItemEl = items[length]?.ref();
|
|
2161
2118
|
if (!currentItemEl) {
|
|
2162
2119
|
continue;
|
|
2163
2120
|
}
|
|
@@ -2202,10 +2159,9 @@ function setItemsBasedOnDOMPosition(items, setItems) {
|
|
|
2202
2159
|
}
|
|
2203
2160
|
}
|
|
2204
2161
|
function getCommonParent(items) {
|
|
2205
|
-
var _a, _b;
|
|
2206
2162
|
const firstItem = items[0];
|
|
2207
|
-
const lastItemEl =
|
|
2208
|
-
let parentEl =
|
|
2163
|
+
const lastItemEl = items[items.length - 1]?.ref();
|
|
2164
|
+
let parentEl = firstItem?.ref()?.parentElement;
|
|
2209
2165
|
while (parentEl) {
|
|
2210
2166
|
if (lastItemEl && parentEl.contains(lastItemEl)) {
|
|
2211
2167
|
return parentEl;
|
|
@@ -2251,10 +2207,7 @@ function createSortBasedOnDOMPosition(items, setItems) {
|
|
|
2251
2207
|
function createDomCollection(props = {}) {
|
|
2252
2208
|
const [items, setItems] = createControllableArraySignal({
|
|
2253
2209
|
value: () => access(props.items),
|
|
2254
|
-
onChange: (value) =>
|
|
2255
|
-
var _a;
|
|
2256
|
-
return (_a = props.onItemsChange) == null ? void 0 : _a.call(props, value);
|
|
2257
|
-
}
|
|
2210
|
+
onChange: (value) => props.onItemsChange?.(value)
|
|
2258
2211
|
});
|
|
2259
2212
|
createSortBasedOnDOMPosition(items, setItems);
|
|
2260
2213
|
const registerItem = (item) => {
|
|
@@ -2296,45 +2249,40 @@ function createDomCollectionItem(props) {
|
|
|
2296
2249
|
});
|
|
2297
2250
|
}
|
|
2298
2251
|
function buildNodes(params) {
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
const level = (_b = params.startLevel) != null ? _b : 0;
|
|
2252
|
+
let index = params.startIndex ?? 0;
|
|
2253
|
+
const level = params.startLevel ?? 0;
|
|
2302
2254
|
const nodes = [];
|
|
2303
2255
|
const getKey = (data) => {
|
|
2304
|
-
var _a2;
|
|
2305
2256
|
if (data == null) {
|
|
2306
2257
|
return "";
|
|
2307
2258
|
}
|
|
2308
|
-
const _getKey =
|
|
2259
|
+
const _getKey = params.getKey ?? "key";
|
|
2309
2260
|
const dataKey = isString(_getKey) ? data[_getKey] : _getKey(data);
|
|
2310
2261
|
return dataKey != null ? String(dataKey) : "";
|
|
2311
2262
|
};
|
|
2312
2263
|
const getTextValue = (data) => {
|
|
2313
|
-
var _a2;
|
|
2314
2264
|
if (data == null) {
|
|
2315
2265
|
return "";
|
|
2316
2266
|
}
|
|
2317
|
-
const _getTextValue =
|
|
2267
|
+
const _getTextValue = params.getTextValue ?? "textValue";
|
|
2318
2268
|
const dataTextValue = isString(_getTextValue) ? data[_getTextValue] : _getTextValue(data);
|
|
2319
2269
|
return dataTextValue != null ? String(dataTextValue) : "";
|
|
2320
2270
|
};
|
|
2321
2271
|
const getDisabled = (data) => {
|
|
2322
|
-
var _a2, _b2;
|
|
2323
2272
|
if (data == null) {
|
|
2324
2273
|
return false;
|
|
2325
2274
|
}
|
|
2326
|
-
const _getDisabled =
|
|
2327
|
-
return (
|
|
2275
|
+
const _getDisabled = params.getDisabled ?? "disabled";
|
|
2276
|
+
return (isString(_getDisabled) ? data[_getDisabled] : _getDisabled(data)) ?? false;
|
|
2328
2277
|
};
|
|
2329
2278
|
const getSectionChildren = (data) => {
|
|
2330
|
-
var _a2;
|
|
2331
2279
|
if (data == null) {
|
|
2332
2280
|
return void 0;
|
|
2333
2281
|
}
|
|
2334
2282
|
if (isString(params.getSectionChildren)) {
|
|
2335
2283
|
return data[params.getSectionChildren];
|
|
2336
2284
|
}
|
|
2337
|
-
return
|
|
2285
|
+
return params.getSectionChildren?.(data);
|
|
2338
2286
|
};
|
|
2339
2287
|
for (const data of params.dataSource) {
|
|
2340
2288
|
if (isString(data) || isNumber(data)) {
|
|
@@ -2364,7 +2312,7 @@ function buildNodes(params) {
|
|
|
2364
2312
|
index
|
|
2365
2313
|
});
|
|
2366
2314
|
index++;
|
|
2367
|
-
const sectionChildren =
|
|
2315
|
+
const sectionChildren = getSectionChildren(data) ?? [];
|
|
2368
2316
|
if (sectionChildren.length > 0) {
|
|
2369
2317
|
const childNodes = buildNodes({
|
|
2370
2318
|
dataSource: sectionChildren,
|
|
@@ -2443,9 +2391,8 @@ var RTL_LANGS = /* @__PURE__ */ new Set([
|
|
|
2443
2391
|
"yi"
|
|
2444
2392
|
]);
|
|
2445
2393
|
function isRTL(locale) {
|
|
2446
|
-
var _a;
|
|
2447
2394
|
if (Intl.Locale) {
|
|
2448
|
-
const script =
|
|
2395
|
+
const script = new Intl.Locale(locale).maximize().script ?? "";
|
|
2449
2396
|
return RTL_SCRIPTS.has(script);
|
|
2450
2397
|
}
|
|
2451
2398
|
const lang = locale.split("-")[0];
|
|
@@ -2518,10 +2465,10 @@ function createCollator(options) {
|
|
|
2518
2465
|
});
|
|
2519
2466
|
}
|
|
2520
2467
|
var Selection = class _Selection extends Set {
|
|
2468
|
+
anchorKey;
|
|
2469
|
+
currentKey;
|
|
2521
2470
|
constructor(keys2, anchorKey, currentKey) {
|
|
2522
2471
|
super(keys2);
|
|
2523
|
-
__publicField(this, "anchorKey");
|
|
2524
|
-
__publicField(this, "currentKey");
|
|
2525
2472
|
if (keys2 instanceof _Selection) {
|
|
2526
2473
|
this.anchorKey = anchorKey || keys2.anchorKey;
|
|
2527
2474
|
this.currentKey = currentKey || keys2.currentKey;
|
|
@@ -2533,10 +2480,7 @@ var Selection = class _Selection extends Set {
|
|
|
2533
2480
|
};
|
|
2534
2481
|
function createControllableSelectionSignal(props) {
|
|
2535
2482
|
const [_value, setValue] = createControllableSignal(props);
|
|
2536
|
-
const value = () =>
|
|
2537
|
-
var _a;
|
|
2538
|
-
return (_a = _value()) != null ? _a : new Selection();
|
|
2539
|
-
};
|
|
2483
|
+
const value = () => _value() ?? new Selection();
|
|
2540
2484
|
return [value, setValue];
|
|
2541
2485
|
}
|
|
2542
2486
|
function isNonContiguousSelectionModifier(e2) {
|
|
@@ -2589,17 +2533,11 @@ function createMultipleSelectionState(props) {
|
|
|
2589
2533
|
const [selectedKeys, _setSelectedKeys] = createControllableSelectionSignal({
|
|
2590
2534
|
value: selectedKeysProp,
|
|
2591
2535
|
defaultValue: defaultSelectedKeys,
|
|
2592
|
-
onChange: (value) =>
|
|
2593
|
-
var _a;
|
|
2594
|
-
return (_a = mergedProps.onSelectionChange) == null ? void 0 : _a.call(mergedProps, value);
|
|
2595
|
-
}
|
|
2536
|
+
onChange: (value) => mergedProps.onSelectionChange?.(value)
|
|
2596
2537
|
});
|
|
2597
2538
|
const [selectionBehavior, setSelectionBehavior] = createSignal(access(mergedProps.selectionBehavior));
|
|
2598
2539
|
const selectionMode = () => access(mergedProps.selectionMode);
|
|
2599
|
-
const disallowEmptySelection = () =>
|
|
2600
|
-
var _a;
|
|
2601
|
-
return (_a = access(mergedProps.disallowEmptySelection)) != null ? _a : false;
|
|
2602
|
-
};
|
|
2540
|
+
const disallowEmptySelection = () => access(mergedProps.disallowEmptySelection) ?? false;
|
|
2603
2541
|
const setSelectedKeys = (keys2) => {
|
|
2604
2542
|
if (access(mergedProps.allowDuplicateSelectionEvents) || !isSameSelection(keys2, selectedKeys())) {
|
|
2605
2543
|
_setSelectedKeys(keys2);
|
|
@@ -2612,8 +2550,7 @@ function createMultipleSelectionState(props) {
|
|
|
2612
2550
|
}
|
|
2613
2551
|
});
|
|
2614
2552
|
createEffect(() => {
|
|
2615
|
-
|
|
2616
|
-
setSelectionBehavior((_a = access(mergedProps.selectionBehavior)) != null ? _a : "toggle");
|
|
2553
|
+
setSelectionBehavior(access(mergedProps.selectionBehavior) ?? "toggle");
|
|
2617
2554
|
});
|
|
2618
2555
|
return {
|
|
2619
2556
|
selectionMode,
|
|
@@ -2632,7 +2569,6 @@ function createTypeSelect(props) {
|
|
|
2632
2569
|
const [search, setSearch] = createSignal("");
|
|
2633
2570
|
const [timeoutId, setTimeoutId] = createSignal(-1);
|
|
2634
2571
|
const onKeyDown = (e2) => {
|
|
2635
|
-
var _a, _b, _c;
|
|
2636
2572
|
if (access(props.isDisabled)) {
|
|
2637
2573
|
return;
|
|
2638
2574
|
}
|
|
@@ -2650,14 +2586,14 @@ function createTypeSelect(props) {
|
|
|
2650
2586
|
e2.stopPropagation();
|
|
2651
2587
|
}
|
|
2652
2588
|
let newSearch = setSearch((prev) => prev + character);
|
|
2653
|
-
let key =
|
|
2589
|
+
let key = delegate.getKeyForSearch(newSearch, manager.focusedKey()) ?? delegate.getKeyForSearch(newSearch);
|
|
2654
2590
|
if (key == null && isAllSameLetter(newSearch)) {
|
|
2655
2591
|
newSearch = newSearch[0];
|
|
2656
|
-
key =
|
|
2592
|
+
key = delegate.getKeyForSearch(newSearch, manager.focusedKey()) ?? delegate.getKeyForSearch(newSearch);
|
|
2657
2593
|
}
|
|
2658
2594
|
if (key != null) {
|
|
2659
2595
|
manager.setFocusedKey(key);
|
|
2660
|
-
|
|
2596
|
+
props.onTypeSelect?.(key);
|
|
2661
2597
|
}
|
|
2662
2598
|
clearTimeout(timeoutId());
|
|
2663
2599
|
setTimeoutId(window.setTimeout(() => setSearch(""), 500));
|
|
@@ -2704,18 +2640,14 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2704
2640
|
keyboardDelegate: () => access(mergedProps.keyboardDelegate),
|
|
2705
2641
|
selectionManager: () => access(mergedProps.selectionManager)
|
|
2706
2642
|
});
|
|
2707
|
-
const orientation = () =>
|
|
2708
|
-
var _a;
|
|
2709
|
-
return (_a = access(mergedProps.orientation)) != null ? _a : "vertical";
|
|
2710
|
-
};
|
|
2643
|
+
const orientation = () => access(mergedProps.orientation) ?? "vertical";
|
|
2711
2644
|
const onKeyDown = (e2) => {
|
|
2712
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2713
2645
|
callHandler(e2, typeSelectHandlers.onKeyDown);
|
|
2714
2646
|
if (e2.altKey && e2.key === "Tab") {
|
|
2715
2647
|
e2.preventDefault();
|
|
2716
2648
|
}
|
|
2717
2649
|
const refEl = ref();
|
|
2718
|
-
if (!
|
|
2650
|
+
if (!refEl?.contains(e2.target)) {
|
|
2719
2651
|
return;
|
|
2720
2652
|
}
|
|
2721
2653
|
const manager = access(mergedProps.selectionManager);
|
|
@@ -2741,10 +2673,10 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2741
2673
|
if (focusedKey != null) {
|
|
2742
2674
|
nextKey = delegate.getKeyBelow(focusedKey);
|
|
2743
2675
|
} else {
|
|
2744
|
-
nextKey =
|
|
2676
|
+
nextKey = delegate.getFirstKey?.();
|
|
2745
2677
|
}
|
|
2746
2678
|
if (nextKey == null && shouldFocusWrap) {
|
|
2747
|
-
nextKey =
|
|
2679
|
+
nextKey = delegate.getFirstKey?.(focusedKey);
|
|
2748
2680
|
}
|
|
2749
2681
|
navigateToKey(nextKey);
|
|
2750
2682
|
}
|
|
@@ -2757,10 +2689,10 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2757
2689
|
if (focusedKey != null) {
|
|
2758
2690
|
nextKey = delegate.getKeyAbove(focusedKey);
|
|
2759
2691
|
} else {
|
|
2760
|
-
nextKey =
|
|
2692
|
+
nextKey = delegate.getLastKey?.();
|
|
2761
2693
|
}
|
|
2762
2694
|
if (nextKey == null && shouldFocusWrap) {
|
|
2763
|
-
nextKey =
|
|
2695
|
+
nextKey = delegate.getLastKey?.(focusedKey);
|
|
2764
2696
|
}
|
|
2765
2697
|
navigateToKey(nextKey);
|
|
2766
2698
|
}
|
|
@@ -2774,7 +2706,7 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2774
2706
|
if (focusedKey != null) {
|
|
2775
2707
|
nextKey = delegate.getKeyLeftOf(focusedKey);
|
|
2776
2708
|
} else {
|
|
2777
|
-
nextKey = isRTL3 ?
|
|
2709
|
+
nextKey = isRTL3 ? delegate.getFirstKey?.() : delegate.getLastKey?.();
|
|
2778
2710
|
}
|
|
2779
2711
|
navigateToKey(nextKey);
|
|
2780
2712
|
}
|
|
@@ -2788,7 +2720,7 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2788
2720
|
if (focusedKey != null) {
|
|
2789
2721
|
nextKey = delegate.getKeyRightOf(focusedKey);
|
|
2790
2722
|
} else {
|
|
2791
|
-
nextKey = isRTL3 ?
|
|
2723
|
+
nextKey = isRTL3 ? delegate.getLastKey?.() : delegate.getFirstKey?.();
|
|
2792
2724
|
}
|
|
2793
2725
|
navigateToKey(nextKey);
|
|
2794
2726
|
}
|
|
@@ -2877,7 +2809,6 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2877
2809
|
}
|
|
2878
2810
|
};
|
|
2879
2811
|
const onFocusIn = (e2) => {
|
|
2880
|
-
var _a, _b, _c, _d;
|
|
2881
2812
|
const manager = access(mergedProps.selectionManager);
|
|
2882
2813
|
const delegate = access(mergedProps.keyboardDelegate);
|
|
2883
2814
|
const selectOnFocus = access(mergedProps.selectOnFocus);
|
|
@@ -2904,11 +2835,11 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2904
2835
|
const relatedTarget = e2.relatedTarget;
|
|
2905
2836
|
if (relatedTarget && e2.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
2906
2837
|
navigateToFirstKey(
|
|
2907
|
-
|
|
2838
|
+
manager.lastSelectedKey() ?? delegate.getLastKey?.()
|
|
2908
2839
|
);
|
|
2909
2840
|
} else {
|
|
2910
2841
|
navigateToFirstKey(
|
|
2911
|
-
|
|
2842
|
+
manager.firstSelectedKey() ?? delegate.getFirstKey?.()
|
|
2912
2843
|
);
|
|
2913
2844
|
}
|
|
2914
2845
|
} else if (!access(mergedProps.isVirtualized)) {
|
|
@@ -2938,7 +2869,6 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2938
2869
|
}
|
|
2939
2870
|
};
|
|
2940
2871
|
const tryAutoFocus = () => {
|
|
2941
|
-
var _a, _b;
|
|
2942
2872
|
const autoFocus = access(mergedProps.autoFocus);
|
|
2943
2873
|
if (!autoFocus) {
|
|
2944
2874
|
return;
|
|
@@ -2947,10 +2877,10 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2947
2877
|
const delegate = access(mergedProps.keyboardDelegate);
|
|
2948
2878
|
let focusedKey;
|
|
2949
2879
|
if (autoFocus === "first") {
|
|
2950
|
-
focusedKey =
|
|
2880
|
+
focusedKey = delegate.getFirstKey?.();
|
|
2951
2881
|
}
|
|
2952
2882
|
if (autoFocus === "last") {
|
|
2953
|
-
focusedKey =
|
|
2883
|
+
focusedKey = delegate.getLastKey?.();
|
|
2954
2884
|
}
|
|
2955
2885
|
const selectedKeys = manager.selectedKeys();
|
|
2956
2886
|
if (selectedKeys.size) {
|
|
@@ -2978,10 +2908,9 @@ function createSelectableCollection(props, ref, scrollRef) {
|
|
|
2978
2908
|
() => access(mergedProps.selectionManager).focusedKey()
|
|
2979
2909
|
],
|
|
2980
2910
|
(newValue) => {
|
|
2981
|
-
var _a;
|
|
2982
2911
|
const [scrollEl, isVirtualized, focusedKey] = newValue;
|
|
2983
2912
|
if (isVirtualized) {
|
|
2984
|
-
focusedKey &&
|
|
2913
|
+
focusedKey && mergedProps.scrollToKey?.(focusedKey);
|
|
2985
2914
|
} else {
|
|
2986
2915
|
if (focusedKey && scrollEl) {
|
|
2987
2916
|
const element = scrollEl.querySelector(
|
|
@@ -3023,7 +2952,7 @@ function createSelectableItem(props, ref) {
|
|
|
3023
2952
|
} else {
|
|
3024
2953
|
manager().replaceSelection(key());
|
|
3025
2954
|
}
|
|
3026
|
-
} else if (e2
|
|
2955
|
+
} else if (e2?.shiftKey) {
|
|
3027
2956
|
manager().extendSelection(key());
|
|
3028
2957
|
} else if (manager().selectionBehavior() === "toggle" || isCtrlKeyPressed(e2) || "pointerType" in e2 && e2.pointerType === "touch") {
|
|
3029
2958
|
manager().toggleSelection(key());
|
|
@@ -3128,9 +3057,9 @@ function createSelectableItem(props, ref) {
|
|
|
3128
3057
|
};
|
|
3129
3058
|
}
|
|
3130
3059
|
var SelectionManager = class {
|
|
3060
|
+
collection;
|
|
3061
|
+
state;
|
|
3131
3062
|
constructor(collection, state) {
|
|
3132
|
-
__publicField(this, "collection");
|
|
3133
|
-
__publicField(this, "state");
|
|
3134
3063
|
this.collection = collection;
|
|
3135
3064
|
this.state = state;
|
|
3136
3065
|
}
|
|
@@ -3199,23 +3128,23 @@ var SelectionManager = class {
|
|
|
3199
3128
|
let first;
|
|
3200
3129
|
for (const key of this.state.selectedKeys()) {
|
|
3201
3130
|
const item = this.collection().getItem(key);
|
|
3202
|
-
const isItemBeforeFirst =
|
|
3131
|
+
const isItemBeforeFirst = item?.index != null && first?.index != null && item.index < first.index;
|
|
3203
3132
|
if (!first || isItemBeforeFirst) {
|
|
3204
3133
|
first = item;
|
|
3205
3134
|
}
|
|
3206
3135
|
}
|
|
3207
|
-
return first
|
|
3136
|
+
return first?.key;
|
|
3208
3137
|
}
|
|
3209
3138
|
lastSelectedKey() {
|
|
3210
3139
|
let last;
|
|
3211
3140
|
for (const key of this.state.selectedKeys()) {
|
|
3212
3141
|
const item = this.collection().getItem(key);
|
|
3213
|
-
const isItemAfterLast =
|
|
3142
|
+
const isItemAfterLast = item?.index != null && last?.index != null && item.index > last.index;
|
|
3214
3143
|
if (!last || isItemAfterLast) {
|
|
3215
3144
|
last = item;
|
|
3216
3145
|
}
|
|
3217
3146
|
}
|
|
3218
|
-
return last
|
|
3147
|
+
return last?.key;
|
|
3219
3148
|
}
|
|
3220
3149
|
/** Extends the selection to the given key. */
|
|
3221
3150
|
extendSelection(toKey) {
|
|
@@ -3431,11 +3360,11 @@ var SelectionManager = class {
|
|
|
3431
3360
|
}
|
|
3432
3361
|
};
|
|
3433
3362
|
var ListCollection = class {
|
|
3363
|
+
keyMap = /* @__PURE__ */ new Map();
|
|
3364
|
+
iterable;
|
|
3365
|
+
firstKey;
|
|
3366
|
+
lastKey;
|
|
3434
3367
|
constructor(nodes) {
|
|
3435
|
-
__publicField(this, "keyMap", /* @__PURE__ */ new Map());
|
|
3436
|
-
__publicField(this, "iterable");
|
|
3437
|
-
__publicField(this, "firstKey");
|
|
3438
|
-
__publicField(this, "lastKey");
|
|
3439
3368
|
this.iterable = nodes;
|
|
3440
3369
|
for (const node of nodes) {
|
|
3441
3370
|
this.keyMap.set(node.key, node);
|
|
@@ -3471,12 +3400,10 @@ var ListCollection = class {
|
|
|
3471
3400
|
return this.keyMap.keys();
|
|
3472
3401
|
}
|
|
3473
3402
|
getKeyBefore(key) {
|
|
3474
|
-
|
|
3475
|
-
return (_a = this.keyMap.get(key)) == null ? void 0 : _a.prevKey;
|
|
3403
|
+
return this.keyMap.get(key)?.prevKey;
|
|
3476
3404
|
}
|
|
3477
3405
|
getKeyAfter(key) {
|
|
3478
|
-
|
|
3479
|
-
return (_a = this.keyMap.get(key)) == null ? void 0 : _a.nextKey;
|
|
3406
|
+
return this.keyMap.get(key)?.nextKey;
|
|
3480
3407
|
}
|
|
3481
3408
|
getFirstKey() {
|
|
3482
3409
|
return this.firstKey;
|
|
@@ -3529,22 +3456,20 @@ var createPresence = (props) => {
|
|
|
3529
3456
|
return getComputedStyle(element);
|
|
3530
3457
|
});
|
|
3531
3458
|
const getAnimationName = () => {
|
|
3532
|
-
|
|
3533
|
-
return (_b = (_a = refStyles()) == null ? void 0 : _a.animationName) != null ? _b : "none";
|
|
3459
|
+
return refStyles()?.animationName ?? "none";
|
|
3534
3460
|
};
|
|
3535
3461
|
const [presentState, setPresentState] = createSignal(access2(props.show) ? "present" : "hidden");
|
|
3536
3462
|
let animationName = "none";
|
|
3537
3463
|
createEffect((prevShow) => {
|
|
3538
3464
|
const show = access2(props.show);
|
|
3539
3465
|
untrack(() => {
|
|
3540
|
-
var _a;
|
|
3541
3466
|
if (prevShow === show)
|
|
3542
3467
|
return show;
|
|
3543
3468
|
const prevAnimationName = animationName;
|
|
3544
3469
|
const currentAnimationName = getAnimationName();
|
|
3545
3470
|
if (show) {
|
|
3546
3471
|
setPresentState("present");
|
|
3547
|
-
} else if (currentAnimationName === "none" ||
|
|
3472
|
+
} else if (currentAnimationName === "none" || refStyles()?.display === "none") {
|
|
3548
3473
|
setPresentState("hidden");
|
|
3549
3474
|
} else {
|
|
3550
3475
|
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
@@ -3614,8 +3539,7 @@ function hasPointerBlockingLayer() {
|
|
|
3614
3539
|
return getPointerBlockingLayers().length > 0;
|
|
3615
3540
|
}
|
|
3616
3541
|
function isBelowPointerBlockingLayer(node) {
|
|
3617
|
-
|
|
3618
|
-
const highestBlockingIndex = indexOf((_a = getTopMostPointerBlockingLayer()) == null ? void 0 : _a.node);
|
|
3542
|
+
const highestBlockingIndex = indexOf(getTopMostPointerBlockingLayer()?.node);
|
|
3619
3543
|
return indexOf(node) < highestBlockingIndex;
|
|
3620
3544
|
}
|
|
3621
3545
|
function addLayer(layer) {
|
|
@@ -3711,7 +3635,7 @@ function ButtonRoot(props) {
|
|
|
3711
3635
|
return tagName() === "input";
|
|
3712
3636
|
});
|
|
3713
3637
|
const isNativeLink = createMemo(() => {
|
|
3714
|
-
return tagName() === "a" &&
|
|
3638
|
+
return tagName() === "a" && ref?.getAttribute("href") != null;
|
|
3715
3639
|
});
|
|
3716
3640
|
return createComponent(Polymorphic, mergeProps({
|
|
3717
3641
|
as: "button",
|
|
@@ -5216,18 +5140,9 @@ function PopperArrow(props) {
|
|
|
5216
5140
|
const [local, others] = splitProps(mergedProps, ["ref", "style", "size"]);
|
|
5217
5141
|
const dir = () => context.currentPlacement().split("-")[0];
|
|
5218
5142
|
const contentStyle = createComputedStyle(context.contentRef);
|
|
5219
|
-
const fill = () =>
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
};
|
|
5223
|
-
const stroke = () => {
|
|
5224
|
-
var _a;
|
|
5225
|
-
return ((_a = contentStyle()) == null ? void 0 : _a.getPropertyValue(`border-${dir()}-color`)) || "none";
|
|
5226
|
-
};
|
|
5227
|
-
const borderWidth = () => {
|
|
5228
|
-
var _a;
|
|
5229
|
-
return ((_a = contentStyle()) == null ? void 0 : _a.getPropertyValue(`border-${dir()}-width`)) || "0px";
|
|
5230
|
-
};
|
|
5143
|
+
const fill = () => contentStyle()?.getPropertyValue("background-color") || "none";
|
|
5144
|
+
const stroke = () => contentStyle()?.getPropertyValue(`border-${dir()}-color`) || "none";
|
|
5145
|
+
const borderWidth = () => contentStyle()?.getPropertyValue(`border-${dir()}-width`) || "0px";
|
|
5231
5146
|
const strokeWidth = () => {
|
|
5232
5147
|
return Number.parseInt(borderWidth()) * 2 * (DEFAULT_SIZE / local.size);
|
|
5233
5148
|
};
|
|
@@ -5291,7 +5206,7 @@ function PopperPositioner(props) {
|
|
|
5291
5206
|
}, others));
|
|
5292
5207
|
}
|
|
5293
5208
|
function createDOMRect(anchorRect) {
|
|
5294
|
-
const { x = 0, y = 0, width = 0, height = 0 } = anchorRect
|
|
5209
|
+
const { x = 0, y = 0, width = 0, height = 0 } = anchorRect ?? {};
|
|
5295
5210
|
if (typeof DOMRect === "function") {
|
|
5296
5211
|
return new DOMRect(x, y, width, height);
|
|
5297
5212
|
}
|
|
@@ -5348,7 +5263,7 @@ function getTransformOrigin(placement, readingDirection) {
|
|
|
5348
5263
|
}
|
|
5349
5264
|
function PopperRoot(props) {
|
|
5350
5265
|
const mergedProps = mergeDefaultProps({
|
|
5351
|
-
getAnchorRect: (anchor) => anchor
|
|
5266
|
+
getAnchorRect: (anchor) => anchor?.getBoundingClientRect(),
|
|
5352
5267
|
placement: "bottom",
|
|
5353
5268
|
gutter: 0,
|
|
5354
5269
|
shift: 0,
|
|
@@ -5365,23 +5280,19 @@ function PopperRoot(props) {
|
|
|
5365
5280
|
const [positionerRef, setPositionerRef] = createSignal();
|
|
5366
5281
|
const [arrowRef, setArrowRef] = createSignal();
|
|
5367
5282
|
const [currentPlacement, setCurrentPlacement] = createSignal(mergedProps.placement);
|
|
5368
|
-
const anchorRef = () =>
|
|
5369
|
-
var _a;
|
|
5370
|
-
return getAnchorElement((_a = mergedProps.anchorRef) == null ? void 0 : _a.call(mergedProps), mergedProps.getAnchorRect);
|
|
5371
|
-
};
|
|
5283
|
+
const anchorRef = () => getAnchorElement(mergedProps.anchorRef?.(), mergedProps.getAnchorRect);
|
|
5372
5284
|
const {
|
|
5373
5285
|
direction
|
|
5374
5286
|
} = useLocale();
|
|
5375
5287
|
async function updatePosition() {
|
|
5376
|
-
var _a, _b, _c;
|
|
5377
5288
|
const referenceEl = anchorRef();
|
|
5378
5289
|
const floatingEl = positionerRef();
|
|
5379
5290
|
const arrowEl = arrowRef();
|
|
5380
5291
|
if (!referenceEl || !floatingEl) {
|
|
5381
5292
|
return;
|
|
5382
5293
|
}
|
|
5383
|
-
const arrowOffset = (
|
|
5384
|
-
const finalGutter = typeof mergedProps.gutter === "number" ? mergedProps.gutter + arrowOffset :
|
|
5294
|
+
const arrowOffset = (arrowEl?.clientHeight || 0) / 2;
|
|
5295
|
+
const finalGutter = typeof mergedProps.gutter === "number" ? mergedProps.gutter + arrowOffset : mergedProps.gutter ?? arrowOffset;
|
|
5385
5296
|
floatingEl.style.setProperty("--kb-popper-content-overflow-padding", `${mergedProps.overflowPadding}px`);
|
|
5386
5297
|
referenceEl.getBoundingClientRect();
|
|
5387
5298
|
const middleware = [
|
|
@@ -5457,7 +5368,7 @@ function PopperRoot(props) {
|
|
|
5457
5368
|
}
|
|
5458
5369
|
});
|
|
5459
5370
|
setCurrentPlacement(pos.placement);
|
|
5460
|
-
|
|
5371
|
+
mergedProps.onCurrentPlacementChange?.(pos.placement);
|
|
5461
5372
|
if (!floatingEl) {
|
|
5462
5373
|
return;
|
|
5463
5374
|
}
|
|
@@ -5466,7 +5377,7 @@ function PopperRoot(props) {
|
|
|
5466
5377
|
const y = Math.round(pos.y);
|
|
5467
5378
|
let visibility;
|
|
5468
5379
|
if (mergedProps.hideWhenDetached) {
|
|
5469
|
-
visibility =
|
|
5380
|
+
visibility = pos.middlewareData.hide?.referenceHidden ? "hidden" : "visible";
|
|
5470
5381
|
}
|
|
5471
5382
|
Object.assign(floatingEl.style, {
|
|
5472
5383
|
top: "0",
|
|
@@ -5500,9 +5411,8 @@ function PopperRoot(props) {
|
|
|
5500
5411
|
onCleanup(cleanupAutoUpdate);
|
|
5501
5412
|
});
|
|
5502
5413
|
createEffect(() => {
|
|
5503
|
-
var _a;
|
|
5504
5414
|
const positioner = positionerRef();
|
|
5505
|
-
const content =
|
|
5415
|
+
const content = mergedProps.contentRef?.();
|
|
5506
5416
|
if (!positioner || !content) {
|
|
5507
5417
|
return;
|
|
5508
5418
|
}
|
|
@@ -5512,10 +5422,7 @@ function PopperRoot(props) {
|
|
|
5512
5422
|
});
|
|
5513
5423
|
const context = {
|
|
5514
5424
|
currentPlacement,
|
|
5515
|
-
contentRef: () =>
|
|
5516
|
-
var _a;
|
|
5517
|
-
return (_a = mergedProps.contentRef) == null ? void 0 : _a.call(mergedProps);
|
|
5518
|
-
},
|
|
5425
|
+
contentRef: () => mergedProps.contentRef?.(),
|
|
5519
5426
|
setPositionerRef,
|
|
5520
5427
|
setArrowRef
|
|
5521
5428
|
};
|
|
@@ -5534,17 +5441,15 @@ var Popper = Object.assign(PopperRoot, {
|
|
|
5534
5441
|
});
|
|
5535
5442
|
function createEscapeKeyDown(props) {
|
|
5536
5443
|
const handleKeyDown = (event) => {
|
|
5537
|
-
var _a;
|
|
5538
5444
|
if (event.key === EventKey.Escape) {
|
|
5539
|
-
|
|
5445
|
+
props.onEscapeKeyDown?.(event);
|
|
5540
5446
|
}
|
|
5541
5447
|
};
|
|
5542
5448
|
createEffect(() => {
|
|
5543
|
-
var _a, _b;
|
|
5544
5449
|
if (access(props.isDisabled)) {
|
|
5545
5450
|
return;
|
|
5546
5451
|
}
|
|
5547
|
-
const document2 =
|
|
5452
|
+
const document2 = props.ownerDocument?.() ?? getDocument();
|
|
5548
5453
|
document2.addEventListener("keydown", handleKeyDown);
|
|
5549
5454
|
onCleanup(() => {
|
|
5550
5455
|
document2.removeEventListener("keydown", handleKeyDown);
|
|
@@ -5557,20 +5462,10 @@ function createInteractOutside(props, ref) {
|
|
|
5557
5462
|
let pointerDownTimeoutId;
|
|
5558
5463
|
let clickHandler = noop3;
|
|
5559
5464
|
const ownerDocument = () => getDocument(ref());
|
|
5560
|
-
const onPointerDownOutside = (e2) =>
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
};
|
|
5564
|
-
const onFocusOutside = (e2) => {
|
|
5565
|
-
var _a;
|
|
5566
|
-
return (_a = props.onFocusOutside) == null ? void 0 : _a.call(props, e2);
|
|
5567
|
-
};
|
|
5568
|
-
const onInteractOutside = (e2) => {
|
|
5569
|
-
var _a;
|
|
5570
|
-
return (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, e2);
|
|
5571
|
-
};
|
|
5465
|
+
const onPointerDownOutside = (e2) => props.onPointerDownOutside?.(e2);
|
|
5466
|
+
const onFocusOutside = (e2) => props.onFocusOutside?.(e2);
|
|
5467
|
+
const onInteractOutside = (e2) => props.onInteractOutside?.(e2);
|
|
5572
5468
|
const isEventOutside = (e2) => {
|
|
5573
|
-
var _a;
|
|
5574
5469
|
const target = e2.target;
|
|
5575
5470
|
if (!(target instanceof HTMLElement)) {
|
|
5576
5471
|
return false;
|
|
@@ -5584,7 +5479,7 @@ function createInteractOutside(props, ref) {
|
|
|
5584
5479
|
if (contains(ref(), target)) {
|
|
5585
5480
|
return false;
|
|
5586
5481
|
}
|
|
5587
|
-
return !
|
|
5482
|
+
return !props.shouldExcludeElement?.(target);
|
|
5588
5483
|
};
|
|
5589
5484
|
const onPointerDown = (e2) => {
|
|
5590
5485
|
function handler() {
|
|
@@ -5669,39 +5564,36 @@ function DismissableLayer(props) {
|
|
|
5669
5564
|
const nestedLayers = /* @__PURE__ */ new Set([]);
|
|
5670
5565
|
const registerNestedLayer = (element) => {
|
|
5671
5566
|
nestedLayers.add(element);
|
|
5672
|
-
const parentUnregister = parentContext
|
|
5567
|
+
const parentUnregister = parentContext?.registerNestedLayer(element);
|
|
5673
5568
|
return () => {
|
|
5674
5569
|
nestedLayers.delete(element);
|
|
5675
|
-
parentUnregister
|
|
5570
|
+
parentUnregister?.();
|
|
5676
5571
|
};
|
|
5677
5572
|
};
|
|
5678
5573
|
const shouldExcludeElement = (element) => {
|
|
5679
|
-
var _a;
|
|
5680
5574
|
if (!ref) {
|
|
5681
5575
|
return false;
|
|
5682
5576
|
}
|
|
5683
|
-
return
|
|
5577
|
+
return local.excludedElements?.some((node) => contains(node(), element)) || [...nestedLayers].some((layer) => contains(layer, element));
|
|
5684
5578
|
};
|
|
5685
5579
|
const onPointerDownOutside = (e2) => {
|
|
5686
|
-
var _a, _b, _c;
|
|
5687
5580
|
if (!ref || layerStack.isBelowPointerBlockingLayer(ref)) {
|
|
5688
5581
|
return;
|
|
5689
5582
|
}
|
|
5690
5583
|
if (!local.bypassTopMostLayerCheck && !layerStack.isTopMostLayer(ref)) {
|
|
5691
5584
|
return;
|
|
5692
5585
|
}
|
|
5693
|
-
|
|
5694
|
-
|
|
5586
|
+
local.onPointerDownOutside?.(e2);
|
|
5587
|
+
local.onInteractOutside?.(e2);
|
|
5695
5588
|
if (!e2.defaultPrevented) {
|
|
5696
|
-
|
|
5589
|
+
local.onDismiss?.();
|
|
5697
5590
|
}
|
|
5698
5591
|
};
|
|
5699
5592
|
const onFocusOutside = (e2) => {
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
(_b = local.onInteractOutside) == null ? void 0 : _b.call(local, e2);
|
|
5593
|
+
local.onFocusOutside?.(e2);
|
|
5594
|
+
local.onInteractOutside?.(e2);
|
|
5703
5595
|
if (!e2.defaultPrevented) {
|
|
5704
|
-
|
|
5596
|
+
local.onDismiss?.();
|
|
5705
5597
|
}
|
|
5706
5598
|
};
|
|
5707
5599
|
createInteractOutside({
|
|
@@ -5712,11 +5604,10 @@ function DismissableLayer(props) {
|
|
|
5712
5604
|
createEscapeKeyDown({
|
|
5713
5605
|
ownerDocument: () => getDocument(ref),
|
|
5714
5606
|
onEscapeKeyDown: (e2) => {
|
|
5715
|
-
var _a;
|
|
5716
5607
|
if (!ref || !layerStack.isTopMostLayer(ref)) {
|
|
5717
5608
|
return;
|
|
5718
5609
|
}
|
|
5719
|
-
|
|
5610
|
+
local.onEscapeKeyDown?.(e2);
|
|
5720
5611
|
if (!e2.defaultPrevented && local.onDismiss) {
|
|
5721
5612
|
e2.preventDefault();
|
|
5722
5613
|
local.onDismiss();
|
|
@@ -5732,7 +5623,7 @@ function DismissableLayer(props) {
|
|
|
5732
5623
|
isPointerBlocking: local.disableOutsidePointerEvents,
|
|
5733
5624
|
dismiss: local.onDismiss
|
|
5734
5625
|
});
|
|
5735
|
-
const unregisterFromParentLayer = parentContext
|
|
5626
|
+
const unregisterFromParentLayer = parentContext?.registerNestedLayer(ref);
|
|
5736
5627
|
layerStack.assignPointerEventToLayers();
|
|
5737
5628
|
layerStack.disableBodyPointerEvents(ref);
|
|
5738
5629
|
onCleanup(() => {
|
|
@@ -5740,7 +5631,7 @@ function DismissableLayer(props) {
|
|
|
5740
5631
|
return;
|
|
5741
5632
|
}
|
|
5742
5633
|
layerStack.removeLayer(ref);
|
|
5743
|
-
unregisterFromParentLayer
|
|
5634
|
+
unregisterFromParentLayer?.();
|
|
5744
5635
|
layerStack.assignPointerEventToLayers();
|
|
5745
5636
|
layerStack.restoreBodyPointerEvents(ref);
|
|
5746
5637
|
});
|
|
@@ -5783,10 +5674,7 @@ function createDisclosureState(props = {}) {
|
|
|
5783
5674
|
const [isOpen, setIsOpen] = createControllableBooleanSignal({
|
|
5784
5675
|
value: () => access(props.open),
|
|
5785
5676
|
defaultValue: () => !!access(props.defaultOpen),
|
|
5786
|
-
onChange: (value) =>
|
|
5787
|
-
var _a;
|
|
5788
|
-
return (_a = props.onOpenChange) == null ? void 0 : _a.call(props, value);
|
|
5789
|
-
}
|
|
5677
|
+
onChange: (value) => props.onOpenChange?.(value)
|
|
5790
5678
|
});
|
|
5791
5679
|
const open = () => {
|
|
5792
5680
|
setIsOpen(true);
|
|
@@ -5900,17 +5788,15 @@ function RadioGroupItemControl(props) {
|
|
|
5900
5788
|
}, props);
|
|
5901
5789
|
const [local, others] = splitProps(mergedProps, ["onClick", "onKeyDown"]);
|
|
5902
5790
|
const onClick = (e2) => {
|
|
5903
|
-
var _a;
|
|
5904
5791
|
callHandler(e2, local.onClick);
|
|
5905
5792
|
context.select();
|
|
5906
|
-
|
|
5793
|
+
context.inputRef()?.focus();
|
|
5907
5794
|
};
|
|
5908
5795
|
const onKeyDown = (e2) => {
|
|
5909
|
-
var _a;
|
|
5910
5796
|
callHandler(e2, local.onKeyDown);
|
|
5911
5797
|
if (e2.key === EventKey.Space) {
|
|
5912
5798
|
context.select();
|
|
5913
|
-
|
|
5799
|
+
context.inputRef()?.focus();
|
|
5914
5800
|
}
|
|
5915
5801
|
};
|
|
5916
5802
|
return createComponent(Polymorphic, mergeProps({
|
|
@@ -5940,10 +5826,7 @@ function RadioGroupItemIndicator(props) {
|
|
|
5940
5826
|
present
|
|
5941
5827
|
} = src_default({
|
|
5942
5828
|
show: () => local.forceMount || context.isSelected(),
|
|
5943
|
-
element: () =>
|
|
5944
|
-
var _a;
|
|
5945
|
-
return (_a = ref()) != null ? _a : null;
|
|
5946
|
-
}
|
|
5829
|
+
element: () => ref() ?? null
|
|
5947
5830
|
});
|
|
5948
5831
|
return createComponent(Show, {
|
|
5949
5832
|
get when() {
|
|
@@ -6003,11 +5886,11 @@ function RadioGroupItemInput(props) {
|
|
|
6003
5886
|
return;
|
|
6004
5887
|
setIsInternalChangeEvent(true);
|
|
6005
5888
|
const ref = radioContext.inputRef();
|
|
6006
|
-
ref
|
|
5889
|
+
ref?.dispatchEvent(new Event("input", {
|
|
6007
5890
|
bubbles: true,
|
|
6008
5891
|
cancelable: true
|
|
6009
5892
|
}));
|
|
6010
|
-
ref
|
|
5893
|
+
ref?.dispatchEvent(new Event("change", {
|
|
6011
5894
|
bubbles: true,
|
|
6012
5895
|
cancelable: true
|
|
6013
5896
|
}));
|
|
@@ -6085,18 +5968,12 @@ function RadioGroupRoot(props) {
|
|
|
6085
5968
|
const [selected, setSelected] = createControllableSignal({
|
|
6086
5969
|
value: () => local.value,
|
|
6087
5970
|
defaultValue: () => local.defaultValue,
|
|
6088
|
-
onChange: (value) =>
|
|
6089
|
-
var _a;
|
|
6090
|
-
return (_a = local.onChange) == null ? void 0 : _a.call(local, value);
|
|
6091
|
-
}
|
|
5971
|
+
onChange: (value) => local.onChange?.(value)
|
|
6092
5972
|
});
|
|
6093
5973
|
const {
|
|
6094
5974
|
formControlContext
|
|
6095
5975
|
} = createFormControl(formControlProps);
|
|
6096
|
-
createFormResetListener(() => ref, () =>
|
|
6097
|
-
var _a;
|
|
6098
|
-
return setSelected((_a = local.defaultValue) != null ? _a : "");
|
|
6099
|
-
});
|
|
5976
|
+
createFormResetListener(() => ref, () => setSelected(local.defaultValue ?? ""));
|
|
6100
5977
|
const ariaLabelledBy = () => {
|
|
6101
5978
|
return formControlContext.getAriaLabelledBy(access(formControlProps.id), others["aria-label"], local["aria-labelledby"]);
|
|
6102
5979
|
};
|
|
@@ -6176,10 +6053,10 @@ var RadioGroup = Object.assign(RadioGroupRoot, {
|
|
|
6176
6053
|
Label: RadioGroupLabel
|
|
6177
6054
|
});
|
|
6178
6055
|
var ListKeyboardDelegate = class {
|
|
6056
|
+
collection;
|
|
6057
|
+
ref;
|
|
6058
|
+
collator;
|
|
6179
6059
|
constructor(collection, ref, collator) {
|
|
6180
|
-
__publicField(this, "collection");
|
|
6181
|
-
__publicField(this, "ref");
|
|
6182
|
-
__publicField(this, "collator");
|
|
6183
6060
|
this.collection = collection;
|
|
6184
6061
|
this.ref = ref;
|
|
6185
6062
|
this.collator = collator;
|
|
@@ -6225,13 +6102,11 @@ var ListKeyboardDelegate = class {
|
|
|
6225
6102
|
}
|
|
6226
6103
|
}
|
|
6227
6104
|
getItem(key) {
|
|
6228
|
-
|
|
6229
|
-
return (_c = (_b = (_a = this.ref) == null ? void 0 : _a.call(this)) == null ? void 0 : _b.querySelector(`[data-key="${key}"]`)) != null ? _c : null;
|
|
6105
|
+
return this.ref?.()?.querySelector(`[data-key="${key}"]`) ?? null;
|
|
6230
6106
|
}
|
|
6231
6107
|
// TODO: not working correctly
|
|
6232
6108
|
getKeyPageAbove(key) {
|
|
6233
|
-
|
|
6234
|
-
const menu = (_a = this.ref) == null ? void 0 : _a.call(this);
|
|
6109
|
+
const menu = this.ref?.();
|
|
6235
6110
|
let item = this.getItem(key);
|
|
6236
6111
|
if (!menu || !item) {
|
|
6237
6112
|
return;
|
|
@@ -6249,8 +6124,7 @@ var ListKeyboardDelegate = class {
|
|
|
6249
6124
|
}
|
|
6250
6125
|
// TODO: not working correctly
|
|
6251
6126
|
getKeyPageBelow(key) {
|
|
6252
|
-
|
|
6253
|
-
const menu = (_a = this.ref) == null ? void 0 : _a.call(this);
|
|
6127
|
+
const menu = this.ref?.();
|
|
6254
6128
|
let item = this.getItem(key);
|
|
6255
6129
|
if (!menu || !item) {
|
|
6256
6130
|
return;
|
|
@@ -6267,8 +6141,7 @@ var ListKeyboardDelegate = class {
|
|
|
6267
6141
|
return keyBelow;
|
|
6268
6142
|
}
|
|
6269
6143
|
getKeyForSearch(search, fromKey) {
|
|
6270
|
-
|
|
6271
|
-
const collator = (_a = this.collator) == null ? void 0 : _a.call(this);
|
|
6144
|
+
const collator = this.collator?.();
|
|
6272
6145
|
if (!collator) {
|
|
6273
6146
|
return;
|
|
6274
6147
|
}
|
|
@@ -6307,10 +6180,7 @@ function createSelectableList(props, ref, scrollRef) {
|
|
|
6307
6180
|
shouldUseVirtualFocus: () => access(props.shouldUseVirtualFocus),
|
|
6308
6181
|
allowsTabNavigation: () => access(props.allowsTabNavigation),
|
|
6309
6182
|
isVirtualized: () => access(props.isVirtualized),
|
|
6310
|
-
scrollToKey: (key) =>
|
|
6311
|
-
var _a;
|
|
6312
|
-
return (_a = access(props.scrollToKey)) == null ? void 0 : _a(key);
|
|
6313
|
-
},
|
|
6183
|
+
scrollToKey: (key) => access(props.scrollToKey)?.(key),
|
|
6314
6184
|
orientation: () => access(props.orientation)
|
|
6315
6185
|
},
|
|
6316
6186
|
ref
|
|
@@ -6329,17 +6199,15 @@ var focusScopeStack = {
|
|
|
6329
6199
|
return this.stack[0];
|
|
6330
6200
|
},
|
|
6331
6201
|
add(scope) {
|
|
6332
|
-
var _a;
|
|
6333
6202
|
if (scope !== this.active()) {
|
|
6334
|
-
|
|
6203
|
+
this.active()?.pause();
|
|
6335
6204
|
}
|
|
6336
6205
|
this.stack = removeItemFromArray(this.stack, scope);
|
|
6337
6206
|
this.stack.unshift(scope);
|
|
6338
6207
|
},
|
|
6339
6208
|
remove(scope) {
|
|
6340
|
-
var _a;
|
|
6341
6209
|
this.stack = removeItemFromArray(this.stack, scope);
|
|
6342
|
-
|
|
6210
|
+
this.active()?.resume();
|
|
6343
6211
|
}
|
|
6344
6212
|
};
|
|
6345
6213
|
function createFocusScope(props, ref) {
|
|
@@ -6353,14 +6221,8 @@ function createFocusScope(props, ref) {
|
|
|
6353
6221
|
}
|
|
6354
6222
|
};
|
|
6355
6223
|
let lastFocusedElement = null;
|
|
6356
|
-
const onMountAutoFocus = (e2) =>
|
|
6357
|
-
|
|
6358
|
-
return (_a = props.onMountAutoFocus) == null ? void 0 : _a.call(props, e2);
|
|
6359
|
-
};
|
|
6360
|
-
const onUnmountAutoFocus = (e2) => {
|
|
6361
|
-
var _a;
|
|
6362
|
-
return (_a = props.onUnmountAutoFocus) == null ? void 0 : _a.call(props, e2);
|
|
6363
|
-
};
|
|
6224
|
+
const onMountAutoFocus = (e2) => props.onMountAutoFocus?.(e2);
|
|
6225
|
+
const onUnmountAutoFocus = (e2) => props.onUnmountAutoFocus?.(e2);
|
|
6364
6226
|
const ownerDocument = () => getDocument(ref());
|
|
6365
6227
|
const createSentinel = () => {
|
|
6366
6228
|
const element = ownerDocument().createElement("span");
|
|
@@ -6429,7 +6291,7 @@ function createFocusScope(props, ref) {
|
|
|
6429
6291
|
container.addEventListener(AUTOFOCUS_ON_UNMOUNT_EVENT, onUnmountAutoFocus);
|
|
6430
6292
|
container.dispatchEvent(unmountEvent);
|
|
6431
6293
|
if (!unmountEvent.defaultPrevented) {
|
|
6432
|
-
focusWithoutScrolling(previouslyFocusedElement
|
|
6294
|
+
focusWithoutScrolling(previouslyFocusedElement ?? ownerDocument().body);
|
|
6433
6295
|
}
|
|
6434
6296
|
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT_EVENT, onUnmountAutoFocus);
|
|
6435
6297
|
focusScopeStack.remove(focusScope);
|
|
@@ -6443,7 +6305,7 @@ function createFocusScope(props, ref) {
|
|
|
6443
6305
|
}
|
|
6444
6306
|
const onFocusIn = (event) => {
|
|
6445
6307
|
const target = event.target;
|
|
6446
|
-
if (target
|
|
6308
|
+
if (target?.closest(`[${DATA_TOP_LAYER_ATTR}]`)) {
|
|
6447
6309
|
return;
|
|
6448
6310
|
}
|
|
6449
6311
|
if (contains(container, target)) {
|
|
@@ -6454,8 +6316,8 @@ function createFocusScope(props, ref) {
|
|
|
6454
6316
|
};
|
|
6455
6317
|
const onFocusOut = (event) => {
|
|
6456
6318
|
const relatedTarget = event.relatedTarget;
|
|
6457
|
-
const target = relatedTarget
|
|
6458
|
-
if (target
|
|
6319
|
+
const target = relatedTarget ?? getActiveElement(container);
|
|
6320
|
+
if (target?.closest(`[${DATA_TOP_LAYER_ATTR}]`)) {
|
|
6459
6321
|
return;
|
|
6460
6322
|
}
|
|
6461
6323
|
if (!contains(container, target)) {
|
|
@@ -6561,8 +6423,7 @@ function ariaHideOutside(targets, root = document.body) {
|
|
|
6561
6423
|
}
|
|
6562
6424
|
};
|
|
6563
6425
|
const hide3 = (node) => {
|
|
6564
|
-
|
|
6565
|
-
const refCount = (_a = refCountMap.get(node)) != null ? _a : 0;
|
|
6426
|
+
const refCount = refCountMap.get(node) ?? 0;
|
|
6566
6427
|
if (node.getAttribute("aria-hidden") === "true" && refCount === 0) {
|
|
6567
6428
|
return;
|
|
6568
6429
|
}
|
|
@@ -6637,9 +6498,8 @@ function ariaHideOutside(targets, root = document.body) {
|
|
|
6637
6498
|
var activeStyles = /* @__PURE__ */ new Map();
|
|
6638
6499
|
var createStyle = (props) => {
|
|
6639
6500
|
createEffect(() => {
|
|
6640
|
-
|
|
6641
|
-
const
|
|
6642
|
-
const properties = (_b = access2(props.properties)) != null ? _b : [];
|
|
6501
|
+
const style = access2(props.style) ?? {};
|
|
6502
|
+
const properties = access2(props.properties) ?? [];
|
|
6643
6503
|
const originalStyles = {};
|
|
6644
6504
|
for (const key in style) {
|
|
6645
6505
|
originalStyles[key] = props.element.style[key];
|
|
@@ -6659,7 +6519,6 @@ var createStyle = (props) => {
|
|
|
6659
6519
|
props.element.style.setProperty(property.key, property.value);
|
|
6660
6520
|
}
|
|
6661
6521
|
onCleanup(() => {
|
|
6662
|
-
var _a2;
|
|
6663
6522
|
const activeStyle2 = activeStyles.get(props.key);
|
|
6664
6523
|
if (!activeStyle2)
|
|
6665
6524
|
return;
|
|
@@ -6677,7 +6536,7 @@ var createStyle = (props) => {
|
|
|
6677
6536
|
if (props.element.style.length === 0) {
|
|
6678
6537
|
props.element.removeAttribute("style");
|
|
6679
6538
|
}
|
|
6680
|
-
|
|
6539
|
+
props.cleanup?.();
|
|
6681
6540
|
});
|
|
6682
6541
|
});
|
|
6683
6542
|
};
|
|
@@ -6697,7 +6556,6 @@ var isScrollContainer = (element, axis) => {
|
|
|
6697
6556
|
element.tagName === "HTML" && overflow === "visible";
|
|
6698
6557
|
};
|
|
6699
6558
|
var getScrollAtLocation = (location, axis, stopAt) => {
|
|
6700
|
-
var _a;
|
|
6701
6559
|
const directionFactor = axis === "x" && window.getComputedStyle(location).direction === "rtl" ? -1 : 1;
|
|
6702
6560
|
let currentElement = location;
|
|
6703
6561
|
let availableScroll = 0;
|
|
@@ -6713,10 +6571,10 @@ var getScrollAtLocation = (location, axis, stopAt) => {
|
|
|
6713
6571
|
availableScroll += scrolled;
|
|
6714
6572
|
availableScrollTop += scrollOffset;
|
|
6715
6573
|
}
|
|
6716
|
-
if (currentElement === (stopAt
|
|
6574
|
+
if (currentElement === (stopAt ?? document.documentElement)) {
|
|
6717
6575
|
wrapperReached = true;
|
|
6718
6576
|
} else {
|
|
6719
|
-
currentElement =
|
|
6577
|
+
currentElement = currentElement._$host ?? currentElement.parentElement;
|
|
6720
6578
|
}
|
|
6721
6579
|
} while (currentElement && !wrapperReached);
|
|
6722
6580
|
return [availableScroll, availableScrollTop];
|
|
@@ -6889,14 +6747,13 @@ var wouldScroll = (target, axis, delta, wrapper) => {
|
|
|
6889
6747
|
return true;
|
|
6890
6748
|
};
|
|
6891
6749
|
var contains2 = (wrapper, target) => {
|
|
6892
|
-
var _a;
|
|
6893
6750
|
if (wrapper.contains(target))
|
|
6894
6751
|
return true;
|
|
6895
6752
|
let currentElement = target;
|
|
6896
6753
|
while (currentElement) {
|
|
6897
6754
|
if (currentElement === wrapper)
|
|
6898
6755
|
return true;
|
|
6899
|
-
currentElement =
|
|
6756
|
+
currentElement = currentElement._$host ?? currentElement.parentElement;
|
|
6900
6757
|
}
|
|
6901
6758
|
return false;
|
|
6902
6759
|
};
|
|
@@ -6944,8 +6801,7 @@ function MenuItemBase(props) {
|
|
|
6944
6801
|
const key = () => others.id;
|
|
6945
6802
|
const isHighlighted = () => selectionManager().focusedKey() === key();
|
|
6946
6803
|
const onSelect = () => {
|
|
6947
|
-
|
|
6948
|
-
(_a = local.onSelect) == null ? void 0 : _a.call(local);
|
|
6804
|
+
local.onSelect?.();
|
|
6949
6805
|
if (local.closeOnSelect) {
|
|
6950
6806
|
setTimeout(() => {
|
|
6951
6807
|
menuContext.close(true);
|
|
@@ -6953,16 +6809,13 @@ function MenuItemBase(props) {
|
|
|
6953
6809
|
}
|
|
6954
6810
|
};
|
|
6955
6811
|
createDomCollectionItem({
|
|
6956
|
-
getItem: () => {
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
disabled: (_e = local.disabled) != null ? _e : false
|
|
6964
|
-
};
|
|
6965
|
-
}
|
|
6812
|
+
getItem: () => ({
|
|
6813
|
+
ref: () => ref,
|
|
6814
|
+
type: "item",
|
|
6815
|
+
key: key(),
|
|
6816
|
+
textValue: local.textValue ?? labelRef()?.textContent ?? ref?.textContent ?? "",
|
|
6817
|
+
disabled: local.disabled ?? false
|
|
6818
|
+
})
|
|
6966
6819
|
});
|
|
6967
6820
|
const selectableItem = createSelectableItem({
|
|
6968
6821
|
key,
|
|
@@ -7097,15 +6950,11 @@ function MenuCheckboxItem(props) {
|
|
|
7097
6950
|
const state = createToggleState({
|
|
7098
6951
|
isSelected: () => local.checked,
|
|
7099
6952
|
defaultIsSelected: () => local.defaultChecked,
|
|
7100
|
-
onSelectedChange: (checked) =>
|
|
7101
|
-
var _a;
|
|
7102
|
-
return (_a = local.onChange) == null ? void 0 : _a.call(local, checked);
|
|
7103
|
-
},
|
|
6953
|
+
onSelectedChange: (checked) => local.onChange?.(checked),
|
|
7104
6954
|
isDisabled: () => others.disabled
|
|
7105
6955
|
});
|
|
7106
6956
|
const onSelect = () => {
|
|
7107
|
-
|
|
7108
|
-
(_a = local.onSelect) == null ? void 0 : _a.call(local);
|
|
6957
|
+
local.onSelect?.();
|
|
7109
6958
|
state.toggle();
|
|
7110
6959
|
};
|
|
7111
6960
|
return createComponent(MenuItemBase, mergeProps({
|
|
@@ -7141,24 +6990,19 @@ function MenuTrigger(props) {
|
|
|
7141
6990
|
const [local, others] = splitProps(mergedProps, ["ref", "id", "disabled", "onPointerDown", "onClick", "onKeyDown", "onMouseOver", "onFocus"]);
|
|
7142
6991
|
let key = () => rootContext.value();
|
|
7143
6992
|
if (optionalMenubarContext !== void 0) {
|
|
7144
|
-
key = () =>
|
|
7145
|
-
var _a;
|
|
7146
|
-
return (_a = rootContext.value()) != null ? _a : local.id;
|
|
7147
|
-
};
|
|
6993
|
+
key = () => rootContext.value() ?? local.id;
|
|
7148
6994
|
if (optionalMenubarContext.lastValue() === void 0)
|
|
7149
6995
|
optionalMenubarContext.setLastValue(key);
|
|
7150
6996
|
}
|
|
7151
6997
|
const tagName = createTagName(() => context.triggerRef(), () => "button");
|
|
7152
6998
|
const isNativeLink = createMemo(() => {
|
|
7153
|
-
|
|
7154
|
-
return tagName() === "a" && ((_a = context.triggerRef()) == null ? void 0 : _a.getAttribute("href")) != null;
|
|
6999
|
+
return tagName() === "a" && context.triggerRef()?.getAttribute("href") != null;
|
|
7155
7000
|
});
|
|
7156
|
-
createEffect(on(() => optionalMenubarContext
|
|
7157
|
-
var _a;
|
|
7001
|
+
createEffect(on(() => optionalMenubarContext?.value(), (value) => {
|
|
7158
7002
|
if (!isNativeLink())
|
|
7159
7003
|
return;
|
|
7160
7004
|
if (value === key())
|
|
7161
|
-
|
|
7005
|
+
context.triggerRef()?.focus();
|
|
7162
7006
|
}));
|
|
7163
7007
|
const handleClick = () => {
|
|
7164
7008
|
if (optionalMenubarContext !== void 0) {
|
|
@@ -7208,8 +7052,8 @@ function MenuTrigger(props) {
|
|
|
7208
7052
|
e2.preventDefault();
|
|
7209
7053
|
scrollIntoViewport(e2.currentTarget);
|
|
7210
7054
|
context.open("first");
|
|
7211
|
-
optionalMenubarContext
|
|
7212
|
-
optionalMenubarContext
|
|
7055
|
+
optionalMenubarContext?.setAutoFocusMenu(true);
|
|
7056
|
+
optionalMenubarContext?.setValue(key);
|
|
7213
7057
|
break;
|
|
7214
7058
|
case MENU_KEYS.last(rootContext.orientation()):
|
|
7215
7059
|
e2.stopPropagation();
|
|
@@ -7233,9 +7077,8 @@ function MenuTrigger(props) {
|
|
|
7233
7077
|
}
|
|
7234
7078
|
};
|
|
7235
7079
|
const onMouseOver = (e2) => {
|
|
7236
|
-
var _a;
|
|
7237
7080
|
callHandler(e2, local.onMouseOver);
|
|
7238
|
-
if (
|
|
7081
|
+
if (context.triggerRef()?.dataset.pointerType === "touch")
|
|
7239
7082
|
return;
|
|
7240
7083
|
if (!local.disabled && optionalMenubarContext !== void 0 && optionalMenubarContext.value() !== void 0) {
|
|
7241
7084
|
optionalMenubarContext.setValue(key);
|
|
@@ -7269,7 +7112,7 @@ function MenuTrigger(props) {
|
|
|
7269
7112
|
return createMemo(() => !!context.isOpen())() ? context.contentId() : void 0;
|
|
7270
7113
|
},
|
|
7271
7114
|
get ["data-highlighted"]() {
|
|
7272
|
-
return key() !== void 0 &&
|
|
7115
|
+
return key() !== void 0 && optionalMenubarContext?.value() === key() ? true : void 0;
|
|
7273
7116
|
},
|
|
7274
7117
|
get tabIndex() {
|
|
7275
7118
|
return optionalMenubarContext !== void 0 ? optionalMenubarContext.value() === key() || optionalMenubarContext.lastValue() === key() ? 0 : -1 : void 0;
|
|
@@ -7316,9 +7159,8 @@ function MenuContentBase(props) {
|
|
|
7316
7159
|
createFocusScope({
|
|
7317
7160
|
trapFocus: () => isRootModalContent() && context.isOpen(),
|
|
7318
7161
|
onMountAutoFocus: (event) => {
|
|
7319
|
-
var _a;
|
|
7320
7162
|
if (optionalMenubarContext === void 0)
|
|
7321
|
-
|
|
7163
|
+
local.onOpenAutoFocus?.(event);
|
|
7322
7164
|
},
|
|
7323
7165
|
onUnmountAutoFocus: local.onCloseAutoFocus
|
|
7324
7166
|
}, () => ref);
|
|
@@ -7352,26 +7194,23 @@ function MenuContentBase(props) {
|
|
|
7352
7194
|
}
|
|
7353
7195
|
};
|
|
7354
7196
|
const onEscapeKeyDown = (e2) => {
|
|
7355
|
-
|
|
7356
|
-
(
|
|
7357
|
-
optionalMenubarContext == null ? void 0 : optionalMenubarContext.setAutoFocusMenu(false);
|
|
7197
|
+
local.onEscapeKeyDown?.(e2);
|
|
7198
|
+
optionalMenubarContext?.setAutoFocusMenu(false);
|
|
7358
7199
|
context.close(true);
|
|
7359
7200
|
};
|
|
7360
7201
|
const onFocusOutside = (e2) => {
|
|
7361
|
-
|
|
7362
|
-
(_a = local.onFocusOutside) == null ? void 0 : _a.call(local, e2);
|
|
7202
|
+
local.onFocusOutside?.(e2);
|
|
7363
7203
|
if (rootContext.isModal()) {
|
|
7364
7204
|
e2.preventDefault();
|
|
7365
7205
|
}
|
|
7366
7206
|
};
|
|
7367
7207
|
const onPointerEnter = (e2) => {
|
|
7368
|
-
var _a, _b;
|
|
7369
7208
|
callHandler(e2, local.onPointerEnter);
|
|
7370
7209
|
if (!context.isOpen()) {
|
|
7371
7210
|
return;
|
|
7372
7211
|
}
|
|
7373
|
-
|
|
7374
|
-
|
|
7212
|
+
context.parentMenuContext()?.listState().selectionManager().setFocused(false);
|
|
7213
|
+
context.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0);
|
|
7375
7214
|
};
|
|
7376
7215
|
const onPointerMove = (e2) => {
|
|
7377
7216
|
callHandler(e2, local.onPointerMove);
|
|
@@ -7461,7 +7300,7 @@ function MenuContent(props) {
|
|
|
7461
7300
|
const context = useMenuContext();
|
|
7462
7301
|
const [local, others] = splitProps(props, ["ref"]);
|
|
7463
7302
|
src_default2({
|
|
7464
|
-
element: () => ref
|
|
7303
|
+
element: () => ref ?? null,
|
|
7465
7304
|
enabled: () => context.contentPresent() && rootContext.preventScroll()
|
|
7466
7305
|
});
|
|
7467
7306
|
return createComponent(MenuContentBase, mergeProps({
|
|
@@ -7613,10 +7452,7 @@ function MenuRadioGroup(props) {
|
|
|
7613
7452
|
const [selected, setSelected] = createControllableSignal({
|
|
7614
7453
|
value: () => local.value,
|
|
7615
7454
|
defaultValue: () => local.defaultValue,
|
|
7616
|
-
onChange: (value) =>
|
|
7617
|
-
var _a;
|
|
7618
|
-
return (_a = local.onChange) == null ? void 0 : _a.call(local, value);
|
|
7619
|
-
}
|
|
7455
|
+
onChange: (value) => local.onChange?.(value)
|
|
7620
7456
|
});
|
|
7621
7457
|
const context = {
|
|
7622
7458
|
isDisabled: () => local.disabled,
|
|
@@ -7637,8 +7473,7 @@ function MenuRadioItem(props) {
|
|
|
7637
7473
|
}, props);
|
|
7638
7474
|
const [local, others] = splitProps(mergedProps, ["value", "onSelect"]);
|
|
7639
7475
|
const onSelect = () => {
|
|
7640
|
-
|
|
7641
|
-
(_a = local.onSelect) == null ? void 0 : _a.call(local);
|
|
7476
|
+
local.onSelect?.();
|
|
7642
7477
|
context.setSelectedValue(local.value);
|
|
7643
7478
|
};
|
|
7644
7479
|
return createComponent(MenuItemBase, mergeProps({
|
|
@@ -7723,19 +7558,13 @@ function Menu(props) {
|
|
|
7723
7558
|
const disclosureState = createDisclosureState({
|
|
7724
7559
|
open: () => local.open,
|
|
7725
7560
|
defaultOpen: () => local.defaultOpen,
|
|
7726
|
-
onOpenChange: (isOpen) =>
|
|
7727
|
-
var _a;
|
|
7728
|
-
return (_a = local.onOpenChange) == null ? void 0 : _a.call(local, isOpen);
|
|
7729
|
-
}
|
|
7561
|
+
onOpenChange: (isOpen) => local.onOpenChange?.(isOpen)
|
|
7730
7562
|
});
|
|
7731
7563
|
const {
|
|
7732
7564
|
present: contentPresent
|
|
7733
7565
|
} = src_default({
|
|
7734
7566
|
show: () => rootContext.forceMount() || disclosureState.isOpen(),
|
|
7735
|
-
element: () =>
|
|
7736
|
-
var _a;
|
|
7737
|
-
return (_a = contentRef()) != null ? _a : null;
|
|
7738
|
-
}
|
|
7567
|
+
element: () => contentRef() ?? null
|
|
7739
7568
|
});
|
|
7740
7569
|
const listState = createListState({
|
|
7741
7570
|
selectionMode: "none",
|
|
@@ -7771,15 +7600,15 @@ function Menu(props) {
|
|
|
7771
7600
|
};
|
|
7772
7601
|
const registerNestedMenu = (element) => {
|
|
7773
7602
|
setNestedMenus((prev) => [...prev, element]);
|
|
7774
|
-
const parentUnregister = parentMenuContext
|
|
7603
|
+
const parentUnregister = parentMenuContext?.registerNestedMenu(element);
|
|
7775
7604
|
return () => {
|
|
7776
7605
|
setNestedMenus((prev) => removeItemFromArray(prev, element));
|
|
7777
|
-
parentUnregister
|
|
7606
|
+
parentUnregister?.();
|
|
7778
7607
|
};
|
|
7779
7608
|
};
|
|
7780
7609
|
const isPointerMovingToSubmenu = (e2) => {
|
|
7781
|
-
const isMovingTowards = pointerDir ===
|
|
7782
|
-
return isMovingTowards && isPointerInGraceArea(e2, pointerGraceIntent
|
|
7610
|
+
const isMovingTowards = pointerDir === pointerGraceIntent?.side;
|
|
7611
|
+
return isMovingTowards && isPointerInGraceArea(e2, pointerGraceIntent?.area);
|
|
7783
7612
|
};
|
|
7784
7613
|
const onItemEnter = (e2) => {
|
|
7785
7614
|
if (isPointerMovingToSubmenu(e2)) {
|
|
@@ -7816,14 +7645,13 @@ function Menu(props) {
|
|
|
7816
7645
|
createEffect(() => {
|
|
7817
7646
|
if (parentMenuContext !== void 0)
|
|
7818
7647
|
return;
|
|
7819
|
-
optionalMenubarContext
|
|
7648
|
+
optionalMenubarContext?.registerMenu(rootContext.value(), [contentRef(), ...nestedMenus()]);
|
|
7820
7649
|
});
|
|
7821
7650
|
createEffect(() => {
|
|
7822
|
-
var _a;
|
|
7823
7651
|
if (parentMenuContext !== void 0 || optionalMenubarContext === void 0)
|
|
7824
7652
|
return;
|
|
7825
7653
|
if (optionalMenubarContext.value() === rootContext.value()) {
|
|
7826
|
-
|
|
7654
|
+
triggerRef()?.focus();
|
|
7827
7655
|
if (optionalMenubarContext.autoFocusMenu())
|
|
7828
7656
|
open(true);
|
|
7829
7657
|
} else
|
|
@@ -7838,7 +7666,7 @@ function Menu(props) {
|
|
|
7838
7666
|
onCleanup(() => {
|
|
7839
7667
|
if (parentMenuContext !== void 0)
|
|
7840
7668
|
return;
|
|
7841
|
-
optionalMenubarContext
|
|
7669
|
+
optionalMenubarContext?.unregisterMenu(rootContext.value());
|
|
7842
7670
|
});
|
|
7843
7671
|
const dataset = createMemo(() => ({
|
|
7844
7672
|
"data-expanded": disclosureState.isOpen() ? "" : void 0,
|
|
@@ -7871,7 +7699,7 @@ function Menu(props) {
|
|
|
7871
7699
|
setPointerGraceTimeoutId: (id) => pointerGraceTimeoutId = id,
|
|
7872
7700
|
setPointerGraceIntent: (intent) => pointerGraceIntent = intent,
|
|
7873
7701
|
registerNestedMenu,
|
|
7874
|
-
registerItemToParentDomCollection: parentDomCollectionContext
|
|
7702
|
+
registerItemToParentDomCollection: parentDomCollectionContext?.registerItem,
|
|
7875
7703
|
registerTriggerId: createRegisterId(setTriggerId),
|
|
7876
7704
|
registerContentId: createRegisterId(setContentId)
|
|
7877
7705
|
};
|
|
@@ -7931,8 +7759,7 @@ function MenuSubContent(props) {
|
|
|
7931
7759
|
e2.preventDefault();
|
|
7932
7760
|
};
|
|
7933
7761
|
const onFocusOutside = (e2) => {
|
|
7934
|
-
|
|
7935
|
-
(_a = local.onFocusOutside) == null ? void 0 : _a.call(local, e2);
|
|
7762
|
+
local.onFocusOutside?.(e2);
|
|
7936
7763
|
const target = e2.target;
|
|
7937
7764
|
if (!contains(context.triggerRef(), target)) {
|
|
7938
7765
|
context.close();
|
|
@@ -8006,36 +7833,35 @@ function MenuSubTrigger(props) {
|
|
|
8006
7833
|
}
|
|
8007
7834
|
};
|
|
8008
7835
|
const onPointerMove = (e2) => {
|
|
8009
|
-
var _a;
|
|
8010
7836
|
callHandler(e2, local.onPointerMove);
|
|
8011
7837
|
if (e2.pointerType !== "mouse") {
|
|
8012
7838
|
return;
|
|
8013
7839
|
}
|
|
8014
7840
|
const parentMenuContext = context.parentMenuContext();
|
|
8015
|
-
parentMenuContext
|
|
7841
|
+
parentMenuContext?.onItemEnter(e2);
|
|
8016
7842
|
if (e2.defaultPrevented) {
|
|
8017
7843
|
return;
|
|
8018
7844
|
}
|
|
8019
7845
|
if (local.disabled) {
|
|
8020
|
-
parentMenuContext
|
|
7846
|
+
parentMenuContext?.onItemLeave(e2);
|
|
8021
7847
|
return;
|
|
8022
7848
|
}
|
|
8023
7849
|
if (!context.isOpen() && !openTimeoutId) {
|
|
8024
|
-
|
|
7850
|
+
context.parentMenuContext()?.setPointerGraceIntent(null);
|
|
8025
7851
|
openTimeoutId = window.setTimeout(() => {
|
|
8026
7852
|
context.open(false);
|
|
8027
7853
|
clearOpenTimeout();
|
|
8028
7854
|
}, 100);
|
|
8029
7855
|
}
|
|
8030
|
-
parentMenuContext
|
|
7856
|
+
parentMenuContext?.onItemEnter(e2);
|
|
8031
7857
|
if (!e2.defaultPrevented) {
|
|
8032
7858
|
if (context.listState().selectionManager().isFocused()) {
|
|
8033
7859
|
context.listState().selectionManager().setFocused(false);
|
|
8034
7860
|
context.listState().selectionManager().setFocusedKey(void 0);
|
|
8035
7861
|
}
|
|
8036
7862
|
focusWithoutScrolling(e2.currentTarget);
|
|
8037
|
-
parentMenuContext
|
|
8038
|
-
parentMenuContext
|
|
7863
|
+
parentMenuContext?.listState().selectionManager().setFocused(true);
|
|
7864
|
+
parentMenuContext?.listState().selectionManager().setFocusedKey(key());
|
|
8039
7865
|
}
|
|
8040
7866
|
};
|
|
8041
7867
|
const onPointerLeave = (e2) => {
|
|
@@ -8047,24 +7873,24 @@ function MenuSubTrigger(props) {
|
|
|
8047
7873
|
const parentMenuContext = context.parentMenuContext();
|
|
8048
7874
|
const contentEl = context.contentRef();
|
|
8049
7875
|
if (contentEl) {
|
|
8050
|
-
parentMenuContext
|
|
7876
|
+
parentMenuContext?.setPointerGraceIntent({
|
|
8051
7877
|
area: getPointerGraceArea(context.currentPlacement(), e2, contentEl),
|
|
8052
7878
|
// Safe because sub menu always open "left" or "right".
|
|
8053
7879
|
side: context.currentPlacement().split("-")[0]
|
|
8054
7880
|
});
|
|
8055
|
-
window.clearTimeout(parentMenuContext
|
|
7881
|
+
window.clearTimeout(parentMenuContext?.pointerGraceTimeoutId());
|
|
8056
7882
|
const pointerGraceTimeoutId = window.setTimeout(() => {
|
|
8057
|
-
parentMenuContext
|
|
7883
|
+
parentMenuContext?.setPointerGraceIntent(null);
|
|
8058
7884
|
}, 300);
|
|
8059
|
-
parentMenuContext
|
|
7885
|
+
parentMenuContext?.setPointerGraceTimeoutId(pointerGraceTimeoutId);
|
|
8060
7886
|
} else {
|
|
8061
|
-
parentMenuContext
|
|
7887
|
+
parentMenuContext?.onTriggerLeave(e2);
|
|
8062
7888
|
if (e2.defaultPrevented) {
|
|
8063
7889
|
return;
|
|
8064
7890
|
}
|
|
8065
|
-
parentMenuContext
|
|
7891
|
+
parentMenuContext?.setPointerGraceIntent(null);
|
|
8066
7892
|
}
|
|
8067
|
-
parentMenuContext
|
|
7893
|
+
parentMenuContext?.onItemLeave(e2);
|
|
8068
7894
|
};
|
|
8069
7895
|
const onKeyDown = (e2) => {
|
|
8070
7896
|
callHandler(e2, local.onKeyDown);
|
|
@@ -8088,7 +7914,6 @@ function MenuSubTrigger(props) {
|
|
|
8088
7914
|
}
|
|
8089
7915
|
};
|
|
8090
7916
|
createEffect(() => {
|
|
8091
|
-
var _a, _b, _c;
|
|
8092
7917
|
if (context.registerItemToParentDomCollection == null) {
|
|
8093
7918
|
throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");
|
|
8094
7919
|
}
|
|
@@ -8096,19 +7921,15 @@ function MenuSubTrigger(props) {
|
|
|
8096
7921
|
ref: () => ref,
|
|
8097
7922
|
type: "item",
|
|
8098
7923
|
key: key(),
|
|
8099
|
-
textValue:
|
|
8100
|
-
disabled:
|
|
7924
|
+
textValue: local.textValue ?? ref?.textContent ?? "",
|
|
7925
|
+
disabled: local.disabled ?? false
|
|
8101
7926
|
});
|
|
8102
7927
|
onCleanup(unregister);
|
|
8103
7928
|
});
|
|
8104
|
-
createEffect(on(() => {
|
|
8105
|
-
var _a;
|
|
8106
|
-
return (_a = context.parentMenuContext()) == null ? void 0 : _a.pointerGraceTimeoutId();
|
|
8107
|
-
}, (pointerGraceTimer) => {
|
|
7929
|
+
createEffect(on(() => context.parentMenuContext()?.pointerGraceTimeoutId(), (pointerGraceTimer) => {
|
|
8108
7930
|
onCleanup(() => {
|
|
8109
|
-
var _a;
|
|
8110
7931
|
window.clearTimeout(pointerGraceTimer);
|
|
8111
|
-
|
|
7932
|
+
context.parentMenuContext()?.setPointerGraceIntent(null);
|
|
8112
7933
|
});
|
|
8113
7934
|
}));
|
|
8114
7935
|
createEffect(() => onCleanup(context.registerTriggerId(local.id)));
|
|
@@ -8183,30 +8004,15 @@ function MenuRoot(props) {
|
|
|
8183
8004
|
const disclosureState = createDisclosureState({
|
|
8184
8005
|
open: () => local.open,
|
|
8185
8006
|
defaultOpen: () => local.defaultOpen,
|
|
8186
|
-
onOpenChange: (isOpen) =>
|
|
8187
|
-
var _a;
|
|
8188
|
-
return (_a = local.onOpenChange) == null ? void 0 : _a.call(local, isOpen);
|
|
8189
|
-
}
|
|
8007
|
+
onOpenChange: (isOpen) => local.onOpenChange?.(isOpen)
|
|
8190
8008
|
});
|
|
8191
8009
|
const context = {
|
|
8192
|
-
isModal: () =>
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
},
|
|
8196
|
-
preventScroll: () => {
|
|
8197
|
-
var _a;
|
|
8198
|
-
return (_a = local.preventScroll) != null ? _a : context.isModal();
|
|
8199
|
-
},
|
|
8200
|
-
forceMount: () => {
|
|
8201
|
-
var _a;
|
|
8202
|
-
return (_a = local.forceMount) != null ? _a : false;
|
|
8203
|
-
},
|
|
8010
|
+
isModal: () => local.modal ?? true,
|
|
8011
|
+
preventScroll: () => local.preventScroll ?? context.isModal(),
|
|
8012
|
+
forceMount: () => local.forceMount ?? false,
|
|
8204
8013
|
generateId: createGenerateId(() => local.id),
|
|
8205
8014
|
value: () => local.value,
|
|
8206
|
-
orientation: () =>
|
|
8207
|
-
var _a, _b;
|
|
8208
|
-
return (_b = (_a = local.orientation) != null ? _a : optionalMenubarContext == null ? void 0 : optionalMenubarContext.orientation()) != null ? _b : "horizontal";
|
|
8209
|
-
}
|
|
8015
|
+
orientation: () => local.orientation ?? optionalMenubarContext?.orientation() ?? "horizontal"
|
|
8210
8016
|
};
|
|
8211
8017
|
return createComponent(MenuRootContext.Provider, {
|
|
8212
8018
|
value: context,
|
|
@@ -8281,8 +8087,7 @@ function DropdownMenuContent(props) {
|
|
|
8281
8087
|
const [local, others] = splitProps(props, ["onCloseAutoFocus", "onInteractOutside"]);
|
|
8282
8088
|
let hasInteractedOutside = false;
|
|
8283
8089
|
const onCloseAutoFocus = (e2) => {
|
|
8284
|
-
|
|
8285
|
-
(_a = local.onCloseAutoFocus) == null ? void 0 : _a.call(local, e2);
|
|
8090
|
+
local.onCloseAutoFocus?.(e2);
|
|
8286
8091
|
if (!hasInteractedOutside) {
|
|
8287
8092
|
focusWithoutScrolling(context.triggerRef());
|
|
8288
8093
|
}
|
|
@@ -8290,8 +8095,7 @@ function DropdownMenuContent(props) {
|
|
|
8290
8095
|
e2.preventDefault();
|
|
8291
8096
|
};
|
|
8292
8097
|
const onInteractOutside = (e2) => {
|
|
8293
|
-
|
|
8294
|
-
(_a = local.onInteractOutside) == null ? void 0 : _a.call(local, e2);
|
|
8098
|
+
local.onInteractOutside?.(e2);
|
|
8295
8099
|
if (!rootContext.isModal() || e2.detail.isContextMenu) {
|
|
8296
8100
|
hasInteractedOutside = true;
|
|
8297
8101
|
}
|
|
@@ -8925,7 +8729,6 @@ function isIterable(x) {
|
|
|
8925
8729
|
return Symbol.iterator in x;
|
|
8926
8730
|
}
|
|
8927
8731
|
function Explorer(props) {
|
|
8928
|
-
var _a;
|
|
8929
8732
|
const theme = useTheme();
|
|
8930
8733
|
const css = useQueryDevtoolsContext().shadowDOMTarget ? u.bind({
|
|
8931
8734
|
target: useQueryDevtoolsContext().shadowDOMTarget
|
|
@@ -8973,7 +8776,7 @@ function Explorer(props) {
|
|
|
8973
8776
|
return typeof props.value;
|
|
8974
8777
|
});
|
|
8975
8778
|
const subEntryPages = createMemo(() => chunkArray(subEntries(), 100));
|
|
8976
|
-
const currentDataPath =
|
|
8779
|
+
const currentDataPath = props.dataPath ?? [];
|
|
8977
8780
|
return (() => {
|
|
8978
8781
|
var _el$6 = _tmpl$72();
|
|
8979
8782
|
insert(_el$6, createComponent(Show, {
|
|
@@ -9037,8 +8840,7 @@ function Explorer(props) {
|
|
|
9037
8840
|
get children() {
|
|
9038
8841
|
var _el$15 = _tmpl$62();
|
|
9039
8842
|
_el$15.$$click = () => {
|
|
9040
|
-
|
|
9041
|
-
(_a2 = props.onEdit) == null ? void 0 : _a2.call(props);
|
|
8843
|
+
props.onEdit?.();
|
|
9042
8844
|
};
|
|
9043
8845
|
insert(_el$15, createComponent(Pencil, {}));
|
|
9044
8846
|
createRenderEffect(() => className(_el$15, styles().actionButton));
|
|
@@ -9491,10 +9293,7 @@ var Devtools = (props) => {
|
|
|
9491
9293
|
window.removeEventListener("focus", onFocus);
|
|
9492
9294
|
});
|
|
9493
9295
|
});
|
|
9494
|
-
const pip_open = createMemo(() =>
|
|
9495
|
-
var _a;
|
|
9496
|
-
return (_a = props.localStore.pip_open) != null ? _a : "false";
|
|
9497
|
-
});
|
|
9296
|
+
const pip_open = createMemo(() => props.localStore.pip_open ?? "false");
|
|
9498
9297
|
return [createComponent(Show, {
|
|
9499
9298
|
get when() {
|
|
9500
9299
|
return createMemo(() => !!pip().pipWindow)() && pip_open() == "true";
|
|
@@ -9502,8 +9301,7 @@ var Devtools = (props) => {
|
|
|
9502
9301
|
get children() {
|
|
9503
9302
|
return createComponent(Portal, {
|
|
9504
9303
|
get mount() {
|
|
9505
|
-
|
|
9506
|
-
return (_a = pip().pipWindow) == null ? void 0 : _a.document.body;
|
|
9304
|
+
return pip().pipWindow?.document.body;
|
|
9507
9305
|
},
|
|
9508
9306
|
get children() {
|
|
9509
9307
|
return createComponent(PiPPanel, {
|
|
@@ -9759,8 +9557,7 @@ var DraggablePanel = (props) => {
|
|
|
9759
9557
|
});
|
|
9760
9558
|
});
|
|
9761
9559
|
createEffect(() => {
|
|
9762
|
-
|
|
9763
|
-
const rootContainer = (_b = (_a = panelRef.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement;
|
|
9560
|
+
const rootContainer = panelRef.parentElement?.parentElement?.parentElement;
|
|
9764
9561
|
if (!rootContainer)
|
|
9765
9562
|
return;
|
|
9766
9563
|
const currentPosition = props.localStore.position || POSITION;
|
|
@@ -10060,8 +9857,7 @@ var ContentView = (props) => {
|
|
|
10060
9857
|
get children() {
|
|
10061
9858
|
var _el$30 = _tmpl$83();
|
|
10062
9859
|
_el$30.$$click = () => {
|
|
10063
|
-
|
|
10064
|
-
pip().requestPipWindow(Number(window.innerWidth), Number((_a = props.localStore.height) != null ? _a : 500));
|
|
9860
|
+
pip().requestPipWindow(Number(window.innerWidth), Number(props.localStore.height ?? 500));
|
|
10065
9861
|
};
|
|
10066
9862
|
insert(_el$30, createComponent(PiPIcon, {}));
|
|
10067
9863
|
createRenderEffect(() => className(_el$30, clsx(styles().actionsBtn, "tsqd-actions-btn", "tsqd-action-open-pip")));
|
|
@@ -10366,30 +10162,18 @@ var QueryRow = (props) => {
|
|
|
10366
10162
|
alpha
|
|
10367
10163
|
} = tokens;
|
|
10368
10164
|
const t2 = (light, dark) => theme() === "dark" ? dark : light;
|
|
10369
|
-
const queryState = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
}, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10375
|
-
const
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
}, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10381
|
-
const isStale = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
10382
|
-
var _a, _b;
|
|
10383
|
-
return (_b = (_a = queryCache().find({
|
|
10384
|
-
queryKey: props.query.queryKey
|
|
10385
|
-
})) == null ? void 0 : _a.isStale()) != null ? _b : false;
|
|
10386
|
-
}, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10387
|
-
const observers = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
10388
|
-
var _a, _b;
|
|
10389
|
-
return (_b = (_a = queryCache().find({
|
|
10390
|
-
queryKey: props.query.queryKey
|
|
10391
|
-
})) == null ? void 0 : _a.getObserversCount()) != null ? _b : 0;
|
|
10392
|
-
}, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10165
|
+
const queryState = createSubscribeToQueryCacheBatcher((queryCache) => queryCache().find({
|
|
10166
|
+
queryKey: props.query.queryKey
|
|
10167
|
+
})?.state, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10168
|
+
const isDisabled = createSubscribeToQueryCacheBatcher((queryCache) => queryCache().find({
|
|
10169
|
+
queryKey: props.query.queryKey
|
|
10170
|
+
})?.isDisabled() ?? false, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10171
|
+
const isStale = createSubscribeToQueryCacheBatcher((queryCache) => queryCache().find({
|
|
10172
|
+
queryKey: props.query.queryKey
|
|
10173
|
+
})?.isStale() ?? false, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10174
|
+
const observers = createSubscribeToQueryCacheBatcher((queryCache) => queryCache().find({
|
|
10175
|
+
queryKey: props.query.queryKey
|
|
10176
|
+
})?.getObserversCount() ?? 0, true, (e2) => e2.query.queryHash === props.query.queryHash);
|
|
10393
10177
|
const color = createMemo(() => getQueryStatusColor({
|
|
10394
10178
|
queryState: queryState(),
|
|
10395
10179
|
observerCount: observers(),
|
|
@@ -10455,7 +10239,7 @@ var MutationRow = (props) => {
|
|
|
10455
10239
|
const mutationState = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
10456
10240
|
const mutations = mutationCache().getAll();
|
|
10457
10241
|
const mutation = mutations.find((m) => m.mutationId === props.mutation.mutationId);
|
|
10458
|
-
return mutation
|
|
10242
|
+
return mutation?.state;
|
|
10459
10243
|
});
|
|
10460
10244
|
const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
10461
10245
|
const mutations = mutationCache().getAll();
|
|
@@ -10783,13 +10567,9 @@ var QueryDetails = () => {
|
|
|
10783
10567
|
const activeQueryFresh = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
10784
10568
|
return queryCache().getAll().find((query) => query.queryHash === selectedQueryHash());
|
|
10785
10569
|
}, false);
|
|
10786
|
-
const activeQueryState = createSubscribeToQueryCacheBatcher((queryCache) =>
|
|
10787
|
-
var _a;
|
|
10788
|
-
return (_a = queryCache().getAll().find((query) => query.queryHash === selectedQueryHash())) == null ? void 0 : _a.state;
|
|
10789
|
-
}, false);
|
|
10570
|
+
const activeQueryState = createSubscribeToQueryCacheBatcher((queryCache) => queryCache().getAll().find((query) => query.queryHash === selectedQueryHash())?.state, false);
|
|
10790
10571
|
const activeQueryStateData = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
10791
|
-
|
|
10792
|
-
return (_a = queryCache().getAll().find((query) => query.queryHash === selectedQueryHash())) == null ? void 0 : _a.state.data;
|
|
10572
|
+
return queryCache().getAll().find((query) => query.queryHash === selectedQueryHash())?.state.data;
|
|
10793
10573
|
}, false);
|
|
10794
10574
|
const statusLabel = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
10795
10575
|
const query = queryCache().getAll().find((q) => q.queryHash === selectedQueryHash());
|
|
@@ -10803,20 +10583,15 @@ var QueryDetails = () => {
|
|
|
10803
10583
|
return "pending";
|
|
10804
10584
|
return query.state.status;
|
|
10805
10585
|
});
|
|
10806
|
-
const observerCount = createSubscribeToQueryCacheBatcher((queryCache) =>
|
|
10807
|
-
var _a, _b;
|
|
10808
|
-
return (_b = (_a = queryCache().getAll().find((query) => query.queryHash === selectedQueryHash())) == null ? void 0 : _a.getObserversCount()) != null ? _b : 0;
|
|
10809
|
-
});
|
|
10586
|
+
const observerCount = createSubscribeToQueryCacheBatcher((queryCache) => queryCache().getAll().find((query) => query.queryHash === selectedQueryHash())?.getObserversCount() ?? 0);
|
|
10810
10587
|
const color = createMemo(() => getQueryStatusColorByLabel(statusLabel()));
|
|
10811
10588
|
const handleRefetch = () => {
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
promise == null ? void 0 : promise.catch(() => {
|
|
10589
|
+
const promise = activeQuery()?.fetch();
|
|
10590
|
+
promise?.catch(() => {
|
|
10815
10591
|
});
|
|
10816
10592
|
};
|
|
10817
10593
|
const triggerError = (errorType) => {
|
|
10818
|
-
|
|
10819
|
-
const error = (_a = errorType == null ? void 0 : errorType.initializer(activeQuery())) != null ? _a : new Error("Unknown error from devtools");
|
|
10594
|
+
const error = errorType?.initializer(activeQuery()) ?? new Error("Unknown error from devtools");
|
|
10820
10595
|
const __previousQueryOptions = activeQuery().options;
|
|
10821
10596
|
activeQuery().setState({
|
|
10822
10597
|
status: "error",
|
|
@@ -10882,8 +10657,7 @@ var QueryDetails = () => {
|
|
|
10882
10657
|
setSelectedQueryHash(null);
|
|
10883
10658
|
};
|
|
10884
10659
|
_el$86.$$click = () => {
|
|
10885
|
-
|
|
10886
|
-
if (((_a = activeQuery()) == null ? void 0 : _a.state.data) === void 0) {
|
|
10660
|
+
if (activeQuery()?.state.data === void 0) {
|
|
10887
10661
|
setRestoringLoading(true);
|
|
10888
10662
|
restoreQueryAfterLoadingOrError();
|
|
10889
10663
|
} else {
|