@huyooo/ui 0.5.9 → 0.5.12

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.
@@ -1,399 +0,0 @@
1
- import { ref as d, computed as y, watch as S, toValue as $, isRef as j, hasInjectionContext as v, inject as H, watchEffect as M, getCurrentInstance as R, onBeforeUnmount as E, onDeactivated as D, onActivated as L } from "vue";
2
- import { useRouter as w, useRoute as C } from "vue-router";
3
- /* empty css */
4
- /* empty css */
5
- /* empty css */
6
- import "@arco-design/web-vue";
7
- /* empty css */
8
- /* empty css */
9
- import "./useUploadCos-D5k1YLb7.js";
10
- import "@huyooo/api";
11
- import "./AuthkitAuthModal.vue_vue_type_style_index_1_lang-BpOmabWi.js";
12
- import { a as b } from "./useAuthkitUsersProfile-Bi_zM2qG.js";
13
- import "@iconify/vue";
14
- /* empty css */
15
- import { u as P } from "./useAuthkitAppsAuthPageInfo-Dfj4byB5.js";
16
- /* empty css */
17
- /* empty css */
18
- /* empty css */
19
- /* empty css */
20
- const h = d({
21
- key: "",
22
- name: ""
23
- });
24
- function ft() {
25
- function t(s, e) {
26
- h.value.key = s, h.value.name = e;
27
- }
28
- return {
29
- activeDoc: h,
30
- setActiveDoc: t
31
- };
32
- }
33
- function mt(t, s = "default") {
34
- const e = document;
35
- if (e && typeof e.startViewTransition == "function") {
36
- const n = document.body;
37
- n.classList.add(`vt-${s}`), e.startViewTransition(() => {
38
- try {
39
- t();
40
- } catch {
41
- }
42
- }).finished.finally(() => {
43
- n.classList.remove(`vt-${s}`);
44
- });
45
- } else
46
- t();
47
- }
48
- function ht(t, s, e) {
49
- const n = t.find((r) => {
50
- var i;
51
- return ((i = r.meta) == null ? void 0 : i.menuType) === s;
52
- });
53
- return (n == null ? void 0 : n.path) || e;
54
- }
55
- function dt(t) {
56
- const s = w(), {
57
- appsData: e
58
- } = P(), {
59
- isLoggedIn: n,
60
- userProfile: r
61
- } = b(), i = y(() => {
62
- var a;
63
- return !n.value || !r.value ? [] : ((a = r.value.permissions) == null ? void 0 : a.map((c) => c.permissionKey)) || [];
64
- });
65
- function o(a) {
66
- return (e.value.publicRoutes || []).some((u) => u.permissionKey === a);
67
- }
68
- function p(a) {
69
- return n.value ? i.value.includes(a) : !1;
70
- }
71
- return {
72
- menus: y(() => s.getRoutes().filter((c) => {
73
- const u = c.meta;
74
- return t ? u.menuType === t : !!u.menuType;
75
- }).filter((c) => {
76
- const u = c.path;
77
- return o(u) ? !0 : p(u);
78
- }).map((c) => {
79
- const u = c.meta;
80
- return {
81
- name: u.title || c.path,
82
- path: c.path,
83
- key: c.path,
84
- icon: u.menuIcon || u.icon || "Header/Help"
85
- };
86
- })),
87
- isRoutePublic: o,
88
- hasPermission: (a) => o(a) ? !0 : p(a),
89
- isLoggedIn: n
90
- };
91
- }
92
- function yt() {
93
- const t = w(), s = C(), {
94
- appsAuthPageInfoApi: e,
95
- appsData: n
96
- } = P(), {
97
- isLoggedIn: r,
98
- userProfile: i
99
- } = b(), o = d(!1);
100
- function p(c) {
101
- return (n.value.publicRoutes || []).some((f) => f.permissionKey === c);
102
- }
103
- function l(c) {
104
- var f;
105
- return !r.value || !i.value ? !1 : (((f = i.value.permissions) == null ? void 0 : f.map((T) => T.permissionKey)) || []).includes(c);
106
- }
107
- function a(c) {
108
- if (o.value = !0, p(c)) {
109
- o.value = !1;
110
- return;
111
- }
112
- if (!r.value) {
113
- t.replace("/"), o.value = !1;
114
- return;
115
- }
116
- l(c) || t.replace("/"), o.value = !1;
117
- }
118
- return e(() => {
119
- a(s.path), S(() => s.path, (c) => {
120
- a(c);
121
- });
122
- }), {
123
- isChecking: o,
124
- isRoutePublic: p,
125
- hasPermission: l
126
- };
127
- }
128
- const O = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), k = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]), gt = /* @__PURE__ */ new Set([
129
- "base",
130
- "meta",
131
- "link",
132
- "style",
133
- "script",
134
- "noscript"
135
- ]), wt = /* @__PURE__ */ new Set([
136
- "title",
137
- "base",
138
- "htmlAttrs",
139
- "bodyAttrs",
140
- "meta",
141
- "link",
142
- "style",
143
- "script",
144
- "noscript"
145
- ]), x = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]), I = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]), bt = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]), V = /* @__PURE__ */ new Set([
146
- "theme-color",
147
- "google-site-verification",
148
- "og",
149
- "article",
150
- "book",
151
- "profile",
152
- "twitter",
153
- "author"
154
- ]), K = ["name", "property", "http-equiv"], U = /* @__PURE__ */ new Set([
155
- "viewport",
156
- "description",
157
- "keywords",
158
- "robots"
159
- ]);
160
- function Pt(t) {
161
- const s = t.split(":");
162
- return s.length ? V.has(s[1]) : !1;
163
- }
164
- function At(t) {
165
- const { props: s, tag: e } = t;
166
- if (x.has(e))
167
- return e;
168
- if (e === "link" && s.rel === "canonical")
169
- return "canonical";
170
- if (s.charset)
171
- return "charset";
172
- if (t.tag === "meta") {
173
- for (const n of K)
174
- if (s[n] !== void 0) {
175
- const r = s[n], i = r.includes(":"), o = U.has(r), l = !(i || o) && t.key ? `:key:${t.key}` : "";
176
- return `${e}:${r}${l}`;
177
- }
178
- }
179
- if (t.key)
180
- return `${e}:key:${t.key}`;
181
- if (s.id)
182
- return `${e}:id:${s.id}`;
183
- if (k.has(e)) {
184
- const n = t.textContent || t.innerHTML;
185
- if (n)
186
- return `${e}:content:${n}`;
187
- }
188
- }
189
- function Tt(t) {
190
- const s = t._h || t._d;
191
- if (s)
192
- return s;
193
- const e = t.textContent || t.innerHTML;
194
- return e || `${t.tag}:${Object.entries(t.props).map(([n, r]) => `${n}:${String(r)}`).join(",")}`;
195
- }
196
- function m(t, s, e) {
197
- typeof t === "function" && (!e || e !== "titleTemplate" && !(e[0] === "o" && e[1] === "n")) && (t = t());
198
- let r;
199
- if (s && (r = s(e, t)), Array.isArray(r))
200
- return r.map((i) => m(i, s));
201
- if ((r == null ? void 0 : r.constructor) === Object) {
202
- const i = {};
203
- for (const o of Object.keys(r))
204
- i[o] = m(r[o], s, o);
205
- return i;
206
- }
207
- return r;
208
- }
209
- function z(t, s) {
210
- const e = t === "style" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
211
- function n(r) {
212
- const i = r.trim();
213
- if (i)
214
- if (t === "style") {
215
- const [o, ...p] = i.split(":").map((l) => l.trim());
216
- o && p.length && e.set(o, p.join(":"));
217
- } else
218
- i.split(" ").filter(Boolean).forEach((o) => e.add(o));
219
- }
220
- return typeof s == "string" ? t === "style" ? s.split(";").forEach(n) : n(s) : Array.isArray(s) ? s.forEach((r) => n(r)) : s && typeof s == "object" && Object.entries(s).forEach(([r, i]) => {
221
- i && i !== "false" && (t === "style" ? e.set(r.trim(), i) : n(r));
222
- }), e;
223
- }
224
- function _(t, s) {
225
- return t.props = t.props || {}, s ? t.tag === "templateParams" ? (t.props = s, t) : (Object.entries(s).forEach(([e, n]) => {
226
- if (n === null) {
227
- t.props[e] = null;
228
- return;
229
- }
230
- if (e === "class" || e === "style") {
231
- t.props[e] = z(e, n);
232
- return;
233
- }
234
- if (I.has(e)) {
235
- if (["textContent", "innerHTML"].includes(e) && typeof n == "object") {
236
- let o = s.type;
237
- if (s.type || (o = "application/json"), !(o != null && o.endsWith("json")) && o !== "speculationrules")
238
- return;
239
- s.type = o, t.props.type = o, t[e] = JSON.stringify(n);
240
- } else
241
- t[e] = n;
242
- return;
243
- }
244
- const r = String(n), i = e.startsWith("data-");
245
- r === "true" || r === "" ? t.props[e] = i ? r : !0 : !n && i && r === "false" ? t.props[e] = "false" : n !== void 0 && (t.props[e] = n);
246
- }), t) : t;
247
- }
248
- function W(t, s) {
249
- const e = typeof s == "object" && typeof s != "function" ? s : { [t === "script" || t === "noscript" || t === "style" ? "innerHTML" : "textContent"]: s }, n = _({ tag: t, props: {} }, e);
250
- return n.key && O.has(n.tag) && (n.props["data-hid"] = n._h = n.key), n.tag === "script" && typeof n.innerHTML == "object" && (n.innerHTML = JSON.stringify(n.innerHTML), n.props.type = n.props.type || "application/json"), Array.isArray(n.props.content) ? n.props.content.map((r) => ({ ...n, props: { ...n.props, content: r } })) : n;
251
- }
252
- function St(t, s) {
253
- if (!t)
254
- return [];
255
- typeof t == "function" && (t = t());
256
- const e = (r, i) => {
257
- for (let o = 0; o < s.length; o++)
258
- i = s[o](r, i);
259
- return i;
260
- };
261
- t = e(void 0, t);
262
- const n = [];
263
- return t = m(t, e), Object.entries(t || {}).forEach(([r, i]) => {
264
- if (i !== void 0)
265
- for (const o of Array.isArray(i) ? i : [i])
266
- n.push(W(r, o));
267
- }), n.flat();
268
- }
269
- const q = (t, s) => j(s) ? $(s) : s, A = "usehead";
270
- // @__NO_SIDE_EFFECTS__
271
- function $t(t) {
272
- return {
273
- install(e) {
274
- e.config.globalProperties.$unhead = t, e.config.globalProperties.$head = t, e.provide(A, t);
275
- }
276
- }.install;
277
- }
278
- // @__NO_SIDE_EFFECTS__
279
- function B() {
280
- if (v()) {
281
- const t = H(A);
282
- if (!t)
283
- throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
284
- return t;
285
- }
286
- throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
287
- }
288
- function g(t, s = {}) {
289
- const e = s.head || /* @__PURE__ */ B();
290
- return e.ssr ? e.push(t || {}, s) : J(e, t, s);
291
- }
292
- function J(t, s, e = {}) {
293
- const n = d(!1);
294
- let r;
295
- return M(() => {
296
- const o = n.value ? {} : m(s, q);
297
- r ? r.patch(o) : r = t.push(o, e);
298
- }), R() && (E(() => {
299
- r.dispose();
300
- }), D(() => {
301
- n.value = !0;
302
- }), L(() => {
303
- n.value = !1;
304
- })), r;
305
- }
306
- function jt() {
307
- function t(e) {
308
- const n = [];
309
- e.siteName && n.push({
310
- property: "og:site_name",
311
- content: e.siteName
312
- }), e.locale && n.push({
313
- property: "og:locale",
314
- content: e.locale
315
- }), n.length > 0 && g({
316
- meta: n
317
- });
318
- }
319
- function s(e) {
320
- const {
321
- title: n,
322
- description: r,
323
- keywords: i,
324
- image: o,
325
- url: p,
326
- type: l = "website"
327
- } = e, a = r && r.length > 160 ? `${r.substring(0, 157)}...` : r, c = [];
328
- r && c.push({
329
- name: "description",
330
- content: a || r
331
- }), i && c.push({
332
- name: "keywords",
333
- content: i
334
- }), c.push({
335
- property: "og:title",
336
- content: n
337
- }), r && c.push({
338
- property: "og:description",
339
- content: a || r
340
- }), c.push({
341
- property: "og:type",
342
- content: l
343
- }), p && c.push({
344
- property: "og:url",
345
- content: p
346
- }), o && (c.push({
347
- property: "og:image",
348
- content: o
349
- }), c.push({
350
- property: "og:image:width",
351
- content: "1200"
352
- }), c.push({
353
- property: "og:image:height",
354
- content: "630"
355
- })), c.push({
356
- name: "twitter:card",
357
- content: "summary_large_image"
358
- }), c.push({
359
- name: "twitter:title",
360
- content: n
361
- }), r && c.push({
362
- name: "twitter:description",
363
- content: a || r
364
- }), o && c.push({
365
- name: "twitter:image",
366
- content: o
367
- });
368
- const u = [];
369
- p && u.push({
370
- rel: "canonical",
371
- href: p
372
- }), g({
373
- title: n,
374
- meta: c,
375
- link: u
376
- });
377
- }
378
- return {
379
- setGlobalSEO: t,
380
- setPageSEO: s
381
- };
382
- }
383
- export {
384
- gt as H,
385
- bt as U,
386
- wt as V,
387
- dt as a,
388
- yt as b,
389
- jt as c,
390
- At as d,
391
- _ as e,
392
- ht as f,
393
- Tt as h,
394
- Pt as i,
395
- St as n,
396
- ft as u,
397
- $t as v,
398
- mt as w
399
- };