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