@v-c/trigger 0.0.8 → 0.0.9
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.
- package/dist/hooks/useAlign.cjs +1 -1
- package/dist/hooks/useAlign.d.ts +1 -1
- package/dist/hooks/useAlign.js +148 -154
- package/package.json +4 -3
package/dist/hooks/useAlign.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Ae=require("@v-c/util/dist/Dom/findDOMNode"),Re=require("@v-c/util/dist/Dom/isVisible"),Pe=require("@v-c/util/dist/raf"),f=require("vue"),V=require("../util.cjs");function Mt(o,a=0){const c=`${a}`,u=c.match(/^(.*)\%$/);return u?o*(parseFloat(u[1])/100):parseFloat(c)}function Bt(o,a){const[c,u]=a||[];return[Mt(o.width,c),Mt(o.height,u)]}function Ot(o=""){return[o[0],o[1]]}function T(o,a){const c=a[0],u=a[1];let y,P;return c==="t"?P=o.y:c==="b"?P=o.y+o.height:P=o.y+o.height/2,u==="l"?y=o.x:u==="r"?y=o.x+o.width:y=o.x+o.width/2,{x:y,y:P}}function w(o,a){const c={t:"b",b:"t",l:"r",r:"l"};return o.map((u,y)=>y===a?c[u]||"c":u).join("")}function Xe(o,a,c,u,y,P,Vt,D){const g=f.ref({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:y.value[u.value]||{}}),E=f.shallowRef(0),J=f.computed(()=>!a.value||D?.value?[]:V.collectScroller(a.value)),h=f.ref({}),Tt=()=>{h.value={}},Ct=()=>{if(a.value&&c.value&&o.value&&!D?.value){let p=function(t,v,m=rt){const Xt=s.x+t,Yt=s.y+v,de=Xt+Y,ve=Yt+X,ye=Math.max(Xt,m.left),xe=Math.max(Yt,m.top),be=Math.min(de,m.right),we=Math.min(ve,m.bottom);return Math.max(0,(be-ye)*(we-xe))},Z=function(){N=s.y+r,H=N+X,F=s.x+l,k=F+Y};const e=a.value,tt=e.ownerDocument,et=V.getWin(e),{position:It}=et.getComputedStyle(e),St=e.style.left,Nt=e.style.top,Ft=e.style.right,jt=e.style.bottom,Wt=e.style.overflow,C={...y.value[u.value],...P?.value},A=tt.createElement("div");e.parentElement?.appendChild(A),A.style.left=`${e.offsetLeft}px`,A.style.top=`${e.offsetTop}px`,A.style.position=It,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(c.value))i={x:c.value[0],y:c.value[1],width:0,height:0};else{const t=c.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 s=e.getBoundingClientRect(),{height:$t,width:qt}=et.getComputedStyle(e);s.x=s.x??s.left,s.y=s.y??s.top;const{clientWidth:Ht,clientHeight:kt,scrollWidth:Dt,scrollHeight:Et,scrollTop:ot,scrollLeft:nt}=tt.documentElement,X=s.height,Y=s.width,L=i.height,I=i.width,_t={left:0,top:0,right:Ht,bottom:kt},Ut={left:-nt,top:-ot,right:Dt-nt,bottom:Et-ot};let{htmlRegion:S}=C;const st="visible",it="visibleFirst";S!=="scroll"&&S!==it&&(S=st);const lt=S===it,zt=V.getVisibleArea(Ut,J.value),n=V.getVisibleArea(_t,J.value),rt=S===st?n:zt,$=lt?n:rt;e.style.left="auto",e.style.top="auto",e.style.right="0",e.style.bottom="0";const ft=e.getBoundingClientRect();e.style.left=St,e.style.top=Nt,e.style.right=Ft,e.style.bottom=jt,e.style.overflow=Wt,e.parentElement?.removeChild(A);const M=V.toNum(Math.round(Y/parseFloat(qt)*1e3)/1e3),B=V.toNum(Math.round(X/parseFloat($t)*1e3)/1e3);if(M===0||B===0||Ae.isDOM(c)&&!Re(c))return;const{offset:Gt,targetOffset:Jt}=C;let[x,b]=Bt(s,Gt);const[Kt,Qt]=Bt(i,Jt);i.x-=Kt,i.y-=Qt;const[Zt,te]=C.points||[],R=Ot(te),d=Ot(Zt),ct=T(i,R),at=T(s,d),O={...C};let l=ct.x-at.x+x,r=ct.y-at.y+b;const ut=p(l,r),ee=p(l,r,n),q=(t,v)=>!!(t>ut||lt&&t===ut&&v>=ee),pt=T(i,["t","l"]),ht=T(s,["t","l"]),gt=T(i,["b","r"]),mt=T(s,["b","r"]),oe=C.overflow||{},{adjustX:ne,adjustY:se,shiftX:dt,shiftY:vt}=oe,yt=t=>typeof t=="boolean"?t:t>=0;let N,H,F,k;Z();const xt=yt(se),bt=d[0]===R[0];if(xt&&d[0]==="t"&&(H>$.bottom||h.value.bt)){let t=r;bt?t-=X-L:t=pt.y-mt.y-b;const v=p(l,t),m=p(l,t,n);q(v,m)?(h.value.bt=!0,r=t,b=-b,O.points=[w(d,0),w(R,0)]):h.value.bt=!1}if(xt&&d[0]==="b"&&(N<$.top||h.value.tb)){let t=r;bt?t+=X-L:t=gt.y-ht.y-b;const v=p(l,t),m=p(l,t,n);q(v,m)?(h.value.tb=!0,r=t,b=-b,O.points=[w(d,0),w(R,0)]):h.value.tb=!1}const wt=yt(ne),At=d[1]===R[1];if(wt&&d[1]==="l"&&(k>$.right||h.value.rl)){let t=l;At?t-=Y-I:t=pt.x-mt.x-x;const v=p(t,r),m=p(t,r,n);q(v,m)?(h.value.rl=!0,l=t,x=-x,O.points=[w(d,1),w(R,1)]):h.value.rl=!1}if(wt&&d[1]==="r"&&(F<$.left||h.value.lr)){let t=l;At?t+=Y-I:t=gt.x-ht.x-x;const v=p(t,r),m=p(t,r,n);q(v,m)?(h.value.lr=!0,l=t,x=-x,O.points=[w(d,1),w(R,1)]):h.value.lr=!1}Z();const j=dt===!0?0:dt;typeof j=="number"&&(F<n.left&&(l-=F-n.left-x,i.x+I<n.left+j&&(l+=i.x-n.left+I-j)),k>n.right&&(l-=k-n.right-x,i.x>n.right-j&&(l+=i.x-n.right+j)));const W=vt===!0?0:vt;typeof W=="number"&&(N<n.top&&(r-=N-n.top-b,i.y+L<n.top+W&&(r+=i.y-n.top+L-W)),H>n.bottom&&(r-=H-n.bottom-b,i.y>n.bottom-W&&(r+=i.y-n.bottom+W)));const _=s.x+l,ie=_+Y,U=s.y+r,le=U+X,Rt=i.x,re=Rt+I,Pt=i.y,fe=Pt+L,ce=Math.max(_,Rt),ae=Math.min(ie,re),ue=(ce+ae)/2-_,pe=Math.max(U,Pt),he=Math.min(le,fe),ge=(pe+he)/2-U;Vt?.(a.value,O);let z=ft.right-s.x-(l+s.width),G=ft.bottom-s.y-(r+s.height);M===1&&(l=Math.round(l),z=Math.round(z)),B===1&&(r=Math.round(r),G=Math.round(G));const me={ready:!0,offsetX:l/M,offsetY:r/B,offsetR:z/M,offsetB:G/B,arrowX:ue/M,arrowY:ge/B,scaleX:M,scaleY:B,align:O};g.value=me}},Lt=Pe.rafDebounce(Ct),K=()=>{E.value+=1;const p=E.value;Promise.resolve().then(()=>{E.value===p&&Lt()})};f.watch(a,async p=>{p&&o.value&&!D?.value&&(await f.nextTick(),K())});const Q=()=>{g.value.ready=!1};return f.watch(u,async()=>{await f.nextTick(),Q()}),f.watchEffect(async()=>{await f.nextTick(),o.value||(Tt(),Q())}),[f.computed(()=>g.value?.ready),f.computed(()=>g.value?.offsetX),f.computed(()=>g.value?.offsetY),f.computed(()=>g.value?.offsetR),f.computed(()=>g.value?.offsetB),f.computed(()=>g.value?.arrowX),f.computed(()=>g.value?.arrowY),f.computed(()=>g.value?.scaleX),f.computed(()=>g.value?.scaleY),f.computed(()=>g.value?.align),K]}exports.default=Xe;
|
package/dist/hooks/useAlign.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { TriggerProps } from '../index.tsx';
|
|
3
3
|
import { AlignType } from '../interface';
|
|
4
|
-
export default function useAlign(open: Ref<boolean>, popupEle: Ref<HTMLElement>, target: Ref<HTMLElement | [x: number, y: number]>, placement: Ref<string>, builtinPlacements: Ref<any>, popupAlign?: Ref<AlignType | undefined>, onPopupAlign?: TriggerProps['onPopupAlign'], mobile?: Ref<boolean | undefined>): readonly [
|
|
4
|
+
export default function useAlign(open: Ref<boolean>, popupEle: Ref<HTMLElement>, target: Ref<HTMLElement | [x: number, y: number]>, placement: Ref<string>, builtinPlacements: Ref<any>, popupAlign?: Ref<AlignType | undefined>, onPopupAlign?: TriggerProps['onPopupAlign'], mobile?: Ref<boolean | undefined>): readonly [import('vue').ComputedRef<boolean>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<number>, import('vue').ComputedRef<any>, () => void];
|
package/dist/hooks/useAlign.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { isDOM as
|
|
2
|
-
import
|
|
3
|
-
import { rafDebounce as
|
|
4
|
-
import {
|
|
5
|
-
import { collectScroller as
|
|
6
|
-
function
|
|
7
|
-
const f = `${
|
|
8
|
-
return
|
|
1
|
+
import { isDOM as Ye } from "@v-c/util/dist/Dom/findDOMNode";
|
|
2
|
+
import Pe from "@v-c/util/dist/Dom/isVisible";
|
|
3
|
+
import { rafDebounce as Be } from "@v-c/util/dist/raf";
|
|
4
|
+
import { ref as Bt, shallowRef as Me, computed as y, watch as Mt, nextTick as G, watchEffect as Oe } from "vue";
|
|
5
|
+
import { collectScroller as Ve, getWin as Ce, getVisibleArea as Ot, toNum as Vt } from "../util.js";
|
|
6
|
+
function Ct(o, a = 0) {
|
|
7
|
+
const f = `${a}`, c = f.match(/^(.*)\%$/);
|
|
8
|
+
return c ? o * (parseFloat(c[1]) / 100) : parseFloat(f);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const [f,
|
|
10
|
+
function Lt(o, a) {
|
|
11
|
+
const [f, c] = a || [];
|
|
12
12
|
return [
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
Ct(o.width, f),
|
|
14
|
+
Ct(o.height, c)
|
|
15
15
|
];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function It(o = "") {
|
|
18
18
|
return [o[0], o[1]];
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const f =
|
|
22
|
-
let
|
|
23
|
-
return f === "t" ?
|
|
20
|
+
function V(o, a) {
|
|
21
|
+
const f = a[0], c = a[1];
|
|
22
|
+
let d, X;
|
|
23
|
+
return f === "t" ? X = o.y : f === "b" ? X = o.y + o.height : X = o.y + o.height / 2, c === "l" ? d = o.x : c === "r" ? d = o.x + o.width : d = o.x + o.width / 2, { x: d, y: X };
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function w(o, a) {
|
|
26
26
|
const f = {
|
|
27
27
|
t: "b",
|
|
28
28
|
b: "t",
|
|
29
29
|
l: "r",
|
|
30
30
|
r: "l"
|
|
31
31
|
};
|
|
32
|
-
return o.map((
|
|
32
|
+
return o.map((c, d) => d === a ? f[c] || "c" : c).join("");
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const
|
|
34
|
+
function $e(o, a, f, c, d, X, Tt, D) {
|
|
35
|
+
const h = Bt({
|
|
36
36
|
ready: !1,
|
|
37
37
|
offsetX: 0,
|
|
38
38
|
offsetY: 0,
|
|
@@ -42,22 +42,22 @@ function Ke(o, c, f, a, y, R, Lt, D) {
|
|
|
42
42
|
arrowY: 0,
|
|
43
43
|
scaleX: 1,
|
|
44
44
|
scaleY: 1,
|
|
45
|
-
align:
|
|
46
|
-
}),
|
|
45
|
+
align: d.value[c.value] || {}
|
|
46
|
+
}), _ = Me(0), J = y(() => !a.value || D?.value ? [] : Ve(a.value)), p = Bt({}), Ft = () => {
|
|
47
47
|
p.value = {};
|
|
48
|
-
},
|
|
49
|
-
if (
|
|
50
|
-
let u = function(t,
|
|
51
|
-
const
|
|
52
|
-
return Math.max(0, (
|
|
53
|
-
},
|
|
54
|
-
F =
|
|
48
|
+
}, St = Be(() => {
|
|
49
|
+
if (a.value && f.value && o.value && !D?.value) {
|
|
50
|
+
let u = function(t, v, g = rt) {
|
|
51
|
+
const Yt = s.x + t, Pt = s.y + v, xe = Yt + P, be = Pt + Y, we = Math.max(Yt, g.left), Ae = Math.max(Pt, g.top), Re = Math.min(xe, g.right), Xe = Math.min(be, g.bottom);
|
|
52
|
+
return Math.max(0, (Re - we) * (Xe - Ae));
|
|
53
|
+
}, Z = function() {
|
|
54
|
+
F = s.y + r, H = F + Y, S = s.x + l, E = S + P;
|
|
55
55
|
};
|
|
56
|
-
const e =
|
|
57
|
-
...
|
|
58
|
-
...
|
|
59
|
-
},
|
|
60
|
-
e.parentElement?.appendChild(
|
|
56
|
+
const e = a.value, tt = e.ownerDocument, et = Ce(e), { position: Nt } = et.getComputedStyle(e), jt = e.style.left, Wt = e.style.top, $t = e.style.right, Ht = e.style.bottom, Et = e.style.overflow, C = {
|
|
57
|
+
...d.value[c.value],
|
|
58
|
+
...X?.value
|
|
59
|
+
}, A = tt.createElement("div");
|
|
60
|
+
e.parentElement?.appendChild(A), A.style.left = `${e.offsetLeft}px`, A.style.top = `${e.offsetTop}px`, A.style.position = Nt, 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";
|
|
61
61
|
let i;
|
|
62
62
|
if (Array.isArray(f.value))
|
|
63
63
|
i = {
|
|
@@ -75,190 +75,184 @@ function Ke(o, c, f, a, y, R, Lt, D) {
|
|
|
75
75
|
height: t.height
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
78
|
+
const s = e.getBoundingClientRect(), { height: Dt, width: _t } = et.getComputedStyle(e);
|
|
79
|
+
s.x = s.x ?? s.left, s.y = s.y ?? s.top;
|
|
80
80
|
const {
|
|
81
|
-
clientWidth:
|
|
82
|
-
clientHeight:
|
|
83
|
-
scrollWidth:
|
|
84
|
-
scrollHeight:
|
|
85
|
-
scrollTop:
|
|
81
|
+
clientWidth: kt,
|
|
82
|
+
clientHeight: Ut,
|
|
83
|
+
scrollWidth: qt,
|
|
84
|
+
scrollHeight: zt,
|
|
85
|
+
scrollTop: ot,
|
|
86
86
|
scrollLeft: nt
|
|
87
|
-
} =
|
|
87
|
+
} = tt.documentElement, Y = s.height, P = s.width, L = i.height, I = i.width, Gt = {
|
|
88
88
|
left: 0,
|
|
89
89
|
top: 0,
|
|
90
|
-
right:
|
|
91
|
-
bottom:
|
|
92
|
-
},
|
|
90
|
+
right: kt,
|
|
91
|
+
bottom: Ut
|
|
92
|
+
}, Jt = {
|
|
93
93
|
left: -nt,
|
|
94
|
-
top: -
|
|
95
|
-
right:
|
|
96
|
-
bottom:
|
|
94
|
+
top: -ot,
|
|
95
|
+
right: qt - nt,
|
|
96
|
+
bottom: zt - ot
|
|
97
97
|
};
|
|
98
|
-
let { htmlRegion:
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
98
|
+
let { htmlRegion: T } = C;
|
|
99
|
+
const st = "visible", it = "visibleFirst";
|
|
100
|
+
T !== "scroll" && T !== it && (T = st);
|
|
101
|
+
const lt = T === it, Kt = Ot(Jt, J.value), n = Ot(Gt, J.value), rt = T === st ? n : Kt, W = lt ? n : rt;
|
|
102
102
|
e.style.left = "auto", e.style.top = "auto", e.style.right = "0", e.style.bottom = "0";
|
|
103
103
|
const ft = e.getBoundingClientRect();
|
|
104
|
-
e.style.left =
|
|
105
|
-
const
|
|
106
|
-
Math.round(
|
|
107
|
-
),
|
|
108
|
-
Math.round(
|
|
104
|
+
e.style.left = jt, e.style.top = Wt, e.style.right = $t, e.style.bottom = Ht, e.style.overflow = Et, e.parentElement?.removeChild(A);
|
|
105
|
+
const B = Vt(
|
|
106
|
+
Math.round(P / parseFloat(_t) * 1e3) / 1e3
|
|
107
|
+
), M = Vt(
|
|
108
|
+
Math.round(Y / parseFloat(Dt) * 1e3) / 1e3
|
|
109
109
|
);
|
|
110
|
-
if (
|
|
110
|
+
if (B === 0 || M === 0 || Ye(f) && !Pe(f))
|
|
111
111
|
return;
|
|
112
|
-
const { offset:
|
|
113
|
-
let [
|
|
114
|
-
const [
|
|
112
|
+
const { offset: Qt, targetOffset: Zt } = C;
|
|
113
|
+
let [x, b] = Lt(s, Qt);
|
|
114
|
+
const [te, ee] = Lt(
|
|
115
115
|
i,
|
|
116
|
-
|
|
116
|
+
Zt
|
|
117
117
|
);
|
|
118
|
-
i.x -=
|
|
119
|
-
const [
|
|
120
|
-
...
|
|
118
|
+
i.x -= te, i.y -= ee;
|
|
119
|
+
const [oe, ne] = C.points || [], R = It(ne), m = It(oe), at = V(i, R), ct = V(s, m), O = {
|
|
120
|
+
...C
|
|
121
121
|
};
|
|
122
|
-
let l =
|
|
123
|
-
const
|
|
122
|
+
let l = at.x - ct.x + x, r = at.y - ct.y + b;
|
|
123
|
+
const ut = u(
|
|
124
124
|
l,
|
|
125
125
|
r
|
|
126
|
-
),
|
|
126
|
+
), se = u(
|
|
127
127
|
l,
|
|
128
128
|
r,
|
|
129
|
-
|
|
130
|
-
), ut =
|
|
129
|
+
n
|
|
130
|
+
), $ = (t, v) => !!(t > ut || lt && t === ut && v >= se), pt = V(i, ["t", "l"]), ht = V(s, ["t", "l"]), gt = V(i, ["b", "r"]), mt = V(s, ["b", "r"]), ie = C.overflow || {}, { adjustX: le, adjustY: re, shiftX: vt, shiftY: yt } = ie, dt = (t) => typeof t == "boolean" ? t : t >= 0;
|
|
131
131
|
let F, H, S, E;
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
132
|
+
Z();
|
|
133
|
+
const xt = dt(re), bt = m[0] === R[0];
|
|
134
|
+
if (xt && m[0] === "t" && (H > W.bottom || p.value.bt)) {
|
|
135
135
|
let t = r;
|
|
136
|
-
|
|
137
|
-
const
|
|
136
|
+
bt ? t -= Y - L : t = pt.y - mt.y - b;
|
|
137
|
+
const v = u(
|
|
138
138
|
l,
|
|
139
139
|
t
|
|
140
140
|
), g = u(
|
|
141
141
|
l,
|
|
142
142
|
t,
|
|
143
|
-
|
|
143
|
+
n
|
|
144
144
|
);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
b(A, 0)
|
|
145
|
+
$(v, g) ? (p.value.bt = !0, r = t, b = -b, O.points = [
|
|
146
|
+
w(m, 0),
|
|
147
|
+
w(R, 0)
|
|
149
148
|
]) : p.value.bt = !1;
|
|
150
149
|
}
|
|
151
|
-
if (
|
|
150
|
+
if (xt && m[0] === "b" && (F < W.top || p.value.tb)) {
|
|
152
151
|
let t = r;
|
|
153
|
-
|
|
154
|
-
const
|
|
152
|
+
bt ? t += Y - L : t = gt.y - ht.y - b;
|
|
153
|
+
const v = u(
|
|
155
154
|
l,
|
|
156
155
|
t
|
|
157
156
|
), g = u(
|
|
158
157
|
l,
|
|
159
158
|
t,
|
|
160
|
-
|
|
159
|
+
n
|
|
161
160
|
);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
b(A, 0)
|
|
161
|
+
$(v, g) ? (p.value.tb = !0, r = t, b = -b, O.points = [
|
|
162
|
+
w(m, 0),
|
|
163
|
+
w(R, 0)
|
|
166
164
|
]) : p.value.tb = !1;
|
|
167
165
|
}
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
166
|
+
const wt = dt(le), At = m[1] === R[1];
|
|
167
|
+
if (wt && m[1] === "l" && (E > W.right || p.value.rl)) {
|
|
170
168
|
let t = l;
|
|
171
|
-
|
|
172
|
-
const
|
|
169
|
+
At ? t -= P - I : t = pt.x - mt.x - x;
|
|
170
|
+
const v = u(
|
|
173
171
|
t,
|
|
174
172
|
r
|
|
175
173
|
), g = u(
|
|
176
174
|
t,
|
|
177
175
|
r,
|
|
178
|
-
|
|
176
|
+
n
|
|
179
177
|
);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
b(A, 1)
|
|
178
|
+
$(v, g) ? (p.value.rl = !0, l = t, x = -x, O.points = [
|
|
179
|
+
w(m, 1),
|
|
180
|
+
w(R, 1)
|
|
184
181
|
]) : p.value.rl = !1;
|
|
185
182
|
}
|
|
186
|
-
if (
|
|
183
|
+
if (wt && m[1] === "r" && (S < W.left || p.value.lr)) {
|
|
187
184
|
let t = l;
|
|
188
|
-
|
|
189
|
-
const
|
|
185
|
+
At ? t += P - I : t = gt.x - ht.x - x;
|
|
186
|
+
const v = u(
|
|
190
187
|
t,
|
|
191
188
|
r
|
|
192
189
|
), g = u(
|
|
193
190
|
t,
|
|
194
191
|
r,
|
|
195
|
-
|
|
192
|
+
n
|
|
196
193
|
);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
b(A, 1)
|
|
194
|
+
$(v, g) ? (p.value.lr = !0, l = t, x = -x, O.points = [
|
|
195
|
+
w(m, 1),
|
|
196
|
+
w(R, 1)
|
|
201
197
|
]) : p.value.lr = !1;
|
|
202
198
|
}
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
typeof
|
|
206
|
-
const
|
|
207
|
-
typeof
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
let
|
|
211
|
-
|
|
212
|
-
const
|
|
199
|
+
Z();
|
|
200
|
+
const N = vt === !0 ? 0 : vt;
|
|
201
|
+
typeof N == "number" && (S < n.left && (l -= S - n.left - x, i.x + I < n.left + N && (l += i.x - n.left + I - N)), E > n.right && (l -= E - n.right - x, i.x > n.right - N && (l += i.x - n.right + N)));
|
|
202
|
+
const j = yt === !0 ? 0 : yt;
|
|
203
|
+
typeof j == "number" && (F < n.top && (r -= F - n.top - b, i.y + L < n.top + j && (r += i.y - n.top + L - j)), H > n.bottom && (r -= H - n.bottom - b, i.y > n.bottom - j && (r += i.y - n.bottom + j)));
|
|
204
|
+
const k = s.x + l, fe = k + P, U = s.y + r, ae = U + Y, Rt = i.x, ce = Rt + I, Xt = i.y, ue = Xt + L, pe = Math.max(k, Rt), he = Math.min(fe, ce), ge = (pe + he) / 2 - k, me = Math.max(U, Xt), ve = Math.min(ae, ue), ye = (me + ve) / 2 - U;
|
|
205
|
+
Tt?.(a.value, O);
|
|
206
|
+
let q = ft.right - s.x - (l + s.width), z = ft.bottom - s.y - (r + s.height);
|
|
207
|
+
B === 1 && (l = Math.round(l), q = Math.round(q)), M === 1 && (r = Math.round(r), z = Math.round(z));
|
|
208
|
+
const de = {
|
|
213
209
|
ready: !0,
|
|
214
|
-
offsetX: l /
|
|
215
|
-
offsetY: r /
|
|
216
|
-
offsetR:
|
|
217
|
-
offsetB:
|
|
218
|
-
arrowX:
|
|
219
|
-
arrowY:
|
|
220
|
-
scaleX:
|
|
221
|
-
scaleY:
|
|
222
|
-
align:
|
|
210
|
+
offsetX: l / B,
|
|
211
|
+
offsetY: r / M,
|
|
212
|
+
offsetR: q / B,
|
|
213
|
+
offsetB: z / M,
|
|
214
|
+
arrowX: ge / B,
|
|
215
|
+
arrowY: ye / M,
|
|
216
|
+
scaleX: B,
|
|
217
|
+
scaleY: M,
|
|
218
|
+
align: O
|
|
223
219
|
};
|
|
224
|
-
|
|
220
|
+
h.value = de;
|
|
225
221
|
}
|
|
226
|
-
}),
|
|
227
|
-
|
|
228
|
-
const u =
|
|
222
|
+
}), K = () => {
|
|
223
|
+
_.value += 1;
|
|
224
|
+
const u = _.value;
|
|
229
225
|
Promise.resolve().then(() => {
|
|
230
|
-
|
|
226
|
+
_.value === u && St();
|
|
231
227
|
});
|
|
232
228
|
};
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
Mt(
|
|
230
|
+
a,
|
|
235
231
|
async (u) => {
|
|
236
|
-
u && o.value && !D?.value && (await
|
|
232
|
+
u && o.value && !D?.value && (await G(), K());
|
|
237
233
|
}
|
|
238
234
|
);
|
|
239
|
-
const
|
|
240
|
-
|
|
235
|
+
const Q = () => {
|
|
236
|
+
h.value.ready = !1;
|
|
241
237
|
};
|
|
242
|
-
|
|
243
|
-
await
|
|
244
|
-
}),
|
|
245
|
-
await
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
$t,
|
|
259
|
-
Q
|
|
238
|
+
return Mt(c, async () => {
|
|
239
|
+
await G(), Q();
|
|
240
|
+
}), Oe(async () => {
|
|
241
|
+
await G(), o.value || (Ft(), Q());
|
|
242
|
+
}), [
|
|
243
|
+
y(() => h.value?.ready),
|
|
244
|
+
y(() => h.value?.offsetX),
|
|
245
|
+
y(() => h.value?.offsetY),
|
|
246
|
+
y(() => h.value?.offsetR),
|
|
247
|
+
y(() => h.value?.offsetB),
|
|
248
|
+
y(() => h.value?.arrowX),
|
|
249
|
+
y(() => h.value?.arrowY),
|
|
250
|
+
y(() => h.value?.scaleX),
|
|
251
|
+
y(() => h.value?.scaleY),
|
|
252
|
+
y(() => h.value?.align),
|
|
253
|
+
K
|
|
260
254
|
];
|
|
261
255
|
}
|
|
262
256
|
export {
|
|
263
|
-
|
|
257
|
+
$e as default
|
|
264
258
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/trigger",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -31,11 +31,12 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@v-c/portal": "0.0.3",
|
|
33
33
|
"@v-c/resize-observer": "0.0.2",
|
|
34
|
-
"@v-c/util": "0.0.
|
|
34
|
+
"@v-c/util": "0.0.12"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "vite build",
|
|
38
38
|
"test": "vitest",
|
|
39
|
-
"prepublish": "pnpm build"
|
|
39
|
+
"prepublish": "pnpm build",
|
|
40
|
+
"bump": "bumpp patch"
|
|
40
41
|
}
|
|
41
42
|
}
|