aptechka 0.4.21 → 0.4.22
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 +45 -41
- package/package.json +1 -1
package/lib/pointer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var i=(t,e,s)=>(E(t,e,"read from private field"),s?s.call(t):e.get(t)),p=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},m=(t,e,s,h)=>(E(t,e,"write to private field"),h?h.call(t,s):e.set(t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../Damped-B0G_t-pw.cjs"),L=require("../coordinates-D8Np3cPD.cjs"),k=require("../dom-JBOkFLTh.cjs"),q=require("../math-GDWEqu7y.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");require("../Store-BQGNOHlY.cjs");require("../ticker/index.cjs");const M=require("../custom-element/index.cjs"),v=require("../css-property/index.cjs");var a,u,d,l,_,w,x;class W{constructor(e){p(this,a,void 0);p(this,u,void 0);p(this,d,void 0);p(this,l,void 0);p(this,_,e=>{i(this,l).set(1)});p(this,w,e=>{i(this,l).set(0)});p(this,x,e=>{const s={x:e.offsetX,y:e.offsetY},h={width:this.element.offsetWidth,height:this.element.offsetHeight},o={x:s.x,y:s.y};if(this.cartesian){const c=L.screenToCartesian(o,h);o.x=c.x,o.y=c.y}if(this.normalize){const c=L.normalize(o,h);o.x=q.clamp(c.x*2,-1,1),o.y=q.clamp(c.y*2,-1,1)}i(this,u).set(o.x),i(this,d).set(o.y)});m(this,a,k.getElement(e.element)),m(this,u,new C.Damped(0,e.damped)),m(this,d,new C.Damped(0,e.damped)),m(this,l,new C.Damped(0,e.damped)),this.cartesian=e.cartesian||!1,this.normalize=e.normalize||!1}get element(){return i(this,a)}get x(){return i(this,u)}get y(){return i(this,d)}get z(){return i(this,l)}connect(){i(this,a).addEventListener("pointerenter",i(this,_)),i(this,a).addEventListener("pointerleave",i(this,w)),i(this,a).addEventListener("pointermove",i(this,x))}disconnect(){i(this,a).removeEventListener("pointerenter",i(this,_)),i(this,a).removeEventListener("pointerleave",i(this,w)),i(this,a).removeEventListener("pointermove",i(this,x)),i(this,u).reset(),i(this,d).reset(),i(this,l).reset()}}a=new WeakMap,u=new WeakMap,d=new WeakMap,l=new WeakMap,_=new WeakMap,w=new WeakMap,x=new WeakMap;var O=Object.defineProperty,T=Object.getOwnPropertyDescriptor,A=(t,e,s,h)=>{for(var o=h>1?void 0:h?T(e,s):e,c=t.length-1,b;c>=0;c--)(b=t[c])&&(o=(h?b(e,s,o):b(o))||o);return h&&o&&O(e,s,o),o},D=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(D(t,e,"read from private field"),s?s.call(t):e.get(t)),y=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},G=(t,e,s,h)=>(D(t,e,"write to private field"),h?h.call(t,s):e.set(t,s),s),n,f,P,S,g,z;exports.PointerElement=class extends M.CustomElement{constructor(){super(),y(this,n,void 0),y(this,f,new v.CSSProperty(this,"--damping",20)),y(this,P,new v.CSSProperty(this,"--mass",0)),y(this,S,new v.CSSProperty(this,"--stiffness",0)),y(this,g,new v.CSSProperty(this,"--cartesian",!1)),y(this,z,new v.CSSProperty(this,"--normalize",!1)),G(this,n,new W({element:this})),r(this,f).subscribe(e=>{r(this,n).x.damping=e.current,r(this,n).y.damping=e.current,r(this,n).z.damping=e.current}),r(this,g).subscribe(e=>{r(this,n).cartesian=e.current}),r(this,z).subscribe(e=>{r(this,n).normalize=e.current}),r(this,P).subscribe(e=>{r(this,n).x.mass=e.current,r(this,n).y.mass=e.current,r(this,n).z.mass=e.current}),r(this,S).subscribe(e=>{r(this,n).x.stiffness=e.current,r(this,n).y.stiffness=e.current,r(this,n).z.stiffness=e.current}),r(this,n).x.subscribe(e=>{this.style.setProperty("--x",e.current.toString())}),r(this,n).y.subscribe(e=>{this.style.setProperty("--y",e.current.toString())}),r(this,n).z.subscribe(e=>{this.style.setProperty("--z",e.current.toString())})}connectedCallback(){r(this,n).connect(),r(this,f).observe(),r(this,P).observe(),r(this,S).observe()}disconnectedCallback(){r(this,n).disconnect(),r(this,f).unobserve(),r(this,P).unobserve(),r(this,S).unobserve(),this.style.removeProperty("--x"),this.style.removeProperty("--y"),this.style.removeProperty("--z")}};n=new WeakMap;f=new WeakMap;P=new WeakMap;S=new WeakMap;g=new WeakMap;z=new WeakMap;exports.PointerElement=A([M.define("e-pointer")],exports.PointerElement);exports.Pointer=W;
|
package/lib/pointer/index.js
CHANGED
|
@@ -6,30 +6,34 @@ var r = (e, t, s) => (E(e, t, "read from private field"), s ? s.call(e) : t.get(
|
|
|
6
6
|
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
9
|
-
},
|
|
10
|
-
import { D as
|
|
11
|
-
import {
|
|
9
|
+
}, y = (e, t, s, h) => (E(e, t, "write to private field"), h ? h.call(e, s) : t.set(e, s), s);
|
|
10
|
+
import { D as g } from "../Damped-DpaKIZqv.js";
|
|
11
|
+
import { s as k, n as D } from "../coordinates-CgdGoSYs.js";
|
|
12
12
|
import { g as O } from "../dom-0S_WDL4g.js";
|
|
13
|
+
import { c as L } from "../math-BOBiC4TN.js";
|
|
13
14
|
import "../path-data-polyfill-DgeDWYeI.js";
|
|
14
15
|
import "../Store-Cd-E5W1z.js";
|
|
15
16
|
import "../ticker/index.js";
|
|
16
17
|
import { CustomElement as T, define as A } from "../custom-element/index.js";
|
|
17
|
-
import { CSSProperty as
|
|
18
|
-
var a,
|
|
18
|
+
import { CSSProperty as d } from "../css-property/index.js";
|
|
19
|
+
var a, l, f, m, x, P, S;
|
|
19
20
|
class G {
|
|
20
21
|
constructor(t) {
|
|
21
22
|
p(this, a, void 0);
|
|
22
|
-
p(this, m, void 0);
|
|
23
|
-
p(this, v, void 0);
|
|
24
23
|
p(this, l, void 0);
|
|
25
|
-
p(this,
|
|
26
|
-
|
|
24
|
+
p(this, f, void 0);
|
|
25
|
+
p(this, m, void 0);
|
|
26
|
+
p(this, x, (t) => {
|
|
27
|
+
r(this, m).set(1);
|
|
27
28
|
});
|
|
28
|
-
p(this,
|
|
29
|
-
r(this,
|
|
29
|
+
p(this, P, (t) => {
|
|
30
|
+
r(this, m).set(0);
|
|
30
31
|
});
|
|
31
|
-
p(this,
|
|
32
|
-
const s =
|
|
32
|
+
p(this, S, (t) => {
|
|
33
|
+
const s = {
|
|
34
|
+
x: t.offsetX,
|
|
35
|
+
y: t.offsetY
|
|
36
|
+
}, h = {
|
|
33
37
|
width: this.element.offsetWidth,
|
|
34
38
|
height: this.element.offsetHeight
|
|
35
39
|
}, o = {
|
|
@@ -42,55 +46,55 @@ class G {
|
|
|
42
46
|
}
|
|
43
47
|
if (this.normalize) {
|
|
44
48
|
const c = D(o, h);
|
|
45
|
-
o.x = c.x * 2, o.y = c.y * 2;
|
|
49
|
+
o.x = L(c.x * 2, -1, 1), o.y = L(c.y * 2, -1, 1);
|
|
46
50
|
}
|
|
47
|
-
r(this,
|
|
51
|
+
r(this, l).set(o.x), r(this, f).set(o.y);
|
|
48
52
|
});
|
|
49
|
-
|
|
53
|
+
y(this, a, O(t.element)), y(this, l, new g(0, t.damped)), y(this, f, new g(0, t.damped)), y(this, m, new g(0, t.damped)), this.cartesian = t.cartesian || !1, this.normalize = t.normalize || !1;
|
|
50
54
|
}
|
|
51
55
|
get element() {
|
|
52
56
|
return r(this, a);
|
|
53
57
|
}
|
|
54
58
|
get x() {
|
|
55
|
-
return r(this,
|
|
59
|
+
return r(this, l);
|
|
56
60
|
}
|
|
57
61
|
get y() {
|
|
58
|
-
return r(this,
|
|
62
|
+
return r(this, f);
|
|
59
63
|
}
|
|
60
64
|
get z() {
|
|
61
|
-
return r(this,
|
|
65
|
+
return r(this, m);
|
|
62
66
|
}
|
|
63
67
|
connect() {
|
|
64
|
-
r(this, a).addEventListener("pointerenter", r(this,
|
|
68
|
+
r(this, a).addEventListener("pointerenter", r(this, x)), r(this, a).addEventListener("pointerleave", r(this, P)), r(this, a).addEventListener("pointermove", r(this, S));
|
|
65
69
|
}
|
|
66
70
|
disconnect() {
|
|
67
71
|
r(this, a).removeEventListener(
|
|
68
72
|
"pointerenter",
|
|
69
|
-
r(this,
|
|
73
|
+
r(this, x)
|
|
70
74
|
), r(this, a).removeEventListener(
|
|
71
75
|
"pointerleave",
|
|
72
|
-
r(this,
|
|
73
|
-
), r(this, a).removeEventListener("pointermove", r(this,
|
|
76
|
+
r(this, P)
|
|
77
|
+
), r(this, a).removeEventListener("pointermove", r(this, S)), r(this, l).reset(), r(this, f).reset(), r(this, m).reset();
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
|
-
a = new WeakMap(),
|
|
77
|
-
var H = Object.defineProperty,
|
|
78
|
-
for (var o = h > 1 ? void 0 : h ?
|
|
79
|
-
(
|
|
80
|
+
a = new WeakMap(), l = new WeakMap(), f = new WeakMap(), m = new WeakMap(), x = new WeakMap(), P = new WeakMap(), S = new WeakMap();
|
|
81
|
+
var H = Object.defineProperty, X = Object.getOwnPropertyDescriptor, Y = (e, t, s, h) => {
|
|
82
|
+
for (var o = h > 1 ? void 0 : h ? X(t, s) : t, c = e.length - 1, b; c >= 0; c--)
|
|
83
|
+
(b = e[c]) && (o = (h ? b(t, s, o) : b(o)) || o);
|
|
80
84
|
return h && o && H(t, s, o), o;
|
|
81
|
-
},
|
|
85
|
+
}, M = (e, t, s) => {
|
|
82
86
|
if (!t.has(e))
|
|
83
87
|
throw TypeError("Cannot " + s);
|
|
84
|
-
}, i = (e, t, s) => (
|
|
88
|
+
}, i = (e, t, s) => (M(e, t, "read from private field"), s ? s.call(e) : t.get(e)), v = (e, t, s) => {
|
|
85
89
|
if (t.has(e))
|
|
86
90
|
throw TypeError("Cannot add the same private member more than once");
|
|
87
91
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
88
|
-
},
|
|
89
|
-
let
|
|
92
|
+
}, q = (e, t, s, h) => (M(e, t, "write to private field"), h ? h.call(e, s) : t.set(e, s), s), n, u, w, _, z, C;
|
|
93
|
+
let W = class extends T {
|
|
90
94
|
constructor() {
|
|
91
|
-
super(),
|
|
95
|
+
super(), v(this, n, void 0), v(this, u, new d(this, "--damping", 20)), v(this, w, new d(this, "--mass", 0)), v(this, _, new d(this, "--stiffness", 0)), v(this, z, new d(this, "--cartesian", !1)), v(this, C, new d(this, "--normalize", !1)), q(this, n, new G({
|
|
92
96
|
element: this
|
|
93
|
-
})), i(this,
|
|
97
|
+
})), i(this, u).subscribe((e) => {
|
|
94
98
|
i(this, n).x.damping = e.current, i(this, n).y.damping = e.current, i(this, n).z.damping = e.current;
|
|
95
99
|
}), i(this, z).subscribe((e) => {
|
|
96
100
|
i(this, n).cartesian = e.current;
|
|
@@ -98,7 +102,7 @@ let L = class extends T {
|
|
|
98
102
|
i(this, n).normalize = e.current;
|
|
99
103
|
}), i(this, w).subscribe((e) => {
|
|
100
104
|
i(this, n).x.mass = e.current, i(this, n).y.mass = e.current, i(this, n).z.mass = e.current;
|
|
101
|
-
}), i(this,
|
|
105
|
+
}), i(this, _).subscribe((e) => {
|
|
102
106
|
i(this, n).x.stiffness = e.current, i(this, n).y.stiffness = e.current, i(this, n).z.stiffness = e.current;
|
|
103
107
|
}), i(this, n).x.subscribe((e) => {
|
|
104
108
|
this.style.setProperty("--x", e.current.toString());
|
|
@@ -109,22 +113,22 @@ let L = class extends T {
|
|
|
109
113
|
});
|
|
110
114
|
}
|
|
111
115
|
connectedCallback() {
|
|
112
|
-
i(this, n).connect(), i(this,
|
|
116
|
+
i(this, n).connect(), i(this, u).observe(), i(this, w).observe(), i(this, _).observe();
|
|
113
117
|
}
|
|
114
118
|
disconnectedCallback() {
|
|
115
|
-
i(this, n).disconnect(), i(this,
|
|
119
|
+
i(this, n).disconnect(), i(this, u).unobserve(), i(this, w).unobserve(), i(this, _).unobserve(), this.style.removeProperty("--x"), this.style.removeProperty("--y"), this.style.removeProperty("--z");
|
|
116
120
|
}
|
|
117
121
|
};
|
|
118
122
|
n = /* @__PURE__ */ new WeakMap();
|
|
119
|
-
|
|
123
|
+
u = /* @__PURE__ */ new WeakMap();
|
|
120
124
|
w = /* @__PURE__ */ new WeakMap();
|
|
121
|
-
|
|
125
|
+
_ = /* @__PURE__ */ new WeakMap();
|
|
122
126
|
z = /* @__PURE__ */ new WeakMap();
|
|
123
127
|
C = /* @__PURE__ */ new WeakMap();
|
|
124
|
-
|
|
128
|
+
W = Y([
|
|
125
129
|
A("e-pointer")
|
|
126
|
-
],
|
|
130
|
+
], W);
|
|
127
131
|
export {
|
|
128
132
|
G as Pointer,
|
|
129
|
-
|
|
133
|
+
W as PointerElement
|
|
130
134
|
};
|