@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 +4 -0
- package/dist/{index-CfK0PRAy.js → index-9Ug4oygq.js} +51 -41
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3275 -4
- package/dist/piniaStore/base/auth.d.ts +3 -3
- package/dist/piniaStore/index.d.ts +1 -0
- package/dist/piniaStore/index.js +6 -5
- package/dist/piniaStore/mock.d.ts +11 -0
- package/dist/request/axios.d.ts +6 -0
- package/dist/request/fetch.d.ts +0 -0
- package/dist/utils/index.d.ts +0 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
import "pinia-plugin-persistedstate";
|
|
2
|
-
import {
|
|
3
|
-
import { ref as
|
|
4
|
-
import {
|
|
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 =
|
|
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 =
|
|
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:
|
|
21
|
+
userInfo: r,
|
|
14
22
|
dict: o,
|
|
15
|
-
role:
|
|
16
|
-
setUserInfo: (
|
|
17
|
-
|
|
23
|
+
role: i,
|
|
24
|
+
setUserInfo: (s) => {
|
|
25
|
+
r.value = s;
|
|
18
26
|
},
|
|
19
|
-
setToken: (
|
|
20
|
-
t.value =
|
|
27
|
+
setToken: (s) => {
|
|
28
|
+
t.value = s, e.value = !0;
|
|
21
29
|
},
|
|
22
|
-
setDict: (
|
|
23
|
-
o.value =
|
|
30
|
+
setDict: (s) => {
|
|
31
|
+
o.value = s;
|
|
24
32
|
},
|
|
25
|
-
setRole: (
|
|
26
|
-
|
|
33
|
+
setRole: (s) => {
|
|
34
|
+
i.value = s;
|
|
27
35
|
},
|
|
28
36
|
clearAuth: () => {
|
|
29
|
-
t.value = null,
|
|
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
|
|
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
|
|
52
|
+
let l;
|
|
45
53
|
const g = new Uint8Array(16);
|
|
46
|
-
function
|
|
47
|
-
if (!
|
|
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
|
-
|
|
58
|
+
l = crypto.getRandomValues.bind(crypto);
|
|
51
59
|
}
|
|
52
|
-
return
|
|
60
|
+
return l(g);
|
|
53
61
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
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?.() ??
|
|
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,
|
|
68
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, f(o);
|
|
61
69
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
70
|
+
function S(e, t, r) {
|
|
71
|
+
return p.randomUUID && !e ? p.randomUUID() : k(e);
|
|
64
72
|
}
|
|
65
|
-
const
|
|
73
|
+
const x = d(
|
|
66
74
|
"@jnrs/vue-core/pinia:menu",
|
|
67
75
|
() => {
|
|
68
|
-
const e =
|
|
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 (
|
|
75
|
-
throw
|
|
82
|
+
} catch (c) {
|
|
83
|
+
throw c;
|
|
76
84
|
}
|
|
77
85
|
return t.value;
|
|
78
86
|
}, o = (a) => {
|
|
79
|
-
for (const
|
|
80
|
-
|
|
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:
|
|
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
|
|
104
|
+
const T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
97
105
|
__proto__: null,
|
|
98
|
-
useAuthStore:
|
|
99
|
-
useMenuStore:
|
|
100
|
-
|
|
106
|
+
useAuthStore: h,
|
|
107
|
+
useMenuStore: x,
|
|
108
|
+
useMockStore: y,
|
|
109
|
+
useSystemStore: m
|
|
101
110
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
102
111
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
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