aptechka 0.53.2 → 0.53.3
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/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +91 -85
- package/package.json +1 -1
package/lib/pointer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var J=Object.defineProperty;var B=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var j=i=>{throw TypeError(i)};var H=(i,s,t)=>s in i?J(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t,O=(i,s)=>{for(var t in s||(s={}))K.call(s,t)&&H(i,t,s[t]);if(B)for(var t of B(s))N.call(s,t)&&H(i,t,s[t]);return i};var R=(i,s,t)=>s.has(i)||j("Cannot "+t);var e=(i,s,t)=>(R(i,s,"read from private field"),t?t.call(i):s.get(i)),r=(i,s,t)=>s.has(i)?j("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(i):s.set(i,t),c=(i,s,t,u)=>(R(i,s,"write to private field"),u?u.call(i,t):s.set(i,t),t),D=(i,s,t)=>(R(i,s,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../Store-GokLe_g-.cjs");const _=require("../coordinates-D8Np3cPD.cjs"),Q=require("../dom-JBOkFLTh.cjs"),W=require("../math-GDWEqu7y.cjs"),U=require("../index-Cqw2NKev.cjs");require("../ticker/index.cjs");const M=require("../Damped-DgAIjXp3.cjs"),A=require("../element-resizer/index.cjs"),F=require("../window-resizer/index.cjs"),S=require("../css-property/index.cjs");var o,a,l,d,m,p,b,x,k,f,w,C,y,q,T;class G{constructor(s){r(this,q);r(this,o);r(this,a);r(this,l);r(this,d);r(this,m);r(this,p);r(this,b,0);r(this,x,0);r(this,k,!1);r(this,f,s=>{const t=D(this,q,T).call(this,s);e(this,a).set(t.x,{equalize:!0}),e(this,l).set(t.y,{equalize:!0}),e(this,d).set(1)});r(this,w,s=>{e(this,d).set(0)});r(this,C,s=>{const t=D(this,q,T).call(this,s);e(this,a).set(t.x),e(this,l).set(t.y)});r(this,y,()=>{c(this,b,this.element.clientWidth),c(this,x,this.element.clientHeight);let s=0,t=0,u=0,h=0;e(this,m)?e(this,p)?(s=-1,t=1,u=-1,h=1):(s=e(this,b)/2*-1,t=e(this,b)/2*1,u=e(this,x)/2*-1,h=e(this,x)/2*1):e(this,p)?(s=0,t=1,u=0,h=1):(s=0,t=e(this,b),u=0,h=e(this,x)),e(this,a).min=s,e(this,a).max=t,e(this,l).min=u,e(this,l).max=h});c(this,o,Q.getElement(s.element)),c(this,a,new M.Damped(0,s.damped)),c(this,l,new M.Damped(0,s.damped)),c(this,d,new M.Damped(0,O({min:0,max:1},s.damped))),c(this,m,s.cartesian||!1),c(this,p,s.normalize||!1)}get element(){return e(this,o)}get x(){return e(this,a)}get y(){return e(this,l)}get z(){return e(this,d)}get cartesian(){return e(this,m)}set cartesian(s){c(this,m,s),e(this,y).call(this)}get normalize(){return e(this,p)}set normalize(s){c(this,p,s),e(this,y).call(this)}connect(){e(this,o).addEventListener("pointerenter",e(this,f)),e(this,o).addEventListener("pointerleave",e(this,w)),e(this,o).addEventListener("pointermove",e(this,C)),A.elementResizer.subscribe(e(this,o),e(this,y)),F.windowResizer.subscribe(e(this,y))}disconnect(){e(this,o).removeEventListener("pointerenter",e(this,f)),e(this,o).removeEventListener("pointerleave",e(this,w)),e(this,o).removeEventListener("pointermove",e(this,C)),A.elementResizer.unsubscribe(e(this,y)),F.windowResizer.unsubscribe(e(this,y)),e(this,a).reset(),e(this,l).reset(),e(this,d).reset()}}o=new WeakMap,a=new WeakMap,l=new WeakMap,d=new WeakMap,m=new WeakMap,p=new WeakMap,b=new WeakMap,x=new WeakMap,k=new WeakMap,f=new WeakMap,w=new WeakMap,C=new WeakMap,y=new WeakMap,q=new WeakSet,T=function(s){const t=_.getPointerPosition(s,e(this,o).getBoundingClientRect()),u={width:e(this,b),height:e(this,x)},h={x:t.x,y:t.y};if(e(this,m)){const z=_.screenToCartesian(h,u);h.x=z.x,h.y=z.y}if(e(this,p)){const z=_.normalize(h,u);e(this,m)?(h.x=W.clamp(z.x*2,-1,1),h.y=W.clamp(z.y*2,-1,1)):(h.x=z.x,h.y=z.y)}return h};var n,g,v,P,E,L;class I extends HTMLElement{constructor(){super();r(this,n);r(this,g,new S.CSSProperty(this,"--damping",20));r(this,v,new S.CSSProperty(this,"--mass",0));r(this,P,new S.CSSProperty(this,"--stiffness",0));r(this,E,new S.CSSProperty(this,"--cartesian",!1));r(this,L,new S.CSSProperty(this,"--normalize",!1));c(this,n,new G({element:this})),e(this,g).subscribe(t=>{e(this,n).x.damping=t.current,e(this,n).y.damping=t.current,e(this,n).z.damping=t.current}),e(this,E).subscribe(t=>{e(this,n).cartesian=t.current}),e(this,L).subscribe(t=>{e(this,n).normalize=t.current}),e(this,v).subscribe(t=>{e(this,n).x.mass=t.current,e(this,n).y.mass=t.current,e(this,n).z.mass=t.current}),e(this,P).subscribe(t=>{e(this,n).x.stiffness=t.current,e(this,n).y.stiffness=t.current,e(this,n).z.stiffness=t.current}),e(this,n).x.subscribe(t=>{this.style.setProperty("--x",t.current.toString())}),e(this,n).y.subscribe(t=>{this.style.setProperty("--y",t.current.toString())}),e(this,n).z.subscribe(t=>{this.style.setProperty("--z",t.current.toString())})}get pointer(){return e(this,n)}connectedCallback(){e(this,n).connect(),e(this,g).observe(),e(this,v).observe(),e(this,P).observe()}disconnectedCallback(){e(this,n).disconnect(),e(this,g).unobserve(),e(this,v).unobserve(),e(this,P).unobserve(),this.style.removeProperty("--x"),this.style.removeProperty("--y"),this.style.removeProperty("--z")}}n=new WeakMap,g=new WeakMap,v=new WeakMap,P=new WeakMap,E=new WeakMap,L=new WeakMap;U.isBrowser&&!customElements.get("e-pointer")&&customElements.define("e-pointer",I);exports.Pointer=G;exports.PointerElement=I;
|
package/lib/pointer/index.js
CHANGED
|
@@ -1,70 +1,59 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var M = Object.getOwnPropertySymbols;
|
|
3
|
+
var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var W = (i) => {
|
|
5
5
|
throw TypeError(i);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var T = (i, s, e) => s in i ? I(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e, j = (i, s) => {
|
|
8
8
|
for (var e in s || (s = {}))
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
for (var e of
|
|
12
|
-
|
|
9
|
+
J.call(s, e) && T(i, e, s[e]);
|
|
10
|
+
if (M)
|
|
11
|
+
for (var e of M(s))
|
|
12
|
+
K.call(s, e) && T(i, e, s[e]);
|
|
13
13
|
return i;
|
|
14
14
|
};
|
|
15
|
-
var
|
|
16
|
-
var t = (i, s, e) => (
|
|
15
|
+
var R = (i, s, e) => s.has(i) || W("Cannot " + e);
|
|
16
|
+
var t = (i, s, e) => (R(i, s, "read from private field"), e ? e.call(i) : s.get(i)), r = (i, s, e) => s.has(i) ? W("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, e), c = (i, s, e, m) => (R(i, s, "write to private field"), m ? m.call(i, e) : s.set(i, e), e), k = (i, s, e) => (R(i, s, "access private method"), e);
|
|
17
17
|
import "../Store-swP_0ymB.js";
|
|
18
|
-
import { g as
|
|
19
|
-
import { g as
|
|
20
|
-
import { c as
|
|
21
|
-
import { i as
|
|
18
|
+
import { g as N, s as O, n as Q } from "../coordinates-CgdGoSYs.js";
|
|
19
|
+
import { g as U } from "../dom-CVWzyXPH.js";
|
|
20
|
+
import { c as A } from "../math-BOBiC4TN.js";
|
|
21
|
+
import { i as V } from "../index-euf5anj6.js";
|
|
22
22
|
import "../ticker/index.js";
|
|
23
|
-
import { D as
|
|
24
|
-
import { elementResizer as
|
|
25
|
-
import { windowResizer as
|
|
23
|
+
import { D as B } from "../Damped-GyAS-U-z.js";
|
|
24
|
+
import { elementResizer as F } from "../element-resizer/index.js";
|
|
25
|
+
import { windowResizer as G } from "../window-resizer/index.js";
|
|
26
26
|
import { CSSProperty as P } from "../css-property/index.js";
|
|
27
|
-
var o, a, l, b,
|
|
28
|
-
class
|
|
27
|
+
var o, a, l, b, u, p, d, f, H, S, w, E, y, L, D;
|
|
28
|
+
class X {
|
|
29
29
|
constructor(s) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
r(this, L);
|
|
31
|
+
r(this, o);
|
|
32
|
+
r(this, a);
|
|
33
|
+
r(this, l);
|
|
34
|
+
r(this, b);
|
|
35
|
+
r(this, u);
|
|
36
|
+
r(this, p);
|
|
37
|
+
r(this, d, 0);
|
|
38
|
+
r(this, f, 0);
|
|
39
|
+
r(this, H, !1);
|
|
40
|
+
r(this, S, (s) => {
|
|
41
|
+
const e = k(this, L, D).call(this, s);
|
|
42
|
+
t(this, a).set(e.x, { equalize: !0 }), t(this, l).set(e.y, { equalize: !0 }), t(this, b).set(1);
|
|
40
43
|
});
|
|
41
|
-
|
|
44
|
+
r(this, w, (s) => {
|
|
42
45
|
t(this, b).set(0);
|
|
43
46
|
});
|
|
44
|
-
|
|
45
|
-
const e =
|
|
46
|
-
|
|
47
|
-
height: t(this, f)
|
|
48
|
-
}, h = {
|
|
49
|
-
x: e.x,
|
|
50
|
-
y: e.y
|
|
51
|
-
};
|
|
52
|
-
if (t(this, p)) {
|
|
53
|
-
const x = I(h, c);
|
|
54
|
-
h.x = x.x, h.y = x.y;
|
|
55
|
-
}
|
|
56
|
-
if (t(this, u)) {
|
|
57
|
-
const x = J(h, c);
|
|
58
|
-
t(this, p) ? (h.x = T(x.x * 2, -1, 1), h.y = T(x.y * 2, -1, 1)) : (h.x = x.x, h.y = x.y);
|
|
59
|
-
}
|
|
60
|
-
t(this, a).set(h.x), t(this, l).set(h.y);
|
|
47
|
+
r(this, E, (s) => {
|
|
48
|
+
const e = k(this, L, D).call(this, s);
|
|
49
|
+
t(this, a).set(e.x), t(this, l).set(e.y);
|
|
61
50
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
let s = 0, e = 0,
|
|
65
|
-
t(this,
|
|
51
|
+
r(this, y, () => {
|
|
52
|
+
c(this, d, this.element.clientWidth), c(this, f, this.element.clientHeight);
|
|
53
|
+
let s = 0, e = 0, m = 0, h = 0;
|
|
54
|
+
t(this, u) ? t(this, p) ? (s = -1, e = 1, m = -1, h = 1) : (s = t(this, d) / 2 * -1, e = t(this, d) / 2 * 1, m = t(this, f) / 2 * -1, h = t(this, f) / 2 * 1) : t(this, p) ? (s = 0, e = 1, m = 0, h = 1) : (s = 0, e = t(this, d), m = 0, h = t(this, f)), t(this, a).min = s, t(this, a).max = e, t(this, l).min = m, t(this, l).max = h;
|
|
66
55
|
});
|
|
67
|
-
|
|
56
|
+
c(this, o, U(s.element)), c(this, a, new B(0, s.damped)), c(this, l, new B(0, s.damped)), c(this, b, new B(0, j({ min: 0, max: 1 }, s.damped))), c(this, u, s.cartesian || !1), c(this, p, s.normalize || !1);
|
|
68
57
|
}
|
|
69
58
|
get element() {
|
|
70
59
|
return t(this, o);
|
|
@@ -79,19 +68,19 @@ class O {
|
|
|
79
68
|
return t(this, b);
|
|
80
69
|
}
|
|
81
70
|
get cartesian() {
|
|
82
|
-
return t(this,
|
|
71
|
+
return t(this, u);
|
|
83
72
|
}
|
|
84
73
|
set cartesian(s) {
|
|
85
|
-
|
|
74
|
+
c(this, u, s), t(this, y).call(this);
|
|
86
75
|
}
|
|
87
76
|
get normalize() {
|
|
88
|
-
return t(this,
|
|
77
|
+
return t(this, p);
|
|
89
78
|
}
|
|
90
79
|
set normalize(s) {
|
|
91
|
-
|
|
80
|
+
c(this, p, s), t(this, y).call(this);
|
|
92
81
|
}
|
|
93
82
|
connect() {
|
|
94
|
-
t(this, o).addEventListener("pointerenter", t(this, S)), t(this, o).addEventListener("pointerleave", t(this, w)), t(this, o).addEventListener("pointermove", t(this, E)),
|
|
83
|
+
t(this, o).addEventListener("pointerenter", t(this, S)), t(this, o).addEventListener("pointerleave", t(this, w)), t(this, o).addEventListener("pointermove", t(this, E)), F.subscribe(t(this, o), t(this, y)), G.subscribe(t(this, y));
|
|
95
84
|
}
|
|
96
85
|
disconnect() {
|
|
97
86
|
t(this, o).removeEventListener(
|
|
@@ -100,53 +89,70 @@ class O {
|
|
|
100
89
|
), t(this, o).removeEventListener(
|
|
101
90
|
"pointerleave",
|
|
102
91
|
t(this, w)
|
|
103
|
-
), t(this, o).removeEventListener("pointermove", t(this, E)),
|
|
92
|
+
), t(this, o).removeEventListener("pointermove", t(this, E)), F.unsubscribe(t(this, y)), G.unsubscribe(t(this, y)), t(this, a).reset(), t(this, l).reset(), t(this, b).reset();
|
|
104
93
|
}
|
|
105
94
|
}
|
|
106
|
-
o = new WeakMap(), a = new WeakMap(), l = new WeakMap(), b = new WeakMap(),
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
o = new WeakMap(), a = new WeakMap(), l = new WeakMap(), b = new WeakMap(), u = new WeakMap(), p = new WeakMap(), d = new WeakMap(), f = new WeakMap(), H = new WeakMap(), S = new WeakMap(), w = new WeakMap(), E = new WeakMap(), y = new WeakMap(), L = new WeakSet(), D = function(s) {
|
|
96
|
+
const e = N(s, t(this, o).getBoundingClientRect()), m = {
|
|
97
|
+
width: t(this, d),
|
|
98
|
+
height: t(this, f)
|
|
99
|
+
}, h = {
|
|
100
|
+
x: e.x,
|
|
101
|
+
y: e.y
|
|
102
|
+
};
|
|
103
|
+
if (t(this, u)) {
|
|
104
|
+
const x = O(h, m);
|
|
105
|
+
h.x = x.x, h.y = x.y;
|
|
106
|
+
}
|
|
107
|
+
if (t(this, p)) {
|
|
108
|
+
const x = Q(h, m);
|
|
109
|
+
t(this, u) ? (h.x = A(x.x * 2, -1, 1), h.y = A(x.y * 2, -1, 1)) : (h.x = x.x, h.y = x.y);
|
|
110
|
+
}
|
|
111
|
+
return h;
|
|
112
|
+
};
|
|
113
|
+
var n, g, v, z, C, q;
|
|
114
|
+
class Y extends HTMLElement {
|
|
109
115
|
constructor() {
|
|
110
116
|
super();
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
r(this, n);
|
|
118
|
+
r(this, g, new P(this, "--damping", 20));
|
|
119
|
+
r(this, v, new P(this, "--mass", 0));
|
|
120
|
+
r(this, z, new P(this, "--stiffness", 0));
|
|
121
|
+
r(this, C, new P(this, "--cartesian", !1));
|
|
122
|
+
r(this, q, new P(this, "--normalize", !1));
|
|
123
|
+
c(this, n, new X({
|
|
118
124
|
element: this
|
|
119
125
|
})), t(this, g).subscribe((e) => {
|
|
120
|
-
t(this,
|
|
121
|
-
}), t(this, L).subscribe((e) => {
|
|
122
|
-
t(this, r).cartesian = e.current;
|
|
126
|
+
t(this, n).x.damping = e.current, t(this, n).y.damping = e.current, t(this, n).z.damping = e.current;
|
|
123
127
|
}), t(this, C).subscribe((e) => {
|
|
124
|
-
t(this,
|
|
128
|
+
t(this, n).cartesian = e.current;
|
|
129
|
+
}), t(this, q).subscribe((e) => {
|
|
130
|
+
t(this, n).normalize = e.current;
|
|
125
131
|
}), t(this, v).subscribe((e) => {
|
|
126
|
-
t(this,
|
|
132
|
+
t(this, n).x.mass = e.current, t(this, n).y.mass = e.current, t(this, n).z.mass = e.current;
|
|
127
133
|
}), t(this, z).subscribe((e) => {
|
|
128
|
-
t(this,
|
|
129
|
-
}), t(this,
|
|
134
|
+
t(this, n).x.stiffness = e.current, t(this, n).y.stiffness = e.current, t(this, n).z.stiffness = e.current;
|
|
135
|
+
}), t(this, n).x.subscribe((e) => {
|
|
130
136
|
this.style.setProperty("--x", e.current.toString());
|
|
131
|
-
}), t(this,
|
|
137
|
+
}), t(this, n).y.subscribe((e) => {
|
|
132
138
|
this.style.setProperty("--y", e.current.toString());
|
|
133
|
-
}), t(this,
|
|
139
|
+
}), t(this, n).z.subscribe((e) => {
|
|
134
140
|
this.style.setProperty("--z", e.current.toString());
|
|
135
141
|
});
|
|
136
142
|
}
|
|
137
143
|
get pointer() {
|
|
138
|
-
return t(this,
|
|
144
|
+
return t(this, n);
|
|
139
145
|
}
|
|
140
146
|
connectedCallback() {
|
|
141
|
-
t(this,
|
|
147
|
+
t(this, n).connect(), t(this, g).observe(), t(this, v).observe(), t(this, z).observe();
|
|
142
148
|
}
|
|
143
149
|
disconnectedCallback() {
|
|
144
|
-
t(this,
|
|
150
|
+
t(this, n).disconnect(), t(this, g).unobserve(), t(this, v).unobserve(), t(this, z).unobserve(), this.style.removeProperty("--x"), this.style.removeProperty("--y"), this.style.removeProperty("--z");
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
n = new WeakMap(), g = new WeakMap(), v = new WeakMap(), z = new WeakMap(), C = new WeakMap(), q = new WeakMap();
|
|
154
|
+
V && !customElements.get("e-pointer") && customElements.define("e-pointer", Y);
|
|
149
155
|
export {
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
X as Pointer,
|
|
157
|
+
Y as PointerElement
|
|
152
158
|
};
|