@done-coding/admin-core 0.12.2 → 0.12.3-alpha.0

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 (31) hide show
  1. package/es/bridge/index.mjs +28 -28
  2. package/es/bridge/plugin.mjs +4 -4
  3. package/es/components/app-layout/AppBody.vue.mjs +2 -2
  4. package/es/components/app-layout/AppBody.vue2.mjs +26 -33
  5. package/es/components/app-layout/AppLayout.vue.mjs +2 -2
  6. package/es/components/app-layout/AppLayout.vue2.mjs +53 -56
  7. package/es/components/app-layout/AppSidebar.vue.mjs +3 -3
  8. package/es/components/app-layout/AppSidebar.vue2.mjs +8 -8
  9. package/es/components/display/ActionBtn.vue.mjs +37 -36
  10. package/es/components/display/ActionConfirm.vue.mjs +1 -1
  11. package/es/components/display/ActionConfirm.vue2.mjs +50 -50
  12. package/es/components/form/FormSubmitBtn.vue.mjs +18 -13
  13. package/es/components/form/use-form-submit.mjs +8 -8
  14. package/es/components/table/constants.mjs +5 -0
  15. package/es/hooks/activated.mjs +1 -1
  16. package/es/hooks/use-theme-apply.mjs +80 -79
  17. package/es/hooks/use-viewport-apply.mjs +17 -16
  18. package/es/index.mjs +131 -128
  19. package/es/inject/key.mjs +27 -24
  20. package/es/injectInfo.json.mjs +6 -0
  21. package/es/style.css +1 -1
  22. package/package.json +2 -2
  23. package/types/components/app-layout/AppLayout.vue.d.ts +1 -1
  24. package/types/components/display/ActionConfirm.vue.d.ts +2 -0
  25. package/types/components/form/types.d.ts +1 -0
  26. package/types/components/form/use-form-submit.d.ts +1 -0
  27. package/types/components/table/constants.d.ts +2 -0
  28. package/types/components/table/index.d.ts +1 -0
  29. package/types/hooks/use-theme-apply.d.ts +2 -2
  30. package/types/hooks/use-viewport-apply.d.ts +2 -2
  31. package/types/injectInfo.json.d.ts +7 -0
@@ -1,6 +1,6 @@
1
- import { watch as s } from "vue";
2
- import { themeScaleDerive as C, themeScaleParseHex as S, themeScaleMix as $, themeScaleToRgba as _ } from "../utils/theme-scale.mjs";
3
- const m = "dc-core-theme", y = [
1
+ import { watch as m, onScopeDispose as C } from "vue";
2
+ import { themeScaleDerive as y, themeScaleParseHex as S, themeScaleMix as b, themeScaleToRgba as $ } from "../utils/theme-scale.mjs";
3
+ const L = "dc-core-theme", A = () => Math.random().toString(36).slice(2, 9), T = [
4
4
  ["primaryColor", { scale: !0, el: "--el-color-primary" }],
5
5
  ["successColor", { scale: !0, el: "--el-color-success" }],
6
6
  ["warningColor", { scale: !0, el: "--el-color-warning" }],
@@ -25,69 +25,69 @@ const m = "dc-core-theme", y = [
25
25
  "light-8",
26
26
  "light-9",
27
27
  "dark-2"
28
- ], L = (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase(), g = (r, t) => {
28
+ ], v = (o) => o.replace(/([A-Z])/g, "-$1").toLowerCase(), g = (o, t) => {
29
29
  const e = [];
30
- for (const [c, n] of y) {
31
- const o = r[c];
32
- if (o === void 0 || o === "") continue;
33
- const l = `--dc-core-${L(c)}`, a = n.el === void 0 ? [] : Array.isArray(n.el) ? n.el : [n.el];
34
- if (n.scale) {
35
- const d = C(o, t);
36
- e.push(`${l}: ${o};`);
37
- for (const i of p)
38
- e.push(`${l}-${i}: ${d[i]};`);
39
- for (const i of a) {
40
- e.push(`${i}: ${o};`);
41
- for (const u of p)
42
- e.push(`${i}-${u}: ${d[u]};`);
30
+ for (const [c, l] of T) {
31
+ const n = o[c];
32
+ if (n === void 0 || n === "") continue;
33
+ const i = `--dc-core-${v(c)}`, d = l.el === void 0 ? [] : Array.isArray(l.el) ? l.el : [l.el];
34
+ if (l.scale) {
35
+ const s = y(n, t);
36
+ e.push(`${i}: ${n};`);
37
+ for (const r of p)
38
+ e.push(`${i}-${r}: ${s[r]};`);
39
+ for (const r of d) {
40
+ e.push(`${r}: ${n};`);
41
+ for (const a of p)
42
+ e.push(`${r}-${a}: ${s[a]};`);
43
43
  }
44
44
  } else {
45
- e.push(`${l}: ${o};`);
46
- for (const d of a) e.push(`${d}: ${o};`);
45
+ e.push(`${i}: ${n};`);
46
+ for (const s of d) e.push(`${s}: ${n};`);
47
47
  }
48
48
  }
49
49
  return e.join(`
50
50
  `);
51
- }, A = 0.4, T = 10, v = {
51
+ }, D = 0.4, P = 10, k = {
52
52
  light: 0.5,
53
53
  dark: 0.72
54
- }, f = (r, t) => {
55
- if (!r) return "";
56
- const e = S(r);
54
+ }, f = (o, t) => {
55
+ if (!o) return "";
56
+ const e = S(o);
57
57
  if (!e) return "";
58
- const c = Math.max(...e), n = c === 0 ? 0 : Math.min(A, T / c), o = $(r, "#000000", n);
59
- return `--el-overlay-color-lighter: ${_(
60
- o,
61
- v[t]
58
+ const c = Math.max(...e), l = c === 0 ? 0 : Math.min(D, P / c), n = b(o, "#000000", l);
59
+ return `--el-overlay-color-lighter: ${$(
60
+ n,
61
+ k[t]
62
62
  )};`;
63
- }, I = { light: 0.9, dark: 0.8 }, h = (r, t) => {
64
- if (!r) return "";
65
- const e = _(r, I[t]);
66
- return e === r ? "" : `--el-mask-color: ${e};`;
67
- }, P = 0.88, k = (r, t) => !r || !S(r) ? "" : `--dc-core-dialog-surface: ${$(r, "#ffffff", P)};`, D = (r) => {
68
- const t = r.light, e = r.dark, c = g(t, "light"), n = g(e, "dark"), l = [
63
+ }, I = { light: 0.9, dark: 0.8 }, h = (o, t) => {
64
+ if (!o) return "";
65
+ const e = $(o, I[t]);
66
+ return e === o ? "" : `--el-mask-color: ${e};`;
67
+ }, w = 0.88, B = (o, t) => !o || !S(o) ? "" : `--dc-core-dialog-surface: ${b(o, "#ffffff", w)};`, R = (o) => {
68
+ const t = o.light, e = o.dark, c = g(t, "light"), l = g(e, "dark"), i = [
69
69
  c,
70
70
  "color: var(--dc-core-base-color);",
71
71
  f(t.bodyColor, "light"),
72
72
  h(t.bodyColor, "light")
73
- ].filter(Boolean), a = [
74
- n,
73
+ ].filter(Boolean), d = [
74
+ l,
75
75
  f(e.bodyColor, "dark"),
76
76
  h(e.bodyColor, "dark"),
77
- k(e.bodyColor)
77
+ B(e.bodyColor)
78
78
  ].filter(Boolean);
79
79
  return `:root {
80
- ${l.join(
80
+ ${i.join(
81
81
  `
82
82
  `
83
83
  )}
84
84
  }
85
85
  :root.dark {
86
- ${a.join(`
86
+ ${d.join(`
87
87
  `)}
88
88
  }
89
89
  `;
90
- }, E = "dc-core-rhythm", b = "dc-core-ep-bridge", x = "dc-core-ep-structural", B = [
90
+ }, H = "dc-core-rhythm", E = "dc-core-ep-bridge", x = "dc-core-ep-structural", M = [
91
91
  ".el-dialog,",
92
92
  ".el-message-box {",
93
93
  // elevation:暗色下用提亮过的面板底(--dc-core-dialog-surface,仅 :root.dark 派生),
@@ -96,7 +96,7 @@ const m = "dc-core-theme", y = [
96
96
  " border: 1px solid var(--dc-core-border-color, var(--el-border-color));",
97
97
  "}"
98
98
  ].join(`
99
- `), R = [
99
+ `), Y = [
100
100
  // T1 必纳:表格行密度(垂直经 td padding,水平经 .cell padding)
101
101
  ".el-table .el-table__cell {",
102
102
  " padding-top: var(--dc-core-cell-padding-y, 8px);",
@@ -113,7 +113,7 @@ const m = "dc-core-theme", y = [
113
113
  // 注:dialog/card 内距撤到期二——其 EP 原生值(dialog 16 / card 20)与单一
114
114
  // content-gap 无法同时对齐,本期纳入会破"默认档零漂移";期二用专属 var 补。
115
115
  ].join(`
116
- `), w = {
116
+ `), z = {
117
117
  compact: {
118
118
  spaceUnit: "4px",
119
119
  gap: "8px",
@@ -146,7 +146,7 @@ const m = "dc-core-theme", y = [
146
146
  fontSizeBase: "15px",
147
147
  fontScale: "1.25"
148
148
  }
149
- }, H = {
149
+ }, U = {
150
150
  snappy: {
151
151
  duration: "120ms",
152
152
  durationSlow: "180ms",
@@ -165,8 +165,8 @@ const m = "dc-core-theme", y = [
165
165
  easing: "cubic-bezier(0.22, 0.61, 0.36, 1)"
166
166
  }
167
167
  };
168
- function Y(r, t) {
169
- const e = w[r], c = H[t], n = [
168
+ function O(o, t) {
169
+ const e = z[o], c = U[t], l = [
170
170
  `--dc-core-space-unit: ${e.spaceUnit};`,
171
171
  `--dc-core-content-gap: ${e.gap};`,
172
172
  `--dc-core-control-height: ${e.controlHeight};`,
@@ -184,19 +184,19 @@ function Y(r, t) {
184
184
  // easing 仅挂 dc-core,[MUST NOT] dual-write 覆盖 EP 两条 bezier——
185
185
  // EP ease-in-out / fast 曲线各异,覆盖会让默认档动画曲线漂移;motion 档对 EP 只经 duration 生效。
186
186
  `--dc-core-motion-easing: ${c.easing};`
187
- ], o = [
187
+ ], n = [
188
188
  "--dc-core-motion-duration: 0.01ms;",
189
189
  "--dc-core-motion-duration-slow: 0.01ms;",
190
190
  "--el-transition-duration: 0.01ms;",
191
191
  "--el-transition-duration-fast: 0.01ms;"
192
192
  ];
193
193
  return `:root {
194
- ${n.join(`
194
+ ${l.join(`
195
195
  `)}
196
196
  }
197
197
  @media (prefers-reduced-motion: reduce) {
198
198
  :root {
199
- ${o.join(
199
+ ${n.join(
200
200
  `
201
201
  `
202
202
  )}
@@ -204,52 +204,53 @@ function Y(r, t) {
204
204
  }
205
205
  `;
206
206
  }
207
- function U(r) {
208
- const t = r.document ?? (typeof document < "u" ? document : void 0);
207
+ function V(o) {
208
+ const t = o.document ?? (typeof document < "u" ? document : void 0);
209
209
  if (!t) return;
210
- const e = () => {
211
- let o = t.getElementById(m);
212
- return o || (o = t.createElement("style"), o.id = m, t.head.appendChild(o)), o;
210
+ const e = A(), c = [], l = (r) => {
211
+ const a = t.createElement("style");
212
+ return a.id = `${r}-${e}`, t.head.appendChild(a), c.push(a), a;
213
213
  };
214
+ let n = null;
215
+ const i = () => (n || (n = l(L)), n);
214
216
  if (!t.getElementById(x)) {
215
- const o = t.createElement("style");
216
- o.id = x, o.textContent = B, t.head.appendChild(o);
217
+ const r = t.createElement("style");
218
+ r.id = x, r.textContent = M, t.head.appendChild(r);
217
219
  }
218
- s(
219
- r.getThemeConfig,
220
- (o) => {
221
- e().textContent = D(o);
220
+ m(
221
+ o.getThemeConfig,
222
+ (r) => {
223
+ i().textContent = R(r);
222
224
  },
223
225
  { deep: !0, immediate: !0 }
224
- ), s(
225
- r.getThemeIsDark,
226
- (o) => {
227
- t.documentElement.classList.toggle("dark", o);
226
+ ), m(
227
+ o.getThemeIsDark,
228
+ (r) => {
229
+ t.documentElement.classList.toggle("dark", r);
228
230
  },
229
231
  { immediate: !0 }
230
232
  );
231
- const { getThemeDensity: c, getThemeMotion: n } = r;
232
- if (c && n) {
233
- if (!t.getElementById(b)) {
234
- const l = t.createElement("style");
235
- l.id = b, l.textContent = R, t.head.appendChild(l);
233
+ const { getThemeDensity: d, getThemeMotion: s } = o;
234
+ if (d && s) {
235
+ if (!t.getElementById(E)) {
236
+ const u = t.createElement("style");
237
+ u.id = E, u.textContent = Y, t.head.appendChild(u);
236
238
  }
237
- const o = () => {
238
- let l = t.getElementById(
239
- E
240
- );
241
- return l || (l = t.createElement("style"), l.id = E, t.head.appendChild(l)), l;
242
- };
243
- s(
244
- () => [c(), n()],
245
- ([l, a]) => {
246
- o().textContent = Y(l, a);
239
+ let r = null;
240
+ const a = () => (r || (r = l(H)), r);
241
+ m(
242
+ () => [d(), s()],
243
+ ([u, _]) => {
244
+ a().textContent = O(u, _);
247
245
  },
248
246
  { immediate: !0 }
249
247
  );
250
248
  }
249
+ C(() => {
250
+ c.forEach((r) => r.remove()), c.length = 0;
251
+ });
251
252
  }
252
253
  export {
253
- Y as buildRhythmCss,
254
- U as useThemeApply
254
+ O as buildRhythmCss,
255
+ V as useCoreThemeApply
255
256
  };
@@ -1,8 +1,8 @@
1
- import { watch as i } from "vue";
2
- const r = "dc-core-viewport", c = (e, d) => {
3
- const p = e.paddingLeft + e.paddingRight, t = e.paddingTop + e.paddingBottom;
1
+ import { watch as c, onScopeDispose as n } from "vue";
2
+ const a = "dc-core-viewport", l = () => Math.random().toString(36).slice(2, 9), u = (e, d) => {
3
+ const r = e.paddingLeft + e.paddingRight, t = e.paddingTop + e.paddingBottom;
4
4
  return `:root {
5
- --dc-core-viewport-width: calc(100vw - ${p}px);
5
+ --dc-core-viewport-width: calc(100vw - ${r}px);
6
6
  --dc-core-viewport-height: calc(100vh - ${t}px);
7
7
  --dc-core-viewport-padding-top: ${e.paddingTop}px;
8
8
  --dc-core-viewport-padding-right: ${e.paddingRight}px;
@@ -13,27 +13,28 @@ const r = "dc-core-viewport", c = (e, d) => {
13
13
  ` : "") + `}
14
14
  `;
15
15
  };
16
- function a(e) {
16
+ function m(e) {
17
17
  const d = e.document ?? (typeof document < "u" ? document : void 0);
18
18
  if (!d) return;
19
- const p = () => {
20
- let t = d.getElementById(r);
21
- return t || (t = d.createElement("style"), t.id = r, d.head.appendChild(t)), t;
22
- };
23
- i(
19
+ const r = `${a}-${l()}`;
20
+ let t = null;
21
+ const p = () => (t || (t = d.createElement("style"), t.id = r, d.head.appendChild(t)), t);
22
+ c(
24
23
  () => {
25
- var t;
24
+ var o;
26
25
  return {
27
26
  viewport: e.getViewportConfig(),
28
- gap: (t = e.getGapConfig) == null ? void 0 : t.call(e)
27
+ gap: (o = e.getGapConfig) == null ? void 0 : o.call(e)
29
28
  };
30
29
  },
31
- ({ viewport: t, gap: o }) => {
32
- p().textContent = c(t, o);
30
+ ({ viewport: o, gap: i }) => {
31
+ p().textContent = u(o, i);
33
32
  },
34
33
  { deep: !0, immediate: !0 }
35
- );
34
+ ), n(() => {
35
+ t == null || t.remove(), t = null;
36
+ });
36
37
  }
37
38
  export {
38
- a as useViewportApply
39
+ m as useCoreViewportApply
39
40
  };