@duxweb/dvha-core 0.1.19 → 0.1.21

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.
Files changed (131) hide show
  1. package/dist/cjs/_virtual/_commonjsHelpers.cjs +1 -0
  2. package/dist/cjs/_virtual/dayjs.min.cjs +1 -0
  3. package/dist/cjs/_virtual/dayjs.min2.cjs +1 -0
  4. package/dist/cjs/components/auth/can.cjs +1 -1
  5. package/dist/cjs/components/loader/iframe.cjs +1 -1
  6. package/dist/cjs/components/loader/loader.cjs +1 -0
  7. package/dist/cjs/components/loader/remote/loader.cjs +1 -0
  8. package/dist/cjs/components/loader/remote/render.cjs +1 -0
  9. package/dist/cjs/components/status/error.cjs +1 -1
  10. package/dist/cjs/components/status/exception.cjs +1 -0
  11. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  12. package/dist/cjs/components/status/notFound.cjs +1 -1
  13. package/dist/cjs/directive/permission.cjs +1 -1
  14. package/dist/cjs/hooks/auth.cjs +1 -1
  15. package/dist/cjs/hooks/data.cjs +1 -1
  16. package/dist/cjs/hooks/export.cjs +1 -1
  17. package/dist/cjs/hooks/form.cjs +1 -1
  18. package/dist/cjs/hooks/formExtend.cjs +1 -0
  19. package/dist/cjs/hooks/formValidate.cjs +1 -0
  20. package/dist/cjs/hooks/i18n.cjs +1 -1
  21. package/dist/cjs/hooks/importCsv.cjs +1 -1
  22. package/dist/cjs/hooks/json/index.cjs +1 -0
  23. package/dist/cjs/hooks/json/utils/contextManager.cjs +1 -0
  24. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -0
  25. package/dist/cjs/hooks/json/vFor.cjs +1 -0
  26. package/dist/cjs/hooks/json/vIf.cjs +1 -0
  27. package/dist/cjs/hooks/json/vModel.cjs +1 -0
  28. package/dist/cjs/hooks/json/vOn.cjs +1 -0
  29. package/dist/cjs/hooks/json/vShow.cjs +1 -0
  30. package/dist/cjs/hooks/json/vText.cjs +1 -0
  31. package/dist/cjs/hooks/json.cjs +1 -0
  32. package/dist/cjs/hooks/list.cjs +1 -0
  33. package/dist/cjs/hooks/manage.cjs +1 -1
  34. package/dist/cjs/hooks/menu.cjs +1 -1
  35. package/dist/cjs/hooks/overlay.cjs +1 -1
  36. package/dist/cjs/hooks/select.cjs +1 -1
  37. package/dist/cjs/hooks/theme.cjs +2 -2
  38. package/dist/cjs/hooks/upload.cjs +1 -1
  39. package/dist/cjs/index.cjs +1 -1
  40. package/dist/cjs/main.cjs +1 -1
  41. package/dist/cjs/node_modules/dayjs/dayjs.min.cjs +1 -0
  42. package/dist/cjs/node_modules/jsep/dist/jsep.cjs +2 -0
  43. package/dist/cjs/node_modules/mitt/dist/mitt.cjs +1 -0
  44. package/dist/cjs/preset/dataProvider.cjs +1 -1
  45. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  46. package/dist/cjs/provider/app.cjs +1 -1
  47. package/dist/cjs/stores/manage.cjs +1 -1
  48. package/dist/cjs/stores/tab.cjs +1 -1
  49. package/dist/cjs/stores/theme.cjs +1 -1
  50. package/dist/cjs/utils/theme.cjs +9 -1
  51. package/dist/esm/_virtual/_commonjsHelpers.js +6 -0
  52. package/dist/esm/_virtual/dayjs.min.js +7 -0
  53. package/dist/esm/_virtual/dayjs.min2.js +4 -0
  54. package/dist/esm/components/auth/can.js +11 -8
  55. package/dist/esm/components/loader/loader.js +47 -0
  56. package/dist/esm/components/loader/remote/loader.js +150 -0
  57. package/dist/esm/components/loader/remote/render.js +19 -0
  58. package/dist/esm/components/status/error.js +3 -3
  59. package/dist/esm/components/status/exception.js +23 -0
  60. package/dist/esm/components/status/notAuthorized.js +2 -2
  61. package/dist/esm/components/status/notFound.js +4 -4
  62. package/dist/esm/directive/permission.js +6 -3
  63. package/dist/esm/hooks/auth.js +67 -67
  64. package/dist/esm/hooks/data.js +187 -183
  65. package/dist/esm/hooks/export.js +26 -23
  66. package/dist/esm/hooks/form.js +38 -35
  67. package/dist/esm/hooks/formExtend.js +38 -0
  68. package/dist/esm/hooks/formValidate.js +28 -0
  69. package/dist/esm/hooks/i18n.js +16 -8
  70. package/dist/esm/hooks/json/index.js +23 -0
  71. package/dist/esm/hooks/json/utils/contextManager.js +31 -0
  72. package/dist/esm/hooks/json/utils/expressionParser.js +134 -0
  73. package/dist/esm/hooks/json/vFor.js +57 -0
  74. package/dist/esm/hooks/json/vIf.js +17 -0
  75. package/dist/esm/hooks/json/vModel.js +78 -0
  76. package/dist/esm/hooks/json/vOn.js +32 -0
  77. package/dist/esm/hooks/json/vShow.js +24 -0
  78. package/dist/esm/hooks/json/vText.js +54 -0
  79. package/dist/esm/hooks/json.js +80 -0
  80. package/dist/esm/hooks/list.js +179 -0
  81. package/dist/esm/hooks/manage.js +19 -14
  82. package/dist/esm/hooks/overlay.js +7 -4
  83. package/dist/esm/hooks/theme.js +72 -72
  84. package/dist/esm/index.js +132 -100
  85. package/dist/esm/main.js +22 -12
  86. package/dist/esm/node_modules/dayjs/dayjs.min.js +282 -0
  87. package/dist/esm/node_modules/jsep/dist/jsep.js +737 -0
  88. package/dist/esm/node_modules/mitt/dist/mitt.js +19 -0
  89. package/dist/esm/preset/i18nProvider.js +21 -13
  90. package/dist/esm/provider/app.js +62 -53
  91. package/dist/esm/stores/manage.js +23 -15
  92. package/dist/esm/stores/tab.js +58 -49
  93. package/dist/esm/utils/theme.js +89 -76
  94. package/dist/types/components/index.d.ts +2 -1
  95. package/dist/types/components/loader/loader.d.ts +2 -0
  96. package/dist/types/components/loader/remote/index.d.ts +2 -0
  97. package/dist/types/components/loader/remote/loader.d.ts +1 -0
  98. package/dist/types/components/loader/remote/render.d.ts +1 -0
  99. package/dist/types/components/status/error.d.ts +1 -2
  100. package/dist/types/components/status/exception.d.ts +3 -0
  101. package/dist/types/components/status/index.d.ts +4 -0
  102. package/dist/types/components/status/notAuthorized.d.ts +1 -2
  103. package/dist/types/components/status/notFound.d.ts +1 -2
  104. package/dist/types/config/index.d.ts +1 -0
  105. package/dist/types/hooks/auth.d.ts +6 -6
  106. package/dist/types/hooks/data.d.ts +30 -30
  107. package/dist/types/hooks/form.d.ts +6 -3
  108. package/dist/types/hooks/formExtend.d.ts +12 -0
  109. package/dist/types/hooks/formValidate.d.ts +14 -0
  110. package/dist/types/hooks/i18n.d.ts +2 -0
  111. package/dist/types/hooks/import.d.ts +1 -2
  112. package/dist/types/hooks/index.d.ts +6 -1
  113. package/dist/types/hooks/json/types.d.ts +1 -0
  114. package/dist/types/hooks/json.d.ts +2 -3
  115. package/dist/types/hooks/list.d.ts +66 -0
  116. package/dist/types/hooks/manage.d.ts +1 -0
  117. package/dist/types/hooks/overlay.d.ts +4 -0
  118. package/dist/types/index.d.ts +6 -5
  119. package/dist/types/preset/i18nProvider.d.ts +1 -1
  120. package/dist/types/stores/route.d.ts +180 -180
  121. package/dist/types/stores/tab.d.ts +1112 -73
  122. package/dist/types/types/config.d.ts +9 -0
  123. package/dist/types/types/data.d.ts +1 -1
  124. package/dist/types/types/i18n.d.ts +1 -0
  125. package/dist/types/types/manage.d.ts +6 -0
  126. package/dist/types/utils/index.d.ts +1 -1
  127. package/dist/types/utils/theme.d.ts +4 -49
  128. package/package.json +11 -5
  129. /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
  130. /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
  131. /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
@@ -0,0 +1,54 @@
1
+ import { evaluateExpression as h } from "./utils/expressionParser.js";
2
+ function l(r) {
3
+ return typeof r == "string" && /\{\{.+?\}\}/.test(r);
4
+ }
5
+ function f(r, o) {
6
+ return l(r) ? r.replace(/\{\{([^}]+)\}\}/g, (c, e) => {
7
+ try {
8
+ const n = h(e.trim(), o);
9
+ return String(n ?? "");
10
+ } catch (n) {
11
+ return console.warn(`Interpolation expression evaluation failed: ${e}`, n), c;
12
+ }
13
+ }) : r;
14
+ }
15
+ const d = {
16
+ name: "v-text",
17
+ priority: 50,
18
+ process(r, o) {
19
+ const c = o._context || {};
20
+ let e = !1, n = !1;
21
+ const i = {};
22
+ Object.entries(o).forEach(([t, s]) => {
23
+ if (typeof s == "string" && l(s)) {
24
+ const a = f(s, c);
25
+ a !== s ? (i[t] = a, e = !0) : i[t] = s;
26
+ } else
27
+ i[t] = s;
28
+ });
29
+ let p = r.children;
30
+ if (typeof r.children == "string" && l(r.children)) {
31
+ const t = f(r.children, c);
32
+ t !== r.children && (p = t, e = !0, n = !0);
33
+ }
34
+ if (!e)
35
+ return null;
36
+ if (n) {
37
+ const t = {
38
+ ...r,
39
+ attrs: r.attrs,
40
+ children: p
41
+ };
42
+ return {
43
+ props: i,
44
+ nodes: [t]
45
+ };
46
+ }
47
+ return {
48
+ props: i
49
+ };
50
+ }
51
+ };
52
+ export {
53
+ d as vTextAdaptor
54
+ };
@@ -0,0 +1,80 @@
1
+ import { computed as R, isRef as A, defineComponent as _, h as b, unref as F } from "vue";
2
+ import { defaultAdaptors as G } from "./json/index.js";
3
+ import { injectContext as N } from "./json/utils/contextManager.js";
4
+ function z(t) {
5
+ const O = (t == null ? void 0 : t.adaptors) || G, j = (t == null ? void 0 : t.components) || {}, P = R(() => A(t == null ? void 0 : t.data) ? t == null ? void 0 : t.data.value : t == null ? void 0 : t.data);
6
+ function V() {
7
+ return (A(t == null ? void 0 : t.context) ? t == null ? void 0 : t.context.value : t == null ? void 0 : t.context) || {};
8
+ }
9
+ function h(e) {
10
+ const r = {};
11
+ return Object.entries(e).forEach(([n, f]) => {
12
+ if (n === "_context") return;
13
+ const l = n === "modelValue" || n.startsWith("modelValue") || n !== "value" && (n.includes("model") || n.includes("Model"));
14
+ r[n] = l && A(f) ? F(f) : f;
15
+ }), r;
16
+ }
17
+ function s(e, r, n) {
18
+ return typeof e == "string" ? e : typeof e == "function" ? s(e(r), r, n) : Array.isArray(e) ? e.flatMap((f) => s(f, r, n)).filter(Boolean) : e != null && e.tag ? a(e, !0, n) : e;
19
+ }
20
+ function E(e, r, n) {
21
+ if (e)
22
+ return typeof e == "string" ? e : Array.isArray(e) ? e.flatMap((f) => typeof f == "string" ? f : a(f, r, n)).filter(Boolean) : a(e, r, n);
23
+ }
24
+ function a(e, r = !1, n = {}) {
25
+ const {
26
+ tag: f,
27
+ attrs: l = {},
28
+ children: J,
29
+ slots: B
30
+ } = e, c = {
31
+ ...V(),
32
+ ...n
33
+ };
34
+ let i = {
35
+ ...l
36
+ };
37
+ Object.keys(c).length > 0 && (i = {
38
+ ...i,
39
+ ...N({}, c)
40
+ });
41
+ for (const o of O) {
42
+ const u = o.process(e, i);
43
+ if (u) {
44
+ if (i = u.props, u.skip) return null;
45
+ if (u.nodes)
46
+ return u.nodes.map((m) => {
47
+ var v;
48
+ const y = ((v = m.attrs) == null ? void 0 : v._context) || {};
49
+ return a(m, r, {
50
+ ...c,
51
+ ...y
52
+ });
53
+ }).filter(Boolean);
54
+ }
55
+ }
56
+ const d = typeof f == "string" && j[f] ? j[f] : f, M = typeof d != "string", g = h(i);
57
+ if (B && M && !r) {
58
+ const o = {};
59
+ return Object.entries(B).forEach(([u, m]) => {
60
+ o[u] = (y = {}) => s(m, y, c);
61
+ }), b(d, g, o);
62
+ }
63
+ const x = E(J, r, c);
64
+ return M && x !== void 0 ? b(d, g, {
65
+ default: () => x
66
+ }) : b(d, g, x);
67
+ }
68
+ return {
69
+ render: /* @__PURE__ */ _({
70
+ name: "JsonSchemaRenderer",
71
+ render() {
72
+ var e;
73
+ return (e = P.value) == null ? void 0 : e.map((r) => a(r)).filter(Boolean);
74
+ }
75
+ })
76
+ };
77
+ }
78
+ export {
79
+ z as useJsonSchema
80
+ };
@@ -0,0 +1,179 @@
1
+ import { reactiveComputed as V, useCountdown as W } from "@vueuse/core";
2
+ import { toRef as f, ref as r, watch as P, computed as o } from "vue";
3
+ import { useList as X } from "./data.js";
4
+ import { useExportCsv as I } from "./exportCsv.js";
5
+ import { useImportCsv as Y } from "./importCsv.js";
6
+ function ae(t) {
7
+ const c = f(t, "filters", {}), g = f(t, "sorters", {}), l = f(typeof t.pagination == "object" ? t.pagination : {
8
+ page: 1,
9
+ pageSize: 20
10
+ }), h = [10, 20, 30, 40, 50, 100], x = (e) => h.includes(e) ? h : Array.from({
11
+ length: 5
12
+ }, (a, u) => e * (u + 1)), s = r(x(l.value.pageSize));
13
+ P(() => l.value.pageSize, (e) => {
14
+ s.value.includes(e) || (s.value = x(e));
15
+ });
16
+ const k = (e) => {
17
+ l.value.pageSize = e, l.value.page = 1;
18
+ }, L = (e) => {
19
+ l.value.page = e;
20
+ }, {
21
+ data: i,
22
+ isLoading: R,
23
+ refetch: w
24
+ } = X({
25
+ path: t.path,
26
+ pagination: t.pagination ? l.value : !1,
27
+ filters: c.value,
28
+ sorters: g.value
29
+ }), F = o(() => {
30
+ var e;
31
+ return ((e = i.value) == null ? void 0 : e.data) || [];
32
+ }), S = o(() => {
33
+ var e;
34
+ return ((e = i.value) == null ? void 0 : e.meta) || {};
35
+ }), E = o(() => {
36
+ var e, a;
37
+ return ((e = t.total) == null ? void 0 : e.call(t, i.value)) || ((a = S.value) == null ? void 0 : a[t.totalField || "total"]) || 0;
38
+ }), U = o(() => Math.ceil(E.value / l.value.pageSize) || 0), A = (e) => {
39
+ c.value = e;
40
+ }, y = (e) => {
41
+ g.value = e;
42
+ }, n = r([]), z = o(() => {
43
+ var e, a;
44
+ return n.value.length > 0 && n.value.length === ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length);
45
+ }), M = o(() => {
46
+ var e, a;
47
+ return n.value.length > 0 && n.value.length < (((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length) || 0);
48
+ }), b = (e) => {
49
+ const a = n.value.indexOf(e);
50
+ a > -1 ? n.value.splice(a, 1) : n.value.push(e);
51
+ }, j = (e) => {
52
+ n.value = e;
53
+ }, O = (e) => n.value.includes(e), _ = () => {
54
+ var e, a;
55
+ z.value ? n.value = [] : n.value = ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.map((u) => u[t.key || "id"]).filter((u) => u != null)) || [];
56
+ };
57
+ P(() => {
58
+ var e;
59
+ return (e = i.value) == null ? void 0 : e.data;
60
+ }, () => {
61
+ n.value = [];
62
+ });
63
+ const d = () => {
64
+ n.value = [], w();
65
+ }, m = r({
66
+ page: 1,
67
+ pageSize: 100
68
+ }), {
69
+ trigger: q,
70
+ isLoading: B
71
+ } = I({
72
+ path: t.path,
73
+ filters: c.value || {},
74
+ sorters: g.value || {},
75
+ maxPage: () => l.value.pageSize || t.exportMaxPage || 10,
76
+ pagination: m.value,
77
+ filename: t.exportFilename || "data.csv",
78
+ onSuccess: (e) => {
79
+ var a;
80
+ (a = t.onExportSuccess) == null || a.call(t, e), m.value.page = 1;
81
+ },
82
+ onProgress: (e) => {
83
+ var a;
84
+ (a = t.onExportProgress) == null || a.call(t, e);
85
+ },
86
+ onError: (e) => {
87
+ var a;
88
+ (a = t.onExportError) == null || a.call(t, e), m.value.page = 1;
89
+ }
90
+ }), D = V(() => ({
91
+ ids: n.value
92
+ })), {
93
+ trigger: G,
94
+ isLoading: H
95
+ } = I({
96
+ path: t.path,
97
+ filters: D,
98
+ maxPage: 1,
99
+ filename: t.exportFilename || "rows.csv",
100
+ onSuccess: (e) => {
101
+ var a;
102
+ (a = t.onExportSuccess) == null || a.call(t, e);
103
+ },
104
+ onError: (e) => {
105
+ var a;
106
+ (a = t.onExportError) == null || a.call(t, e);
107
+ }
108
+ }), {
109
+ open: J,
110
+ isLoading: K
111
+ } = Y({
112
+ path: t.path,
113
+ onComplete: (e) => {
114
+ var a;
115
+ (a = t.onImportSuccess) == null || a.call(t, e);
116
+ },
117
+ onProgress: (e) => {
118
+ var a;
119
+ (a = t.onImportProgress) == null || a.call(t, e);
120
+ },
121
+ onError: (e) => {
122
+ var a;
123
+ (a = t.onImportError) == null || a.call(t, e);
124
+ }
125
+ }), v = r(!1), {
126
+ remaining: N,
127
+ start: C,
128
+ stop: Q
129
+ } = W(10, {
130
+ onComplete: () => {
131
+ d(), C();
132
+ }
133
+ }), T = () => {
134
+ v.value = !v.value, v.value ? (d(), C()) : Q();
135
+ };
136
+ return {
137
+ // 数据
138
+ list: F,
139
+ meta: S,
140
+ isLoading: R,
141
+ pagination: l,
142
+ filters: c,
143
+ sorters: g,
144
+ onRefresh: d,
145
+ onUpdateFilters: A,
146
+ onUpdateSorters: y,
147
+ // 选中
148
+ checkeds: n,
149
+ isAllChecked: z,
150
+ isIndeterminate: M,
151
+ toggleChecked: b,
152
+ isChecked: O,
153
+ toggleSelectAll: _,
154
+ onUpdateChecked: j,
155
+ // 分页
156
+ total: E,
157
+ page: o(() => l.value.page),
158
+ pageSize: o(() => l.value.pageSize),
159
+ pageSizes: s.value,
160
+ pageCount: U,
161
+ onUpdatePage: L,
162
+ onUpdatePageSize: k,
163
+ // 导出
164
+ onExport: q,
165
+ isExporting: B,
166
+ onExportRows: G,
167
+ isExportingRows: H,
168
+ // 导入
169
+ onImport: J,
170
+ isImporting: K,
171
+ // 自动刷新
172
+ autoRefetch: v,
173
+ onAutoRefetch: T,
174
+ autoCountdown: N
175
+ };
176
+ }
177
+ export {
178
+ ae as useExtendList
179
+ };
@@ -1,22 +1,27 @@
1
1
  import { trimStart as c } from "lodash-es";
2
- import { inject as p } from "vue";
2
+ import { inject as h, toRaw as w } from "vue";
3
+ import { useRoute as x } from "vue-router";
3
4
  import "pinia";
4
- import { useManageStore as s } from "../stores/manage.js";
5
- function w(o) {
6
- const e = p("dux.manage");
7
- if (o || (o = e == null ? void 0 : e.value), !o)
5
+ import { useManageStore as m } from "../stores/manage.js";
6
+ function U(e) {
7
+ const n = h("dux.manage");
8
+ if (e || (e = n == null ? void 0 : n.value), !e)
8
9
  throw new Error("manage name is not defined");
9
- const { config: t } = s(o);
10
+ const { config: t } = m(e), s = (o) => `${t == null ? void 0 : t.routePrefix}/${c(o || "", "/")}`, p = (o, i) => {
11
+ var u, f;
12
+ const r = (u = t == null ? void 0 : t.dataProvider) == null ? void 0 : u[i || "default"];
13
+ return ((f = r == null ? void 0 : r.apiUrl) == null ? void 0 : f.call(r, o)) || "";
14
+ }, l = x(), g = () => {
15
+ const o = l.path, i = (t == null ? void 0 : t.routePrefix) || "";
16
+ return c(o.replace(i, ""), "/");
17
+ };
10
18
  return {
11
- config: t,
12
- getRoutePath: (i) => `${t == null ? void 0 : t.routePrefix}/${c(i || "", "/")}`,
13
- getApiUrl: (i, f) => {
14
- var n, u;
15
- const r = (n = t == null ? void 0 : t.dataProvider) == null ? void 0 : n[f || "default"];
16
- return ((u = r == null ? void 0 : r.apiUrl) == null ? void 0 : u.call(r, i)) || "";
17
- }
19
+ config: w(t),
20
+ getRoutePath: s,
21
+ getApiUrl: p,
22
+ getPath: g
18
23
  };
19
24
  }
20
25
  export {
21
- w as useManage
26
+ U as useManage
22
27
  };
@@ -1,21 +1,24 @@
1
1
  import { useOverlayInject as t } from "@overlastic/vue";
2
2
  import "vue";
3
- import "clsx";
4
3
  import "vue-router";
5
- import { DuxOverlay as m } from "../components/overlay/overlay.js";
6
4
  import "pinia";
7
5
  import "lodash-es";
8
6
  import "@tanstack/vue-query";
9
7
  import "json-2-csv";
8
+ import "@vee-validate/rules";
9
+ import "vee-validate";
10
10
  import "@vueuse/core";
11
+ import "./json/index.js";
11
12
  import "colorizr";
12
13
  import "axios";
13
- function h() {
14
+ import "clsx";
15
+ import { DuxOverlay as m } from "../components/overlay/overlay.js";
16
+ function j() {
14
17
  const r = t(m);
15
18
  return {
16
19
  show: (o) => r(o)
17
20
  };
18
21
  }
19
22
  export {
20
- h as useOverlay
23
+ j as useOverlay
21
24
  };
@@ -1,16 +1,16 @@
1
1
  import { useColorMode as Q, useCycleList as W } from "@vueuse/core";
2
2
  import { hex2rgb as X } from "colorizr";
3
3
  import { storeToRefs as Y } from "pinia";
4
- import { watchEffect as Z, computed as m, watch as _, readonly as I } from "vue";
4
+ import { watchEffect as Z, computed as g, watch as _, readonly as I } from "vue";
5
+ import { themeColor as N } from "../config/color.js";
5
6
  import "lodash-es";
6
- import { useThemeStore as N } from "../stores/theme.js";
7
- import { useManage as ee } from "./manage.js";
8
- import { themeColor as te } from "./themeColor.js";
7
+ import { useThemeStore as ee } from "../stores/theme.js";
8
+ import { useManage as te } from "./manage.js";
9
9
  function de() {
10
10
  var V, M;
11
- const f = N(), { mode: L } = Y(f), C = Q({
11
+ const f = ee(), { mode: L } = Y(f), C = Q({
12
12
  storageRef: L
13
- }), h = ee(), { state: x, next: O, go: p } = W(["dark", "light", "auto"], {
13
+ }), h = te(), { state: x, next: O, go: p } = W(["dark", "light", "auto"], {
14
14
  initialValue: C.store.value
15
15
  });
16
16
  Z(() => {
@@ -28,20 +28,20 @@ function de() {
28
28
  p(0);
29
29
  break;
30
30
  }
31
- }, b = m(() => {
31
+ }, b = g(() => {
32
32
  const { system: t, store: e } = C;
33
33
  return e.value === "auto" ? t.value === "dark" : e.value === "dark";
34
- }), z = m(() => {
35
- var t, e, r, c, i, l, o, s;
34
+ }), z = g(() => {
35
+ var t, e, o, c, i, l, r, s;
36
36
  return b.value ? {
37
37
  logo: (e = (t = h.config) == null ? void 0 : t.theme) == null ? void 0 : e.darkLogo,
38
- banner: (c = (r = h.config) == null ? void 0 : r.theme) == null ? void 0 : c.darkBanner
38
+ banner: (c = (o = h.config) == null ? void 0 : o.theme) == null ? void 0 : c.darkBanner
39
39
  } : {
40
40
  logo: (l = (i = h.config) == null ? void 0 : i.theme) == null ? void 0 : l.logo,
41
- banner: (s = (o = h.config) == null ? void 0 : o.theme) == null ? void 0 : s.banner
41
+ banner: (s = (r = h.config) == null ? void 0 : r.theme) == null ? void 0 : s.banner
42
42
  };
43
43
  }), n = { ...{
44
- colors: te,
44
+ colors: N,
45
45
  // 色彩类型
46
46
  colorTypes: ["primary", "info", "success", "warning", "error", "gray"],
47
47
  // 色彩色阶
@@ -49,7 +49,7 @@ function de() {
49
49
  // 色彩场景
50
50
  colorScenes: {
51
51
  light: {
52
- default: { default: "500", hover: "600", pressed: "700", focus: "500", disabled: "300" }
52
+ default: { default: "600", hover: "600", pressed: "700", focus: "500", disabled: "300" }
53
53
  },
54
54
  dark: {
55
55
  default: { default: "500", hover: "400", pressed: "300", focus: "500", disabled: "600" }
@@ -58,39 +58,39 @@ function de() {
58
58
  // 语义颜色
59
59
  colorSemantic: {
60
60
  light: {
61
- text: { dimmed: "400", muted: "500", toned: "600", base: "700", highlighted: "900", inverted: "white" },
61
+ text: { dimmed: "300", muted: "400", toned: "600", base: "800", highlighted: "900", inverted: "white" },
62
62
  bg: { base: "white", muted: "50", elevated: "100", accented: "200", inverted: "900" },
63
- border: { base: "200", muted: "200", accented: "300", inverted: "900" }
63
+ border: { base: "100", muted: "200", accented: "300", inverted: "900" }
64
64
  },
65
65
  dark: {
66
- text: { dimmed: "600", muted: "500", toned: "400", base: "300", highlighted: "100", inverted: "black" },
66
+ text: { dimmed: "600", muted: "500", toned: "300", base: "400", highlighted: "100", inverted: "black" },
67
67
  bg: { base: "950", muted: "900", elevated: "800", accented: "700", inverted: "100" },
68
- border: { base: "900", muted: "800", accented: "700", inverted: "100" }
68
+ border: { base: "600", muted: "800", accented: "700", inverted: "100" }
69
69
  }
70
70
  },
71
71
  colorBase: { white: "#ffffff", black: "#000000" }
72
- }, ...(M = (V = h.config) == null ? void 0 : V.theme) == null ? void 0 : M.config }, { colorShades: k, colorTypes: w } = n, g = m(() => f.theme), $ = m(() => Object.keys(n.colors)), T = ["default", "hover", "pressed", "focus", "disabled"];
72
+ }, ...(M = (V = h.config) == null ? void 0 : V.theme) == null ? void 0 : M.config }, { colorShades: k, colorTypes: w } = n, m = g(() => f.theme), v = g(() => Object.keys(n.colors)), T = ["default", "hover", "pressed", "focus", "disabled"];
73
73
  function y() {
74
74
  return b.value ? n.colorScenes.dark : n.colorScenes.light;
75
75
  }
76
76
  function E(t, e) {
77
77
  var i;
78
- const r = y(), c = r.default;
79
- if ((i = r.overrides) != null && i[t]) {
80
- const l = r.overrides[t], o = l == null ? void 0 : l[e];
81
- if (o)
82
- return o;
78
+ const o = y(), c = o.default;
79
+ if ((i = o.overrides) != null && i[t]) {
80
+ const l = o.overrides[t], r = l == null ? void 0 : l[e];
81
+ if (r)
82
+ return r;
83
83
  }
84
84
  return c[e] || "500";
85
85
  }
86
86
  function j(t, e) {
87
87
  var c;
88
- const r = g.value[t];
89
- return ((c = n.colors[r]) == null ? void 0 : c[e]) || "";
88
+ const o = m.value[t];
89
+ return ((c = n.colors[o]) == null ? void 0 : c[e]) || "";
90
90
  }
91
- function a(t, e, r) {
91
+ function a(t, e, o) {
92
92
  const i = (b.value ? n.colorSemantic.dark : n.colorSemantic.light)[t][e];
93
- return i === "white" || i === "black" ? `var(--ui-color-${i})` : `var(--base-color-${r}-${i})`;
93
+ return i === "white" || i === "black" ? `var(--ui-color-${i})` : `var(--base-color-${o}-${i})`;
94
94
  }
95
95
  const S = (t) => {
96
96
  const e = X(t);
@@ -99,43 +99,43 @@ function de() {
99
99
  function D() {
100
100
  var i, l;
101
101
  const t = [];
102
- Object.entries(n.colors).forEach(([o, s]) => {
102
+ Object.entries(n.colors).forEach(([r, s]) => {
103
103
  typeof s == "object" && Object.entries(s).forEach(([u, d]) => {
104
104
  try {
105
- t.push(`--base-color-${o}-${u}: ${S(d)};`);
105
+ t.push(`--base-color-${r}-${u}: ${S(d)};`);
106
106
  } catch {
107
- t.push(`--base-color-${o}-${u}: ${d};`);
107
+ t.push(`--base-color-${r}-${u}: ${d};`);
108
108
  }
109
109
  });
110
110
  });
111
111
  const e = [];
112
- w.forEach((o) => {
113
- const s = g.value[o];
112
+ w.forEach((r) => {
113
+ const s = m.value[r];
114
114
  k.forEach((u) => {
115
- e.push(`--ui-color-${o}-${u}: var(--base-color-${s}-${u});`);
115
+ e.push(`--ui-color-${r}-${u}: var(--base-color-${s}-${u});`);
116
116
  }), T.forEach((u) => {
117
- const d = E(o, u);
118
- u === "default" ? e.push(`--ui-color-${o}: var(--base-color-${s}-${d});`) : e.push(`--ui-color-${o}-${u}: var(--base-color-${s}-${d});`);
117
+ const d = E(r, u);
118
+ u === "default" ? e.push(`--ui-color-${r}: var(--base-color-${s}-${d});`) : e.push(`--ui-color-${r}-${u}: var(--base-color-${s}-${d});`);
119
119
  });
120
120
  });
121
- const r = g.value.gray, c = [
121
+ const o = m.value.gray, c = [
122
122
  `--ui-color-white: ${S(((i = n.colorBase) == null ? void 0 : i.white) || "#ffffff")};`,
123
123
  `--ui-color-black: ${S(((l = n.colorBase) == null ? void 0 : l.black) || "#000000")};`,
124
- `--ui-text-dimmed: ${a("text", "dimmed", r)};`,
125
- `--ui-text-muted: ${a("text", "muted", r)};`,
126
- `--ui-text-toned: ${a("text", "toned", r)};`,
127
- `--ui-text: ${a("text", "base", r)};`,
128
- `--ui-text-highlighted: ${a("text", "highlighted", r)};`,
129
- `--ui-text-inverted: ${a("text", "inverted", r)};`,
130
- `--ui-bg: ${a("bg", "base", r)};`,
131
- `--ui-bg-muted: ${a("bg", "muted", r)};`,
132
- `--ui-bg-elevated: ${a("bg", "elevated", r)};`,
133
- `--ui-bg-accented: ${a("bg", "accented", r)};`,
134
- `--ui-bg-inverted: ${a("bg", "inverted", r)};`,
135
- `--ui-border: ${a("border", "base", r)};`,
136
- `--ui-border-muted: ${a("border", "muted", r)};`,
137
- `--ui-border-accented: ${a("border", "accented", r)};`,
138
- `--ui-border-inverted: ${a("border", "inverted", r)};`
124
+ `--ui-text-dimmed: ${a("text", "dimmed", o)};`,
125
+ `--ui-text-muted: ${a("text", "muted", o)};`,
126
+ `--ui-text-toned: ${a("text", "toned", o)};`,
127
+ `--ui-text: ${a("text", "base", o)};`,
128
+ `--ui-text-highlighted: ${a("text", "highlighted", o)};`,
129
+ `--ui-text-inverted: ${a("text", "inverted", o)};`,
130
+ `--ui-bg: ${a("bg", "base", o)};`,
131
+ `--ui-bg-muted: ${a("bg", "muted", o)};`,
132
+ `--ui-bg-elevated: ${a("bg", "elevated", o)};`,
133
+ `--ui-bg-accented: ${a("bg", "accented", o)};`,
134
+ `--ui-bg-inverted: ${a("bg", "inverted", o)};`,
135
+ `--ui-border: ${a("border", "base", o)};`,
136
+ `--ui-border-muted: ${a("border", "muted", o)};`,
137
+ `--ui-border-accented: ${a("border", "accented", o)};`,
138
+ `--ui-border-inverted: ${a("border", "inverted", o)};`
139
139
  ];
140
140
  return `:root {
141
141
  ${t.join(`
@@ -146,19 +146,19 @@ function de() {
146
146
  `)}
147
147
  }`;
148
148
  }
149
- let v = null;
149
+ let $ = null;
150
150
  function B() {
151
151
  const t = D();
152
- v || (v = document.createElement("style"), v.id = "dvha-variables", document.head.appendChild(v)), v.textContent = t;
152
+ $ || ($ = document.createElement("style"), $.id = "dvha-variables", document.head.appendChild($)), $.textContent = t;
153
153
  }
154
154
  function G() {
155
155
  f.cssInit || (f.setCssInit(), B());
156
156
  }
157
- _([g, b], () => {
157
+ _([m, b], () => {
158
158
  f.cssInit && B();
159
159
  }, { deep: !0, immediate: !1 });
160
160
  function U(t, e) {
161
- $.value.includes(e) ? f.setThemeColor(t, e) : console.warn(`Color "${e}" is not available`);
161
+ v.value.includes(e) ? f.setThemeColor(t, e) : console.warn(`Color "${e}" is not available`);
162
162
  }
163
163
  function q(t) {
164
164
  f.setThemeColors(t);
@@ -166,18 +166,18 @@ function de() {
166
166
  function A() {
167
167
  f.resetTheme();
168
168
  }
169
- function F(t, e, r = !1) {
170
- return r ? `rgb(var(--ui-color-${t}-${e}))` : j(t, e);
169
+ function F(t, e, o = !1) {
170
+ return o ? `--ui-color-${t}-${e}` : j(t, e);
171
171
  }
172
- function H(t, e, r = !1) {
173
- if (e || (e = "default"), r)
174
- return e === "default" ? `rgb(var(--ui-color-${t}))` : `rgb(var(--ui-color-${t}-${e}))`;
172
+ function H(t, e, o = !1) {
173
+ if (e || (e = "default"), o)
174
+ return e === "default" ? `--ui-color-${t})` : `--ui-color-${t}-${e})`;
175
175
  const c = E(t, e);
176
176
  return j(t, c);
177
177
  }
178
- function J(t, e, r = !1) {
179
- var o, s, u;
180
- if (r) {
178
+ function J(t, e, o = !1) {
179
+ var r, s, u;
180
+ if (o) {
181
181
  let d;
182
182
  switch (t) {
183
183
  case "text":
@@ -192,17 +192,17 @@ function de() {
192
192
  default:
193
193
  d = `--ui-${t}-${e}`;
194
194
  }
195
- return `rgb(var(${d}))`;
195
+ return `${d}`;
196
196
  }
197
- const c = g.value.gray, l = (b.value ? n.colorSemantic.dark : n.colorSemantic.light)[t][e];
198
- return l === "white" ? ((o = n.colorBase) == null ? void 0 : o.white) || "#ffffff" : l === "black" ? ((s = n.colorBase) == null ? void 0 : s.black) || "#000000" : ((u = n.colors[c]) == null ? void 0 : u[l]) || "";
197
+ const c = m.value.gray, l = (b.value ? n.colorSemantic.dark : n.colorSemantic.light)[t][e];
198
+ return l === "white" ? ((r = n.colorBase) == null ? void 0 : r.white) || "#ffffff" : l === "black" ? ((s = n.colorBase) == null ? void 0 : s.black) || "#000000" : ((u = n.colors[c]) == null ? void 0 : u[l]) || "";
199
199
  }
200
- const K = m(() => {
200
+ const K = g(() => {
201
201
  var t;
202
- return (t = $.value) == null ? void 0 : t.filter((e) => ["slate", "gray", "zinc", "neutral", "stone"].includes(e));
203
- }), P = m(() => {
202
+ return (t = v.value) == null ? void 0 : t.filter((e) => ["slate", "gray", "zinc", "neutral", "stone"].includes(e));
203
+ }), P = g(() => {
204
204
  var t;
205
- return (t = $.value) == null ? void 0 : t.filter((e) => !["slate", "gray", "zinc", "neutral", "stone"].includes(e));
205
+ return (t = v.value) == null ? void 0 : t.filter((e) => !["slate", "gray", "zinc", "neutral", "stone"].includes(e));
206
206
  });
207
207
  return {
208
208
  toggle: O,
@@ -211,8 +211,8 @@ function de() {
211
211
  isDark: b,
212
212
  resources: z,
213
213
  config: I(n),
214
- colorMapping: I(g),
215
- colors: $,
214
+ colorMapping: I(m),
215
+ colors: v,
216
216
  neutralColors: K,
217
217
  primaryColors: P,
218
218
  colorShades: k,