@vitejs/devtools 0.1.0 → 0.1.1
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/DockIcon-BtMEW4VE.js +97 -0
- package/dist/{DockStandalone-Dd6Dcd5B.js → DockStandalone-CZAqITKs.js} +4 -4
- package/dist/{LogItem-CfTxUV6A.js → LogItem-BTrEubKY.js} +2 -1
- package/dist/{ToastOverlay-BVErqkif.js → ToastOverlay-DO3Kl_rY.js} +14 -7
- package/dist/{ViewBuiltinLogs-DQLxnQ1c.js → ViewBuiltinLogs-BL373XPJ.js} +3 -2
- package/dist/{ViewBuiltinTerminals-B83FB-cT.js → ViewBuiltinTerminals-DdpE1Ftb.js} +4 -2
- package/dist/ViewJsonRender-coidkW9b.js +6835 -0
- package/dist/{cli-commands-DRp01A04.js → cli-commands-BRswBnHn.js} +5 -3
- package/dist/cli-commands.js +2 -2
- package/dist/cli.js +2 -2
- package/dist/client/inject.js +3 -2
- package/dist/client/standalone/assets/DockStandalone-DDaYjGO1.js +1 -0
- package/dist/client/standalone/assets/LogItem-CKbVrExA.js +1 -0
- package/dist/client/standalone/assets/ViewBuiltinLogs-9oWDdl1G.js +1 -0
- package/dist/client/standalone/assets/{ViewBuiltinTerminals-Dkd5qdlN.js → ViewBuiltinTerminals-CpexS-ib.js} +2 -2
- package/dist/client/standalone/assets/ViewJsonRender-CKPzRgqQ.js +43 -0
- package/dist/client/standalone/assets/dist-JpCJ4ieR.js +1 -0
- package/dist/client/standalone/assets/iconify-C-CPDXMf.js +2 -0
- package/dist/client/standalone/assets/index-3wlMt-60.js +3 -0
- package/dist/client/standalone/assets/runtime-core.esm-bundler-oO31W4LZ.js +1 -0
- package/dist/client/standalone/index.html +5 -3
- package/dist/client/webcomponents.js +6 -4
- package/dist/config.js +1 -1
- package/dist/dist-Cgqg5_oP.js +1113 -0
- package/dist/{DockIcon-Jbdv1CYn.js → iconify-YyqAMHKf.js} +1 -96
- package/dist/index.js +1 -1
- package/dist/{plugins-6tW2SoNv.js → plugins-Cvy_lJ0L.js} +23 -3
- package/dist/{popup-EDv_a9nQ.js → popup-ffZHGm5D.js} +2 -2
- package/dist/utils-Csuu5uNf.js +10 -0
- package/dist/{dist-3NIYLDlS.js → vue.runtime.esm-bundler-D2MZbyFr.js} +74 -1185
- package/package.json +9 -6
- package/dist/client/standalone/assets/DockStandalone-B8W-HO8N.js +0 -1
- package/dist/client/standalone/assets/LogItem-B-ayIBi6.js +0 -1
- package/dist/client/standalone/assets/ViewBuiltinLogs-B8M7lPbt.js +0 -1
- package/dist/client/standalone/assets/dist-ZC9UAo6H.js +0 -1
- package/dist/client/standalone/assets/index-odNIfapG.js +0 -4
- package/dist/utils--qjmgani.js +0 -6
|
@@ -30,9 +30,9 @@ const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
|
30
30
|
const isFunction = (val) => typeof val === "function";
|
|
31
31
|
const isString = (val) => typeof val === "string";
|
|
32
32
|
const isSymbol = (val) => typeof val === "symbol";
|
|
33
|
-
const isObject
|
|
33
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
34
34
|
const isPromise = (val) => {
|
|
35
|
-
return (isObject
|
|
35
|
+
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
|
36
36
|
};
|
|
37
37
|
const objectToString = Object.prototype.toString;
|
|
38
38
|
const toTypeString = (value) => objectToString.call(value);
|
|
@@ -43,22 +43,22 @@ const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
|
43
43
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
44
44
|
const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
45
45
|
const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
46
|
-
const cacheStringFunction
|
|
46
|
+
const cacheStringFunction = (fn) => {
|
|
47
47
|
const cache = /* @__PURE__ */ Object.create(null);
|
|
48
48
|
return ((str) => {
|
|
49
49
|
return cache[str] || (cache[str] = fn(str));
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
const camelizeRE
|
|
53
|
-
const camelize
|
|
54
|
-
return str.replace(camelizeRE
|
|
52
|
+
const camelizeRE = /-\w/g;
|
|
53
|
+
const camelize = cacheStringFunction((str) => {
|
|
54
|
+
return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
|
|
55
55
|
});
|
|
56
|
-
const hyphenateRE
|
|
57
|
-
const hyphenate
|
|
58
|
-
const capitalize = cacheStringFunction
|
|
56
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
57
|
+
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
58
|
+
const capitalize = cacheStringFunction((str) => {
|
|
59
59
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
60
60
|
});
|
|
61
|
-
const toHandlerKey = cacheStringFunction
|
|
61
|
+
const toHandlerKey = cacheStringFunction((str) => {
|
|
62
62
|
return str ? `on${capitalize(str)}` : ``;
|
|
63
63
|
});
|
|
64
64
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
@@ -94,7 +94,7 @@ function normalizeStyle(value) {
|
|
|
94
94
|
if (normalized) for (const key in normalized) res[key] = normalized[key];
|
|
95
95
|
}
|
|
96
96
|
return res;
|
|
97
|
-
} else if (isString(value) || isObject
|
|
97
|
+
} else if (isString(value) || isObject(value)) return value;
|
|
98
98
|
}
|
|
99
99
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
100
100
|
const propertyDelimiterRE = /:([^]+)/;
|
|
@@ -116,7 +116,7 @@ function normalizeClass(value) {
|
|
|
116
116
|
const normalized = normalizeClass(value[i]);
|
|
117
117
|
if (normalized) res += normalized + " ";
|
|
118
118
|
}
|
|
119
|
-
else if (isObject
|
|
119
|
+
else if (isObject(value)) {
|
|
120
120
|
for (const name in value) if (value[name]) res += name + " ";
|
|
121
121
|
}
|
|
122
122
|
return res.trim();
|
|
@@ -150,8 +150,8 @@ function looseEqual(a, b) {
|
|
|
150
150
|
aValidType = isArray(a);
|
|
151
151
|
bValidType = isArray(b);
|
|
152
152
|
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
|
153
|
-
aValidType = isObject
|
|
154
|
-
bValidType = isObject
|
|
153
|
+
aValidType = isObject(a);
|
|
154
|
+
bValidType = isObject(b);
|
|
155
155
|
if (aValidType || bValidType) {
|
|
156
156
|
if (!aValidType || !bValidType) return false;
|
|
157
157
|
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
@@ -167,7 +167,7 @@ const isRef$1 = (val) => {
|
|
|
167
167
|
return !!(val && val["__v_isRef"] === true);
|
|
168
168
|
};
|
|
169
169
|
const toDisplayString = (val) => {
|
|
170
|
-
return isString(val) ? val : val == null ? "" : isArray(val) || isObject
|
|
170
|
+
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
|
|
171
171
|
};
|
|
172
172
|
const replacer = (_key, val) => {
|
|
173
173
|
if (isRef$1(val)) return replacer(_key, val.value);
|
|
@@ -177,7 +177,7 @@ const replacer = (_key, val) => {
|
|
|
177
177
|
}, {}) };
|
|
178
178
|
else if (isSet(val)) return { [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) };
|
|
179
179
|
else if (isSymbol(val)) return stringifySymbol(val);
|
|
180
|
-
else if (isObject
|
|
180
|
+
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) return String(val);
|
|
181
181
|
return val;
|
|
182
182
|
};
|
|
183
183
|
const stringifySymbol = (v, i = "") => {
|
|
@@ -939,9 +939,9 @@ var BaseReactiveHandler = class {
|
|
|
939
939
|
if (isShallow2) return res;
|
|
940
940
|
if (/* @__PURE__ */ isRef(res)) {
|
|
941
941
|
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
942
|
-
return isReadonly2 && isObject
|
|
942
|
+
return isReadonly2 && isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
943
943
|
}
|
|
944
|
-
if (isObject
|
|
944
|
+
if (isObject(res)) return isReadonly2 ? /* @__PURE__ */ readonly(res) : /* @__PURE__ */ reactive(res);
|
|
945
945
|
return res;
|
|
946
946
|
}
|
|
947
947
|
};
|
|
@@ -1203,7 +1203,7 @@ function shallowReadonly(target) {
|
|
|
1203
1203
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
1204
1204
|
}
|
|
1205
1205
|
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1206
|
-
if (!isObject
|
|
1206
|
+
if (!isObject(target)) {
|
|
1207
1207
|
if (!!(process.env.NODE_ENV !== "production")) warn$2(`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(target)}`);
|
|
1208
1208
|
return target;
|
|
1209
1209
|
}
|
|
@@ -1242,8 +1242,8 @@ function markRaw(value) {
|
|
|
1242
1242
|
if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) def(value, "__v_skip", true);
|
|
1243
1243
|
return value;
|
|
1244
1244
|
}
|
|
1245
|
-
const toReactive = (value) => isObject
|
|
1246
|
-
const toReadonly = (value) => isObject
|
|
1245
|
+
const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
|
|
1246
|
+
const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1247
1247
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1248
1248
|
function isRef(r) {
|
|
1249
1249
|
return r ? r["__v_isRef"] === true : false;
|
|
@@ -1387,10 +1387,10 @@ var GetterRefImpl = class {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
};
|
|
1389
1389
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1390
|
-
function toRef
|
|
1390
|
+
function toRef(source, key, defaultValue) {
|
|
1391
1391
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1392
1392
|
else if (isFunction(source)) return new GetterRefImpl(source);
|
|
1393
|
-
else if (isObject
|
|
1393
|
+
else if (isObject(source) && arguments.length > 1) return propertyToRef(source, key, defaultValue);
|
|
1394
1394
|
else return /* @__PURE__ */ ref(source);
|
|
1395
1395
|
}
|
|
1396
1396
|
function propertyToRef(source, key, defaultValue) {
|
|
@@ -1606,7 +1606,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
|
1606
1606
|
return watchHandle;
|
|
1607
1607
|
}
|
|
1608
1608
|
function traverse(value, depth = Infinity, seen) {
|
|
1609
|
-
if (depth <= 0 || !isObject
|
|
1609
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) return value;
|
|
1610
1610
|
seen = seen || /* @__PURE__ */ new Map();
|
|
1611
1611
|
if ((seen.get(value) || 0) >= depth) return value;
|
|
1612
1612
|
seen.set(value, depth);
|
|
@@ -2615,7 +2615,7 @@ function defineAsyncComponent(source) {
|
|
|
2615
2615
|
if (thisRequest !== pendingRequest && pendingRequest) return pendingRequest;
|
|
2616
2616
|
if (!!(process.env.NODE_ENV !== "production") && !comp) warn$1(`Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`);
|
|
2617
2617
|
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) comp = comp.default;
|
|
2618
|
-
if (!!(process.env.NODE_ENV !== "production") && comp && !isObject
|
|
2618
|
+
if (!!(process.env.NODE_ENV !== "production") && comp && !isObject(comp) && !isFunction(comp)) throw new Error(`Invalid async component load result: ${comp}`);
|
|
2619
2619
|
resolvedComp = comp;
|
|
2620
2620
|
return comp;
|
|
2621
2621
|
}));
|
|
@@ -2778,7 +2778,7 @@ function renderList(source, renderItem, cache, index) {
|
|
|
2778
2778
|
ret = new Array(source);
|
|
2779
2779
|
for (let i = 0; i < source; i++) ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
|
2780
2780
|
}
|
|
2781
|
-
else if (isObject
|
|
2781
|
+
else if (isObject(source)) if (source[Symbol.iterator]) ret = Array.from(source, (item, i) => renderItem(item, i, void 0, cached && cached[i]));
|
|
2782
2782
|
else {
|
|
2783
2783
|
const keys = Object.keys(source);
|
|
2784
2784
|
ret = new Array(keys.length);
|
|
@@ -3016,7 +3016,7 @@ function applyOptions(instance) {
|
|
|
3016
3016
|
if (!!(process.env.NODE_ENV !== "production") && !isFunction(dataOptions)) warn$1(`The data option must be a function. Plain object usage is no longer supported.`);
|
|
3017
3017
|
const data = dataOptions.call(publicThis, publicThis);
|
|
3018
3018
|
if (!!(process.env.NODE_ENV !== "production") && isPromise(data)) warn$1(`data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`);
|
|
3019
|
-
if (!isObject
|
|
3019
|
+
if (!isObject(data)) process.env.NODE_ENV !== "production" && warn$1(`data() should return an object.`);
|
|
3020
3020
|
else {
|
|
3021
3021
|
instance.data = /* @__PURE__ */ reactive(data);
|
|
3022
3022
|
if (!!(process.env.NODE_ENV !== "production")) for (const key in data) {
|
|
@@ -3096,7 +3096,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
3096
3096
|
for (const key in injectOptions) {
|
|
3097
3097
|
const opt = injectOptions[key];
|
|
3098
3098
|
let injected;
|
|
3099
|
-
if (isObject
|
|
3099
|
+
if (isObject(opt)) if ("default" in opt) injected = inject(opt.from || key, opt.default, true);
|
|
3100
3100
|
else injected = inject(opt.from || key);
|
|
3101
3101
|
else injected = inject(opt);
|
|
3102
3102
|
if (/* @__PURE__ */ isRef(injected)) Object.defineProperty(ctx, key, {
|
|
@@ -3119,7 +3119,7 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
3119
3119
|
if (isFunction(handler)) watch(getter, handler);
|
|
3120
3120
|
else if (!!(process.env.NODE_ENV !== "production")) warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
3121
3121
|
} else if (isFunction(raw)) watch(getter, raw.bind(publicThis));
|
|
3122
|
-
else if (isObject
|
|
3122
|
+
else if (isObject(raw)) if (isArray(raw)) raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
3123
3123
|
else {
|
|
3124
3124
|
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
3125
3125
|
if (isFunction(handler)) watch(getter, handler, raw);
|
|
@@ -3140,7 +3140,7 @@ function resolveMergedOptions(instance) {
|
|
|
3140
3140
|
if (globalMixins.length) globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
3141
3141
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
3142
3142
|
}
|
|
3143
|
-
if (isObject
|
|
3143
|
+
if (isObject(base)) cache.set(base, resolved);
|
|
3144
3144
|
return resolved;
|
|
3145
3145
|
}
|
|
3146
3146
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -3242,7 +3242,7 @@ let uid$1 = 0;
|
|
|
3242
3242
|
function createAppAPI(render, hydrate) {
|
|
3243
3243
|
return function createApp(rootComponent, rootProps = null) {
|
|
3244
3244
|
if (!isFunction(rootComponent)) rootComponent = extend({}, rootComponent);
|
|
3245
|
-
if (rootProps != null && !isObject
|
|
3245
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
3246
3246
|
process.env.NODE_ENV !== "production" && warn$1(`root props passed to app.mount() must be an object.`);
|
|
3247
3247
|
rootProps = null;
|
|
3248
3248
|
}
|
|
@@ -3358,7 +3358,7 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
3358
3358
|
}
|
|
3359
3359
|
let currentApp = null;
|
|
3360
3360
|
const getModelModifiers = (props, modelName) => {
|
|
3361
|
-
return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize
|
|
3361
|
+
return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
|
|
3362
3362
|
};
|
|
3363
3363
|
function emit(instance, event, ...rawArgs) {
|
|
3364
3364
|
if (instance.isUnmounted) return;
|
|
@@ -3366,7 +3366,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
3366
3366
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3367
3367
|
const { emitsOptions, propsOptions: [propsOptions] } = instance;
|
|
3368
3368
|
if (emitsOptions) if (!(event in emitsOptions) && true) {
|
|
3369
|
-
if (!propsOptions || !(toHandlerKey(camelize
|
|
3369
|
+
if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) warn$1(`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`);
|
|
3370
3370
|
} else {
|
|
3371
3371
|
const validator = emitsOptions[event];
|
|
3372
3372
|
if (isFunction(validator)) {
|
|
@@ -3384,11 +3384,11 @@ function emit(instance, event, ...rawArgs) {
|
|
|
3384
3384
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentEmit(instance, event, args);
|
|
3385
3385
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3386
3386
|
const lowerCaseEvent = event.toLowerCase();
|
|
3387
|
-
if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) warn$1(`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate
|
|
3387
|
+
if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) warn$1(`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(event)}" instead of "${event}".`);
|
|
3388
3388
|
}
|
|
3389
3389
|
let handlerName;
|
|
3390
|
-
let handler = props[handlerName = toHandlerKey(event)] || props[handlerName = toHandlerKey(camelize
|
|
3391
|
-
if (!handler && isModelListener) handler = props[handlerName = toHandlerKey(hyphenate
|
|
3390
|
+
let handler = props[handlerName = toHandlerKey(event)] || props[handlerName = toHandlerKey(camelize(event))];
|
|
3391
|
+
if (!handler && isModelListener) handler = props[handlerName = toHandlerKey(hyphenate(event))];
|
|
3392
3392
|
if (handler) callWithAsyncErrorHandling(handler, instance, 6, args);
|
|
3393
3393
|
const onceHandler = props[handlerName + `Once`];
|
|
3394
3394
|
if (onceHandler) {
|
|
@@ -3419,18 +3419,18 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
3419
3419
|
if (comp.mixins) comp.mixins.forEach(extendEmits);
|
|
3420
3420
|
}
|
|
3421
3421
|
if (!raw && !hasExtends) {
|
|
3422
|
-
if (isObject
|
|
3422
|
+
if (isObject(comp)) cache.set(comp, null);
|
|
3423
3423
|
return null;
|
|
3424
3424
|
}
|
|
3425
3425
|
if (isArray(raw)) raw.forEach((key) => normalized[key] = null);
|
|
3426
3426
|
else extend(normalized, raw);
|
|
3427
|
-
if (isObject
|
|
3427
|
+
if (isObject(comp)) cache.set(comp, normalized);
|
|
3428
3428
|
return normalized;
|
|
3429
3429
|
}
|
|
3430
3430
|
function isEmitListener(options, key) {
|
|
3431
3431
|
if (!options || !isOn(key)) return false;
|
|
3432
3432
|
key = key.slice(2).replace(/Once$/, "");
|
|
3433
|
-
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate
|
|
3433
|
+
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
|
3434
3434
|
}
|
|
3435
3435
|
let accessedAttrs = false;
|
|
3436
3436
|
function markAttrsAccessed() {
|
|
@@ -3597,7 +3597,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
|
3597
3597
|
function hasPropValueChanged(nextProps, prevProps, key) {
|
|
3598
3598
|
const nextProp = nextProps[key];
|
|
3599
3599
|
const prevProp = prevProps[key];
|
|
3600
|
-
if (key === "style" && isObject
|
|
3600
|
+
if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
|
|
3601
3601
|
return nextProp !== prevProp;
|
|
3602
3602
|
}
|
|
3603
3603
|
function updateHOCHostEl({ vnode, parent }, el) {
|
|
@@ -3649,7 +3649,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3649
3649
|
hasAttrsChanged = true;
|
|
3650
3650
|
}
|
|
3651
3651
|
} else {
|
|
3652
|
-
const camelizedKey = camelize
|
|
3652
|
+
const camelizedKey = camelize(key);
|
|
3653
3653
|
props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false);
|
|
3654
3654
|
}
|
|
3655
3655
|
else if (value !== attrs[key]) {
|
|
@@ -3661,7 +3661,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3661
3661
|
} else {
|
|
3662
3662
|
if (setFullProps(instance, rawProps, props, attrs)) hasAttrsChanged = true;
|
|
3663
3663
|
let kebabKey;
|
|
3664
|
-
for (const key in rawCurrentProps) if (!rawProps || !hasOwn(rawProps, key) && ((kebabKey = hyphenate
|
|
3664
|
+
for (const key in rawCurrentProps) if (!rawProps || !hasOwn(rawProps, key) && ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) if (options) {
|
|
3665
3665
|
if (rawPrevProps && (rawPrevProps[key] !== void 0 || rawPrevProps[kebabKey] !== void 0)) props[key] = resolvePropValue(options, rawCurrentProps, key, void 0, instance, true);
|
|
3666
3666
|
} else delete props[key];
|
|
3667
3667
|
if (attrs !== rawCurrentProps) {
|
|
@@ -3682,7 +3682,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
3682
3682
|
if (isReservedProp(key)) continue;
|
|
3683
3683
|
const value = rawProps[key];
|
|
3684
3684
|
let camelKey;
|
|
3685
|
-
if (options && hasOwn(options, camelKey = camelize
|
|
3685
|
+
if (options && hasOwn(options, camelKey = camelize(key))) if (!needCastKeys || !needCastKeys.includes(camelKey)) props[camelKey] = value;
|
|
3686
3686
|
else (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
3687
3687
|
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
3688
3688
|
if (!(key in attrs) || value !== attrs[key]) {
|
|
@@ -3720,7 +3720,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3720
3720
|
}
|
|
3721
3721
|
if (opt[0]) {
|
|
3722
3722
|
if (isAbsent && !hasDefault) value = false;
|
|
3723
|
-
else if (opt[1] && (value === "" || value === hyphenate
|
|
3723
|
+
else if (opt[1] && (value === "" || value === hyphenate(key))) value = true;
|
|
3724
3724
|
}
|
|
3725
3725
|
}
|
|
3726
3726
|
return value;
|
|
@@ -3746,18 +3746,18 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3746
3746
|
if (comp.mixins) comp.mixins.forEach(extendProps);
|
|
3747
3747
|
}
|
|
3748
3748
|
if (!raw && !hasExtends) {
|
|
3749
|
-
if (isObject
|
|
3749
|
+
if (isObject(comp)) cache.set(comp, EMPTY_ARR);
|
|
3750
3750
|
return EMPTY_ARR;
|
|
3751
3751
|
}
|
|
3752
3752
|
if (isArray(raw)) for (let i = 0; i < raw.length; i++) {
|
|
3753
3753
|
if (!!(process.env.NODE_ENV !== "production") && !isString(raw[i])) warn$1(`props must be strings when using array syntax.`, raw[i]);
|
|
3754
|
-
const normalizedKey = camelize
|
|
3754
|
+
const normalizedKey = camelize(raw[i]);
|
|
3755
3755
|
if (validatePropName(normalizedKey)) normalized[normalizedKey] = EMPTY_OBJ;
|
|
3756
3756
|
}
|
|
3757
3757
|
else if (raw) {
|
|
3758
|
-
if (!!(process.env.NODE_ENV !== "production") && !isObject
|
|
3758
|
+
if (!!(process.env.NODE_ENV !== "production") && !isObject(raw)) warn$1(`invalid props options`, raw);
|
|
3759
3759
|
for (const key in raw) {
|
|
3760
|
-
const normalizedKey = camelize
|
|
3760
|
+
const normalizedKey = camelize(key);
|
|
3761
3761
|
if (validatePropName(normalizedKey)) {
|
|
3762
3762
|
const opt = raw[key];
|
|
3763
3763
|
const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
|
|
@@ -3780,7 +3780,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3780
3780
|
}
|
|
3781
3781
|
}
|
|
3782
3782
|
const res = [normalized, needCastKeys];
|
|
3783
|
-
if (isObject
|
|
3783
|
+
if (isObject(comp)) cache.set(comp, res);
|
|
3784
3784
|
return res;
|
|
3785
3785
|
}
|
|
3786
3786
|
function validatePropName(key) {
|
|
@@ -3797,7 +3797,7 @@ function getType(ctor) {
|
|
|
3797
3797
|
function validateProps(rawProps, props, instance) {
|
|
3798
3798
|
const resolvedValues = /* @__PURE__ */ toRaw(props);
|
|
3799
3799
|
const options = instance.propsOptions[0];
|
|
3800
|
-
const camelizePropsKey = Object.keys(rawProps).map((key) => camelize
|
|
3800
|
+
const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
|
|
3801
3801
|
for (const key in options) {
|
|
3802
3802
|
let opt = options[key];
|
|
3803
3803
|
if (opt == null) continue;
|
|
@@ -3836,7 +3836,7 @@ function assertType(value, type) {
|
|
|
3836
3836
|
const t = typeof value;
|
|
3837
3837
|
valid = t === expectedType.toLowerCase();
|
|
3838
3838
|
if (!valid && t === "object") valid = value instanceof type;
|
|
3839
|
-
} else if (expectedType === "Object") valid = isObject
|
|
3839
|
+
} else if (expectedType === "Object") valid = isObject(value);
|
|
3840
3840
|
else if (expectedType === "Array") valid = isArray(value);
|
|
3841
3841
|
else valid = value instanceof type;
|
|
3842
3842
|
return {
|
|
@@ -5169,12 +5169,12 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5169
5169
|
props = guardReactiveProps(props);
|
|
5170
5170
|
let { class: klass, style } = props;
|
|
5171
5171
|
if (klass && !isString(klass)) props.class = normalizeClass(klass);
|
|
5172
|
-
if (isObject
|
|
5172
|
+
if (isObject(style)) {
|
|
5173
5173
|
if (/* @__PURE__ */ isProxy(style) && !isArray(style)) style = extend({}, style);
|
|
5174
5174
|
props.style = normalizeStyle(style);
|
|
5175
5175
|
}
|
|
5176
5176
|
}
|
|
5177
|
-
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject
|
|
5177
|
+
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
|
5178
5178
|
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && /* @__PURE__ */ isProxy(type)) {
|
|
5179
5179
|
type = /* @__PURE__ */ toRaw(type);
|
|
5180
5180
|
warn$1(`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`, `
|
|
@@ -5474,7 +5474,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
5474
5474
|
function handleSetupResult(instance, setupResult, isSSR) {
|
|
5475
5475
|
if (isFunction(setupResult)) if (instance.type.__ssrInlineRender) instance.ssrRender = setupResult;
|
|
5476
5476
|
else instance.render = setupResult;
|
|
5477
|
-
else if (isObject
|
|
5477
|
+
else if (isObject(setupResult)) {
|
|
5478
5478
|
if (!!(process.env.NODE_ENV !== "production") && isVNode(setupResult)) warn$1(`setup() should not return VNodes directly - return a render function instead.`);
|
|
5479
5479
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) instance.devtoolsRawSetupState = setupResult;
|
|
5480
5480
|
instance.setupState = proxyRefs(setupResult);
|
|
@@ -5606,7 +5606,7 @@ function h(type, propsOrChildren, children) {
|
|
|
5606
5606
|
try {
|
|
5607
5607
|
setBlockTracking(-1);
|
|
5608
5608
|
const l = arguments.length;
|
|
5609
|
-
if (l === 2) if (isObject
|
|
5609
|
+
if (l === 2) if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
5610
5610
|
if (isVNode(propsOrChildren)) return createVNode(type, null, [propsOrChildren]);
|
|
5611
5611
|
return createVNode(type, propsOrChildren);
|
|
5612
5612
|
} else return createVNode(type, null, propsOrChildren);
|
|
@@ -5628,7 +5628,7 @@ function initCustomFormatter() {
|
|
|
5628
5628
|
const formatter = {
|
|
5629
5629
|
__vue_custom_formatter: true,
|
|
5630
5630
|
header(obj) {
|
|
5631
|
-
if (!isObject
|
|
5631
|
+
if (!isObject(obj)) return null;
|
|
5632
5632
|
if (obj.__isVue) return [
|
|
5633
5633
|
"div",
|
|
5634
5634
|
vueStyle,
|
|
@@ -5753,7 +5753,7 @@ function initCustomFormatter() {
|
|
|
5753
5753
|
keywordStyle,
|
|
5754
5754
|
v
|
|
5755
5755
|
];
|
|
5756
|
-
else if (isObject
|
|
5756
|
+
else if (isObject(v)) return ["object", { object: asRaw ? /* @__PURE__ */ toRaw(v) : v }];
|
|
5757
5757
|
else return [
|
|
5758
5758
|
"span",
|
|
5759
5759
|
stringStyle,
|
|
@@ -5769,7 +5769,7 @@ function initCustomFormatter() {
|
|
|
5769
5769
|
}
|
|
5770
5770
|
function isKeyOfType(Comp, key, type) {
|
|
5771
5771
|
const opts = Comp[type];
|
|
5772
|
-
if (isArray(opts) && opts.includes(key) || isObject
|
|
5772
|
+
if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) return true;
|
|
5773
5773
|
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) return true;
|
|
5774
5774
|
if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) return true;
|
|
5775
5775
|
}
|
|
@@ -5965,7 +5965,7 @@ function resolveTransitionProps(rawProps) {
|
|
|
5965
5965
|
}
|
|
5966
5966
|
function normalizeDuration(duration) {
|
|
5967
5967
|
if (duration == null) return null;
|
|
5968
|
-
else if (isObject
|
|
5968
|
+
else if (isObject(duration)) return [NumberOf(duration.enter), NumberOf(duration.leave)];
|
|
5969
5969
|
else {
|
|
5970
5970
|
const n = NumberOf(duration);
|
|
5971
5971
|
return [n, n];
|
|
@@ -6144,7 +6144,7 @@ function setStyle(style, name, val) {
|
|
|
6144
6144
|
if (name.startsWith("--")) style.setProperty(name, val);
|
|
6145
6145
|
else {
|
|
6146
6146
|
const prefixed = autoPrefix(style, name);
|
|
6147
|
-
if (importantRE.test(val)) style.setProperty(hyphenate
|
|
6147
|
+
if (importantRE.test(val)) style.setProperty(hyphenate(prefixed), val.replace(importantRE, ""), "important");
|
|
6148
6148
|
else style[prefixed] = val;
|
|
6149
6149
|
}
|
|
6150
6150
|
}
|
|
@@ -6158,7 +6158,7 @@ const prefixCache = {};
|
|
|
6158
6158
|
function autoPrefix(style, rawName) {
|
|
6159
6159
|
const cached = prefixCache[rawName];
|
|
6160
6160
|
if (cached) return cached;
|
|
6161
|
-
let name = camelize
|
|
6161
|
+
let name = camelize(rawName);
|
|
6162
6162
|
if (name !== "filter" && name in style) return prefixCache[rawName] = name;
|
|
6163
6163
|
name = capitalize(name);
|
|
6164
6164
|
for (let i = 0; i < prefixes.length; i++) {
|
|
@@ -6238,7 +6238,7 @@ function parseName(name) {
|
|
|
6238
6238
|
options[m[0].toLowerCase()] = true;
|
|
6239
6239
|
}
|
|
6240
6240
|
}
|
|
6241
|
-
return [name[2] === ":" ? name.slice(3) : hyphenate
|
|
6241
|
+
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
6242
6242
|
}
|
|
6243
6243
|
let cachedNow = 0;
|
|
6244
6244
|
const p = /* @__PURE__ */ Promise.resolve();
|
|
@@ -6279,7 +6279,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) =>
|
|
|
6279
6279
|
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
|
|
6280
6280
|
patchDOMProp(el, key, nextValue);
|
|
6281
6281
|
if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
|
|
6282
|
-
} else if (el._isVueCE && (shouldSetAsPropForVueCE(el, key) || el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))) patchDOMProp(el, camelize
|
|
6282
|
+
} else if (el._isVueCE && (shouldSetAsPropForVueCE(el, key) || el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))) patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
|
|
6283
6283
|
else {
|
|
6284
6284
|
if (key === "true-value") el._trueValue = nextValue;
|
|
6285
6285
|
else if (key === "false-value") el._falseValue = nextValue;
|
|
@@ -6307,8 +6307,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
6307
6307
|
function shouldSetAsPropForVueCE(el, key) {
|
|
6308
6308
|
const props = el._def.props;
|
|
6309
6309
|
if (!props) return false;
|
|
6310
|
-
const camelKey = camelize
|
|
6311
|
-
return Array.isArray(props) ? props.some((prop) => camelize
|
|
6310
|
+
const camelKey = camelize(key);
|
|
6311
|
+
return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
|
|
6312
6312
|
}
|
|
6313
6313
|
const REMOVAL = {};
|
|
6314
6314
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -6423,7 +6423,7 @@ var VueElement = class VueElement extends BaseClass {
|
|
|
6423
6423
|
const opt = props[key];
|
|
6424
6424
|
if (opt === Number || opt && opt.type === Number) {
|
|
6425
6425
|
if (key in this._props) this._props[key] = toNumber(this._props[key]);
|
|
6426
|
-
(numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize
|
|
6426
|
+
(numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
|
|
6427
6427
|
}
|
|
6428
6428
|
}
|
|
6429
6429
|
this._numberProps = numberProps;
|
|
@@ -6455,7 +6455,7 @@ var VueElement = class VueElement extends BaseClass {
|
|
|
6455
6455
|
const { props } = def;
|
|
6456
6456
|
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
6457
6457
|
for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
|
|
6458
|
-
for (const key of declaredPropKeys.map(camelize
|
|
6458
|
+
for (const key of declaredPropKeys.map(camelize)) Object.defineProperty(this, key, {
|
|
6459
6459
|
get() {
|
|
6460
6460
|
return this._getProp(key);
|
|
6461
6461
|
},
|
|
@@ -6468,7 +6468,7 @@ var VueElement = class VueElement extends BaseClass {
|
|
|
6468
6468
|
if (key.startsWith("data-v-")) return;
|
|
6469
6469
|
const has = this.hasAttribute(key);
|
|
6470
6470
|
let value = has ? this.getAttribute(key) : REMOVAL;
|
|
6471
|
-
const camelKey = camelize
|
|
6471
|
+
const camelKey = camelize(key);
|
|
6472
6472
|
if (has && this._numberProps && this._numberProps[camelKey]) value = toNumber(value);
|
|
6473
6473
|
this._setProp(camelKey, value, false, true);
|
|
6474
6474
|
}
|
|
@@ -6496,9 +6496,9 @@ var VueElement = class VueElement extends BaseClass {
|
|
|
6496
6496
|
this._processMutations(ob.takeRecords());
|
|
6497
6497
|
ob.disconnect();
|
|
6498
6498
|
}
|
|
6499
|
-
if (val === true) this.setAttribute(hyphenate
|
|
6500
|
-
else if (typeof val === "string" || typeof val === "number") this.setAttribute(hyphenate
|
|
6501
|
-
else if (!val) this.removeAttribute(hyphenate
|
|
6499
|
+
if (val === true) this.setAttribute(hyphenate(key), "");
|
|
6500
|
+
else if (typeof val === "string" || typeof val === "number") this.setAttribute(hyphenate(key), val + "");
|
|
6501
|
+
else if (!val) this.removeAttribute(hyphenate(key));
|
|
6502
6502
|
ob && ob.observe(this, { attributes: true });
|
|
6503
6503
|
}
|
|
6504
6504
|
}
|
|
@@ -6531,7 +6531,7 @@ var VueElement = class VueElement extends BaseClass {
|
|
|
6531
6531
|
};
|
|
6532
6532
|
instance.emit = (event, ...args) => {
|
|
6533
6533
|
dispatch(event, args);
|
|
6534
|
-
if (hyphenate
|
|
6534
|
+
if (hyphenate(event) !== event) dispatch(hyphenate(event), args);
|
|
6535
6535
|
};
|
|
6536
6536
|
this._setParent();
|
|
6537
6537
|
};
|
|
@@ -6893,7 +6893,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
6893
6893
|
const cacheKey = modifiers.join(".");
|
|
6894
6894
|
return cache[cacheKey] || (cache[cacheKey] = ((event) => {
|
|
6895
6895
|
if (!("key" in event)) return;
|
|
6896
|
-
const eventKey = hyphenate
|
|
6896
|
+
const eventKey = hyphenate(event.key);
|
|
6897
6897
|
if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) return fn(event);
|
|
6898
6898
|
}));
|
|
6899
6899
|
};
|
|
@@ -6985,1115 +6985,4 @@ function initDev() {
|
|
|
6985
6985
|
}
|
|
6986
6986
|
if (!!(process.env.NODE_ENV !== "production")) initDev();
|
|
6987
6987
|
//#endregion
|
|
6988
|
-
|
|
6989
|
-
/**
|
|
6990
|
-
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
6991
|
-
*
|
|
6992
|
-
* @param fn
|
|
6993
|
-
*/
|
|
6994
|
-
function tryOnScopeDispose(fn, failSilently) {
|
|
6995
|
-
if (getCurrentScope()) {
|
|
6996
|
-
onScopeDispose(fn, failSilently);
|
|
6997
|
-
return true;
|
|
6998
|
-
}
|
|
6999
|
-
return false;
|
|
7000
|
-
}
|
|
7001
|
-
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
7002
|
-
/**
|
|
7003
|
-
* On the basis of `inject`, it is allowed to directly call inject to obtain the value after call provide in the same component.
|
|
7004
|
-
*
|
|
7005
|
-
* @example
|
|
7006
|
-
* ```ts
|
|
7007
|
-
* injectLocal('MyInjectionKey', 1)
|
|
7008
|
-
* const injectedValue = injectLocal('MyInjectionKey') // injectedValue === 1
|
|
7009
|
-
* ```
|
|
7010
|
-
*
|
|
7011
|
-
* @__NO_SIDE_EFFECTS__
|
|
7012
|
-
*/
|
|
7013
|
-
const injectLocal = (...args) => {
|
|
7014
|
-
var _getCurrentInstance;
|
|
7015
|
-
const key = args[0];
|
|
7016
|
-
const instance = (_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy;
|
|
7017
|
-
const owner = instance !== null && instance !== void 0 ? instance : getCurrentScope();
|
|
7018
|
-
if (owner == null && !hasInjectionContext()) throw new Error("injectLocal must be called in setup");
|
|
7019
|
-
if (owner && localProvidedStateMap.has(owner) && key in localProvidedStateMap.get(owner)) return localProvidedStateMap.get(owner)[key];
|
|
7020
|
-
return inject(...args);
|
|
7021
|
-
};
|
|
7022
|
-
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
7023
|
-
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
7024
|
-
const notNullish = (val) => val != null;
|
|
7025
|
-
const toString = Object.prototype.toString;
|
|
7026
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
7027
|
-
const noop = () => {};
|
|
7028
|
-
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
7029
|
-
function getIsIOS() {
|
|
7030
|
-
var _window, _window2, _window3;
|
|
7031
|
-
return isClient && !!((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.navigator) === null || _window2 === void 0 ? void 0 : _window2.maxTouchPoints) > 2 && /iPad|Macintosh/.test((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.navigator.userAgent));
|
|
7032
|
-
}
|
|
7033
|
-
function toRef(...args) {
|
|
7034
|
-
if (args.length !== 1) return /* @__PURE__ */ toRef$1(...args);
|
|
7035
|
-
const r = args[0];
|
|
7036
|
-
return typeof r === "function" ? /* @__PURE__ */ readonly(customRef(() => ({
|
|
7037
|
-
get: r,
|
|
7038
|
-
set: noop
|
|
7039
|
-
}))) : /* @__PURE__ */ ref(r);
|
|
7040
|
-
}
|
|
7041
|
-
/**
|
|
7042
|
-
* @internal
|
|
7043
|
-
*/
|
|
7044
|
-
function createFilterWrapper(filter, fn) {
|
|
7045
|
-
function wrapper(...args) {
|
|
7046
|
-
return new Promise((resolve, reject) => {
|
|
7047
|
-
Promise.resolve(filter(() => fn.apply(this, args), {
|
|
7048
|
-
fn,
|
|
7049
|
-
thisArg: this,
|
|
7050
|
-
args
|
|
7051
|
-
})).then(resolve).catch(reject);
|
|
7052
|
-
});
|
|
7053
|
-
}
|
|
7054
|
-
return wrapper;
|
|
7055
|
-
}
|
|
7056
|
-
const bypassFilter = (invoke$1) => {
|
|
7057
|
-
return invoke$1();
|
|
7058
|
-
};
|
|
7059
|
-
/**
|
|
7060
|
-
* Create an EventFilter that debounce the events
|
|
7061
|
-
*/
|
|
7062
|
-
function debounceFilter(ms, options = {}) {
|
|
7063
|
-
let timer;
|
|
7064
|
-
let maxTimer;
|
|
7065
|
-
let lastRejector = noop;
|
|
7066
|
-
const _clearTimeout = (timer$1) => {
|
|
7067
|
-
clearTimeout(timer$1);
|
|
7068
|
-
lastRejector();
|
|
7069
|
-
lastRejector = noop;
|
|
7070
|
-
};
|
|
7071
|
-
let lastInvoker;
|
|
7072
|
-
const filter = (invoke$1) => {
|
|
7073
|
-
const duration = toValue(ms);
|
|
7074
|
-
const maxDuration = toValue(options.maxWait);
|
|
7075
|
-
if (timer) _clearTimeout(timer);
|
|
7076
|
-
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
7077
|
-
if (maxTimer) {
|
|
7078
|
-
_clearTimeout(maxTimer);
|
|
7079
|
-
maxTimer = void 0;
|
|
7080
|
-
}
|
|
7081
|
-
return Promise.resolve(invoke$1());
|
|
7082
|
-
}
|
|
7083
|
-
return new Promise((resolve, reject) => {
|
|
7084
|
-
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
7085
|
-
lastInvoker = invoke$1;
|
|
7086
|
-
if (maxDuration && !maxTimer) maxTimer = setTimeout(() => {
|
|
7087
|
-
if (timer) _clearTimeout(timer);
|
|
7088
|
-
maxTimer = void 0;
|
|
7089
|
-
resolve(lastInvoker());
|
|
7090
|
-
}, maxDuration);
|
|
7091
|
-
timer = setTimeout(() => {
|
|
7092
|
-
if (maxTimer) _clearTimeout(maxTimer);
|
|
7093
|
-
maxTimer = void 0;
|
|
7094
|
-
resolve(invoke$1());
|
|
7095
|
-
}, duration);
|
|
7096
|
-
});
|
|
7097
|
-
};
|
|
7098
|
-
return filter;
|
|
7099
|
-
}
|
|
7100
|
-
/**
|
|
7101
|
-
* EventFilter that gives extra controls to pause and resume the filter
|
|
7102
|
-
*
|
|
7103
|
-
* @param extendFilter Extra filter to apply when the PausableFilter is active, default to none
|
|
7104
|
-
* @param options Options to configure the filter
|
|
7105
|
-
*/
|
|
7106
|
-
function pausableFilter(extendFilter = bypassFilter, options = {}) {
|
|
7107
|
-
const { initialState = "active" } = options;
|
|
7108
|
-
const isActive = toRef(initialState === "active");
|
|
7109
|
-
function pause() {
|
|
7110
|
-
isActive.value = false;
|
|
7111
|
-
}
|
|
7112
|
-
function resume() {
|
|
7113
|
-
isActive.value = true;
|
|
7114
|
-
}
|
|
7115
|
-
const eventFilter = (...args) => {
|
|
7116
|
-
if (isActive.value) extendFilter(...args);
|
|
7117
|
-
};
|
|
7118
|
-
return {
|
|
7119
|
-
isActive: /* @__PURE__ */ readonly(isActive),
|
|
7120
|
-
pause,
|
|
7121
|
-
resume,
|
|
7122
|
-
eventFilter
|
|
7123
|
-
};
|
|
7124
|
-
}
|
|
7125
|
-
/**
|
|
7126
|
-
* Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
|
|
7127
|
-
*/
|
|
7128
|
-
function pxValue(px) {
|
|
7129
|
-
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
|
|
7130
|
-
}
|
|
7131
|
-
function toArray(value) {
|
|
7132
|
-
return Array.isArray(value) ? value : [value];
|
|
7133
|
-
}
|
|
7134
|
-
function cacheStringFunction(fn) {
|
|
7135
|
-
const cache = Object.create(null);
|
|
7136
|
-
return ((str) => {
|
|
7137
|
-
return cache[str] || (cache[str] = fn(str));
|
|
7138
|
-
});
|
|
7139
|
-
}
|
|
7140
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
7141
|
-
cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
7142
|
-
const camelizeRE = /-(\w)/g;
|
|
7143
|
-
cacheStringFunction((str) => {
|
|
7144
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
7145
|
-
});
|
|
7146
|
-
function getLifeCycleTarget(target) {
|
|
7147
|
-
return target || getCurrentInstance();
|
|
7148
|
-
}
|
|
7149
|
-
/**
|
|
7150
|
-
* Debounce execution of a function.
|
|
7151
|
-
*
|
|
7152
|
-
* @see https://vueuse.org/useDebounceFn
|
|
7153
|
-
* @param fn A function to be executed after delay milliseconds debounced.
|
|
7154
|
-
* @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
7155
|
-
* @param options Options
|
|
7156
|
-
*
|
|
7157
|
-
* @return A new, debounce, function.
|
|
7158
|
-
*
|
|
7159
|
-
* @__NO_SIDE_EFFECTS__
|
|
7160
|
-
*/
|
|
7161
|
-
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
7162
|
-
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
7163
|
-
}
|
|
7164
|
-
function watchWithFilter(source, cb, options = {}) {
|
|
7165
|
-
const { eventFilter = bypassFilter, ...watchOptions } = options;
|
|
7166
|
-
return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
7167
|
-
}
|
|
7168
|
-
/** @deprecated Use Vue's built-in `watch` instead. This function will be removed in future version. */
|
|
7169
|
-
function watchPausable(source, cb, options = {}) {
|
|
7170
|
-
const { eventFilter: filter, initialState = "active", ...watchOptions } = options;
|
|
7171
|
-
const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState });
|
|
7172
|
-
return {
|
|
7173
|
-
stop: watchWithFilter(source, cb, {
|
|
7174
|
-
...watchOptions,
|
|
7175
|
-
eventFilter
|
|
7176
|
-
}),
|
|
7177
|
-
pause,
|
|
7178
|
-
resume,
|
|
7179
|
-
isActive
|
|
7180
|
-
};
|
|
7181
|
-
}
|
|
7182
|
-
/**
|
|
7183
|
-
* Call onMounted() if it's inside a component lifecycle, if not, just call the function
|
|
7184
|
-
*
|
|
7185
|
-
* @param fn
|
|
7186
|
-
* @param sync if set to false, it will run in the nextTick() of Vue
|
|
7187
|
-
* @param target
|
|
7188
|
-
*/
|
|
7189
|
-
function tryOnMounted(fn, sync = true, target) {
|
|
7190
|
-
if (getLifeCycleTarget(target)) onMounted(fn, target);
|
|
7191
|
-
else if (sync) fn();
|
|
7192
|
-
else nextTick(fn);
|
|
7193
|
-
}
|
|
7194
|
-
/**
|
|
7195
|
-
* Wrapper for `setInterval` with controls
|
|
7196
|
-
*
|
|
7197
|
-
* @see https://vueuse.org/useIntervalFn
|
|
7198
|
-
* @param cb
|
|
7199
|
-
* @param interval
|
|
7200
|
-
* @param options
|
|
7201
|
-
*/
|
|
7202
|
-
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
7203
|
-
const { immediate = true, immediateCallback = false } = options;
|
|
7204
|
-
let timer = null;
|
|
7205
|
-
const isActive = /* @__PURE__ */ shallowRef(false);
|
|
7206
|
-
function clean() {
|
|
7207
|
-
if (timer) {
|
|
7208
|
-
clearInterval(timer);
|
|
7209
|
-
timer = null;
|
|
7210
|
-
}
|
|
7211
|
-
}
|
|
7212
|
-
function pause() {
|
|
7213
|
-
isActive.value = false;
|
|
7214
|
-
clean();
|
|
7215
|
-
}
|
|
7216
|
-
function resume() {
|
|
7217
|
-
const intervalValue = toValue(interval);
|
|
7218
|
-
if (intervalValue <= 0) return;
|
|
7219
|
-
isActive.value = true;
|
|
7220
|
-
if (immediateCallback) cb();
|
|
7221
|
-
clean();
|
|
7222
|
-
if (isActive.value) timer = setInterval(cb, intervalValue);
|
|
7223
|
-
}
|
|
7224
|
-
if (immediate && isClient) resume();
|
|
7225
|
-
if (/* @__PURE__ */ isRef(interval) || typeof interval === "function") tryOnScopeDispose(watch(interval, () => {
|
|
7226
|
-
if (isActive.value && isClient) resume();
|
|
7227
|
-
}));
|
|
7228
|
-
tryOnScopeDispose(pause);
|
|
7229
|
-
return {
|
|
7230
|
-
isActive: /* @__PURE__ */ shallowReadonly(isActive),
|
|
7231
|
-
pause,
|
|
7232
|
-
resume
|
|
7233
|
-
};
|
|
7234
|
-
}
|
|
7235
|
-
function watchDebounced(source, cb, options = {}) {
|
|
7236
|
-
const { debounce = 0, maxWait = void 0, ...watchOptions } = options;
|
|
7237
|
-
return watchWithFilter(source, cb, {
|
|
7238
|
-
...watchOptions,
|
|
7239
|
-
eventFilter: debounceFilter(debounce, { maxWait })
|
|
7240
|
-
});
|
|
7241
|
-
}
|
|
7242
|
-
/**
|
|
7243
|
-
* Shorthand for watching value with {immediate: true}
|
|
7244
|
-
*
|
|
7245
|
-
* @see https://vueuse.org/watchImmediate
|
|
7246
|
-
*/
|
|
7247
|
-
function watchImmediate(source, cb, options) {
|
|
7248
|
-
return watch(source, cb, {
|
|
7249
|
-
...options,
|
|
7250
|
-
immediate: true
|
|
7251
|
-
});
|
|
7252
|
-
}
|
|
7253
|
-
//#endregion
|
|
7254
|
-
//#region ../../node_modules/.pnpm/@vueuse+core@14.2.1_vue@3.5.30_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.js
|
|
7255
|
-
const defaultWindow = isClient ? window : void 0;
|
|
7256
|
-
isClient && window.document;
|
|
7257
|
-
isClient && window.navigator;
|
|
7258
|
-
isClient && window.location;
|
|
7259
|
-
/**
|
|
7260
|
-
* Get the dom element of a ref of element or Vue component instance
|
|
7261
|
-
*
|
|
7262
|
-
* @param elRef
|
|
7263
|
-
*/
|
|
7264
|
-
function unrefElement(elRef) {
|
|
7265
|
-
var _$el;
|
|
7266
|
-
const plain = toValue(elRef);
|
|
7267
|
-
return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;
|
|
7268
|
-
}
|
|
7269
|
-
function useEventListener(...args) {
|
|
7270
|
-
const register = (el, event, listener, options) => {
|
|
7271
|
-
el.addEventListener(event, listener, options);
|
|
7272
|
-
return () => el.removeEventListener(event, listener, options);
|
|
7273
|
-
};
|
|
7274
|
-
const firstParamTargets = computed(() => {
|
|
7275
|
-
const test = toArray(toValue(args[0])).filter((e) => e != null);
|
|
7276
|
-
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
7277
|
-
});
|
|
7278
|
-
return watchImmediate(() => {
|
|
7279
|
-
var _firstParamTargets$va, _firstParamTargets$va2;
|
|
7280
|
-
return [
|
|
7281
|
-
(_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null),
|
|
7282
|
-
toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
7283
|
-
toArray(unref(firstParamTargets.value ? args[2] : args[1])),
|
|
7284
|
-
toValue(firstParamTargets.value ? args[3] : args[2])
|
|
7285
|
-
];
|
|
7286
|
-
}, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => {
|
|
7287
|
-
if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return;
|
|
7288
|
-
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
7289
|
-
const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))));
|
|
7290
|
-
onCleanup(() => {
|
|
7291
|
-
cleanups.forEach((fn) => fn());
|
|
7292
|
-
});
|
|
7293
|
-
}, { flush: "post" });
|
|
7294
|
-
}
|
|
7295
|
-
let _iOSWorkaround = false;
|
|
7296
|
-
function onClickOutside(target, handler, options = {}) {
|
|
7297
|
-
const { window: window$1 = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options;
|
|
7298
|
-
if (!window$1) return controls ? {
|
|
7299
|
-
stop: noop,
|
|
7300
|
-
cancel: noop,
|
|
7301
|
-
trigger: noop
|
|
7302
|
-
} : noop;
|
|
7303
|
-
if (isIOS && !_iOSWorkaround) {
|
|
7304
|
-
_iOSWorkaround = true;
|
|
7305
|
-
const listenerOptions = { passive: true };
|
|
7306
|
-
Array.from(window$1.document.body.children).forEach((el) => el.addEventListener("click", noop, listenerOptions));
|
|
7307
|
-
window$1.document.documentElement.addEventListener("click", noop, listenerOptions);
|
|
7308
|
-
}
|
|
7309
|
-
let shouldListen = true;
|
|
7310
|
-
const shouldIgnore = (event) => {
|
|
7311
|
-
return toValue(ignore).some((target$1) => {
|
|
7312
|
-
if (typeof target$1 === "string") return Array.from(window$1.document.querySelectorAll(target$1)).some((el) => el === event.target || event.composedPath().includes(el));
|
|
7313
|
-
else {
|
|
7314
|
-
const el = unrefElement(target$1);
|
|
7315
|
-
return el && (event.target === el || event.composedPath().includes(el));
|
|
7316
|
-
}
|
|
7317
|
-
});
|
|
7318
|
-
};
|
|
7319
|
-
/**
|
|
7320
|
-
* Determines if the given target has multiple root elements.
|
|
7321
|
-
* Referenced from: https://github.com/vuejs/test-utils/blob/ccb460be55f9f6be05ab708500a41ec8adf6f4bc/src/vue-wrapper.ts#L21
|
|
7322
|
-
*/
|
|
7323
|
-
function hasMultipleRoots(target$1) {
|
|
7324
|
-
const vm = toValue(target$1);
|
|
7325
|
-
return vm && vm.$.subTree.shapeFlag === 16;
|
|
7326
|
-
}
|
|
7327
|
-
function checkMultipleRoots(target$1, event) {
|
|
7328
|
-
const vm = toValue(target$1);
|
|
7329
|
-
const children = vm.$.subTree && vm.$.subTree.children;
|
|
7330
|
-
if (children == null || !Array.isArray(children)) return false;
|
|
7331
|
-
return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
|
|
7332
|
-
}
|
|
7333
|
-
const listener = (event) => {
|
|
7334
|
-
const el = unrefElement(target);
|
|
7335
|
-
if (event.target == null) return;
|
|
7336
|
-
if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return;
|
|
7337
|
-
if (!el || el === event.target || event.composedPath().includes(el)) return;
|
|
7338
|
-
if ("detail" in event && event.detail === 0) shouldListen = !shouldIgnore(event);
|
|
7339
|
-
if (!shouldListen) {
|
|
7340
|
-
shouldListen = true;
|
|
7341
|
-
return;
|
|
7342
|
-
}
|
|
7343
|
-
handler(event);
|
|
7344
|
-
};
|
|
7345
|
-
let isProcessingClick = false;
|
|
7346
|
-
const cleanup = [
|
|
7347
|
-
useEventListener(window$1, "click", (event) => {
|
|
7348
|
-
if (!isProcessingClick) {
|
|
7349
|
-
isProcessingClick = true;
|
|
7350
|
-
setTimeout(() => {
|
|
7351
|
-
isProcessingClick = false;
|
|
7352
|
-
}, 0);
|
|
7353
|
-
listener(event);
|
|
7354
|
-
}
|
|
7355
|
-
}, {
|
|
7356
|
-
passive: true,
|
|
7357
|
-
capture
|
|
7358
|
-
}),
|
|
7359
|
-
useEventListener(window$1, "pointerdown", (e) => {
|
|
7360
|
-
const el = unrefElement(target);
|
|
7361
|
-
shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
|
|
7362
|
-
}, { passive: true }),
|
|
7363
|
-
detectIframe && useEventListener(window$1, "blur", (event) => {
|
|
7364
|
-
setTimeout(() => {
|
|
7365
|
-
var _window$document$acti;
|
|
7366
|
-
const el = unrefElement(target);
|
|
7367
|
-
if (((_window$document$acti = window$1.document.activeElement) === null || _window$document$acti === void 0 ? void 0 : _window$document$acti.tagName) === "IFRAME" && !(el === null || el === void 0 ? void 0 : el.contains(window$1.document.activeElement))) handler(event);
|
|
7368
|
-
}, 0);
|
|
7369
|
-
}, { passive: true })
|
|
7370
|
-
].filter(Boolean);
|
|
7371
|
-
const stop = () => cleanup.forEach((fn) => fn());
|
|
7372
|
-
if (controls) return {
|
|
7373
|
-
stop,
|
|
7374
|
-
cancel: () => {
|
|
7375
|
-
shouldListen = false;
|
|
7376
|
-
},
|
|
7377
|
-
trigger: (event) => {
|
|
7378
|
-
shouldListen = true;
|
|
7379
|
-
listener(event);
|
|
7380
|
-
shouldListen = false;
|
|
7381
|
-
}
|
|
7382
|
-
};
|
|
7383
|
-
return stop;
|
|
7384
|
-
}
|
|
7385
|
-
/**
|
|
7386
|
-
* Mounted state in ref.
|
|
7387
|
-
*
|
|
7388
|
-
* @see https://vueuse.org/useMounted
|
|
7389
|
-
*
|
|
7390
|
-
* @__NO_SIDE_EFFECTS__
|
|
7391
|
-
*/
|
|
7392
|
-
function useMounted() {
|
|
7393
|
-
const isMounted = /* @__PURE__ */ shallowRef(false);
|
|
7394
|
-
const instance = getCurrentInstance();
|
|
7395
|
-
if (instance) onMounted(() => {
|
|
7396
|
-
isMounted.value = true;
|
|
7397
|
-
}, instance);
|
|
7398
|
-
return isMounted;
|
|
7399
|
-
}
|
|
7400
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
7401
|
-
function useSupported(callback) {
|
|
7402
|
-
const isMounted = useMounted();
|
|
7403
|
-
return computed(() => {
|
|
7404
|
-
isMounted.value;
|
|
7405
|
-
return Boolean(callback());
|
|
7406
|
-
});
|
|
7407
|
-
}
|
|
7408
|
-
/**
|
|
7409
|
-
* Watch for changes being made to the DOM tree.
|
|
7410
|
-
*
|
|
7411
|
-
* @see https://vueuse.org/useMutationObserver
|
|
7412
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver MutationObserver MDN
|
|
7413
|
-
* @param target
|
|
7414
|
-
* @param callback
|
|
7415
|
-
* @param options
|
|
7416
|
-
*/
|
|
7417
|
-
function useMutationObserver(target, callback, options = {}) {
|
|
7418
|
-
const { window: window$1 = defaultWindow, ...mutationOptions } = options;
|
|
7419
|
-
let observer;
|
|
7420
|
-
const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "MutationObserver" in window$1);
|
|
7421
|
-
const cleanup = () => {
|
|
7422
|
-
if (observer) {
|
|
7423
|
-
observer.disconnect();
|
|
7424
|
-
observer = void 0;
|
|
7425
|
-
}
|
|
7426
|
-
};
|
|
7427
|
-
const stopWatch = watch(computed(() => {
|
|
7428
|
-
const items = toArray(toValue(target)).map(unrefElement).filter(notNullish);
|
|
7429
|
-
return new Set(items);
|
|
7430
|
-
}), (newTargets) => {
|
|
7431
|
-
cleanup();
|
|
7432
|
-
if (isSupported.value && newTargets.size) {
|
|
7433
|
-
observer = new MutationObserver(callback);
|
|
7434
|
-
newTargets.forEach((el) => observer.observe(el, mutationOptions));
|
|
7435
|
-
}
|
|
7436
|
-
}, {
|
|
7437
|
-
immediate: true,
|
|
7438
|
-
flush: "post"
|
|
7439
|
-
});
|
|
7440
|
-
const takeRecords = () => {
|
|
7441
|
-
return observer === null || observer === void 0 ? void 0 : observer.takeRecords();
|
|
7442
|
-
};
|
|
7443
|
-
const stop = () => {
|
|
7444
|
-
stopWatch();
|
|
7445
|
-
cleanup();
|
|
7446
|
-
};
|
|
7447
|
-
tryOnScopeDispose(stop);
|
|
7448
|
-
return {
|
|
7449
|
-
isSupported,
|
|
7450
|
-
stop,
|
|
7451
|
-
takeRecords
|
|
7452
|
-
};
|
|
7453
|
-
}
|
|
7454
|
-
/**
|
|
7455
|
-
* Call function on every `requestAnimationFrame`. With controls of pausing and resuming.
|
|
7456
|
-
*
|
|
7457
|
-
* @see https://vueuse.org/useRafFn
|
|
7458
|
-
* @param fn
|
|
7459
|
-
* @param options
|
|
7460
|
-
*/
|
|
7461
|
-
function useRafFn(fn, options = {}) {
|
|
7462
|
-
const { immediate = true, fpsLimit = null, window: window$1 = defaultWindow, once = false } = options;
|
|
7463
|
-
const isActive = /* @__PURE__ */ shallowRef(false);
|
|
7464
|
-
const intervalLimit = computed(() => {
|
|
7465
|
-
const limit = toValue(fpsLimit);
|
|
7466
|
-
return limit ? 1e3 / limit : null;
|
|
7467
|
-
});
|
|
7468
|
-
let previousFrameTimestamp = 0;
|
|
7469
|
-
let rafId = null;
|
|
7470
|
-
function loop(timestamp$1) {
|
|
7471
|
-
if (!isActive.value || !window$1) return;
|
|
7472
|
-
if (!previousFrameTimestamp) previousFrameTimestamp = timestamp$1;
|
|
7473
|
-
const delta = timestamp$1 - previousFrameTimestamp;
|
|
7474
|
-
if (intervalLimit.value && delta < intervalLimit.value) {
|
|
7475
|
-
rafId = window$1.requestAnimationFrame(loop);
|
|
7476
|
-
return;
|
|
7477
|
-
}
|
|
7478
|
-
previousFrameTimestamp = timestamp$1;
|
|
7479
|
-
fn({
|
|
7480
|
-
delta,
|
|
7481
|
-
timestamp: timestamp$1
|
|
7482
|
-
});
|
|
7483
|
-
if (once) {
|
|
7484
|
-
isActive.value = false;
|
|
7485
|
-
rafId = null;
|
|
7486
|
-
return;
|
|
7487
|
-
}
|
|
7488
|
-
rafId = window$1.requestAnimationFrame(loop);
|
|
7489
|
-
}
|
|
7490
|
-
function resume() {
|
|
7491
|
-
if (!isActive.value && window$1) {
|
|
7492
|
-
isActive.value = true;
|
|
7493
|
-
previousFrameTimestamp = 0;
|
|
7494
|
-
rafId = window$1.requestAnimationFrame(loop);
|
|
7495
|
-
}
|
|
7496
|
-
}
|
|
7497
|
-
function pause() {
|
|
7498
|
-
isActive.value = false;
|
|
7499
|
-
if (rafId != null && window$1) {
|
|
7500
|
-
window$1.cancelAnimationFrame(rafId);
|
|
7501
|
-
rafId = null;
|
|
7502
|
-
}
|
|
7503
|
-
}
|
|
7504
|
-
if (immediate) resume();
|
|
7505
|
-
tryOnScopeDispose(pause);
|
|
7506
|
-
return {
|
|
7507
|
-
isActive: /* @__PURE__ */ readonly(isActive),
|
|
7508
|
-
pause,
|
|
7509
|
-
resume
|
|
7510
|
-
};
|
|
7511
|
-
}
|
|
7512
|
-
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
7513
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
7514
|
-
function useSSRWidth() {
|
|
7515
|
-
const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
|
|
7516
|
-
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
7517
|
-
}
|
|
7518
|
-
/**
|
|
7519
|
-
* Reactive Media Query.
|
|
7520
|
-
*
|
|
7521
|
-
* @see https://vueuse.org/useMediaQuery
|
|
7522
|
-
* @param query
|
|
7523
|
-
* @param options
|
|
7524
|
-
*/
|
|
7525
|
-
function useMediaQuery(query, options = {}) {
|
|
7526
|
-
const { window: window$1 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
7527
|
-
const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "matchMedia" in window$1 && typeof window$1.matchMedia === "function");
|
|
7528
|
-
const ssrSupport = /* @__PURE__ */ shallowRef(typeof ssrWidth === "number");
|
|
7529
|
-
const mediaQuery = /* @__PURE__ */ shallowRef();
|
|
7530
|
-
const matches = /* @__PURE__ */ shallowRef(false);
|
|
7531
|
-
const handler = (event) => {
|
|
7532
|
-
matches.value = event.matches;
|
|
7533
|
-
};
|
|
7534
|
-
watchEffect(() => {
|
|
7535
|
-
if (ssrSupport.value) {
|
|
7536
|
-
ssrSupport.value = !isSupported.value;
|
|
7537
|
-
matches.value = toValue(query).split(",").some((queryString) => {
|
|
7538
|
-
const not = queryString.includes("not all");
|
|
7539
|
-
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
7540
|
-
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
7541
|
-
let res = Boolean(minWidth || maxWidth);
|
|
7542
|
-
if (minWidth && res) res = ssrWidth >= pxValue(minWidth[1]);
|
|
7543
|
-
if (maxWidth && res) res = ssrWidth <= pxValue(maxWidth[1]);
|
|
7544
|
-
return not ? !res : res;
|
|
7545
|
-
});
|
|
7546
|
-
return;
|
|
7547
|
-
}
|
|
7548
|
-
if (!isSupported.value) return;
|
|
7549
|
-
mediaQuery.value = window$1.matchMedia(toValue(query));
|
|
7550
|
-
matches.value = mediaQuery.value.matches;
|
|
7551
|
-
});
|
|
7552
|
-
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
7553
|
-
return computed(() => matches.value);
|
|
7554
|
-
}
|
|
7555
|
-
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
7556
|
-
const globalKey = "__vueuse_ssr_handlers__";
|
|
7557
|
-
const handlers = /* @__PURE__ */ getHandlers();
|
|
7558
|
-
function getHandlers() {
|
|
7559
|
-
if (!(globalKey in _global)) _global[globalKey] = _global[globalKey] || {};
|
|
7560
|
-
return _global[globalKey];
|
|
7561
|
-
}
|
|
7562
|
-
function getSSRHandler(key, fallback) {
|
|
7563
|
-
return handlers[key] || fallback;
|
|
7564
|
-
}
|
|
7565
|
-
function guessSerializerType(rawInit) {
|
|
7566
|
-
return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
|
|
7567
|
-
}
|
|
7568
|
-
const StorageSerializers = {
|
|
7569
|
-
boolean: {
|
|
7570
|
-
read: (v) => v === "true",
|
|
7571
|
-
write: (v) => String(v)
|
|
7572
|
-
},
|
|
7573
|
-
object: {
|
|
7574
|
-
read: (v) => JSON.parse(v),
|
|
7575
|
-
write: (v) => JSON.stringify(v)
|
|
7576
|
-
},
|
|
7577
|
-
number: {
|
|
7578
|
-
read: (v) => Number.parseFloat(v),
|
|
7579
|
-
write: (v) => String(v)
|
|
7580
|
-
},
|
|
7581
|
-
any: {
|
|
7582
|
-
read: (v) => v,
|
|
7583
|
-
write: (v) => String(v)
|
|
7584
|
-
},
|
|
7585
|
-
string: {
|
|
7586
|
-
read: (v) => v,
|
|
7587
|
-
write: (v) => String(v)
|
|
7588
|
-
},
|
|
7589
|
-
map: {
|
|
7590
|
-
read: (v) => new Map(JSON.parse(v)),
|
|
7591
|
-
write: (v) => JSON.stringify(Array.from(v.entries()))
|
|
7592
|
-
},
|
|
7593
|
-
set: {
|
|
7594
|
-
read: (v) => new Set(JSON.parse(v)),
|
|
7595
|
-
write: (v) => JSON.stringify(Array.from(v))
|
|
7596
|
-
},
|
|
7597
|
-
date: {
|
|
7598
|
-
read: (v) => new Date(v),
|
|
7599
|
-
write: (v) => v.toISOString()
|
|
7600
|
-
}
|
|
7601
|
-
};
|
|
7602
|
-
const customStorageEventName = "vueuse-storage";
|
|
7603
|
-
/**
|
|
7604
|
-
* Reactive LocalStorage/SessionStorage.
|
|
7605
|
-
*
|
|
7606
|
-
* @see https://vueuse.org/useStorage
|
|
7607
|
-
*/
|
|
7608
|
-
function useStorage(key, defaults$1, storage, options = {}) {
|
|
7609
|
-
var _options$serializer;
|
|
7610
|
-
const { flush = "pre", deep = true, listenToStorageChanges = true, writeDefaults = true, mergeDefaults = false, shallow, window: window$1 = defaultWindow, eventFilter, onError = (e) => {
|
|
7611
|
-
console.error(e);
|
|
7612
|
-
}, initOnMounted } = options;
|
|
7613
|
-
const data = (shallow ? shallowRef : ref)(typeof defaults$1 === "function" ? defaults$1() : defaults$1);
|
|
7614
|
-
const keyComputed = computed(() => toValue(key));
|
|
7615
|
-
if (!storage) try {
|
|
7616
|
-
storage = getSSRHandler("getDefaultStorage", () => defaultWindow === null || defaultWindow === void 0 ? void 0 : defaultWindow.localStorage)();
|
|
7617
|
-
} catch (e) {
|
|
7618
|
-
onError(e);
|
|
7619
|
-
}
|
|
7620
|
-
if (!storage) return data;
|
|
7621
|
-
const rawInit = toValue(defaults$1);
|
|
7622
|
-
const type = guessSerializerType(rawInit);
|
|
7623
|
-
const serializer = (_options$serializer = options.serializer) !== null && _options$serializer !== void 0 ? _options$serializer : StorageSerializers[type];
|
|
7624
|
-
const { pause: pauseWatch, resume: resumeWatch } = watchPausable(data, (newValue) => write(newValue), {
|
|
7625
|
-
flush,
|
|
7626
|
-
deep,
|
|
7627
|
-
eventFilter
|
|
7628
|
-
});
|
|
7629
|
-
watch(keyComputed, () => update(), { flush });
|
|
7630
|
-
let firstMounted = false;
|
|
7631
|
-
const onStorageEvent = (ev) => {
|
|
7632
|
-
if (initOnMounted && !firstMounted) return;
|
|
7633
|
-
update(ev);
|
|
7634
|
-
};
|
|
7635
|
-
const onStorageCustomEvent = (ev) => {
|
|
7636
|
-
if (initOnMounted && !firstMounted) return;
|
|
7637
|
-
updateFromCustomEvent(ev);
|
|
7638
|
-
};
|
|
7639
|
-
/**
|
|
7640
|
-
* The custom event is needed for same-document syncing when using custom
|
|
7641
|
-
* storage backends, but it doesn't work across different documents.
|
|
7642
|
-
*
|
|
7643
|
-
* TODO: Consider implementing a BroadcastChannel-based solution that fixes this.
|
|
7644
|
-
*/
|
|
7645
|
-
if (window$1 && listenToStorageChanges) if (storage instanceof Storage) useEventListener(window$1, "storage", onStorageEvent, { passive: true });
|
|
7646
|
-
else useEventListener(window$1, customStorageEventName, onStorageCustomEvent);
|
|
7647
|
-
if (initOnMounted) tryOnMounted(() => {
|
|
7648
|
-
firstMounted = true;
|
|
7649
|
-
update();
|
|
7650
|
-
});
|
|
7651
|
-
else update();
|
|
7652
|
-
function dispatchWriteEvent(oldValue, newValue) {
|
|
7653
|
-
if (window$1) {
|
|
7654
|
-
const payload = {
|
|
7655
|
-
key: keyComputed.value,
|
|
7656
|
-
oldValue,
|
|
7657
|
-
newValue,
|
|
7658
|
-
storageArea: storage
|
|
7659
|
-
};
|
|
7660
|
-
window$1.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, { detail: payload }));
|
|
7661
|
-
}
|
|
7662
|
-
}
|
|
7663
|
-
function write(v) {
|
|
7664
|
-
try {
|
|
7665
|
-
const oldValue = storage.getItem(keyComputed.value);
|
|
7666
|
-
if (v == null) {
|
|
7667
|
-
dispatchWriteEvent(oldValue, null);
|
|
7668
|
-
storage.removeItem(keyComputed.value);
|
|
7669
|
-
} else {
|
|
7670
|
-
const serialized = serializer.write(v);
|
|
7671
|
-
if (oldValue !== serialized) {
|
|
7672
|
-
storage.setItem(keyComputed.value, serialized);
|
|
7673
|
-
dispatchWriteEvent(oldValue, serialized);
|
|
7674
|
-
}
|
|
7675
|
-
}
|
|
7676
|
-
} catch (e) {
|
|
7677
|
-
onError(e);
|
|
7678
|
-
}
|
|
7679
|
-
}
|
|
7680
|
-
function read(event) {
|
|
7681
|
-
const rawValue = event ? event.newValue : storage.getItem(keyComputed.value);
|
|
7682
|
-
if (rawValue == null) {
|
|
7683
|
-
if (writeDefaults && rawInit != null) storage.setItem(keyComputed.value, serializer.write(rawInit));
|
|
7684
|
-
return rawInit;
|
|
7685
|
-
} else if (!event && mergeDefaults) {
|
|
7686
|
-
const value = serializer.read(rawValue);
|
|
7687
|
-
if (typeof mergeDefaults === "function") return mergeDefaults(value, rawInit);
|
|
7688
|
-
else if (type === "object" && !Array.isArray(value)) return {
|
|
7689
|
-
...rawInit,
|
|
7690
|
-
...value
|
|
7691
|
-
};
|
|
7692
|
-
return value;
|
|
7693
|
-
} else if (typeof rawValue !== "string") return rawValue;
|
|
7694
|
-
else return serializer.read(rawValue);
|
|
7695
|
-
}
|
|
7696
|
-
function update(event) {
|
|
7697
|
-
if (event && event.storageArea !== storage) return;
|
|
7698
|
-
if (event && event.key == null) {
|
|
7699
|
-
data.value = rawInit;
|
|
7700
|
-
return;
|
|
7701
|
-
}
|
|
7702
|
-
if (event && event.key !== keyComputed.value) return;
|
|
7703
|
-
pauseWatch();
|
|
7704
|
-
try {
|
|
7705
|
-
const serializedData = serializer.write(data.value);
|
|
7706
|
-
if (event === void 0 || (event === null || event === void 0 ? void 0 : event.newValue) !== serializedData) data.value = read(event);
|
|
7707
|
-
} catch (e) {
|
|
7708
|
-
onError(e);
|
|
7709
|
-
} finally {
|
|
7710
|
-
if (event) nextTick(resumeWatch);
|
|
7711
|
-
else resumeWatch();
|
|
7712
|
-
}
|
|
7713
|
-
}
|
|
7714
|
-
function updateFromCustomEvent(event) {
|
|
7715
|
-
update(event.detail);
|
|
7716
|
-
}
|
|
7717
|
-
return data;
|
|
7718
|
-
}
|
|
7719
|
-
/**
|
|
7720
|
-
* Manipulate CSS variables.
|
|
7721
|
-
*
|
|
7722
|
-
* @see https://vueuse.org/useCssVar
|
|
7723
|
-
* @param prop
|
|
7724
|
-
* @param target
|
|
7725
|
-
* @param options
|
|
7726
|
-
*/
|
|
7727
|
-
function useCssVar(prop, target, options = {}) {
|
|
7728
|
-
const { window: window$1 = defaultWindow, initialValue, observe = false } = options;
|
|
7729
|
-
const variable = /* @__PURE__ */ shallowRef(initialValue);
|
|
7730
|
-
const elRef = computed(() => {
|
|
7731
|
-
var _window$document;
|
|
7732
|
-
return unrefElement(target) || (window$1 === null || window$1 === void 0 || (_window$document = window$1.document) === null || _window$document === void 0 ? void 0 : _window$document.documentElement);
|
|
7733
|
-
});
|
|
7734
|
-
function updateCssVar() {
|
|
7735
|
-
const key = toValue(prop);
|
|
7736
|
-
const el = toValue(elRef);
|
|
7737
|
-
if (el && window$1 && key) {
|
|
7738
|
-
var _window$getComputedSt;
|
|
7739
|
-
variable.value = ((_window$getComputedSt = window$1.getComputedStyle(el).getPropertyValue(key)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.trim()) || variable.value || initialValue;
|
|
7740
|
-
}
|
|
7741
|
-
}
|
|
7742
|
-
if (observe) useMutationObserver(elRef, updateCssVar, {
|
|
7743
|
-
attributeFilter: ["style", "class"],
|
|
7744
|
-
window: window$1
|
|
7745
|
-
});
|
|
7746
|
-
watch([elRef, () => toValue(prop)], (_, old) => {
|
|
7747
|
-
if (old[0] && old[1]) old[0].style.removeProperty(old[1]);
|
|
7748
|
-
updateCssVar();
|
|
7749
|
-
}, { immediate: true });
|
|
7750
|
-
watch([variable, elRef], ([val, el]) => {
|
|
7751
|
-
const raw_prop = toValue(prop);
|
|
7752
|
-
if ((el === null || el === void 0 ? void 0 : el.style) && raw_prop) if (val == null) el.style.removeProperty(raw_prop);
|
|
7753
|
-
else el.style.setProperty(raw_prop, val);
|
|
7754
|
-
}, { immediate: true });
|
|
7755
|
-
return variable;
|
|
7756
|
-
}
|
|
7757
|
-
/**
|
|
7758
|
-
* Reports changes to the dimensions of an Element's content or the border-box
|
|
7759
|
-
*
|
|
7760
|
-
* @see https://vueuse.org/useResizeObserver
|
|
7761
|
-
* @param target
|
|
7762
|
-
* @param callback
|
|
7763
|
-
* @param options
|
|
7764
|
-
*/
|
|
7765
|
-
function useResizeObserver(target, callback, options = {}) {
|
|
7766
|
-
const { window: window$1 = defaultWindow, ...observerOptions } = options;
|
|
7767
|
-
let observer;
|
|
7768
|
-
const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "ResizeObserver" in window$1);
|
|
7769
|
-
const cleanup = () => {
|
|
7770
|
-
if (observer) {
|
|
7771
|
-
observer.disconnect();
|
|
7772
|
-
observer = void 0;
|
|
7773
|
-
}
|
|
7774
|
-
};
|
|
7775
|
-
const stopWatch = watch(computed(() => {
|
|
7776
|
-
const _targets = toValue(target);
|
|
7777
|
-
return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
|
|
7778
|
-
}), (els) => {
|
|
7779
|
-
cleanup();
|
|
7780
|
-
if (isSupported.value && window$1) {
|
|
7781
|
-
observer = new ResizeObserver(callback);
|
|
7782
|
-
for (const _el of els) if (_el) observer.observe(_el, observerOptions);
|
|
7783
|
-
}
|
|
7784
|
-
}, {
|
|
7785
|
-
immediate: true,
|
|
7786
|
-
flush: "post"
|
|
7787
|
-
});
|
|
7788
|
-
const stop = () => {
|
|
7789
|
-
cleanup();
|
|
7790
|
-
stopWatch();
|
|
7791
|
-
};
|
|
7792
|
-
tryOnScopeDispose(stop);
|
|
7793
|
-
return {
|
|
7794
|
-
isSupported,
|
|
7795
|
-
stop
|
|
7796
|
-
};
|
|
7797
|
-
}
|
|
7798
|
-
/**
|
|
7799
|
-
* Reactive bounding box of an HTML element.
|
|
7800
|
-
*
|
|
7801
|
-
* @see https://vueuse.org/useElementBounding
|
|
7802
|
-
* @param target
|
|
7803
|
-
*/
|
|
7804
|
-
function useElementBounding(target, options = {}) {
|
|
7805
|
-
const { reset = true, windowResize = true, windowScroll = true, immediate = true, updateTiming = "sync" } = options;
|
|
7806
|
-
const height = /* @__PURE__ */ shallowRef(0);
|
|
7807
|
-
const bottom = /* @__PURE__ */ shallowRef(0);
|
|
7808
|
-
const left = /* @__PURE__ */ shallowRef(0);
|
|
7809
|
-
const right = /* @__PURE__ */ shallowRef(0);
|
|
7810
|
-
const top = /* @__PURE__ */ shallowRef(0);
|
|
7811
|
-
const width = /* @__PURE__ */ shallowRef(0);
|
|
7812
|
-
const x = /* @__PURE__ */ shallowRef(0);
|
|
7813
|
-
const y = /* @__PURE__ */ shallowRef(0);
|
|
7814
|
-
function recalculate() {
|
|
7815
|
-
const el = unrefElement(target);
|
|
7816
|
-
if (!el) {
|
|
7817
|
-
if (reset) {
|
|
7818
|
-
height.value = 0;
|
|
7819
|
-
bottom.value = 0;
|
|
7820
|
-
left.value = 0;
|
|
7821
|
-
right.value = 0;
|
|
7822
|
-
top.value = 0;
|
|
7823
|
-
width.value = 0;
|
|
7824
|
-
x.value = 0;
|
|
7825
|
-
y.value = 0;
|
|
7826
|
-
}
|
|
7827
|
-
return;
|
|
7828
|
-
}
|
|
7829
|
-
const rect = el.getBoundingClientRect();
|
|
7830
|
-
height.value = rect.height;
|
|
7831
|
-
bottom.value = rect.bottom;
|
|
7832
|
-
left.value = rect.left;
|
|
7833
|
-
right.value = rect.right;
|
|
7834
|
-
top.value = rect.top;
|
|
7835
|
-
width.value = rect.width;
|
|
7836
|
-
x.value = rect.x;
|
|
7837
|
-
y.value = rect.y;
|
|
7838
|
-
}
|
|
7839
|
-
function update() {
|
|
7840
|
-
if (updateTiming === "sync") recalculate();
|
|
7841
|
-
else if (updateTiming === "next-frame") requestAnimationFrame(() => recalculate());
|
|
7842
|
-
}
|
|
7843
|
-
useResizeObserver(target, update);
|
|
7844
|
-
watch(() => unrefElement(target), (ele) => !ele && update());
|
|
7845
|
-
useMutationObserver(target, update, { attributeFilter: ["style", "class"] });
|
|
7846
|
-
if (windowScroll) useEventListener("scroll", update, {
|
|
7847
|
-
capture: true,
|
|
7848
|
-
passive: true
|
|
7849
|
-
});
|
|
7850
|
-
if (windowResize) useEventListener("resize", update, { passive: true });
|
|
7851
|
-
tryOnMounted(() => {
|
|
7852
|
-
if (immediate) update();
|
|
7853
|
-
});
|
|
7854
|
-
return {
|
|
7855
|
-
height,
|
|
7856
|
-
bottom,
|
|
7857
|
-
left,
|
|
7858
|
-
right,
|
|
7859
|
-
top,
|
|
7860
|
-
width,
|
|
7861
|
-
x,
|
|
7862
|
-
y,
|
|
7863
|
-
update
|
|
7864
|
-
};
|
|
7865
|
-
}
|
|
7866
|
-
/**
|
|
7867
|
-
* Reactive LocalStorage.
|
|
7868
|
-
*
|
|
7869
|
-
* @see https://vueuse.org/useLocalStorage
|
|
7870
|
-
* @param key
|
|
7871
|
-
* @param initialValue
|
|
7872
|
-
* @param options
|
|
7873
|
-
*/
|
|
7874
|
-
function useLocalStorage(key, initialValue, options = {}) {
|
|
7875
|
-
const { window: window$1 = defaultWindow } = options;
|
|
7876
|
-
return useStorage(key, initialValue, window$1 === null || window$1 === void 0 ? void 0 : window$1.localStorage, options);
|
|
7877
|
-
}
|
|
7878
|
-
function getDefaultScheduler$5(options) {
|
|
7879
|
-
if ("interval" in options || "immediate" in options) {
|
|
7880
|
-
const { interval = "requestAnimationFrame", immediate = true } = options;
|
|
7881
|
-
return interval === "requestAnimationFrame" ? (fn) => useRafFn(fn, { immediate }) : (fn) => useIntervalFn(fn, interval, options);
|
|
7882
|
-
}
|
|
7883
|
-
return useRafFn;
|
|
7884
|
-
}
|
|
7885
|
-
/**
|
|
7886
|
-
* Reactive current Date instance.
|
|
7887
|
-
*
|
|
7888
|
-
* @see https://vueuse.org/useNow
|
|
7889
|
-
* @param options
|
|
7890
|
-
*
|
|
7891
|
-
* @__NO_SIDE_EFFECTS__
|
|
7892
|
-
*/
|
|
7893
|
-
function useNow(options = {}) {
|
|
7894
|
-
const { controls: exposeControls = false, scheduler = getDefaultScheduler$5(options) } = options;
|
|
7895
|
-
const now = /* @__PURE__ */ ref(/* @__PURE__ */ new Date());
|
|
7896
|
-
const update = () => now.value = /* @__PURE__ */ new Date();
|
|
7897
|
-
const controls = scheduler(update);
|
|
7898
|
-
if (exposeControls) return {
|
|
7899
|
-
now,
|
|
7900
|
-
...controls
|
|
7901
|
-
};
|
|
7902
|
-
else return now;
|
|
7903
|
-
}
|
|
7904
|
-
const topVarName = "--vueuse-safe-area-top";
|
|
7905
|
-
const rightVarName = "--vueuse-safe-area-right";
|
|
7906
|
-
const bottomVarName = "--vueuse-safe-area-bottom";
|
|
7907
|
-
const leftVarName = "--vueuse-safe-area-left";
|
|
7908
|
-
/**
|
|
7909
|
-
* Reactive `env(safe-area-inset-*)`
|
|
7910
|
-
*
|
|
7911
|
-
* @see https://vueuse.org/useScreenSafeArea
|
|
7912
|
-
*/
|
|
7913
|
-
function useScreenSafeArea() {
|
|
7914
|
-
const top = /* @__PURE__ */ shallowRef("");
|
|
7915
|
-
const right = /* @__PURE__ */ shallowRef("");
|
|
7916
|
-
const bottom = /* @__PURE__ */ shallowRef("");
|
|
7917
|
-
const left = /* @__PURE__ */ shallowRef("");
|
|
7918
|
-
if (isClient) {
|
|
7919
|
-
const topCssVar = useCssVar(topVarName);
|
|
7920
|
-
const rightCssVar = useCssVar(rightVarName);
|
|
7921
|
-
const bottomCssVar = useCssVar(bottomVarName);
|
|
7922
|
-
const leftCssVar = useCssVar(leftVarName);
|
|
7923
|
-
topCssVar.value = "env(safe-area-inset-top, 0px)";
|
|
7924
|
-
rightCssVar.value = "env(safe-area-inset-right, 0px)";
|
|
7925
|
-
bottomCssVar.value = "env(safe-area-inset-bottom, 0px)";
|
|
7926
|
-
leftCssVar.value = "env(safe-area-inset-left, 0px)";
|
|
7927
|
-
tryOnMounted(update);
|
|
7928
|
-
useEventListener("resize", useDebounceFn(update), { passive: true });
|
|
7929
|
-
}
|
|
7930
|
-
function update() {
|
|
7931
|
-
top.value = getValue(topVarName);
|
|
7932
|
-
right.value = getValue(rightVarName);
|
|
7933
|
-
bottom.value = getValue(bottomVarName);
|
|
7934
|
-
left.value = getValue(leftVarName);
|
|
7935
|
-
}
|
|
7936
|
-
return {
|
|
7937
|
-
top,
|
|
7938
|
-
right,
|
|
7939
|
-
bottom,
|
|
7940
|
-
left,
|
|
7941
|
-
update
|
|
7942
|
-
};
|
|
7943
|
-
}
|
|
7944
|
-
function getValue(position) {
|
|
7945
|
-
return getComputedStyle(document.documentElement).getPropertyValue(position);
|
|
7946
|
-
}
|
|
7947
|
-
const DEFAULT_UNITS = [
|
|
7948
|
-
{
|
|
7949
|
-
max: 6e4,
|
|
7950
|
-
value: 1e3,
|
|
7951
|
-
name: "second"
|
|
7952
|
-
},
|
|
7953
|
-
{
|
|
7954
|
-
max: 276e4,
|
|
7955
|
-
value: 6e4,
|
|
7956
|
-
name: "minute"
|
|
7957
|
-
},
|
|
7958
|
-
{
|
|
7959
|
-
max: 72e6,
|
|
7960
|
-
value: 36e5,
|
|
7961
|
-
name: "hour"
|
|
7962
|
-
},
|
|
7963
|
-
{
|
|
7964
|
-
max: 5184e5,
|
|
7965
|
-
value: 864e5,
|
|
7966
|
-
name: "day"
|
|
7967
|
-
},
|
|
7968
|
-
{
|
|
7969
|
-
max: 24192e5,
|
|
7970
|
-
value: 6048e5,
|
|
7971
|
-
name: "week"
|
|
7972
|
-
},
|
|
7973
|
-
{
|
|
7974
|
-
max: 28512e6,
|
|
7975
|
-
value: 2592e6,
|
|
7976
|
-
name: "month"
|
|
7977
|
-
},
|
|
7978
|
-
{
|
|
7979
|
-
max: Number.POSITIVE_INFINITY,
|
|
7980
|
-
value: 31536e6,
|
|
7981
|
-
name: "year"
|
|
7982
|
-
}
|
|
7983
|
-
];
|
|
7984
|
-
const DEFAULT_MESSAGES = {
|
|
7985
|
-
justNow: "just now",
|
|
7986
|
-
past: (n) => n.match(/\d/) ? `${n} ago` : n,
|
|
7987
|
-
future: (n) => n.match(/\d/) ? `in ${n}` : n,
|
|
7988
|
-
month: (n, past) => n === 1 ? past ? "last month" : "next month" : `${n} month${n > 1 ? "s" : ""}`,
|
|
7989
|
-
year: (n, past) => n === 1 ? past ? "last year" : "next year" : `${n} year${n > 1 ? "s" : ""}`,
|
|
7990
|
-
day: (n, past) => n === 1 ? past ? "yesterday" : "tomorrow" : `${n} day${n > 1 ? "s" : ""}`,
|
|
7991
|
-
week: (n, past) => n === 1 ? past ? "last week" : "next week" : `${n} week${n > 1 ? "s" : ""}`,
|
|
7992
|
-
hour: (n) => `${n} hour${n > 1 ? "s" : ""}`,
|
|
7993
|
-
minute: (n) => `${n} minute${n > 1 ? "s" : ""}`,
|
|
7994
|
-
second: (n) => `${n} second${n > 1 ? "s" : ""}`,
|
|
7995
|
-
invalid: ""
|
|
7996
|
-
};
|
|
7997
|
-
function DEFAULT_FORMATTER(date) {
|
|
7998
|
-
return date.toISOString().slice(0, 10);
|
|
7999
|
-
}
|
|
8000
|
-
function getDefaultScheduler$4(options) {
|
|
8001
|
-
if ("updateInterval" in options) {
|
|
8002
|
-
const { updateInterval = 3e4 } = options;
|
|
8003
|
-
return (cb) => useIntervalFn(cb, updateInterval);
|
|
8004
|
-
}
|
|
8005
|
-
return (cb) => useIntervalFn(cb, 3e4);
|
|
8006
|
-
}
|
|
8007
|
-
/**
|
|
8008
|
-
* Reactive time ago formatter.
|
|
8009
|
-
*
|
|
8010
|
-
* @see https://vueuse.org/useTimeAgo
|
|
8011
|
-
*
|
|
8012
|
-
* @__NO_SIDE_EFFECTS__
|
|
8013
|
-
*/
|
|
8014
|
-
function useTimeAgo(time, options = {}) {
|
|
8015
|
-
const { controls: exposeControls = false, scheduler = getDefaultScheduler$4(options) } = options;
|
|
8016
|
-
const { now, ...controls } = useNow({
|
|
8017
|
-
scheduler,
|
|
8018
|
-
controls: true
|
|
8019
|
-
});
|
|
8020
|
-
const timeAgo = computed(() => formatTimeAgo(new Date(toValue(time)), options, toValue(now)));
|
|
8021
|
-
if (exposeControls) return {
|
|
8022
|
-
timeAgo,
|
|
8023
|
-
...controls
|
|
8024
|
-
};
|
|
8025
|
-
else return timeAgo;
|
|
8026
|
-
}
|
|
8027
|
-
function formatTimeAgo(from, options = {}, now = Date.now()) {
|
|
8028
|
-
const { max, messages = DEFAULT_MESSAGES, fullDateFormatter = DEFAULT_FORMATTER, units = DEFAULT_UNITS, showSecond = false, rounding = "round" } = options;
|
|
8029
|
-
const roundFn = typeof rounding === "number" ? (n) => +n.toFixed(rounding) : Math[rounding];
|
|
8030
|
-
const diff = +now - +from;
|
|
8031
|
-
const absDiff = Math.abs(diff);
|
|
8032
|
-
function getValue$1(diff$1, unit) {
|
|
8033
|
-
return roundFn(Math.abs(diff$1) / unit.value);
|
|
8034
|
-
}
|
|
8035
|
-
function format(diff$1, unit) {
|
|
8036
|
-
const val = getValue$1(diff$1, unit);
|
|
8037
|
-
const past = diff$1 > 0;
|
|
8038
|
-
const str = applyFormat(unit.name, val, past);
|
|
8039
|
-
return applyFormat(past ? "past" : "future", str, past);
|
|
8040
|
-
}
|
|
8041
|
-
function applyFormat(name, val, isPast) {
|
|
8042
|
-
const formatter = messages[name];
|
|
8043
|
-
if (typeof formatter === "function") return formatter(val, isPast);
|
|
8044
|
-
return formatter.replace("{0}", val.toString());
|
|
8045
|
-
}
|
|
8046
|
-
if (absDiff < 6e4 && !showSecond) return messages.justNow;
|
|
8047
|
-
if (typeof max === "number" && absDiff > max) return fullDateFormatter(new Date(from));
|
|
8048
|
-
if (typeof max === "string") {
|
|
8049
|
-
var _units$find;
|
|
8050
|
-
const unitMax = (_units$find = units.find((i) => i.name === max)) === null || _units$find === void 0 ? void 0 : _units$find.max;
|
|
8051
|
-
if (unitMax && absDiff > unitMax) return fullDateFormatter(new Date(from));
|
|
8052
|
-
}
|
|
8053
|
-
for (const [idx, unit] of units.entries()) {
|
|
8054
|
-
if (getValue$1(diff, unit) <= 0 && units[idx - 1]) return format(diff, units[idx - 1]);
|
|
8055
|
-
if (absDiff < unit.max) return format(diff, unit);
|
|
8056
|
-
}
|
|
8057
|
-
return messages.invalid;
|
|
8058
|
-
}
|
|
8059
|
-
/**
|
|
8060
|
-
* Reactive window size.
|
|
8061
|
-
*
|
|
8062
|
-
* @see https://vueuse.org/useWindowSize
|
|
8063
|
-
* @param options
|
|
8064
|
-
*
|
|
8065
|
-
* @__NO_SIDE_EFFECTS__
|
|
8066
|
-
*/
|
|
8067
|
-
function useWindowSize(options = {}) {
|
|
8068
|
-
const { window: window$1 = defaultWindow, initialWidth = Number.POSITIVE_INFINITY, initialHeight = Number.POSITIVE_INFINITY, listenOrientation = true, includeScrollbar = true, type = "inner" } = options;
|
|
8069
|
-
const width = /* @__PURE__ */ shallowRef(initialWidth);
|
|
8070
|
-
const height = /* @__PURE__ */ shallowRef(initialHeight);
|
|
8071
|
-
const update = () => {
|
|
8072
|
-
if (window$1) if (type === "outer") {
|
|
8073
|
-
width.value = window$1.outerWidth;
|
|
8074
|
-
height.value = window$1.outerHeight;
|
|
8075
|
-
} else if (type === "visual" && window$1.visualViewport) {
|
|
8076
|
-
const { width: visualViewportWidth, height: visualViewportHeight, scale } = window$1.visualViewport;
|
|
8077
|
-
width.value = Math.round(visualViewportWidth * scale);
|
|
8078
|
-
height.value = Math.round(visualViewportHeight * scale);
|
|
8079
|
-
} else if (includeScrollbar) {
|
|
8080
|
-
width.value = window$1.innerWidth;
|
|
8081
|
-
height.value = window$1.innerHeight;
|
|
8082
|
-
} else {
|
|
8083
|
-
width.value = window$1.document.documentElement.clientWidth;
|
|
8084
|
-
height.value = window$1.document.documentElement.clientHeight;
|
|
8085
|
-
}
|
|
8086
|
-
};
|
|
8087
|
-
update();
|
|
8088
|
-
tryOnMounted(update);
|
|
8089
|
-
const listenerOptions = { passive: true };
|
|
8090
|
-
useEventListener("resize", update, listenerOptions);
|
|
8091
|
-
if (window$1 && type === "visual" && window$1.visualViewport) useEventListener(window$1.visualViewport, "resize", update, listenerOptions);
|
|
8092
|
-
if (listenOrientation) watch(useMediaQuery("(orientation: portrait)"), () => update());
|
|
8093
|
-
return {
|
|
8094
|
-
width,
|
|
8095
|
-
height
|
|
8096
|
-
};
|
|
8097
|
-
}
|
|
8098
|
-
//#endregion
|
|
8099
|
-
export { nextTick as A, withDirectives as B, createElementBlock as C, defineAsyncComponent as D, createVNode as E, renderSlot as F, toRefs as G, reactive as H, useTemplateRef as I, normalizeStyle as J, unref as K, watch as L, onUnmounted as M, openBlock as N, defineComponent as O, renderList as P, watchEffect as R, createCommentVNode as S, createTextVNode as T, ref as U, markRaw as V, shallowRef as W, toDisplayString as Y, Fragment as _, useScreenSafeArea as a, createBaseVNode as b, useDebounceFn as c, TransitionGroup as d, defineCustomElement as f, withModifiers as g, withKeys as h, useLocalStorage as i, onMounted as j, h as k, watchDebounced as l, vShow as m, useElementBounding as n, useTimeAgo as o, vModelText as p, normalizeClass as q, useEventListener as r, useWindowSize as s, onClickOutside as t, watchImmediate as u, Suspense as v, createStaticVNode as w, createBlock as x, computed as y, withCtx as z };
|
|
6988
|
+
export { renderSlot as A, onScopeDispose as B, nextTick as C, openBlock as D, onUnmounted as E, withDirectives as F, shallowRef as G, readonly as H, customRef as I, toValue as J, toRef as K, getCurrentScope as L, watch as M, watchEffect as N, provide as O, withCtx as P, toDisplayString as Q, isRef as R, inject as S, onMounted as T, ref as U, reactive as V, shallowReadonly as W, normalizeClass as X, unref as Y, normalizeStyle as Z, defineAsyncComponent as _, withKeys as a, h as b, Suspense as c, createBlock as d, createCommentVNode as f, createVNode as g, createTextVNode as h, vShow as i, useTemplateRef as j, renderList as k, computed as l, createStaticVNode as m, defineCustomElement as n, withModifiers as o, createElementBlock as p, toRefs as q, vModelText as r, Fragment as s, TransitionGroup as t, createBaseVNode as u, defineComponent as v, onErrorCaptured as w, hasInjectionContext as x, getCurrentInstance as y, markRaw as z };
|