vue-modal-utils 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.
@@ -0,0 +1,33 @@
1
+ import type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types';
2
+ /**
3
+ * 配置 `vue-modal-utils` 的全局行为。
4
+ *
5
+ * @param config - 全局配置。
6
+ * @public
7
+ */
8
+ export declare function configureModalUtils(config?: ModalGlobalConfig): void;
9
+ /**
10
+ * 展示单按钮底部弹窗。
11
+ *
12
+ * @param options - 弹窗展示参数。
13
+ * @returns 用户关闭弹窗后的完成信号。
14
+ * @public
15
+ */
16
+ export declare function showCommonBottomPopup(options?: ShowCommonBottomPopupOptions): Promise<void>;
17
+ /**
18
+ * `showCommonBottomPopup` 的别名。
19
+ *
20
+ * @public
21
+ */
22
+ export declare const showBottomTip: typeof showCommonBottomPopup;
23
+ /**
24
+ * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。
25
+ *
26
+ * @param options - 弹窗展示参数。
27
+ * @returns Promise resolve 为关闭动作类型。
28
+ * @remarks
29
+ * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。
30
+ * @public
31
+ */
32
+ export declare function showModal(options?: ShowModalOptions): Promise<ModalAction>;
33
+ export type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types';
@@ -0,0 +1,92 @@
1
+ import type { Component, VNodeChild } from 'vue';
2
+ /**
3
+ * `vue-modal-utils` 全局配置项。
4
+ *
5
+ * @public
6
+ */
7
+ export interface ModalGlobalConfig {
8
+ /** 动画时长,支持数字(毫秒)或 CSS 时间字符串(如 `300ms`、`0.3s`)。 */
9
+ animationDuration?: number | string;
10
+ }
11
+ /**
12
+ * `showCommonBottomPopup` 的入参。
13
+ *
14
+ * @public
15
+ */
16
+ export interface ShowCommonBottomPopupOptions {
17
+ title?: string;
18
+ message?: string;
19
+ buttonText?: string;
20
+ showClose?: boolean;
21
+ animationDuration?: number | string;
22
+ }
23
+ /**
24
+ * 多按钮模式下的按钮配置。
25
+ *
26
+ * @public
27
+ */
28
+ export interface ModalButton {
29
+ text: string;
30
+ type?: string;
31
+ key?: string;
32
+ onClick?: () => void;
33
+ }
34
+ /**
35
+ * 弹窗关闭/交互动作。
36
+ *
37
+ * @public
38
+ */
39
+ export type ModalAction = 'confirm' | 'cancel' | 'overlay' | 'close' | string;
40
+ /**
41
+ * 自定义内容渲染方式。
42
+ *
43
+ * @public
44
+ */
45
+ export type ModalContent = (() => VNodeChild) | {
46
+ render: () => VNodeChild;
47
+ } | null;
48
+ /**
49
+ * `showModal` 的入参。
50
+ *
51
+ * @public
52
+ */
53
+ export interface ShowModalOptions {
54
+ position?: 'bottom' | 'center' | 'top';
55
+ title?: string;
56
+ message?: string;
57
+ confirmText?: string;
58
+ cancelText?: string;
59
+ showCancelButton?: boolean;
60
+ showClose?: boolean;
61
+ content?: ModalContent;
62
+ component?: Component | null;
63
+ componentProps?: Record<string, unknown>;
64
+ modalComponent?: Component | null;
65
+ modalComponentProps?: Record<string, unknown>;
66
+ buttons?: ModalButton[] | null;
67
+ onOpen?: () => void;
68
+ onClose?: () => void;
69
+ beforeClose?: (action: ModalAction, payload?: unknown) => Promise<boolean | void> | boolean | void;
70
+ animationDuration?: number | string;
71
+ }
72
+ /**
73
+ * `ModalRenderer` 组件的 Props。
74
+ *
75
+ * @public
76
+ */
77
+ export interface ModalRendererProps {
78
+ show?: boolean;
79
+ position?: 'bottom' | 'center' | 'top';
80
+ title?: string;
81
+ message?: string;
82
+ confirmText?: string;
83
+ cancelText?: string;
84
+ showCancelButton?: boolean;
85
+ showClose?: boolean;
86
+ content?: ModalContent;
87
+ component?: Component | null;
88
+ componentProps?: Record<string, unknown>;
89
+ modalComponent?: Component | null;
90
+ modalComponentProps?: Record<string, unknown>;
91
+ buttons?: ModalButton[] | null;
92
+ }
@@ -1 +1 @@
1
- .validate-popup .validate-content[data-v-d8ab28e4]{padding:16px}.validate-popup .validate-card[data-v-d8ab28e4]{background:#fff;border-radius:8px;padding:14px 16px 16px}.validate-popup .popup-header[data-v-d8ab28e4]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.validate-popup .popup-header .title[data-v-d8ab28e4]{margin-left:auto;font-size:16px;font-weight:600;line-height:1;color:#333}.validate-popup .popup-header .icon[data-v-d8ab28e4]{padding:8px;margin-left:auto}.validate-popup .validate-text[data-v-d8ab28e4]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.validate-popup .validate-btn[data-v-d8ab28e4]{background-color:#ff5712;border-radius:6px;border-width:0;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-content[data-v-c1845810]{padding:16px}.modal-renderer-popup .modal-renderer-header[data-v-c1845810]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.modal-renderer-popup .modal-renderer-header .modal-renderer-title[data-v-c1845810]{flex:1;text-align:center;font-size:16px;font-weight:600;line-height:1;color:#333}.modal-renderer-popup .modal-renderer-header .modal-renderer-close[data-v-c1845810]{padding:8px}.modal-renderer-popup .modal-renderer-body[data-v-c1845810]{background:#fff;border-radius:8px;padding:14px 16px 16px;min-height:40px}.modal-renderer-popup .modal-renderer-text[data-v-c1845810],.modal-renderer-popup .modal-renderer-message[data-v-c1845810]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.modal-renderer-popup .modal-renderer-footer[data-v-c1845810]{display:flex;align-items:center;gap:12px;margin-top:16px}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn[data-v-c1845810]{flex:1;border-radius:6px;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-cancel[data-v-c1845810]{border:1px solid #dcdee0;color:#333;background:#fff}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-confirm[data-v-c1845810]{background-color:#ff5712;border:none}
1
+ .validate-popup .validate-content[data-v-04db935a]{padding:16px}.validate-popup .validate-card[data-v-04db935a]{background:#fff;border-radius:8px;padding:14px 16px 16px}.validate-popup .popup-header[data-v-04db935a]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.validate-popup .popup-header .title[data-v-04db935a]{margin-left:auto;font-size:16px;font-weight:600;line-height:1;color:#333}.validate-popup .popup-header .icon[data-v-04db935a]{padding:8px;margin-left:auto}.validate-popup .validate-text[data-v-04db935a]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.validate-popup .validate-btn[data-v-04db935a]{background-color:#ff5712;border-radius:6px;border-width:0;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-content[data-v-81792d1e]{padding:16px}.modal-renderer-popup .modal-renderer-header[data-v-81792d1e]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.modal-renderer-popup .modal-renderer-header .modal-renderer-title[data-v-81792d1e]{flex:1;text-align:center;font-size:16px;font-weight:600;line-height:1;color:#333}.modal-renderer-popup .modal-renderer-header .modal-renderer-close[data-v-81792d1e]{padding:8px}.modal-renderer-popup .modal-renderer-body[data-v-81792d1e]{background:#fff;border-radius:8px;padding:14px 16px 16px;min-height:40px}.modal-renderer-popup .modal-renderer-text[data-v-81792d1e],.modal-renderer-popup .modal-renderer-message[data-v-81792d1e]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.modal-renderer-popup .modal-renderer-footer[data-v-81792d1e]{display:flex;align-items:center;gap:12px;margin-top:16px}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn[data-v-81792d1e]{flex:1;border-radius:6px;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-cancel[data-v-81792d1e]{border:1px solid #dcdee0;color:#333;background:#fff}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-confirm[data-v-81792d1e]{background-color:#ff5712;border:none}
@@ -1,10 +1,10 @@
1
- import { createApp as Q, openBlock as l, createBlock as d, withCtx as b, createElementVNode as f, createCommentVNode as _, toDisplayString as C, createVNode as $, createTextVNode as T, ref as N, watch as W, computed as P, defineComponent as X, resolveDynamicComponent as U, mergeProps as Y, createElementBlock as x, Fragment as D, unref as Z, renderList as tt, h as A } from "vue";
2
- import { Popup as F, Icon as j, Button as q } from "vant/es";
1
+ import { createApp as W, defineComponent as M, openBlock as l, createBlock as d, withCtx as _, createElementVNode as f, createCommentVNode as b, toDisplayString as C, createVNode as S, createTextVNode as T, ref as V, watch as X, computed as P, resolveDynamicComponent as F, mergeProps as Y, createElementBlock as g, Fragment as D, unref as Z, renderList as ee, h as B } from "vue";
2
+ import { Popup as z, Icon as E, Button as q } from "vant/es";
3
3
  import "vant/es/popup/style/index";
4
4
  import "vant/es/button/style/index";
5
5
  import "vant/es/icon/style/index";
6
- function z(t, o = {}) {
7
- const { unmountDelay: e = 0, parent: n = document.body } = o, a = Q(t), r = document.createElement("div");
6
+ function j(e, o = {}) {
7
+ const { unmountDelay: t = 0, parent: n = document.body } = o, a = W(e), r = document.createElement("div");
8
8
  n.appendChild(r);
9
9
  const m = a.mount(r), c = () => {
10
10
  a.unmount(), r.remove();
@@ -13,69 +13,64 @@ function z(t, o = {}) {
13
13
  const p = () => {
14
14
  c(), u == null || u();
15
15
  };
16
- e > 0 ? setTimeout(p, e) : p();
16
+ t > 0 ? setTimeout(p, t) : p();
17
17
  } };
18
18
  }
19
- const E = (t, o) => {
20
- const e = t.__vccOpts || t;
21
- for (const [n, a] of o)
22
- e[n] = a;
23
- return e;
24
- }, et = { class: "validate-content" }, nt = { class: "popup-header" }, ot = { class: "title" }, st = { class: "validate-card" }, at = { class: "validate-text" }, rt = {
19
+ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = { class: "title" }, se = { class: "validate-card" }, ae = { class: "validate-text" }, re = /* @__PURE__ */ M({
25
20
  __name: "BottomPopup",
26
21
  props: {
27
22
  show: { type: Boolean, default: !1 },
28
- title: { type: String, default: "提示" },
29
- message: { type: String, required: !0 },
30
- buttonText: { type: String, default: "知道了" },
23
+ title: { default: "提示" },
24
+ message: {},
25
+ buttonText: { default: "知道了" },
31
26
  showClose: { type: Boolean, default: !0 }
32
27
  },
33
28
  emits: ["update:show", "confirm"],
34
- setup(t, { emit: o }) {
35
- const e = t, n = o, a = () => {
29
+ setup(e, { emit: o }) {
30
+ const t = e, n = o, a = () => {
36
31
  n("update:show", !1);
37
32
  }, r = () => {
38
33
  n("confirm");
39
34
  };
40
35
  return (m, c) => {
41
- const u = j, p = q, w = F;
36
+ const u = E, p = q, w = z;
42
37
  return l(), d(w, {
43
- show: e.show,
44
- "onUpdate:show": c[0] || (c[0] = (i) => e.show = i),
38
+ show: t.show,
39
+ "onUpdate:show": c[0] || (c[0] = (i) => t.show = i),
45
40
  position: "bottom",
46
41
  round: !0,
47
42
  class: "validate-popup",
48
43
  "close-on-click-overlay": !0
49
44
  }, {
50
- default: b(() => [
51
- f("div", et, [
52
- f("div", nt, [
53
- e.showClose ? (l(), d(u, {
45
+ default: _(() => [
46
+ f("div", te, [
47
+ f("div", ne, [
48
+ t.showClose ? (l(), d(u, {
54
49
  key: 0,
55
50
  name: "cross",
56
51
  size: "20",
57
52
  style: { visibility: "hidden", padding: "8px" }
58
- })) : _("", !0),
59
- f("div", ot, C(e.title), 1),
60
- e.showClose ? (l(), d(u, {
53
+ })) : b("", !0),
54
+ f("div", oe, C(t.title), 1),
55
+ t.showClose ? (l(), d(u, {
61
56
  key: 1,
62
57
  class: "icon",
63
58
  name: "cross",
64
59
  size: "20",
65
60
  color: "#999",
66
61
  onClick: a
67
- })) : _("", !0)
62
+ })) : b("", !0)
68
63
  ]),
69
- f("div", st, [
70
- f("p", at, C(e.message), 1),
71
- $(p, {
64
+ f("div", se, [
65
+ f("p", ae, C(t.message), 1),
66
+ S(p, {
72
67
  type: "primary",
73
68
  block: "",
74
69
  class: "validate-btn",
75
70
  onClick: r
76
71
  }, {
77
- default: b(() => [
78
- T(C(e.buttonText), 1)
72
+ default: _(() => [
73
+ T(C(t.buttonText), 1)
79
74
  ]),
80
75
  _: 1
81
76
  })
@@ -86,146 +81,151 @@ const E = (t, o) => {
86
81
  }, 8, ["show"]);
87
82
  };
88
83
  }
89
- }, ct = /* @__PURE__ */ E(rt, [["__scopeId", "data-v-d8ab28e4"]]), lt = { class: "modal-renderer-content" }, ut = { class: "modal-renderer-header" }, it = { class: "modal-renderer-title" }, mt = { class: "modal-renderer-body" }, dt = {
84
+ }), L = (e, o) => {
85
+ const t = e.__vccOpts || e;
86
+ for (const [n, a] of o)
87
+ t[n] = a;
88
+ return t;
89
+ }, ce = /* @__PURE__ */ L(re, [["__scopeId", "data-v-04db935a"]]), le = { class: "modal-renderer-content" }, ue = { class: "modal-renderer-header" }, ie = { class: "modal-renderer-title" }, me = { class: "modal-renderer-body" }, de = {
90
90
  key: 0,
91
91
  class: "modal-renderer-text"
92
- }, ft = { class: "modal-renderer-footer" }, pt = {
92
+ }, fe = { class: "modal-renderer-footer" }, pe = /* @__PURE__ */ M({
93
93
  __name: "ModalRenderer",
94
94
  props: {
95
95
  show: { type: Boolean, default: !0 },
96
- position: { type: String, default: "bottom" },
97
- title: { type: String, default: "提示" },
98
- message: { type: String, default: "" },
99
- confirmText: { type: String, default: "确认" },
100
- cancelText: { type: String, default: "取消" },
96
+ position: { default: "bottom" },
97
+ title: { default: "提示" },
98
+ message: { default: "" },
99
+ confirmText: { default: "确认" },
100
+ cancelText: { default: "取消" },
101
101
  showCancelButton: { type: Boolean, default: !1 },
102
102
  showClose: { type: Boolean, default: !0 },
103
- content: { type: [Function, Object], default: null },
104
- component: { type: [Object, Function], default: null },
105
- componentProps: { type: Object, default: () => ({}) },
106
- modalComponent: { type: [Object, Function], default: null },
107
- modalComponentProps: { type: Object, default: () => ({}) },
108
- buttons: { type: Array, default: null }
103
+ content: { type: [Function, Object, null], default: null },
104
+ component: { default: null },
105
+ componentProps: { default: () => ({}) },
106
+ modalComponent: { default: null },
107
+ modalComponentProps: { default: () => ({}) },
108
+ buttons: { default: null }
109
109
  },
110
- emits: ["update:show", "confirm", "cancel", "action", "close"],
111
- setup(t, { emit: o }) {
112
- const e = t, n = o, a = N(e.show);
113
- W(
114
- () => e.show,
110
+ emits: ["update:show", "confirm", "cancel", "close", "action"],
111
+ setup(e, { emit: o }) {
112
+ const t = e, n = o, a = V(t.show);
113
+ X(
114
+ () => t.show,
115
115
  (s) => {
116
116
  a.value = s;
117
117
  }
118
118
  );
119
- const r = P(() => e.content || e.component), m = P(() => Array.isArray(e.buttons) && e.buttons.length > 0), c = () => n("action", "overlay"), u = () => {
119
+ const r = P(() => !!(t.content || t.component)), m = P(() => Array.isArray(t.buttons) && t.buttons.length > 0), c = () => n("action", "overlay"), u = () => {
120
120
  n("confirm"), n("action", "confirm");
121
121
  }, p = () => {
122
122
  n("cancel"), n("action", "cancel");
123
123
  }, w = (s, v) => {
124
- const g = s.key ?? String(v);
125
- n("action", g), typeof s.onClick == "function" && s.onClick();
124
+ const x = s.key ?? String(v);
125
+ n("action", x), typeof s.onClick == "function" && s.onClick();
126
126
  }, i = () => n("action", "close"), y = (s) => {
127
127
  a.value = s, n("update:show", s), s || n("action", "close");
128
- }, h = (s, v) => n("action", s, v), S = (s) => n("action", "confirm", s), V = (s) => n("action", "cancel", s), O = (s) => n("action", "close", s), R = () => {
128
+ }, h = (s, v) => n("action", s, v), I = (s) => n("action", "confirm", s), U = (s) => n("action", "cancel", s), O = (s) => n("action", "close", s), H = () => {
129
129
  var s;
130
- return e.component ? A(e.component, e.componentProps) : typeof e.content == "function" ? e.content() : (s = e.content) != null && s.render ? e.content.render() : e.message ? A("p", { class: "modal-renderer-message" }, e.message) : null;
131
- }, H = X({
130
+ return t.component ? B(t.component, t.componentProps) : typeof t.content == "function" ? t.content() : (s = t.content) != null && s.render ? t.content.render() : t.message ? B("p", { class: "modal-renderer-message" }, t.message) : null;
131
+ }, J = M({
132
132
  setup() {
133
- return () => R();
133
+ return () => H();
134
134
  }
135
- }), J = P(() => ({
136
- ...e.modalComponentProps,
135
+ }), K = P(() => ({
136
+ ...t.modalComponentProps,
137
137
  show: a.value,
138
- position: e.position,
139
- title: e.title,
140
- message: e.message,
141
- confirmText: e.confirmText,
142
- cancelText: e.cancelText,
143
- showCancelButton: e.showCancelButton,
144
- showClose: e.showClose,
145
- content: e.content,
146
- component: e.component,
147
- componentProps: e.componentProps,
148
- buttons: e.buttons,
138
+ position: t.position,
139
+ title: t.title,
140
+ message: t.message,
141
+ confirmText: t.confirmText,
142
+ cancelText: t.cancelText,
143
+ showCancelButton: t.showCancelButton,
144
+ showClose: t.showClose,
145
+ content: t.content,
146
+ component: t.component,
147
+ componentProps: t.componentProps,
148
+ buttons: t.buttons,
149
149
  requestAction: h,
150
- requestConfirm: S,
151
- requestCancel: V,
150
+ requestConfirm: I,
151
+ requestCancel: U,
152
152
  requestClose: O
153
153
  }));
154
154
  return (s, v) => {
155
- const g = j, B = q, K = F;
156
- return t.modalComponent ? (l(), d(U(t.modalComponent), Y({ key: 0 }, J.value, {
155
+ const x = E, A = q, Q = z;
156
+ return e.modalComponent ? (l(), d(F(e.modalComponent), Y({ key: 0 }, K.value, {
157
157
  "onUpdate:show": y,
158
158
  onAction: h,
159
- onConfirm: S,
160
- onCancel: V,
159
+ onConfirm: I,
160
+ onCancel: U,
161
161
  onClose: O
162
- }), null, 16)) : (l(), d(K, {
162
+ }), null, 16)) : (l(), d(Q, {
163
163
  key: 1,
164
164
  show: a.value,
165
165
  "onUpdate:show": [
166
166
  v[0] || (v[0] = (k) => a.value = k),
167
167
  y
168
168
  ],
169
- position: t.position,
170
- round: t.position === "bottom",
169
+ position: e.position,
170
+ round: e.position === "bottom",
171
171
  class: "modal-renderer-popup",
172
172
  "close-on-click-overlay": !1,
173
173
  onClickOverlay: c
174
174
  }, {
175
- default: b(() => [
176
- f("div", lt, [
177
- f("div", ut, [
178
- t.showClose ? (l(), d(g, {
175
+ default: _(() => [
176
+ f("div", le, [
177
+ f("div", ue, [
178
+ e.showClose ? (l(), d(x, {
179
179
  key: 0,
180
180
  name: "cross",
181
181
  size: "20",
182
182
  style: { visibility: "hidden", padding: "8px" }
183
- })) : _("", !0),
184
- f("div", it, C(t.title), 1),
185
- t.showClose ? (l(), d(g, {
183
+ })) : b("", !0),
184
+ f("div", ie, C(e.title), 1),
185
+ e.showClose ? (l(), d(x, {
186
186
  key: 1,
187
187
  class: "modal-renderer-close",
188
188
  name: "cross",
189
189
  size: "20",
190
190
  color: "#999",
191
191
  onClick: i
192
- })) : _("", !0)
192
+ })) : b("", !0)
193
193
  ]),
194
- f("div", mt, [
195
- r.value ? (l(), d(U(Z(H)), { key: 1 })) : (l(), x(D, { key: 0 }, [
196
- t.message ? (l(), x("p", dt, C(t.message), 1)) : _("", !0)
194
+ f("div", me, [
195
+ r.value ? (l(), d(F(Z(J)), { key: 1 })) : (l(), g(D, { key: 0 }, [
196
+ e.message ? (l(), g("p", de, C(e.message), 1)) : b("", !0)
197
197
  ], 64))
198
198
  ]),
199
- f("div", ft, [
200
- m.value ? (l(!0), x(D, { key: 0 }, tt(t.buttons, (k, I) => (l(), d(B, {
201
- key: I,
199
+ f("div", fe, [
200
+ m.value ? (l(!0), g(D, { key: 0 }, ee(e.buttons, (k, $) => (l(), d(A, {
201
+ key: $,
202
202
  type: k.type || "default",
203
203
  class: "modal-renderer-btn",
204
- onClick: (bt) => w(k, I)
204
+ onClick: (_e) => w(k, $)
205
205
  }, {
206
- default: b(() => [
206
+ default: _(() => [
207
207
  T(C(k.text), 1)
208
208
  ]),
209
209
  _: 2
210
- }, 1032, ["type", "onClick"]))), 128)) : (l(), x(D, { key: 1 }, [
211
- t.showCancelButton ? (l(), d(B, {
210
+ }, 1032, ["type", "onClick"]))), 128)) : (l(), g(D, { key: 1 }, [
211
+ e.showCancelButton ? (l(), d(A, {
212
212
  key: 0,
213
213
  type: "default",
214
214
  class: "modal-renderer-btn modal-renderer-btn-cancel",
215
215
  onClick: p
216
216
  }, {
217
- default: b(() => [
218
- T(C(t.cancelText), 1)
217
+ default: _(() => [
218
+ T(C(e.cancelText), 1)
219
219
  ]),
220
220
  _: 1
221
- })) : _("", !0),
222
- $(B, {
221
+ })) : b("", !0),
222
+ S(A, {
223
223
  type: "primary",
224
224
  class: "modal-renderer-btn modal-renderer-btn-confirm",
225
225
  onClick: u
226
226
  }, {
227
- default: b(() => [
228
- T(C(t.confirmText), 1)
227
+ default: _(() => [
228
+ T(C(e.confirmText), 1)
229
229
  ]),
230
230
  _: 1
231
231
  })
@@ -237,115 +237,115 @@ const E = (t, o) => {
237
237
  }, 8, ["show", "position", "round"]));
238
238
  };
239
239
  }
240
- }, ht = /* @__PURE__ */ E(pt, [["__scopeId", "data-v-c1845810"]]), Ct = 300, yt = ["--van-duration-base", "--van-animation-duration-base"], L = {
240
+ }), he = /* @__PURE__ */ L(pe, [["__scopeId", "data-v-81792d1e"]]), Ce = 300, ye = ["--van-duration-base", "--van-animation-duration-base"], G = {
241
241
  animationDuration: void 0
242
242
  };
243
- function M(t) {
243
+ function N(e) {
244
244
  var r;
245
- if (typeof t == "number" && Number.isFinite(t))
246
- return Math.max(0, Math.round(t));
247
- if (typeof t != "string") return null;
248
- const o = (r = t.trim().split(",")[0]) == null ? void 0 : r.trim();
245
+ if (typeof e == "number" && Number.isFinite(e))
246
+ return Math.max(0, Math.round(e));
247
+ if (typeof e != "string") return null;
248
+ const o = (r = e.trim().split(",")[0]) == null ? void 0 : r.trim();
249
249
  if (!o) return null;
250
- const e = o.match(/^(-?\d+(?:\.\d+)?)ms$/i);
251
- if (e) return Math.max(0, Math.round(Number(e[1])));
250
+ const t = o.match(/^(-?\d+(?:\.\d+)?)ms$/i);
251
+ if (t) return Math.max(0, Math.round(Number(t[1])));
252
252
  const n = o.match(/^(-?\d+(?:\.\d+)?)s$/i);
253
253
  if (n) return Math.max(0, Math.round(Number(n[1]) * 1e3));
254
254
  const a = Number(o);
255
255
  return Number.isFinite(a) ? Math.max(0, Math.round(a)) : null;
256
256
  }
257
- function wt() {
257
+ function we() {
258
258
  if (typeof window > "u" || typeof document > "u") return null;
259
- const t = window.getComputedStyle(document.documentElement);
260
- for (const o of yt) {
261
- const e = t.getPropertyValue(o), n = M(e);
259
+ const e = window.getComputedStyle(document.documentElement);
260
+ for (const o of ye) {
261
+ const t = e.getPropertyValue(o), n = N(t);
262
262
  if (n !== null) return n;
263
263
  }
264
264
  return null;
265
265
  }
266
- function G(t = {}) {
267
- const o = M(t.animationDuration);
266
+ function R(e = {}) {
267
+ const o = N(e.animationDuration);
268
268
  if (o !== null) return o;
269
- const e = M(L.animationDuration);
270
- if (e !== null) return e;
271
- const n = wt();
272
- return n !== null ? n : Ct;
269
+ const t = N(G.animationDuration);
270
+ if (t !== null) return t;
271
+ const n = we();
272
+ return n !== null ? n : Ce;
273
273
  }
274
- function At(t = {}) {
275
- !t || typeof t != "object" || "animationDuration" in t && (L.animationDuration = t.animationDuration);
274
+ function Be(e = {}) {
275
+ !e || typeof e != "object" || "animationDuration" in e && (G.animationDuration = e.animationDuration);
276
276
  }
277
- function vt(t = {}) {
277
+ function ve(e = {}) {
278
278
  return new Promise((o) => {
279
- const e = { fn: null }, n = G(t), { unmount: a } = z(
279
+ const t = { fn: null }, n = R(e), { unmount: a } = j(
280
280
  {
281
281
  setup() {
282
- const r = N(!0), m = () => {
282
+ const r = V(!0), m = () => {
283
283
  var c;
284
- r.value = !1, (c = e.fn) == null || c.call(e);
284
+ r.value = !1, (c = t.fn) == null || c.call(t);
285
285
  };
286
- return () => A(ct, {
286
+ return () => B(ce, {
287
287
  show: r.value,
288
288
  "onUpdate:show": (c) => {
289
289
  var u;
290
- r.value = c, c || (u = e.fn) == null || u.call(e);
290
+ r.value = c, c || (u = t.fn) == null || u.call(t);
291
291
  },
292
- title: t.title ?? "提示",
293
- message: t.message ?? "",
294
- buttonText: t.buttonText ?? "知道了",
295
- showClose: t.showClose ?? !0,
292
+ title: e.title ?? "提示",
293
+ message: e.message ?? "",
294
+ buttonText: e.buttonText ?? "知道了",
295
+ showClose: e.showClose ?? !0,
296
296
  onConfirm: m
297
297
  });
298
298
  }
299
299
  },
300
300
  { unmountDelay: n }
301
301
  );
302
- e.fn = () => a(() => o());
302
+ t.fn = () => a(() => o());
303
303
  });
304
304
  }
305
- const Bt = vt;
306
- function Pt(t = {}) {
307
- return new Promise((o, e) => {
305
+ const Ae = ve;
306
+ function Pe(e = {}) {
307
+ return new Promise((o, t) => {
308
308
  var w;
309
- const n = { fn: null }, a = G(t), r = N(!0);
309
+ const n = { fn: null }, a = R(e), r = V(!0);
310
310
  let m = !1;
311
311
  const c = (i) => {
312
312
  var y, h;
313
- m || (m = !0, r.value = !1, (y = t.onClose) == null || y.call(t), (h = n.fn) == null || h.call(n, i));
313
+ m || (m = !0, r.value = !1, (y = e.onClose) == null || y.call(e), (h = n.fn) == null || h.call(n, i));
314
314
  }, u = async (i, y) => {
315
315
  if (!m) {
316
- if (typeof t.beforeClose == "function")
316
+ if (typeof e.beforeClose == "function")
317
317
  try {
318
- if (await t.beforeClose(i, y) === !1) return;
318
+ if (await e.beforeClose(i, y) === !1) return;
319
319
  } catch (h) {
320
- e(h);
320
+ t(h);
321
321
  return;
322
322
  }
323
323
  c(i);
324
324
  }
325
325
  };
326
- (w = t.onOpen) == null || w.call(t);
327
- const { unmount: p } = z(
326
+ (w = e.onOpen) == null || w.call(e);
327
+ const { unmount: p } = j(
328
328
  {
329
329
  setup() {
330
- return () => A(ht, {
330
+ return () => B(he, {
331
331
  show: r.value,
332
332
  "onUpdate:show": (i) => {
333
333
  r.value = i;
334
334
  },
335
335
  onAction: u,
336
- position: t.position ?? "bottom",
337
- title: t.title ?? "提示",
338
- message: t.message ?? "",
339
- confirmText: t.confirmText ?? "确认",
340
- cancelText: t.cancelText ?? "取消",
341
- showCancelButton: t.showCancelButton ?? !1,
342
- showClose: t.showClose ?? !0,
343
- content: t.content ?? null,
344
- component: t.component ?? null,
345
- componentProps: t.componentProps ?? {},
346
- modalComponent: t.modalComponent ?? null,
347
- modalComponentProps: t.modalComponentProps ?? {},
348
- buttons: t.buttons ?? null
336
+ position: e.position ?? "bottom",
337
+ title: e.title ?? "提示",
338
+ message: e.message ?? "",
339
+ confirmText: e.confirmText ?? "确认",
340
+ cancelText: e.cancelText ?? "取消",
341
+ showCancelButton: e.showCancelButton ?? !1,
342
+ showClose: e.showClose ?? !0,
343
+ content: e.content ?? null,
344
+ component: e.component ?? null,
345
+ componentProps: e.componentProps ?? {},
346
+ modalComponent: e.modalComponent ?? null,
347
+ modalComponentProps: e.modalComponentProps ?? {},
348
+ buttons: e.buttons ?? null
349
349
  });
350
350
  }
351
351
  },
@@ -355,9 +355,9 @@ function Pt(t = {}) {
355
355
  });
356
356
  }
357
357
  export {
358
- At as configureModalUtils,
359
- Bt as showBottomTip,
360
- vt as showCommonBottomPopup,
361
- Pt as showModal
358
+ Be as configureModalUtils,
359
+ Ae as showBottomTip,
360
+ ve as showCommonBottomPopup,
361
+ Pe as showModal
362
362
  };
363
363
  //# sourceMappingURL=vue-modal-utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-modal-utils.mjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.js"],"sourcesContent":["import { createApp as a } from \"vue\";\nfunction l(m, c = {}) {\n const { unmountDelay: u = 0, parent: r = document.body } = c, n = a(m), t = document.createElement(\"div\");\n r.appendChild(t);\n const p = n.mount(t), s = () => {\n n.unmount(), t.remove();\n };\n return { app: n, instance: p, container: t, unmount: (o) => {\n const e = () => {\n s(), o == null || o();\n };\n u > 0 ? setTimeout(e, u) : e();\n } };\n}\nexport {\n l as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup>\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n const props = defineProps({\n show: { type: Boolean, default: false },\n title: { type: String, default: '提示' },\n message: { type: String, required: true },\n buttonText: { type: String, default: '知道了' },\n showClose: { type: Boolean, default: true },\n })\n\n const emit = defineEmits(['update:show', 'confirm'])\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n v-model:show=\"props.show\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup>\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent } from 'vue'\n import { h } from 'vue'\n\n const props = defineProps({\n show: { type: Boolean, default: true },\n position: { type: String, default: 'bottom' },\n title: { type: String, default: '提示' },\n message: { type: String, default: '' },\n confirmText: { type: String, default: '确认' },\n cancelText: { type: String, default: '取消' },\n showCancelButton: { type: Boolean, default: false },\n showClose: { type: Boolean, default: true },\n content: { type: [Function, Object], default: null },\n component: { type: [Object, Function], default: null },\n componentProps: { type: Object, default: () => ({}) },\n modalComponent: { type: [Object, Function], default: null },\n modalComponentProps: { type: Object, default: () => ({}) },\n buttons: { type: Array, default: null },\n })\n\n const emit = defineEmits(['update:show', 'confirm', 'cancel', 'action', 'close'])\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => props.content || props.component)\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn, index) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action, payload) => emit('action', action, payload)\n const onCustomConfirm = (payload) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload) => emit('action', 'cancel', payload)\n const onCustomClose = (payload) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n ...props.modalComponentProps,\n show: internalShow.value,\n position: props.position,\n title: props.title,\n message: props.message,\n confirmText: props.confirmText,\n cancelText: props.cancelText,\n showCancelButton: props.showCancelButton,\n showClose: props.showClose,\n content: props.content,\n component: props.component,\n componentProps: props.componentProps,\n buttons: props.buttons,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"position === 'bottom'\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * vue-modal-utils\n * 弹窗命令式调用 API:showCommonBottomPopup、showModal、showBottomTip\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value) {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar() {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\nfunction resolveAnimationDuration(options = {}) {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(modalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n\n/**\n * 配置 vue-modal-utils 的全局行为\n * @param {Object} [config]\n * @param {number|string} [config.animationDuration] - 动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n */\nexport function configureModalUtils(config = {}) {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * Phase 1: 单按钮底部弹窗\n * @param {Object} options\n * @param {string} [options.title='提示']\n * @param {string} options.message\n * @param {string} [options.buttonText='知道了']\n * @param {boolean} [options.showClose=true]\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<void>}\n */\nexport function showCommonBottomPopup(options = {}) {\n return new Promise((resolve) => {\n const closeRef = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/** showCommonBottomPopup 的别名 */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * Phase 2/3: 统一弹窗 API\n * @param {Object} options\n * @param {'bottom'|'center'|'top'} [options.position='bottom']\n * @param {string} [options.title='提示']\n * @param {string} [options.message]\n * @param {string} [options.confirmText='确认']\n * @param {string} [options.cancelText='取消']\n * @param {boolean} [options.showCancelButton=false]\n * @param {boolean} [options.showClose=true]\n * @param {Function|Object} [options.content] - 渲染函数 () => VNode\n * @param {Object|Function} [options.component] - 业务组件\n * @param {Object} [options.componentProps] - 组件 props\n * @param {Object|Function} [options.modalComponent] - 完全自定义弹窗组件\n * @param {Object} [options.modalComponentProps] - 完全自定义弹窗组件 props\n * @param {Array} [options.buttons] - [{ text, type?, key? }]\n * @param {Function} [options.onOpen]\n * @param {Function} [options.onClose]\n * @param {Function} [options.beforeClose] - async, 返回 false 可阻止关闭;签名 (action, payload)\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<'confirm'|'cancel'|'overlay'|'close'|string>}\n */\nexport function showModal(options = {}) {\n return new Promise((resolve, reject) => {\n const closeRef = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n const finish = (action) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action, payload) => {\n if (resolved) return\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) return\n } catch (e) {\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n"],"names":["l","m","c","u","r","n","a","t","p","s","o","e","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","v","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","_a","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","modalConfig","parseAnimationDuration","value","normalized","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","fromCall","fromGlobalConfig","fromVantCssVar","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","finish","_b","handleAction","ModalRenderer"],"mappings":";;;;;AACA,SAASA,EAAEC,GAAGC,IAAI,IAAI;AACpB,QAAM,EAAE,cAAcC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AAEmD,IAAe;AAAA,YACf,MAAMV,EAAK;AAAA,YACX,iBAAiB,CAAC5D,MAAM;AACtB,cAAA4D,EAAK,QAAQ5D;AAAA,YACf;AAAA,YACA,UAAUqE;AAAA,YACV,UAAUrB,EAAQ,YAAY;AAAA,YAC9B,OAAOA,EAAQ,SAAS;AAAA,YACxB,SAASA,EAAQ,WAAW;AAAA,YAC5B,aAAaA,EAAQ,eAAe;AAAA,YACpC,YAAYA,EAAQ,cAAc;AAAA,YAClC,kBAAkBA,EAAQ,oBAAoB;AAAA,YAC9C,WAAWA,EAAQ,aAAa;AAAA,YAChC,SAASA,EAAQ,WAAW;AAAA,YAC5B,WAAWA,EAAQ,aAAa;AAAA,YAChC,gBAAgBA,EAAQ,kBAAkB,CAAA;AAAA,YAC1C,gBAAgBA,EAAQ,kBAAkB;AAAA,YAC1C,qBAAqBA,EAAQ,uBAAuB,CAAA;AAAA,YACpD,SAASA,EAAQ,WAAW;AAAA,UAC1C,CAAa;AAAA,QACL;AAAA,MACR;AAAA,MACM,EAAE,cAAAS,EAAY;AAAA,IACpB;AAEI,IAAAD,EAAS,KAAK,CAAC3C,MAAW6C,EAAQ,MAAMH,EAAQ1C,CAAM,CAAC;AAAA,EACzD,CAAC;AACH;"}
1
+ {"version":3,"file":"vue-modal-utils.mjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.ts"],"sourcesContent":["import { createApp as a } from \"vue\";\nfunction l(m, c = {}) {\n const { unmountDelay: u = 0, parent: r = document.body } = c, n = a(m), t = document.createElement(\"div\");\n r.appendChild(t);\n const p = n.mount(t), s = () => {\n n.unmount(), t.remove();\n };\n return { app: n, instance: p, container: t, unmount: (o) => {\n const e = () => {\n s(), o == null || o();\n };\n u > 0 ? setTimeout(e, u) : e();\n } };\n}\nexport {\n l as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup lang=\"ts\">\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n interface BottomPopupProps {\n show?: boolean\n title?: string\n message: string\n buttonText?: string\n showClose?: boolean\n }\n\n const props = withDefaults(defineProps<BottomPopupProps>(), {\n show: false,\n title: '提示',\n buttonText: '知道了',\n showClose: true,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n }>()\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n v-model:show=\"props.show\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent, h } from 'vue'\n import type { ModalAction, ModalButton, ModalRendererProps } from './types'\n\n const props = withDefaults(defineProps<ModalRendererProps>(), {\n show: true,\n position: 'bottom',\n title: '提示',\n message: '',\n confirmText: '确认',\n cancelText: '取消',\n showCancelButton: false,\n showClose: true,\n content: null,\n component: null,\n componentProps: () => ({}),\n modalComponent: null,\n modalComponentProps: () => ({}),\n buttons: null,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n (e: 'cancel'): void\n (e: 'close'): void\n (e: 'action', action: ModalAction, payload?: unknown): void\n }>()\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => !!(props.content || props.component))\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn: ModalButton, index: number) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v: boolean) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action: ModalAction, payload?: unknown) => emit('action', action, payload)\n const onCustomConfirm = (payload?: unknown) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload?: unknown) => emit('action', 'cancel', payload)\n const onCustomClose = (payload?: unknown) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n ...props.modalComponentProps,\n show: internalShow.value,\n position: props.position,\n title: props.title,\n message: props.message,\n confirmText: props.confirmText,\n cancelText: props.cancelText,\n showCancelButton: props.showCancelButton,\n showClose: props.showClose,\n content: props.content,\n component: props.component,\n componentProps: props.componentProps,\n buttons: props.buttons,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"position === 'bottom'\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * `vue-modal-utils` 弹窗命令式 API 入口。\n *\n * @packageDocumentation\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\nimport type {\n ModalAction,\n ModalGlobalConfig,\n ShowCommonBottomPopupOptions,\n ShowModalOptions,\n} from './types'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig: ModalGlobalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar(): number | null {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\nfunction resolveAnimationDuration(options: { animationDuration?: number | string } = {}): number {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(modalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n\n/**\n * 配置 `vue-modal-utils` 的全局行为。\n *\n * @param config - 全局配置。\n * @public\n */\nexport function configureModalUtils(config: ModalGlobalConfig = {}): void {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * 展示单按钮底部弹窗。\n *\n * @param options - 弹窗展示参数。\n * @returns 用户关闭弹窗后的完成信号。\n * @public\n */\nexport function showCommonBottomPopup(options: ShowCommonBottomPopupOptions = {}): Promise<void> {\n return new Promise((resolve) => {\n const closeRef: { fn: null | (() => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/**\n * `showCommonBottomPopup` 的别名。\n *\n * @public\n */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。\n *\n * @param options - 弹窗展示参数。\n * @returns Promise resolve 为关闭动作类型。\n * @remarks\n * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。\n * @public\n */\nexport function showModal(options: ShowModalOptions = {}): Promise<ModalAction> {\n return new Promise((resolve, reject) => {\n const closeRef: { fn: null | ((action: ModalAction) => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n const finish = (action: ModalAction) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action: ModalAction, payload?: unknown) => {\n if (resolved) return\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) return\n } catch (e) {\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n\nexport type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types'\n"],"names":["l","m","c","u","r","n","a","t","p","s","o","e","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","v","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","_a","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","modalConfig","parseAnimationDuration","value","normalized","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","fromCall","fromGlobalConfig","fromVantCssVar","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","finish","_b","handleAction","ModalRenderer"],"mappings":";;;;;AACA,SAASA,EAAEC,GAAGC,IAAI,IAAI;AACpB,QAAM,EAAE,cAAcC,IAAI,GAAG,QAAQC,IAAI,SAAS,KAAI,IAAKF,GAAGG,IAAIC,EAAEL,CAAC,GA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AAA,QACE,QAAQ;AACN,iBAAO,MACLxC,EAAEmD,IAAe;AAAA,YACf,MAAMV,EAAK;AAAA,YACX,iBAAiB,CAAC5D,MAAe;AAC/B,cAAA4D,EAAK,QAAQ5D;AAAA,YACf;AAAA,YACA,UAAUqE;AAAA,YACV,UAAUrB,EAAQ,YAAY;AAAA,YAC9B,OAAOA,EAAQ,SAAS;AAAA,YACxB,SAASA,EAAQ,WAAW;AAAA,YAC5B,aAAaA,EAAQ,eAAe;AAAA,YACpC,YAAYA,EAAQ,cAAc;AAAA,YAClC,kBAAkBA,EAAQ,oBAAoB;AAAA,YAC9C,WAAWA,EAAQ,aAAa;AAAA,YAChC,SAASA,EAAQ,WAAW;AAAA,YAC5B,WAAWA,EAAQ,aAAa;AAAA,YAChC,gBAAgBA,EAAQ,kBAAkB,CAAA;AAAA,YAC1C,gBAAgBA,EAAQ,kBAAkB;AAAA,YAC1C,qBAAqBA,EAAQ,uBAAuB,CAAA;AAAA,YACpD,SAASA,EAAQ,WAAW;AAAA,UAAA,CAC7B;AAAA,QACL;AAAA,MAAA;AAAA,MAEF,EAAE,cAAAS,EAAA;AAAA,IAAa;AAGjB,IAAAD,EAAS,KAAK,CAAC3C,MAAW6C,EAAQ,MAAMH,EAAQ1C,CAAM,CAAC;AAAA,EACzD,CAAC;AACH;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("vant/es");require("vant/es/popup/style/index");require("vant/es/button/style/index");require("vant/es/icon/style/index");function N(t,c={}){const{unmountDelay:o=0,parent:n=document.body}=c,r=e.createApp(t),s=document.createElement("div");n.appendChild(s);const m=r.mount(s),l=()=>{r.unmount(),s.remove()};return{app:r,instance:m,container:s,unmount:i=>{const d=()=>{l(),i==null||i()};o>0?setTimeout(d,o):d()}}}const V=(t,c)=>{const o=t.__vccOpts||t;for(const[n,r]of c)o[n]=r;return o},O={class:"validate-content"},I={class:"popup-header"},U={class:"title"},q={class:"validate-card"},F={class:"validate-text"},$={__name:"BottomPopup",props:{show:{type:Boolean,default:!1},title:{type:String,default:"提示"},message:{type:String,required:!0},buttonText:{type:String,default:"知道了"},showClose:{type:Boolean,default:!0}},emits:["update:show","confirm"],setup(t,{emit:c}){const o=t,n=c,r=()=>{n("update:show",!1)},s=()=>{n("confirm")};return(m,l)=>{const i=y.Icon,d=y.Button,h=y.Popup;return e.openBlock(),e.createBlock(h,{show:o.show,"onUpdate:show":l[0]||(l[0]=u=>o.show=u),position:"bottom",round:!0,class:"validate-popup","close-on-click-overlay":!0},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("div",I,[o.showClose?(e.openBlock(),e.createBlock(i,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",U,e.toDisplayString(o.title),1),o.showClose?(e.openBlock(),e.createBlock(i,{key:1,class:"icon",name:"cross",size:"20",color:"#999",onClick:r})):e.createCommentVNode("",!0)]),e.createElementVNode("div",q,[e.createElementVNode("p",F,e.toDisplayString(o.message),1),e.createVNode(d,{type:"primary",block:"",class:"validate-btn",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.buttonText),1)]),_:1})])])]),_:1},8,["show"])}}},j=V($,[["__scopeId","data-v-d8ab28e4"]]),z={class:"modal-renderer-content"},L={class:"modal-renderer-header"},G={class:"modal-renderer-title"},R={class:"modal-renderer-body"},H={key:0,class:"modal-renderer-text"},J={class:"modal-renderer-footer"},K={__name:"ModalRenderer",props:{show:{type:Boolean,default:!0},position:{type:String,default:"bottom"},title:{type:String,default:"提示"},message:{type:String,default:""},confirmText:{type:String,default:"确认"},cancelText:{type:String,default:"取消"},showCancelButton:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},content:{type:[Function,Object],default:null},component:{type:[Object,Function],default:null},componentProps:{type:Object,default:()=>({})},modalComponent:{type:[Object,Function],default:null},modalComponentProps:{type:Object,default:()=>({})},buttons:{type:Array,default:null}},emits:["update:show","confirm","cancel","action","close"],setup(t,{emit:c}){const o=t,n=c,r=e.ref(o.show);e.watch(()=>o.show,a=>{r.value=a});const s=e.computed(()=>o.content||o.component),m=e.computed(()=>Array.isArray(o.buttons)&&o.buttons.length>0),l=()=>n("action","overlay"),i=()=>{n("confirm"),n("action","confirm")},d=()=>{n("cancel"),n("action","cancel")},h=(a,C)=>{const k=a.key??String(C);n("action",k),typeof a.onClick=="function"&&a.onClick()},u=()=>n("action","close"),f=a=>{r.value=a,n("update:show",a),a||n("action","close")},p=(a,C)=>n("action",a,C),b=a=>n("action","confirm",a),g=a=>n("action","cancel",a),_=a=>n("action","close",a),P=()=>{var a;return o.component?e.h(o.component,o.componentProps):typeof o.content=="function"?o.content():(a=o.content)!=null&&a.render?o.content.render():o.message?e.h("p",{class:"modal-renderer-message"},o.message):null},A=e.defineComponent({setup(){return()=>P()}}),M=e.computed(()=>({...o.modalComponentProps,show:r.value,position:o.position,title:o.title,message:o.message,confirmText:o.confirmText,cancelText:o.cancelText,showCancelButton:o.showCancelButton,showClose:o.showClose,content:o.content,component:o.component,componentProps:o.componentProps,buttons:o.buttons,requestAction:p,requestConfirm:b,requestCancel:g,requestClose:_}));return(a,C)=>{const k=y.Icon,v=y.Button,E=y.Popup;return t.modalComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.modalComponent),e.mergeProps({key:0},M.value,{"onUpdate:show":f,onAction:p,onConfirm:b,onCancel:g,onClose:_}),null,16)):(e.openBlock(),e.createBlock(E,{key:1,show:r.value,"onUpdate:show":[C[0]||(C[0]=w=>r.value=w),f],position:t.position,round:t.position==="bottom",class:"modal-renderer-popup","close-on-click-overlay":!1,onClickOverlay:l},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createElementVNode("div",L,[t.showClose?(e.openBlock(),e.createBlock(k,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",G,e.toDisplayString(t.title),1),t.showClose?(e.openBlock(),e.createBlock(k,{key:1,class:"modal-renderer-close",name:"cross",size:"20",color:"#999",onClick:u})):e.createCommentVNode("",!0)]),e.createElementVNode("div",R,[s.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(A)),{key:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.message?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(t.message),1)):e.createCommentVNode("",!0)],64))]),e.createElementVNode("div",J,[m.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.buttons,(w,x)=>(e.openBlock(),e.createBlock(v,{key:x,type:w.type||"default",class:"modal-renderer-btn",onClick:oe=>h(w,x)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(w.text),1)]),_:2},1032,["type","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancelButton?(e.openBlock(),e.createBlock(v,{key:0,type:"default",class:"modal-renderer-btn modal-renderer-btn-cancel",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(v,{type:"primary",class:"modal-renderer-btn modal-renderer-btn-confirm",onClick:i},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.confirmText),1)]),_:1})],64))])])]),_:1},8,["show","position","round"]))}}},Q=V(K,[["__scopeId","data-v-c1845810"]]),W=300,X=["--van-duration-base","--van-animation-duration-base"],T={animationDuration:void 0};function B(t){var s;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,Math.round(t));if(typeof t!="string")return null;const c=(s=t.trim().split(",")[0])==null?void 0:s.trim();if(!c)return null;const o=c.match(/^(-?\d+(?:\.\d+)?)ms$/i);if(o)return Math.max(0,Math.round(Number(o[1])));const n=c.match(/^(-?\d+(?:\.\d+)?)s$/i);if(n)return Math.max(0,Math.round(Number(n[1])*1e3));const r=Number(c);return Number.isFinite(r)?Math.max(0,Math.round(r)):null}function Y(){if(typeof window>"u"||typeof document>"u")return null;const t=window.getComputedStyle(document.documentElement);for(const c of X){const o=t.getPropertyValue(c),n=B(o);if(n!==null)return n}return null}function D(t={}){const c=B(t.animationDuration);if(c!==null)return c;const o=B(T.animationDuration);if(o!==null)return o;const n=Y();return n!==null?n:W}function Z(t={}){!t||typeof t!="object"||"animationDuration"in t&&(T.animationDuration=t.animationDuration)}function S(t={}){return new Promise(c=>{const o={fn:null},n=D(t),{unmount:r}=N({setup(){const s=e.ref(!0),m=()=>{var l;s.value=!1,(l=o.fn)==null||l.call(o)};return()=>e.h(j,{show:s.value,"onUpdate:show":l=>{var i;s.value=l,l||(i=o.fn)==null||i.call(o)},title:t.title??"提示",message:t.message??"",buttonText:t.buttonText??"知道了",showClose:t.showClose??!0,onConfirm:m})}},{unmountDelay:n});o.fn=()=>r(()=>c())})}const ee=S;function te(t={}){return new Promise((c,o)=>{var h;const n={fn:null},r=D(t),s=e.ref(!0);let m=!1;const l=u=>{var f,p;m||(m=!0,s.value=!1,(f=t.onClose)==null||f.call(t),(p=n.fn)==null||p.call(n,u))},i=async(u,f)=>{if(!m){if(typeof t.beforeClose=="function")try{if(await t.beforeClose(u,f)===!1)return}catch(p){o(p);return}l(u)}};(h=t.onOpen)==null||h.call(t);const{unmount:d}=N({setup(){return()=>e.h(Q,{show:s.value,"onUpdate:show":u=>{s.value=u},onAction:i,position:t.position??"bottom",title:t.title??"提示",message:t.message??"",confirmText:t.confirmText??"确认",cancelText:t.cancelText??"取消",showCancelButton:t.showCancelButton??!1,showClose:t.showClose??!0,content:t.content??null,component:t.component??null,componentProps:t.componentProps??{},modalComponent:t.modalComponent??null,modalComponentProps:t.modalComponentProps??{},buttons:t.buttons??null})}},{unmountDelay:r});n.fn=u=>d(()=>c(u))})}exports.configureModalUtils=Z;exports.showBottomTip=ee;exports.showCommonBottomPopup=S;exports.showModal=te;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("vant/es");require("vant/es/popup/style/index");require("vant/es/button/style/index");require("vant/es/icon/style/index");function N(t,a={}){const{unmountDelay:o=0,parent:n=document.body}=a,r=e.createApp(t),l=document.createElement("div");n.appendChild(l);const m=r.mount(l),s=()=>{r.unmount(),l.remove()};return{app:r,instance:m,container:l,unmount:i=>{const d=()=>{s(),i==null||i()};o>0?setTimeout(d,o):d()}}}const I={class:"validate-content"},U={class:"popup-header"},O={class:"title"},q={class:"validate-card"},$={class:"validate-text"},F=e.defineComponent({__name:"BottomPopup",props:{show:{type:Boolean,default:!1},title:{default:"提示"},message:{},buttonText:{default:"知道了"},showClose:{type:Boolean,default:!0}},emits:["update:show","confirm"],setup(t,{emit:a}){const o=t,n=a,r=()=>{n("update:show",!1)},l=()=>{n("confirm")};return(m,s)=>{const i=y.Icon,d=y.Button,h=y.Popup;return e.openBlock(),e.createBlock(h,{show:o.show,"onUpdate:show":s[0]||(s[0]=u=>o.show=u),position:"bottom",round:!0,class:"validate-popup","close-on-click-overlay":!0},{default:e.withCtx(()=>[e.createElementVNode("div",I,[e.createElementVNode("div",U,[o.showClose?(e.openBlock(),e.createBlock(i,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",O,e.toDisplayString(o.title),1),o.showClose?(e.openBlock(),e.createBlock(i,{key:1,class:"icon",name:"cross",size:"20",color:"#999",onClick:r})):e.createCommentVNode("",!0)]),e.createElementVNode("div",q,[e.createElementVNode("p",$,e.toDisplayString(o.message),1),e.createVNode(d,{type:"primary",block:"",class:"validate-btn",onClick:l},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.buttonText),1)]),_:1})])])]),_:1},8,["show"])}}}),V=(t,a)=>{const o=t.__vccOpts||t;for(const[n,r]of a)o[n]=r;return o},z=V(F,[["__scopeId","data-v-04db935a"]]),j={class:"modal-renderer-content"},L={class:"modal-renderer-header"},G={class:"modal-renderer-title"},R={class:"modal-renderer-body"},H={key:0,class:"modal-renderer-text"},J={class:"modal-renderer-footer"},K=e.defineComponent({__name:"ModalRenderer",props:{show:{type:Boolean,default:!0},position:{default:"bottom"},title:{default:"提示"},message:{default:""},confirmText:{default:"确认"},cancelText:{default:"取消"},showCancelButton:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},content:{type:[Function,Object,null],default:null},component:{default:null},componentProps:{default:()=>({})},modalComponent:{default:null},modalComponentProps:{default:()=>({})},buttons:{default:null}},emits:["update:show","confirm","cancel","close","action"],setup(t,{emit:a}){const o=t,n=a,r=e.ref(o.show);e.watch(()=>o.show,c=>{r.value=c});const l=e.computed(()=>!!(o.content||o.component)),m=e.computed(()=>Array.isArray(o.buttons)&&o.buttons.length>0),s=()=>n("action","overlay"),i=()=>{n("confirm"),n("action","confirm")},d=()=>{n("cancel"),n("action","cancel")},h=(c,C)=>{const k=c.key??String(C);n("action",k),typeof c.onClick=="function"&&c.onClick()},u=()=>n("action","close"),f=c=>{r.value=c,n("update:show",c),c||n("action","close")},p=(c,C)=>n("action",c,C),b=c=>n("action","confirm",c),_=c=>n("action","cancel",c),g=c=>n("action","close",c),M=()=>{var c;return o.component?e.h(o.component,o.componentProps):typeof o.content=="function"?o.content():(c=o.content)!=null&&c.render?o.content.render():o.message?e.h("p",{class:"modal-renderer-message"},o.message):null},A=e.defineComponent({setup(){return()=>M()}}),E=e.computed(()=>({...o.modalComponentProps,show:r.value,position:o.position,title:o.title,message:o.message,confirmText:o.confirmText,cancelText:o.cancelText,showCancelButton:o.showCancelButton,showClose:o.showClose,content:o.content,component:o.component,componentProps:o.componentProps,buttons:o.buttons,requestAction:p,requestConfirm:b,requestCancel:_,requestClose:g}));return(c,C)=>{const k=y.Icon,v=y.Button,S=y.Popup;return t.modalComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.modalComponent),e.mergeProps({key:0},E.value,{"onUpdate:show":f,onAction:p,onConfirm:b,onCancel:_,onClose:g}),null,16)):(e.openBlock(),e.createBlock(S,{key:1,show:r.value,"onUpdate:show":[C[0]||(C[0]=w=>r.value=w),f],position:t.position,round:t.position==="bottom",class:"modal-renderer-popup","close-on-click-overlay":!1,onClickOverlay:s},{default:e.withCtx(()=>[e.createElementVNode("div",j,[e.createElementVNode("div",L,[t.showClose?(e.openBlock(),e.createBlock(k,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",G,e.toDisplayString(t.title),1),t.showClose?(e.openBlock(),e.createBlock(k,{key:1,class:"modal-renderer-close",name:"cross",size:"20",color:"#999",onClick:u})):e.createCommentVNode("",!0)]),e.createElementVNode("div",R,[l.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(A)),{key:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.message?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(t.message),1)):e.createCommentVNode("",!0)],64))]),e.createElementVNode("div",J,[m.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.buttons,(w,x)=>(e.openBlock(),e.createBlock(v,{key:x,type:w.type||"default",class:"modal-renderer-btn",onClick:oe=>h(w,x)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(w.text),1)]),_:2},1032,["type","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancelButton?(e.openBlock(),e.createBlock(v,{key:0,type:"default",class:"modal-renderer-btn modal-renderer-btn-cancel",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(v,{type:"primary",class:"modal-renderer-btn modal-renderer-btn-confirm",onClick:i},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.confirmText),1)]),_:1})],64))])])]),_:1},8,["show","position","round"]))}}}),Q=V(K,[["__scopeId","data-v-81792d1e"]]),W=300,X=["--van-duration-base","--van-animation-duration-base"],T={animationDuration:void 0};function B(t){var l;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,Math.round(t));if(typeof t!="string")return null;const a=(l=t.trim().split(",")[0])==null?void 0:l.trim();if(!a)return null;const o=a.match(/^(-?\d+(?:\.\d+)?)ms$/i);if(o)return Math.max(0,Math.round(Number(o[1])));const n=a.match(/^(-?\d+(?:\.\d+)?)s$/i);if(n)return Math.max(0,Math.round(Number(n[1])*1e3));const r=Number(a);return Number.isFinite(r)?Math.max(0,Math.round(r)):null}function Y(){if(typeof window>"u"||typeof document>"u")return null;const t=window.getComputedStyle(document.documentElement);for(const a of X){const o=t.getPropertyValue(a),n=B(o);if(n!==null)return n}return null}function D(t={}){const a=B(t.animationDuration);if(a!==null)return a;const o=B(T.animationDuration);if(o!==null)return o;const n=Y();return n!==null?n:W}function Z(t={}){!t||typeof t!="object"||"animationDuration"in t&&(T.animationDuration=t.animationDuration)}function P(t={}){return new Promise(a=>{const o={fn:null},n=D(t),{unmount:r}=N({setup(){const l=e.ref(!0),m=()=>{var s;l.value=!1,(s=o.fn)==null||s.call(o)};return()=>e.h(z,{show:l.value,"onUpdate:show":s=>{var i;l.value=s,s||(i=o.fn)==null||i.call(o)},title:t.title??"提示",message:t.message??"",buttonText:t.buttonText??"知道了",showClose:t.showClose??!0,onConfirm:m})}},{unmountDelay:n});o.fn=()=>r(()=>a())})}const ee=P;function te(t={}){return new Promise((a,o)=>{var h;const n={fn:null},r=D(t),l=e.ref(!0);let m=!1;const s=u=>{var f,p;m||(m=!0,l.value=!1,(f=t.onClose)==null||f.call(t),(p=n.fn)==null||p.call(n,u))},i=async(u,f)=>{if(!m){if(typeof t.beforeClose=="function")try{if(await t.beforeClose(u,f)===!1)return}catch(p){o(p);return}s(u)}};(h=t.onOpen)==null||h.call(t);const{unmount:d}=N({setup(){return()=>e.h(Q,{show:l.value,"onUpdate:show":u=>{l.value=u},onAction:i,position:t.position??"bottom",title:t.title??"提示",message:t.message??"",confirmText:t.confirmText??"确认",cancelText:t.cancelText??"取消",showCancelButton:t.showCancelButton??!1,showClose:t.showClose??!0,content:t.content??null,component:t.component??null,componentProps:t.componentProps??{},modalComponent:t.modalComponent??null,modalComponentProps:t.modalComponentProps??{},buttons:t.buttons??null})}},{unmountDelay:r});n.fn=u=>d(()=>a(u))})}exports.configureModalUtils=Z;exports.showBottomTip=ee;exports.showCommonBottomPopup=P;exports.showModal=te;
2
2
  //# sourceMappingURL=vue-modal-utils.umd.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-modal-utils.umd.cjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.js"],"sourcesContent":["import { createApp as a } from \"vue\";\nfunction l(m, c = {}) {\n const { unmountDelay: u = 0, parent: r = document.body } = c, n = a(m), t = document.createElement(\"div\");\n r.appendChild(t);\n const p = n.mount(t), s = () => {\n n.unmount(), t.remove();\n };\n return { app: n, instance: p, container: t, unmount: (o) => {\n const e = () => {\n s(), o == null || o();\n };\n u > 0 ? setTimeout(e, u) : e();\n } };\n}\nexport {\n l as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup>\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n const props = defineProps({\n show: { type: Boolean, default: false },\n title: { type: String, default: '提示' },\n message: { type: String, required: true },\n buttonText: { type: String, default: '知道了' },\n showClose: { type: Boolean, default: true },\n })\n\n const emit = defineEmits(['update:show', 'confirm'])\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n v-model:show=\"props.show\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup>\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent } from 'vue'\n import { h } from 'vue'\n\n const props = defineProps({\n show: { type: Boolean, default: true },\n position: { type: String, default: 'bottom' },\n title: { type: String, default: '提示' },\n message: { type: String, default: '' },\n confirmText: { type: String, default: '确认' },\n cancelText: { type: String, default: '取消' },\n showCancelButton: { type: Boolean, default: false },\n showClose: { type: Boolean, default: true },\n content: { type: [Function, Object], default: null },\n component: { type: [Object, Function], default: null },\n componentProps: { type: Object, default: () => ({}) },\n modalComponent: { type: [Object, Function], default: null },\n modalComponentProps: { type: Object, default: () => ({}) },\n buttons: { type: Array, default: null },\n })\n\n const emit = defineEmits(['update:show', 'confirm', 'cancel', 'action', 'close'])\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => props.content || props.component)\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn, index) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action, payload) => emit('action', action, payload)\n const onCustomConfirm = (payload) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload) => emit('action', 'cancel', payload)\n const onCustomClose = (payload) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n ...props.modalComponentProps,\n show: internalShow.value,\n position: props.position,\n title: props.title,\n message: props.message,\n confirmText: props.confirmText,\n cancelText: props.cancelText,\n showCancelButton: props.showCancelButton,\n showClose: props.showClose,\n content: props.content,\n component: props.component,\n componentProps: props.componentProps,\n buttons: props.buttons,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"position === 'bottom'\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * vue-modal-utils\n * 弹窗命令式调用 API:showCommonBottomPopup、showModal、showBottomTip\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value) {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar() {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\nfunction resolveAnimationDuration(options = {}) {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(modalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n\n/**\n * 配置 vue-modal-utils 的全局行为\n * @param {Object} [config]\n * @param {number|string} [config.animationDuration] - 动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n */\nexport function configureModalUtils(config = {}) {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * Phase 1: 单按钮底部弹窗\n * @param {Object} options\n * @param {string} [options.title='提示']\n * @param {string} options.message\n * @param {string} [options.buttonText='知道了']\n * @param {boolean} [options.showClose=true]\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<void>}\n */\nexport function showCommonBottomPopup(options = {}) {\n return new Promise((resolve) => {\n const closeRef = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/** showCommonBottomPopup 的别名 */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * Phase 2/3: 统一弹窗 API\n * @param {Object} options\n * @param {'bottom'|'center'|'top'} [options.position='bottom']\n * @param {string} [options.title='提示']\n * @param {string} [options.message]\n * @param {string} [options.confirmText='确认']\n * @param {string} [options.cancelText='取消']\n * @param {boolean} [options.showCancelButton=false]\n * @param {boolean} [options.showClose=true]\n * @param {Function|Object} [options.content] - 渲染函数 () => VNode\n * @param {Object|Function} [options.component] - 业务组件\n * @param {Object} [options.componentProps] - 组件 props\n * @param {Object|Function} [options.modalComponent] - 完全自定义弹窗组件\n * @param {Object} [options.modalComponentProps] - 完全自定义弹窗组件 props\n * @param {Array} [options.buttons] - [{ text, type?, key? }]\n * @param {Function} [options.onOpen]\n * @param {Function} [options.onClose]\n * @param {Function} [options.beforeClose] - async, 返回 false 可阻止关闭;签名 (action, payload)\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<'confirm'|'cancel'|'overlay'|'close'|string>}\n */\nexport function showModal(options = {}) {\n return new Promise((resolve, reject) => {\n const closeRef = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n const finish = (action) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action, payload) => {\n if (resolved) return\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) return\n } catch (e) {\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n"],"names":["l","m","u","r","n","a","t","p","s","o","e","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","v","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","_a","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","modalConfig","parseAnimationDuration","value","normalized","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","fromCall","fromGlobalConfig","fromVantCssVar","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","finish","_b","handleAction","ModalRenderer"],"mappings":"2OACA,SAASA,EAAEC,EAAG,EAAI,GAAI,CACpB,KAAM,CAAE,aAAcC,EAAI,EAAG,OAAQC,EAAI,SAAS,IAAI,EAAK,EAAGC,EAAIC,EAAAA,UAAEJ,CAAC,EAAGK,EAAI,SAAS,cAAc,KAAK,EACxGH,EAAE,YAAYG,CAAC,EACf,MAAMC,EAAIH,EAAE,MAAME,CAAC,EAAGE,EAAI,IAAM,CAC9BJ,EAAE,QAAO,EAAIE,EAAE,OAAM,CACvB,EACA,MAAO,CAAE,IAAKF,EAAG,SAAUG,EAAG,UAAWD,EAAG,QAAUG,GAAM,CAC1D,MAAMC,EAAI,IAAM,CACdF,IAAKC,GAAK,MAAQA,EAAC,CACrB,EACAP,EAAI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B,EAAA,KAAA4B,GAEA,KAAM,CAAE,QAAAU,CAAO,EAAKC,EAClB,CACE,OAAQ,CACN,MAAO,IACLxC,EAAAA,EAAEmD,EAAe,CACf,KAAMV,EAAK,MACX,gBAAkB5D,GAAM,CACtB4D,EAAK,MAAQ5D,CACf,EACA,SAAUqE,EACV,SAAUrB,EAAQ,UAAY,SAC9B,MAAOA,EAAQ,OAAS,KACxB,QAASA,EAAQ,SAAW,GAC5B,YAAaA,EAAQ,aAAe,KACpC,WAAYA,EAAQ,YAAc,KAClC,iBAAkBA,EAAQ,kBAAoB,GAC9C,UAAWA,EAAQ,WAAa,GAChC,QAASA,EAAQ,SAAW,KAC5B,UAAWA,EAAQ,WAAa,KAChC,eAAgBA,EAAQ,gBAAkB,CAAA,EAC1C,eAAgBA,EAAQ,gBAAkB,KAC1C,oBAAqBA,EAAQ,qBAAuB,CAAA,EACpD,QAASA,EAAQ,SAAW,IAC1C,CAAa,CACL,CACR,EACM,CAAE,aAAAS,CAAY,CACpB,EAEID,EAAS,GAAM3C,GAAW6C,EAAQ,IAAMH,EAAQ1C,CAAM,CAAC,CACzD,CAAC,CACH"}
1
+ {"version":3,"file":"vue-modal-utils.umd.cjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.ts"],"sourcesContent":["import { createApp as a } from \"vue\";\nfunction l(m, c = {}) {\n const { unmountDelay: u = 0, parent: r = document.body } = c, n = a(m), t = document.createElement(\"div\");\n r.appendChild(t);\n const p = n.mount(t), s = () => {\n n.unmount(), t.remove();\n };\n return { app: n, instance: p, container: t, unmount: (o) => {\n const e = () => {\n s(), o == null || o();\n };\n u > 0 ? setTimeout(e, u) : e();\n } };\n}\nexport {\n l as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup lang=\"ts\">\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n interface BottomPopupProps {\n show?: boolean\n title?: string\n message: string\n buttonText?: string\n showClose?: boolean\n }\n\n const props = withDefaults(defineProps<BottomPopupProps>(), {\n show: false,\n title: '提示',\n buttonText: '知道了',\n showClose: true,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n }>()\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n v-model:show=\"props.show\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent, h } from 'vue'\n import type { ModalAction, ModalButton, ModalRendererProps } from './types'\n\n const props = withDefaults(defineProps<ModalRendererProps>(), {\n show: true,\n position: 'bottom',\n title: '提示',\n message: '',\n confirmText: '确认',\n cancelText: '取消',\n showCancelButton: false,\n showClose: true,\n content: null,\n component: null,\n componentProps: () => ({}),\n modalComponent: null,\n modalComponentProps: () => ({}),\n buttons: null,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n (e: 'cancel'): void\n (e: 'close'): void\n (e: 'action', action: ModalAction, payload?: unknown): void\n }>()\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => !!(props.content || props.component))\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn: ModalButton, index: number) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v: boolean) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action: ModalAction, payload?: unknown) => emit('action', action, payload)\n const onCustomConfirm = (payload?: unknown) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload?: unknown) => emit('action', 'cancel', payload)\n const onCustomClose = (payload?: unknown) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n ...props.modalComponentProps,\n show: internalShow.value,\n position: props.position,\n title: props.title,\n message: props.message,\n confirmText: props.confirmText,\n cancelText: props.cancelText,\n showCancelButton: props.showCancelButton,\n showClose: props.showClose,\n content: props.content,\n component: props.component,\n componentProps: props.componentProps,\n buttons: props.buttons,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"position === 'bottom'\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * `vue-modal-utils` 弹窗命令式 API 入口。\n *\n * @packageDocumentation\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\nimport type {\n ModalAction,\n ModalGlobalConfig,\n ShowCommonBottomPopupOptions,\n ShowModalOptions,\n} from './types'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig: ModalGlobalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar(): number | null {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\nfunction resolveAnimationDuration(options: { animationDuration?: number | string } = {}): number {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(modalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n\n/**\n * 配置 `vue-modal-utils` 的全局行为。\n *\n * @param config - 全局配置。\n * @public\n */\nexport function configureModalUtils(config: ModalGlobalConfig = {}): void {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * 展示单按钮底部弹窗。\n *\n * @param options - 弹窗展示参数。\n * @returns 用户关闭弹窗后的完成信号。\n * @public\n */\nexport function showCommonBottomPopup(options: ShowCommonBottomPopupOptions = {}): Promise<void> {\n return new Promise((resolve) => {\n const closeRef: { fn: null | (() => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/**\n * `showCommonBottomPopup` 的别名。\n *\n * @public\n */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。\n *\n * @param options - 弹窗展示参数。\n * @returns Promise resolve 为关闭动作类型。\n * @remarks\n * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。\n * @public\n */\nexport function showModal(options: ShowModalOptions = {}): Promise<ModalAction> {\n return new Promise((resolve, reject) => {\n const closeRef: { fn: null | ((action: ModalAction) => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n const finish = (action: ModalAction) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action: ModalAction, payload?: unknown) => {\n if (resolved) return\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) return\n } catch (e) {\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n\nexport type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types'\n"],"names":["l","m","c","u","r","n","a","t","p","o","e","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","v","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","_a","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","modalConfig","parseAnimationDuration","value","normalized","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","fromCall","fromGlobalConfig","fromVantCssVar","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","finish","_b","handleAction","ModalRenderer"],"mappings":"2OACA,SAASA,EAAEC,EAAGC,EAAI,GAAI,CACpB,KAAM,CAAE,aAAcC,EAAI,EAAG,OAAQC,EAAI,SAAS,IAAI,EAAKF,EAAGG,EAAIC,EAAAA,UAAEL,CAAC,EAAGM,EAAI,SAAS,cAAc,KAAK,EACxGH,EAAE,YAAYG,CAAC,EACf,MA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,IACAoB,EAAAZ,EAAS,KAAT,MAAAY,EAAA,KAAAZ,EAAc3C,GAChB,EAEMwD,EAAe,MAAOxD,EAAqBC,IAAsB,CACrE,GAAI,CAAAoD,EACJ,IAAI,OAAOlB,EAAQ,aAAgB,WACjC,GAAI,CAEF,GADe,MAAMA,EAAQ,YAAYnC,EAAQC,CAAO,IACzC,GAAO,MACxB,OAASvC,EAAG,CACV0F,EAAO1F,CAAC,EACR,MACF,CAEF4F,EAAOtD,CAAM,EACf,GAEAO,EAAA4B,EAAQ,SAAR,MAAA5B,EAAA,KAAA4B,GAEA,KAAM,CAAE,QAAAU,GAAYC,EAClB,CACE,OAAQ,CACN,MAAO,IACLxC,EAAAA,EAAEmD,EAAe,CACf,KAAMV,EAAK,MACX,gBAAkB5D,GAAe,CAC/B4D,EAAK,MAAQ5D,CACf,EACA,SAAUqE,EACV,SAAUrB,EAAQ,UAAY,SAC9B,MAAOA,EAAQ,OAAS,KACxB,QAASA,EAAQ,SAAW,GAC5B,YAAaA,EAAQ,aAAe,KACpC,WAAYA,EAAQ,YAAc,KAClC,iBAAkBA,EAAQ,kBAAoB,GAC9C,UAAWA,EAAQ,WAAa,GAChC,QAASA,EAAQ,SAAW,KAC5B,UAAWA,EAAQ,WAAa,KAChC,eAAgBA,EAAQ,gBAAkB,CAAA,EAC1C,eAAgBA,EAAQ,gBAAkB,KAC1C,oBAAqBA,EAAQ,qBAAuB,CAAA,EACpD,QAASA,EAAQ,SAAW,IAAA,CAC7B,CACL,CAAA,EAEF,CAAE,aAAAS,CAAA,CAAa,EAGjBD,EAAS,GAAM3C,GAAW6C,EAAQ,IAAMH,EAAQ1C,CAAM,CAAC,CACzD,CAAC,CACH"}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "vue-modal-utils",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Vue 3 弹窗命令式调用 API,基于 Vant",
6
6
  "main": "dist/vue-modal-utils.umd.cjs",
7
7
  "module": "dist/vue-modal-utils.mjs",
8
+ "types": "dist/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "import": "./dist/vue-modal-utils.mjs",
@@ -22,6 +23,7 @@
22
23
  "devDependencies": {
23
24
  "@vitejs/plugin-vue": "^5.2.4",
24
25
  "sass": "^1.42.1",
26
+ "typescript": "^5.9.3",
25
27
  "unplugin-vue-components": "^28.7.0",
26
28
  "vant": "^4.9.19",
27
29
  "vite": "^6.3.5",
@@ -29,7 +31,7 @@
29
31
  "vue-shared-utils": "workspace:*"
30
32
  },
31
33
  "scripts": {
32
- "build": "vite build",
34
+ "build": "vite build && tsc -p tsconfig.json",
33
35
  "dev": "vite build --watch"
34
36
  },
35
37
  "keywords": [