@huyooo/ui 0.14.3 → 0.14.5

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.
@@ -0,0 +1,212 @@
1
+ import { ref as w, computed as b, watch as S } from "vue";
2
+ import { useRouter as I, useRoute as T } from "vue-router";
3
+ import { u as k } from "./useAuthkitAppsAuthPageInfo-nCjfAjiw.js";
4
+ import { u as M } from "./useAuthkitUsersProfile-BC5EsA2f.js";
5
+ const y = w({
6
+ key: "",
7
+ name: ""
8
+ });
9
+ function W() {
10
+ function t(r, s) {
11
+ y.value.key = r, y.value.name = s;
12
+ }
13
+ return {
14
+ activeDoc: y,
15
+ setActiveDoc: t
16
+ };
17
+ }
18
+ function j(t, r = "default") {
19
+ const s = document;
20
+ if (s && typeof s.startViewTransition == "function") {
21
+ const n = document.body;
22
+ n.classList.add(`vt-${r}`), s.startViewTransition(() => {
23
+ try {
24
+ t();
25
+ } catch {
26
+ }
27
+ }).finished.finally(() => {
28
+ n.classList.remove(`vt-${r}`);
29
+ });
30
+ } else
31
+ t();
32
+ }
33
+ function K(t) {
34
+ const r = /* @__PURE__ */ new Set();
35
+ r.add(t);
36
+ const s = t.split("/").filter(Boolean);
37
+ for (let n = s.length - 1; n > 0; n--)
38
+ r.add(`/${s.slice(0, n).join("/")}`);
39
+ return [...r];
40
+ }
41
+ function L(t, r) {
42
+ const s = new Set(r);
43
+ return K(t).some((n) => s.has(n));
44
+ }
45
+ function C(t, r) {
46
+ return Array.isArray(t == null ? void 0 : t.menuTypes) ? t.menuTypes.includes(r) : !1;
47
+ }
48
+ function z(t, r, s) {
49
+ for (let n = t.length - 1; n >= 0; n--) {
50
+ const f = t[n];
51
+ if (C(f.meta, r))
52
+ return f.path;
53
+ }
54
+ return s;
55
+ }
56
+ function R(t) {
57
+ return t.split("?")[0].split("#")[0];
58
+ }
59
+ function B(t, r, s) {
60
+ const n = R(r), f = (s == null ? void 0 : s.returnParentOnChildMatch) ?? !1;
61
+ function m(u, p) {
62
+ for (const a of u) {
63
+ if (R(a.path) === p)
64
+ return a.path;
65
+ if (a.children && a.children.length > 0) {
66
+ const e = m(a.children, p);
67
+ if (e)
68
+ return f ? a.path : e;
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+ const d = m(t, n);
74
+ if (d)
75
+ return d;
76
+ for (const u of t) {
77
+ const p = R(u.path);
78
+ if (n.startsWith(p + "/") || n === p) {
79
+ if (u.children && u.children.length > 0)
80
+ for (const a of u.children) {
81
+ const v = R(a.path);
82
+ if (n.startsWith(v + "/") || n === v)
83
+ return f ? u.path : a.path;
84
+ }
85
+ return u.path;
86
+ }
87
+ }
88
+ return s != null && s.fallback ? s.fallback(n) : n;
89
+ }
90
+ function F(t) {
91
+ const r = I(), {
92
+ appsData: s
93
+ } = k(), {
94
+ isLoggedIn: n,
95
+ userProfile: f
96
+ } = M(), m = b(() => {
97
+ var e;
98
+ return !n.value || !f.value ? [] : ((e = f.value.permissions) == null ? void 0 : e.map((c) => c.permissionKey)) || [];
99
+ });
100
+ function d(e) {
101
+ return (s.value.publicRoutes || []).some((l) => l.permissionKey === e);
102
+ }
103
+ function u(e) {
104
+ return n.value ? L(e, m.value) : !1;
105
+ }
106
+ function p(e) {
107
+ var c;
108
+ return {
109
+ path: e.path,
110
+ name: e.name,
111
+ meta: e.meta,
112
+ children: (c = e.children) == null ? void 0 : c.map((l) => p(l))
113
+ };
114
+ }
115
+ function a(e, c) {
116
+ const l = [];
117
+ for (const o of e) {
118
+ if (o.path === "/" || o.path === "/:catchAll(.*)")
119
+ continue;
120
+ const i = o.meta;
121
+ if (C(i, c)) {
122
+ const P = o.path;
123
+ if (d(P) || u(P)) {
124
+ const h = {
125
+ name: (i == null ? void 0 : i.menuName) || (i == null ? void 0 : i.title) || (typeof o.name == "string" ? o.name : o.path),
126
+ path: o.path,
127
+ icon: (i == null ? void 0 : i.menuIcon) || (i == null ? void 0 : i.icon),
128
+ description: (i == null ? void 0 : i.menuDescription) || (i == null ? void 0 : i.description),
129
+ hidden: i == null ? void 0 : i.hidden
130
+ };
131
+ if (o.children && o.children.length > 0) {
132
+ const g = a(o.children, c);
133
+ g.length > 0 && (h.children = g);
134
+ }
135
+ l.push(h);
136
+ }
137
+ } else if (o.children && o.children.length > 0) {
138
+ const P = a(o.children, c);
139
+ l.push(...P);
140
+ }
141
+ }
142
+ return l;
143
+ }
144
+ return {
145
+ menus: b(() => {
146
+ if (!t)
147
+ return [];
148
+ const e = r.getRoutes(), c = e.find((h) => h.path === "/"), l = c != null && c.children ? c.children.map((h) => p(h)) : [], o = new Set(l.map((h) => h.path)), P = e.filter((h) => h.path === "/" || h.path === "/:catchAll(.*)" || o.has(h.path) ? !1 : h.path.split("/").filter((D) => D).length === 1).map(p), A = [...l, ...P];
149
+ return a(A, t);
150
+ }),
151
+ isRoutePublic: d,
152
+ hasPermission: (e) => d(e) ? !0 : u(e),
153
+ isLoggedIn: n
154
+ };
155
+ }
156
+ function N() {
157
+ const t = I(), r = T(), {
158
+ appsData: s,
159
+ appsAuthPageInfoSuccess: n
160
+ } = k(), {
161
+ userProfile: f,
162
+ isLoggedIn: m,
163
+ usersProfileReady: d
164
+ } = M(), u = w(!1);
165
+ function p(e) {
166
+ return (s.value.publicRoutes || []).some((l) => l.permissionKey === e);
167
+ }
168
+ function a(e) {
169
+ var l;
170
+ if (!m.value || !f.value)
171
+ return !1;
172
+ const c = ((l = f.value.permissions) == null ? void 0 : l.map((o) => o.permissionKey)) || [];
173
+ return L(e, c);
174
+ }
175
+ function v(e) {
176
+ if (!n.value) {
177
+ u.value = !0;
178
+ return;
179
+ }
180
+ if (u.value = !0, p(e)) {
181
+ u.value = !1;
182
+ return;
183
+ }
184
+ if (!d.value) {
185
+ u.value = !0;
186
+ return;
187
+ }
188
+ if (!m.value) {
189
+ t.replace("/"), u.value = !1;
190
+ return;
191
+ }
192
+ a(e) || t.replace("/"), u.value = !1;
193
+ }
194
+ return S([() => r.path, n, d, m], () => {
195
+ v(r.path);
196
+ }, {
197
+ immediate: !0
198
+ }), {
199
+ isChecking: u,
200
+ isRoutePublic: p,
201
+ hasPermission: a
202
+ };
203
+ }
204
+ export {
205
+ z as a,
206
+ F as b,
207
+ N as c,
208
+ B as f,
209
+ R as g,
210
+ W as u,
211
+ j as w
212
+ };
@@ -0,0 +1,153 @@
1
+ /* empty css */
2
+ import { g } from "./apiClients-CkI47p36.js";
3
+ import { Message as f } from "@arco-design/web-vue";
4
+ import { ref as i, computed as r } from "vue";
5
+ import { useHead as p, useSeoMeta as m } from "@unhead/vue";
6
+ import { useRoute as w } from "vue-router";
7
+ function S(s) {
8
+ const o = i(!1), t = i(), e = i(!1), a = i(""), u = i("");
9
+ function l(c) {
10
+ f.success(c), e.value = !1, o.value = !1, s("confirm");
11
+ }
12
+ function n() {
13
+ e.value = !1, s("cancel");
14
+ }
15
+ return {
16
+ loading: o,
17
+ formRef: t,
18
+ submitSuccess: l,
19
+ modelType: a,
20
+ changeType: u,
21
+ show: e,
22
+ handleCancel: n
23
+ };
24
+ }
25
+ function C() {
26
+ const s = i([]), o = i(!1), t = i(""), e = i("");
27
+ async function a() {
28
+ o.value = !0, t.value = "";
29
+ try {
30
+ const l = await (await fetch(`${g.onesPrefixUrl}/releases/latest`, {
31
+ method: "POST",
32
+ headers: {
33
+ "Content-Type": "application/json",
34
+ "app-id": g.appId
35
+ },
36
+ body: JSON.stringify({})
37
+ })).json();
38
+ e.value = l.version, s.value = l.downloads.map((n) => {
39
+ const c = {
40
+ id: n.id,
41
+ name: n.name,
42
+ description: n.description,
43
+ version: n.version,
44
+ updateDate: n.updateDate,
45
+ icon: "",
46
+ downloadUrl: n.downloadUrl,
47
+ platform: n.platform,
48
+ requirements: n.requirements
49
+ };
50
+ return n.arch && (c.arch = n.arch), n.badge && (c.badge = n.badge), c;
51
+ });
52
+ } catch {
53
+ t.value = "获取版本信息失败,请刷新重试";
54
+ } finally {
55
+ o.value = !1;
56
+ }
57
+ }
58
+ return {
59
+ downloads: s,
60
+ loading: o,
61
+ error: t,
62
+ version: e,
63
+ fetchDownloads: a
64
+ };
65
+ }
66
+ function O() {
67
+ function s(t) {
68
+ m({
69
+ ogSiteName: t.siteName,
70
+ ogLocale: t.locale
71
+ });
72
+ }
73
+ function o(t) {
74
+ const {
75
+ title: e,
76
+ description: a,
77
+ keywords: u,
78
+ image: l,
79
+ url: n,
80
+ type: c = "website"
81
+ } = t, d = a && a.length > 155 ? `${a.substring(0, 152)}...` : a;
82
+ p({
83
+ title: e,
84
+ link: n ? [{
85
+ rel: "canonical",
86
+ href: n
87
+ }] : []
88
+ }), m({
89
+ description: d || a,
90
+ keywords: u,
91
+ ogTitle: e,
92
+ ogDescription: d || a,
93
+ ogType: c === "product" ? void 0 : c,
94
+ // product 类型不被支持,跳过
95
+ ogUrl: n,
96
+ ogImage: l,
97
+ twitterCard: "summary_large_image",
98
+ twitterTitle: e,
99
+ twitterDescription: d || a,
100
+ twitterImage: l
101
+ });
102
+ }
103
+ return {
104
+ setGlobalSEO: s,
105
+ setPageSEO: o
106
+ };
107
+ }
108
+ function U() {
109
+ const s = w(), o = () => s.meta;
110
+ p({
111
+ title: r(() => o().title || ""),
112
+ link: r(() => {
113
+ const t = o();
114
+ return t.url ? [{
115
+ rel: "canonical",
116
+ href: t.url
117
+ }] : [];
118
+ })
119
+ }), m({
120
+ description: r(() => {
121
+ const e = o().description;
122
+ if (e)
123
+ return e.length > 155 ? `${e.substring(0, 152)}...` : e;
124
+ }),
125
+ keywords: r(() => o().keywords),
126
+ ogTitle: r(() => o().title),
127
+ ogDescription: r(() => {
128
+ const e = o().description;
129
+ if (e)
130
+ return e.length > 155 ? `${e.substring(0, 152)}...` : e;
131
+ }),
132
+ ogType: r(() => {
133
+ const e = o().type || "website";
134
+ return e === "product" ? void 0 : e;
135
+ }),
136
+ ogUrl: r(() => o().url),
137
+ ogImage: r(() => o().image),
138
+ twitterCard: "summary_large_image",
139
+ twitterTitle: r(() => o().title),
140
+ twitterDescription: r(() => {
141
+ const e = o().description;
142
+ if (e)
143
+ return e.length > 155 ? `${e.substring(0, 152)}...` : e;
144
+ }),
145
+ twitterImage: r(() => o().image)
146
+ });
147
+ }
148
+ export {
149
+ C as a,
150
+ U as b,
151
+ O as c,
152
+ S as u
153
+ };
package/dist/user.js CHANGED
@@ -1,4 +1,4 @@
1
- import { U as a, a as n, b as r, c as t, d as U, _ as u, e as i, f as M, g as o, h as m, i as I, j as c, k as d, l as b, m as f } from "./UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-1lGqM4u-.js";
1
+ import { U as a, a as n, b as r, c as t, d as U, _ as u, e as i, f as M, g as o, h as m, i as I, j as c, k as d, l as b, m as f } from "./UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-f2mzNg6i.js";
2
2
  export {
3
3
  a as UserAccountMenu,
4
4
  n as UserAvatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -90,13 +90,13 @@
90
90
  "@arco-design/web-vue": ">=2.56.3",
91
91
  "@huyooo/vue-tiptap": ">=0.3.25",
92
92
  "@iconify/vue": ">=4.1.2",
93
+ "@unhead/vue": ">=2.0.19",
93
94
  "@vueuse/core": ">=11.3.0",
94
95
  "ant-design-x-vue": ">=1.2.6",
95
96
  "vue": ">=3.4.37",
96
97
  "vue-router": ">=4.0.0"
97
98
  },
98
99
  "dependencies": {
99
- "@unhead/vue": "^2.0.19",
100
100
  "@vafast/api-client": "^0.3.6",
101
101
  "cos-js-sdk-v5": "^1.10.1",
102
102
  "json-bigint": "^1.0.0",
@@ -107,6 +107,7 @@
107
107
  "@arco-plugins/vite-vue": "^1.4.5",
108
108
  "@types/json-bigint": "^1.0.4",
109
109
  "@types/node": "^22.5.1",
110
+ "@unhead/vue": "^2.0.19",
110
111
  "@vafast/cli": "^0.2.1",
111
112
  "@vitejs/plugin-vue": "^5.1.2",
112
113
  "bumpp": "^10.2.0",