savor-ui 0.1.0 → 0.3.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 (84) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/es/components/index.d.ts +1 -0
  3. package/dist/es/components/index.mjs +5 -3
  4. package/dist/es/components/src/anchor/anchor.vue_vue_type_script_setup_true_vapor_true_lang.mjs +46 -35
  5. package/dist/es/components/src/avatar/types.d.ts +1 -1
  6. package/dist/es/components/src/button/button.vue_vue_type_script_setup_true_vapor_true_lang.mjs +29 -32
  7. package/dist/es/components/src/color-picker/color-picker.vue_vue_type_script_setup_true_vapor_true_lang.mjs +91 -94
  8. package/dist/es/components/src/config-provider/config-provider.d.ts +9 -17
  9. package/dist/es/components/src/config-provider/config-provider.vue.mjs +1 -1
  10. package/dist/es/components/src/config-provider/config-provider.vue_vue_type_script_setup_true_lang.mjs +24 -0
  11. package/dist/es/components/src/config-provider/index.d.ts +17 -20
  12. package/dist/es/components/src/config-provider-vapor/config-provider-vapor.d.ts +20 -0
  13. package/dist/es/components/src/config-provider-vapor/config-provider-vapor.vue.mjs +5 -0
  14. package/dist/es/components/src/{config-provider/config-provider.vue_vue_type_script_setup_true_vapor_true_lang.mjs → config-provider-vapor/config-provider-vapor.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +4 -4
  15. package/dist/es/components/src/config-provider-vapor/index.d.ts +21 -0
  16. package/dist/es/components/src/config-provider-vapor/index.mjs +8 -0
  17. package/dist/es/components/src/config-provider-vapor/types.d.ts +17 -0
  18. package/dist/es/components/src/config-provider-vapor/types.mjs +4 -0
  19. package/dist/es/components/src/drawer/drawer.vue_vue_type_script_setup_true_vapor_true_lang.mjs +4 -4
  20. package/dist/es/components/src/dropdown/doption.vue_vue_type_script_setup_true_vapor_true_lang.mjs +20 -23
  21. package/dist/es/components/src/dropdown/dsubmenu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +27 -30
  22. package/dist/es/components/src/image/image-group.d.ts +1 -3
  23. package/dist/es/components/src/image/image-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +64 -70
  24. package/dist/es/components/src/image/index.d.ts +2 -6
  25. package/dist/es/components/src/layout/index.d.ts +1 -0
  26. package/dist/es/components/src/layout/layout.vue_vue_type_script_setup_true_vapor_true_lang.mjs +11 -5
  27. package/dist/es/components/src/layout/types.d.ts +2 -0
  28. package/dist/es/components/src/link/index.d.ts +1 -1
  29. package/dist/es/components/src/link/types.d.ts +1 -1
  30. package/dist/es/components/src/message/message-container.d.ts +1 -1
  31. package/dist/es/components/src/message/message-container.vue_vue_type_script_setup_true_vapor_true_lang.mjs +24 -22
  32. package/dist/es/components/src/message/message.vue_vue_type_script_setup_true_vapor_true_lang.mjs +1 -2
  33. package/dist/es/components/src/message/method.mjs +33 -28
  34. package/dist/es/components/src/message/types.d.ts +2 -6
  35. package/dist/es/components/src/radio/index.d.ts +4 -2
  36. package/dist/es/components/src/radio/radio-group.d.ts +2 -1
  37. package/dist/es/components/src/radio/radio-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +23 -15
  38. package/dist/es/components/src/radio/radio.vue_vue_type_script_setup_true_vapor_true_lang.mjs +14 -9
  39. package/dist/es/components/src/radio/types.d.ts +6 -1
  40. package/dist/es/components/src/scrollbar/index.d.ts +3 -0
  41. package/dist/es/components/src/scrollbar/scrollbar.vue_vue_type_script_setup_true_vapor_true_lang.mjs +35 -29
  42. package/dist/es/components/src/scrollbar/types.d.ts +7 -0
  43. package/dist/es/components/src/select/index.d.ts +6 -5
  44. package/dist/es/components/src/select/select.d.ts +5 -5
  45. package/dist/es/components/src/select/select.vue_vue_type_script_setup_true_vapor_true_lang.mjs +189 -125
  46. package/dist/es/components/src/select/types.d.ts +6 -4
  47. package/dist/es/components/src/space/index.d.ts +1 -0
  48. package/dist/es/components/src/space/space.vue_vue_type_script_setup_true_vapor_true_lang.mjs +3 -1
  49. package/dist/es/components/src/space/types.d.ts +2 -0
  50. package/dist/es/components/src/table/table.vue_vue_type_script_setup_true_vapor_true_lang.mjs +10 -12
  51. package/dist/es/components/src/table/types.d.ts +2 -2
  52. package/dist/es/components/src/text/index.d.ts +7 -2
  53. package/dist/es/components/src/text/text.d.ts +6 -2
  54. package/dist/es/components/src/text/text.vue_vue_type_script_setup_true_vapor_true_lang.mjs +137 -29
  55. package/dist/es/components/src/text/types.d.ts +6 -0
  56. package/dist/es/core/components.mjs +66 -64
  57. package/dist/es/core/global.d.ts +1 -0
  58. package/dist/es/core/index.mjs +61 -59
  59. package/dist/es/hooks/index.d.ts +0 -1
  60. package/dist/es/hooks/index.mjs +0 -1
  61. package/dist/es/icons/src/copy.vue.mjs +9 -3
  62. package/dist/es/theme/components/button.scss +22 -3
  63. package/dist/es/theme/components/cascader.scss +3 -0
  64. package/dist/es/theme/components/collapse.scss +16 -17
  65. package/dist/es/theme/components/color-picker.scss +4 -1
  66. package/dist/es/theme/components/dropdown.scss +34 -24
  67. package/dist/es/theme/components/image.scss +9 -33
  68. package/dist/es/theme/components/layout.scss +0 -1
  69. package/dist/es/theme/components/pagination.scss +5 -0
  70. package/dist/es/theme/components/radio.scss +44 -1
  71. package/dist/es/theme/components/segmented.scss +1 -1
  72. package/dist/es/theme/components/select.scss +92 -1
  73. package/dist/es/theme/components/space.scss +4 -0
  74. package/dist/es/theme/components/tabs.scss +3 -3
  75. package/dist/es/theme/components/text.scss +37 -0
  76. package/dist/es/theme/components/wheel.scss +12 -9
  77. package/dist/es/theme/mixins/function.scss +9 -4
  78. package/dist/es/utils/src/theme/themeMap.mjs +4 -4
  79. package/dist/json/vetur-attributes.json +46 -8
  80. package/dist/json/vetur-tags.json +22 -8
  81. package/dist/json/web-types.json +110 -14
  82. package/package.json +1 -1
  83. package/dist/es/hooks/src/use-ripple.d.ts +0 -15
  84. package/dist/es/hooks/src/use-ripple.mjs +0 -86
package/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
 
4
4
 
5
+ # [0.3.0](https://gitee.com/mach552/savor-ui/compare/v0.2.0...v0.3.0) (2026-06-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **anchor:** 修复激活状态失效问题 ([b9033d6](https://gitee.com/mach552/savor-ui/commits/b9033d6f851785006999cde93465c9411a107a79))
11
+ * **anchor:** 修复路由报历史警告问题 ([195493b](https://gitee.com/mach552/savor-ui/commits/195493b8859b2c0e114a30bc9f987471f3ad911a))
12
+ * **collapse:** 修复禁用样式无效问题 ([0d45085](https://gitee.com/mach552/savor-ui/commits/0d450857cd03fca4b4d255e817eb2f03c71a85d7))
13
+ * **pagination:** 修复页码处于边界时翻页按钮的禁用状态失效问题 ([a184a2f](https://gitee.com/mach552/savor-ui/commits/a184a2f22d2dec82909a9eb7a5b1d1c7944c88b3))
14
+ * **table:** 修复列宽自适应失效问题 ([d334c8f](https://gitee.com/mach552/savor-ui/commits/d334c8f6d3c5623117783121516f459ed17f5ece))
15
+
16
+
17
+ ### Features
18
+
19
+ * **config-provider:** 新增`config-provider-vapor`组件 ([72be61f](https://gitee.com/mach552/savor-ui/commits/72be61fab0a8713c93886d8610548a01e92e3ee7))
20
+ * **layout:** 新增`bgColor`背景颜色属性 ([3a11757](https://gitee.com/mach552/savor-ui/commits/3a11757f1eb472e84d00e6cf3ff7f775e2bff49d))
21
+ * **scrollbar:** 新增`backtop`返回顶部属性和插槽 ([37ce9aa](https://gitee.com/mach552/savor-ui/commits/37ce9aa92a9b6d756ce5085fda0fd2552191a9c6))
22
+ * **select:** 新增多选模式 ([325a62c](https://gitee.com/mach552/savor-ui/commits/325a62c3e0a54e9fdbba00fbf0177ecdfc00f6a5))
23
+ * **space:** 新增`wrap`换行属性 ([b046416](https://gitee.com/mach552/savor-ui/commits/b0464167d9db73ede45f1fa59e26b723107d1620))
24
+
25
+ # [0.2.0](https://gitee.com/mach552/savor-ui/compare/v0.1.0...v0.2.0) (2026-05-22)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **image:** 修复图片组预览图片不展示的问题 ([d485580](https://gitee.com/mach552/savor-ui/commits/d485580c89acd0483cd71cb885175a294b3db1d3))
31
+ * **message:** 修复容器不销毁的问题 ([6c34e24](https://gitee.com/mach552/savor-ui/commits/6c34e24fcc1b0aadab4c49c385470cb79f88d1b5))
32
+
33
+
34
+ ### Features
35
+
36
+ * **radio:** 新增按钮类型的单选框组 ([4b7e12a](https://gitee.com/mach552/savor-ui/commits/4b7e12aef25fc0504e3bdb8d52a85d899acefd00))
37
+ * **text:** 新增复制和编辑模式,新增气泡提示 ([39125c3](https://gitee.com/mach552/savor-ui/commits/39125c3877a14d9bcd9deda7736f7b2583e479b1))
38
+
5
39
  # 0.1.0 (2026-05-16)
6
40
 
7
41
 
@@ -11,6 +11,7 @@ export * from './src/checkbox';
11
11
  export * from './src/collapse';
12
12
  export * from './src/color-picker';
13
13
  export * from './src/config-provider';
14
+ export * from './src/config-provider-vapor';
14
15
  export * from './src/date-picker';
15
16
  export * from './src/datetime-picker';
16
17
  export * from './src/descriptions';
@@ -7,11 +7,11 @@ import "./src/popover/index.mjs";
7
7
  import "./src/tooltip/index.mjs";
8
8
  import "./src/form/index.mjs";
9
9
  import "./src/input/index.mjs";
10
+ import "./src/button/types.mjs";
11
+ import "./src/back-top/index.mjs";
10
12
  import "./src/scrollbar/index.mjs";
11
13
  import "./src/auto-complete/index.mjs";
12
14
  import "./src/avatar/index.mjs";
13
- import "./src/button/types.mjs";
14
- import "./src/back-top/index.mjs";
15
15
  import "./src/badge/index.mjs";
16
16
  import "./src/button/index.mjs";
17
17
  import "./src/card/index.mjs";
@@ -23,8 +23,11 @@ import "./src/collapse/types.mjs";
23
23
  import "./src/collapse/index.mjs";
24
24
  import "./src/empty/index.mjs";
25
25
  import "./src/icon/index.mjs";
26
+ import "./src/tag/index.mjs";
26
27
  import "./src/select/index.mjs";
27
28
  import "./src/color-picker/index.mjs";
29
+ import "./src/config-provider-vapor/types.mjs";
30
+ import "./src/config-provider-vapor/index.mjs";
28
31
  import "./src/date-picker/index.mjs";
29
32
  import "./src/datetime-picker/index.mjs";
30
33
  import "./src/descriptions/types.mjs";
@@ -65,7 +68,6 @@ import "./src/switch/index.mjs";
65
68
  import "./src/table/index.mjs";
66
69
  import "./src/tabs/types.mjs";
67
70
  import "./src/tabs/index.mjs";
68
- import "./src/tag/index.mjs";
69
71
  import "./src/text/index.mjs";
70
72
  import "./src/textarea/index.mjs";
71
73
  import "./src/timeline/types.mjs";
@@ -38,39 +38,45 @@ var x = _("<div><div><span></div><div>", !0), S = /* @__PURE__ */ o({
38
38
  e && !E.value.includes(e) && E.value.push(e);
39
39
  }, I = (e) => {
40
40
  E.value = E.value.filter((t) => t !== e);
41
- }, L = (e) => {
42
- R(e), O.value && window.history.replaceState(null, "", e), T.value = e, C("change", e);
43
- }, R = (e) => {
41
+ }, L = !1, R = null, z = (e) => {
42
+ L = !0, R && clearTimeout(R), H(e), O.value && window.history.replaceState({ ...window.history.state }, "", e), T.value = e, C("change", e), R = setTimeout(() => {
43
+ L = !1, G();
44
+ }, 3e3);
45
+ }, B = null, V = null, H = (e) => {
44
46
  let t = e.replace(/^#/, ""), n = document.getElementById(t);
45
47
  if (!n) return;
46
48
  let r = M || document.documentElement, i = r === document.documentElement ? { top: 0 } : r.getBoundingClientRect(), a = n.getBoundingClientRect().top - i.top, o = (r === document.documentElement ? window.scrollY : r.scrollTop) + a - S.offsetTop, s = k.value ? "smooth" : "instant";
47
- V.value = !0, r === document.documentElement ? window.scrollTo({
49
+ B = o, V && clearTimeout(V), r === document.documentElement ? window.scrollTo({
48
50
  top: o,
49
51
  behavior: s
50
52
  }) : r.scrollTo({
51
53
  top: o,
52
54
  behavior: s
53
- });
54
- let c = () => {
55
- j.value.removeEventListener("scrollend", c), H && clearTimeout(H), V.value = !1, z();
56
- };
57
- j.value.addEventListener("scrollend", c, { once: !0 }), H = setTimeout(() => {
58
- j.value.removeEventListener("scrollend", c), V.value = !1, z();
59
- }, 800);
60
- }, z = () => {
61
- if (V.value) return;
62
- let e = M || document.documentElement, t = e === document.documentElement ? window.scrollY : e.scrollTop, n = "";
63
- for (let r = E.value.length - 1; r >= 0; r--) {
64
- let i = E.value[r], a = i.replace(/^#/, ""), o = document.getElementById(a);
65
- if (!o) continue;
66
- let s = e === document.documentElement ? { top: 0 } : e.getBoundingClientRect();
67
- if (t >= o.getBoundingClientRect().top - s.top + t - S.offsetTop - 5) {
68
- n = i;
55
+ }), V = setTimeout(() => {
56
+ B = null;
57
+ }, 5e3);
58
+ }, U = null, W = () => {
59
+ if (B !== null) {
60
+ let e = M === document.documentElement ? window.scrollY : M.scrollTop;
61
+ if (Math.abs(e - B) <= 5) B = null, V &&= (clearTimeout(V), null);
62
+ else return;
63
+ }
64
+ L || (U && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
65
+ U = null, G();
66
+ }));
67
+ }, G = () => {
68
+ let e = "";
69
+ for (let t = E.value.length - 1; t >= 0; t--) {
70
+ let n = E.value[t], r = n.replace(/^#/, ""), i = document.getElementById(r);
71
+ if (!i) continue;
72
+ let a = i.getBoundingClientRect();
73
+ if (a.top <= S.offsetTop + 5 && a.top > -(S.offsetTop + 5)) {
74
+ e = n;
69
75
  break;
70
76
  }
71
77
  }
72
- n && n !== T.value ? (T.value = n, O.value && window.history.replaceState(null, "", n), C("change", n)) : n || (T.value = "");
73
- }, B = () => {
78
+ e && e !== T.value && (T.value = e, C("change", e));
79
+ }, K = () => {
74
80
  c(() => {
75
81
  let e = document.querySelector(`.${w.b()}`);
76
82
  if (!e) return;
@@ -80,11 +86,16 @@ var x = _("<div><div><span></div><div>", !0), S = /* @__PURE__ */ o({
80
86
  D.value = r.top - n.top + r.height / 2;
81
87
  }
82
88
  });
83
- }, V = f(!1), H = null;
89
+ };
84
90
  b(T, () => {
85
- B();
91
+ K();
86
92
  }), b(E, () => {
87
- z();
93
+ let e = window.location.hash;
94
+ c(e ? () => {
95
+ T.value = e, H(e);
96
+ } : () => {
97
+ T.value = "", G();
98
+ });
88
99
  }, { deep: !0 }), d(t, {
89
100
  activeHash: T,
90
101
  changeHash: O,
@@ -92,24 +103,24 @@ var x = _("<div><div><span></div><div>", !0), S = /* @__PURE__ */ o({
92
103
  offsetTop: A,
93
104
  registerLink: F,
94
105
  unregisterLink: I,
95
- handleLinkClick: L,
106
+ handleLinkClick: z,
96
107
  scrollContainer: j
97
108
  }), l(() => {
98
109
  P();
99
110
  let e = window.location.hash;
100
- e && c(() => {
101
- T.value = e, R(e);
102
- }), j.value.addEventListener("scroll", z);
111
+ c(e ? () => {
112
+ T.value = e, H(e);
113
+ } : G), j.value.addEventListener("scroll", W);
103
114
  }), u(() => {
104
- j.value.removeEventListener("scroll", z);
115
+ j.value.removeEventListener("scroll", W), V && clearTimeout(V), U && cancelAnimationFrame(U), R && clearTimeout(R);
105
116
  }), b(() => S.scrollContainer, () => {
106
- j.value.removeEventListener("scroll", z), P(), j.value.addEventListener("scroll", z);
117
+ j.value.removeEventListener("scroll", W), P(), j.value.addEventListener("scroll", W);
107
118
  });
108
- let U = x(), W = r(U), G = r(W), K = s(W, 1);
109
- return n(G, () => T.value), p(() => {
119
+ let q = x(), J = r(q), Y = r(J), X = s(J, 1);
120
+ return n(Y, () => T.value), p(() => {
110
121
  let e = y(w);
111
- m(U, [e.b(), { [e.m("line-less")]: o.lineLess }]), m(W, e.e("ink")), m(G, [e.e("ink-ball")]), g(G, N.value), m(K, e.e("list"));
112
- }), h(K, null, 0), a("default", null), U;
122
+ m(q, [e.b(), { [e.m("line-less")]: o.lineLess }]), m(J, e.e("ink")), m(Y, [e.e("ink-ball")]), g(Y, N.value), m(X, e.e("list"));
123
+ }), h(X, null, 0), a("default", null), q;
113
124
  }
114
125
  });
115
126
  //#endregion
@@ -1,6 +1,6 @@
1
1
  export interface AvatarProps {
2
2
  /** 头像大小
3
- * @default '40px'
3
+ * @default 40px
4
4
  */
5
5
  size?: number | string;
6
6
  /** 是否圆形 */
@@ -1,12 +1,11 @@
1
1
  import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
2
- import { useRipple as t } from "../../../hooks/src/use-ripple.mjs";
3
2
  import "../../../hooks/index.mjs";
4
- import n from "../../../icons/src/loading.vue.mjs";
3
+ import t from "../../../icons/src/loading.vue.mjs";
5
4
  import "../../../icons/index.mjs";
6
- import { buttonGroupContextKey as r } from "./types.mjs";
7
- import { computed as i, createComponent as a, createDynamicComponent as o, createIf as s, createSlot as c, createTemplateRefSetter as l, defineVaporComponent as u, inject as d, renderEffect as f, setAttr as p, setClass as m, setInsertionState as h, setProp as g, setText as _, template as v, toDisplayString as y, unref as b, useTemplateRef as x } from "vue";
5
+ import { buttonGroupContextKey as n } from "./types.mjs";
6
+ import { computed as r, createComponent as i, createDynamicComponent as a, createIf as o, createSlot as s, defineVaporComponent as c, inject as l, renderEffect as u, setAttr as d, setClass as f, setInsertionState as p, setProp as m, setText as h, template as g, toDisplayString as _, unref as v } from "vue";
8
7
  //#region ../components/src/button/button.vue?vue&type=script&setup=true&vapor=true&lang.ts
9
- var S = v("<div>"), C = v(" "), w = v("<button>", !0), T = /* @__PURE__ */ u({
8
+ var y = g("<div>"), b = g(" "), x = g("<button>", !0), S = /* @__PURE__ */ c({
10
9
  name: "SButton",
11
10
  __name: "button",
12
11
  props: {
@@ -24,36 +23,34 @@ var S = v("<div>"), C = v(" "), w = v("<button>", !0), T = /* @__PURE__ */ u({
24
23
  secondary: { type: Boolean }
25
24
  },
26
25
  __multiRoot: !1,
27
- setup(u, { slots: v }) {
28
- let T = u, E = e("button"), D = x("btnRef");
29
- t(D);
30
- let O = d(r, void 0), k = i(() => O?.size?.value || T.size), A = l(), j = w();
31
- return f(() => {
32
- let e = b(E), t = u.disabled, n = u.loading;
33
- m(j, [
26
+ setup(c, { slots: g }) {
27
+ let S = c, C = e("button"), w = l(n, void 0), T = r(() => w?.size?.value || S.size), E = x();
28
+ return u(() => {
29
+ let e = v(C), t = c.disabled, n = c.loading;
30
+ f(E, [
34
31
  e.b(),
35
- e.m(u.type),
36
- e.m(k.value),
37
- e.is("circle", u.circle),
38
- e.is("block", u.block),
39
- e.is("text", u.text),
40
- e.is("secondary", u.secondary),
41
- e.is("link", u.link),
32
+ e.m(c.type),
33
+ e.m(T.value),
34
+ e.is("circle", c.circle),
35
+ e.is("block", c.block),
36
+ e.is("text", c.text),
37
+ e.is("secondary", c.secondary),
38
+ e.is("link", c.link),
42
39
  e.is("disabled", t),
43
40
  e.is("loading", n),
44
- e.is("only-icon", !v.default && !u.label)
45
- ]), g(j, "disabled", t || n), p(j, "html-type", u.htmlType);
46
- }), h(j, null, 0), s(() => (v.icon || u.icon) && !u.loading, () => {
47
- let e = S();
48
- return f(() => m(e, [b(E).e("icon")])), h(e, null, 0), c("icon", null, () => o(() => u.icon)), e;
49
- }, () => s(() => u.loading, () => {
50
- let e = S();
51
- return f(() => m(e, [b(E).e("icon")])), h(e, null, 0), a(b(n)), e;
52
- }, null, 1), 5, null, 0), h(j, null, 1), c("default", null, () => {
53
- let e = C();
54
- return f(() => _(e, y(u.label))), e;
55
- }), A(j, D, null, "btnRef"), j;
41
+ e.is("only-icon", !g.default && !c.label)
42
+ ]), m(E, "disabled", t || n), d(E, "html-type", c.htmlType);
43
+ }), p(E, null, 0), o(() => (g.icon || c.icon) && !c.loading, () => {
44
+ let e = y();
45
+ return u(() => f(e, [v(C).e("icon")])), p(e, null, 0), s("icon", null, () => a(() => c.icon)), e;
46
+ }, () => o(() => c.loading, () => {
47
+ let e = y();
48
+ return u(() => f(e, [v(C).e("icon")])), p(e, null, 0), i(v(t)), e;
49
+ }, null, 1), 5, null, 0), p(E, null, 1), s("default", null, () => {
50
+ let e = b();
51
+ return u(() => h(e, _(c.label))), e;
52
+ }), E;
56
53
  }
57
54
  });
58
55
  //#endregion
59
- export { T as default };
56
+ export { S as default };
@@ -1,18 +1,17 @@
1
1
  import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
2
- import { useRipple as t } from "../../../hooks/src/use-ripple.mjs";
3
2
  import "../../../hooks/index.mjs";
4
- import { useFormItem as n } from "../form/use-form-item.mjs";
5
- import { SPopover as r } from "../popover/index.mjs";
6
- import { SInput as i } from "../input/index.mjs";
7
- import { SSelect as a } from "../select/index.mjs";
8
- import { child as o, computed as s, createComponent as c, createFor as l, createIf as u, createInvoker as d, createTemplateRefSetter as f, defineVaporComponent as p, delegateEvents as m, mergeModels as h, next as g, onMounted as _, onUnmounted as v, ref as y, renderEffect as b, setClass as x, setInsertionState as S, setStyle as C, setText as w, template as T, toDisplayString as E, toRefs as ee, txt as te, unref as D, useModel as ne, useTemplateRef as O, watch as k, withModifiers as re, withVaporCtx as ie } from "vue";
3
+ import { useFormItem as t } from "../form/use-form-item.mjs";
4
+ import { SPopover as n } from "../popover/index.mjs";
5
+ import { SInput as r } from "../input/index.mjs";
6
+ import { SSelect as i } from "../select/index.mjs";
7
+ import { child as a, computed as o, createComponent as s, createFor as c, createIf as l, createInvoker as u, createTemplateRefSetter as d, defineVaporComponent as f, delegateEvents as p, mergeModels as m, next as h, onMounted as g, onUnmounted as _, ref as v, renderEffect as y, setClass as b, setInsertionState as x, setStyle as S, setText as C, template as w, toDisplayString as T, toRefs as E, txt as ee, unref as D, useModel as te, useTemplateRef as ne, watch as O, withModifiers as re, withVaporCtx as ie } from "vue";
9
8
  //#region ../components/src/color-picker/color-picker.vue?vue&type=script&setup=true&vapor=true&lang.ts
10
- var ae = T("<div> "), oe = T("<div><div></div></div>"), se = T("<div><div><div></div></div><div></div>"), ce = T("<div>"), le = T("<div><div>预设颜色</div><div>"), ue = T("<div><div><div><div></div><div></div></div><div><div><div><div><div></div></div><div></div></div></div><div><div></div></div></div><div></div>"), de = T("<div>", !0);
11
- m("mousedown", "click");
12
- var A = /* @__PURE__ */ p({
9
+ var k = w("<div> "), A = w("<div><div></div></div>"), ae = w("<div><div><div></div></div><div></div>"), oe = w("<div>"), se = w("<div><div>预设颜色</div><div>"), ce = w("<div><div><div><div></div><div></div></div><div><div><div><div><div></div></div><div></div></div></div><div><div></div></div></div><div></div>"), le = w("<div>", !0);
10
+ p("mousedown", "click");
11
+ var j = /* @__PURE__ */ f({
13
12
  name: "SColorPicker",
14
13
  __name: "color-picker",
15
- props: /* @__PURE__ */ h({
14
+ props: /* @__PURE__ */ m({
16
15
  modelValue: {},
17
16
  format: { default: "hex" },
18
17
  popoverProps: {},
@@ -27,26 +26,24 @@ var A = /* @__PURE__ */ p({
27
26
  modelValue: { default: "#3867D6" },
28
27
  modelModifiers: {}
29
28
  }),
30
- emits: /* @__PURE__ */ h(["change"], ["update:modelValue"]),
29
+ emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
31
30
  __multiRoot: !1,
32
- setup(p, { emit: m }) {
33
- let h = p, T = m, A = e("color-picker"), j = ne(p, "modelValue"), { size: fe, error: pe } = ee(h), { mergedSize: me, mergedError: he } = n({
34
- size: fe,
35
- error: pe
36
- }), M = O("triggerRef");
37
- t(M);
38
- let N = O("popoverRef"), P = y(!1), F = (e) => {
31
+ setup(f, { emit: p }) {
32
+ let m = f, w = p, j = e("color-picker"), M = te(f, "modelValue"), { size: ue, error: de } = E(m), { mergedSize: fe, mergedError: pe } = t({
33
+ size: ue,
34
+ error: de
35
+ }), N = ne("popoverRef"), P = v(!1), F = (e) => {
39
36
  e ? N.value?.show() : N.value?.hide(), P.value = e;
40
- }, ge = () => {
41
- h.disabled || (P.value ? F(!1) : F(!0));
42
- }, _e = () => {
37
+ }, me = () => {
38
+ m.disabled || (P.value ? F(!1) : F(!0));
39
+ }, he = () => {
43
40
  F(!1);
44
- }, I = y(h.format), L = y({
41
+ }, I = v(m.format), L = v({
45
42
  h: 220,
46
43
  s: .77,
47
44
  v: .84,
48
45
  a: 1
49
- }), R = y(), z = y(), B = y(), V = y(!1), H = y(null), ve = s(() => h.presetColors && h.presetColors.length > 0 ? h.presetColors : [
46
+ }), R = v(), z = v(), B = v(), V = v(!1), H = v(null), ge = o(() => m.presetColors && m.presetColors.length > 0 ? m.presetColors : [
50
47
  "#3867D6",
51
48
  "#20BF6B",
52
49
  "#FA8231",
@@ -57,7 +54,7 @@ var A = /* @__PURE__ */ p({
57
54
  "#F5319D",
58
55
  "#D91AD9",
59
56
  "#722ED1"
60
- ]), ye = (e, t, n) => {
57
+ ]), _e = (e, t, n) => {
61
58
  let r = 0, i = 0, a = 0, o = Math.floor(e / 60), s = e / 60 - o, c = n * (1 - t), l = n * (1 - s * t), u = n * (1 - (1 - s) * t);
62
59
  switch (o % 6) {
63
60
  case 0:
@@ -84,11 +81,11 @@ var A = /* @__PURE__ */ p({
84
81
  g: Math.round(i * 255),
85
82
  b: Math.round(a * 255)
86
83
  };
87
- }, be = (e, t, n) => `#${[
84
+ }, ve = (e, t, n) => `#${[
88
85
  e,
89
86
  t,
90
87
  n
91
- ].map((e) => e.toString(16).padStart(2, "0")).join("").toUpperCase()}`, xe = (e) => (e = e.replace("#", ""), e.length === 3 && (e = e.split("").map((e) => e + e).join("")), e.length === 6 ? {
88
+ ].map((e) => e.toString(16).padStart(2, "0")).join("").toUpperCase()}`, ye = (e) => (e = e.replace("#", ""), e.length === 3 && (e = e.split("").map((e) => e + e).join("")), e.length === 6 ? {
92
89
  r: parseInt(e.slice(0, 2), 16) || 0,
93
90
  g: parseInt(e.slice(2, 4), 16) || 0,
94
91
  b: parseInt(e.slice(4, 6), 16) || 0
@@ -118,16 +115,16 @@ var A = /* @__PURE__ */ p({
118
115
  s: o,
119
116
  v: s
120
117
  };
121
- }, W = s(() => ye(L.value.h, L.value.s, L.value.v)), G = s(() => {
118
+ }, W = o(() => _e(L.value.h, L.value.s, L.value.v)), G = o(() => {
122
119
  let { r: e, g: t, b: n } = W.value;
123
120
  return `rgba(${e},${t},${n},${L.value.a})`;
124
- }), Se = s(() => {
121
+ }), be = o(() => {
125
122
  let { r: e, g: t, b: n } = W.value;
126
- return I.value === "hex" ? be(e, t, n) : L.value.a === 1 ? `rgb(${e},${t},${n})` : `rgba(${e},${t},${n},${Math.round(L.value.a * 10) / 10})`;
123
+ return I.value === "hex" ? ve(e, t, n) : L.value.a === 1 ? `rgb(${e},${t},${n})` : `rgba(${e},${t},${n},${Math.round(L.value.a * 10) / 10})`;
127
124
  }), K = (e) => {
128
125
  try {
129
126
  if (e.startsWith("#")) {
130
- let t = xe(e), n = {
127
+ let t = ye(e), n = {
131
128
  ...U(t.r, t.g, t.b),
132
129
  a: L.value.a
133
130
  };
@@ -157,19 +154,19 @@ var A = /* @__PURE__ */ p({
157
154
  if (!R.value) return;
158
155
  let t = R.value.getBoundingClientRect(), n = q(e.clientX - t.left, 0, t.width), r = q(e.clientY - t.top, 0, t.height);
159
156
  L.value.s = n / t.width, L.value.v = 1 - r / t.height;
160
- }, Ce = (e) => {
157
+ }, xe = (e) => {
161
158
  e.preventDefault(), V.value = !0, H.value = "panel", J(e);
162
- }, we = (e) => {
159
+ }, Se = (e) => {
163
160
  J(e);
164
- }, Te = (e) => {
161
+ }, Ce = (e) => {
165
162
  e.preventDefault(), V.value = !0, H.value = "hue";
166
- }, Ee = (e) => {
163
+ }, we = (e) => {
167
164
  if (!z.value) return;
168
165
  let t = z.value.getBoundingClientRect(), n = q(e.clientX - t.left, 0, t.width);
169
166
  L.value.h = q(n / t.width * 360, 0, 360);
170
- }, De = (e) => {
171
- e.preventDefault(), V.value = !0, H.value = "alpha";
172
167
  }, Y = (e) => {
168
+ e.preventDefault(), V.value = !0, H.value = "alpha";
169
+ }, Te = (e) => {
173
170
  if (!B.value) return;
174
171
  let t = B.value.getBoundingClientRect(), n = q(e.clientX - t.left, 0, t.width);
175
172
  L.value.a = q(n / t.width, 0, 1);
@@ -186,57 +183,57 @@ var A = /* @__PURE__ */ p({
186
183
  }
187
184
  }, Z = () => {
188
185
  V.value = !1, H.value = null;
189
- }, Oe = (e) => {
186
+ }, Ee = (e) => {
190
187
  K(e);
191
188
  };
192
- k(Se, (e) => {
193
- j.value = e, T("change", e);
194
- }), k(j, (e) => {
189
+ O(be, (e) => {
190
+ M.value = e, w("change", e);
191
+ }), O(M, (e) => {
195
192
  K(e);
196
- }, { immediate: !0 }), _(() => {
193
+ }, { immediate: !0 }), g(() => {
197
194
  document.addEventListener("mousemove", X), document.addEventListener("mouseup", Z);
198
- }), v(() => {
195
+ }), _(() => {
199
196
  document.removeEventListener("mousemove", X), document.removeEventListener("mouseup", Z);
200
197
  });
201
- let Q = f(), $ = de();
202
- return b(() => {
203
- let e = D(A);
204
- x($, [
198
+ let Q = d(), $ = le();
199
+ return y(() => {
200
+ let e = D(j);
201
+ b($, [
205
202
  e.b(),
206
- e.m(D(me)),
207
- e.is("error", D(he))
203
+ e.m(D(fe)),
204
+ e.is("error", D(pe))
208
205
  ]);
209
- }), S($, null, 0), Q(c(D(r), { $: [() => ({
206
+ }), x($, null, 0), Q(s(D(n), { $: [() => ({
210
207
  offset: [0, 4],
211
208
  placement: "bottom-start",
212
209
  width: "sameWidth",
213
210
  manual: !0,
214
- ...p.popoverProps
215
- }), { onClickOutside: () => _e }] }, {
211
+ ...f.popoverProps
212
+ }), { onClickOutside: () => he }] }, {
216
213
  content: ie(() => {
217
- let e = ue(), t = o(e), n = o(t), r = o(n), s = g(r, 1), f = g(n, 1), m = o(f), h = o(m), _ = o(h), v = o(_), y = g(_, 1), w = g(m, 1), T = o(w), E = g(f, 2);
218
- return n.$evtmousedown = d(Ce), n.$evtclick = d(we), Q(n, R, null, "panelRef"), _.$evtclick = d(Ee), Q(_, z, null, "hueSliderRef"), y.$evtmousedown = d(Te), b(() => {
219
- let i = D(A), a = L.value, o = a.h;
220
- x(e, [i.e("wrapper")]), x(t, [i.e("content")]), x(n, [i.e("panel")]), x(r, [i.e("panel-bg")]), C(r, { background: `linear-gradient(to right, #fff, hsl(${o}deg 100% 50%))` }), x(s, [i.e("panel-thumb")]), C(s, {
221
- left: `${a.s * 100}%`,
222
- top: `${(1 - a.v) * 100}%`
223
- }), x(f, [i.e("control")]), x(m, [i.e("control-item")]), x(h, [i.e("control-wrapper")]), x(_, [i.e("control-track")]), x(v, [i.e("control-hue")]), x(y, [i.e("control-thumb")]), C(y, {
224
- left: `${o / 3.6}%`,
225
- color: j.value
214
+ let e = ce(), t = a(e), n = a(t), o = a(n), d = h(o, 1), p = h(n, 1), m = a(p), g = a(m), _ = a(g), v = a(_), C = h(_, 1), w = h(m, 1), T = a(w), E = h(p, 2);
215
+ return n.$evtmousedown = u(xe), n.$evtclick = u(Se), Q(n, R, null, "panelRef"), _.$evtclick = u(we), Q(_, z, null, "hueSliderRef"), C.$evtmousedown = u(Ce), y(() => {
216
+ let r = D(j), i = L.value, a = i.h;
217
+ b(e, [r.e("wrapper")]), b(t, [r.e("content")]), b(n, [r.e("panel")]), b(o, [r.e("panel-bg")]), S(o, { background: `linear-gradient(to right, #fff, hsl(${a}deg 100% 50%))` }), b(d, [r.e("panel-thumb")]), S(d, {
218
+ left: `${i.s * 100}%`,
219
+ top: `${(1 - i.v) * 100}%`
220
+ }), b(p, [r.e("control")]), b(m, [r.e("control-item")]), b(g, [r.e("control-wrapper")]), b(_, [r.e("control-track")]), b(v, [r.e("control-hue")]), b(C, [r.e("control-thumb")]), S(C, {
221
+ left: `${a / 3.6}%`,
222
+ color: M.value
226
223
  });
227
- }), S(m, null, 1), u(() => !p.disabledAlpha, () => {
228
- let e = se(), t = o(e), n = o(t), r = g(t, 1);
229
- return t.$evtclick = d(Y), Q(t, B, null, "alphaSliderRef"), r.$evtmousedown = d(De), b(() => {
230
- let i = D(A);
231
- x(e, [i.e("control-wrapper")]), x(t, [i.e("control-track")]), x(n, [i.e("control-alpha")]), C(n, { color: G.value }), x(r, [i.e("control-thumb")]), C(r, {
224
+ }), x(m, null, 1), l(() => !f.disabledAlpha, () => {
225
+ let e = ae(), t = a(e), n = a(t), r = h(t, 1);
226
+ return t.$evtclick = u(Te), Q(t, B, null, "alphaSliderRef"), r.$evtmousedown = u(Y), y(() => {
227
+ let i = D(j);
228
+ b(e, [i.e("control-wrapper")]), b(t, [i.e("control-track")]), b(n, [i.e("control-alpha")]), S(n, { color: G.value }), b(r, [i.e("control-thumb")]), S(r, {
232
229
  left: `${L.value.a * 100}%`,
233
- color: j.value
230
+ color: M.value
234
231
  });
235
232
  }), e;
236
- }, null, 1), b(() => {
237
- let e = D(A);
238
- x(w, [e.e("control-preview")]), x(T, [e.e("control-preview-color")]), C(T, { background: G.value }), x(E, [e.e("input")]);
239
- }), S(E, null, 0), c(D(a), {
233
+ }, null, 1), y(() => {
234
+ let e = D(j);
235
+ b(w, [e.e("control-preview")]), b(T, [e.e("control-preview-color")]), S(T, { background: G.value }), b(E, [e.e("input")]);
236
+ }), x(E, null, 0), s(D(i), {
240
237
  modelValue: () => I.value,
241
238
  "onUpdate:modelValue": () => (e) => I.value = e,
242
239
  style: () => ({ width: "100px" }),
@@ -248,38 +245,38 @@ var A = /* @__PURE__ */ p({
248
245
  label: "RGB",
249
246
  value: "rgb"
250
247
  }]
251
- }), S(E, null, 1), c(D(i), {
248
+ }), x(E, null, 1), s(D(r), {
252
249
  size: () => "mini",
253
250
  style: () => ({ flex: "1" }),
254
- modelValue: () => j.value,
255
- "onUpdate:modelValue": () => (e) => j.value = e
256
- }), S(t, null, 3), u(() => p.showPreset, () => {
257
- let e = le(), t = o(e), n = g(t, 1);
258
- return b(() => {
259
- let r = D(A);
260
- x(e, [r.e("presets")]), x(t, [r.e("presets-title")]), x(n, [r.e("presets-list")]);
261
- }), S(n, null, 0), l(() => ve.value, (e) => {
262
- let t = ce();
263
- return t.$evtclick = d(() => Oe(e.value)), b(() => {
264
- x(t, [[D(A).e("presets-item")], "item"]), C(t, { background: e.value });
251
+ modelValue: () => M.value,
252
+ "onUpdate:modelValue": () => (e) => M.value = e
253
+ }), x(t, null, 3), l(() => f.showPreset, () => {
254
+ let e = se(), t = a(e), n = h(t, 1);
255
+ return y(() => {
256
+ let r = D(j);
257
+ b(e, [r.e("presets")]), b(t, [r.e("presets-title")]), b(n, [r.e("presets-list")]);
258
+ }), x(n, null, 0), c(() => ge.value, (e) => {
259
+ let t = oe();
260
+ return t.$evtclick = u(() => Ee(e.value)), y(() => {
261
+ b(t, [[D(j).e("presets-item")], "item"]), S(t, { background: e.value });
265
262
  }), t;
266
263
  }, (e) => e, 1), e;
267
- }, null, 1), e.$evtmousedown = d(re(() => {}, ["prevent"])), e;
264
+ }, null, 1), e.$evtmousedown = u(re(() => {}, ["prevent"])), e;
268
265
  }),
269
266
  default: () => {
270
- let e = oe(), t = o(e);
271
- return b(() => {
272
- let n = D(A);
273
- x(e, [n.e("trigger"), n.is("disabled", p.disabled)]), x(t, [n.e("preview")]), C(t, { backgroundColor: j.value });
274
- }), S(e, null, 1), u(() => p.showText, () => {
275
- let e = ae(), t = te(e);
276
- return b(() => {
277
- x(e, [D(A).e("value")]), w(t, E(j.value));
267
+ let e = A(), t = a(e);
268
+ return y(() => {
269
+ let n = D(j);
270
+ b(e, [n.e("trigger"), n.is("disabled", f.disabled)]), b(t, [n.e("preview")]), S(t, { backgroundColor: M.value });
271
+ }), x(e, null, 1), l(() => f.showText, () => {
272
+ let e = k(), t = ee(e);
273
+ return y(() => {
274
+ b(e, [D(j).e("value")]), C(t, T(M.value));
278
275
  }), e;
279
- }, null, 1), Q(e, M, null, "triggerRef"), e;
276
+ }, null, 1), e;
280
277
  }
281
- }), N, null, "popoverRef"), $.$evtclick = d(ge), $;
278
+ }), N, null, "popoverRef"), $.$evtclick = u(me), $;
282
279
  }
283
280
  });
284
281
  //#endregion
285
- export { A as default };
282
+ export { j as default };
@@ -1,20 +1,12 @@
1
1
  import { ConfigProviderProps, ConfigProviderSlots } from './types';
2
- import { PublicProps, VNode } from 'vue';
3
- declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: PublicProps & __VLS_PrettifyLocal<ConfigProviderProps> & (typeof globalThis extends {
5
- __VLS_PROPS_FALLBACK: infer P;
6
- } ? P : {});
7
- expose: (exposed: {}) => void;
8
- attrs: any;
9
- slots: ConfigProviderSlots;
10
- emit: {};
11
- }>) => VNode & {
12
- __ctx?: Awaited<typeof __VLS_setup>;
13
- };
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ type __VLS_Slots = ConfigProviderSlots;
4
+ declare const __VLS_base: DefineComponent<ConfigProviderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ConfigProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
5
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
6
  declare const _default: typeof __VLS_export;
15
7
  export default _default;
16
- type __VLS_PrettifyLocal<T> = (T extends any ? {
17
- [K in keyof T]: T[K];
18
- } : {
19
- [K in keyof T as K]: T[K];
20
- }) & {};
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };