@huyooo/ui 0.5.12 → 0.5.14

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/main.d.ts CHANGED
@@ -10,5 +10,5 @@ export * from './upload';
10
10
  export * from './user';
11
11
  export * from './download';
12
12
  export * from './privateCom';
13
- export { createUnhead } from '@unhead/vue';
14
- export { default as request } from './utils/request';
13
+ export { createHead } from '@unhead/vue/client';
14
+ export { default as api } from './utils/request';
@@ -1,4 +1,4 @@
1
- import { ref as T, computed as f, watch as U, toValue as D, isRef as K, hasInjectionContext as H, inject as R, watchEffect as k, getCurrentInstance as L, onBeforeUnmount as q, onDeactivated as z, onActivated as N } from "vue";
1
+ import { ref as $, computed as f, watch as H, toValue as D, isRef as K, hasInjectionContext as k, inject as L, watchEffect as R, getCurrentInstance as q, onBeforeUnmount as z, onDeactivated as N, onActivated as G } from "vue";
2
2
  import { useRouter as j, useRoute as M } from "vue-router";
3
3
  /* empty css */
4
4
  /* empty css */
@@ -17,7 +17,7 @@ import { u as O } from "./useAuthkitAppsAuthPageInfo-Dfj4byB5.js";
17
17
  /* empty css */
18
18
  /* empty css */
19
19
  /* empty css */
20
- const b = T({
20
+ const b = $({
21
21
  key: "",
22
22
  name: ""
23
23
  });
@@ -52,7 +52,7 @@ function Oe(e, t, r) {
52
52
  });
53
53
  return (n == null ? void 0 : n.path) || r;
54
54
  }
55
- function Ie(e) {
55
+ function ve(e) {
56
56
  const t = j(), {
57
57
  appsData: r
58
58
  } = O(), {
@@ -89,20 +89,20 @@ function Ie(e) {
89
89
  isLoggedIn: n
90
90
  };
91
91
  }
92
- function ve() {
92
+ function Ie() {
93
93
  const e = j(), t = M(), {
94
94
  appsAuthPageInfoApi: r,
95
95
  appsData: n
96
96
  } = O(), {
97
97
  isLoggedIn: o,
98
98
  userProfile: i
99
- } = E(), s = T(!1);
99
+ } = E(), s = $(!1);
100
100
  function a(l) {
101
101
  return (n.value.publicRoutes || []).some((d) => d.permissionKey === l);
102
102
  }
103
103
  function u(l) {
104
104
  var d;
105
- return !o.value || !i.value ? !1 : (((d = i.value.permissions) == null ? void 0 : d.map((x) => x.permissionKey)) || []).includes(l);
105
+ return !o.value || !i.value ? !1 : (((d = i.value.permissions) == null ? void 0 : d.map((U) => U.permissionKey)) || []).includes(l);
106
106
  }
107
107
  function c(l) {
108
108
  if (s.value = !0, a(l)) {
@@ -116,7 +116,7 @@ function ve() {
116
116
  u(l) || e.replace("/"), s.value = !1;
117
117
  }
118
118
  return r(() => {
119
- c(t.path), U(() => t.path, (l) => {
119
+ c(t.path), H(() => t.path, (l) => {
120
120
  c(l);
121
121
  });
122
122
  }), {
@@ -125,7 +125,14 @@ function ve() {
125
125
  hasPermission: u
126
126
  };
127
127
  }
128
- const G = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), W = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]), Ve = /* @__PURE__ */ new Set([
128
+ const W = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), B = /* @__PURE__ */ new Set(["title", "titleTemplate", "script", "style", "noscript"]), Ve = /* @__PURE__ */ new Set([
129
+ "base",
130
+ "meta",
131
+ "link",
132
+ "style",
133
+ "script",
134
+ "noscript"
135
+ ]), Ce = /* @__PURE__ */ new Set([
129
136
  "title",
130
137
  "base",
131
138
  "htmlAttrs",
@@ -135,7 +142,7 @@ const G = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), W =
135
142
  "style",
136
143
  "script",
137
144
  "noscript"
138
- ]), B = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]), F = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]), Ce = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]), A = /* @__PURE__ */ new Set([
145
+ ]), F = /* @__PURE__ */ new Set(["base", "title", "titleTemplate", "bodyAttrs", "htmlAttrs", "templateParams"]), J = /* @__PURE__ */ new Set(["key", "tagPosition", "tagPriority", "tagDuplicateStrategy", "innerHTML", "textContent", "processTemplateParams"]), _e = /* @__PURE__ */ new Set(["templateParams", "htmlAttrs", "bodyAttrs"]), T = /* @__PURE__ */ new Set([
139
146
  "theme-color",
140
147
  "google-site-verification",
141
148
  "og",
@@ -149,7 +156,7 @@ const G = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), W =
149
156
  OG: /* @__PURE__ */ new Set(["og", "book", "article", "profile", "fb"]),
150
157
  MEDIA: /* @__PURE__ */ new Set(["ogImage", "ogVideo", "ogAudio", "twitterImage"]),
151
158
  HTTP_EQUIV: /* @__PURE__ */ new Set(["contentType", "defaultStyle", "xUaCompatible"])
152
- }, J = {
159
+ }, Q = {
153
160
  articleExpirationTime: "article:expiration_time",
154
161
  articleModifiedTime: "article:modified_time",
155
162
  articlePublishedTime: "article:published_time",
@@ -168,7 +175,7 @@ const G = /* @__PURE__ */ new Set(["link", "style", "script", "noscript"]), W =
168
175
  msapplicationConfig: "msapplication-Config",
169
176
  msapplicationTileColor: "msapplication-TileColor",
170
177
  msapplicationTileImage: "msapplication-TileImage"
171
- }, I = {
178
+ }, v = {
172
179
  appleItunesApp: {
173
180
  unpack: {
174
181
  entrySeparator: ", ",
@@ -205,7 +212,7 @@ function m(e) {
205
212
  const t = e.replace(/([A-Z])/g, "-$1").toLowerCase(), r = t.indexOf("-");
206
213
  return r === -1 ? t : h.META.has(t.slice(0, r)) || h.OG.has(t.slice(0, r)) ? e.replace(/([A-Z])/g, ":$1").toLowerCase() : t;
207
214
  }
208
- function v(e) {
215
+ function I(e) {
209
216
  return Object.fromEntries(Object.entries(e).filter(([t, r]) => String(r) !== "false" && t));
210
217
  }
211
218
  function w(e) {
@@ -224,38 +231,38 @@ function V(e, t = {}) {
224
231
  }).join(r);
225
232
  }
226
233
  function P(e, t) {
227
- const r = v(t), n = m(e), o = C(n);
228
- if (!A.has(n))
234
+ const r = I(t), n = m(e), o = C(n);
235
+ if (!T.has(n))
229
236
  return [{ [o]: n, ...r }];
230
237
  const i = Object.fromEntries(
231
238
  Object.entries(r).map(([s, a]) => [`${e}${s === "url" ? "" : `${s[0].toUpperCase()}${s.slice(1)}`}`, a])
232
239
  );
233
- return y(i || {}).sort((s, a) => {
240
+ return g(i || {}).sort((s, a) => {
234
241
  var u, c;
235
242
  return (((u = s[o]) == null ? void 0 : u.length) || 0) - (((c = a[o]) == null ? void 0 : c.length) || 0);
236
243
  });
237
244
  }
238
245
  function C(e) {
239
246
  var n;
240
- if (((n = I[e]) == null ? void 0 : n.metaKey) === "http-equiv" || h.HTTP_EQUIV.has(e))
247
+ if (((n = v[e]) == null ? void 0 : n.metaKey) === "http-equiv" || h.HTTP_EQUIV.has(e))
241
248
  return "http-equiv";
242
249
  const t = m(e), r = t.indexOf(":");
243
250
  return r === -1 ? "name" : h.OG.has(t.slice(0, r)) ? "property" : "name";
244
251
  }
245
- function Q(e) {
246
- return J[e] || m(e);
252
+ function Z(e) {
253
+ return Q[e] || m(e);
247
254
  }
248
- function Z(e, t) {
255
+ function X(e, t) {
249
256
  var r;
250
257
  return t === "refresh" ? `${e.seconds};url=${e.url}` : V(w(e), {
251
258
  keyValueSeparator: "=",
252
259
  entrySeparator: ", ",
253
260
  resolve: ({ value: n, key: o }) => n === null ? "" : typeof n == "boolean" ? o : void 0,
254
261
  // @ts-expect-error untyped
255
- ...(r = I[t]) == null ? void 0 : r.unpack
262
+ ...(r = v[t]) == null ? void 0 : r.unpack
256
263
  });
257
264
  }
258
- function y(e) {
265
+ function g(e) {
259
266
  const t = [], r = {};
260
267
  for (const [o, i] of Object.entries(e)) {
261
268
  if (Array.isArray(i)) {
@@ -269,12 +276,12 @@ function y(e) {
269
276
  if (typeof s == "object" && s !== null) {
270
277
  const a = [], u = [];
271
278
  for (const [c, l] of Object.entries(s)) {
272
- const p = `${o}${c === "url" ? "" : `:${c}`}`, d = y({ [p]: l });
279
+ const p = `${o}${c === "url" ? "" : `:${c}`}`, d = g({ [p]: l });
273
280
  (c === "url" ? a : u).push(...d);
274
281
  }
275
282
  t.push(...a, ...u);
276
283
  } else
277
- t.push(...typeof s == "string" ? y({ [o]: s }) : P(o, s));
284
+ t.push(...typeof s == "string" ? g({ [o]: s }) : P(o, s));
278
285
  continue;
279
286
  }
280
287
  if (typeof i == "object" && i)
@@ -293,54 +300,54 @@ function y(e) {
293
300
  // @ts-expect-error untyped
294
301
  content: l
295
302
  });
296
- } else A.has(m(o)) ? t.push(...P(o, i)) : r[o] = v(i);
303
+ } else T.has(m(o)) ? t.push(...P(o, i)) : r[o] = I(i);
297
304
  else
298
305
  r[o] = i;
299
306
  }
300
307
  const n = Object.entries(r).map(([o, i]) => {
301
308
  if (o === "charset")
302
309
  return { charset: i === null ? "_null" : i };
303
- const s = C(o), a = Q(o), u = i === null ? "_null" : typeof i == "object" ? Z(i, o) : typeof i == "number" ? i.toString() : i;
310
+ const s = C(o), a = Z(o), u = i === null ? "_null" : typeof i == "object" ? X(i, o) : typeof i == "number" ? i.toString() : i;
304
311
  return s === "http-equiv" ? { "http-equiv": a, content: u } : { [s]: a, content: u };
305
312
  });
306
313
  return [...t, ...n].map(
307
314
  (o) => "content" in o && o.content === "_null" ? { ...o, content: null } : o
308
315
  );
309
316
  }
310
- const X = {
317
+ const Y = {
311
318
  key: "flatMeta",
312
319
  hooks: {
313
320
  "entries:normalize": (e) => {
314
321
  const t = [];
315
- e.tags = e.tags.map((r) => r.tag !== "_flatMeta" ? r : (t.push(y(r.props).map((n) => ({
322
+ e.tags = e.tags.map((r) => r.tag !== "_flatMeta" ? r : (t.push(g(r.props).map((n) => ({
316
323
  ...r,
317
324
  tag: "meta",
318
325
  props: n
319
326
  }))), !1)).filter(Boolean).concat(...t);
320
327
  }
321
328
  }
322
- }, Y = ["name", "property", "http-equiv"], ee = /* @__PURE__ */ new Set([
329
+ }, ee = ["name", "property", "http-equiv"], te = /* @__PURE__ */ new Set([
323
330
  "viewport",
324
331
  "description",
325
332
  "keywords",
326
333
  "robots"
327
334
  ]);
328
- function _e(e) {
335
+ function xe(e) {
329
336
  const t = e.split(":");
330
- return t.length ? A.has(t[1]) : !1;
337
+ return t.length ? T.has(t[1]) : !1;
331
338
  }
332
- function xe(e) {
339
+ function Ue(e) {
333
340
  const { props: t, tag: r } = e;
334
- if (B.has(r))
341
+ if (F.has(r))
335
342
  return r;
336
343
  if (r === "link" && t.rel === "canonical")
337
344
  return "canonical";
338
345
  if (t.charset)
339
346
  return "charset";
340
347
  if (e.tag === "meta") {
341
- for (const n of Y)
348
+ for (const n of ee)
342
349
  if (t[n] !== void 0) {
343
- const o = t[n], i = o.includes(":"), s = ee.has(o), u = !(i || s) && e.key ? `:key:${e.key}` : "";
350
+ const o = t[n], i = o.includes(":"), s = te.has(o), u = !(i || s) && e.key ? `:key:${e.key}` : "";
344
351
  return `${r}:${o}${u}`;
345
352
  }
346
353
  }
@@ -348,26 +355,33 @@ function xe(e) {
348
355
  return `${r}:key:${e.key}`;
349
356
  if (t.id)
350
357
  return `${r}:id:${t.id}`;
351
- if (W.has(r)) {
358
+ if (B.has(r)) {
352
359
  const n = e.textContent || e.innerHTML;
353
360
  if (n)
354
361
  return `${r}:content:${n}`;
355
362
  }
356
363
  }
357
- function g(e, t, r) {
364
+ function He(e) {
365
+ const t = e._h || e._d;
366
+ if (t)
367
+ return t;
368
+ const r = e.textContent || e.innerHTML;
369
+ return r || `${e.tag}:${Object.entries(e.props).map(([n, o]) => `${n}:${String(o)}`).join(",")}`;
370
+ }
371
+ function y(e, t, r) {
358
372
  typeof e === "function" && (!r || r !== "titleTemplate" && !(r[0] === "o" && r[1] === "n")) && (e = e());
359
373
  let o;
360
374
  if (t && (o = t(r, e)), Array.isArray(o))
361
- return o.map((i) => g(i, t));
375
+ return o.map((i) => y(i, t));
362
376
  if ((o == null ? void 0 : o.constructor) === Object) {
363
377
  const i = {};
364
378
  for (const s of Object.keys(o))
365
- i[s] = g(o[s], t, s);
379
+ i[s] = y(o[s], t, s);
366
380
  return i;
367
381
  }
368
382
  return o;
369
383
  }
370
- function te(e, t) {
384
+ function re(e, t) {
371
385
  const r = e === "style" ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
372
386
  function n(o) {
373
387
  const i = o.trim();
@@ -382,17 +396,17 @@ function te(e, t) {
382
396
  i && i !== "false" && (e === "style" ? r.set(o.trim(), i) : n(o));
383
397
  }), r;
384
398
  }
385
- function re(e, t) {
399
+ function ne(e, t) {
386
400
  return e.props = e.props || {}, t ? e.tag === "templateParams" ? (e.props = t, e) : (Object.entries(t).forEach(([r, n]) => {
387
401
  if (n === null) {
388
402
  e.props[r] = null;
389
403
  return;
390
404
  }
391
405
  if (r === "class" || r === "style") {
392
- e.props[r] = te(r, n);
406
+ e.props[r] = re(r, n);
393
407
  return;
394
408
  }
395
- if (F.has(r)) {
409
+ if (J.has(r)) {
396
410
  if (["textContent", "innerHTML"].includes(r) && typeof n == "object") {
397
411
  let s = t.type;
398
412
  if (t.type || (s = "application/json"), !(s != null && s.endsWith("json")) && s !== "speculationrules")
@@ -406,11 +420,11 @@ function re(e, t) {
406
420
  o === "true" || o === "" ? e.props[r] = i ? o : !0 : !n && i && o === "false" ? e.props[r] = "false" : n !== void 0 && (e.props[r] = n);
407
421
  }), e) : e;
408
422
  }
409
- function ne(e, t) {
410
- const r = typeof t == "object" && typeof t != "function" ? t : { [e === "script" || e === "noscript" || e === "style" ? "innerHTML" : "textContent"]: t }, n = re({ tag: e, props: {} }, r);
411
- return n.key && G.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((o) => ({ ...n, props: { ...n.props, content: o } })) : n;
423
+ function oe(e, t) {
424
+ const r = typeof t == "object" && typeof t != "function" ? t : { [e === "script" || e === "noscript" || e === "style" ? "innerHTML" : "textContent"]: t }, n = ne({ tag: e, props: {} }, r);
425
+ return n.key && W.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((o) => ({ ...n, props: { ...n.props, content: o } })) : n;
412
426
  }
413
- function Ue(e, t) {
427
+ function De(e, t) {
414
428
  if (!e)
415
429
  return [];
416
430
  typeof e == "function" && (e = e());
@@ -421,51 +435,59 @@ function Ue(e, t) {
421
435
  };
422
436
  e = r(void 0, e);
423
437
  const n = [];
424
- return e = g(e, r), Object.entries(e || {}).forEach(([o, i]) => {
438
+ return e = y(e, r), Object.entries(e || {}).forEach(([o, i]) => {
425
439
  if (i !== void 0)
426
440
  for (const s of Array.isArray(i) ? i : [i])
427
- n.push(ne(o, s));
441
+ n.push(oe(o, s));
428
442
  }), n.flat();
429
443
  }
430
- const oe = (e, t) => K(t) ? D(t) : t, se = "usehead";
444
+ const se = (e, t) => K(t) ? D(t) : t, _ = "usehead";
431
445
  // @__NO_SIDE_EFFECTS__
432
- function _() {
433
- if (H()) {
434
- const e = R(se);
446
+ function Ke(e) {
447
+ return {
448
+ install(r) {
449
+ r.config.globalProperties.$unhead = e, r.config.globalProperties.$head = e, r.provide(_, e);
450
+ }
451
+ }.install;
452
+ }
453
+ // @__NO_SIDE_EFFECTS__
454
+ function x() {
455
+ if (k()) {
456
+ const e = L(_);
435
457
  if (!e)
436
458
  throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
437
459
  return e;
438
460
  }
439
461
  throw new Error("useHead() was called without provide context, ensure you call it through the setup() function.");
440
462
  }
441
- function $(e, t = {}) {
442
- const r = t.head || /* @__PURE__ */ _();
463
+ function A(e, t = {}) {
464
+ const r = t.head || /* @__PURE__ */ x();
443
465
  return r.ssr ? r.push(e || {}, t) : ie(r, e, t);
444
466
  }
445
467
  function ie(e, t, r = {}) {
446
- const n = T(!1);
468
+ const n = $(!1);
447
469
  let o;
448
- return k(() => {
449
- const s = n.value ? {} : g(t, oe);
470
+ return R(() => {
471
+ const s = n.value ? {} : y(t, se);
450
472
  o ? o.patch(s) : o = e.push(s, r);
451
- }), L() && (q(() => {
473
+ }), q() && (z(() => {
452
474
  o.dispose();
453
- }), z(() => {
454
- n.value = !0;
455
475
  }), N(() => {
476
+ n.value = !0;
477
+ }), G(() => {
456
478
  n.value = !1;
457
479
  })), o;
458
480
  }
459
481
  function S(e = {}, t = {}) {
460
- (t.head || /* @__PURE__ */ _()).use(X);
482
+ (t.head || /* @__PURE__ */ x()).use(Y);
461
483
  const { title: n, titleTemplate: o, ...i } = e;
462
- return $({
484
+ return A({
463
485
  title: n,
464
486
  titleTemplate: o,
465
487
  _flatMeta: i
466
488
  }, t);
467
489
  }
468
- function De() {
490
+ function ke() {
469
491
  function e(r) {
470
492
  S({
471
493
  ogSiteName: r.siteName,
@@ -481,7 +503,7 @@ function De() {
481
503
  url: a,
482
504
  type: u = "website"
483
505
  } = r, c = o && o.length > 155 ? `${o.substring(0, 152)}...` : o;
484
- $({
506
+ A({
485
507
  title: n,
486
508
  link: a ? [{
487
509
  rel: "canonical",
@@ -507,9 +529,9 @@ function De() {
507
529
  setPageSEO: t
508
530
  };
509
531
  }
510
- function Ke() {
532
+ function Le() {
511
533
  const e = M(), t = () => e.meta;
512
- $({
534
+ A({
513
535
  title: f(() => t().title || ""),
514
536
  link: f(() => {
515
537
  const r = t();
@@ -548,16 +570,20 @@ function Ke() {
548
570
  });
549
571
  }
550
572
  export {
551
- Ce as U,
552
- Ve as V,
553
- Ie as a,
554
- ve as b,
555
- De as c,
556
- Ke as d,
557
- xe as e,
573
+ Ve as H,
574
+ _e as U,
575
+ Ce as V,
576
+ ve as a,
577
+ Ie as b,
578
+ ke as c,
579
+ Le as d,
580
+ Ue as e,
558
581
  Oe as f,
559
- _e as i,
560
- Ue as n,
582
+ ne as g,
583
+ He as h,
584
+ xe as i,
585
+ De as n,
561
586
  Me as u,
587
+ Ke as v,
562
588
  Ee as w
563
589
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [