@pubinfo/core 2.1.10-beta.2 → 2.1.11
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/{AppSetting-Dl8pVkN4.js → AppSetting-7jlhUzze.js} +42 -42
- package/dist/{HButton-CzYSwI6a.js → HButton-Dt6qGhhR.js} +7 -7
- package/dist/{HCheckList-CHR-lWIq.js → HCheckList-cPBgATmv.js} +15 -15
- package/dist/{HDivider-CXS9rl4C.js → HDivider-BwvBr5OE.js} +3 -3
- package/dist/{HInput-CSVwTg1Q.js → HInput-KJ5nFBpF.js} +10 -10
- package/dist/HSlideover-DVQDc9q6.js +3151 -0
- package/dist/{HToggle-C_iVIpxv.js → HToggle-Ce_2-yhZ.js} +8 -8
- package/dist/{HTooltip-BHBHfrCD.js → HTooltip-DjAU-Evn.js} +6 -6
- package/dist/PreferencesContent-BAIH81yS.js +701 -0
- package/dist/SettingBreadcrumb-O9-PhAFT.js +45 -0
- package/dist/SettingCopyright-DIKsWTuf.js +45 -0
- package/dist/{SettingEnableTransition-BBH52KKl.js → SettingEnableTransition-61O7W00b.js} +19 -19
- package/dist/SettingHome-Sv65TPH8.js +31 -0
- package/dist/SettingMenu-BvwJOUZV.js +111 -0
- package/dist/{SettingMode-BwhhUYlz.js → SettingMode-B8H_eQc8.js} +14 -14
- package/dist/SettingNavSearch-BHsmYBA7.js +31 -0
- package/dist/SettingOther-CyyNnaDX.js +48 -0
- package/dist/SettingPage-B82lW41P.js +22 -0
- package/dist/{SettingTabbar-DuqQVRnz.js → SettingTabbar-Bky2xvH-.js} +58 -58
- package/dist/{SettingThemes-Doo6Ax3u.js → SettingThemes-CkdzS1xt.js} +44 -44
- package/dist/SettingToolbar-CD4qns1J.js +50 -0
- package/dist/SettingTopbar-1shjoe3s.js +49 -0
- package/dist/{SettingWidthMode-VaN0CrBa.js → SettingWidthMode-DlG6lXjA.js} +14 -14
- package/dist/auth-BLGKOyc5.js +4432 -0
- package/dist/built-in/layout-component/composables/useContext.d.ts +1 -0
- package/dist/{change-organization-OjxZhWST.js → change-organization-hsqeSzDu.js} +38 -38
- package/dist/{change-password-B6kO54-d.js → change-password-EtccCDRX.js} +73 -73
- package/dist/{chunk-EsrJ1IKw.js → chunk-CD4vhpVs.js} +3 -3
- package/dist/{components-DVIyiEVI.js → components-DFNyaAb9.js} +1584 -1584
- package/dist/core/request.d.ts +1 -1
- package/dist/core-DJIGzMMM.js +4885 -0
- package/dist/dist-7OjQvlya.js +468 -0
- package/dist/engine-oniguruma-CaNXwGSv.js +243 -0
- package/dist/features/settings/index.d.ts +90 -1
- package/dist/{form-EQ9eL9hv.js → form-C3VHofnN.js} +923 -443
- package/dist/index.js +4418 -3895
- package/dist/{modal-CSWipFvB.js → modal-Bl5xHbxa.js} +15510 -15790
- package/dist/{not-found-DBe-djEg.js → not-found-BCjngLzt.js} +19 -19
- package/dist/{not-permission-DQzWCpOK.js → not-permission-C26vTMvf.js} +19 -19
- package/dist/{profile-DJ3gpjsS.js → profile-BVXIFuBG.js} +3340 -3277
- package/dist/{question-line-BKVlJGUb.js → question-line-BG__Ycfv.js} +2 -2
- package/dist/{reload-DAR8dVYw.js → reload-DHx5Vwus.js} +4 -4
- package/dist/{right-VKgVtqD5.js → right-BxBlFUwj.js} +6 -6
- package/dist/style.css +1 -1
- package/dist/{tree-select-CTjWj5WT.js → tree-select-B8cTcGLa.js} +2575 -2256
- package/dist/watchDiff-CPZFtaOC.js +655 -0
- package/package.json +41 -41
- package/src/built-in/layout-component/components/Header/HeaderMenu.vue +2 -3
- package/src/built-in/layout-component/components/Menu/item.vue +2 -2
- package/src/built-in/layout-component/components/Menu/sub.vue +20 -1
- package/src/built-in/layout-component/composables/useContext.ts +1 -0
- package/src/built-in/layout-component/composables/useLayoutVisible.ts +1 -1
- package/src/built-in/layout-component/provider.ts +5 -0
- package/src/built-in/system-info/components/SystemInfo.vue +68 -66
- package/src/built-in/system-info/index.ts +4 -4
- package/src/core/ctx.ts +2 -2
- package/src/core/request.ts +1 -1
- package/src/features/components/PubinfoApp/index.vue +1 -0
- package/types/auto-imports.d.ts +63 -63
- package/types/components.d.ts +45 -1
- package/dist/HSlideover-Bc6OHPHe.js +0 -1695
- package/dist/HeaderFullMenu-BRhGliRJ.js +0 -6
- package/dist/HeaderFullMenu-DCF-gTCZ.js +0 -249
- package/dist/HeaderThinMenu-B_7vLcQX.js +0 -6
- package/dist/HeaderThinMenu-PA12XAvb.js +0 -437
- package/dist/PreferencesContent-cll4nwwl.js +0 -695
- package/dist/SettingBreadcrumb-BvSc7VUo.js +0 -45
- package/dist/SettingCopyright-DcWLKM5d.js +0 -45
- package/dist/SettingHome-Cd43oJmB.js +0 -31
- package/dist/SettingMenu-CJsN4F1l.js +0 -111
- package/dist/SettingNavSearch-BhHUWem3.js +0 -31
- package/dist/SettingOther-CDY0jSVT.js +0 -48
- package/dist/SettingPage-B0WNvUlj.js +0 -22
- package/dist/SettingToolbar-CHV_dVJ9.js +0 -50
- package/dist/SettingTopbar-CF1K_XIt.js +0 -49
- package/dist/auth-CPSkJwBz.js +0 -3968
- package/dist/core-Bg2PEcZK.js +0 -4884
- package/dist/dist-DAb-7mqe.js +0 -468
- package/dist/engine-oniguruma-CUfGsBrF.js +0 -243
- package/dist/overlayscrollbars-vue-BOGU2FK-.js +0 -1436
- package/dist/pick-C42gkI1h.js +0 -10
- package/dist/watchDiff-C4eGkl9e.js +0 -397
- /package/dist/{_plugin-vue_export-helper-DaPiLSxE.js → _plugin-vue_export-helper-sUTDUeGO.js} +0 -0
- /package/dist/{json-S7wVLDnW.js → json-Bu_Zprin.js} +0 -0
- /package/dist/{useContext-D6pJCZez.js → useContext-DLtu9F7E.js} +0 -0
- /package/dist/{vitesse-dark-BsnBIHGG.js → vitesse-dark-CTe40QT_.js} +0 -0
- /package/dist/{vitesse-light-Cs_6DF7j.js → vitesse-light-BWXC_WeB.js} +0 -0
- /package/dist/{wasm-EvDQvzqp.js → wasm-2zDVqo-C.js} +0 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import { Fragment, TransitionGroup, computed, customRef, defineComponent, getCurrentInstance, getCurrentScope, h, hasInjectionContext, inject, isRef, markRaw, nextTick, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUnmounted, onUpdated, provide, reactive, readonly, ref, shallowReadonly, shallowRef, toRaw, toRef, toRefs, toValue, unref, watch, watchEffect } from "vue";
|
|
2
|
+
function tryOnScopeDispose(e, t) {
|
|
3
|
+
return getCurrentScope() ? (onScopeDispose(e, t), !0) : !1;
|
|
4
|
+
}
|
|
5
|
+
var localProvidedStateMap = /* @__PURE__ */ new WeakMap(), injectLocal = (...e) => {
|
|
6
|
+
let t = e[0], n = getCurrentInstance()?.proxy ?? getCurrentScope();
|
|
7
|
+
if (n == null && !hasInjectionContext()) throw Error("injectLocal must be called in setup");
|
|
8
|
+
return n && localProvidedStateMap.has(n) && t in localProvidedStateMap.get(n) ? localProvidedStateMap.get(n)[t] : inject(...e);
|
|
9
|
+
}, isClient = typeof window < "u" && typeof document < "u";
|
|
10
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
11
|
+
var notNullish = (e) => e != null, toString = Object.prototype.toString, isObject = (e) => toString.call(e) === "[object Object]", noop = () => {};
|
|
12
|
+
function toRef$1(...e) {
|
|
13
|
+
if (e.length !== 1) return toRef(...e);
|
|
14
|
+
let t = e[0];
|
|
15
|
+
return typeof t == "function" ? readonly(customRef(() => ({
|
|
16
|
+
get: t,
|
|
17
|
+
set: noop
|
|
18
|
+
}))) : ref(t);
|
|
19
|
+
}
|
|
20
|
+
function createSingletonPromise(e) {
|
|
21
|
+
let t;
|
|
22
|
+
function n() {
|
|
23
|
+
return t ||= e(), t;
|
|
24
|
+
}
|
|
25
|
+
return n.reset = async () => {
|
|
26
|
+
let e = t;
|
|
27
|
+
t = void 0, e && await e;
|
|
28
|
+
}, n;
|
|
29
|
+
}
|
|
30
|
+
function pxValue(e) {
|
|
31
|
+
return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
|
|
32
|
+
}
|
|
33
|
+
function toArray(e) {
|
|
34
|
+
return Array.isArray(e) ? e : [e];
|
|
35
|
+
}
|
|
36
|
+
function getLifeCycleTarget(e) {
|
|
37
|
+
return e || getCurrentInstance();
|
|
38
|
+
}
|
|
39
|
+
function tryOnMounted(e, t = !0, n) {
|
|
40
|
+
getLifeCycleTarget(n) ? onMounted(e, n) : t ? e() : nextTick(e);
|
|
41
|
+
}
|
|
42
|
+
function useTimeoutFn(e, t, n = {}) {
|
|
43
|
+
let { immediate: r = !0, immediateCallback: i = !1 } = n, a = shallowRef(!1), o;
|
|
44
|
+
function s() {
|
|
45
|
+
o &&= (clearTimeout(o), void 0);
|
|
46
|
+
}
|
|
47
|
+
function c() {
|
|
48
|
+
a.value = !1, s();
|
|
49
|
+
}
|
|
50
|
+
function l(...n) {
|
|
51
|
+
i && e(), s(), a.value = !0, o = setTimeout(() => {
|
|
52
|
+
a.value = !1, o = void 0, e(...n);
|
|
53
|
+
}, toValue(t));
|
|
54
|
+
}
|
|
55
|
+
return r && (a.value = !0, isClient && l()), tryOnScopeDispose(c), {
|
|
56
|
+
isPending: shallowReadonly(a),
|
|
57
|
+
start: l,
|
|
58
|
+
stop: c
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function useToggle(e = !1, t = {}) {
|
|
62
|
+
let { truthyValue: n = !0, falsyValue: r = !1 } = t, i = isRef(e), a = shallowRef(e);
|
|
63
|
+
function o(e) {
|
|
64
|
+
if (arguments.length) return a.value = e, a.value;
|
|
65
|
+
{
|
|
66
|
+
let e = toValue(n);
|
|
67
|
+
return a.value = a.value === e ? toValue(r) : e, a.value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return i ? o : [a, o];
|
|
71
|
+
}
|
|
72
|
+
function watchImmediate(e, t, n) {
|
|
73
|
+
return watch(e, t, {
|
|
74
|
+
...n,
|
|
75
|
+
immediate: !0
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function computedAsync(e, t, r) {
|
|
79
|
+
let i;
|
|
80
|
+
i = isRef(r) ? { evaluating: r } : r || {};
|
|
81
|
+
let { lazy: a = !1, flush: o = "sync", evaluating: s = void 0, shallow: c = !0, onError: l = globalThis.reportError ?? noop } = i, d = shallowRef(!a), f = c ? shallowRef(t) : ref(t), p = 0;
|
|
82
|
+
return watchEffect(async (t) => {
|
|
83
|
+
if (!d.value) return;
|
|
84
|
+
p++;
|
|
85
|
+
let n = p, r = !1;
|
|
86
|
+
s && Promise.resolve().then(() => {
|
|
87
|
+
s.value = !0;
|
|
88
|
+
});
|
|
89
|
+
try {
|
|
90
|
+
let i = await e((e) => {
|
|
91
|
+
t(() => {
|
|
92
|
+
s && (s.value = !1), r || e();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
n === p && (f.value = i);
|
|
96
|
+
} catch (e) {
|
|
97
|
+
l(e);
|
|
98
|
+
} finally {
|
|
99
|
+
s && n === p && (s.value = !1), r = !0;
|
|
100
|
+
}
|
|
101
|
+
}, { flush: o }), a ? computed(() => (d.value = !0, f.value)) : f;
|
|
102
|
+
}
|
|
103
|
+
var defaultWindow = isClient ? window : void 0, defaultDocument = isClient ? window.document : void 0, defaultNavigator = isClient ? window.navigator : void 0;
|
|
104
|
+
isClient && window.location;
|
|
105
|
+
function unrefElement(e) {
|
|
106
|
+
let t = toValue(e);
|
|
107
|
+
return t?.$el ?? t;
|
|
108
|
+
}
|
|
109
|
+
function useEventListener(...e) {
|
|
110
|
+
let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), r = computed(() => {
|
|
111
|
+
let t = toArray(toValue(e[0])).filter((e) => e != null);
|
|
112
|
+
return t.every((e) => typeof e != "string") ? t : void 0;
|
|
113
|
+
});
|
|
114
|
+
return watchImmediate(() => [
|
|
115
|
+
r.value?.map((e) => unrefElement(e)) ?? [defaultWindow].filter((e) => e != null),
|
|
116
|
+
toArray(toValue(r.value ? e[1] : e[0])),
|
|
117
|
+
toArray(unref(r.value ? e[2] : e[1])),
|
|
118
|
+
toValue(r.value ? e[3] : e[2])
|
|
119
|
+
], ([e, n, r, i], a, o) => {
|
|
120
|
+
if (!e?.length || !n?.length || !r?.length) return;
|
|
121
|
+
let s = isObject(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
|
|
122
|
+
o(() => {
|
|
123
|
+
c.forEach((e) => e());
|
|
124
|
+
});
|
|
125
|
+
}, { flush: "post" });
|
|
126
|
+
}
|
|
127
|
+
function useMounted() {
|
|
128
|
+
let e = shallowRef(!1), t = getCurrentInstance();
|
|
129
|
+
return t && onMounted(() => {
|
|
130
|
+
e.value = !0;
|
|
131
|
+
}, t), e;
|
|
132
|
+
}
|
|
133
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
134
|
+
function useSupported(e) {
|
|
135
|
+
let t = useMounted();
|
|
136
|
+
return computed(() => (t.value, !!e()));
|
|
137
|
+
}
|
|
138
|
+
function useMutationObserver(e, t, r = {}) {
|
|
139
|
+
let { window: i = defaultWindow, ...a } = r, o, s = /* @__PURE__ */ useSupported(() => i && "MutationObserver" in i), c = () => {
|
|
140
|
+
o &&= (o.disconnect(), void 0);
|
|
141
|
+
}, l = watch(computed(() => {
|
|
142
|
+
let t = toArray(toValue(e)).map(unrefElement).filter(notNullish);
|
|
143
|
+
return new Set(t);
|
|
144
|
+
}), (e) => {
|
|
145
|
+
c(), s.value && e.size && (o = new MutationObserver(t), e.forEach((e) => o.observe(e, a)));
|
|
146
|
+
}, {
|
|
147
|
+
immediate: !0,
|
|
148
|
+
flush: "post"
|
|
149
|
+
}), u = () => o?.takeRecords(), d = () => {
|
|
150
|
+
l(), c();
|
|
151
|
+
};
|
|
152
|
+
return tryOnScopeDispose(d), {
|
|
153
|
+
isSupported: s,
|
|
154
|
+
stop: d,
|
|
155
|
+
takeRecords: u
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
var ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
159
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
160
|
+
function useSSRWidth() {
|
|
161
|
+
let e = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
|
|
162
|
+
return typeof e == "number" ? e : void 0;
|
|
163
|
+
}
|
|
164
|
+
function useMediaQuery(e, t = {}) {
|
|
165
|
+
let { window: r = defaultWindow, ssrWidth: i = /* @__PURE__ */ useSSRWidth() } = t, a = /* @__PURE__ */ useSupported(() => r && "matchMedia" in r && typeof r.matchMedia == "function"), o = shallowRef(typeof i == "number"), s = shallowRef(), c = shallowRef(!1);
|
|
166
|
+
return watchEffect(() => {
|
|
167
|
+
if (o.value) {
|
|
168
|
+
o.value = !a.value, c.value = toValue(e).split(",").some((e) => {
|
|
169
|
+
let t = e.includes("not all"), n = e.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), r = e.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), a = !!(n || r);
|
|
170
|
+
return n && a && (a = i >= pxValue(n[1])), r && a && (a = i <= pxValue(r[1])), t ? !a : a;
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
a.value && (s.value = r.matchMedia(toValue(e)), c.value = s.value.matches);
|
|
175
|
+
}), useEventListener(s, "change", (e) => {
|
|
176
|
+
c.value = e.matches;
|
|
177
|
+
}, { passive: !0 }), computed(() => c.value);
|
|
178
|
+
}
|
|
179
|
+
function usePermission(e, t = {}) {
|
|
180
|
+
let { controls: n = !1, navigator: r = defaultNavigator } = t, i = /* @__PURE__ */ useSupported(() => r && "permissions" in r), a = shallowRef(), o = typeof e == "string" ? { name: e } : e, s = shallowRef(), c = () => {
|
|
181
|
+
s.value = a.value?.state ?? "prompt";
|
|
182
|
+
};
|
|
183
|
+
useEventListener(a, "change", c, { passive: !0 });
|
|
184
|
+
let l = createSingletonPromise(async () => {
|
|
185
|
+
if (i.value) {
|
|
186
|
+
if (!a.value) try {
|
|
187
|
+
a.value = await r.permissions.query(o);
|
|
188
|
+
} catch {
|
|
189
|
+
a.value = void 0;
|
|
190
|
+
} finally {
|
|
191
|
+
c();
|
|
192
|
+
}
|
|
193
|
+
if (n) return toRaw(a.value);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return l(), n ? {
|
|
197
|
+
state: s,
|
|
198
|
+
isSupported: i,
|
|
199
|
+
query: l
|
|
200
|
+
} : s;
|
|
201
|
+
}
|
|
202
|
+
function useClipboard(e = {}) {
|
|
203
|
+
let { navigator: t = defaultNavigator, read: r = !1, source: i, copiedDuring: a = 1500, legacy: o = !1 } = e, s = /* @__PURE__ */ useSupported(() => t && "clipboard" in t), c = usePermission("clipboard-read"), l = usePermission("clipboard-write"), u = computed(() => s.value || o), d = shallowRef(""), f = shallowRef(!1), p = useTimeoutFn(() => f.value = !1, a, { immediate: !1 });
|
|
204
|
+
async function m() {
|
|
205
|
+
let e = !(s.value && y(c.value));
|
|
206
|
+
if (!e) try {
|
|
207
|
+
d.value = await t.clipboard.readText();
|
|
208
|
+
} catch {
|
|
209
|
+
e = !0;
|
|
210
|
+
}
|
|
211
|
+
e && (d.value = v());
|
|
212
|
+
}
|
|
213
|
+
u.value && r && useEventListener(["copy", "cut"], m, { passive: !0 });
|
|
214
|
+
async function g(e = toValue(i)) {
|
|
215
|
+
if (u.value && e != null) {
|
|
216
|
+
let n = !(s.value && y(l.value));
|
|
217
|
+
if (!n) try {
|
|
218
|
+
await t.clipboard.writeText(e);
|
|
219
|
+
} catch {
|
|
220
|
+
n = !0;
|
|
221
|
+
}
|
|
222
|
+
n && _(e), d.value = e, f.value = !0, p.start();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function _(e) {
|
|
226
|
+
let t = document.createElement("textarea");
|
|
227
|
+
t.value = e, t.style.position = "absolute", t.style.opacity = "0", t.setAttribute("readonly", ""), document.body.appendChild(t), t.select(), document.execCommand("copy"), t.remove();
|
|
228
|
+
}
|
|
229
|
+
function v() {
|
|
230
|
+
var e, t;
|
|
231
|
+
return ((e = document) == null || (t = e.getSelection) == null || (t = t.call(e)) == null ? void 0 : t.toString()) ?? "";
|
|
232
|
+
}
|
|
233
|
+
function y(e) {
|
|
234
|
+
return e === "granted" || e === "prompt";
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
isSupported: u,
|
|
238
|
+
text: readonly(d),
|
|
239
|
+
copied: readonly(f),
|
|
240
|
+
copy: g
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function usePreferredDark(e) {
|
|
244
|
+
return useMediaQuery("(prefers-color-scheme: dark)", e);
|
|
245
|
+
}
|
|
246
|
+
function useCssVar(e, t, r = {}) {
|
|
247
|
+
let { window: i = defaultWindow, initialValue: a, observe: o = !1 } = r, s = shallowRef(a), c = computed(() => {
|
|
248
|
+
var e;
|
|
249
|
+
return unrefElement(t) || (i == null || (e = i.document) == null ? void 0 : e.documentElement);
|
|
250
|
+
});
|
|
251
|
+
function l() {
|
|
252
|
+
let t = toValue(e), n = toValue(c);
|
|
253
|
+
n && i && t && (s.value = i.getComputedStyle(n).getPropertyValue(t)?.trim() || s.value || a);
|
|
254
|
+
}
|
|
255
|
+
return o && useMutationObserver(c, l, {
|
|
256
|
+
attributeFilter: ["style", "class"],
|
|
257
|
+
window: i
|
|
258
|
+
}), watch([c, () => toValue(e)], (e, t) => {
|
|
259
|
+
t[0] && t[1] && t[0].style.removeProperty(t[1]), l();
|
|
260
|
+
}, { immediate: !0 }), watch([s, c], ([t, n]) => {
|
|
261
|
+
let r = toValue(e);
|
|
262
|
+
n?.style && r && (t == null ? n.style.removeProperty(r) : n.style.setProperty(r, t));
|
|
263
|
+
}, { immediate: !0 }), s;
|
|
264
|
+
}
|
|
265
|
+
function useResizeObserver(e, t, r = {}) {
|
|
266
|
+
let { window: i = defaultWindow, ...a } = r, o, s = /* @__PURE__ */ useSupported(() => i && "ResizeObserver" in i), c = () => {
|
|
267
|
+
o &&= (o.disconnect(), void 0);
|
|
268
|
+
}, l = watch(computed(() => {
|
|
269
|
+
let t = toValue(e);
|
|
270
|
+
return Array.isArray(t) ? t.map((e) => unrefElement(e)) : [unrefElement(t)];
|
|
271
|
+
}), (e) => {
|
|
272
|
+
if (c(), s.value && i) {
|
|
273
|
+
o = new ResizeObserver(t);
|
|
274
|
+
for (let t of e) t && o.observe(t, a);
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
immediate: !0,
|
|
278
|
+
flush: "post"
|
|
279
|
+
}), u = () => {
|
|
280
|
+
c(), l();
|
|
281
|
+
};
|
|
282
|
+
return tryOnScopeDispose(u), {
|
|
283
|
+
isSupported: s,
|
|
284
|
+
stop: u
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function useElementSize(e, t = {
|
|
288
|
+
width: 0,
|
|
289
|
+
height: 0
|
|
290
|
+
}, r = {}) {
|
|
291
|
+
let { window: i = defaultWindow, box: a = "content-box" } = r, o = computed(() => {
|
|
292
|
+
var t;
|
|
293
|
+
return (t = unrefElement(e)) == null || (t = t.namespaceURI) == null ? void 0 : t.includes("svg");
|
|
294
|
+
}), s = shallowRef(t.width), c = shallowRef(t.height), { stop: l } = useResizeObserver(e, ([t]) => {
|
|
295
|
+
let n = a === "border-box" ? t.borderBoxSize : a === "content-box" ? t.contentBoxSize : t.devicePixelContentBoxSize;
|
|
296
|
+
if (i && o.value) {
|
|
297
|
+
let t = unrefElement(e);
|
|
298
|
+
if (t) {
|
|
299
|
+
let e = t.getBoundingClientRect();
|
|
300
|
+
s.value = e.width, c.value = e.height;
|
|
301
|
+
}
|
|
302
|
+
} else if (n) {
|
|
303
|
+
let e = toArray(n);
|
|
304
|
+
s.value = e.reduce((e, { inlineSize: t }) => e + t, 0), c.value = e.reduce((e, { blockSize: t }) => e + t, 0);
|
|
305
|
+
} else s.value = t.contentRect.width, c.value = t.contentRect.height;
|
|
306
|
+
}, r);
|
|
307
|
+
tryOnMounted(() => {
|
|
308
|
+
let n = unrefElement(e);
|
|
309
|
+
n && (s.value = "offsetWidth" in n ? n.offsetWidth : t.width, c.value = "offsetHeight" in n ? n.offsetHeight : t.height);
|
|
310
|
+
});
|
|
311
|
+
let u = watch(() => unrefElement(e), (e) => {
|
|
312
|
+
s.value = e ? t.width : 0, c.value = e ? t.height : 0;
|
|
313
|
+
});
|
|
314
|
+
function d() {
|
|
315
|
+
l(), u();
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
width: s,
|
|
319
|
+
height: c,
|
|
320
|
+
stop: d
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
var eventHandlers = [
|
|
324
|
+
"fullscreenchange",
|
|
325
|
+
"webkitfullscreenchange",
|
|
326
|
+
"webkitendfullscreen",
|
|
327
|
+
"mozfullscreenchange",
|
|
328
|
+
"MSFullscreenChange"
|
|
329
|
+
];
|
|
330
|
+
function useFullscreen(e, t = {}) {
|
|
331
|
+
let { document: r = defaultDocument, autoExit: i = !1 } = t, a = computed(() => unrefElement(e) ?? r?.documentElement), o = shallowRef(!1), s = computed(() => [
|
|
332
|
+
"requestFullscreen",
|
|
333
|
+
"webkitRequestFullscreen",
|
|
334
|
+
"webkitEnterFullscreen",
|
|
335
|
+
"webkitEnterFullScreen",
|
|
336
|
+
"webkitRequestFullScreen",
|
|
337
|
+
"mozRequestFullScreen",
|
|
338
|
+
"msRequestFullscreen"
|
|
339
|
+
].find((e) => r && e in r || a.value && e in a.value)), c = computed(() => [
|
|
340
|
+
"exitFullscreen",
|
|
341
|
+
"webkitExitFullscreen",
|
|
342
|
+
"webkitExitFullScreen",
|
|
343
|
+
"webkitCancelFullScreen",
|
|
344
|
+
"mozCancelFullScreen",
|
|
345
|
+
"msExitFullscreen"
|
|
346
|
+
].find((e) => r && e in r || a.value && e in a.value)), l = computed(() => [
|
|
347
|
+
"fullScreen",
|
|
348
|
+
"webkitIsFullScreen",
|
|
349
|
+
"webkitDisplayingFullscreen",
|
|
350
|
+
"mozFullScreen",
|
|
351
|
+
"msFullscreenElement"
|
|
352
|
+
].find((e) => r && e in r || a.value && e in a.value)), u = [
|
|
353
|
+
"fullscreenElement",
|
|
354
|
+
"webkitFullscreenElement",
|
|
355
|
+
"mozFullScreenElement",
|
|
356
|
+
"msFullscreenElement"
|
|
357
|
+
].find((e) => r && e in r), d = /* @__PURE__ */ useSupported(() => a.value && r && s.value !== void 0 && c.value !== void 0 && l.value !== void 0), f = () => u ? r?.[u] === a.value : !1, p = () => {
|
|
358
|
+
if (l.value) {
|
|
359
|
+
if (r && r[l.value] != null) return r[l.value];
|
|
360
|
+
{
|
|
361
|
+
let e = a.value;
|
|
362
|
+
if (e?.[l.value] != null) return !!e[l.value];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return !1;
|
|
366
|
+
};
|
|
367
|
+
async function m() {
|
|
368
|
+
if (!(!d.value || !o.value)) {
|
|
369
|
+
if (c.value) if (r?.[c.value] != null) await r[c.value]();
|
|
370
|
+
else {
|
|
371
|
+
let e = a.value;
|
|
372
|
+
e?.[c.value] != null && await e[c.value]();
|
|
373
|
+
}
|
|
374
|
+
o.value = !1;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
async function g() {
|
|
378
|
+
if (!d.value || o.value) return;
|
|
379
|
+
p() && await m();
|
|
380
|
+
let e = a.value;
|
|
381
|
+
s.value && e?.[s.value] != null && (await e[s.value](), o.value = !0);
|
|
382
|
+
}
|
|
383
|
+
async function _() {
|
|
384
|
+
await (o.value ? m() : g());
|
|
385
|
+
}
|
|
386
|
+
let v = () => {
|
|
387
|
+
let e = p();
|
|
388
|
+
(!e || e && f()) && (o.value = e);
|
|
389
|
+
}, y = {
|
|
390
|
+
capture: !1,
|
|
391
|
+
passive: !0
|
|
392
|
+
};
|
|
393
|
+
return useEventListener(r, eventHandlers, v, y), useEventListener(() => unrefElement(a), eventHandlers, v, y), tryOnMounted(v, !1), i && tryOnScopeDispose(m), {
|
|
394
|
+
isSupported: d,
|
|
395
|
+
isFullscreen: o,
|
|
396
|
+
enter: g,
|
|
397
|
+
exit: m,
|
|
398
|
+
toggle: _
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
var DefaultMagicKeysAliasMap = {
|
|
402
|
+
ctrl: "control",
|
|
403
|
+
command: "meta",
|
|
404
|
+
cmd: "meta",
|
|
405
|
+
option: "alt",
|
|
406
|
+
up: "arrowup",
|
|
407
|
+
down: "arrowdown",
|
|
408
|
+
left: "arrowleft",
|
|
409
|
+
right: "arrowright"
|
|
410
|
+
};
|
|
411
|
+
function useMagicKeys(e = {}) {
|
|
412
|
+
let { reactive: t = !1, target: r = defaultWindow, aliasMap: i = DefaultMagicKeysAliasMap, passive: a = !0, onEventFired: o = noop } = e, s = reactive(/* @__PURE__ */ new Set()), c = {
|
|
413
|
+
toJSON() {
|
|
414
|
+
return {};
|
|
415
|
+
},
|
|
416
|
+
current: s
|
|
417
|
+
}, l = t ? reactive(c) : c, u = /* @__PURE__ */ new Set(), d = new Map([
|
|
418
|
+
["Meta", u],
|
|
419
|
+
["Shift", /* @__PURE__ */ new Set()],
|
|
420
|
+
["Alt", /* @__PURE__ */ new Set()]
|
|
421
|
+
]), f = /* @__PURE__ */ new Set();
|
|
422
|
+
function p(e, n) {
|
|
423
|
+
e in l && (t ? l[e] = n : l[e].value = n);
|
|
424
|
+
}
|
|
425
|
+
function m() {
|
|
426
|
+
s.clear();
|
|
427
|
+
for (let e of f) p(e, !1);
|
|
428
|
+
}
|
|
429
|
+
function g(e, t, n) {
|
|
430
|
+
if (!(!e || typeof t.getModifierState != "function")) {
|
|
431
|
+
for (let [e, r] of d) if (t.getModifierState(e)) {
|
|
432
|
+
n.forEach((e) => r.add(e));
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function _(e, t) {
|
|
438
|
+
if (e) return;
|
|
439
|
+
let n = `${t[0].toUpperCase()}${t.slice(1)}`, r = d.get(n);
|
|
440
|
+
if (!["shift", "alt"].includes(t) || !r) return;
|
|
441
|
+
let i = Array.from(r), a = i.indexOf(t);
|
|
442
|
+
i.forEach((e, t) => {
|
|
443
|
+
t >= a && (s.delete(e), p(e, !1));
|
|
444
|
+
}), r.clear();
|
|
445
|
+
}
|
|
446
|
+
function v(e, t) {
|
|
447
|
+
let n = e.key?.toLowerCase(), r = [e.code?.toLowerCase(), n].filter(Boolean);
|
|
448
|
+
if (n) {
|
|
449
|
+
n && (t ? s.add(n) : s.delete(n));
|
|
450
|
+
for (let e of r) f.add(e), p(e, t);
|
|
451
|
+
g(t, e, [...s, ...r]), _(t, n), n === "meta" && !t && (u.forEach((e) => {
|
|
452
|
+
s.delete(e), p(e, !1);
|
|
453
|
+
}), u.clear());
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
useEventListener(r, "keydown", (e) => (v(e, !0), o(e)), { passive: a }), useEventListener(r, "keyup", (e) => (v(e, !1), o(e)), { passive: a }), useEventListener("blur", m, { passive: a }), useEventListener("focus", m, { passive: a });
|
|
457
|
+
let y = new Proxy(l, { get(e, r, a) {
|
|
458
|
+
if (typeof r != "string") return Reflect.get(e, r, a);
|
|
459
|
+
if (r = r.toLowerCase(), r in i && (r = i[r]), !(r in l)) if (/[+_-]/.test(r)) {
|
|
460
|
+
let e = r.split(/[+_-]/g).map((e) => e.trim());
|
|
461
|
+
l[r] = computed(() => e.map((e) => toValue(y[e])).every(Boolean));
|
|
462
|
+
} else l[r] = shallowRef(!1);
|
|
463
|
+
let o = Reflect.get(e, r, a);
|
|
464
|
+
return t ? toValue(o) : o;
|
|
465
|
+
} });
|
|
466
|
+
return y;
|
|
467
|
+
}
|
|
468
|
+
export { useFullscreen as a, isClient as c, useTimeoutFn as d, useToggle as f, useElementSize as i, toRef$1 as l, useClipboard as n, useMagicKeys as o, useCssVar as r, usePreferredDark as s, computedAsync as t, tryOnScopeDispose as u };
|