vue-popup-plus 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,235 +1,259 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".popup-mask[data-v-53a2b502]{position:fixed;inset:0;background-color:var(--popup-color-mask)}.popup-mask.is-blur[data-v-53a2b502]{-webkit-backdrop-filter:blur(15px) saturate(180%);backdrop-filter:blur(15px) saturate(180%)}.popup-view-wrapper[data-v-14a39a91]{display:flex;justify-content:center;align-items:center;position:fixed;inset:0;pointer-events:none}.popup-view-wrapper .popup-view[data-v-14a39a91]{position:relative;margin:auto;overflow:auto;pointer-events:auto}.vue-popup-plus-animation{animation-timing-function:linear;animation-duration:var(--v9a56ef92)}.vue-popup-plus-animation-enter-fade{animation-name:vue-popup-plus-animation-enter-fade}.vue-popup-plus-animation-leave-fade{animation-name:vue-popup-plus-animation-leave-fade}.vue-popup-plus-animation-enter-scale-enlarge{animation-name:vue-popup-plus-animation-enter-scale-enlarge}.vue-popup-plus-animation-leave-scale-enlarge{animation-name:vue-popup-plus-animation-leave-scale-enlarge}.vue-popup-plus-animation-enter-scale-reduce{animation-name:vue-popup-plus-animation-enter-scale-reduce}.vue-popup-plus-animation-leave-scale-reduce{animation-name:vue-popup-plus-animation-leave-scale-reduce}.vue-popup-plus-animation-enter-fly-top{animation-name:vue-popup-plus-animation-enter-fly-top}.vue-popup-plus-animation-leave-fly-top{animation-name:vue-popup-plus-animation-leave-fly-top}.vue-popup-plus-animation-enter-fly-left{animation-name:vue-popup-plus-animation-enter-fly-left}.vue-popup-plus-animation-leave-fly-left{animation-name:vue-popup-plus-animation-leave-fly-left}.vue-popup-plus-animation-enter-fly-right{animation-name:vue-popup-plus-animation-enter-fly-right}.vue-popup-plus-animation-leave-fly-right{animation-name:vue-popup-plus-animation-leave-fly-right}.vue-popup-plus-animation-enter-fly-bottom{animation-name:vue-popup-plus-animation-enter-fly-bottom}.vue-popup-plus-animation-leave-fly-bottom{animation-name:vue-popup-plus-animation-leave-fly-bottom}@-moz-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-webkit-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-o-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-moz-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-webkit-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-o-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-moz-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-o-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-moz-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-o-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-o-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-o-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-o-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@-o-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}:root{--popup-color-mask: rgba(125,125,125,.3);--popup-color-mask-dark-lite: rgba(112,112,112,.3);--popup-color-mask-dark: rgba(94,94,94,.3);--popup-color-mask-dark-most: rgba(50,50,50,.3);--popup-color-mask-light-lite: rgba(138,138,138,.3);--popup-color-mask-light: rgba(157,157,157,.3);--popup-color-mask-light-most: rgba(203,203,203,.3)}.dark{--popup-color-mask: rgba(75,75,75,.3);--popup-color-mask-dark-lite: rgba(68,68,68,.3);--popup-color-mask-dark: rgba(56,56,56,.3);--popup-color-mask-dark-most: rgba(30,30,30,.3);--popup-color-mask-light-lite: rgba(93,93,93,.3);--popup-color-mask-light: rgba(120,120,120,.3);--popup-color-mask-light-most: rgba(183,183,183,.3)}")),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { defineComponent as P, inject as v, createElementBlock as N, openBlock as d, normalizeStyle as g, normalizeClass as U, unref as p, ref as h, computed as a, defineAsyncComponent as V, provide as x, onMounted as b, onUpdated as W, nextTick as B, createElementVNode as H, createBlock as A, resolveDynamicComponent as L, mergeProps as F, useCssVars as z, Transition as X, withCtx as S, renderSlot as j, createCommentVNode as D, Fragment as G, createVNode as w, createApp as J, render as O, toRefs as q, reactive as K } from "vue";
3
- const I = "vue-popup-plus", y = {
4
- INSTANCE_ID: Symbol(`${I}-instance-id`),
5
- COMPUTED_VIEW_STYLE: Symbol(`${I}-computed-view-style`)
6
- }, E = {
7
- INSTANCE_STORE: Symbol(`${I}-instance-store`)
8
- };
9
- function Q(o = 0) {
1
+ (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".vue-popup-plus-animation{animation-timing-function:linear;animation-duration:var(--v6e614cc2)}.popup-frame[data-v-5a4614b0]{display:flex;flex-direction:column;position:fixed;inset:0;pointer-events:none}.popup-mask[data-v-c4c8c95e]{position:fixed;inset:0;background-color:var(--popup-color-mask)}.popup-mask.is-blur[data-v-c4c8c95e]{-webkit-backdrop-filter:blur(15px) saturate(180%);backdrop-filter:blur(15px) saturate(180%)}.popup-view[data-v-bbc1055f]{position:relative;pointer-events:auto}.vue-popup-plus-animation-enter-fade{animation-name:vue-popup-plus-animation-enter-fade}.vue-popup-plus-animation-leave-fade{animation-name:vue-popup-plus-animation-leave-fade}.vue-popup-plus-animation-enter-scale-enlarge{animation-name:vue-popup-plus-animation-enter-scale-enlarge}.vue-popup-plus-animation-leave-scale-enlarge{animation-name:vue-popup-plus-animation-leave-scale-enlarge}.vue-popup-plus-animation-enter-scale-reduce{animation-name:vue-popup-plus-animation-enter-scale-reduce}.vue-popup-plus-animation-leave-scale-reduce{animation-name:vue-popup-plus-animation-leave-scale-reduce}.vue-popup-plus-animation-enter-fly-top{animation-name:vue-popup-plus-animation-enter-fly-top}.vue-popup-plus-animation-leave-fly-top{animation-name:vue-popup-plus-animation-leave-fly-top}.vue-popup-plus-animation-enter-fly-left{animation-name:vue-popup-plus-animation-enter-fly-left}.vue-popup-plus-animation-leave-fly-left{animation-name:vue-popup-plus-animation-leave-fly-left}.vue-popup-plus-animation-enter-fly-right{animation-name:vue-popup-plus-animation-enter-fly-right}.vue-popup-plus-animation-leave-fly-right{animation-name:vue-popup-plus-animation-leave-fly-right}.vue-popup-plus-animation-enter-fly-bottom{animation-name:vue-popup-plus-animation-enter-fly-bottom}.vue-popup-plus-animation-leave-fly-bottom{animation-name:vue-popup-plus-animation-leave-fly-bottom}@-moz-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-webkit-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-o-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-moz-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-webkit-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-o-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-moz-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-o-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-moz-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-o-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-o-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-o-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-o-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@-o-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}:root{--popup-color-mask: rgba(0,0,0,.45);--popup-color-mask-dark-lite: rgba(0,0,0,.45);--popup-color-mask-dark: rgba(0,0,0,.45);--popup-color-mask-dark-most: rgba(0,0,0,.45);--popup-color-mask-light-lite: rgba(26,26,26,.45);--popup-color-mask-light: rgba(64,64,64,.45);--popup-color-mask-light-most: rgba(153,153,153,.45)}.dark{--popup-color-mask: rgba(75,75,75,.45);--popup-color-mask-dark-lite: rgba(68,68,68,.45);--popup-color-mask-dark: rgba(56,56,56,.45);--popup-color-mask-dark-most: rgba(30,30,30,.45);--popup-color-mask-light-lite: rgba(93,93,93,.45);--popup-color-mask-light: rgba(120,120,120,.45);--popup-color-mask-light-most: rgba(183,183,183,.45)}")),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { defineComponent as C, useCssVars as Z, computed as p, inject as w, ref as $, onMounted as Y, createBlock as T, openBlock as h, Transition as ee, withCtx as S, renderSlot as W, createCommentVNode as H, unref as P, normalizeStyle as V, createElementBlock as N, normalizeClass as te, defineAsyncComponent as ne, provide as M, onUpdated as oe, nextTick as se, resolveDynamicComponent as re, mergeProps as ae, Teleport as ie, createElementVNode as ue, createVNode as E, createApp as ce, render as U, toRefs as le, reactive as q, onBeforeMount as pe, onBeforeUnmount as de, Fragment as z, renderList as me, markRaw as he } from "vue";
3
+ function fe(n) {
4
+ const e = Object.prototype.toString.call(n).match(/\s+(\w+)/);
5
+ return e ? e[1] : "Null";
6
+ }
7
+ function ge(n = 0) {
10
8
  return new Promise((e) => {
11
- window.setTimeout(e, o);
9
+ window.setTimeout(e, n);
12
10
  });
13
11
  }
14
- const Z = /* @__PURE__ */ P({
12
+ const R = "vue-popup-plus", A = {
13
+ INSTANCE_ID: Symbol(`${R}-instance-id`),
14
+ COMPUTED_VIEW_STYLE: Symbol(`${R}-computed-view-style`)
15
+ }, I = {
16
+ CORE: Symbol(`${R}-core`),
17
+ INSTANCE_STORE: Symbol(`${R}-instance-store`)
18
+ }, ve = "http://vue-popup-plus.styzy.cn", B = /* @__PURE__ */ C({
19
+ name: "PopupAnimation",
20
+ __name: "PopupAnimation",
21
+ props: {
22
+ type: {},
23
+ duration: {}
24
+ },
25
+ setup(n) {
26
+ Z((u) => ({
27
+ v6e614cc2: r.value
28
+ }));
29
+ const e = w(I.INSTANCE_STORE), o = $(!1), t = p(
30
+ () => `vue-popup-plus-animation vue-popup-plus-animation-enter-${n.type}`
31
+ ), s = p(
32
+ () => `vue-popup-plus-animation vue-popup-plus-animation-leave-${n.type}`
33
+ ), r = p(() => `${n.duration}ms`);
34
+ return Y(() => {
35
+ o.value = !0;
36
+ }), (u, m) => (h(), T(ee, {
37
+ "enter-active-class": t.value,
38
+ "leave-active-class": s.value
39
+ }, {
40
+ default: S(() => [
41
+ o.value && !P(e).isBeforeUnmount.value ? W(u.$slots, "default", {
42
+ key: 0,
43
+ style: V({ animationDuration: `${n.duration}ms` })
44
+ }) : H("", !0)
45
+ ]),
46
+ _: 3
47
+ }, 8, ["enter-active-class", "leave-active-class"]));
48
+ }
49
+ }), ye = /* @__PURE__ */ C({
50
+ name: "PopupFrame",
51
+ __name: "PopupFrame",
52
+ props: {
53
+ placement: {},
54
+ zIndex: {}
55
+ },
56
+ setup(n) {
57
+ const e = p(() => ({
58
+ alignItems: n.placement.includes("left") ? "flex-start" : n.placement.includes("right") ? "flex-end" : "center",
59
+ justifyContent: n.placement.includes("top") ? "flex-start" : n.placement.includes("bottom") ? "flex-end" : "center",
60
+ zIndex: n.zIndex
61
+ }));
62
+ return (o, t) => (h(), N("div", {
63
+ class: "popup-frame",
64
+ style: V(e.value)
65
+ }, [
66
+ W(o.$slots, "default", {}, void 0, !0)
67
+ ], 4));
68
+ }
69
+ }), F = (n, e) => {
70
+ const o = n.__vccOpts || n;
71
+ for (const [t, s] of e)
72
+ o[t] = s;
73
+ return o;
74
+ }, _e = /* @__PURE__ */ F(ye, [["__scopeId", "data-v-5a4614b0"]]), we = /* @__PURE__ */ C({
15
75
  name: "PopupMask",
16
76
  __name: "PopupMask",
17
- setup(o) {
18
- const e = v(y.INSTANCE_ID), n = v(E.INSTANCE_STORE);
77
+ setup(n) {
78
+ const e = w(A.INSTANCE_ID), o = w(I.INSTANCE_STORE);
19
79
  function t() {
20
- n.maskClickClose && _e().destroy(e);
80
+ o.maskClickClose && Ue().destroy(e);
21
81
  }
22
- return (i, r) => (d(), N("div", {
23
- class: U(["popup-mask", { "is-blur": p(n).maskBlur.value }]),
24
- style: g({ zIndex: p(n).zIndex.value }),
82
+ return (s, r) => (h(), N("div", {
83
+ class: te(["popup-mask", { "is-blur": P(o).maskBlur.value }]),
84
+ style: V({ zIndex: P(o).zIndex.value }),
25
85
  onClick: t
26
86
  }, null, 6));
27
87
  }
28
- }), M = (o, e) => {
29
- const n = o.__vccOpts || o;
30
- for (const [t, i] of e)
31
- n[t] = i;
32
- return n;
33
- }, ee = /* @__PURE__ */ M(Z, [["__scopeId", "data-v-53a2b502"]]), te = /* @__PURE__ */ P({
88
+ }), Pe = /* @__PURE__ */ F(we, [["__scopeId", "data-v-c4c8c95e"]]), Ce = /* @__PURE__ */ C({
34
89
  name: "PopupView",
35
90
  __name: "PopupView",
36
- setup(o) {
37
- const e = h(), n = v(y.INSTANCE_ID), t = v(E.INSTANCE_STORE), i = h(0), r = h(0), u = a(() => typeof t.component == "function" ? V(t.component) : t.component), m = a(() => t.viewTranslateOverflow.value ? t.viewTranslateX.value : t.viewTranslateX.value > 0 ? Math.min(
38
- t.viewTranslateX.value,
39
- (window.innerWidth - i.value) / 2
40
- ) : Math.max(
41
- t.viewTranslateX.value,
42
- -(window.innerWidth - i.value) / 2
43
- )), _ = a(() => t.viewTranslateOverflow.value ? t.viewTranslateY.value : t.viewTranslateY.value > 0 ? Math.min(
44
- t.viewTranslateY.value,
45
- (window.innerHeight - r.value) / 2
46
- ) : Math.max(
47
- t.viewTranslateY.value,
48
- -(window.innerHeight - r.value) / 2
49
- )), C = a(() => ({
50
- width: c(t.width.value),
51
- maxWidth: c(t.maxWidth.value),
52
- minWidth: c(t.minWidth.value),
53
- height: c(t.height.value),
54
- maxHeight: c(t.maxHeight.value),
55
- minHeight: c(t.minHeight.value),
56
- transform: `translate(${m.value}px, ${_.value}px)`
57
- })), R = a(() => ({
58
- width: i.value,
91
+ setup(n) {
92
+ const e = $(), o = w(A.INSTANCE_ID), t = w(I.INSTANCE_STORE), s = $(0), r = $(0), u = p(() => typeof t.component == "function" ? ne(t.component) : t.component), m = p(() => {
93
+ const c = Math.ceil(window.innerWidth - s.value);
94
+ return t.placement.value.includes("left") ? [0, c] : t.placement.value.includes("right") ? [-c, 0] : [-(c / 2), c / 2];
95
+ }), f = p(() => {
96
+ const c = Math.ceil(window.innerHeight - r.value);
97
+ return t.placement.value.includes("top") ? [0, c] : t.placement.value.includes("bottom") ? [-c, 0] : [-(c / 2), c / 2];
98
+ }), g = p(() => t.viewTranslateOverflow.value ? t.viewTranslateX.value : Math.max(
99
+ Math.min(t.viewTranslateX.value, m.value[1]),
100
+ m.value[0]
101
+ )), x = p(() => t.viewTranslateOverflow.value ? t.viewTranslateY.value : Math.max(
102
+ Math.min(t.viewTranslateY.value, f.value[1]),
103
+ f.value[0]
104
+ )), K = p(() => ({
105
+ width: y(t.width.value),
106
+ maxWidth: y(t.maxWidth.value),
107
+ minWidth: y(t.minWidth.value),
108
+ height: y(t.height.value),
109
+ maxHeight: y(t.maxHeight.value),
110
+ minHeight: y(t.minHeight.value),
111
+ transform: `translate(${g.value}px, ${x.value}px)`
112
+ })), Q = p(() => ({
113
+ width: s.value,
59
114
  height: r.value,
60
115
  zIndex: t.zIndex.value,
61
- translateX: m.value,
62
- translateY: _.value
116
+ translateX: g.value,
117
+ translateY: x.value
63
118
  }));
64
- x(y.COMPUTED_VIEW_STYLE, R), b(() => {
65
- window.setTimeout(k, t.animationDuration.value);
66
- }), W(() => {
67
- k();
119
+ M(A.COMPUTED_VIEW_STYLE, Q), Y(() => {
120
+ window.setTimeout(L, t.animationDuration.value);
121
+ }), oe(() => {
122
+ L();
68
123
  });
69
- async function k() {
70
- await B();
71
- const s = e.value?.getBoundingClientRect();
72
- s && (i.value = s.width, r.value = s.height);
124
+ async function L() {
125
+ await se();
126
+ const c = e.value?.getBoundingClientRect();
127
+ c && (s.value = c.width, r.value = c.height);
73
128
  }
74
- function c(s) {
75
- return typeof s == "number" ? `${s}px` : s;
129
+ function y(c) {
130
+ return typeof c == "number" ? `${c}px` : c;
76
131
  }
77
- return (s, we) => (d(), N("div", {
78
- class: "popup-view-wrapper",
79
- style: g({ zIndex: p(t).zIndex.value })
132
+ return (c, ze) => (h(), N("div", {
133
+ class: "popup-view",
134
+ style: V(K.value),
135
+ ref_key: "popupViewRef",
136
+ ref: e
80
137
  }, [
81
- H("div", {
82
- class: "popup-view",
83
- style: g(C.value),
84
- ref_key: "popupViewRef",
85
- ref: e
86
- }, [
87
- (d(), A(L(u.value), F({
88
- key: `${p(n).name}-component`
89
- }, p(t).componentProps), null, 16))
90
- ], 4)
138
+ (h(), T(re(u.value), ae({
139
+ key: `${P(o).name}-component`
140
+ }, P(t).componentProps), null, 16))
91
141
  ], 4));
92
142
  }
93
- }), ne = /* @__PURE__ */ M(te, [["__scopeId", "data-v-14a39a91"]]), $ = /* @__PURE__ */ P({
94
- name: "PopupAnimation",
95
- __name: "PopupAnimation",
96
- props: {
97
- type: {},
98
- duration: {}
99
- },
100
- setup(o) {
101
- z((u) => ({
102
- v9a56ef92: r.value
103
- }));
104
- const e = v(E.INSTANCE_STORE), n = h(!1), t = a(
105
- () => `vue-popup-plus-animation vue-popup-plus-animation-enter-${o.type}`
106
- ), i = a(
107
- () => `vue-popup-plus-animation vue-popup-plus-animation-leave-${o.type}`
108
- ), r = a(() => `${o.duration}ms`);
109
- return b(() => {
110
- n.value = !0;
111
- }), (u, m) => (d(), A(X, {
112
- "enter-active-class": t.value,
113
- "leave-active-class": i.value
114
- }, {
115
- default: S(() => [
116
- n.value && !p(e).isBeforeUnmount.value ? j(u.$slots, "default", {
117
- key: 0,
118
- style: g({ animationDuration: `${o.duration}ms` })
119
- }) : D("", !0)
120
- ]),
121
- _: 3
122
- }, 8, ["enter-active-class", "leave-active-class"]));
123
- }
124
- }), T = /* @__PURE__ */ P({
125
- name: "Popup",
126
- __name: "Popup",
143
+ }), Ie = /* @__PURE__ */ F(Ce, [["__scopeId", "data-v-bbc1055f"]]), xe = { class: "popup-instance" }, O = /* @__PURE__ */ C({
144
+ name: "PopupInstance",
145
+ __name: "PopupInstance",
127
146
  props: {
128
147
  store: {}
129
148
  },
130
- setup(o) {
131
- return x(y.INSTANCE_ID, o.store.id), x(E.INSTANCE_STORE, o.store), (e, n) => (d(), N(G, null, [
132
- o.store.mask ? (d(), A($, {
133
- key: 0,
134
- duration: o.store.animationDuration.value,
135
- type: o.store.maskAnimation.value
136
- }, {
137
- default: S(() => [
138
- w(ee)
139
- ]),
140
- _: 1
141
- }, 8, ["duration", "type"])) : D("", !0),
142
- w($, {
143
- duration: o.store.animationDuration.value,
144
- type: o.store.viewAnimation.value
145
- }, {
146
- default: S(() => [
147
- w(ne)
148
- ]),
149
- _: 1
150
- }, 8, ["duration", "type"])
151
- ], 64));
152
- }
153
- }), oe = (o, {
149
+ setup(n) {
150
+ return M(A.INSTANCE_ID, n.store.id), M(I.INSTANCE_STORE, n.store), (e, o) => (h(), T(ie, {
151
+ to: n.store.appendTo
152
+ }, [
153
+ ue("div", xe, [
154
+ n.store.mask ? (h(), T(B, {
155
+ key: 0,
156
+ duration: n.store.animationDuration.value,
157
+ type: n.store.maskAnimation.value
158
+ }, {
159
+ default: S(() => [
160
+ E(Pe)
161
+ ]),
162
+ _: 1
163
+ }, 8, ["duration", "type"])) : H("", !0),
164
+ E(_e, {
165
+ placement: n.store.placement.value,
166
+ zIndex: n.store.zIndex.value
167
+ }, {
168
+ default: S(() => [
169
+ E(B, {
170
+ duration: n.store.animationDuration.value,
171
+ type: n.store.viewAnimation.value
172
+ }, {
173
+ default: S(() => [
174
+ E(Ie)
175
+ ]),
176
+ _: 1
177
+ }, 8, ["duration", "type"])
178
+ ]),
179
+ _: 1
180
+ }, 8, ["placement", "zIndex"])
181
+ ])
182
+ ], 8, ["to"]));
183
+ }
184
+ }), Ee = (n, {
154
185
  component: e,
155
- componentProps: n,
186
+ componentProps: o,
156
187
  onMounted: t,
157
- onUnmounted: i,
188
+ onUnmounted: s,
158
189
  appendTo: r,
159
190
  mask: u,
160
191
  maskClickClose: m,
161
- disableScroll: _,
162
- ...C
192
+ disableScroll: f,
193
+ ...g
163
194
  }) => ({
164
- id: o,
165
- parentElement: ie(r),
195
+ id: n,
196
+ parentElement: $e(r),
166
197
  appendTo: r,
167
198
  mask: u,
168
199
  maskClickClose: m,
169
- disableScroll: _,
200
+ disableScroll: f,
170
201
  component: e,
171
- componentProps: n,
202
+ componentProps: o,
172
203
  onMounted: t,
173
- onUnmounted: i,
174
- isBeforeUnmount: h(!1),
175
- ...q(K(C))
204
+ onUnmounted: s,
205
+ isBeforeUnmount: $(!1),
206
+ ...le(q(g))
176
207
  });
177
- function ie(o) {
178
- return typeof o == "string" && (o = document.querySelector(o) || document.body), o;
208
+ function $e(n) {
209
+ return typeof n == "string" && (n = document.querySelector(n) || document.body), n;
179
210
  }
180
- class re {
181
- #t;
211
+ class Te {
212
+ _seed;
182
213
  get seed() {
183
- return this.#t;
214
+ return this._seed;
184
215
  }
185
216
  get name() {
186
217
  return `vue-popup-plus-instance-${this.seed}`;
187
218
  }
188
219
  constructor(e) {
189
- this.#t = e;
220
+ this._seed = e;
190
221
  }
191
222
  }
192
- class se {
193
- #t;
194
- #i;
195
- #e;
223
+ var j = /* @__PURE__ */ ((n) => (n.ROOT_COMPONENT = "RootComponent", n.APP = "App", n.VNODE = "VNode", n))(j || {});
224
+ class Ne {
196
225
  #n;
197
- #r;
226
+ _id;
227
+ _store;
228
+ renderType;
229
+ #e;
198
230
  #o;
231
+ #t;
199
232
  get id() {
200
- return this.#i;
233
+ return this._id;
201
234
  }
202
235
  get store() {
203
- return this.#e;
204
- }
205
- get renderType() {
206
- return this.#t.config.debugMode ? "app" : "vnode";
236
+ return this._store;
207
237
  }
208
- constructor(e, n) {
209
- this.#t = e, this.#i = new re(e.seed), this.#e = oe(this.#i, n), this.renderType === "app" ? (this.#n = J(T, { store: this.#e }), this.#n._context.components = this.#t.app._context.components, this.#n._context.provides = this.#t.app._context.provides, this.#n._context.config = this.#t.app._context.config, this.#n._context.directives = this.#t.app._context.directives, this.#n._context.mixins = this.#t.app._context.mixins) : (this.#r = w(T, { store: this.#e }), this.#r.appContext = this.#t.app._context, this.#r.appContext.components.Popup = T);
238
+ constructor(e, o) {
239
+ this.#n = e, this._id = new Te(e.seed), this._store = Ee(this._id, o), this.renderType = e.isRootComponentRegistered ? "RootComponent" : e.config.debugMode ? "App" : "VNode";
210
240
  }
211
241
  mount() {
212
- return this.#o = document.createElement("div"), this.renderType === "app" ? this.#n.mount(this.#o) : O(this.#r, this.#o), this.#e.parentElement.appendChild(this.#o), this.#e.onMounted(), this.id;
242
+ return this.renderType === "App" ? (this.#t = document.createElement("div"), this.#e = ce(O, { store: this._store }), this.#e._context.components = this.#n.app._context.components, this.#e._context.provides = this.#n.app._context.provides, this.#e._context.config = this.#n.app._context.config, this.#e._context.directives = this.#n.app._context.directives, this.#e._context.mixins = this.#n.app._context.mixins, this.#e.mount(this.#t), this._store.parentElement.appendChild(this.#t)) : this.renderType === "VNode" && (this.#t = document.createElement("div"), this.#o = E(O, {
243
+ store: this._store
244
+ }), this.#o.appContext = this.#n.app._context, this.#o.appContext.components.Popup = O, U(this.#o, this.#t), this._store.parentElement.appendChild(this.#t)), this.#n.addInstance(this), this._store.onMounted(), this.id;
213
245
  }
214
246
  async unmount(e) {
215
- this.#e.isBeforeUnmount.value = !0, await Q(this.#e.animationDuration.value), this.renderType === "app" ? this.#n.unmount() : O(null, this.#o), this.#e.parentElement.removeChild(this.#o), this.#e.onUnmounted(e);
247
+ this._store.isBeforeUnmount.value = !0, await ge(this._store.animationDuration.value), this.renderType === "App" ? (this.#e.unmount(), this._store.parentElement.removeChild(this.#t)) : this.renderType === "VNode" && (U(null, this.#t), this._store.parentElement.removeChild(this.#t)), this.#n.removeInstance(this), this._store.onUnmounted(e);
216
248
  }
217
249
  update(e) {
218
- for (const n in e) {
219
- const t = n, i = e[t] === void 0 ? this.#e[t].value : e[t];
220
- this.#e[t].value = i;
250
+ for (const o in e) {
251
+ const t = o, s = e[t] === void 0 ? this._store[t].value : e[t];
252
+ this._store[t].value = s;
221
253
  }
222
254
  }
223
255
  }
224
- class f extends Error {
225
- constructor(e) {
226
- super(e);
227
- }
228
- toString() {
229
- return `vue-popup-plus error: ${this.message}`;
230
- }
231
- }
232
- class ae {
256
+ class Se {
233
257
  get NONE() {
234
258
  return "none";
235
259
  }
@@ -257,54 +281,205 @@ class ae {
257
281
  constructor() {
258
282
  }
259
283
  }
260
- const l = new ae(), ye = (o) => o, ue = (o) => new Proxy(
261
- o,
284
+ const _ = new Se(), Oe = "1.5.0", b = Oe, a = {
285
+ /**
286
+ * 成功日志
287
+ */
288
+ Success: "success",
289
+ /**
290
+ * 信息日志
291
+ */
292
+ Info: "info",
293
+ /**
294
+ * 警告日志
295
+ */
296
+ Warning: "warning",
297
+ /**
298
+ * 错误日志
299
+ */
300
+ Error: "error"
301
+ }, i = {
302
+ /**
303
+ * 默认类型
304
+ */
305
+ Default: "default",
306
+ /**
307
+ * 数据类型
308
+ */
309
+ Data: "data"
310
+ };
311
+ class d {
312
+ namespace = "VuePopupPlus";
313
+ type;
314
+ caller;
315
+ message;
316
+ group;
317
+ get hasCaller() {
318
+ return !!this.caller;
319
+ }
320
+ get hasGroup() {
321
+ return !!this.group.length;
322
+ }
323
+ /**
324
+ * 创建日志实例
325
+ *
326
+ * @param type 日志类型
327
+ * @param name 日志名称
328
+ * @param message 日志消息
329
+ * @param group 日志组
330
+ * @returns 日志实例
331
+ */
332
+ constructor({
333
+ type: e = a.Info,
334
+ caller: o = "",
335
+ message: t = "",
336
+ group: s = []
337
+ } = {}) {
338
+ this.type = e, this.caller = o, this.message = t, this.group = s, this.group.unshift({
339
+ type: i.Default,
340
+ message: `核心版本: ${b}`
341
+ }), this.hasCaller && this.group.unshift({
342
+ type: i.Default,
343
+ message: `调用者: ${this.caller}`
344
+ });
345
+ }
346
+ }
347
+ const l = (n) => {
348
+ const e = J();
349
+ e?.config.debugMode && e.config.logHandler(n);
350
+ }, X = (n) => {
351
+ const e = k({
352
+ printer: console.groupCollapsed,
353
+ type: n.type,
354
+ hasPrefix: !0
355
+ }), o = k({
356
+ printer: console.log,
357
+ type: n.type,
358
+ isGroupContent: !0
359
+ }), t = k({
360
+ printer: De(n.type),
361
+ type: n.type,
362
+ hasPrefix: !0
363
+ }), s = `${n.namespace} ${n.type.toUpperCase()}`, r = n.message;
364
+ n.hasGroup ? (e(s, r), n.group?.forEach((u, m) => {
365
+ m === 0 && n.hasCaller ? o(u.message, "") : u.type === void 0 || u.type === i.Default ? o(u.message) : u.type === i.Data && (o(
366
+ `${u.dataName} : ${u.dataType ?? "any"} ( ${fe(u.dataValue)} )`
367
+ ), console.dir(u.dataValue));
368
+ }), console.groupEnd()) : t(s, r);
369
+ };
370
+ function De(n) {
371
+ switch (n) {
372
+ case a.Success:
373
+ return console.log;
374
+ case a.Info:
375
+ default:
376
+ return console.log;
377
+ case a.Warning:
378
+ return console.warn;
379
+ case a.Error:
380
+ return console.error;
381
+ }
382
+ }
383
+ const Re = {
384
+ [a.Success]: "#4caf50",
385
+ [a.Info]: "#3499fe",
386
+ [a.Warning]: "#e6a23c",
387
+ [a.Error]: "#f56c6c"
388
+ }, k = function({
389
+ printer: n,
390
+ type: e,
391
+ hasPrefix: o = !1,
392
+ isGroupContent: t = !1
393
+ }) {
394
+ const s = Re[e], r = `color: #FFFFFF;background-color: ${s};padding: 4px 8px;margin-right: 6px;border-radius: 4px;font-weight: 700;`, u = `background-color: ${s}22;padding: 4px 8px;border-radius: 4px;font-weight: 400;`, m = `color: ${s};background-color: ${s}22;padding: 4px 8px;border-radius: 4px;font-weight: 400;`;
395
+ return o ? (f, g, x = "") => {
396
+ n(
397
+ `%c${f}%c${g}`,
398
+ r,
399
+ (t ? m : u) + x
400
+ );
401
+ } : (f, g = "") => {
402
+ n(
403
+ `%c${f}`,
404
+ (t ? m : u) + g
405
+ );
406
+ };
407
+ };
408
+ class v extends Error {
409
+ /**
410
+ * 弹出层错误类
411
+ *
412
+ * - 建议从 {@link ILog} 日志实例创建错误
413
+ * @param {ErrorOption} options 错误参数
414
+ * @example
415
+ * new PopupError(new Log({
416
+ * type: LogType.Error,
417
+ * caller: 'controller.render()',
418
+ * message: '弹出层渲染失败',
419
+ * }))
420
+ */
421
+ constructor({ namespace: e, caller: o, message: t }) {
422
+ super(), this.message = `[${e} error] ${o}: ${t}`;
423
+ }
424
+ }
425
+ const Ye = (n) => n, Ae = (n) => new Proxy(
426
+ n,
262
427
  {
263
- set(e, n, t) {
264
- throw new f(`${n} 是只读属性,不能被覆盖`);
428
+ set(e, o, t) {
429
+ const s = new d({
430
+ caller: "definePlugin()",
431
+ message: `${o} 是只读属性,不能被覆盖`
432
+ });
433
+ throw l(s), new v(s);
265
434
  },
266
- get(e, n) {
267
- return n === "customProperties" ? ce(o) : n === "customAnimations" ? le() : o[n];
435
+ get(e, o) {
436
+ return o === "customProperties" ? be(n) : o === "customAnimations" ? Ve() : n[o];
268
437
  }
269
438
  }
270
439
  );
271
- function ce(o) {
440
+ function be(n) {
272
441
  return new Proxy(
273
442
  {},
274
443
  {
275
- set: (e, n, t) => {
276
- if (n in o)
277
- throw new f(
278
- `定义插件扩展属性 ${n} 时失败,${n} 是只读属性,不能被覆盖`
279
- );
280
- return o.__proto__[n] = t, !0;
444
+ set: (e, o, t) => {
445
+ if (o in n) {
446
+ const s = new d({
447
+ caller: "definePlugin()",
448
+ message: `定义插件扩展属性 ${o} 时失败,${o} 是只读属性,不能被覆盖`
449
+ });
450
+ throw l(s), new v(s);
451
+ }
452
+ return n.__proto__[o] = t, !0;
281
453
  },
282
- get: (e, n) => {
283
- if (n in o)
284
- return o.__proto__[n];
454
+ get: (e, o) => {
455
+ if (o in n)
456
+ return n.__proto__[o];
285
457
  }
286
458
  }
287
459
  );
288
460
  }
289
- function le(o) {
461
+ function Ve(n) {
290
462
  return new Proxy(
291
463
  {},
292
464
  {
293
- set: (e, n, t) => {
294
- if (n in l)
295
- throw new f(
296
- `定义插件扩展动画类型 ${n} 时失败,${n} 是只读属性,不能被覆盖`
297
- );
298
- return l.__proto__[n] = t, !0;
465
+ set: (e, o, t) => {
466
+ if (o in _) {
467
+ const s = new d({
468
+ caller: "definePlugin()",
469
+ message: `定义插件扩展动画类型 ${o} 时失败,${o} 是只读属性,不能被覆盖`
470
+ });
471
+ throw l(s), new v(s);
472
+ }
473
+ return _.__proto__[o] = t, !0;
299
474
  },
300
- get: (e, n) => {
301
- if (n in l)
302
- return l.__proto__[n];
475
+ get: (e, o) => {
476
+ if (o in _)
477
+ return _.__proto__[o];
303
478
  }
304
479
  }
305
480
  );
306
481
  }
307
- const pe = "1.4.0", de = {
482
+ const ke = {
308
483
  appendTo: document.body,
309
484
  mask: !0,
310
485
  maskClickClose: !1,
@@ -320,92 +495,285 @@ const pe = "1.4.0", de = {
320
495
  height: "auto",
321
496
  maxHeight: "auto",
322
497
  minHeight: "auto",
498
+ placement: "center",
323
499
  viewTranslateX: 0,
324
500
  viewTranslateY: 0,
325
501
  viewTranslateOverflow: !1,
326
- viewAnimation: l.FADE,
327
- maskAnimation: l.FADE,
502
+ viewAnimation: _.FADE,
503
+ maskAnimation: _.FADE,
328
504
  maskBlur: !0,
329
505
  animationDuration: 100
330
506
  };
331
- class me {
507
+ class Me {
332
508
  _core;
509
+ get isInstalled() {
510
+ return !!this._core.app;
511
+ }
333
512
  get version() {
334
- return pe;
513
+ return b;
335
514
  }
336
515
  constructor(e) {
337
516
  this._core = e;
338
517
  }
339
518
  install(e) {
340
- e.config.globalProperties[this._core.config.prototypeName] = this, this._core.app = e;
341
- }
342
- use(e, n) {
343
- if (!this._core.addPlugin(e))
344
- throw new f(
345
- `使用插件 ${e.name} 失败,已存在同名插件 ${e.name}`
346
- );
347
- e.install(ue(this), this._core.config, n);
348
- }
349
- render({ zIndex: e, ...n }) {
519
+ e.config.globalProperties[this._core.config.prototypeName] = this, this._core.app = e, e.provide(I.CORE, this._core);
520
+ }
521
+ use(e, o) {
522
+ const t = new d({
523
+ type: a.Success,
524
+ caller: "popup.use()",
525
+ group: [
526
+ {
527
+ type: i.Default,
528
+ message: `插件名称: ${e.name}`
529
+ },
530
+ {
531
+ type: i.Default,
532
+ message: `插件作者: ${e.author ?? "未知(可能存在安全风险)"}`
533
+ },
534
+ {
535
+ type: i.Default,
536
+ message: `插件要求最低核心版本: ${e.requiredCoreVersion?.min ?? "-"}`
537
+ },
538
+ {
539
+ type: i.Default,
540
+ message: `插件要求最高核心版本: ${e.requiredCoreVersion?.max ?? "-"}`
541
+ }
542
+ ]
543
+ });
544
+ if (!this._core.addPlugin(e)) {
545
+ t.type = a.Error, t.message = `注册插件 ${e.name} 失败,已存在同名插件 ${e.name}`, l(t);
546
+ return;
547
+ }
548
+ const s = e.requiredCoreVersion?.min || e.requiredCoreVersion?.max;
549
+ if (s)
550
+ if (We(e))
551
+ t.group.push({
552
+ type: i.Default,
553
+ message: "插件版本校验: 通过"
554
+ });
555
+ else {
556
+ t.type = a.Error, t.message = `注册插件 ${e.name} 失败,未通过核心版本校验`, t.group.push({
557
+ type: i.Default,
558
+ message: "插件版本校验: 未通过"
559
+ }), l(t);
560
+ return;
561
+ }
562
+ else
563
+ t.group.push({
564
+ type: i.Default,
565
+ message: "插件版本校验: 未校验(可能存在兼容性问题)"
566
+ });
567
+ t.group.push({
568
+ type: i.Data,
569
+ dataName: "插件注册选项",
570
+ dataValue: o,
571
+ dataType: "PluginOption"
572
+ }), e.install(Ae(this), this._core.config, o);
573
+ const r = e.author !== void 0;
574
+ !s || !r ? (t.type = a.Warning, t.message = `注册插件 ${e.name} 成功,但可能存在风险`) : (t.type = a.Success, t.message = `注册插件 ${e.name} 成功`), l(t);
575
+ }
576
+ render({ zIndex: e, ...o }) {
577
+ const t = new d({
578
+ type: a.Info,
579
+ caller: "popup.render()"
580
+ });
581
+ if (!this.isInstalled)
582
+ throw t.type = a.Error, t.message = "渲染弹出层失败,请先调用 app.use() 注册插件", l(t), new v(t);
350
583
  e = e ?? this._core.config.zIndex++;
351
- const t = new se(this._core, {
352
- ...de,
353
- ...n,
584
+ const s = {
585
+ ...ke,
586
+ ...o,
354
587
  zIndex: e
588
+ }, r = new Ne(this._core, s);
589
+ return r.mount(), r.renderType !== j.ROOT_COMPONENT && l(
590
+ new d({
591
+ type: a.Warning,
592
+ caller: "popup.render()",
593
+ message: `渲染弹出层 ${r.id.name} 未使用 PopupRoot 根组件渲染,无法同步应用上下文`,
594
+ group: [
595
+ {
596
+ type: i.Default,
597
+ message: "修复建议:使用 PopupRoot 根组件包裹 App 组件以同步应用上下文"
598
+ },
599
+ {
600
+ type: i.Default,
601
+ message: `帮助文档:${ve}/guide/initialization.html#同步应用上下文`
602
+ }
603
+ ]
604
+ })
605
+ ), t.message = `渲染弹出层 ${r.id.name} 成功`, t.group.push({
606
+ type: i.Default,
607
+ message: `渲染方式:${r.renderType}`
608
+ }), t.group.push({
609
+ type: i.Data,
610
+ dataName: "instanceId",
611
+ dataValue: r.id,
612
+ dataType: "InstanceId"
613
+ }), t.group.push({
614
+ type: i.Data,
615
+ dataName: "options",
616
+ dataValue: arguments[0],
617
+ dataType: "RenderOption"
618
+ }), t.group.push({
619
+ type: i.Data,
620
+ dataName: "mergedOptions",
621
+ dataValue: s,
622
+ dataType: "RenderOption"
623
+ }), l(t), r.id;
624
+ }
625
+ update(e, o) {
626
+ const t = new d({
627
+ type: a.Info,
628
+ caller: "popup.update()"
355
629
  });
356
- return this._core.addInstance(t), t.mount(), t.id;
357
- }
358
- update(e, n) {
359
- const t = this._core.getInstance(e);
360
- t && t.update(n);
361
- }
362
- async destroy(e, n) {
363
- const t = this._core.getInstance(e);
364
- t && (await t.unmount(n), this._core.removeInstance(t));
630
+ if (!this.isInstalled)
631
+ throw t.type = a.Error, t.message = "更新弹出层失败,请先调用 app.use() 注册插件", l(t), new v(t);
632
+ const s = this._core.getInstance(e);
633
+ s && (s.update(o), t.message = `更新弹出层 ${s.id.name} 成功`, t.group.push({
634
+ type: i.Data,
635
+ dataName: "instanceId",
636
+ dataValue: s.id,
637
+ dataType: "InstanceId"
638
+ }), t.group.push({
639
+ type: i.Data,
640
+ dataName: "options",
641
+ dataValue: o,
642
+ dataType: "UpdateOption"
643
+ }), l(t));
644
+ }
645
+ async destroy(e, o) {
646
+ const t = new d({
647
+ type: a.Info,
648
+ caller: "popup.destroy()"
649
+ });
650
+ if (!this.isInstalled)
651
+ throw t.type = a.Error, t.message = "销毁弹出层失败,请先调用 app.use() 注册插件", l(t), new v(t);
652
+ const s = this._core.getInstance(e);
653
+ if (!s) {
654
+ t.type = a.Warning, t.message = `销毁弹出层 ${e.name} 失败,弹出层不存在`, l(t);
655
+ return;
656
+ }
657
+ await s.unmount(o), t.message = `销毁弹出层 ${s.id.name} 成功`, t.group.push({
658
+ type: i.Data,
659
+ dataName: "instanceId",
660
+ dataValue: s.id,
661
+ dataType: "InstanceId"
662
+ }), t.group.push({
663
+ type: i.Data,
664
+ dataName: "payload",
665
+ dataValue: o,
666
+ dataType: "any"
667
+ }), l(t);
365
668
  }
366
669
  }
367
- let Y = null;
368
- function he(o) {
369
- return new fe(o);
670
+ function We(n) {
671
+ const { requiredCoreVersion: e } = n, { min: o, max: t } = e ?? {};
672
+ return !(o && b < o || t && b > t);
673
+ }
674
+ const D = "PopupRoot", He = /* @__PURE__ */ C({
675
+ PopupRootComponentName: D,
676
+ __name: "PopupRoot",
677
+ setup(n) {
678
+ const e = w(I.CORE);
679
+ if (!e) {
680
+ const t = new d({
681
+ type: a.Error,
682
+ caller: "PopupRoot",
683
+ message: "根组件初始化失败,请先调用 createPopup() 方法"
684
+ });
685
+ throw l(t), new v(t);
686
+ }
687
+ const o = e?.instances || {};
688
+ return pe(() => {
689
+ e?.registerRootComponent();
690
+ }), de(() => {
691
+ e?.unregisterRootComponent();
692
+ }), (t, s) => (h(), N(z, null, [
693
+ W(t.$slots, "default"),
694
+ (h(!0), N(z, null, me(P(o), (r) => (h(), T(O, {
695
+ key: r.id.name,
696
+ store: r.store
697
+ }, null, 8, ["store"]))), 128))
698
+ ], 64));
699
+ }
700
+ });
701
+ let G = null;
702
+ function Fe(n) {
703
+ return new Le(n);
370
704
  }
371
- function ve() {
372
- return Y;
705
+ function J() {
706
+ return G;
373
707
  }
374
- class fe {
708
+ class Le {
375
709
  app;
376
- #t = 1;
377
- #i = {};
378
- #e;
379
- #n;
710
+ #n = 1;
711
+ #e = q({});
712
+ #o;
713
+ #t;
380
714
  #r = {};
381
- #o = "";
715
+ #a = "";
716
+ #s = 0;
382
717
  get seed() {
383
- return this.#t++;
718
+ return this.#n++;
384
719
  }
385
720
  get config() {
386
- return this.#n;
721
+ return this.#t;
387
722
  }
388
723
  get controller() {
724
+ return this.#o;
725
+ }
726
+ get instances() {
389
727
  return this.#e;
390
728
  }
729
+ get isRootComponentRegistered() {
730
+ return this.#s > 0;
731
+ }
391
732
  constructor({
392
733
  zIndex: e = 1e3,
393
- prototypeName: n = "$popup",
734
+ prototypeName: o = "$popup",
394
735
  autoDisableScroll: t = !0,
395
- debugMode: i = !1
736
+ logHandler: s = X,
737
+ debugMode: r = !1
396
738
  } = {}) {
397
- this.#n = { zIndex: e, prototypeName: n, autoDisableScroll: t, debugMode: i }, this.#e = new me(this), Y = this;
739
+ this.#t = {
740
+ zIndex: e,
741
+ prototypeName: o,
742
+ autoDisableScroll: t,
743
+ logHandler: s,
744
+ debugMode: r
745
+ }, this.#o = new Me(this), G = this;
746
+ }
747
+ registerRootComponent() {
748
+ if (this.#s > 0) {
749
+ const e = new d({
750
+ caller: "core",
751
+ type: a.Warning,
752
+ message: `检测到同时存在 ${this.#s + 1} 个 ${D} 根组件实例`,
753
+ group: [
754
+ {
755
+ type: i.Default,
756
+ message: `修改建议:${D} 根组件同一时刻应当只存在一个实例,请移除多余的 ${D} 根组件`
757
+ }
758
+ ]
759
+ });
760
+ l(e);
761
+ }
762
+ this.#s++;
763
+ }
764
+ unregisterRootComponent() {
765
+ this.#s--;
398
766
  }
399
767
  addInstance(e) {
400
- this.#i[e.id.name] = e, this.config.autoDisableScroll && e.store.disableScroll && this.#s();
768
+ this.#e[e.id.name] = he(e), this.config.autoDisableScroll && e.store.disableScroll && this.#i();
401
769
  }
402
770
  getInstance(e) {
403
- return this.#i[e.name];
771
+ return this.#e[e.name];
404
772
  }
405
773
  removeInstance(e) {
406
- delete this.#i[e.id.name], Object.values(this.#i).filter(
407
- (n) => n.store.disableScroll
408
- ).length === 0 && this.#a();
774
+ delete this.#e[e.id.name], Object.values(this.#e).filter(
775
+ (o) => o.store.disableScroll
776
+ ).length === 0 && this.#u();
409
777
  }
410
778
  addPlugin(e) {
411
779
  return this.getPlugin(e.name) ? !1 : (this.#r[e.name] = e, !0);
@@ -416,29 +784,39 @@ class fe {
416
784
  removePlugin(e) {
417
785
  delete this.#r[e];
418
786
  }
419
- #s() {
420
- document.body.style.overflow !== "hidden" && (this.#o = document.body.style.overflow, document.body.style.overflow = "hidden");
787
+ #i() {
788
+ document.body.style.overflow !== "hidden" && (this.#a = document.body.style.overflow, document.body.style.overflow = "hidden");
421
789
  }
422
- #a() {
423
- this.config.autoDisableScroll && (document.body.style.overflow = this.#o);
790
+ #u() {
791
+ this.config.autoDisableScroll && (document.body.style.overflow = this.#a);
424
792
  }
425
793
  }
426
- function Pe(o) {
427
- return he(o).controller;
794
+ function qe(n) {
795
+ return Fe(n).controller;
428
796
  }
429
- function _e() {
430
- const o = ve();
431
- if (!o)
432
- throw new f(
433
- "调用 usePopup 前请先调用 createPopup 创建弹出层控制器实例"
434
- );
435
- return o.controller;
797
+ function Ue() {
798
+ const n = J();
799
+ if (!n) {
800
+ const e = new d({
801
+ type: a.Error,
802
+ caller: "usePopup()",
803
+ message: "调用 usePopup() 前请先调用 createPopup() 创建弹出层控制器实例"
804
+ });
805
+ throw X(e), new v(e);
806
+ }
807
+ return n.controller;
436
808
  }
437
809
  export {
438
- l as POPUP_ANIMATIONS,
439
- y as POPUP_COMPONENT_INJECTS,
440
- Pe as createPopup,
441
- ye as definePlugin,
442
- _e as usePopup,
443
- pe as version
810
+ d as Log,
811
+ i as LogGroupItemType,
812
+ a as LogType,
813
+ _ as POPUP_ANIMATIONS,
814
+ A as POPUP_COMPONENT_INJECTS,
815
+ v as PopupError,
816
+ He as PopupRoot,
817
+ qe as createPopup,
818
+ Ye as definePlugin,
819
+ l as printLog,
820
+ Ue as usePopup,
821
+ b as version
444
822
  };