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