@huyooo/ui 0.5.37 → 0.5.39

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,4 +1,4 @@
1
- import { ref as I, computed as d, watch as C, toValue as G, isRef as W, hasInjectionContext as B, inject as F, watchEffect as J, getCurrentInstance as Q, onBeforeUnmount as Z, onDeactivated as X, onActivated as Y } from "vue";
1
+ import { ref as I, computed as h, watch as C, toValue as G, isRef as W, hasInjectionContext as B, inject as F, watchEffect as J, getCurrentInstance as Q, onBeforeUnmount as Z, onDeactivated as X, onActivated as Y } from "vue";
2
2
  import { useRouter as _, useRoute as x } from "vue-router";
3
3
  import { u as R } from "./useAuthkitAppsAuthPageInfo-Ct-ElH04.js";
4
4
  import { a as U } from "./useAuthkitUsersProfile-B1y2nleU.js";
@@ -30,13 +30,13 @@ function Se(e, t = "default") {
30
30
  } else
31
31
  e();
32
32
  }
33
- function K(e, t) {
33
+ function D(e, t) {
34
34
  return Array.isArray(e == null ? void 0 : e.menuTypes) ? e.menuTypes.includes(t) : !1;
35
35
  }
36
36
  function Ae(e, t, n) {
37
37
  for (let r = e.length - 1; r >= 0; r--) {
38
38
  const o = e[r];
39
- if (K(o.meta, t))
39
+ if (D(o.meta, t))
40
40
  return o.path;
41
41
  }
42
42
  return n;
@@ -47,62 +47,63 @@ function $e(e) {
47
47
  } = R(), {
48
48
  isLoggedIn: r,
49
49
  userProfile: o
50
- } = U(), s = d(() => {
51
- var p;
52
- return !r.value || !o.value ? [] : ((p = o.value.permissions) == null ? void 0 : p.map((a) => a.permissionKey)) || [];
50
+ } = U(), s = h(() => {
51
+ var f;
52
+ return !r.value || !o.value ? [] : ((f = o.value.permissions) == null ? void 0 : f.map((a) => a.permissionKey)) || [];
53
53
  });
54
- function i(p) {
55
- return (n.value.publicRoutes || []).some((h) => h.permissionKey === p);
54
+ function i(f) {
55
+ return (n.value.publicRoutes || []).some((d) => d.permissionKey === f);
56
56
  }
57
- function c(p) {
58
- return r.value ? s.value.includes(p) : !1;
57
+ function c(f) {
58
+ return r.value ? s.value.includes(f) : !1;
59
59
  }
60
- function l(p) {
60
+ function l(f) {
61
61
  var a;
62
62
  return {
63
- path: p.path,
64
- name: p.name,
65
- meta: p.meta,
66
- children: (a = p.children) == null ? void 0 : a.map((h) => l(h))
63
+ path: f.path,
64
+ name: f.name,
65
+ meta: f.meta,
66
+ children: (a = f.children) == null ? void 0 : a.map((d) => l(d))
67
67
  };
68
68
  }
69
- function u(p, a) {
70
- const h = [];
71
- for (const f of p) {
72
- if (f.path === "/" || f.path === "/:catchAll(.*)")
69
+ function p(f, a) {
70
+ const d = [];
71
+ for (const m of f) {
72
+ if (m.path === "/" || m.path === "/:catchAll(.*)")
73
73
  continue;
74
- const m = f.meta;
75
- if (K(m, a)) {
76
- const w = f.path;
74
+ const u = m.meta;
75
+ if (D(u, a)) {
76
+ const w = m.path;
77
77
  if (i(w) || c(w)) {
78
78
  const g = {
79
- name: (m == null ? void 0 : m.menuName) || (m == null ? void 0 : m.title) || (typeof f.name == "string" ? f.name : f.path),
80
- path: f.path,
81
- icon: (m == null ? void 0 : m.menuIcon) || (m == null ? void 0 : m.icon),
82
- hidden: m == null ? void 0 : m.hidden
79
+ name: (u == null ? void 0 : u.menuName) || (u == null ? void 0 : u.title) || (typeof m.name == "string" ? m.name : m.path),
80
+ path: m.path,
81
+ icon: (u == null ? void 0 : u.menuIcon) || (u == null ? void 0 : u.icon),
82
+ description: (u == null ? void 0 : u.menuDescription) || (u == null ? void 0 : u.description),
83
+ hidden: u == null ? void 0 : u.hidden
83
84
  };
84
- if (f.children && f.children.length > 0) {
85
- const P = u(f.children, a);
85
+ if (m.children && m.children.length > 0) {
86
+ const P = p(m.children, a);
86
87
  P.length > 0 && (g.children = P);
87
88
  }
88
- h.push(g);
89
+ d.push(g);
89
90
  }
90
- } else if (f.children && f.children.length > 0) {
91
- const w = u(f.children, a);
92
- h.push(...w);
91
+ } else if (m.children && m.children.length > 0) {
92
+ const w = p(m.children, a);
93
+ d.push(...w);
93
94
  }
94
95
  }
95
- return h;
96
+ return d;
96
97
  }
97
98
  return {
98
- menus: d(() => {
99
+ menus: h(() => {
99
100
  if (!e)
100
101
  return [];
101
- const p = t.getRoutes(), a = p.find((g) => g.path === "/"), h = a != null && a.children ? a.children.map((g) => l(g)) : [], f = new Set(h.map((g) => g.path)), w = p.filter((g) => g.path === "/" || g.path === "/:catchAll(.*)" || f.has(g.path) ? !1 : g.path.split("/").filter((N) => N).length === 1).map(l), T = [...h, ...w];
102
- return console.log(u(T, e), "过滤菜单"), u(T, e);
102
+ const f = t.getRoutes(), a = f.find((g) => g.path === "/"), d = a != null && a.children ? a.children.map((g) => l(g)) : [], m = new Set(d.map((g) => g.path)), w = f.filter((g) => g.path === "/" || g.path === "/:catchAll(.*)" || m.has(g.path) ? !1 : g.path.split("/").filter((N) => N).length === 1).map(l), T = [...d, ...w];
103
+ return console.log(p(T, e), "过滤菜单"), p(T, e);
103
104
  }),
104
105
  isRoutePublic: i,
105
- hasPermission: (p) => i(p) ? !0 : c(p),
106
+ hasPermission: (f) => i(f) ? !0 : c(f),
106
107
  isLoggedIn: r
107
108
  };
108
109
  }
@@ -116,20 +117,20 @@ function Te() {
116
117
  isLoggedIn: i,
117
118
  usersProfileSuccess: c
118
119
  } = U(), l = I(!1);
119
- function u(a) {
120
- return (r.value.publicRoutes || []).some((f) => f.permissionKey === a);
120
+ function p(a) {
121
+ return (r.value.publicRoutes || []).some((m) => m.permissionKey === a);
121
122
  }
122
123
  function b(a) {
123
- var f;
124
- return !i.value || !s.value ? !1 : (((f = s.value.permissions) == null ? void 0 : f.map((m) => m.permissionKey)) || []).includes(a);
124
+ var m;
125
+ return !i.value || !s.value ? !1 : (((m = s.value.permissions) == null ? void 0 : m.map((u) => u.permissionKey)) || []).includes(a);
125
126
  }
126
- function p(a) {
127
- var h, f;
127
+ function f(a) {
128
+ var d, m;
128
129
  if (!o.value) {
129
130
  console.log("权限检查跳过:appsAuthPageInfoSuccess 未加载完成", a);
130
131
  return;
131
132
  }
132
- if (l.value = !0, u(a)) {
133
+ if (l.value = !0, p(a)) {
133
134
  console.log("权限检查通过:公开路由", a), l.value = !1;
134
135
  return;
135
136
  }
@@ -142,16 +143,16 @@ function Te() {
142
143
  return;
143
144
  }
144
145
  b(a) ? console.log("权限检查通过:有权限", a) : (console.log("权限检查失败:无权限,重定向到首页", a, {
145
- permissions: (f = (h = s.value) == null ? void 0 : h.permissions) == null ? void 0 : f.map((m) => m.permissionKey)
146
+ permissions: (m = (d = s.value) == null ? void 0 : d.permissions) == null ? void 0 : m.map((u) => u.permissionKey)
146
147
  }), e.replace("/")), l.value = !1;
147
148
  }
148
149
  return n(), C(() => t.path, (a) => {
149
- p(a);
150
+ f(a);
150
151
  }), C([o, c], ([a]) => {
151
- a && p(t.path);
152
+ a && f(t.path);
152
153
  }), {
153
154
  isChecking: l,
154
- isRoutePublic: u,
155
+ isRoutePublic: p,
155
156
  hasPermission: b
156
157
  };
157
158
  }
@@ -205,7 +206,7 @@ const ee = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), te
205
206
  msapplicationConfig: "msapplication-Config",
206
207
  msapplicationTileColor: "msapplication-TileColor",
207
208
  msapplicationTileImage: "msapplication-TileImage"
208
- }, L = {
209
+ }, K = {
209
210
  appleItunesApp: {
210
211
  unpack: {
211
212
  entrySeparator: ", ",
@@ -242,7 +243,7 @@ function y(e) {
242
243
  const t = e.replace(/([A-Z])/g, "-$1").toLowerCase(), n = t.indexOf("-");
243
244
  return n === -1 ? t : S.META.has(t.slice(0, n)) || S.OG.has(t.slice(0, n)) ? e.replace(/([A-Z])/g, ":$1").toLowerCase() : t;
244
245
  }
245
- function D(e) {
246
+ function L(e) {
246
247
  return Object.fromEntries(Object.entries(e).filter(([t, n]) => String(n) !== "false" && t));
247
248
  }
248
249
  function j(e) {
@@ -252,29 +253,29 @@ function H(e, t = {}) {
252
253
  const { entrySeparator: n = "", keyValueSeparator: r = "", wrapValue: o, resolve: s } = t;
253
254
  return Object.entries(e).map(([i, c]) => {
254
255
  if (s) {
255
- const u = s({ key: i, value: c });
256
- if (u !== void 0)
257
- return u;
256
+ const p = s({ key: i, value: c });
257
+ if (p !== void 0)
258
+ return p;
258
259
  }
259
260
  const l = typeof c == "object" ? H(c, t) : typeof c == "number" ? c.toString() : typeof c == "string" && o ? `${o}${c.replace(new RegExp(o, "g"), `\\${o}`)}${o}` : c;
260
261
  return `${i}${r}${l}`;
261
262
  }).join(n);
262
263
  }
263
264
  function V(e, t) {
264
- const n = D(t), r = y(e), o = k(r);
265
+ const n = L(t), r = y(e), o = k(r);
265
266
  if (!E.has(r))
266
267
  return [{ [o]: r, ...n }];
267
268
  const s = Object.fromEntries(
268
269
  Object.entries(n).map(([i, c]) => [`${e}${i === "url" ? "" : `${i[0].toUpperCase()}${i.slice(1)}`}`, c])
269
270
  );
270
271
  return A(s || {}).sort((i, c) => {
271
- var l, u;
272
- return (((l = i[o]) == null ? void 0 : l.length) || 0) - (((u = c[o]) == null ? void 0 : u.length) || 0);
272
+ var l, p;
273
+ return (((l = i[o]) == null ? void 0 : l.length) || 0) - (((p = c[o]) == null ? void 0 : p.length) || 0);
273
274
  });
274
275
  }
275
276
  function k(e) {
276
277
  var r;
277
- if (((r = L[e]) == null ? void 0 : r.metaKey) === "http-equiv" || S.HTTP_EQUIV.has(e))
278
+ if (((r = K[e]) == null ? void 0 : r.metaKey) === "http-equiv" || S.HTTP_EQUIV.has(e))
278
279
  return "http-equiv";
279
280
  const t = y(e), n = t.indexOf(":");
280
281
  return n === -1 ? "name" : S.OG.has(t.slice(0, n)) ? "property" : "name";
@@ -289,7 +290,7 @@ function ie(e, t) {
289
290
  entrySeparator: ", ",
290
291
  resolve: ({ value: r, key: o }) => r === null ? "" : typeof r == "boolean" ? o : void 0,
291
292
  // @ts-expect-error untyped
292
- ...(n = L[t]) == null ? void 0 : n.unpack
293
+ ...(n = K[t]) == null ? void 0 : n.unpack
293
294
  });
294
295
  }
295
296
  function A(e) {
@@ -305,9 +306,9 @@ function A(e) {
305
306
  for (const i of s)
306
307
  if (typeof i == "object" && i !== null) {
307
308
  const c = [], l = [];
308
- for (const [u, b] of Object.entries(i)) {
309
- const p = `${o}${u === "url" ? "" : `:${u}`}`, a = A({ [p]: b });
310
- (u === "url" ? c : l).push(...a);
309
+ for (const [p, b] of Object.entries(i)) {
310
+ const f = `${o}${p === "url" ? "" : `:${p}`}`, a = A({ [f]: b });
311
+ (p === "url" ? c : l).push(...a);
311
312
  }
312
313
  t.push(...c, ...l);
313
314
  } else
@@ -324,13 +325,13 @@ function A(e) {
324
325
  [l]: `${i}:${c}:secure_url`,
325
326
  content: s.secureUrl
326
327
  });
327
- for (const [u, b] of Object.entries(s))
328
- u !== "url" && u !== "secureUrl" && t.push({
329
- [l]: `${i}:${c}:${u}`,
328
+ for (const [p, b] of Object.entries(s))
329
+ p !== "url" && p !== "secureUrl" && t.push({
330
+ [l]: `${i}:${c}:${p}`,
330
331
  // @ts-expect-error untyped
331
332
  content: b
332
333
  });
333
- } else E.has(y(o)) ? t.push(...V(o, s)) : n[o] = D(s);
334
+ } else E.has(y(o)) ? t.push(...V(o, s)) : n[o] = L(s);
334
335
  else
335
336
  n[o] = s;
336
337
  }
@@ -492,9 +493,9 @@ function z() {
492
493
  }
493
494
  function O(e, t = {}) {
494
495
  const n = t.head || /* @__PURE__ */ z();
495
- return n.ssr ? n.push(e || {}, t) : he(n, e, t);
496
+ return n.ssr ? n.push(e || {}, t) : de(n, e, t);
496
497
  }
497
- function he(e, t, n = {}) {
498
+ function de(e, t, n = {}) {
498
499
  const r = I(!1);
499
500
  let o;
500
501
  return J(() => {
@@ -532,7 +533,7 @@ function Ve() {
532
533
  image: i,
533
534
  url: c,
534
535
  type: l = "website"
535
- } = n, u = o && o.length > 155 ? `${o.substring(0, 152)}...` : o;
536
+ } = n, p = o && o.length > 155 ? `${o.substring(0, 152)}...` : o;
536
537
  O({
537
538
  title: r,
538
539
  link: c ? [{
@@ -540,17 +541,17 @@ function Ve() {
540
541
  href: c
541
542
  }] : []
542
543
  }), M({
543
- description: u || o,
544
+ description: p || o,
544
545
  keywords: s,
545
546
  ogTitle: r,
546
- ogDescription: u || o,
547
+ ogDescription: p || o,
547
548
  ogType: l === "product" ? void 0 : l,
548
549
  // product 类型不被支持,跳过
549
550
  ogUrl: c,
550
551
  ogImage: i,
551
552
  twitterCard: "summary_large_image",
552
553
  twitterTitle: r,
553
- twitterDescription: u || o,
554
+ twitterDescription: p || o,
554
555
  twitterImage: i
555
556
  });
556
557
  }
@@ -562,8 +563,8 @@ function Ve() {
562
563
  function _e() {
563
564
  const e = x(), t = () => e.meta;
564
565
  O({
565
- title: d(() => t().title || ""),
566
- link: d(() => {
566
+ title: h(() => t().title || ""),
567
+ link: h(() => {
567
568
  const n = t();
568
569
  return n.url ? [{
569
570
  rel: "canonical",
@@ -571,32 +572,32 @@ function _e() {
571
572
  }] : [];
572
573
  })
573
574
  }), M({
574
- description: d(() => {
575
+ description: h(() => {
575
576
  const r = t().description;
576
577
  if (r)
577
578
  return r.length > 155 ? `${r.substring(0, 152)}...` : r;
578
579
  }),
579
- keywords: d(() => t().keywords),
580
- ogTitle: d(() => t().title),
581
- ogDescription: d(() => {
580
+ keywords: h(() => t().keywords),
581
+ ogTitle: h(() => t().title),
582
+ ogDescription: h(() => {
582
583
  const r = t().description;
583
584
  if (r)
584
585
  return r.length > 155 ? `${r.substring(0, 152)}...` : r;
585
586
  }),
586
- ogType: d(() => {
587
+ ogType: h(() => {
587
588
  const r = t().type || "website";
588
589
  return r === "product" ? void 0 : r;
589
590
  }),
590
- ogUrl: d(() => t().url),
591
- ogImage: d(() => t().image),
591
+ ogUrl: h(() => t().url),
592
+ ogImage: h(() => t().image),
592
593
  twitterCard: "summary_large_image",
593
- twitterTitle: d(() => t().title),
594
- twitterDescription: d(() => {
594
+ twitterTitle: h(() => t().title),
595
+ twitterDescription: h(() => {
595
596
  const r = t().description;
596
597
  if (r)
597
598
  return r.length > 155 ? `${r.substring(0, 152)}...` : r;
598
599
  }),
599
- twitterImage: d(() => t().image)
600
+ twitterImage: h(() => t().image)
600
601
  });
601
602
  }
602
603
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.5.37",
3
+ "version": "0.5.39",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [