@jnrs/vue-core 1.1.5 → 1.1.6

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/README.md CHANGED
@@ -32,6 +32,10 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
32
32
  - DictItem
33
33
  - Dict
34
34
  - MenuItem
35
+
36
+ 函数
37
+ - request 网络请求
38
+
35
39
  #### @jnrs/vue-core/pinia 模块
36
40
  函数
37
41
  ``` typescript
@@ -1,32 +1,40 @@
1
1
  import "pinia-plugin-persistedstate";
2
- import { u as p } from "./system-KZETuQYC.js";
3
- import { ref as c } from "vue";
4
- import { defineStore as m } from "pinia";
2
+ import { defineStore as d } from "pinia";
3
+ import { ref as u } from "vue";
4
+ import { u as m } from "./system-KZETuQYC.js";
5
5
  import { a as v } from "./index-Ci9uljtG.js";
6
- const y = m(
6
+ const y = d(
7
+ "jnrs-app-mock",
8
+ () => ({ isMock: u(!1) }),
9
+ {
10
+ persist: {
11
+ pick: ["isMock"]
12
+ }
13
+ }
14
+ ), h = d(
7
15
  "@jnrs/vue-core/pinia:auth",
8
16
  () => {
9
- const e = c(!1), t = c(null), u = c(null), o = c([]), l = c([]);
17
+ const e = u(!1), t = u(null), r = u(null), o = u(), i = u([]);
10
18
  return {
11
19
  hasAuthenticated: e,
12
20
  token: t,
13
- userInfo: u,
21
+ userInfo: r,
14
22
  dict: o,
15
- role: l,
16
- setUserInfo: (r) => {
17
- u.value = r;
23
+ role: i,
24
+ setUserInfo: (s) => {
25
+ r.value = s;
18
26
  },
19
- setToken: (r) => {
20
- t.value = r, e.value = !0;
27
+ setToken: (s) => {
28
+ t.value = s, e.value = !0;
21
29
  },
22
- setDict: (r) => {
23
- o.value = r;
30
+ setDict: (s) => {
31
+ o.value = s;
24
32
  },
25
- setRole: (r) => {
26
- l.value = r;
33
+ setRole: (s) => {
34
+ i.value = s;
27
35
  },
28
36
  clearAuth: () => {
29
- t.value = null, u.value = null, o.value = [], l.value = [], e.value = !1;
37
+ t.value = null, r.value = null, o.value = void 0, i.value = [], e.value = !1;
30
38
  }
31
39
  };
32
40
  },
@@ -38,48 +46,48 @@ const y = m(
38
46
  ), n = [];
39
47
  for (let e = 0; e < 256; ++e)
40
48
  n.push((e + 256).toString(16).slice(1));
41
- function h(e, t = 0) {
49
+ function f(e, t = 0) {
42
50
  return (n[e[t + 0]] + n[e[t + 1]] + n[e[t + 2]] + n[e[t + 3]] + "-" + n[e[t + 4]] + n[e[t + 5]] + "-" + n[e[t + 6]] + n[e[t + 7]] + "-" + n[e[t + 8]] + n[e[t + 9]] + "-" + n[e[t + 10]] + n[e[t + 11]] + n[e[t + 12]] + n[e[t + 13]] + n[e[t + 14]] + n[e[t + 15]]).toLowerCase();
43
51
  }
44
- let i;
52
+ let l;
45
53
  const g = new Uint8Array(16);
46
- function f() {
47
- if (!i) {
54
+ function b() {
55
+ if (!l) {
48
56
  if (typeof crypto > "u" || !crypto.getRandomValues)
49
57
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
50
- i = crypto.getRandomValues.bind(crypto);
58
+ l = crypto.getRandomValues.bind(crypto);
51
59
  }
52
- return i(g);
60
+ return l(g);
53
61
  }
54
- const b = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), d = { randomUUID: b };
55
- function U(e, t, u) {
62
+ const U = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), p = { randomUUID: U };
63
+ function k(e, t, r) {
56
64
  e = e || {};
57
- const o = e.random ?? e.rng?.() ?? f();
65
+ const o = e.random ?? e.rng?.() ?? b();
58
66
  if (o.length < 16)
59
67
  throw new Error("Random bytes length must be >= 16");
60
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, h(o);
68
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, f(o);
61
69
  }
62
- function x(e, t, u) {
63
- return d.randomUUID && !e ? d.randomUUID() : U(e);
70
+ function S(e, t, r) {
71
+ return p.randomUUID && !e ? p.randomUUID() : k(e);
64
72
  }
65
- const S = m(
73
+ const x = d(
66
74
  "@jnrs/vue-core/pinia:menu",
67
75
  () => {
68
- const e = c(!1), t = c([]), u = async (a) => {
76
+ const e = u(!1), t = u([]), r = async (a) => {
69
77
  if (e.value)
70
78
  return t.value;
71
79
  o(a), t.value = a, e.value = !0;
72
80
  try {
73
81
  await v(t.value);
74
- } catch (s) {
75
- throw s;
82
+ } catch (c) {
83
+ throw c;
76
84
  }
77
85
  return t.value;
78
86
  }, o = (a) => {
79
- for (const s of a)
80
- s.meta.uuid = x(), s.children && o(s.children);
87
+ for (const c of a)
88
+ c.meta.uuid = S(), c.children && o(c.children);
81
89
  };
82
- return { hasFetchedAsyncMenus: e, menus: t, asyncSetMenus: u, clearMenu: () => {
90
+ return { hasFetchedAsyncMenus: e, menus: t, asyncSetMenus: r, clearMenu: () => {
83
91
  e.value = !1, t.value = [];
84
92
  } };
85
93
  }
@@ -93,14 +101,16 @@ console.log(
93
101
  "%c✨ 欢迎使用 @jnrs/vue-core/pinia",
94
102
  'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
95
103
  );
96
- const _ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
104
+ const T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
97
105
  __proto__: null,
98
- useAuthStore: y,
99
- useMenuStore: S,
100
- useSystemStore: p
106
+ useAuthStore: h,
107
+ useMenuStore: x,
108
+ useMockStore: y,
109
+ useSystemStore: m
101
110
  }, Symbol.toStringTag, { value: "Module" }));
102
111
  export {
103
- S as a,
104
- _ as i,
112
+ h as a,
113
+ x as b,
114
+ T as i,
105
115
  y as u
106
116
  };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export type * from './types/base';
2
2
  export * as vueRouter from './vueRouter/createVueRouter';
3
3
  export * as piniaStore from './piniaStore/index';
4
+ export { request } from './request/axios';