@v-c/trigger 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/Popup/Arrow.cjs +1 -1
  2. package/dist/Popup/Arrow.js +36 -33
  3. package/dist/Popup/Mask.cjs +1 -1
  4. package/dist/Popup/Mask.js +25 -19
  5. package/dist/Popup/PopupContent.cjs +1 -1
  6. package/dist/Popup/PopupContent.js +7 -6
  7. package/dist/Popup/index.cjs +1 -1
  8. package/dist/Popup/index.js +152 -116
  9. package/dist/UniqueProvider/UniqueContainer.cjs +1 -1
  10. package/dist/UniqueProvider/UniqueContainer.js +55 -41
  11. package/dist/UniqueProvider/index.cjs +1 -1
  12. package/dist/UniqueProvider/index.js +24 -24
  13. package/dist/hooks/useAlign.cjs +1 -1
  14. package/dist/hooks/useAlign.js +125 -118
  15. package/dist/hooks/useWinClick.cjs +1 -1
  16. package/dist/hooks/useWinClick.js +14 -14
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +276 -235
  20. package/package.json +3 -3
  21. package/dist/portal/dist/Context.cjs +0 -1
  22. package/dist/portal/dist/Context.js +0 -14
  23. package/dist/portal/dist/Portal.cjs +0 -1
  24. package/dist/portal/dist/Portal.js +0 -73
  25. package/dist/portal/dist/useDom.cjs +0 -1
  26. package/dist/portal/dist/useDom.js +0 -34
  27. package/dist/portal/dist/useScrollLocker.cjs +0 -5
  28. package/dist/portal/dist/useScrollLocker.js +0 -28
  29. package/dist/portal/dist/util.cjs +0 -1
  30. package/dist/portal/dist/util.js +0 -6
  31. package/dist/resize-observer/dist/Collection.cjs +0 -1
  32. package/dist/resize-observer/dist/Collection.js +0 -32
  33. package/dist/resize-observer/dist/SingleObserver/DomWrapper.cjs +0 -1
  34. package/dist/resize-observer/dist/SingleObserver/DomWrapper.js +0 -11
  35. package/dist/resize-observer/dist/SingleObserver/index.cjs +0 -1
  36. package/dist/resize-observer/dist/SingleObserver/index.js +0 -81
  37. package/dist/resize-observer/dist/index.cjs +0 -1
  38. package/dist/resize-observer/dist/index.js +0 -44
  39. package/dist/resize-observer/dist/utils/observerUtil.cjs +0 -1
  40. package/dist/resize-observer/dist/utils/observerUtil.js +0 -21
  41. package/dist/util/dist/Children/isFragment.cjs +0 -1
  42. package/dist/util/dist/Children/isFragment.js +0 -7
  43. package/dist/util/dist/Children/toArray.cjs +0 -1
  44. package/dist/util/dist/Children/toArray.js +0 -11
  45. package/dist/util/dist/Dom/canUseDom.cjs +0 -1
  46. package/dist/util/dist/Dom/canUseDom.js +0 -6
  47. package/dist/util/dist/Dom/contains.cjs +0 -1
  48. package/dist/util/dist/Dom/contains.js +0 -16
  49. package/dist/util/dist/Dom/dynamicCSS.cjs +0 -1
  50. package/dist/util/dist/Dom/dynamicCSS.js +0 -73
  51. package/dist/util/dist/Dom/findDOMNode.cjs +0 -1
  52. package/dist/util/dist/Dom/findDOMNode.js +0 -12
  53. package/dist/util/dist/Dom/isVisible.cjs +0 -1
  54. package/dist/util/dist/Dom/isVisible.js +0 -22
  55. package/dist/util/dist/Dom/shadow.cjs +0 -1
  56. package/dist/util/dist/Dom/shadow.js +0 -13
  57. package/dist/util/dist/classnames.cjs +0 -1
  58. package/dist/util/dist/classnames.js +0 -30
  59. package/dist/util/dist/getScrollBarSize.cjs +0 -1
  60. package/dist/util/dist/getScrollBarSize.js +0 -37
  61. package/dist/util/dist/props-util/index.cjs +0 -1
  62. package/dist/util/dist/props-util/index.js +0 -21
  63. package/dist/util/dist/raf.cjs +0 -1
  64. package/dist/util/dist/raf.js +0 -37
  65. package/dist/util/dist/utils/transition.cjs +0 -1
  66. package/dist/util/dist/utils/transition.js +0 -21
  67. package/dist/util/dist/warning.cjs +0 -1
  68. package/dist/util/dist/warning.js +0 -48
@@ -1,8 +1,7 @@
1
1
  import { defineComponent as F, computed as a, shallowRef as v, ref as m, watch as O, createVNode as n } from "vue";
2
- import H from "../portal/dist/Portal.js";
3
- import "../util/dist/warning.js";
4
- import g from "../util/dist/classnames.js";
5
- import { isDOM as l } from "../util/dist/Dom/findDOMNode.js";
2
+ import H from "@v-c/portal";
3
+ import { classNames as g } from "@v-c/util";
4
+ import { isDOM as l } from "@v-c/util/dist/Dom/findDOMNode";
6
5
  import { useTriggerContext as W, UniqueContextProvider as j, TriggerContextProvider as G } from "../context.js";
7
6
  import J from "../hooks/useAlign.js";
8
7
  import K from "../hooks/useDelay.js";
@@ -10,7 +9,7 @@ import L from "../Popup/index.js";
10
9
  import { getAlignPopupClassName as Q } from "../util.js";
11
10
  import Z from "./UniqueContainer.js";
12
11
  import _ from "./useTargetState.js";
13
- const ve = /* @__PURE__ */ F((c, {
12
+ const fe = /* @__PURE__ */ F((c, {
14
13
  slots: A
15
14
  }) => {
16
15
  const [d, s, i, M] = _(), e = a(() => !i.value || !c.postTriggerProps ? i.value : c.postTriggerProps(i.value)), p = v(null), C = m(null), V = v(null), E = (t) => {
@@ -21,11 +20,11 @@ const ve = /* @__PURE__ */ F((c, {
21
20
  const o = t;
22
21
  if (l(o?.$el))
23
22
  return o.$el;
24
- const u = o?.nativeElement;
25
- if (l(u?.value))
26
- return u.value;
27
- if (l(u))
28
- return u;
23
+ const r = o?.nativeElement;
24
+ if (l(r?.value))
25
+ return r.value;
26
+ if (l(r))
27
+ return r;
29
28
  if (typeof o?.getElement == "function") {
30
29
  const k = o.getElement();
31
30
  if (l(k))
@@ -48,16 +47,16 @@ const ve = /* @__PURE__ */ F((c, {
48
47
  }, [
49
48
  y,
50
49
  h,
50
+ N,
51
51
  q,
52
52
  w,
53
- N,
54
53
  b,
55
54
  R,
56
55
  // scaleX - not used in UniqueProvider
57
56
  ,
58
57
  ,
59
58
  // scaleY - not used in UniqueProvider
60
- r,
59
+ u,
61
60
  f
62
61
  ] = J(
63
62
  s,
@@ -73,8 +72,8 @@ const ve = /* @__PURE__ */ F((c, {
73
72
  ), S = a(() => {
74
73
  if (!e.value)
75
74
  return "";
76
- const t = Q(e.value?.builtinPlacements || {}, e.value.prefixCls || "", r.value, !1);
77
- return g(t, e.value?.getPopupClassNameFromAlign?.(r.value));
75
+ const t = Q(e.value?.builtinPlacements || {}, e.value.prefixCls || "", u.value, !1);
76
+ return g(t, e.value?.getPopupClassNameFromAlign?.(u.value));
78
77
  }), Y = {
79
78
  show: D,
80
79
  hide: I
@@ -108,9 +107,9 @@ const ve = /* @__PURE__ */ F((c, {
108
107
  onVisibleChanged: X,
109
108
  ready: y.value,
110
109
  offsetX: h.value,
111
- offsetY: q.value,
112
- offsetR: w.value,
113
- offsetB: N.value,
110
+ offsetY: N.value,
111
+ offsetR: q.value,
112
+ offsetB: w.value,
114
113
  onAlign: f,
115
114
  onPrepare: B,
116
115
  onResize: (o) => {
@@ -123,7 +122,7 @@ const ve = /* @__PURE__ */ F((c, {
123
122
  x: b.value,
124
123
  y: R.value
125
124
  },
126
- align: r.value,
125
+ align: u.value,
127
126
  zIndex: e.value?.zIndex,
128
127
  mask: e.value?.mask,
129
128
  arrow: e.value?.arrow,
@@ -136,11 +135,11 @@ const ve = /* @__PURE__ */ F((c, {
136
135
  isMobile: !1,
137
136
  ready: y.value,
138
137
  open: s.value,
139
- align: r.value,
138
+ align: u.value,
140
139
  offsetX: h.value,
141
- offsetY: q.value,
142
- offsetR: w.value,
143
- offsetB: N.value,
140
+ offsetY: N.value,
141
+ offsetR: q.value,
142
+ offsetB: w.value,
144
143
  arrowPos: {
145
144
  x: b.value,
146
145
  y: R.value
@@ -158,10 +157,11 @@ const ve = /* @__PURE__ */ F((c, {
158
157
  props: {
159
158
  postTriggerProps: {
160
159
  type: Function,
161
- required: !1
160
+ required: !1,
161
+ default: void 0
162
162
  }
163
163
  }
164
164
  });
165
165
  export {
166
- ve as default
166
+ fe as default
167
167
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Ce=require("../util/dist/Dom/findDOMNode.cjs"),Te=require("../util/dist/Dom/isVisible.cjs"),Le=require("../util/dist/raf.cjs"),x=require("vue"),V=require("../util.cjs");function Mt(o,c=0){const f=`${c}`,a=f.match(/^(.*)\%$/);return a?o*(parseFloat(a[1])/100):parseFloat(f)}function Pt(o,c){const[f,a]=c||[];return[Mt(o.width,f),Mt(o.height,a)]}function Bt(o=""){return[o[0],o[1]]}function C(o,c){const f=c[0],a=c[1];let y,X;return f==="t"?X=o.y:f==="b"?X=o.y+o.height:X=o.y+o.height/2,a==="l"?y=o.x:a==="r"?y=o.x+o.width:y=o.x+o.width/2,{x:y,y:X}}function w(o,c){const f={t:"b",b:"t",l:"r",r:"l"};return o.map((a,y)=>y===c?f[a]||"c":a).join("")}function Ie(o,c,f,a,y,X,Ot,K){const _=x.reactive({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:y.value[a.value]||{}}),k=x.shallowRef(0),Q=x.computed(()=>!c.value||K?.value?[]:V.collectScroller(c.value)),u=x.ref({}),Vt=()=>{u.value={}},Ct=()=>{if(c.value&&f.value&&o.value&&!K?.value){let h=function(t,p,g=rt){const Xt=n.x+t,Yt=n.y+p,Ye=Xt+M,Me=Yt+Y,Pe=Math.max(Xt,g.left),Be=Math.max(Yt,g.top),Oe=Math.min(Ye,g.right),Ve=Math.min(Me,g.bottom);return Math.max(0,(Oe-Pe)*(Ve-Be))},tt=function(){F=n.y+r,H=F+Y,N=n.x+l,D=N+M};const e=c.value,et=e.ownerDocument,ot=V.getWin(e),{position:Dt}=ot.getComputedStyle(e),_t=e.style.left,kt=e.style.top,Ut=e.style.right,zt=e.style.bottom,Gt=e.style.overflow,T={...y.value[a.value],...X?.value},A=et.createElement("div");e.parentElement?.appendChild(A),A.style.left=`${e.offsetLeft}px`,A.style.top=`${e.offsetTop}px`,A.style.position=Dt,A.style.height=`${e.offsetHeight}px`,A.style.width=`${e.offsetWidth}px`,e.style.left="0",e.style.top="0",e.style.right="auto",e.style.bottom="auto",e.style.overflow="hidden";let i;if(Array.isArray(f.value))i={x:f.value[0],y:f.value[1],width:0,height:0};else{const t=f.value.getBoundingClientRect();t.x=t.x??t.left,t.y=t.y??t.top,i={x:t.x,y:t.y,width:t.width,height:t.height}}const n=e.getBoundingClientRect(),{height:Jt,width:Kt}=ot.getComputedStyle(e);n.x=n.x??n.left,n.y=n.y??n.top;const{clientWidth:Qt,clientHeight:Zt,scrollWidth:te,scrollHeight:ee,scrollTop:st,scrollLeft:nt}=et.documentElement,Y=n.height,M=n.width,L=i.height,I=i.width,oe={left:0,top:0,right:Qt,bottom:Zt},se={left:-nt,top:-st,right:te-nt,bottom:ee-st};let{htmlRegion:S}=T;const it="visible",lt="visibleFirst";S!=="scroll"&&S!==lt&&(S=it);const j=S===lt,ne=V.getVisibleArea(se,Q.value),s=V.getVisibleArea(oe,Q.value),rt=S===it?s:ne,q=j?s:rt;e.style.left="auto",e.style.top="auto",e.style.right="0",e.style.bottom="0";const ft=e.getBoundingClientRect();e.style.left=_t,e.style.top=kt,e.style.right=Ut,e.style.bottom=zt,e.style.overflow=Gt,e.parentElement?.removeChild(A);const P=V.toNum(Math.round(M/parseFloat(Kt)*1e3)/1e3),B=V.toNum(Math.round(Y/parseFloat(Jt)*1e3)/1e3);if(P===0||B===0||Ce.isDOM(f)&&!Te.default(f))return;const{offset:ie,targetOffset:le}=T;let[d,v]=Pt(n,ie);const[re,fe]=Pt(i,le);i.x-=re,i.y-=fe;const[ce,ae]=T.points||[],R=Bt(ae),m=Bt(ce),ct=C(i,R),at=C(n,m),O={...T};let l=ct.x-at.x+d,r=ct.y-at.y+v;const b=h(l,r),E=h(l,r,s),ut=C(i,["t","l"]),pt=C(n,["t","l"]),ht=C(i,["b","r"]),gt=C(n,["b","r"]),ue=T.overflow||{},{adjustX:pe,adjustY:he,shiftX:mt,shiftY:yt}=ue,dt=t=>typeof t=="boolean"?t:t>=0;let F,H,N,D;tt();const vt=dt(he),xt=m[0]===R[0];if(vt&&m[0]==="t"&&(H>q.bottom||u.value.bt)){let t=r;xt?t-=Y-L:t=ut.y-gt.y-v;const p=h(l,t),g=h(l,t,s);p>b||p===b&&(!j||g>=E)?(u.value.bt=!0,r=t,v=-v,O.points=[w(m,0),w(R,0)]):u.value.bt=!1}if(vt&&m[0]==="b"&&(F<q.top||u.value.tb)){let t=r;xt?t+=Y-L:t=ht.y-pt.y-v;const p=h(l,t),g=h(l,t,s);p>b||p===b&&(!j||g>=E)?(u.value.tb=!0,r=t,v=-v,O.points=[w(m,0),w(R,0)]):u.value.tb=!1}const bt=dt(pe),wt=m[1]===R[1];if(bt&&m[1]==="l"&&(D>q.right||u.value.rl)){let t=l;wt?t-=M-I:t=ut.x-gt.x-d;const p=h(t,r),g=h(t,r,s);p>b||p===b&&(!j||g>=E)?(u.value.rl=!0,l=t,d=-d,O.points=[w(m,1),w(R,1)]):u.value.rl=!1}if(bt&&m[1]==="r"&&(N<q.left||u.value.lr)){let t=l;wt?t+=M-I:t=ht.x-pt.x-d;const p=h(t,r),g=h(t,r,s);p>b||p===b&&(!j||g>=E)?(u.value.lr=!0,l=t,d=-d,O.points=[w(m,1),w(R,1)]):u.value.lr=!1}tt();const W=mt===!0?0:mt;typeof W=="number"&&(N<s.left&&(l-=N-s.left-d,i.x+I<s.left+W&&(l+=i.x-s.left+I-W)),D>s.right&&(l-=D-s.right-d,i.x>s.right-W&&(l+=i.x-s.right+W)));const $=yt===!0?0:yt;typeof $=="number"&&(F<s.top&&(r-=F-s.top-v,i.y+L<s.top+$&&(r+=i.y-s.top+L-$)),H>s.bottom&&(r-=H-s.bottom-v,i.y>s.bottom-$&&(r+=i.y-s.bottom+$)));const U=n.x+l,ge=U+M,z=n.y+r,me=z+Y,At=i.x,ye=At+I,Rt=i.y,de=Rt+L,ve=Math.max(U,At),xe=Math.min(ge,ye),be=(ve+xe)/2-U,we=Math.max(z,Rt),Ae=Math.min(me,de),Re=(we+Ae)/2-z;Ot?.(c.value,O);let G=ft.right-n.x-(l+n.width),J=ft.bottom-n.y-(r+n.height);P===1&&(l=Math.round(l),G=Math.round(G)),B===1&&(r=Math.round(r),J=Math.round(J));const Xe={ready:!0,offsetX:l/P,offsetY:r/B,offsetR:G/P,offsetB:J/B,arrowX:be/P,arrowY:Re/B,scaleX:P,scaleY:B,align:O};Object.assign(_,Xe)}},Tt=Le.rafDebounce(Ct),Lt=()=>{k.value+=1;const h=k.value;Promise.resolve().then(()=>{k.value===h&&Tt()})},Z=()=>{_.ready=!1};x.watch(a,async()=>{await x.nextTick(),Z()}),x.watchEffect(async()=>{await x.nextTick(),o.value||(Vt(),Z())});const{ready:It,offsetX:St,offsetR:jt,offsetY:Ft,offsetB:Nt,align:Wt,arrowY:$t,arrowX:qt,scaleY:Et,scaleX:Ht}=x.toRefs(_);return[It,St,Ft,jt,Nt,qt,$t,Ht,Et,Wt,Lt]}exports.default=Ie;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Te=require("@v-c/util/dist/Dom/findDOMNode"),Ce=require("@v-c/util/dist/Dom/isVisible"),Le=require("@v-c/util/dist/raf"),m=require("vue"),V=require("../util.cjs");function Pt(o,c=0){const f=`${c}`,a=f.match(/^(.*)\%$/);return a?o*(parseFloat(a[1])/100):parseFloat(f)}function Bt(o,c){const[f,a]=c||[];return[Pt(o.width,f),Pt(o.height,a)]}function Ot(o=""){return[o[0],o[1]]}function T(o,c){const f=c[0],a=c[1];let d,X;return f==="t"?X=o.y:f==="b"?X=o.y+o.height:X=o.y+o.height/2,a==="l"?d=o.x:a==="r"?d=o.x+o.width:d=o.x+o.width/2,{x:d,y:X}}function w(o,c){const f={t:"b",b:"t",l:"r",r:"l"};return o.map((a,d)=>d===c?f[a]||"c":a).join("")}function Ie(o,c,f,a,d,X,Vt,E){const _=m.reactive({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:d.value[a.value]||{}}),U=m.shallowRef(0),Q=m.computed(()=>!c.value||E?.value?[]:V.collectScroller(c.value)),p=m.ref({}),Tt=()=>{p.value={}},Ct=()=>{if(c.value&&f.value&&o.value&&!E?.value){let u=function(t,h,g=ft){const Yt=n.x+t,Mt=n.y+h,Ye=Yt+M,Me=Mt+Y,Pe=Math.max(Yt,g.left),Be=Math.max(Mt,g.top),Oe=Math.min(Ye,g.right),Ve=Math.min(Me,g.bottom);return Math.max(0,(Oe-Pe)*(Ve-Be))},et=function(){F=n.y+r,k=F+Y,N=n.x+l,D=N+M};const e=c.value,ot=e.ownerDocument,st=V.getWin(e),{position:Dt}=st.getComputedStyle(e),Et=e.style.left,_t=e.style.top,Ut=e.style.right,zt=e.style.bottom,Gt=e.style.overflow,C={...d.value[a.value],...X?.value},A=ot.createElement("div");e.parentElement?.appendChild(A),A.style.left=`${e.offsetLeft}px`,A.style.top=`${e.offsetTop}px`,A.style.position=Dt,A.style.height=`${e.offsetHeight}px`,A.style.width=`${e.offsetWidth}px`,e.style.left="0",e.style.top="0",e.style.right="auto",e.style.bottom="auto",e.style.overflow="hidden";let i;if(Array.isArray(f.value))i={x:f.value[0],y:f.value[1],width:0,height:0};else{const t=f.value.getBoundingClientRect();t.x=t.x??t.left,t.y=t.y??t.top,i={x:t.x,y:t.y,width:t.width,height:t.height}}const n=e.getBoundingClientRect(),{height:Jt,width:Kt}=st.getComputedStyle(e);n.x=n.x??n.left,n.y=n.y??n.top;const{clientWidth:Qt,clientHeight:Zt,scrollWidth:te,scrollHeight:ee,scrollTop:nt,scrollLeft:it}=ot.documentElement,Y=n.height,M=n.width,L=i.height,I=i.width,oe={left:0,top:0,right:Qt,bottom:Zt},se={left:-it,top:-nt,right:te-it,bottom:ee-nt};let{htmlRegion:S}=C;const lt="visible",rt="visibleFirst";S!=="scroll"&&S!==rt&&(S=lt);const j=S===rt,ne=V.getVisibleArea(se,Q.value),s=V.getVisibleArea(oe,Q.value),ft=S===lt?s:ne,q=j?s:ft;e.style.left="auto",e.style.top="auto",e.style.right="0",e.style.bottom="0";const ct=e.getBoundingClientRect();e.style.left=Et,e.style.top=_t,e.style.right=Ut,e.style.bottom=zt,e.style.overflow=Gt,e.parentElement?.removeChild(A);const P=V.toNum(Math.round(M/parseFloat(Kt)*1e3)/1e3),B=V.toNum(Math.round(Y/parseFloat(Jt)*1e3)/1e3);if(P===0||B===0||Te.isDOM(f)&&!Ce(f))return;const{offset:ie,targetOffset:le}=C;let[v,x]=Bt(n,ie);const[re,fe]=Bt(i,le);i.x-=re,i.y-=fe;const[ce,ae]=C.points||[],R=Ot(ae),y=Ot(ce),at=T(i,R),ut=T(n,y),O={...C};let l=at.x-ut.x+v,r=at.y-ut.y+x;const b=u(l,r),H=u(l,r,s),pt=T(i,["t","l"]),ht=T(n,["t","l"]),gt=T(i,["b","r"]),yt=T(n,["b","r"]),ue=C.overflow||{},{adjustX:pe,adjustY:he,shiftX:mt,shiftY:dt}=ue,vt=t=>typeof t=="boolean"?t:t>=0;let F,k,N,D;et();const xt=vt(he),bt=y[0]===R[0];if(xt&&y[0]==="t"&&(k>q.bottom||p.value.bt)){let t=r;bt?t-=Y-L:t=pt.y-yt.y-x;const h=u(l,t),g=u(l,t,s);h>b||h===b&&(!j||g>=H)?(p.value.bt=!0,r=t,x=-x,O.points=[w(y,0),w(R,0)]):p.value.bt=!1}if(xt&&y[0]==="b"&&(F<q.top||p.value.tb)){let t=r;bt?t+=Y-L:t=gt.y-ht.y-x;const h=u(l,t),g=u(l,t,s);h>b||h===b&&(!j||g>=H)?(p.value.tb=!0,r=t,x=-x,O.points=[w(y,0),w(R,0)]):p.value.tb=!1}const wt=vt(pe),At=y[1]===R[1];if(wt&&y[1]==="l"&&(D>q.right||p.value.rl)){let t=l;At?t-=M-I:t=pt.x-yt.x-v;const h=u(t,r),g=u(t,r,s);h>b||h===b&&(!j||g>=H)?(p.value.rl=!0,l=t,v=-v,O.points=[w(y,1),w(R,1)]):p.value.rl=!1}if(wt&&y[1]==="r"&&(N<q.left||p.value.lr)){let t=l;At?t+=M-I:t=gt.x-ht.x-v;const h=u(t,r),g=u(t,r,s);h>b||h===b&&(!j||g>=H)?(p.value.lr=!0,l=t,v=-v,O.points=[w(y,1),w(R,1)]):p.value.lr=!1}et();const W=mt===!0?0:mt;typeof W=="number"&&(N<s.left&&(l-=N-s.left-v,i.x+I<s.left+W&&(l+=i.x-s.left+I-W)),D>s.right&&(l-=D-s.right-v,i.x>s.right-W&&(l+=i.x-s.right+W)));const $=dt===!0?0:dt;typeof $=="number"&&(F<s.top&&(r-=F-s.top-x,i.y+L<s.top+$&&(r+=i.y-s.top+L-$)),k>s.bottom&&(r-=k-s.bottom-x,i.y>s.bottom-$&&(r+=i.y-s.bottom+$)));const z=n.x+l,ge=z+M,G=n.y+r,ye=G+Y,Rt=i.x,me=Rt+I,Xt=i.y,de=Xt+L,ve=Math.max(z,Rt),xe=Math.min(ge,me),be=(ve+xe)/2-z,we=Math.max(G,Xt),Ae=Math.min(ye,de),Re=(we+Ae)/2-G;Vt?.(c.value,O);let J=ct.right-n.x-(l+n.width),K=ct.bottom-n.y-(r+n.height);P===1&&(l=Math.round(l),J=Math.round(J)),B===1&&(r=Math.round(r),K=Math.round(K));const Xe={ready:!0,offsetX:l/P,offsetY:r/B,offsetR:J/P,offsetB:K/B,arrowX:be/P,arrowY:Re/B,scaleX:P,scaleY:B,align:O};Object.assign(_,Xe)}},Lt=Le.rafDebounce(Ct),Z=()=>{U.value+=1;const u=U.value;Promise.resolve().then(()=>{U.value===u&&Lt()})};m.watch(c,async u=>{u&&o.value&&!E?.value&&(await m.nextTick(),Z())});const tt=()=>{_.ready=!1};m.watch(a,async()=>{await m.nextTick(),tt()}),m.watchEffect(async()=>{await m.nextTick(),o.value||(Tt(),tt())});const{ready:It,offsetX:St,offsetR:jt,offsetY:Ft,offsetB:Nt,align:Wt,arrowY:$t,arrowX:qt,scaleY:Ht,scaleX:kt}=m.toRefs(_);return[It,St,Ft,jt,Nt,qt,$t,kt,Ht,Wt,Z]}exports.default=Ie;
@@ -1,20 +1,20 @@
1
- import { isDOM as Ce } from "../util/dist/Dom/findDOMNode.js";
2
- import Le from "../util/dist/Dom/isVisible.js";
3
- import { rafDebounce as Ie } from "../util/dist/raf.js";
4
- import { reactive as Te, shallowRef as Fe, computed as Se, ref as je, watch as Ne, nextTick as Xt, watchEffect as We, toRefs as $e } from "vue";
5
- import { collectScroller as Ee, getWin as He, getVisibleArea as Yt, toNum as Pt } from "../util.js";
6
- function Bt(o, c = 0) {
1
+ import { isDOM as Le } from "@v-c/util/dist/Dom/findDOMNode";
2
+ import Ie from "@v-c/util/dist/Dom/isVisible";
3
+ import { rafDebounce as Te } from "@v-c/util/dist/raf";
4
+ import { reactive as Fe, shallowRef as Se, computed as je, ref as Ne, watch as Pt, nextTick as J, watchEffect as We, toRefs as $e } from "vue";
5
+ import { collectScroller as He, getWin as Ee, getVisibleArea as Bt, toNum as Mt } from "../util.js";
6
+ function Ot(o, c = 0) {
7
7
  const f = `${c}`, a = f.match(/^(.*)\%$/);
8
8
  return a ? o * (parseFloat(a[1]) / 100) : parseFloat(f);
9
9
  }
10
- function Mt(o, c) {
10
+ function Vt(o, c) {
11
11
  const [f, a] = c || [];
12
12
  return [
13
- Bt(o.width, f),
14
- Bt(o.height, a)
13
+ Ot(o.width, f),
14
+ Ot(o.height, a)
15
15
  ];
16
16
  }
17
- function Ot(o = "") {
17
+ function Ct(o = "") {
18
18
  return [o[0], o[1]];
19
19
  }
20
20
  function O(o, c) {
@@ -31,8 +31,8 @@ function b(o, c) {
31
31
  };
32
32
  return o.map((a, y) => y === c ? f[a] || "c" : a).join("");
33
33
  }
34
- function Ke(o, c, f, a, y, R, Vt, G) {
35
- const D = Te({
34
+ function Ke(o, c, f, a, y, R, Lt, D) {
35
+ const _ = Fe({
36
36
  ready: !1,
37
37
  offsetX: 0,
38
38
  offsetY: 0,
@@ -43,21 +43,21 @@ function Ke(o, c, f, a, y, R, Vt, G) {
43
43
  scaleX: 1,
44
44
  scaleY: 1,
45
45
  align: y.value[a.value] || {}
46
- }), _ = Fe(0), J = Se(() => !c.value || G?.value ? [] : Ee(c.value)), u = je({}), Ct = () => {
47
- u.value = {};
48
- }, Lt = Ie(() => {
49
- if (c.value && f.value && o.value && !G?.value) {
50
- let h = function(t, p, g = it) {
51
- const At = n.x + t, Rt = n.y + p, Ye = At + Y, Pe = Rt + X, Be = Math.max(At, g.left), Me = Math.max(Rt, g.top), Oe = Math.min(Ye, g.right), Ve = Math.min(Pe, g.bottom);
52
- return Math.max(0, (Oe - Be) * (Ve - Me));
53
- }, Q = function() {
54
- F = n.y + r, E = F + X, S = n.x + l, H = S + Y;
46
+ }), k = Se(0), K = je(() => !c.value || D?.value ? [] : He(c.value)), p = Ne({}), It = () => {
47
+ p.value = {};
48
+ }, Tt = Te(() => {
49
+ if (c.value && f.value && o.value && !D?.value) {
50
+ let u = function(t, h, g = rt) {
51
+ const Xt = n.x + t, Yt = n.y + h, Pe = Xt + Y, Be = Yt + X, Me = Math.max(Xt, g.left), Oe = Math.max(Yt, g.top), Ve = Math.min(Pe, g.right), Ce = Math.min(Be, g.bottom);
52
+ return Math.max(0, (Ve - Me) * (Ce - Oe));
53
+ }, tt = function() {
54
+ F = n.y + r, H = F + X, S = n.x + l, E = S + Y;
55
55
  };
56
- const e = c.value, Z = e.ownerDocument, tt = He(e), { position: _t } = tt.getComputedStyle(e), kt = e.style.left, Ut = e.style.top, qt = e.style.right, zt = e.style.bottom, Gt = e.style.overflow, V = {
56
+ const e = c.value, et = e.ownerDocument, ot = Ee(e), { position: kt } = ot.getComputedStyle(e), Ut = e.style.left, qt = e.style.top, zt = e.style.right, Gt = e.style.bottom, Jt = e.style.overflow, V = {
57
57
  ...y.value[a.value],
58
58
  ...R?.value
59
- }, w = Z.createElement("div");
60
- e.parentElement?.appendChild(w), w.style.left = `${e.offsetLeft}px`, w.style.top = `${e.offsetTop}px`, w.style.position = _t, w.style.height = `${e.offsetHeight}px`, w.style.width = `${e.offsetWidth}px`, e.style.left = "0", e.style.top = "0", e.style.right = "auto", e.style.bottom = "auto", e.style.overflow = "hidden";
59
+ }, w = et.createElement("div");
60
+ e.parentElement?.appendChild(w), w.style.left = `${e.offsetLeft}px`, w.style.top = `${e.offsetTop}px`, w.style.position = kt, w.style.height = `${e.offsetHeight}px`, w.style.width = `${e.offsetWidth}px`, e.style.left = "0", e.style.top = "0", e.style.right = "auto", e.style.bottom = "auto", e.style.overflow = "hidden";
61
61
  let i;
62
62
  if (Array.isArray(f.value))
63
63
  i = {
@@ -75,181 +75,188 @@ function Ke(o, c, f, a, y, R, Vt, G) {
75
75
  height: t.height
76
76
  };
77
77
  }
78
- const n = e.getBoundingClientRect(), { height: Jt, width: Kt } = tt.getComputedStyle(e);
78
+ const n = e.getBoundingClientRect(), { height: Kt, width: Qt } = ot.getComputedStyle(e);
79
79
  n.x = n.x ?? n.left, n.y = n.y ?? n.top;
80
80
  const {
81
- clientWidth: Qt,
82
- clientHeight: Zt,
83
- scrollWidth: te,
84
- scrollHeight: ee,
85
- scrollTop: et,
86
- scrollLeft: ot
87
- } = Z.documentElement, X = n.height, Y = n.width, C = i.height, L = i.width, oe = {
81
+ clientWidth: Zt,
82
+ clientHeight: te,
83
+ scrollWidth: ee,
84
+ scrollHeight: oe,
85
+ scrollTop: st,
86
+ scrollLeft: nt
87
+ } = et.documentElement, X = n.height, Y = n.width, C = i.height, L = i.width, se = {
88
88
  left: 0,
89
89
  top: 0,
90
- right: Qt,
91
- bottom: Zt
92
- }, se = {
93
- left: -ot,
94
- top: -et,
95
- right: te - ot,
96
- bottom: ee - et
90
+ right: Zt,
91
+ bottom: te
92
+ }, ne = {
93
+ left: -nt,
94
+ top: -st,
95
+ right: ee - nt,
96
+ bottom: oe - st
97
97
  };
98
98
  let { htmlRegion: I } = V;
99
- const st = "visible", nt = "visibleFirst";
100
- I !== "scroll" && I !== nt && (I = st);
101
- const T = I === nt, ne = Yt(se, J.value), s = Yt(oe, J.value), it = I === st ? s : ne, W = T ? s : it;
99
+ const it = "visible", lt = "visibleFirst";
100
+ I !== "scroll" && I !== lt && (I = it);
101
+ const T = I === lt, ie = Bt(ne, K.value), s = Bt(se, K.value), rt = I === it ? s : ie, W = T ? s : rt;
102
102
  e.style.left = "auto", e.style.top = "auto", e.style.right = "0", e.style.bottom = "0";
103
- const lt = e.getBoundingClientRect();
104
- e.style.left = kt, e.style.top = Ut, e.style.right = qt, e.style.bottom = zt, e.style.overflow = Gt, e.parentElement?.removeChild(w);
105
- const P = Pt(
106
- Math.round(Y / parseFloat(Kt) * 1e3) / 1e3
107
- ), B = Pt(
108
- Math.round(X / parseFloat(Jt) * 1e3) / 1e3
103
+ const ft = e.getBoundingClientRect();
104
+ e.style.left = Ut, e.style.top = qt, e.style.right = zt, e.style.bottom = Gt, e.style.overflow = Jt, e.parentElement?.removeChild(w);
105
+ const P = Mt(
106
+ Math.round(Y / parseFloat(Qt) * 1e3) / 1e3
107
+ ), B = Mt(
108
+ Math.round(X / parseFloat(Kt) * 1e3) / 1e3
109
109
  );
110
- if (P === 0 || B === 0 || Ce(f) && !Le(f))
110
+ if (P === 0 || B === 0 || Le(f) && !Ie(f))
111
111
  return;
112
- const { offset: ie, targetOffset: le } = V;
113
- let [d, v] = Mt(n, ie);
114
- const [re, fe] = Mt(
112
+ const { offset: le, targetOffset: re } = V;
113
+ let [v, d] = Vt(n, le);
114
+ const [fe, ce] = Vt(
115
115
  i,
116
- le
116
+ re
117
117
  );
118
- i.x -= re, i.y -= fe;
119
- const [ce, ae] = V.points || [], A = Ot(ae), m = Ot(ce), rt = O(i, A), ft = O(n, m), M = {
118
+ i.x -= fe, i.y -= ce;
119
+ const [ae, ue] = V.points || [], A = Ct(ue), m = Ct(ae), ct = O(i, A), at = O(n, m), M = {
120
120
  ...V
121
121
  };
122
- let l = rt.x - ft.x + d, r = rt.y - ft.y + v;
123
- const x = h(
122
+ let l = ct.x - at.x + v, r = ct.y - at.y + d;
123
+ const x = u(
124
124
  l,
125
125
  r
126
- ), $ = h(
126
+ ), $ = u(
127
127
  l,
128
128
  r,
129
129
  s
130
- ), ct = O(i, ["t", "l"]), at = O(n, ["t", "l"]), ut = O(i, ["b", "r"]), pt = O(n, ["b", "r"]), ue = V.overflow || {}, { adjustX: pe, adjustY: he, shiftX: ht, shiftY: gt } = ue, mt = (t) => typeof t == "boolean" ? t : t >= 0;
131
- let F, E, S, H;
132
- Q();
133
- const yt = mt(he), dt = m[0] === A[0];
134
- if (yt && m[0] === "t" && (E > W.bottom || u.value.bt)) {
130
+ ), ut = O(i, ["t", "l"]), pt = O(n, ["t", "l"]), ht = O(i, ["b", "r"]), gt = O(n, ["b", "r"]), pe = V.overflow || {}, { adjustX: he, adjustY: ge, shiftX: mt, shiftY: yt } = pe, vt = (t) => typeof t == "boolean" ? t : t >= 0;
131
+ let F, H, S, E;
132
+ tt();
133
+ const dt = vt(ge), xt = m[0] === A[0];
134
+ if (dt && m[0] === "t" && (H > W.bottom || p.value.bt)) {
135
135
  let t = r;
136
- dt ? t -= X - C : t = ct.y - pt.y - v;
137
- const p = h(
136
+ xt ? t -= X - C : t = ut.y - gt.y - d;
137
+ const h = u(
138
138
  l,
139
139
  t
140
- ), g = h(
140
+ ), g = u(
141
141
  l,
142
142
  t,
143
143
  s
144
144
  );
145
145
  // Of course use larger one
146
- p > x || p === x && (!T || g >= $) ? (u.value.bt = !0, r = t, v = -v, M.points = [
146
+ h > x || h === x && (!T || g >= $) ? (p.value.bt = !0, r = t, d = -d, M.points = [
147
147
  b(m, 0),
148
148
  b(A, 0)
149
- ]) : u.value.bt = !1;
149
+ ]) : p.value.bt = !1;
150
150
  }
151
- if (yt && m[0] === "b" && (F < W.top || u.value.tb)) {
151
+ if (dt && m[0] === "b" && (F < W.top || p.value.tb)) {
152
152
  let t = r;
153
- dt ? t += X - C : t = ut.y - at.y - v;
154
- const p = h(
153
+ xt ? t += X - C : t = ht.y - pt.y - d;
154
+ const h = u(
155
155
  l,
156
156
  t
157
- ), g = h(
157
+ ), g = u(
158
158
  l,
159
159
  t,
160
160
  s
161
161
  );
162
162
  // Of course use larger one
163
- p > x || p === x && (!T || g >= $) ? (u.value.tb = !0, r = t, v = -v, M.points = [
163
+ h > x || h === x && (!T || g >= $) ? (p.value.tb = !0, r = t, d = -d, M.points = [
164
164
  b(m, 0),
165
165
  b(A, 0)
166
- ]) : u.value.tb = !1;
166
+ ]) : p.value.tb = !1;
167
167
  }
168
- const vt = mt(pe), xt = m[1] === A[1];
169
- if (vt && m[1] === "l" && (H > W.right || u.value.rl)) {
168
+ const bt = vt(he), wt = m[1] === A[1];
169
+ if (bt && m[1] === "l" && (E > W.right || p.value.rl)) {
170
170
  let t = l;
171
- xt ? t -= Y - L : t = ct.x - pt.x - d;
172
- const p = h(
171
+ wt ? t -= Y - L : t = ut.x - gt.x - v;
172
+ const h = u(
173
173
  t,
174
174
  r
175
- ), g = h(
175
+ ), g = u(
176
176
  t,
177
177
  r,
178
178
  s
179
179
  );
180
180
  // Of course use larger one
181
- p > x || p === x && (!T || g >= $) ? (u.value.rl = !0, l = t, d = -d, M.points = [
181
+ h > x || h === x && (!T || g >= $) ? (p.value.rl = !0, l = t, v = -v, M.points = [
182
182
  b(m, 1),
183
183
  b(A, 1)
184
- ]) : u.value.rl = !1;
184
+ ]) : p.value.rl = !1;
185
185
  }
186
- if (vt && m[1] === "r" && (S < W.left || u.value.lr)) {
186
+ if (bt && m[1] === "r" && (S < W.left || p.value.lr)) {
187
187
  let t = l;
188
- xt ? t += Y - L : t = ut.x - at.x - d;
189
- const p = h(
188
+ wt ? t += Y - L : t = ht.x - pt.x - v;
189
+ const h = u(
190
190
  t,
191
191
  r
192
- ), g = h(
192
+ ), g = u(
193
193
  t,
194
194
  r,
195
195
  s
196
196
  );
197
197
  // Of course use larger one
198
- p > x || p === x && (!T || g >= $) ? (u.value.lr = !0, l = t, d = -d, M.points = [
198
+ h > x || h === x && (!T || g >= $) ? (p.value.lr = !0, l = t, v = -v, M.points = [
199
199
  b(m, 1),
200
200
  b(A, 1)
201
- ]) : u.value.lr = !1;
201
+ ]) : p.value.lr = !1;
202
202
  }
203
- Q();
204
- const j = ht === !0 ? 0 : ht;
205
- typeof j == "number" && (S < s.left && (l -= S - s.left - d, i.x + L < s.left + j && (l += i.x - s.left + L - j)), H > s.right && (l -= H - s.right - d, i.x > s.right - j && (l += i.x - s.right + j)));
206
- const N = gt === !0 ? 0 : gt;
207
- typeof N == "number" && (F < s.top && (r -= F - s.top - v, i.y + C < s.top + N && (r += i.y - s.top + C - N)), E > s.bottom && (r -= E - s.bottom - v, i.y > s.bottom - N && (r += i.y - s.bottom + N)));
208
- const k = n.x + l, ge = k + Y, U = n.y + r, me = U + X, bt = i.x, ye = bt + L, wt = i.y, de = wt + C, ve = Math.max(k, bt), xe = Math.min(ge, ye), be = (ve + xe) / 2 - k, we = Math.max(U, wt), Ae = Math.min(me, de), Re = (we + Ae) / 2 - U;
209
- Vt?.(c.value, M);
210
- let q = lt.right - n.x - (l + n.width), z = lt.bottom - n.y - (r + n.height);
211
- P === 1 && (l = Math.round(l), q = Math.round(q)), B === 1 && (r = Math.round(r), z = Math.round(z));
212
- const Xe = {
203
+ tt();
204
+ const j = mt === !0 ? 0 : mt;
205
+ typeof j == "number" && (S < s.left && (l -= S - s.left - v, i.x + L < s.left + j && (l += i.x - s.left + L - j)), E > s.right && (l -= E - s.right - v, i.x > s.right - j && (l += i.x - s.right + j)));
206
+ const N = yt === !0 ? 0 : yt;
207
+ typeof N == "number" && (F < s.top && (r -= F - s.top - d, i.y + C < s.top + N && (r += i.y - s.top + C - N)), H > s.bottom && (r -= H - s.bottom - d, i.y > s.bottom - N && (r += i.y - s.bottom + N)));
208
+ const U = n.x + l, me = U + Y, q = n.y + r, ye = q + X, At = i.x, ve = At + L, Rt = i.y, de = Rt + C, xe = Math.max(U, At), be = Math.min(me, ve), we = (xe + be) / 2 - U, Ae = Math.max(q, Rt), Re = Math.min(ye, de), Xe = (Ae + Re) / 2 - q;
209
+ Lt?.(c.value, M);
210
+ let z = ft.right - n.x - (l + n.width), G = ft.bottom - n.y - (r + n.height);
211
+ P === 1 && (l = Math.round(l), z = Math.round(z)), B === 1 && (r = Math.round(r), G = Math.round(G));
212
+ const Ye = {
213
213
  ready: !0,
214
214
  offsetX: l / P,
215
215
  offsetY: r / B,
216
- offsetR: q / P,
217
- offsetB: z / B,
218
- arrowX: be / P,
219
- arrowY: Re / B,
216
+ offsetR: z / P,
217
+ offsetB: G / B,
218
+ arrowX: we / P,
219
+ arrowY: Xe / B,
220
220
  scaleX: P,
221
221
  scaleY: B,
222
222
  align: M
223
223
  };
224
- Object.assign(D, Xe);
224
+ Object.assign(_, Ye);
225
225
  }
226
- }), It = () => {
227
- _.value += 1;
228
- const h = _.value;
226
+ }), Q = () => {
227
+ k.value += 1;
228
+ const u = k.value;
229
229
  Promise.resolve().then(() => {
230
- _.value === h && Lt();
230
+ k.value === u && Tt();
231
231
  });
232
- }, K = () => {
233
- D.ready = !1;
234
232
  };
235
- Ne(a, async () => {
236
- await Xt(), K();
233
+ Pt(
234
+ c,
235
+ async (u) => {
236
+ u && o.value && !D?.value && (await J(), Q());
237
+ }
238
+ );
239
+ const Z = () => {
240
+ _.ready = !1;
241
+ };
242
+ Pt(a, async () => {
243
+ await J(), Z();
237
244
  }), We(async () => {
238
- await Xt(), o.value || (Ct(), K());
245
+ await J(), o.value || (It(), Z());
239
246
  });
240
- const { ready: Tt, offsetX: Ft, offsetR: St, offsetY: jt, offsetB: Nt, align: Wt, arrowY: $t, arrowX: Et, scaleY: Ht, scaleX: Dt } = $e(D);
247
+ const { ready: Ft, offsetX: St, offsetR: jt, offsetY: Nt, offsetB: Wt, align: $t, arrowY: Ht, arrowX: Et, scaleY: Dt, scaleX: _t } = $e(_);
241
248
  return [
242
- Tt,
243
249
  Ft,
244
- jt,
245
250
  St,
246
251
  Nt,
252
+ jt,
253
+ Wt,
247
254
  Et,
248
- $t,
249
- Dt,
250
255
  Ht,
251
- Wt,
252
- It
256
+ _t,
257
+ Dt,
258
+ $t,
259
+ Q
253
260
  ];
254
261
  }
255
262
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("../util/dist/warning.cjs"),D=require("../util/dist/Dom/shadow.cjs"),r=require("vue"),N=require("../util.cjs");function S(a,v,l,f,w,m,g,p){const d=r.shallowRef(a.value);r.watchEffect(()=>{d.value=a.value});const u=r.shallowRef(!1);r.watch([v,l,f,w,m],([L,s,i,R,E],_,P)=>{if(L&&i&&(!R||E)){const c=()=>{u.value=!1},e=n=>{d.value&&!g(n.composedPath?.()?.[0]||n.target)&&!u.value&&p(!1)},t=N.getWin(i);t.addEventListener("pointerdown",c,!0),t.addEventListener("mousedown",e,!0),t.addEventListener("contextmenu",e,!0);const o=D.getShadowRoot(s);if(o&&(o.addEventListener("mousedown",e,!0),o.addEventListener("contextmenu",e,!0)),process.env.NODE_ENV!=="production"&&s){const n=s.getRootNode?.(),q=i.getRootNode?.();x.default(n===q,"trigger element and popup element should in same shadow root.")}P(()=>{t.removeEventListener("pointerdown",c,!0),t.removeEventListener("mousedown",e,!0),t.removeEventListener("contextmenu",e,!0),o&&(o.removeEventListener("mousedown",e,!0),o.removeEventListener("contextmenu",e,!0))})}});function h(){u.value=!0}return h}exports.default=S;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("@v-c/util"),D=require("@v-c/util/dist/Dom/shadow"),r=require("vue"),N=require("../util.cjs");function S(a,v,l,w,f,m,g,p){const d=r.shallowRef(a.value);r.watchEffect(()=>{d.value=a.value});const u=r.shallowRef(!1);r.watch([v,l,w,f,m],([L,s,i,R,E],_,P)=>{if(L&&i&&(!R||E)){const c=()=>{u.value=!1},e=n=>{d.value&&!g(n.composedPath?.()?.[0]||n.target)&&!u.value&&p(!1)},t=N.getWin(i);t.addEventListener("pointerdown",c,!0),t.addEventListener("mousedown",e,!0),t.addEventListener("contextmenu",e,!0);const o=D.getShadowRoot(s);if(o&&(o.addEventListener("mousedown",e,!0),o.addEventListener("contextmenu",e,!0)),process.env.NODE_ENV!=="production"&&s){const n=s.getRootNode?.(),q=i.getRootNode?.();x.warning(n===q,"trigger element and popup element should in same shadow root.")}P(()=>{t.removeEventListener("pointerdown",c,!0),t.removeEventListener("mousedown",e,!0),t.removeEventListener("contextmenu",e,!0),o&&(o.removeEventListener("mousedown",e,!0),o.removeEventListener("contextmenu",e,!0))})}});function h(){u.value=!0}return h}exports.default=S;
@@ -1,26 +1,26 @@
1
- import D from "../util/dist/warning.js";
2
- import { getShadowRoot as N } from "../util/dist/Dom/shadow.js";
1
+ import { warning as D } from "@v-c/util";
2
+ import { getShadowRoot as N } from "@v-c/util/dist/Dom/shadow";
3
3
  import { shallowRef as m, watchEffect as C, watch as S } from "vue";
4
4
  import { getWin as W } from "../util.js";
5
- function b(i, v, c, f, w, p, l, L) {
6
- const a = m(i.value);
5
+ function b(u, v, c, f, w, p, l, g) {
6
+ const a = m(u.value);
7
7
  C(() => {
8
- a.value = i.value;
8
+ a.value = u.value;
9
9
  });
10
10
  const r = m(!1);
11
11
  S(
12
12
  [v, c, f, w, p],
13
- ([E, s, u, R, h], _, x) => {
14
- if (E && u && (!R || h)) {
13
+ ([E, i, s, R, h], _, x) => {
14
+ if (E && s && (!R || h)) {
15
15
  const d = () => {
16
16
  r.value = !1;
17
17
  }, e = (n) => {
18
- a.value && !l(n.composedPath?.()?.[0] || n.target) && !r.value && L(!1);
19
- }, t = W(u);
18
+ a.value && !l(n.composedPath?.()?.[0] || n.target) && !r.value && g(!1);
19
+ }, t = W(s);
20
20
  t.addEventListener("pointerdown", d, !0), t.addEventListener("mousedown", e, !0), t.addEventListener("contextmenu", e, !0);
21
- const o = N(s);
22
- if (o && (o.addEventListener("mousedown", e, !0), o.addEventListener("contextmenu", e, !0)), process.env.NODE_ENV !== "production" && s) {
23
- const n = s.getRootNode?.(), P = u.getRootNode?.();
21
+ const o = N(i);
22
+ if (o && (o.addEventListener("mousedown", e, !0), o.addEventListener("contextmenu", e, !0)), process.env.NODE_ENV !== "production" && i) {
23
+ const n = i.getRootNode?.(), P = s.getRootNode?.();
24
24
  D(
25
25
  n === P,
26
26
  "trigger element and popup element should in same shadow root."
@@ -40,10 +40,10 @@ function b(i, v, c, f, w, p, l, L) {
40
40
  }
41
41
  }
42
42
  );
43
- function g() {
43
+ function L() {
44
44
  r.value = !0;
45
45
  }
46
- return g;
46
+ return L;
47
47
  }
48
48
  export {
49
49
  b as default
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),fe=require("./portal/dist/Portal.cjs"),Qe=require("./resize-observer/dist/index.cjs");require("./util/dist/warning.cjs");const re=require("./util/dist/classnames.cjs"),k=require("./util/dist/Dom/findDOMNode.cjs"),ce=require("./util/dist/Dom/shadow.cjs"),Ze=require("./util/dist/props-util/index.cjs"),H=require("./context.cjs"),et=require("./hooks/useAction.cjs"),tt=require("./hooks/useAlign.cjs"),ut=require("./hooks/useDelay.cjs"),nt=require("./hooks/useWatch.cjs"),ot=require("./hooks/useWinClick.cjs"),lt=require("./Popup/index.cjs"),at=require("./util.cjs"),it=require("./UniqueProvider/index.cjs");function st(C){return typeof C=="function"||Object.prototype.toString.call(C)==="[object Object]"&&!t.isVNode(C)}const rt={prefixCls:"vc-trigger-popup",action:"hover",mouseLeaveDelay:.1,maskClosable:!0,builtinPlacements:{},popupVisible:void 0,defaultPopupVisible:void 0};function de(C=fe.default){return t.defineComponent((u,{expose:ve,slots:ge,attrs:$})=>{const me=t.computed(()=>u.autoDestroy??!1),O=t.computed(()=>u.popupVisible===void 0),X=t.computed(()=>!!u.mobile),E=t.ref({}),R=H.useTriggerContext(),he=t.computed(()=>({registerSubPopup(e,n){n?E.value[e]=n:delete E.value[e],R?.value.registerSubPopup(e,n)}})),p=H.useUniqueContext(),Y=t.useId(),f=t.shallowRef(null),U=t.shallowRef(null),W=e=>{if(!e)return null;if(k.isDOM(e))return e;const n=e;if(k.isDOM(n?.$el))return n.$el;const a=n?.nativeElement;if(k.isDOM(a?.value))return a.value;if(k.isDOM(a))return a;if(typeof n?.getElement=="function"){const d=n.getElement();if(k.isDOM(d))return d}return null},ye=e=>{const n=W(e);U.value=n,f.value!==n&&(f.value=n),R?.value?.registerSubPopup(Y,n??null)},l=t.shallowRef(null),V=t.shallowRef(null),Pe=e=>{const n=W(e);n&&l.value!==n?(l.value=n,V.value=n):n||(l.value=null,V.value=null)},_=t.computed(()=>Ze.filterEmpty(ge?.default?.()??[])?.[0]),h=t.computed(()=>_?.value?.props||{}),J=t.shallowRef({}),G=t.shallowRef({}),qe=t.computed(()=>({...J.value,...G.value})),Ce=e=>{const n=l.value;return n?.contains(e)||n&&ce.getShadowRoot(n)?.host===e||e===n||f.value?.contains(e)||f.value&&ce.getShadowRoot(f.value)?.host===e||e===f.value||Object.values(E.value).some(a=>a?.contains(e)||e===a)},K=t.computed(()=>u.arrow?{...u?.arrow!==!0?u?.arrow:{}}:null),A=t.shallowRef(u?.defaultPopupVisible??!1);u.popupVisible!==void 0&&(A.value=u.popupVisible);const o=t.computed(()=>u?.popupVisible??A.value),we=e=>{O.value&&(A.value=e)},Q=()=>o.value;t.watch(()=>u.popupVisible,async e=>{e!==void 0&&(await t.nextTick(),A.value=e)});const Z=(e=0)=>({popup:u.popup,target:l.value,delay:e,prefixCls:u.prefixCls,popupClassName:u.popupClassName,uniqueContainerClassName:u.uniqueContainerClassName,uniqueContainerStyle:u.uniqueContainerStyle,popupStyle:u.popupStyle,popupPlacement:u.popupPlacement,builtinPlacements:u.builtinPlacements,popupAlign:u.popupAlign,zIndex:u.zIndex,mask:u.mask,maskClosable:u.maskClosable,popupMotion:u.popupMotion,maskMotion:u.maskMotion,arrow:K.value,getPopupContainer:u.getPopupContainer,getPopupClassNameFromAlign:u.getPopupClassNameFromAlign,id:Y});t.watch([o,l],()=>{if(p&&u.unique&&l.value&&!O.value&&!R?.value)if(o.value){const e=u.mouseEnterDelay??0;p?.show(Z(e),Q)}else p?.hide(u.mouseLeaveDelay||0)});const v=t.shallowRef(o.value),w=t.shallowRef([]);w.value=[],t.watchEffect(()=>{v.value=o.value,o.value||(w.value=[])});const ee=e=>{we(e),(w.value[w.value.length-1]??o.value)!==e&&(w.value.push(e),u?.onOpenChange?.(e),u?.onPopupVisibleChange?.(e))},te=ut.default(),s=(e,n=0)=>{if(u.popupVisible!==void 0){te(()=>{ee(e)},n);return}if(p&&u.unique&&O.value&&!R?.value){e?p?.show(Z(n),Q):p.hide(n);return}te(()=>{ee(e)},n)},g=t.shallowRef(!1);console.log("inMotion"),t.watch(o,async()=>{await t.nextTick(),o.value&&(console.log("inMotion opened"),g.value=!0)});const b=t.shallowRef(),x=t.ref(null),F=e=>{x.value=[e.clientX,e.clientY]},[be,Me,ke,Re,Ae,xe,Se,De,Te,B,j]=tt.default(o,f,t.computed(()=>u?.alignPoint&&x.value!==null?x.value:l.value),t.computed(()=>u?.popupPlacement),t.computed(()=>u?.builtinPlacements),t.computed(()=>u?.popupAlign),u?.onPopupAlign,X),[M,y]=et.default(t.computed(()=>u.action),t.computed(()=>u.showAction),t.computed(()=>u.hideAction)),ue=t.computed(()=>M.value?.has("click")),S=t.computed(()=>y.value?.has("click")||y.value?.has("contextmenu")),P=()=>{g.value||j()},Ne=()=>{v.value&&u?.alignPoint&&S.value&&s(!1)};nt.default(o,l,f,P,Ne),t.watch([x,()=>u.popupPlacement],async()=>{await t.nextTick(),P()}),t.watch(()=>JSON.stringify(u.popupAlign),async()=>{await t.nextTick();const{builtinPlacements:e,popupPlacement:n}=u;o.value&&!e?.[n]&&P()});const Oe=t.computed(()=>{const e=at.getAlignPopupClassName(u.builtinPlacements,u.prefixCls,B.value,u.alignPoint);return re.default(e,u?.getPopupClassNameFromAlign?.(B.value))});ve({nativeElement:V,popupElement:U,forceAlign:P});const ne=t.shallowRef(0),oe=t.shallowRef(0),le=()=>{if(u.stretch&&l.value){const e=l.value.getBoundingClientRect();ne.value=e.width,oe.value=e.height}},Ee=()=>{le(),P()},Ve=e=>{g.value=!1,j(),u?.afterOpenChange?.(e),u?.afterPopupVisibleChange?.(e)},Fe=()=>new Promise(e=>{le(),b.value=e});t.watch([b],()=>{b.value&&(j(),b.value(),b.value=void 0)});function q(e,n,a,d,m,i){e[n]=(r,...c)=>{(!i||!i())&&(m?.(r),s(a,d)),h.value[n]?.(r,...c)}}const ae=t.computed(()=>M.value?.has("touch")),z=t.computed(()=>y.value?.has("touch")),I=t.shallowRef(!1);t.watchEffect(()=>{const e={};(ae.value||z.value)&&(e.onTouchStart=(...n)=>{I.value=!0,v.value&&z.value?s(!1):!v.value&&ae.value&&s(!0),h.value.onTouchStart?.(...n)}),(ue.value||S.value)&&(e.onClick=(n,...a)=>{v.value&&S.value?s(!1):!v.value&&ue.value&&(F(n),s(!0)),h.value?.onClick?.(n,...a),I.value=!1}),J.value=e});const Be=ot.default(o,t.computed(()=>S.value||z.value),l,f,t.computed(()=>u.mask),t.computed(()=>u.maskClosable),Ce,s),je=t.computed(()=>M.value?.has("hover")),ze=t.computed(()=>y.value?.has("hover"));let D,L;const T=()=>I.value;t.watchEffect(()=>{const{mouseEnterDelay:e,mouseLeaveDelay:n,alignPoint:a,focusDelay:d,blurDelay:m}=u,i={};if(je.value){const r=c=>{F(c)};q(i,"onMouseenter",!0,e,r,T),q(i,"onPointerenter",!0,e,r,T),D=c=>{(o.value||g.value)&&f?.value?.contains(c.target)&&s(!0,e)},a&&(i.onMouseMove=c=>{h.value.onMouseMove?.(c)})}else D=void 0;ze.value?(q(i,"onMouseleave",!1,n,void 0,T),q(i,"onPointerleave",!1,n,void 0,T),L=()=>{s(!1,n)}):L=void 0,M.value.has("focus")&&q(i,"onFocus",!0,d),y.value.has("focus")&&q(i,"onBlur",!1,m),M.value.has("contextmenu")&&(i.onContextmenu=(r,...c)=>{v.value&&y.value.has("contextmenu")?s(!1):(F(r),s(!0)),r.preventDefault(),h.value.onContextMenu?.(r,...c)}),G.value=i});const ie=t.shallowRef(!1);return t.watchEffect(()=>{ie.value||=u.forceRender||o.value||g.value}),()=>{const e={...h.value,...qe.value},n={};["onContextmenu","onClick","onMousedown","onTouchstart","onMouseenter","onMouseleave","onFocus","onBlur"].forEach(N=>{$[N]&&(n[N]=(...se)=>{e[N]?.(...se),$[N](...se)})});const d={x:xe.value,y:Se.value},m=t.createVNode(_.value,{...e,...n,ref:Pe}),{unique:i,prefixCls:r,popup:c,popupClassName:Ie,popupStyle:Le,zIndex:He,fresh:$e,onPopupClick:Xe,mask:Ye,popupMotion:Ue,maskMotion:We,forceRender:_e,getPopupContainer:Je,stretch:Ge,mobile:Ke}=u;return console.log(g.value),t.createVNode(t.Fragment,null,[t.createVNode(Qe.default,{disabled:!o.value,onResize:Ee},st(m)?m:{default:()=>[m]}),ie.value&&l.value&&(!p||!i)&&t.createVNode(H.TriggerContextProvider,he.value,{default:()=>[t.createVNode(lt.default,{portal:C,ref:ye,prefixCls:r,popup:c,className:re.default(Ie,!X.value&&Oe.value),style:Le,target:l.value,onMouseEnter:D,onMouseLeave:L,onPointerEnter:D,zIndex:He,open:o.value,keepDom:g.value,fresh:$e,onClick:Xe,onPointerDownCapture:Be,mask:Ye,motion:Ue,maskMotion:We,onVisibleChanged:Ve,onPrepare:Fe,forceRender:_e,autoDestroy:me.value,getPopupContainer:Je,align:B.value,arrow:K.value,arrowPos:d,ready:be.value,offsetX:Me.value,offsetY:ke.value,offsetR:Re.value,offsetB:Ae.value,onAlign:P,stretch:Ge,targetWidth:ne.value/De.value,targetHeight:oe.value/Te.value,mobile:Ke},null)]})])}},{props:t.mergeDefaults({action:{type:[String,Array],required:!1},showAction:{type:Array,required:!1},hideAction:{type:Array,required:!1},prefixCls:{type:String,required:!1},zIndex:{type:Number,required:!1},onPopupAlign:{type:Function,required:!1},stretch:{type:String,required:!1},popupVisible:{type:Boolean,required:!1},defaultPopupVisible:{type:Boolean,required:!1},onOpenChange:{type:Function,required:!1},afterOpenChange:{type:Function,required:!1},onPopupVisibleChange:{type:Function,required:!1},afterPopupVisibleChange:{type:Function,required:!1},getPopupContainer:{type:Function,required:!1},forceRender:{type:Boolean,required:!1},autoDestroy:{type:Boolean,required:!1},mask:{type:Boolean,required:!1},maskClosable:{type:Boolean,required:!1},popupMotion:{type:Object,required:!1},maskMotion:{type:Object,required:!1},mouseEnterDelay:{type:Number,required:!1},mouseLeaveDelay:{type:Number,required:!1},focusDelay:{type:Number,required:!1},blurDelay:{type:Number,required:!1},popup:{type:[String,Number,null,Array,Function],required:!0,skipCheck:!0},popupPlacement:{type:String,required:!1},builtinPlacements:{type:Object,required:!1},popupAlign:{type:Object,required:!1},popupClassName:{type:String,required:!1},uniqueContainerClassName:{type:String,required:!1},uniqueContainerStyle:{type:null,required:!1},popupStyle:{type:null,required:!1},getPopupClassNameFromAlign:{type:Function,required:!1},onPopupClick:{type:Function,required:!1},alignPoint:{type:Boolean,required:!1},fresh:{type:Boolean,required:!1},unique:{type:Boolean,required:!1},arrow:{type:[Boolean,Object],required:!1},mobile:{type:Object,required:!1}},rt)})}const pe=de(fe.default);exports.UniqueProvider=it.default;exports.Trigger=pe;exports.default=pe;exports.generateTrigger=de;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),de=require("@v-c/portal"),Qe=require("@v-c/resize-observer"),re=require("@v-c/util"),R=require("@v-c/util/dist/Dom/findDOMNode"),fe=require("@v-c/util/dist/Dom/shadow"),Ze=require("@v-c/util/dist/props-util"),H=require("./context.cjs"),et=require("./hooks/useAction.cjs"),tt=require("./hooks/useAlign.cjs"),nt=require("./hooks/useDelay.cjs"),ut=require("./hooks/useWatch.cjs"),lt=require("./hooks/useWinClick.cjs"),at=require("./Popup/index.cjs"),ot=require("./util.cjs"),it=require("./UniqueProvider/index.cjs");function st(C){return typeof C=="function"||Object.prototype.toString.call(C)==="[object Object]"&&!t.isVNode(C)}const rt={prefixCls:"vc-trigger-popup",action:"hover",mouseLeaveDelay:.1,maskClosable:!0,builtinPlacements:{},popupVisible:void 0,defaultPopupVisible:void 0};function ce(C=de){return t.defineComponent((n,{expose:ve,slots:me,attrs:U})=>{const ge=t.computed(()=>n.autoDestroy??!1),O=t.computed(()=>n.popupVisible===void 0),X=t.computed(()=>!!n.mobile),E=t.ref({}),k=H.useTriggerContext(),he=t.computed(()=>({registerSubPopup(e,u){u?E.value[e]=u:delete E.value[e],k?.value.registerSubPopup(e,u)}})),c=H.useUniqueContext(),Y=t.useId(),d=t.shallowRef(null),$=t.shallowRef(null),W=e=>{if(!e)return null;if(R.isDOM(e))return e;const u=e;if(R.isDOM(u?.$el))return u.$el;const a=u?.nativeElement;if(R.isDOM(a?.value))return a.value;if(R.isDOM(a))return a;if(typeof u?.getElement=="function"){const v=u.getElement();if(R.isDOM(v))return v}return null},ye=e=>{const u=W(e);$.value=u,d.value!==u&&(d.value=u),k?.value?.registerSubPopup(Y,u??null)},i=t.shallowRef(null),V=t.shallowRef(null),Pe=e=>{const u=W(e);u&&i.value!==u?(i.value=u,V.value=u):u||(i.value=null,V.value=null)},m=t.reactive({}),_=t.shallowRef({}),J=t.shallowRef({}),Ce=t.computed(()=>({..._.value,...J.value})),G=e=>{const u=i.value;return u?.contains(e)||u&&fe.getShadowRoot(u)?.host===e||e===u||d.value?.contains(e)||d.value&&fe.getShadowRoot(d.value)?.host===e||e===d.value||Object.values(E.value).some(a=>a?.contains(e)||e===a)},K=t.computed(()=>n.arrow?{...n?.arrow!==!0?n?.arrow:{}}:null),A=t.shallowRef(n?.defaultPopupVisible??!1);n.popupVisible!==void 0&&(A.value=n.popupVisible);const l=t.computed(()=>n?.popupVisible??A.value),qe=e=>{O.value&&(A.value=e)},Q=()=>l.value;t.watch(()=>n.popupVisible,async e=>{e!==void 0&&(await t.nextTick(),A.value=e)});const Z=(e=0)=>({popup:n.popup,target:i.value,delay:e,prefixCls:n.prefixCls,popupClassName:n.popupClassName,uniqueContainerClassName:n.uniqueContainerClassName,uniqueContainerStyle:n.uniqueContainerStyle,popupStyle:n.popupStyle,popupPlacement:n.popupPlacement,builtinPlacements:n.builtinPlacements,popupAlign:n.popupAlign,zIndex:n.zIndex,mask:n.mask,maskClosable:n.maskClosable,popupMotion:n.popupMotion,maskMotion:n.maskMotion,arrow:K.value,getPopupContainer:n.getPopupContainer,getPopupClassNameFromAlign:n.getPopupClassNameFromAlign,id:Y});t.watch([l,i],()=>{if(c&&n.unique&&i.value&&!O.value&&!k?.value)if(l.value){const e=n.mouseEnterDelay??0;c?.show(Z(e),Q)}else c?.hide(n.mouseLeaveDelay||0)});const p=t.shallowRef(l.value),q=t.shallowRef([]);q.value=[],t.watchEffect(()=>{p.value=l.value,l.value||(q.value=[])});const ee=e=>{qe(e),(q.value[q.value.length-1]??l.value)!==e&&(q.value.push(e),n?.onOpenChange?.(e),n?.onPopupVisibleChange?.(e))},te=nt.default(),f=(e,u=0)=>{if(n.popupVisible!==void 0){te(()=>{ee(e)},u);return}if(c&&n.unique&&O.value&&!k?.value){e?c?.show(Z(u),Q):c.hide(u);return}te(()=>{ee(e)},u)},g=t.shallowRef(!1);t.watch(l,async()=>{await t.nextTick(),l.value&&(g.value=!0)});const b=t.shallowRef(),x=t.ref(null),F=e=>{x.value=[e.clientX,e.clientY]},[be,we,Me,Re,ke,Ae,xe,De,Se,B,j]=tt.default(l,d,t.computed(()=>n?.alignPoint&&x.value!==null?x.value:i.value),t.computed(()=>n?.popupPlacement),t.computed(()=>n?.builtinPlacements),t.computed(()=>n?.popupAlign),n?.onPopupAlign,X),[w,h]=et.default(t.computed(()=>n.action),t.computed(()=>n.showAction),t.computed(()=>n.hideAction)),ne=t.computed(()=>w.value?.has("click")),D=t.computed(()=>h.value?.has("click")||h.value?.has("contextmenu")),y=()=>{g.value||j()},Ne=()=>{p.value&&n?.alignPoint&&D.value&&f(!1)};ut.default(l,i,d,y,Ne),t.watch([x,()=>n.popupPlacement],async()=>{await t.nextTick(),y()}),t.watch(()=>JSON.stringify(n.popupAlign),async()=>{await t.nextTick();const{builtinPlacements:e,popupPlacement:u}=n;l.value&&!e?.[u]&&y()});const Te=t.computed(()=>{const e=ot.getAlignPopupClassName(n.builtinPlacements,n.prefixCls,B.value,n.alignPoint);return re.classNames(e,n?.getPopupClassNameFromAlign?.(B.value))});ve({nativeElement:V,popupElement:$,forceAlign:y});const ue=t.shallowRef(0),le=t.shallowRef(0),ae=()=>{if(n.stretch&&i.value){const e=i.value.getBoundingClientRect();ue.value=e.width,le.value=e.height}},Oe=()=>{ae(),y()},Ee=e=>{g.value=!1,j(),n?.afterOpenChange?.(e),n?.afterPopupVisibleChange?.(e)},Ve=()=>new Promise(e=>{ae(),b.value=e});t.watch([b],()=>{b.value&&(j(),b.value(),b.value=void 0)});function P(e,u,a,v,M,o){e[u]=(r,...s)=>{(!o||!o())&&(M?.(r),f(a,v)),m[u]?.(r,...s)}}const oe=t.computed(()=>w.value?.has("touch")),z=t.computed(()=>h.value?.has("touch")),I=t.shallowRef(!1);t.watchEffect(()=>{const e={};(oe.value||z.value)&&(e.onTouchstart=(...u)=>{I.value=!0,p.value&&z.value?f(!1):!p.value&&oe.value&&f(!0),m.onTouchstart?.(...u)}),(ne.value||D.value)&&(e.onClick=(u,...a)=>{p.value&&D.value?f(!1):!p.value&&ne.value&&(F(u),f(!0)),m?.onClick?.(u,...a),I.value=!1}),_.value=e});const Fe=lt.default(l,t.computed(()=>D.value||z.value),i,d,t.computed(()=>n.mask),t.computed(()=>n.maskClosable),G,f),Be=t.computed(()=>w.value?.has("hover")),je=t.computed(()=>h.value?.has("hover"));let S,L;const N=()=>I.value;t.watchEffect(()=>{const{mouseEnterDelay:e,mouseLeaveDelay:u,alignPoint:a,focusDelay:v,blurDelay:M}=n,o={};if(Be.value){const r=s=>{F(s)};P(o,"onMouseenter",!0,e,r,N),P(o,"onPointerenter",!0,e,r,N),S=s=>{(l.value||g.value)&&d?.value?.contains(s.target)&&f(!0,e)},a&&(o.onMouseMove=s=>{m.onMousemove?.(s)})}else S=void 0;je.value?(P(o,"onMouseleave",!1,u,void 0,N),P(o,"onPointerleave",!1,u,void 0,N),L=r=>{const{relatedTarget:s}=r;s&&G(s)||f(!1,u)}):L=void 0,w.value.has("focus")&&P(o,"onFocus",!0,v),h.value.has("focus")&&P(o,"onBlur",!1,M),w.value.has("contextmenu")&&(o.onContextmenu=(r,...s)=>{p.value&&h.value.has("contextmenu")?f(!1):(F(r),f(!0)),r.preventDefault(),m.onContextmenu?.(r,...s)}),J.value=o});const ie=t.shallowRef(!1);return t.watchEffect(()=>{ie.value||=n.forceRender||l.value||g.value}),()=>{const e=Ze.filterEmpty(me?.default?.()??[])?.[0],u={...m,...Ce.value},a={};["onContextmenu","onClick","onMousedown","onTouchstart","onMouseenter","onMouseleave","onFocus","onBlur"].forEach(T=>{U[T]&&(a[T]=(...se)=>{u[T]?.(...se),U[T](...se)})});const M={x:Ae.value,y:xe.value},o=t.createVNode(e,{...u,...a,ref:Pe}),{unique:r,prefixCls:s,popup:ze,popupClassName:Ie,popupStyle:Le,zIndex:He,fresh:Ue,onPopupClick:Xe,mask:Ye,popupMotion:$e,maskMotion:We,forceRender:_e,getPopupContainer:Je,stretch:Ge,mobile:Ke}=n;return t.createVNode(t.Fragment,null,[t.createVNode(Qe,{disabled:!l.value,onResize:Oe},st(o)?o:{default:()=>[o]}),ie.value&&i.value&&(!c||!r)&&t.createVNode(H.TriggerContextProvider,he.value,{default:()=>[t.createVNode(at.default,{portal:C,ref:ye,prefixCls:s,popup:ze,className:re.classNames(Ie,!X.value&&Te.value),style:Le,target:i.value,onMouseEnter:S,onMouseLeave:L,onPointerEnter:S,zIndex:He,open:l.value,keepDom:g.value,fresh:Ue,onClick:Xe,onPointerDownCapture:Fe,mask:Ye,motion:$e,maskMotion:We,onVisibleChanged:Ee,onPrepare:Ve,forceRender:_e,autoDestroy:ge.value,getPopupContainer:Je,align:B.value,arrow:K.value,arrowPos:M,ready:be.value,offsetX:we.value,offsetY:Me.value,offsetR:Re.value,offsetB:ke.value,onAlign:y,stretch:Ge,targetWidth:ue.value/De.value,targetHeight:le.value/Se.value,mobile:Ke},null)]})])}},{props:t.mergeDefaults({action:{type:[String,Array],required:!1,default:void 0},showAction:{type:Array,required:!1,default:void 0},hideAction:{type:Array,required:!1,default:void 0},prefixCls:{type:String,required:!1,default:void 0},zIndex:{type:Number,required:!1,default:void 0},onPopupAlign:{type:Function,required:!1,default:void 0},stretch:{type:String,required:!1,default:void 0},popupVisible:{type:Boolean,required:!1,default:void 0},defaultPopupVisible:{type:Boolean,required:!1,default:void 0},onOpenChange:{type:Function,required:!1,default:void 0},afterOpenChange:{type:Function,required:!1,default:void 0},onPopupVisibleChange:{type:Function,required:!1,default:void 0},afterPopupVisibleChange:{type:Function,required:!1,default:void 0},getPopupContainer:{type:Function,required:!1,default:void 0},forceRender:{type:Boolean,required:!1,default:void 0},autoDestroy:{type:Boolean,required:!1,default:void 0},mask:{type:Boolean,required:!1,default:void 0},maskClosable:{type:Boolean,required:!1,default:void 0},popupMotion:{type:Object,required:!1,default:void 0},maskMotion:{type:Object,required:!1,default:void 0},mouseEnterDelay:{type:Number,required:!1,default:void 0},mouseLeaveDelay:{type:Number,required:!1,default:void 0},focusDelay:{type:Number,required:!1,default:void 0},blurDelay:{type:Number,required:!1,default:void 0},popup:{type:[String,Number,null,Array,Function],required:!0,skipCheck:!0,default:void 0},popupPlacement:{type:String,required:!1,default:void 0},builtinPlacements:{type:Object,required:!1,default:void 0},popupAlign:{type:Object,required:!1,default:void 0},popupClassName:{type:String,required:!1,default:void 0},uniqueContainerClassName:{type:String,required:!1,default:void 0},uniqueContainerStyle:{type:null,required:!1,default:void 0},popupStyle:{type:null,required:!1,default:void 0},getPopupClassNameFromAlign:{type:Function,required:!1,default:void 0},onPopupClick:{type:Function,required:!1,default:void 0},alignPoint:{type:Boolean,required:!1,default:void 0},fresh:{type:Boolean,required:!1,default:void 0},unique:{type:Boolean,required:!1,default:void 0},arrow:{type:[Boolean,Object],required:!1,default:void 0},mobile:{type:Object,required:!1,default:void 0}},rt)})}const pe=ce(de);exports.UniqueProvider=it.default;exports.Trigger=pe;exports.default=pe;exports.generateTrigger=ce;