vue-modal-utils 0.2.0 → 0.2.2

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.
@@ -1 +1 @@
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
+ .validate-popup .validate-content[data-v-84e1a364]{padding:16px}.validate-popup .validate-card[data-v-84e1a364]{background:#fff;border-radius:8px;padding:14px 16px 16px}.validate-popup .popup-header[data-v-84e1a364]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.validate-popup .popup-header .title[data-v-84e1a364]{margin-left:auto;font-size:16px;font-weight:600;line-height:1;color:#333}.validate-popup .popup-header .icon[data-v-84e1a364]{padding:8px;margin-left:auto}.validate-popup .validate-text[data-v-84e1a364]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.validate-popup .validate-btn[data-v-84e1a364]{background-color:#ff5712;border-radius:6px;border-width:0;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-content[data-v-3f28a77f]{padding:16px}.modal-renderer-popup .modal-renderer-header[data-v-3f28a77f]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.modal-renderer-popup .modal-renderer-header .modal-renderer-title[data-v-3f28a77f]{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-3f28a77f]{padding:8px}.modal-renderer-popup .modal-renderer-body[data-v-3f28a77f]{background:#fff;border-radius:8px;padding:14px 16px 16px;min-height:40px}.modal-renderer-popup .modal-renderer-text[data-v-3f28a77f],.modal-renderer-popup .modal-renderer-message[data-v-3f28a77f]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.modal-renderer-popup .modal-renderer-footer[data-v-3f28a77f]{display:flex;align-items:center;gap:12px;margin-top:16px}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn[data-v-3f28a77f]{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-3f28a77f]{border:1px solid #dcdee0;color:#333;background:#fff}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-confirm[data-v-3f28a77f]{background-color:#ff5712;border:none}
@@ -1,4 +1,4 @@
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";
1
+ import { createApp as W, defineComponent as N, openBlock as c, 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 D, resolveDynamicComponent as F, mergeProps as Y, createElementBlock as g, Fragment as M, unref as Z, renderList as ee, h as A } from "vue";
2
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";
@@ -6,17 +6,17 @@ import "vant/es/icon/style/index";
6
6
  function j(e, o = {}) {
7
7
  const { unmountDelay: t = 0, parent: n = document.body } = o, a = W(e), r = document.createElement("div");
8
8
  n.appendChild(r);
9
- const m = a.mount(r), c = () => {
9
+ const m = a.mount(r), l = () => {
10
10
  a.unmount(), r.remove();
11
11
  };
12
12
  return { app: a, instance: m, container: r, unmount: (u) => {
13
13
  const p = () => {
14
- c(), u == null || u();
14
+ l(), u == null || u();
15
15
  };
16
16
  t > 0 ? setTimeout(p, t) : p();
17
17
  } };
18
18
  }
19
- const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = { class: "title" }, se = { class: "validate-card" }, ae = { class: "validate-text" }, re = /* @__PURE__ */ M({
19
+ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = { class: "title" }, se = { class: "validate-card" }, ae = { class: "validate-text" }, re = /* @__PURE__ */ N({
20
20
  __name: "BottomPopup",
21
21
  props: {
22
22
  show: { type: Boolean, default: !1 },
@@ -32,11 +32,11 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
32
32
  }, r = () => {
33
33
  n("confirm");
34
34
  };
35
- return (m, c) => {
35
+ return (m, l) => {
36
36
  const u = E, p = q, w = z;
37
- return l(), d(w, {
37
+ return c(), d(w, {
38
38
  show: t.show,
39
- "onUpdate:show": c[0] || (c[0] = (i) => t.show = i),
39
+ "onUpdate:show": l[0] || (l[0] = (i) => n("update:show", i)),
40
40
  position: "bottom",
41
41
  round: !0,
42
42
  class: "validate-popup",
@@ -45,14 +45,14 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
45
45
  default: _(() => [
46
46
  f("div", te, [
47
47
  f("div", ne, [
48
- t.showClose ? (l(), d(u, {
48
+ t.showClose ? (c(), d(u, {
49
49
  key: 0,
50
50
  name: "cross",
51
51
  size: "20",
52
52
  style: { visibility: "hidden", padding: "8px" }
53
53
  })) : b("", !0),
54
54
  f("div", oe, C(t.title), 1),
55
- t.showClose ? (l(), d(u, {
55
+ t.showClose ? (c(), d(u, {
56
56
  key: 1,
57
57
  class: "icon",
58
58
  name: "cross",
@@ -86,10 +86,10 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
86
86
  for (const [n, a] of o)
87
87
  t[n] = a;
88
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 = {
89
+ }, le = /* @__PURE__ */ L(re, [["__scopeId", "data-v-84e1a364"]]), ce = { 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
- }, fe = { class: "modal-renderer-footer" }, pe = /* @__PURE__ */ M({
92
+ }, fe = { class: "modal-renderer-footer" }, pe = /* @__PURE__ */ N({
93
93
  __name: "ModalRenderer",
94
94
  props: {
95
95
  show: { type: Boolean, default: !0 },
@@ -116,7 +116,7 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
116
116
  a.value = s;
117
117
  }
118
118
  );
119
- const r = P(() => !!(t.content || t.component)), m = P(() => Array.isArray(t.buttons) && t.buttons.length > 0), c = () => n("action", "overlay"), u = () => {
119
+ const r = D(() => !!(t.content || t.component)), m = D(() => Array.isArray(t.buttons) && t.buttons.length > 0), l = () => n("action", "overlay"), u = () => {
120
120
  n("confirm"), n("action", "confirm");
121
121
  }, p = () => {
122
122
  n("cancel"), n("action", "cancel");
@@ -127,39 +127,40 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
127
127
  a.value = s, n("update:show", s), s || n("action", "close");
128
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 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({
130
+ return t.component ? A(t.component, t.componentProps) : typeof t.content == "function" ? t.content() : (s = t.content) != null && s.render ? t.content.render() : t.message ? A("p", { class: "modal-renderer-message" }, t.message) : null;
131
+ }, J = N({
132
132
  setup() {
133
133
  return () => H();
134
134
  }
135
- }), K = P(() => ({
135
+ }), K = D(() => ({
136
+ // FIX: custom modal should not inherit these from props
137
+ // position: props.position,
138
+ // title: props.title,
139
+ // message: props.message,
140
+ // confirmText: props.confirmText,
141
+ // cancelText: props.cancelText,
142
+ // showCancelButton: props.showCancelButton,
143
+ // showClose: props.showClose,
144
+ // content: props.content,
145
+ // component: props.component,
146
+ // componentProps: props.componentProps,
147
+ // buttons: props.buttons,
136
148
  ...t.modalComponentProps,
137
149
  show: a.value,
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
150
  requestAction: h,
150
151
  requestConfirm: I,
151
152
  requestCancel: U,
152
153
  requestClose: O
153
154
  }));
154
155
  return (s, v) => {
155
- const x = E, A = q, Q = z;
156
- return e.modalComponent ? (l(), d(F(e.modalComponent), Y({ key: 0 }, K.value, {
156
+ const x = E, B = q, Q = z;
157
+ return e.modalComponent ? (c(), d(F(e.modalComponent), Y({ key: 0 }, K.value, {
157
158
  "onUpdate:show": y,
158
159
  onAction: h,
159
160
  onConfirm: I,
160
161
  onCancel: U,
161
162
  onClose: O
162
- }), null, 16)) : (l(), d(Q, {
163
+ }), null, 16)) : (c(), d(Q, {
163
164
  key: 1,
164
165
  show: a.value,
165
166
  "onUpdate:show": [
@@ -167,22 +168,22 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
167
168
  y
168
169
  ],
169
170
  position: e.position,
170
- round: e.position === "bottom",
171
+ round: !0,
171
172
  class: "modal-renderer-popup",
172
173
  "close-on-click-overlay": !1,
173
- onClickOverlay: c
174
+ onClickOverlay: l
174
175
  }, {
175
176
  default: _(() => [
176
- f("div", le, [
177
+ f("div", ce, [
177
178
  f("div", ue, [
178
- e.showClose ? (l(), d(x, {
179
+ e.showClose ? (c(), d(x, {
179
180
  key: 0,
180
181
  name: "cross",
181
182
  size: "20",
182
183
  style: { visibility: "hidden", padding: "8px" }
183
184
  })) : b("", !0),
184
185
  f("div", ie, C(e.title), 1),
185
- e.showClose ? (l(), d(x, {
186
+ e.showClose ? (c(), d(x, {
186
187
  key: 1,
187
188
  class: "modal-renderer-close",
188
189
  name: "cross",
@@ -192,12 +193,12 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
192
193
  })) : b("", !0)
193
194
  ]),
194
195
  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)
196
+ r.value ? (c(), d(F(Z(J)), { key: 1 })) : (c(), g(M, { key: 0 }, [
197
+ e.message ? (c(), g("p", de, C(e.message), 1)) : b("", !0)
197
198
  ], 64))
198
199
  ]),
199
200
  f("div", fe, [
200
- m.value ? (l(!0), g(D, { key: 0 }, ee(e.buttons, (k, $) => (l(), d(A, {
201
+ m.value ? (c(!0), g(M, { key: 0 }, ee(e.buttons, (k, $) => (c(), d(B, {
201
202
  key: $,
202
203
  type: k.type || "default",
203
204
  class: "modal-renderer-btn",
@@ -207,8 +208,8 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
207
208
  T(C(k.text), 1)
208
209
  ]),
209
210
  _: 2
210
- }, 1032, ["type", "onClick"]))), 128)) : (l(), g(D, { key: 1 }, [
211
- e.showCancelButton ? (l(), d(A, {
211
+ }, 1032, ["type", "onClick"]))), 128)) : (c(), g(M, { key: 1 }, [
212
+ e.showCancelButton ? (c(), d(B, {
212
213
  key: 0,
213
214
  type: "default",
214
215
  class: "modal-renderer-btn modal-renderer-btn-cancel",
@@ -219,7 +220,7 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
219
220
  ]),
220
221
  _: 1
221
222
  })) : b("", !0),
222
- S(A, {
223
+ S(B, {
223
224
  type: "primary",
224
225
  class: "modal-renderer-btn modal-renderer-btn-confirm",
225
226
  onClick: u
@@ -234,13 +235,13 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
234
235
  ])
235
236
  ]),
236
237
  _: 1
237
- }, 8, ["show", "position", "round"]));
238
+ }, 8, ["show", "position"]));
238
239
  };
239
240
  }
240
- }), he = /* @__PURE__ */ L(pe, [["__scopeId", "data-v-81792d1e"]]), Ce = 300, ye = ["--van-duration-base", "--van-animation-duration-base"], G = {
241
+ }), he = /* @__PURE__ */ L(pe, [["__scopeId", "data-v-3f28a77f"]]), Ce = 300, ye = ["--van-duration-base", "--van-animation-duration-base"], G = {
241
242
  animationDuration: void 0
242
243
  };
243
- function N(e) {
244
+ function P(e) {
244
245
  var r;
245
246
  if (typeof e == "number" && Number.isFinite(e))
246
247
  return Math.max(0, Math.round(e));
@@ -258,20 +259,20 @@ function we() {
258
259
  if (typeof window > "u" || typeof document > "u") return null;
259
260
  const e = window.getComputedStyle(document.documentElement);
260
261
  for (const o of ye) {
261
- const t = e.getPropertyValue(o), n = N(t);
262
+ const t = e.getPropertyValue(o), n = P(t);
262
263
  if (n !== null) return n;
263
264
  }
264
265
  return null;
265
266
  }
266
267
  function R(e = {}) {
267
- const o = N(e.animationDuration);
268
+ const o = P(e.animationDuration);
268
269
  if (o !== null) return o;
269
- const t = N(G.animationDuration);
270
+ const t = P(G.animationDuration);
270
271
  if (t !== null) return t;
271
272
  const n = we();
272
273
  return n !== null ? n : Ce;
273
274
  }
274
- function Be(e = {}) {
275
+ function Ae(e = {}) {
275
276
  !e || typeof e != "object" || "animationDuration" in e && (G.animationDuration = e.animationDuration);
276
277
  }
277
278
  function ve(e = {}) {
@@ -280,14 +281,14 @@ function ve(e = {}) {
280
281
  {
281
282
  setup() {
282
283
  const r = V(!0), m = () => {
283
- var c;
284
- r.value = !1, (c = t.fn) == null || c.call(t);
284
+ var l;
285
+ r.value = !1, (l = t.fn) == null || l.call(t);
285
286
  };
286
- return () => B(ce, {
287
+ return () => A(le, {
287
288
  show: r.value,
288
- "onUpdate:show": (c) => {
289
+ "onUpdate:show": (l) => {
289
290
  var u;
290
- r.value = c, c || (u = t.fn) == null || u.call(t);
291
+ r.value = l, l || (u = t.fn) == null || u.call(t);
291
292
  },
292
293
  title: e.title ?? "提示",
293
294
  message: e.message ?? "",
@@ -302,13 +303,13 @@ function ve(e = {}) {
302
303
  t.fn = () => a(() => o());
303
304
  });
304
305
  }
305
- const Ae = ve;
306
- function Pe(e = {}) {
306
+ const Be = ve;
307
+ function De(e = {}) {
307
308
  return new Promise((o, t) => {
308
309
  var w;
309
310
  const n = { fn: null }, a = R(e), r = V(!0);
310
311
  let m = !1;
311
- const c = (i) => {
312
+ const l = (i) => {
312
313
  var y, h;
313
314
  m || (m = !0, r.value = !1, (y = e.onClose) == null || y.call(e), (h = n.fn) == null || h.call(n, i));
314
315
  }, u = async (i, y) => {
@@ -320,14 +321,14 @@ function Pe(e = {}) {
320
321
  t(h);
321
322
  return;
322
323
  }
323
- c(i);
324
+ l(i);
324
325
  }
325
326
  };
326
327
  (w = e.onOpen) == null || w.call(e);
327
328
  const { unmount: p } = j(
328
329
  {
329
330
  setup() {
330
- return () => B(he, {
331
+ return () => A(he, {
331
332
  show: r.value,
332
333
  "onUpdate:show": (i) => {
333
334
  r.value = i;
@@ -355,9 +356,9 @@ function Pe(e = {}) {
355
356
  });
356
357
  }
357
358
  export {
358
- Be as configureModalUtils,
359
- Ae as showBottomTip,
359
+ Ae as configureModalUtils,
360
+ Be as showBottomTip,
360
361
  ve as showCommonBottomPopup,
361
- Pe as showModal
362
+ De as showModal
362
363
  };
363
364
  //# 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.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,GAAGM,IAAI,SAAS,cAAc,KAAK;AACxG,EAAAH,EAAE,YAAYG,CAAC;AACf,QAAMC,IAAIH,EAAE,MAAME,CAAC,GAAGE,IAAI,MAAM;A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A4D,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
+ {"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 :show=\"props.show\"\n @update:show=\"emit('update:show', $event)\"\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 // FIX: custom modal should not inherit these from props\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 ...props.modalComponentProps,\n show: internalShow.value,\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=\"true\"\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,GAAGM,IAAI,SAAS,cAAc,KAAK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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,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;
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 x(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:u=>{const d=()=>{s(),u==null||u()};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 u=y.Icon,d=y.Button,h=y.Popup;return e.openBlock(),e.createBlock(h,{show:o.show,"onUpdate:show":s[0]||(s[0]=i=>n("update:show",i)),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(u,{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(u,{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-84e1a364"]]),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"),u=()=>{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()},i=()=>n("action","close"),p=c=>{r.value=c,n("update:show",c),c||n("action","close")},f=(c,C)=>n("action",c,C),_=c=>n("action","confirm",c),b=c=>n("action","cancel",c),N=c=>n("action","close",c),A=()=>{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},P=e.defineComponent({setup(){return()=>A()}}),E=e.computed(()=>({...o.modalComponentProps,show:r.value,requestAction:f,requestConfirm:_,requestCancel:b,requestClose:N}));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":p,onAction:f,onConfirm:_,onCancel:b,onClose:N}),null,16)):(e.openBlock(),e.createBlock(S,{key:1,show:r.value,"onUpdate:show":[C[0]||(C[0]=w=>r.value=w),p],position:t.position,round:!0,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:i})):e.createCommentVNode("",!0)]),e.createElementVNode("div",R,[l.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(P)),{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,g)=>(e.openBlock(),e.createBlock(v,{key:g,type:w.type||"default",class:"modal-renderer-btn",onClick:oe=>h(w,g)},{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:u},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.confirmText),1)]),_:1})],64))])])]),_:1},8,["show","position"]))}}}),Q=V(K,[["__scopeId","data-v-3f28a77f"]]),W=300,X=["--van-duration-base","--van-animation-duration-base"],D={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 T(t={}){const a=B(t.animationDuration);if(a!==null)return a;const o=B(D.animationDuration);if(o!==null)return o;const n=Y();return n!==null?n:W}function Z(t={}){!t||typeof t!="object"||"animationDuration"in t&&(D.animationDuration=t.animationDuration)}function M(t={}){return new Promise(a=>{const o={fn:null},n=T(t),{unmount:r}=x({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 u;l.value=s,s||(u=o.fn)==null||u.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=M;function te(t={}){return new Promise((a,o)=>{var h;const n={fn:null},r=T(t),l=e.ref(!0);let m=!1;const s=i=>{var p,f;m||(m=!0,l.value=!1,(p=t.onClose)==null||p.call(t),(f=n.fn)==null||f.call(n,i))},u=async(i,p)=>{if(!m){if(typeof t.beforeClose=="function")try{if(await t.beforeClose(i,p)===!1)return}catch(f){o(f);return}s(i)}};(h=t.onOpen)==null||h.call(t);const{unmount:d}=x({setup(){return()=>e.h(Q,{show:l.value,"onUpdate:show":i=>{l.value=i},onAction:u,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=i=>d(()=>a(i))})}exports.configureModalUtils=Z;exports.showBottomTip=ee;exports.showCommonBottomPopup=M;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.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,MAAMC,EAAIH,EAAE,MAAME,CAAC,EAAG,EAAI,IAAM,CAC9BF,EAAE,QAAO,EAAIE,EAAE,OAAM,CACvB,EACA,MAAO,CAAE,IAAKF,EAAG,SAAUG,EAAG,UAAWD,EAAG,QAAUE,GAAM,CAC1D,MAAMC,EAAI,IAAM,CACd,IAAKD,GAAK,MAAQA,EAAC,CACrB,EACAN,EAAI,EAAI,WAAWO,EAAGP,CAAC,EAAIO,EAAC,CAC9B,CAAC,CACH,qWCHE,MAAMC,EAAQC,EAORC,EAAOC,EAKPC,EAAQ,IAAM,CAClBF,EAAK,cAAe,EAAK,CAC3B,EACMG,EAAY,IAAM,CACtBH,EAAK,SAAS,CAChB,yEAIAI,EAAAA,YAgCYC,EAAA,CA/BF,KAAMP,EAAM,KAAN,gBAAAQ,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,GAAAT,EAAM,KAAIS,GACxB,SAAS,SACR,MAAO,GACR,MAAM,iBACL,yBAAwB,EAAA,qBAEzB,IAwBM,CAxBNC,EAAAA,mBAwBM,MAxBNC,EAwBM,CAvBJD,EAAAA,mBAgBM,MAhBNE,EAgBM,CAdIZ,EAAM,yBADdM,EAAAA,YAKEO,EAAA,OAHA,KAAK,QACL,KAAK,KACL,MAAA,CAAA,WAAA,SAAA,QAAA,KAAA,CAAA,gCAEFH,EAAAA,mBAA0C,MAA1CI,EAA0CC,EAAAA,gBAApBf,EAAM,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,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"}
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 :show=\"props.show\"\n @update:show=\"emit('update:show', $event)\"\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 // FIX: custom modal should not inherit these from props\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 ...props.modalComponentProps,\n show: internalShow.value,\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=\"true\"\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,MAAMC,EAAIH,EAAE,MAAME,CAAC,EAAG,EAAI,IAAM,CAC9BF,EAAE,QAAO,EAAIE,EAAE,OAAM,CACvB,EACA,MAAO,CAAE,IAAKF,EAAG,SAAUG,EAAG,UAAWD,EAAG,QAAUE,GAAM,CAC1D,MAAMC,EAAI,IAAM,CACd,IAAKD,GAAK,MAAQA,EAAC,CACrB,EACAN,EAAI,EAAI,WAAWO,EAAGP,CAAC,EAAIO,EAAC,CAC9B,CAAC,CACH,qWCHE,MAAMC,EAAQC,EAORC,EAAOC,EAKPC,EAAQ,IAAM,CAClBF,EAAK,cAAe,EAAK,CAC3B,EACMG,EAAY,IAAM,CACtBH,EAAK,SAAS,CAChB,yEAIAI,EAAAA,YAiCYC,EAAA,CAhCT,KAAMP,EAAM,KACZ,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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,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-modal-utils",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Vue 3 弹窗命令式调用 API,基于 Vant",
6
6
  "main": "dist/vue-modal-utils.umd.cjs",