@jnrs/vue-core 1.2.9 → 1.2.11

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,201 +0,0 @@
1
- import "pinia-plugin-persistedstate";
2
- import { defineStore as p } from "pinia";
3
- import { ref as s, computed as k, watch as S } from "vue";
4
- import { Fullscreen as j } from "@jnrs/shared";
5
- import { usePreferredDark as O } from "@vueuse/core";
6
- import { a as C } from "./index-GnfhAnhF.js";
7
- const M = p(
8
- "jnrs-app-mock",
9
- () => ({ isMock: s(!1) }),
10
- {
11
- persist: {
12
- pick: ["isMock"]
13
- }
14
- }
15
- ), w = [
16
- { value: "zhCn", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.zhCn" },
17
- { value: "en", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.en" }
18
- ], G = [
19
- { value: "auto", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.auto" },
20
- { value: "light", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.light" },
21
- { value: "dark", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.dark" }
22
- ], U = [
23
- { value: "oklch(0.6 0.19 41)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jnrs" },
24
- {
25
- value: "oklch(0.51 0.21 264)",
26
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.azure"
27
- },
28
- {
29
- value: "oklch(0.90 0.16 98)",
30
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.moonYellow"
31
- },
32
- { value: "oklch(0.63 0.25 27)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jdRed" },
33
- {
34
- value: "oklch(0.65 0.24 33)",
35
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.taobaoRed"
36
- },
37
- {
38
- value: "oklch(0.61 0.20 261)",
39
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.dingtalkBlue"
40
- },
41
- {
42
- value: "oklch(0.70 0.12 152)",
43
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.wechatGreen"
44
- }
45
- ];
46
- function I(e) {
47
- return e === "zhCn" || e === "en";
48
- }
49
- function x(e) {
50
- return e === "light" || e === "dark" || e === "auto";
51
- }
52
- function L(e) {
53
- return typeof e == "string" && e.trim() !== "";
54
- }
55
- const R = p(
56
- "@jnrs/vue-core/pinia:system",
57
- () => {
58
- const e = s(!1), o = () => e.value = !e.value, a = new j(), n = s(!1), i = async () => {
59
- await a.toggle(), n.value = a.isFullscreen();
60
- }, l = s({
61
- locale: w[0].value,
62
- mode: G[0].value,
63
- primaryColor: U[0].value
64
- }), u = k(() => l.value.mode === "auto" ? d.value ? "dark" : "light" : l.value.mode), d = O();
65
- return S(
66
- [() => l.value.mode, d, () => l.value.primaryColor],
67
- ([r, f, g]) => {
68
- const m = document.documentElement;
69
- m.classList.remove("light", "dark"), r === "auto" ? m.classList.add(f ? "dark" : "light") : m.classList.add(r), g ? m.style.setProperty("--jnrs-color-primary", g) : m.style.removeProperty("--jnrs-color-primary");
70
- },
71
- { immediate: !0 }
72
- ), {
73
- theme: l,
74
- computedThemeMode: u,
75
- menuCollapse: e,
76
- documentFullscreen: n,
77
- toggleCollapse: o,
78
- toggleFullScreen: i,
79
- setLocale: (r) => {
80
- I(r) && (l.value.locale = r);
81
- },
82
- setMode: (r) => {
83
- x(r) && (l.value.mode = r);
84
- },
85
- setPrimaryColor: (r) => {
86
- L(r) && (l.value.primaryColor = r);
87
- }
88
- };
89
- },
90
- {
91
- persist: {
92
- pick: ["theme", "menuCollapse"]
93
- }
94
- }
95
- ), D = p(
96
- "@jnrs/vue-core/pinia:auth",
97
- () => {
98
- const e = s(!1), o = s(null), a = s(null), n = s(), i = s([]);
99
- return {
100
- hasAuthenticated: e,
101
- token: o,
102
- userInfo: a,
103
- dict: n,
104
- role: i,
105
- setUserInfo: (c) => {
106
- a.value = c;
107
- },
108
- setToken: (c) => {
109
- o.value = c, e.value = !0;
110
- },
111
- setDict: (c) => {
112
- n.value = c;
113
- },
114
- setRole: (c) => {
115
- i.value = c;
116
- },
117
- clearAuth: () => {
118
- o.value = null, a.value = null, n.value = void 0, i.value = [], e.value = !1;
119
- }
120
- };
121
- },
122
- {
123
- persist: {
124
- pick: ["hasAuthenticated", "token", "userInfo", "dict"]
125
- }
126
- }
127
- ), t = [];
128
- for (let e = 0; e < 256; ++e)
129
- t.push((e + 256).toString(16).slice(1));
130
- function P(e, o = 0) {
131
- return (t[e[o + 0]] + t[e[o + 1]] + t[e[o + 2]] + t[e[o + 3]] + "-" + t[e[o + 4]] + t[e[o + 5]] + "-" + t[e[o + 6]] + t[e[o + 7]] + "-" + t[e[o + 8]] + t[e[o + 9]] + "-" + t[e[o + 10]] + t[e[o + 11]] + t[e[o + 12]] + t[e[o + 13]] + t[e[o + 14]] + t[e[o + 15]]).toLowerCase();
132
- }
133
- let v;
134
- const T = new Uint8Array(16);
135
- function A() {
136
- if (!v) {
137
- if (typeof crypto > "u" || !crypto.getRandomValues)
138
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
139
- v = crypto.getRandomValues.bind(crypto);
140
- }
141
- return v(T);
142
- }
143
- const _ = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), h = { randomUUID: _ };
144
- function z(e, o, a) {
145
- e = e || {};
146
- const n = e.random ?? e.rng?.() ?? A();
147
- if (n.length < 16)
148
- throw new Error("Random bytes length must be >= 16");
149
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, P(n);
150
- }
151
- function E(e, o, a) {
152
- return h.randomUUID && !e ? h.randomUUID() : z(e);
153
- }
154
- const F = p(
155
- "@jnrs/vue-core/pinia:menu",
156
- () => {
157
- const e = s(!1), o = s([]), a = async (l) => {
158
- if (e.value)
159
- return o.value;
160
- n(l), o.value = l, e.value = !0;
161
- try {
162
- await C(o.value);
163
- } catch (u) {
164
- throw u;
165
- }
166
- return o.value;
167
- }, n = (l) => {
168
- for (const u of l)
169
- u.meta.uuid = E(), u.children && n(u.children);
170
- };
171
- return { hasFetchedAsyncMenus: e, menus: o, asyncSetMenus: a, clearMenu: () => {
172
- e.value = !1, o.value = [];
173
- } };
174
- }
175
- // {
176
- // persist: {
177
- // pick: ['menus']
178
- // }
179
- // }
180
- );
181
- console.log(
182
- "%c✨ 欢迎使用 @jnrs/vue-core/pinia",
183
- 'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
184
- );
185
- const J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
186
- __proto__: null,
187
- useAuthStore: D,
188
- useMenuStore: F,
189
- useMockStore: M,
190
- useSystemStore: R
191
- }, Symbol.toStringTag, { value: "Module" }));
192
- export {
193
- U as C,
194
- w as L,
195
- G as M,
196
- D as a,
197
- R as b,
198
- F as c,
199
- J as i,
200
- M as u
201
- };
@@ -1,135 +0,0 @@
1
- import { Dict, User, Role } from '@jnrs/shared';
2
- /**
3
- * useAuthStore 权限仓库
4
- * @returns hasAuthenticated 是否已身份验证
5
- * @returns token 身份验证凭证
6
- * @returns userInfo 用户信息
7
- * @returns dict 字典
8
- * @returns role 角色权限
9
- * @methods asyncSetAuth 设置权限信息
10
- * @methods clearAuth 清除权限信息
11
- */
12
- export declare const useAuthStore: import('pinia').StoreDefinition<"@jnrs/vue-core/pinia:auth", Pick<{
13
- hasAuthenticated: import('vue').Ref<boolean, boolean>;
14
- token: import('vue').Ref<string | null, string | null>;
15
- userInfo: import('vue').Ref<{
16
- [x: string]: unknown;
17
- id: number;
18
- name: string;
19
- role: number;
20
- permissions?: string[] | undefined;
21
- jobTitle?: number | undefined;
22
- workNo?: string | undefined;
23
- workgroup?: string | undefined;
24
- avatarFileName?: string | undefined;
25
- } | null, User | {
26
- [x: string]: unknown;
27
- id: number;
28
- name: string;
29
- role: number;
30
- permissions?: string[] | undefined;
31
- jobTitle?: number | undefined;
32
- workNo?: string | undefined;
33
- workgroup?: string | undefined;
34
- avatarFileName?: string | undefined;
35
- } | null>;
36
- dict: import('vue').Ref<Dict | undefined, Dict | undefined>;
37
- role: import('vue').Ref<{
38
- [x: string]: unknown;
39
- label: string;
40
- value: string | number;
41
- permissions?: string[] | undefined;
42
- }[], Role[] | {
43
- [x: string]: unknown;
44
- label: string;
45
- value: string | number;
46
- permissions?: string[] | undefined;
47
- }[]>;
48
- setUserInfo: (d: User) => void;
49
- setToken: (d: string) => void;
50
- setDict: (d: Dict) => void;
51
- setRole: (d: Role[]) => void;
52
- clearAuth: () => void;
53
- }, "role" | "hasAuthenticated" | "token" | "userInfo" | "dict">, Pick<{
54
- hasAuthenticated: import('vue').Ref<boolean, boolean>;
55
- token: import('vue').Ref<string | null, string | null>;
56
- userInfo: import('vue').Ref<{
57
- [x: string]: unknown;
58
- id: number;
59
- name: string;
60
- role: number;
61
- permissions?: string[] | undefined;
62
- jobTitle?: number | undefined;
63
- workNo?: string | undefined;
64
- workgroup?: string | undefined;
65
- avatarFileName?: string | undefined;
66
- } | null, User | {
67
- [x: string]: unknown;
68
- id: number;
69
- name: string;
70
- role: number;
71
- permissions?: string[] | undefined;
72
- jobTitle?: number | undefined;
73
- workNo?: string | undefined;
74
- workgroup?: string | undefined;
75
- avatarFileName?: string | undefined;
76
- } | null>;
77
- dict: import('vue').Ref<Dict | undefined, Dict | undefined>;
78
- role: import('vue').Ref<{
79
- [x: string]: unknown;
80
- label: string;
81
- value: string | number;
82
- permissions?: string[] | undefined;
83
- }[], Role[] | {
84
- [x: string]: unknown;
85
- label: string;
86
- value: string | number;
87
- permissions?: string[] | undefined;
88
- }[]>;
89
- setUserInfo: (d: User) => void;
90
- setToken: (d: string) => void;
91
- setDict: (d: Dict) => void;
92
- setRole: (d: Role[]) => void;
93
- clearAuth: () => void;
94
- }, never>, Pick<{
95
- hasAuthenticated: import('vue').Ref<boolean, boolean>;
96
- token: import('vue').Ref<string | null, string | null>;
97
- userInfo: import('vue').Ref<{
98
- [x: string]: unknown;
99
- id: number;
100
- name: string;
101
- role: number;
102
- permissions?: string[] | undefined;
103
- jobTitle?: number | undefined;
104
- workNo?: string | undefined;
105
- workgroup?: string | undefined;
106
- avatarFileName?: string | undefined;
107
- } | null, User | {
108
- [x: string]: unknown;
109
- id: number;
110
- name: string;
111
- role: number;
112
- permissions?: string[] | undefined;
113
- jobTitle?: number | undefined;
114
- workNo?: string | undefined;
115
- workgroup?: string | undefined;
116
- avatarFileName?: string | undefined;
117
- } | null>;
118
- dict: import('vue').Ref<Dict | undefined, Dict | undefined>;
119
- role: import('vue').Ref<{
120
- [x: string]: unknown;
121
- label: string;
122
- value: string | number;
123
- permissions?: string[] | undefined;
124
- }[], Role[] | {
125
- [x: string]: unknown;
126
- label: string;
127
- value: string | number;
128
- permissions?: string[] | undefined;
129
- }[]>;
130
- setUserInfo: (d: User) => void;
131
- setToken: (d: string) => void;
132
- setDict: (d: Dict) => void;
133
- setRole: (d: Role[]) => void;
134
- clearAuth: () => void;
135
- }, "setUserInfo" | "setToken" | "setDict" | "setRole" | "clearAuth">>;
@@ -1,8 +0,0 @@
1
- import { BusinessRequest, BusinessResponse } from '@jnrs/shared/request';
2
- /**
3
- * axios 请求方法(泛型拓展)
4
- * @param options 请求配置项
5
- * @returns Promise<T> 响应数据
6
- */
7
- declare const axiosRequest: <T = BusinessResponse>(options: BusinessRequest) => Promise<T>;
8
- export { axiosRequest };
File without changes
@@ -1 +0,0 @@
1
- export * from './axios';
@@ -1,4 +0,0 @@
1
- import { a as o } from "../index-Wfhohf_A.js";
2
- export {
3
- o as axiosRequest
4
- };