vue-popup-plus 1.3.4 → 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,96 +1,21 @@
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-1aed2cbe]{display:flex;justify-content:center;align-items:center;position:fixed;inset:0;pointer-events:none}.popup-view-wrapper .popup-view[data-v-1aed2cbe]{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-shrink{animation-name:vue-popup-plus-animation-enter-scale-shrink}.vue-popup-plus-animation-leave-scale-shrink{animation-name:vue-popup-plus-animation-leave-scale-shrink}.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-shrink{0%{transform:scale(5)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-shrink{0%{transform:scale(5)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-shrink{0%{transform:scale(5)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-shrink{0%{transform:scale(5)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-shrink{0%{transform:scale(1)}to{transform:scale(5)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-shrink{0%{transform:scale(1)}to{transform:scale(5)}}@-o-keyframes vue-popup-plus-animation-leave-scale-shrink{0%{transform:scale(1)}to{transform:scale(5)}}@keyframes vue-popup-plus-animation-leave-scale-shrink{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 V, unref as p, ref as m, computed as r, defineAsyncComponent as W, provide as E, onMounted as $, onUpdated as B, nextTick as H, createElementVNode as U, 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
- }, T = {
7
- INSTANCE_STORE: Symbol(`${I}-instance-store`)
8
- };
9
- function Q(n = 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
9
  window.setTimeout(e, n);
12
10
  });
13
11
  }
14
- const Z = /* @__PURE__ */ P({
15
- name: "PopupMask",
16
- __name: "PopupMask",
17
- setup(n) {
18
- const e = v(y.INSTANCE_ID), o = v(T.INSTANCE_STORE);
19
- function t() {
20
- o.maskClickClose && fe().destroy(e);
21
- }
22
- return (i, s) => (d(), N("div", {
23
- class: V(["popup-mask", { "is-blur": p(o).maskBlur.value }]),
24
- style: g({ zIndex: p(o).zIndex.value }),
25
- onClick: t
26
- }, null, 6));
27
- }
28
- }), M = (n, e) => {
29
- const o = n.__vccOpts || n;
30
- for (const [t, i] of e)
31
- o[t] = i;
32
- return o;
33
- }, ee = /* @__PURE__ */ M(Z, [["__scopeId", "data-v-53a2b502"]]), te = /* @__PURE__ */ P({
34
- name: "PopupView",
35
- __name: "PopupView",
36
- setup(n) {
37
- const e = m(), o = v(y.INSTANCE_ID), t = v(T.INSTANCE_STORE), i = m(0), s = m(0), u = r(() => typeof t.component == "function" ? W(t.component) : t.component), h = r(() => 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
- )), _ = r(() => t.viewTranslateOverflow.value ? t.viewTranslateY.value : t.viewTranslateY.value > 0 ? Math.min(
44
- t.viewTranslateY.value,
45
- (window.innerHeight - s.value) / 2
46
- ) : Math.max(
47
- t.viewTranslateY.value,
48
- -(window.innerHeight - s.value) / 2
49
- )), x = r(() => ({
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(${h.value}px, ${_.value}px)`
57
- })), R = r(() => ({
58
- width: i.value,
59
- height: s.value,
60
- zIndex: t.zIndex.value,
61
- translateX: h.value,
62
- translateY: _.value
63
- }));
64
- E(y.COMPUTED_VIEW_STYLE, R), $(() => {
65
- window.setTimeout(k, t.animationDuration.value);
66
- }), B(() => {
67
- k();
68
- });
69
- async function k() {
70
- await H();
71
- const a = e.value?.getBoundingClientRect();
72
- a && (i.value = a.width, s.value = a.height);
73
- }
74
- function c(a) {
75
- return typeof a == "number" ? `${a}px` : a;
76
- }
77
- return (a, _e) => (d(), N("div", {
78
- class: "popup-view-wrapper",
79
- style: g({ zIndex: p(t).zIndex.value })
80
- }, [
81
- U("div", {
82
- class: "popup-view",
83
- style: g(x.value),
84
- ref_key: "popupViewRef",
85
- ref: e
86
- }, [
87
- (d(), A(L(u.value), F({
88
- key: `${p(o).name}-component`
89
- }, p(t).componentProps), null, 16))
90
- ], 4)
91
- ], 4));
92
- }
93
- }), ne = /* @__PURE__ */ M(te, [["__scopeId", "data-v-1aed2cbe"]]), b = /* @__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({
94
19
  name: "PopupAnimation",
95
20
  __name: "PopupAnimation",
96
21
  props: {
@@ -98,169 +23,432 @@ const Z = /* @__PURE__ */ P({
98
23
  duration: {}
99
24
  },
100
25
  setup(n) {
101
- z((u) => ({
102
- v9a56ef92: s.value
26
+ Z((u) => ({
27
+ v6e614cc2: r.value
103
28
  }));
104
- const e = v(T.INSTANCE_STORE), o = m(!1), t = r(
29
+ const e = w(I.INSTANCE_STORE), o = $(!1), t = p(
105
30
  () => `vue-popup-plus-animation vue-popup-plus-animation-enter-${n.type}`
106
- ), i = r(
31
+ ), s = p(
107
32
  () => `vue-popup-plus-animation vue-popup-plus-animation-leave-${n.type}`
108
- ), s = r(() => `${n.duration}ms`);
109
- return $(() => {
33
+ ), r = p(() => `${n.duration}ms`);
34
+ return Y(() => {
110
35
  o.value = !0;
111
- }), (u, h) => (d(), A(X, {
36
+ }), (u, m) => (h(), T(ee, {
112
37
  "enter-active-class": t.value,
113
- "leave-active-class": i.value
38
+ "leave-active-class": s.value
114
39
  }, {
115
40
  default: S(() => [
116
- o.value && !p(e).isBeforeUnmount.value ? j(u.$slots, "default", {
41
+ o.value && !P(e).isBeforeUnmount.value ? W(u.$slots, "default", {
117
42
  key: 0,
118
- style: g({ animationDuration: `${n.duration}ms` })
119
- }) : D("", !0)
43
+ style: V({ animationDuration: `${n.duration}ms` })
44
+ }) : H("", !0)
120
45
  ]),
121
46
  _: 3
122
47
  }, 8, ["enter-active-class", "leave-active-class"]));
123
48
  }
124
- }), C = /* @__PURE__ */ P({
125
- name: "Popup",
126
- __name: "Popup",
49
+ }), ye = /* @__PURE__ */ C({
50
+ name: "PopupFrame",
51
+ __name: "PopupFrame",
127
52
  props: {
128
- store: {}
53
+ placement: {},
54
+ zIndex: {}
129
55
  },
130
56
  setup(n) {
131
- return E(y.INSTANCE_ID, n.store.id), E(T.INSTANCE_STORE, n.store), (e, o) => (d(), N(G, null, [
132
- n.store.mask ? (d(), A(b, {
133
- key: 0,
134
- duration: n.store.animationDuration.value,
135
- type: n.store.maskAnimation.value
136
- }, {
137
- default: S(() => [
138
- w(ee)
139
- ]),
140
- _: 1
141
- }, 8, ["duration", "type"])) : D("", !0),
142
- w(b, {
143
- duration: n.store.animationDuration.value,
144
- type: n.store.viewAnimation.value
145
- }, {
146
- default: S(() => [
147
- w(ne)
148
- ]),
149
- _: 1
150
- }, 8, ["duration", "type"])
151
- ], 64));
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({
75
+ name: "PopupMask",
76
+ __name: "PopupMask",
77
+ setup(n) {
78
+ const e = w(A.INSTANCE_ID), o = w(I.INSTANCE_STORE);
79
+ function t() {
80
+ o.maskClickClose && Ue().destroy(e);
81
+ }
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 }),
85
+ onClick: t
86
+ }, null, 6));
152
87
  }
153
- }), oe = (n, {
88
+ }), Pe = /* @__PURE__ */ F(we, [["__scopeId", "data-v-c4c8c95e"]]), Ce = /* @__PURE__ */ C({
89
+ name: "PopupView",
90
+ __name: "PopupView",
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,
114
+ height: r.value,
115
+ zIndex: t.zIndex.value,
116
+ translateX: g.value,
117
+ translateY: x.value
118
+ }));
119
+ M(A.COMPUTED_VIEW_STYLE, Q), Y(() => {
120
+ window.setTimeout(L, t.animationDuration.value);
121
+ }), oe(() => {
122
+ L();
123
+ });
124
+ async function L() {
125
+ await se();
126
+ const c = e.value?.getBoundingClientRect();
127
+ c && (s.value = c.width, r.value = c.height);
128
+ }
129
+ function y(c) {
130
+ return typeof c == "number" ? `${c}px` : c;
131
+ }
132
+ return (c, ze) => (h(), N("div", {
133
+ class: "popup-view",
134
+ style: V(K.value),
135
+ ref_key: "popupViewRef",
136
+ ref: e
137
+ }, [
138
+ (h(), T(re(u.value), ae({
139
+ key: `${P(o).name}-component`
140
+ }, P(t).componentProps), null, 16))
141
+ ], 4));
142
+ }
143
+ }), Ie = /* @__PURE__ */ F(Ce, [["__scopeId", "data-v-bbc1055f"]]), xe = { class: "popup-instance" }, O = /* @__PURE__ */ C({
144
+ name: "PopupInstance",
145
+ __name: "PopupInstance",
146
+ props: {
147
+ store: {}
148
+ },
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
186
  componentProps: o,
156
187
  onMounted: t,
157
- onUnmounted: i,
158
- appendTo: s,
188
+ onUnmounted: s,
189
+ appendTo: r,
159
190
  mask: u,
160
- maskClickClose: h,
161
- disableScroll: _,
162
- ...x
191
+ maskClickClose: m,
192
+ disableScroll: f,
193
+ ...g
163
194
  }) => ({
164
195
  id: n,
165
- parentElement: ie(s),
166
- appendTo: s,
196
+ parentElement: $e(r),
197
+ appendTo: r,
167
198
  mask: u,
168
- maskClickClose: h,
169
- disableScroll: _,
199
+ maskClickClose: m,
200
+ disableScroll: f,
170
201
  component: e,
171
202
  componentProps: o,
172
203
  onMounted: t,
173
- onUnmounted: i,
174
- isBeforeUnmount: m(!1),
175
- ...q(K(x))
204
+ onUnmounted: s,
205
+ isBeforeUnmount: $(!1),
206
+ ...le(q(g))
176
207
  });
177
- function ie(n) {
208
+ function $e(n) {
178
209
  return typeof n == "string" && (n = document.querySelector(n) || document.body), n;
179
210
  }
180
- class se {
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 ae {
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
- #s;
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
238
  constructor(e, o) {
209
- this.#t = e, this.#i = new se(e.seed), this.#e = oe(this.#i, o), this.renderType === "app" ? (this.#n = J(C, { 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.#s = w(C, { store: this.#e }), this.#s.appContext = this.#t.app._context, this.#s.appContext.components.Popup = C);
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.#s, 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
250
  for (const o in e) {
219
- const t = o, i = e[t] === void 0 ? this.#e[t].value : e[t];
220
- this.#e[t].value = i;
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);
256
+ class Se {
257
+ get NONE() {
258
+ return "none";
227
259
  }
228
- toString() {
229
- return `vue-popup-plus error: ${this.message}`;
260
+ get FADE() {
261
+ return "fade";
262
+ }
263
+ get SCALE_ENLARGE() {
264
+ return "scale-enlarge";
265
+ }
266
+ get SCALE_REDUCE() {
267
+ return "scale-reduce";
268
+ }
269
+ get FLY_TOP() {
270
+ return "fly-top";
271
+ }
272
+ get FLY_LEFT() {
273
+ return "fly-left";
274
+ }
275
+ get FLY_RIGHT() {
276
+ return "fly-right";
277
+ }
278
+ get FLY_BOTTOM() {
279
+ return "fly-bottom";
230
280
  }
231
- }
232
- class re {
233
- NONE = "none";
234
- FADE = "fade";
235
- SCALE_ENLARGE = "scale-enlarge";
236
- SCALE_SHRINK = "scale-shrink";
237
- FLY_TOP = "fly-top";
238
- FLY_LEFT = "fly-left";
239
- FLY_RIGHT = "fly-right";
240
- FLY_BOTTOM = "fly-bottom";
241
281
  constructor() {
242
282
  }
243
283
  }
244
- const l = new re(), ge = (n) => n, ue = (n) => new Proxy(
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(
245
426
  n,
246
427
  {
247
428
  set(e, o, t) {
248
- throw new f(`${o} 是只读属性,不能被覆盖`);
429
+ const s = new d({
430
+ caller: "definePlugin()",
431
+ message: `${o} 是只读属性,不能被覆盖`
432
+ });
433
+ throw l(s), new v(s);
249
434
  },
250
435
  get(e, o) {
251
- return o === "customProperties" ? ce(n) : o === "customAnimations" ? le() : n[o];
436
+ return o === "customProperties" ? be(n) : o === "customAnimations" ? Ve() : n[o];
252
437
  }
253
438
  }
254
439
  );
255
- function ce(n) {
440
+ function be(n) {
256
441
  return new Proxy(
257
442
  {},
258
443
  {
259
444
  set: (e, o, t) => {
260
- if (o in n)
261
- throw new f(
262
- `定义插件扩展属性 ${o} 时失败,${o} 是只读属性,不能被覆盖`
263
- );
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
+ }
264
452
  return n.__proto__[o] = t, !0;
265
453
  },
266
454
  get: (e, o) => {
@@ -270,25 +458,28 @@ function ce(n) {
270
458
  }
271
459
  );
272
460
  }
273
- function le(n) {
461
+ function Ve(n) {
274
462
  return new Proxy(
275
463
  {},
276
464
  {
277
465
  set: (e, o, t) => {
278
- if (o in l)
279
- throw new f(
280
- `定义插件扩展动画类型 ${o} 时失败,${o} 是只读属性,不能被覆盖`
281
- );
282
- return l.__proto__[o] = t, !0;
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;
283
474
  },
284
475
  get: (e, o) => {
285
- if (o in l)
286
- return l.__proto__[o];
476
+ if (o in _)
477
+ return _.__proto__[o];
287
478
  }
288
479
  }
289
480
  );
290
481
  }
291
- const pe = {
482
+ const ke = {
292
483
  appendTo: document.body,
293
484
  mask: !0,
294
485
  maskClickClose: !1,
@@ -304,123 +495,328 @@ const pe = {
304
495
  height: "auto",
305
496
  maxHeight: "auto",
306
497
  minHeight: "auto",
498
+ placement: "center",
307
499
  viewTranslateX: 0,
308
500
  viewTranslateY: 0,
309
501
  viewTranslateOverflow: !1,
310
- viewAnimation: l.FADE,
311
- maskAnimation: l.FADE,
502
+ viewAnimation: _.FADE,
503
+ maskAnimation: _.FADE,
312
504
  maskBlur: !0,
313
505
  animationDuration: 100
314
506
  };
315
- class de {
507
+ class Me {
316
508
  _core;
509
+ get isInstalled() {
510
+ return !!this._core.app;
511
+ }
512
+ get version() {
513
+ return b;
514
+ }
317
515
  constructor(e) {
318
516
  this._core = e;
319
517
  }
320
518
  install(e) {
321
- e.config.globalProperties[this._core.config.prototypeName] = this, this._core.app = e;
322
- }
323
- use(e) {
324
- if (!this._core.addPlugin(e))
325
- throw new f(
326
- `使用插件 ${e.name} 失败,已存在同名插件 ${e.name}`
327
- );
328
- e.install(ue(this), this._core.config);
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);
329
575
  }
330
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);
331
583
  e = e ?? this._core.config.zIndex++;
332
- const t = new ae(this._core, {
333
- ...pe,
584
+ const s = {
585
+ ...ke,
334
586
  ...o,
335
587
  zIndex: e
336
- });
337
- return this._core.addInstance(t), t.mount(), t.id;
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;
338
624
  }
339
625
  update(e, o) {
340
- const t = this._core.getInstance(e);
341
- t && t.update(o);
626
+ const t = new d({
627
+ type: a.Info,
628
+ caller: "popup.update()"
629
+ });
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));
342
644
  }
343
645
  async destroy(e, o) {
344
- const t = this._core.getInstance(e);
345
- t && (await t.unmount(o), this._core.removeInstance(t));
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);
346
668
  }
347
669
  }
348
- let Y = null;
349
- function he(n) {
350
- return new ve(n);
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);
351
704
  }
352
- function me() {
353
- return Y;
705
+ function J() {
706
+ return G;
354
707
  }
355
- class ve {
708
+ class Le {
356
709
  app;
357
- #t = 1;
358
- #i = {};
359
- #e;
360
- #n;
361
- #s = {};
362
- #o = "";
710
+ #n = 1;
711
+ #e = q({});
712
+ #o;
713
+ #t;
714
+ #r = {};
715
+ #a = "";
716
+ #s = 0;
363
717
  get seed() {
364
- return this.#t++;
718
+ return this.#n++;
365
719
  }
366
720
  get config() {
367
- return this.#n;
721
+ return this.#t;
368
722
  }
369
723
  get controller() {
724
+ return this.#o;
725
+ }
726
+ get instances() {
370
727
  return this.#e;
371
728
  }
729
+ get isRootComponentRegistered() {
730
+ return this.#s > 0;
731
+ }
372
732
  constructor({
373
733
  zIndex: e = 1e3,
374
734
  prototypeName: o = "$popup",
375
735
  autoDisableScroll: t = !0,
376
- debugMode: i = !1
736
+ logHandler: s = X,
737
+ debugMode: r = !1
377
738
  } = {}) {
378
- this.#n = { zIndex: e, prototypeName: o, autoDisableScroll: t, debugMode: i }, this.#e = new de(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--;
379
766
  }
380
767
  addInstance(e) {
381
- this.#i[e.id.name] = e, this.config.autoDisableScroll && e.store.disableScroll && this.#a();
768
+ this.#e[e.id.name] = he(e), this.config.autoDisableScroll && e.store.disableScroll && this.#i();
382
769
  }
383
770
  getInstance(e) {
384
- return this.#i[e.name];
771
+ return this.#e[e.name];
385
772
  }
386
773
  removeInstance(e) {
387
- delete this.#i[e.id.name], Object.values(this.#i).filter(
774
+ delete this.#e[e.id.name], Object.values(this.#e).filter(
388
775
  (o) => o.store.disableScroll
389
- ).length === 0 && this.#r();
776
+ ).length === 0 && this.#u();
390
777
  }
391
778
  addPlugin(e) {
392
- return this.getPlugin(e.name) ? !1 : (this.#s[e.name] = e, !0);
779
+ return this.getPlugin(e.name) ? !1 : (this.#r[e.name] = e, !0);
393
780
  }
394
781
  getPlugin(e) {
395
- return this.#s[e];
782
+ return this.#r[e];
396
783
  }
397
784
  removePlugin(e) {
398
- delete this.#s[e];
785
+ delete this.#r[e];
399
786
  }
400
- #a() {
401
- 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");
402
789
  }
403
- #r() {
404
- this.config.autoDisableScroll && (document.body.style.overflow = this.#o);
790
+ #u() {
791
+ this.config.autoDisableScroll && (document.body.style.overflow = this.#a);
405
792
  }
406
793
  }
407
- const ye = "1.3.4";
408
- function Pe(n) {
409
- return he(n).controller;
794
+ function qe(n) {
795
+ return Fe(n).controller;
410
796
  }
411
- function fe() {
412
- const n = me();
413
- if (!n)
414
- throw new f(
415
- "调用 usePopup 前请先调用 createPopup 创建弹出层插件实例"
416
- );
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
+ }
417
807
  return n.controller;
418
808
  }
419
809
  export {
420
- l as POPUP_ANIMATIONS,
421
- y as POPUP_COMPONENT_INJECTS,
422
- Pe as createPopup,
423
- ge as definePlugin,
424
- fe as usePopup,
425
- ye 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
426
822
  };