savor-ui 0.1.0 → 0.2.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 (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/es/components/src/image/image-group.d.ts +1 -3
  3. package/dist/es/components/src/image/image-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +64 -70
  4. package/dist/es/components/src/image/index.d.ts +2 -6
  5. package/dist/es/components/src/link/index.d.ts +1 -1
  6. package/dist/es/components/src/link/types.d.ts +1 -1
  7. package/dist/es/components/src/message/message-container.d.ts +1 -1
  8. package/dist/es/components/src/message/message-container.vue_vue_type_script_setup_true_vapor_true_lang.mjs +24 -22
  9. package/dist/es/components/src/message/message.vue_vue_type_script_setup_true_vapor_true_lang.mjs +1 -2
  10. package/dist/es/components/src/message/method.mjs +33 -28
  11. package/dist/es/components/src/message/types.d.ts +0 -4
  12. package/dist/es/components/src/radio/index.d.ts +4 -2
  13. package/dist/es/components/src/radio/radio-group.d.ts +2 -1
  14. package/dist/es/components/src/radio/radio-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +23 -15
  15. package/dist/es/components/src/radio/radio.vue_vue_type_script_setup_true_vapor_true_lang.mjs +14 -9
  16. package/dist/es/components/src/radio/types.d.ts +6 -1
  17. package/dist/es/components/src/text/index.d.ts +7 -2
  18. package/dist/es/components/src/text/text.d.ts +6 -2
  19. package/dist/es/components/src/text/text.vue_vue_type_script_setup_true_vapor_true_lang.mjs +137 -29
  20. package/dist/es/components/src/text/types.d.ts +6 -0
  21. package/dist/es/icons/src/copy.vue.mjs +9 -3
  22. package/dist/es/theme/components/image.scss +9 -33
  23. package/dist/es/theme/components/radio.scss +44 -1
  24. package/dist/es/theme/components/text.scss +37 -0
  25. package/dist/json/vetur-attributes.json +18 -6
  26. package/dist/json/vetur-tags.json +7 -4
  27. package/dist/json/web-types.json +36 -12
  28. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
 
4
4
 
5
+ # [0.2.0](https://gitee.com/mach552/savor-ui/compare/v0.1.0...v0.2.0) (2026-05-22)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **image:** 修复图片组预览图片不展示的问题 ([d485580](https://gitee.com/mach552/savor-ui/commits/d485580c89acd0483cd71cb885175a294b3db1d3))
11
+ * **message:** 修复容器不销毁的问题 ([6c34e24](https://gitee.com/mach552/savor-ui/commits/6c34e24fcc1b0aadab4c49c385470cb79f88d1b5))
12
+
13
+
14
+ ### Features
15
+
16
+ * **radio:** 新增按钮类型的单选框组 ([4b7e12a](https://gitee.com/mach552/savor-ui/commits/4b7e12aef25fc0504e3bdb8d52a85d899acefd00))
17
+ * **text:** 新增复制和编辑模式,新增气泡提示 ([39125c3](https://gitee.com/mach552/savor-ui/commits/39125c3877a14d9bcd9deda7736f7b2583e479b1))
18
+
5
19
  # 0.1.0 (2026-05-16)
6
20
 
7
21
 
@@ -10,9 +10,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
10
10
  } ? P : {});
11
11
  expose: (exposed: {}) => void;
12
12
  attrs: any;
13
- slots: {
14
- default?: (props: {}) => any;
15
- };
13
+ slots: {};
16
14
  emit: (event: "update:modelValue", value: boolean) => void;
17
15
  }>) => VNode & {
18
16
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -3,23 +3,23 @@ import { useScrollHidden as t } from "../../../hooks/src/use-scroll-hidden.mjs";
3
3
  import { useZIndex as n } from "../../../hooks/src/use-zIndex.mjs";
4
4
  import "../../../hooks/index.mjs";
5
5
  import r from "../../../icons/src/close.vue.mjs";
6
- import i from "../../../icons/src/left.vue.mjs";
7
- import a from "../../../icons/src/refresh-left.vue.mjs";
8
- import o from "../../../icons/src/refresh-right.vue.mjs";
9
- import s from "../../../icons/src/refresh.vue.mjs";
10
- import ee from "../../../icons/src/right.vue.mjs";
11
- import te from "../../../icons/src/zoom-in.vue.mjs";
12
- import c from "../../../icons/src/zoom-out.vue.mjs";
6
+ import ee from "../../../icons/src/left.vue.mjs";
7
+ import i from "../../../icons/src/refresh-left.vue.mjs";
8
+ import a from "../../../icons/src/refresh-right.vue.mjs";
9
+ import te from "../../../icons/src/refresh.vue.mjs";
10
+ import ne from "../../../icons/src/right.vue.mjs";
11
+ import re from "../../../icons/src/zoom-in.vue.mjs";
12
+ import ie from "../../../icons/src/zoom-out.vue.mjs";
13
13
  import "../../../icons/index.mjs";
14
- import { imageGroupContextKey as l } from "./types.mjs";
15
- import { VaporTeleport as u, child as d, computed as f, createComponent as p, createIf as m, createInvoker as h, createSlot as g, defineVaporComponent as _, delegateEvents as v, mergeModels as y, next as b, on as x, onMounted as S, onUnmounted as C, provide as w, ref as T, renderEffect as E, setClass as D, setInsertionState as O, setProp as ne, setStyle as k, template as A, unref as j, useModel as re, watch as M, withModifiers as N, withVaporCtx as P } from "vue";
14
+ import { imageGroupContextKey as o } from "./types.mjs";
15
+ import { VaporTeleport as s, child as c, computed as l, createComponent as u, createIf as d, createInvoker as f, defineVaporComponent as p, delegateEvents as m, mergeModels as h, next as g, on as _, onMounted as v, onUnmounted as y, provide as b, ref as x, renderEffect as S, setClass as C, setInsertionState as w, setProp as ae, setStyle as T, template as E, unref as D, useModel as O, watch as k, withModifiers as A, withVaporCtx as j } from "vue";
16
16
  //#region ../components/src/image/image-group.vue?vue&type=script&setup=true&vapor=true&lang.ts
17
- var F = A("<div><img alt>"), I = A("<div><div></div><div><div></div><div></div><div><div></div><div></div><div></div><div></div><div></div><div>");
18
- v("click", "mousedown", "mouseup", "mousemove");
19
- var L = /* @__PURE__ */ _({
17
+ var M = E("<div><img alt>"), N = E("<div><div></div><div><div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div>");
18
+ m("click", "mousedown", "mouseup", "mousemove");
19
+ var P = /* @__PURE__ */ p({
20
20
  name: "SImageGroup",
21
21
  __name: "image-group",
22
- props: /* @__PURE__ */ y({
22
+ props: /* @__PURE__ */ h({
23
23
  modelValue: { type: Boolean },
24
24
  srcList: {}
25
25
  }, {
@@ -27,79 +27,73 @@ var L = /* @__PURE__ */ _({
27
27
  modelModifiers: {}
28
28
  }),
29
29
  emits: ["update:modelValue"],
30
- __multiRoot: !0,
31
- setup(_) {
32
- let v = _, y = e("image"), { nextZIndex: A } = n(), { lockScroll: L, unlockScroll: R } = t(), z = T(0), B = re(_, "modelValue"), V = T([]), H = T(0), U = f(() => V.value[H.value]), W = () => {
33
- B.value = !1, R();
30
+ __multiRoot: !1,
31
+ setup(p) {
32
+ let m = p, h = e("image"), { nextZIndex: E } = n(), { lockScroll: P, unlockScroll: F } = t(), I = x(0), L = O(p, "modelValue"), R = x([]), z = x(0), B = l(() => R.value[z.value]), V = () => {
33
+ L.value = !1, F();
34
34
  };
35
- M(B, (e) => {
36
- e ? (z.value = A(), L()) : R();
35
+ k(L, (e) => {
36
+ e ? (I.value = E(), P()) : F();
37
37
  });
38
- let G = T(0), K = T(1), q = T(0), J = T(0), ie = () => {
39
- G.value += 90;
40
- }, ae = () => {
41
- G.value -= 90;
38
+ let H = x(0), U = x(1), W = x(0), G = x(0), K = () => {
39
+ H.value += 90;
40
+ }, q = () => {
41
+ H.value -= 90;
42
+ }, J = () => {
43
+ U.value += .2, U.value > 2 && (U.value = 2);
42
44
  }, Y = () => {
43
- K.value += .2, K.value > 2 && (K.value = 2);
45
+ U.value -= .2, U.value < .5 && (U.value = .5);
44
46
  }, X = () => {
45
- K.value -= .2, K.value < .5 && (K.value = .5);
46
- }, Z = () => {
47
- G.value = 0, K.value = 1, q.value = 0, J.value = 0;
47
+ H.value = 0, U.value = 1, W.value = 0, G.value = 0;
48
48
  }, oe = () => {
49
- W();
50
- }, Q = (e) => {
51
- B.value && (e.preventDefault(), e.deltaY > 0 ? X() : Y());
52
- }, $ = T(!1), se = (e) => {
53
- e.preventDefault(), $.value = !0;
49
+ V();
50
+ }, Z = (e) => {
51
+ L.value && (e.preventDefault(), e.deltaY > 0 ? Y() : J());
52
+ }, Q = x(!1), se = (e) => {
53
+ e.preventDefault(), Q.value = !0;
54
54
  }, ce = (e) => {
55
- e.preventDefault(), $.value = !1;
55
+ e.preventDefault(), Q.value = !1;
56
56
  }, le = (e) => {
57
- e.preventDefault(), $.value && (q.value += e.movementX, J.value += e.movementY);
57
+ e.preventDefault(), Q.value && (W.value += e.movementX, G.value += e.movementY);
58
+ }, $ = () => {
59
+ z.value--, X(), z.value < 0 && (z.value = R.value.length - 1);
58
60
  }, ue = () => {
59
- H.value--, Z(), H.value < 0 && (H.value = V.value.length - 1);
60
- }, de = () => {
61
- H.value++, Z(), H.value > V.value.length - 1 && (H.value = 0);
61
+ z.value++, X(), z.value > R.value.length - 1 && (z.value = 0);
62
62
  };
63
- return S(() => {
64
- document.addEventListener("wheel", Q, { passive: !1 });
65
- }), C(() => {
66
- document.removeEventListener("wheel", Q);
67
- }), M(() => v.srcList, (e) => {
68
- e && (V.value = e);
69
- }), w(l, {
63
+ return v(() => {
64
+ document.addEventListener("wheel", Z, { passive: !1 });
65
+ }), y(() => {
66
+ document.removeEventListener("wheel", Z);
67
+ }), k(() => m.srcList, (e) => {
68
+ e && (R.value = e);
69
+ }, { immediate: !0 }), b(o, {
70
70
  addImage: (e) => {
71
- V.value.push(e);
71
+ R.value.push(e);
72
72
  },
73
73
  removeImage: (e) => {
74
- V.value = V.value.filter((t) => t !== e);
74
+ R.value = R.value.filter((t) => t !== e);
75
75
  },
76
76
  showPreview: (e) => {
77
- let t = V.value.indexOf(e);
78
- t !== -1 && (H.value = t, Z(), B.value = !0);
77
+ let t = R.value.indexOf(e);
78
+ t !== -1 && (z.value = t, X(), L.value = !0);
79
79
  }
80
- }), [g("default", null), p(u, { to: () => "body" }, { default: P(() => m(() => B.value, () => {
81
- let e = I(), t = d(e), n = b(t, 1), l = d(n, 1), u = b(l, 2), f = b(u, 3), g = d(f), _ = b(g, 1), v = b(_, 2), S = b(v, 3), C = b(S, 4), w = b(C, 5);
82
- return t.$evtclick = h(W), E(() => {
83
- let r = j(y);
84
- D(e, [r.e("preview")]), k(e, { zIndex: z.value }), D(t, [r.e("mask")]), D(n, [r.e("wrapper")]);
85
- }), O(n, 0, 0), m(() => U.value, () => {
86
- let e = F(), t = d(e);
87
- return e.$evtmousedown = h(se), e.$evtmouseup = h(ce), e.$evtmousemove = h(le), E(() => {
88
- let n = j(y);
89
- D(e, [n.e("content")]), k(e, { transform: `translate(${q.value}px, ${J.value}px) rotate(${G.value}deg) scale(${K.value})` }), ne(t, "src", U.value), D(t, [n.e("content-img")]);
80
+ }), u(s, { to: () => "body" }, { default: j(() => d(() => L.value, () => {
81
+ let e = N(), t = c(e), n = g(t, 1), o = c(n, 1), s = c(o), l = g(s, 1), p = g(l, 2), m = g(p, 3), v = g(m, 4), y = g(v, 5), b = g(y, 6), x = g(b, 7);
82
+ return t.$evtclick = f(V), S(() => {
83
+ let r = D(h);
84
+ C(e, [r.e("preview")]), T(e, { zIndex: I.value }), C(t, [r.e("mask")]), C(n, [r.e("wrapper")]);
85
+ }), w(n, 0, 0), d(() => B.value, () => {
86
+ let e = M(), t = c(e);
87
+ return e.$evtmousedown = f(se), e.$evtmouseup = f(ce), e.$evtmousemove = f(le), S(() => {
88
+ let n = D(h);
89
+ C(e, [n.e("content")]), T(e, { transform: `translate(${W.value}px, ${G.value}px) rotate(${H.value}deg) scale(${U.value})` }), ae(t, "src", B.value), C(t, [n.e("content-img")]);
90
90
  }), e;
91
- }, null, 1), E(() => {
92
- let e = j(y);
93
- D(l, [e.e("arrow"), e.e("arrow-left")]);
94
- }), O(l, null, 0), p(j(i)), x(l, "click", h(N(ue, ["stop"]))), E(() => {
95
- let e = j(y);
96
- D(u, [e.e("arrow"), e.e("arrow-right")]);
97
- }), O(u, null, 0), p(j(ee)), x(u, "click", h(N(de, ["stop"]))), E(() => {
98
- let e = j(y);
99
- D(f, [e.e("toolbar")]), D(g, [e.e("toolbar-item")]);
100
- }), O(g, null, 0), p(j(a)), x(g, "click", h(N(ie, ["stop"]))), E(() => D(_, [j(y).e("toolbar-item")])), O(_, null, 0), p(j(o)), x(_, "click", h(N(ae, ["stop"]))), E(() => D(v, [j(y).e("toolbar-item")])), O(v, null, 0), p(j(te)), x(v, "click", h(N(Y, ["stop"]))), E(() => D(S, [j(y).e("toolbar-item")])), O(S, null, 0), p(j(c)), x(S, "click", h(N(X, ["stop"]))), E(() => D(C, [j(y).e("toolbar-item")])), O(C, null, 0), p(j(s)), x(C, "click", h(N(Z, ["stop"]))), E(() => D(w, [j(y).e("toolbar-item")])), O(w, null, 0), p(j(r)), x(w, "click", h(N(oe, ["stop"]))), e;
101
- }, null, 1)) })];
91
+ }, null, 1), S(() => {
92
+ let e = D(h);
93
+ C(o, [e.e("toolbar")]), C(s, [e.e("toolbar-item")]);
94
+ }), w(s, null, 0), u(D(i)), _(s, "click", f(A(K, ["stop"]))), S(() => C(l, [D(h).e("toolbar-item")])), w(l, null, 0), u(D(a)), _(l, "click", f(A(q, ["stop"]))), S(() => C(p, [D(h).e("toolbar-item")])), w(p, null, 0), u(D(re)), _(p, "click", f(A(J, ["stop"]))), S(() => C(m, [D(h).e("toolbar-item")])), w(m, null, 0), u(D(ie)), _(m, "click", f(A(Y, ["stop"]))), S(() => C(v, [D(h).e("toolbar-item")])), w(v, null, 0), u(D(te)), _(v, "click", f(A(X, ["stop"]))), S(() => C(y, [D(h).e("toolbar-item")])), w(y, null, 0), u(D(ee)), _(y, "click", f(A($, ["stop"]))), S(() => C(b, [D(h).e("toolbar-item")])), w(b, null, 0), u(D(ne)), _(b, "click", f(A(ue, ["stop"]))), S(() => C(x, [D(h).e("toolbar-item")])), w(x, null, 0), u(D(r)), _(x, "click", f(A(oe, ["stop"]))), e;
95
+ }, null, 1)) }, !0);
102
96
  }
103
97
  });
104
98
  //#endregion
105
- export { L as default };
99
+ export { P as default };
@@ -40,9 +40,7 @@ export declare const SImagePreview: ((__VLS_props: NonNullable<Awaited<typeof __
40
40
  }) & Plugin;
41
41
  export declare const SImageGroup: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
42
42
  attrs: any;
43
- slots: {
44
- default?: (props: {}) => any;
45
- };
43
+ slots: {};
46
44
  emit: (event: "update:modelValue", value: boolean) => void;
47
45
  }, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
48
46
  props: PublicProps & {
@@ -54,9 +52,7 @@ export declare const SImageGroup: ((__VLS_props: NonNullable<Awaited<typeof __VL
54
52
  } ? P : {});
55
53
  expose: (exposed: {}) => void;
56
54
  attrs: any;
57
- slots: {
58
- default?: (props: {}) => any;
59
- };
55
+ slots: {};
60
56
  emit: (event: "update:modelValue", value: boolean) => void;
61
57
  }>) => VNode & {
62
58
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -8,7 +8,7 @@ export declare const SLink: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
8
8
  props: PublicProps & {
9
9
  href?: string | undefined;
10
10
  label?: string | undefined;
11
- type?: "default" | "primary" | "success" | "warning" | "danger" | "link" | undefined;
11
+ type?: "default" | "primary" | "success" | "warning" | "danger" | "info" | undefined;
12
12
  underline?: "always" | "hover" | "never" | undefined;
13
13
  disabled?: boolean | undefined;
14
14
  } & (typeof globalThis extends {
@@ -4,7 +4,7 @@ export interface LinkProps {
4
4
  /** 链接文本 */
5
5
  label?: string;
6
6
  /** 链接类型 */
7
- type?: "default" | "primary" | "success" | "warning" | "danger" | "link";
7
+ type?: "default" | "primary" | "success" | "warning" | "danger" | "info";
8
8
  /** 链接下划线
9
9
  * @default hover
10
10
  */
@@ -4,7 +4,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
4
4
  props: PublicProps & __VLS_PrettifyLocal<{
5
5
  placement: "top" | "bottom" | "center";
6
6
  offset?: number;
7
- transition?: string;
7
+ onEmpty?: () => void;
8
8
  }> & (typeof globalThis extends {
9
9
  __VLS_PROPS_FALLBACK: infer P;
10
10
  } ? P : {});
@@ -2,36 +2,38 @@ import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
2
2
  import { useZIndex as t } from "../../../hooks/src/use-zIndex.mjs";
3
3
  import "../../../hooks/index.mjs";
4
4
  import n from "./message.vue.mjs";
5
- import { VaporTeleport as r, VaporTransitionGroup as i, computed as a, createComponent as o, createFor as s, defineVaporComponent as c, ref as l, renderEffect as u, setClass as d, setInsertionState as f, template as p, unref as m, withVaporCtx as h } from "vue";
5
+ import { VaporTransitionGroup as r, computed as i, createComponent as a, createFor as o, defineVaporComponent as s, ref as c, renderEffect as l, setClass as u, setInsertionState as d, template as f, unref as p, withVaporCtx as m } from "vue";
6
6
  //#region ../components/src/message/message-container.vue?vue&type=script&setup=true&vapor=true&lang.ts
7
- var g = p("<div>"), _ = /* @__PURE__ */ c({
7
+ var h = f("<div>"), g = /* @__PURE__ */ s({
8
8
  __name: "message-container",
9
9
  props: {
10
10
  placement: {},
11
11
  offset: {},
12
- transition: {}
12
+ onEmpty: {}
13
13
  },
14
14
  __multiRoot: !1,
15
- setup(c, { expose: p }) {
16
- let _ = e("message"), v = c, { nextZIndex: y } = t(), b = l(0), x = a(() => {
17
- let e = { zIndex: b.value };
18
- return v.placement === "top" ? e.top = `${v.offset}px` : v.placement === "bottom" && (e.bottom = `${v.offset}px`), e;
19
- }), S = l([]), C = (e) => {
20
- b.value = y(), S.value.push(e);
15
+ setup(s, { expose: f }) {
16
+ let g = e("message"), _ = s, { nextZIndex: v } = t(), y = c(0), b = 0, x = i(() => {
17
+ let e = { zIndex: y.value };
18
+ return _.placement === "top" ? e.top = `${_.offset}px` : _.placement === "bottom" && (e.bottom = `${_.offset}px`), e;
19
+ }), S = c([]), C = (e) => {
20
+ y.value = v(), S.value.push(e);
21
21
  }, w = (e) => {
22
22
  let t = S.value.findIndex((t) => t.id === e);
23
23
  t > -1 && S.value.splice(t, 1);
24
24
  }, T = (e) => {
25
25
  S.value.find((t) => t.id === e)?.destroy();
26
26
  }, E = (e) => {
27
+ b++;
27
28
  let t = e;
28
29
  t.style.maxHeight = `${t.offsetHeight}px`, t.offsetWidth;
29
30
  }, D = (e) => {
30
31
  let t = e;
31
32
  t.style.maxHeight = "0", t.offsetWidth;
32
33
  }, O = (e) => {
34
+ b--;
33
35
  let t = e;
34
- t.style.maxHeight = "", t.style.overflow = "";
36
+ t.style.maxHeight = "", t.style.overflow = "", S.value.length === 0 && b === 0 && _.onEmpty?.();
35
37
  }, k = (e) => {
36
38
  let t = e;
37
39
  t.style.transition = "none";
@@ -41,13 +43,13 @@ var g = p("<div>"), _ = /* @__PURE__ */ c({
41
43
  let t = e;
42
44
  t.style.maxHeight = "";
43
45
  };
44
- return p({
46
+ return f({
45
47
  addMessage: C,
46
48
  removeMessage: w,
47
49
  getMessages: () => S.value
48
- }), o(r, { to: () => "body" }, { default: h(() => o(i, {
49
- class: () => [m(_).e("container"), m(_).m(`container-${c.placement}`)],
50
- name: () => c.transition,
50
+ }), a(r, {
51
+ class: () => [p(g).e("container"), p(g).m(`container-${s.placement}`)],
52
+ name: () => "message-fade",
51
53
  style: () => x.value,
52
54
  tag: () => "div",
53
55
  onEnter: () => k,
@@ -55,14 +57,14 @@ var g = p("<div>"), _ = /* @__PURE__ */ c({
55
57
  onBeforeLeave: () => E,
56
58
  onAfterLeave: () => O,
57
59
  onAfterEnter: () => A
58
- }, { default: h(() => s(() => S.value, (e) => {
59
- let t = g();
60
- return u(() => {
61
- let e = m(_);
62
- d(t, [e.e("wrapper"), e.m(`wrapper-${c.placement}`)]);
63
- }), f(t, null, 0), o(n, { $: [() => e.value, { onClose: () => () => T(e.value.id) }] }), t;
64
- }, (e) => e.id)) })) }, !0);
60
+ }, { default: m(() => o(() => S.value, (e) => {
61
+ let t = h();
62
+ return l(() => {
63
+ let e = p(g);
64
+ u(t, [e.e("wrapper"), e.m(`wrapper-${s.placement}`)]);
65
+ }), d(t, null, 0), a(n, { $: [() => e.value, { onClose: () => () => T(e.value.id) }] }), t;
66
+ }, (e) => e.id)) }, !0);
65
67
  }
66
68
  });
67
69
  //#endregion
68
- export { _ as default };
70
+ export { g as default };
@@ -30,8 +30,7 @@ var O = /* @__PURE__ */ u({
30
30
  default: !0
31
31
  },
32
32
  grouping: { type: Boolean },
33
- id: {},
34
- transition: {}
33
+ id: {}
35
34
  },
36
35
  emits: ["close"],
37
36
  __multiRoot: !1,
@@ -1,62 +1,67 @@
1
1
  import e from "./message-container.vue.mjs";
2
- import { createComponent as t, nextTick as n, remove as r, setInsertionState as i } from "vue";
2
+ import { createComponent as t, nextTick as n, reactive as r, remove as i, setInsertionState as a } from "vue";
3
3
  //#region ../components/src/message/method.ts
4
- var a = null, o = null, s = null, c = 0, l = null, u = 0, d = () => `message-${++c}`, f = () => s?.exposed ?? null, p = (e) => {
5
- let t = f();
6
- t && t.getMessages()?.some((t) => t.id === e) && (t.removeMessage(e), u--, m());
4
+ var o = null, s = null, c = 0, l = null, u = r({
5
+ placement: "top",
6
+ offset: 8
7
+ }), d = () => `message-${++c}`, f = () => s?.exposed ?? null, p = () => {
8
+ l &&= (clearTimeout(l), null), s &&= (i(s), null), o &&= (o.remove(), null);
7
9
  }, m = () => {
8
10
  l && clearTimeout(l), l = setTimeout(() => {
9
- u > 0 || (s &&= (r(s), null), a?.remove(), a = null, o = null, l = null);
10
- }, 300);
11
- }, h = (n, c, u, d) => {
12
- l &&= (clearTimeout(l), null), s && (r(s), a?.remove(), s = null, a = null), a = document.createElement("div"), i(a, null), s = t(e, { $: [() => ({
13
- placement: n,
14
- offset: c,
15
- transition: u
16
- })] }, null, !1, !1, d), o = n;
17
- }, g = (e) => ({
11
+ let e = f()?.getMessages();
12
+ e && e.length > 0 || p();
13
+ }, 1e3);
14
+ }, h = (e) => {
15
+ let t = f();
16
+ t && t.getMessages()?.some((t) => t.id === e) && (t.removeMessage(e), m());
17
+ }, g = (n) => {
18
+ s ||= (l &&= (clearTimeout(l), null), o = document.createElement("div"), document.body.appendChild(o), a(o, null), t(e, { $: [() => ({
19
+ ...u,
20
+ onEmpty: p
21
+ })] }, null, !1, !1, n));
22
+ }, _ = (e) => ({
18
23
  open: (t) => {
19
- let { placement: r = "top", offset: i = 8, id: a = d(), grouping: c, message: l, transition: m = "message-fade" } = t;
20
- if (c && l) {
21
- let e = f()?.getMessages()?.find((e) => e.message === l);
24
+ let { placement: r = "top", offset: i = 8, id: a = d(), grouping: o, message: c } = t;
25
+ if (o && c) {
26
+ let e = f()?.getMessages()?.find((e) => e.message === c);
22
27
  if (e) return e.count = (e.count || 0) + 1, {
23
28
  id: e.id,
24
29
  close: () => {
25
- p(e.id);
30
+ h(e.id);
26
31
  }
27
32
  };
28
33
  }
29
- let g = !s || r !== o;
30
- g && (h(r, i, m, e), u = 0), u++;
31
- let _ = {
34
+ let l = !s;
35
+ u.placement = r, u.offset = i, g(e);
36
+ let p = {
32
37
  ...t,
33
38
  id: a,
34
39
  destroy: () => {
35
- p(a);
40
+ h(a);
36
41
  },
37
42
  placement: r,
38
43
  offset: i,
39
44
  count: 0
40
- }, v = () => {
45
+ }, m = () => {
41
46
  try {
42
- f()?.addMessage(_);
47
+ f()?.addMessage(p);
43
48
  } catch (e) {
44
49
  console.warn("添加消息失败:", e);
45
50
  }
46
51
  };
47
- return g ? n(v) : v(), {
52
+ return l ? n(m) : m(), {
48
53
  id: a,
49
54
  close: () => {
50
- p(a);
55
+ h(a);
51
56
  }
52
57
  };
53
58
  },
54
59
  close: (e) => {
55
- p(e);
60
+ h(e);
56
61
  },
57
62
  closeAll: () => {
58
- l &&= (clearTimeout(l), null), s &&= (r(s), null), a?.remove(), a = null, o = null, u = 0;
63
+ p();
59
64
  }
60
65
  });
61
66
  //#endregion
62
- export { g as useMessage };
67
+ export { _ as useMessage };
@@ -37,10 +37,6 @@ export interface MessageProps {
37
37
  /** 消息唯一标识
38
38
  */
39
39
  id?: string;
40
- /** 过渡动画名称
41
- * @default 'message-fade'
42
- */
43
- transition?: string;
44
40
  }
45
41
  export interface MessageExpose {
46
42
  /** 实例 ID */
@@ -28,11 +28,13 @@ export declare const SRadioGroup: ((__VLS_props: NonNullable<Awaited<typeof __VL
28
28
  slots: {
29
29
  default?: (props: {}) => any;
30
30
  };
31
- emit: (event: "update:modelValue", value: string | number | boolean) => void;
31
+ emit: ((evt: "change", value: string | number | boolean) => void) & ((event: "update:modelValue", value: string | number | boolean) => void);
32
32
  }, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
33
33
  props: PublicProps & {
34
34
  vertical?: boolean | undefined;
35
+ button?: boolean | undefined;
35
36
  modelValue?: string | number | boolean | undefined;
37
+ onChange?: ((value: string | number | boolean) => any) | undefined;
36
38
  "onUpdate:modelValue"?: ((value: string | number | boolean) => any) | undefined;
37
39
  } & (typeof globalThis extends {
38
40
  __VLS_PROPS_FALLBACK: infer P;
@@ -42,7 +44,7 @@ export declare const SRadioGroup: ((__VLS_props: NonNullable<Awaited<typeof __VL
42
44
  slots: {
43
45
  default?: (props: {}) => any;
44
46
  };
45
- emit: (event: "update:modelValue", value: string | number | boolean) => void;
47
+ emit: ((evt: "change", value: string | number | boolean) => void) & ((event: "update:modelValue", value: string | number | boolean) => void);
46
48
  }>) => VNode & {
47
49
  __ctx?: Awaited<typeof __VLS_setup>;
48
50
  }) & Plugin;
@@ -4,6 +4,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
4
4
  props: PublicProps & __VLS_PrettifyLocal<(RadioGroupProps & {
5
5
  modelValue?: string | number | boolean;
6
6
  }) & {
7
+ onChange?: ((value: string | number | boolean) => any) | undefined;
7
8
  "onUpdate:modelValue"?: ((value: string | number | boolean) => any) | undefined;
8
9
  }> & (typeof globalThis extends {
9
10
  __VLS_PROPS_FALLBACK: infer P;
@@ -13,7 +14,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
13
14
  slots: {
14
15
  default?: (props: {}) => any;
15
16
  };
16
- emit: (event: "update:modelValue", value: string | number | boolean) => void;
17
+ emit: ((evt: "change", value: string | number | boolean) => void) & ((event: "update:modelValue", value: string | number | boolean) => void);
17
18
  }>) => VNode & {
18
19
  __ctx?: Awaited<typeof __VLS_setup>;
19
20
  };
@@ -1,12 +1,15 @@
1
1
  import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
2
2
  import "../../../hooks/index.mjs";
3
3
  import { radioGroupContextKey as t } from "./types.mjs";
4
- import { createSlot as n, defineVaporComponent as r, mergeModels as i, provide as a, renderEffect as o, setClass as s, setInsertionState as c, template as l, unref as u, useModel as d } from "vue";
4
+ import { createSlot as n, defineVaporComponent as r, mergeModels as i, provide as a, renderEffect as o, setClass as s, setInsertionState as c, template as l, toRefs as u, unref as d, useModel as f } from "vue";
5
5
  //#region ../components/src/radio/radio-group.vue?vue&type=script&setup=true&vapor=true&lang.ts
6
- var f = l("<div>", !0), p = /* @__PURE__ */ r({
6
+ var p = l("<div>", !0), m = /* @__PURE__ */ r({
7
7
  name: "SRadioGroup",
8
8
  __name: "radio-group",
9
- props: /* @__PURE__ */ i({ vertical: { type: Boolean } }, {
9
+ props: /* @__PURE__ */ i({
10
+ vertical: { type: Boolean },
11
+ button: { type: Boolean }
12
+ }, {
10
13
  modelValue: {
11
14
  type: [
12
15
  String,
@@ -17,22 +20,27 @@ var f = l("<div>", !0), p = /* @__PURE__ */ r({
17
20
  },
18
21
  modelModifiers: {}
19
22
  }),
20
- emits: ["update:modelValue"],
23
+ emits: /* @__PURE__ */ i(["change"], ["update:modelValue"]),
21
24
  __multiRoot: !1,
22
- setup(r) {
23
- let i = e("radio-group"), l = d(r, "modelValue");
25
+ setup(r, { emit: i }) {
26
+ let l = r, m = i, h = e("radio-group"), g = f(r, "modelValue"), _ = (e) => {
27
+ g.value = e, m("change", g.value);
28
+ }, { button: v } = u(l);
24
29
  a(t, {
25
- checked: (e) => {
26
- l.value = e;
27
- },
28
- checkedValue: l
30
+ checked: _,
31
+ checkedValue: g,
32
+ button: v
29
33
  });
30
- let p = f();
34
+ let y = p();
31
35
  return o(() => {
32
- let e = u(i);
33
- s(p, [e.b(), e.is("vertical", r.vertical)]);
34
- }), c(p, null, 0), n("default", null), p;
36
+ let e = d(h);
37
+ s(y, [
38
+ e.b(),
39
+ e.is("vertical", r.vertical),
40
+ e.is("button", d(v))
41
+ ]);
42
+ }), c(y, null, 0), n("default", null), y;
35
43
  }
36
44
  });
37
45
  //#endregion
38
- export { p as default };
46
+ export { m as default };
@@ -29,22 +29,27 @@ var x = _("<span></span>"), S = _(" "), C = _("<span>"), w = _("<label><input ty
29
29
  emits: /* @__PURE__ */ l(["change"], ["update:modelValue"]),
30
30
  __multiRoot: !1,
31
31
  setup(s, { emit: l, slots: _ }) {
32
- let T = s, E = l, D = e("radio"), O = c(t, void 0), k = b(s, "modelValue"), A = r(() => O?.checkedValue.value === T.value), j = (e) => {
33
- e.target.checked && (k.value = T.value), O?.checked(k.value), E("change", k.value, e);
34
- }, M = w(), N = n(M);
35
- return u(N, "change", a(j)), d(() => {
36
- let e = y(D);
37
- f(M, [e.b(), e.m(s.size)]), f(N, [e.e("input")]), g(N, s.value), m(N, "checked", A.value);
38
- }), p(M, null, 1), i(() => !_.check, () => {
32
+ let T = s, E = l, D = e("radio"), O = c(t, void 0), k = r(() => O?.button.value), A = b(s, "modelValue"), j = r(() => O?.checkedValue.value === T.value), M = (e) => {
33
+ e.target.checked && (A.value = T.value), O?.checked(A.value), E("change", A.value, e);
34
+ }, N = w(), P = n(N);
35
+ return u(P, "change", a(M)), d(() => {
36
+ let e = y(D), t = j.value;
37
+ f(N, [
38
+ e.b(),
39
+ e.m(s.size),
40
+ e.is("checked", t),
41
+ e.is("button", k.value)
42
+ ]), f(P, [e.e("input")]), g(P, s.value), m(P, "checked", t);
43
+ }), p(N, null, 1), i(() => !_.check, () => {
39
44
  let e = x(), t = C();
40
45
  return d(() => {
41
46
  let n = y(D);
42
- f(e, [n.e("inner"), n.is("checked", A.value)]), f(t, [n.e("label")]);
47
+ f(e, [n.e("inner")]), f(t, [n.e("label")]);
43
48
  }), p(t, null, 0), o("default", null, () => {
44
49
  let e = S();
45
50
  return d(() => h(e, v(s.label))), e;
46
51
  }), [e, t];
47
- }, null, 2), p(M, null, 2), o("check", { checked: () => A.value }), M;
52
+ }, null, 2), p(N, null, 2), o("check", { checked: () => j.value }), N;
48
53
  }
49
54
  });
50
55
  //#endregion