aptechka 0.4.31 → 0.4.33
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/Damped-BJgyFENo.js +258 -0
- package/lib/Damped-CbWlWAbx.cjs +1 -0
- package/lib/animation/Animation.d.ts +42 -7
- package/lib/animation/AnimationLink.d.ts +13 -0
- package/lib/animation/Damped.d.ts +23 -28
- package/lib/animation/Tweened.d.ts +7 -19
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.d.ts +2 -1
- package/lib/animation/index.js +43 -61
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.d.ts +1 -1
- package/lib/canvas/index.js +35 -35
- package/lib/class-linked-status/index.cjs +1 -1
- package/lib/class-linked-status/index.d.ts +3 -1
- package/lib/class-linked-status/index.js +36 -37
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +64 -64
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.d.ts +5 -1
- package/lib/css-property/index.js +35 -31
- package/lib/en3/index.cjs +7 -7
- package/lib/en3/index.d.ts +0 -1
- package/lib/en3/index.js +268 -281
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.js +8 -8
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.d.ts +12 -6
- package/lib/ladder/index.js +119 -114
- package/lib/order/index.cjs +1 -1
- package/lib/order/index.d.ts +4 -3
- package/lib/order/index.js +1 -1
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +2 -2
- package/lib/scroll/ScrollElement.d.ts +1 -3
- package/lib/scroll/ScrollSegmentElement.d.ts +6 -11
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.d.ts +1 -1
- package/lib/scroll/index.js +498 -501
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.d.ts +4 -2
- package/lib/sequence/index.js +129 -114
- package/lib/source/SourceElement.d.ts +14 -7
- package/lib/source/index.cjs +2 -2
- package/lib/source/index.d.ts +2 -2
- package/lib/source/index.js +66 -56
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.d.ts +15 -0
- package/lib/theme/index.js +9 -6
- package/lib/ticker/index.cjs +1 -1
- package/lib/ticker/index.d.ts +3 -2
- package/lib/ticker/index.js +81 -71
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +10 -10
- package/package.json +1 -1
- package/lib/Damped-B0G_t-pw.cjs +0 -1
- package/lib/Damped-DpaKIZqv.js +0 -150
- package/lib/en3/instances/en3LazyLoader.d.ts +0 -8
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
var Z = Object.defineProperty, $ = Object.defineProperties;
|
|
2
|
+
var tt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var H = Object.getOwnPropertySymbols;
|
|
4
|
+
var st = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var J = (r, i, t) => i in r ? Z(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t, E = (r, i) => {
|
|
6
|
+
for (var t in i || (i = {}))
|
|
7
|
+
st.call(i, t) && J(r, t, i[t]);
|
|
8
|
+
if (H)
|
|
9
|
+
for (var t of H(i))
|
|
10
|
+
it.call(i, t) && J(r, t, i[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, N = (r, i) => $(r, tt(i));
|
|
13
|
+
var j = (r, i, t) => {
|
|
14
|
+
if (!i.has(r))
|
|
15
|
+
throw TypeError("Cannot " + t);
|
|
16
|
+
};
|
|
17
|
+
var s = (r, i, t) => (j(r, i, "read from private field"), t ? t.call(r) : i.get(r)), e = (r, i, t) => {
|
|
18
|
+
if (i.has(r))
|
|
19
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
20
|
+
i instanceof WeakSet ? i.add(r) : i.set(r, t);
|
|
21
|
+
}, h = (r, i, t, n) => (j(r, i, "write to private field"), n ? n.call(r, t) : i.set(r, t), t);
|
|
22
|
+
var O = (r, i, t) => (j(r, i, "access private method"), t);
|
|
23
|
+
import { c as et, d as rt } from "./math-BOBiC4TN.js";
|
|
24
|
+
import { p as v } from "./number-Bo5RdrA1.js";
|
|
25
|
+
import { n as g } from "./polyfills-DJUYczFm.js";
|
|
26
|
+
import "./path-data-polyfill-DgeDWYeI.js";
|
|
27
|
+
import { S as C } from "./Store-Cd-E5W1z.js";
|
|
28
|
+
import { ticker as Q } from "./ticker/index.js";
|
|
29
|
+
import { TICK_ORDER as ht } from "./order/index.js";
|
|
30
|
+
var u, d, b, o, k, D, M, P, V, U, K, W, I, G, _, X, L;
|
|
31
|
+
class nt {
|
|
32
|
+
constructor(i, t, n, z, F) {
|
|
33
|
+
e(this, V);
|
|
34
|
+
e(this, K);
|
|
35
|
+
e(this, I);
|
|
36
|
+
e(this, _);
|
|
37
|
+
e(this, u, void 0);
|
|
38
|
+
e(this, d, void 0);
|
|
39
|
+
e(this, b, void 0);
|
|
40
|
+
e(this, o, void 0);
|
|
41
|
+
e(this, k, !1);
|
|
42
|
+
e(this, D, !1);
|
|
43
|
+
e(this, M, !1);
|
|
44
|
+
e(this, P, void 0);
|
|
45
|
+
e(this, L, (i) => {
|
|
46
|
+
!s(this, M) && s(this, u).initial !== s(this, u).current && h(this, M, !0), s(this, M) && (i.direction > 0 && i.progress >= s(this, b).current ? O(this, V, U).call(this) : i.direction < 0 && i.progress <= s(this, b).current && O(this, K, W).call(this));
|
|
47
|
+
});
|
|
48
|
+
h(this, u, i), h(this, d, t), h(this, b, new C(n, {
|
|
49
|
+
passport: t.passport ? {
|
|
50
|
+
name: t.passport + "-start",
|
|
51
|
+
manager: {
|
|
52
|
+
type: "number"
|
|
53
|
+
}
|
|
54
|
+
} : void 0
|
|
55
|
+
})), h(this, o, new C(z, {
|
|
56
|
+
passport: t.passport ? {
|
|
57
|
+
name: t.passport + "-set",
|
|
58
|
+
manager: {
|
|
59
|
+
type: "number"
|
|
60
|
+
}
|
|
61
|
+
} : void 0
|
|
62
|
+
})), h(this, P, F), s(this, u).subscribe(s(this, L)), s(this, u).linked.add(this);
|
|
63
|
+
}
|
|
64
|
+
get targetAnimation() {
|
|
65
|
+
return s(this, d);
|
|
66
|
+
}
|
|
67
|
+
get triggerAnimation() {
|
|
68
|
+
return s(this, u);
|
|
69
|
+
}
|
|
70
|
+
destroy() {
|
|
71
|
+
s(this, o).close(), s(this, b).close(), s(this, u).unsubscribe(s(this, L)), s(this, u).linked.delete(this);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
u = new WeakMap(), d = new WeakMap(), b = new WeakMap(), o = new WeakMap(), k = new WeakMap(), D = new WeakMap(), M = new WeakMap(), P = new WeakMap(), V = new WeakSet(), U = function() {
|
|
75
|
+
s(this, k) || (h(this, D, !1), h(this, k, !0), O(this, I, G).call(this, s(this, o).current));
|
|
76
|
+
}, K = new WeakSet(), W = function() {
|
|
77
|
+
s(this, k) && !s(this, D) && (h(this, k, !1), h(this, D, !0), O(this, I, G).call(this, s(this, d).initial));
|
|
78
|
+
}, I = new WeakSet(), G = function(i) {
|
|
79
|
+
O(this, _, X).call(this), s(this, d).updateOptions(s(this, P)), s(this, d).set(i);
|
|
80
|
+
}, _ = new WeakSet(), X = function() {
|
|
81
|
+
var i;
|
|
82
|
+
(i = s(this, P)) != null && i.once && this.destroy();
|
|
83
|
+
}, L = new WeakMap();
|
|
84
|
+
var S, T, q, f, y, p, R, a, c, m, A, x, B;
|
|
85
|
+
class at extends C {
|
|
86
|
+
constructor(t, n) {
|
|
87
|
+
super(t || 0, n);
|
|
88
|
+
e(this, S, void 0);
|
|
89
|
+
e(this, T, ht.ANIMATION);
|
|
90
|
+
e(this, q, void 0);
|
|
91
|
+
e(this, f, new C(!1));
|
|
92
|
+
e(this, y, /* @__PURE__ */ new Set());
|
|
93
|
+
e(this, p, null);
|
|
94
|
+
e(this, R, 0);
|
|
95
|
+
e(this, a, 0);
|
|
96
|
+
e(this, c, -1 / 0);
|
|
97
|
+
e(this, m, 1 / 0);
|
|
98
|
+
e(this, A, 0);
|
|
99
|
+
e(this, x, 1);
|
|
100
|
+
e(this, B, (t) => {
|
|
101
|
+
this.handleAnimationFrame(t);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
get linked() {
|
|
105
|
+
return s(this, y);
|
|
106
|
+
}
|
|
107
|
+
get animationLink() {
|
|
108
|
+
return s(this, p);
|
|
109
|
+
}
|
|
110
|
+
get direction() {
|
|
111
|
+
return s(this, R);
|
|
112
|
+
}
|
|
113
|
+
get target() {
|
|
114
|
+
return s(this, a);
|
|
115
|
+
}
|
|
116
|
+
get min() {
|
|
117
|
+
return s(this, c);
|
|
118
|
+
}
|
|
119
|
+
set min(t) {
|
|
120
|
+
h(this, c, t), this.set(s(this, a), {
|
|
121
|
+
equalize: !0
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
get max() {
|
|
125
|
+
return s(this, m);
|
|
126
|
+
}
|
|
127
|
+
set max(t) {
|
|
128
|
+
h(this, m, t), this.set(s(this, a), {
|
|
129
|
+
equalize: !0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
get from() {
|
|
133
|
+
return s(this, A);
|
|
134
|
+
}
|
|
135
|
+
get to() {
|
|
136
|
+
return s(this, x);
|
|
137
|
+
}
|
|
138
|
+
get isRunning() {
|
|
139
|
+
return s(this, f);
|
|
140
|
+
}
|
|
141
|
+
get currentDistance() {
|
|
142
|
+
return Math.abs(s(this, x) - s(this, A));
|
|
143
|
+
}
|
|
144
|
+
get distance() {
|
|
145
|
+
return Math.abs(s(this, m) - s(this, c));
|
|
146
|
+
}
|
|
147
|
+
get currentProgress() {
|
|
148
|
+
return this.currentDistance ? v(
|
|
149
|
+
Math.abs(this.current - s(this, A)) / this.currentDistance,
|
|
150
|
+
6
|
|
151
|
+
) : 0;
|
|
152
|
+
}
|
|
153
|
+
get progress() {
|
|
154
|
+
return this.distance ? v(Math.abs(this.current - s(this, c)) / this.distance, 6) : 0;
|
|
155
|
+
}
|
|
156
|
+
get entry() {
|
|
157
|
+
return N(E({}, super.entry), {
|
|
158
|
+
from: s(this, A),
|
|
159
|
+
to: s(this, x),
|
|
160
|
+
currentDistance: this.currentDistance,
|
|
161
|
+
distance: this.distance,
|
|
162
|
+
direction: this.direction,
|
|
163
|
+
currentProgress: this.currentProgress,
|
|
164
|
+
progress: this.progress
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
setTarget(t) {
|
|
168
|
+
h(this, R, Math.sign(t - s(this, a))), h(this, a, et(t, s(this, c), s(this, m))), h(this, A, this.current), h(this, x, t);
|
|
169
|
+
}
|
|
170
|
+
set(t, n) {
|
|
171
|
+
s(this, a) !== t && (this.setTarget(t), n && this.updateOptions(n), s(this, a) !== this.current && this.start());
|
|
172
|
+
}
|
|
173
|
+
shift(t, n) {
|
|
174
|
+
this.set(s(this, a) + t, n);
|
|
175
|
+
}
|
|
176
|
+
reset() {
|
|
177
|
+
this.set(this.initial, { equalize: !0 }), super.reset(), s(this, y).forEach((t) => {
|
|
178
|
+
t.targetAnimation.reset();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
close() {
|
|
182
|
+
super.close(), this.unlistenAnimationFrame(), this.unlink(), s(this, y).clear();
|
|
183
|
+
}
|
|
184
|
+
listenAnimationFrame() {
|
|
185
|
+
s(this, f).current || (s(this, f).current = !0, Q.subscribe(s(this, B), {
|
|
186
|
+
maxFPS: s(this, S),
|
|
187
|
+
order: s(this, T),
|
|
188
|
+
culling: s(this, q)
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
unlistenAnimationFrame() {
|
|
192
|
+
s(this, f).current && (s(this, f).current = !1, Q.unsubscribe(s(this, B)), s(this, y).forEach((t) => {
|
|
193
|
+
t.targetAnimation.unlistenAnimationFrame();
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
updateOptions(t) {
|
|
197
|
+
h(this, S, g(t == null ? void 0 : t.maxFPS, s(this, S))), h(this, T, g(t == null ? void 0 : t.order, s(this, T))), h(this, q, g(t == null ? void 0 : t.culling, s(this, q))), h(this, c, g(t == null ? void 0 : t.min, s(this, c))), h(this, m, g(t == null ? void 0 : t.max, s(this, m))), t != null && t.equalize && (this.unlistenAnimationFrame(), this.current = s(this, a));
|
|
198
|
+
}
|
|
199
|
+
linkTo(t, n, z, F) {
|
|
200
|
+
this.unlink(), h(this, p, new nt(
|
|
201
|
+
t,
|
|
202
|
+
this,
|
|
203
|
+
n,
|
|
204
|
+
z,
|
|
205
|
+
F
|
|
206
|
+
));
|
|
207
|
+
}
|
|
208
|
+
unlink() {
|
|
209
|
+
s(this, p) && (s(this, p).destroy(), h(this, p, null));
|
|
210
|
+
}
|
|
211
|
+
start() {
|
|
212
|
+
this.listenAnimationFrame();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
S = new WeakMap(), T = new WeakMap(), q = new WeakMap(), f = new WeakMap(), y = new WeakMap(), p = new WeakMap(), R = new WeakMap(), a = new WeakMap(), c = new WeakMap(), m = new WeakMap(), A = new WeakMap(), x = new WeakMap(), B = new WeakMap();
|
|
216
|
+
var l, w;
|
|
217
|
+
class At extends at {
|
|
218
|
+
constructor(t, n) {
|
|
219
|
+
super(t, n);
|
|
220
|
+
e(this, l, void 0);
|
|
221
|
+
e(this, w, void 0);
|
|
222
|
+
this.damping = 20, this.stiffness = 0, this.mass = 0, h(this, l, 0), h(this, w, 0), this.updateOptions(N(E({}, n), { equalize: !0 }));
|
|
223
|
+
}
|
|
224
|
+
get velocity() {
|
|
225
|
+
return s(this, l);
|
|
226
|
+
}
|
|
227
|
+
get speed() {
|
|
228
|
+
return s(this, w);
|
|
229
|
+
}
|
|
230
|
+
get entry() {
|
|
231
|
+
return N(E({}, super.entry), {
|
|
232
|
+
velocity: s(this, l),
|
|
233
|
+
speed: s(this, w)
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
updateOptions(t) {
|
|
237
|
+
this.damping = g(t == null ? void 0 : t.damping, this.damping), this.mass = g(t == null ? void 0 : t.mass, this.mass), this.stiffness = g(t == null ? void 0 : t.stiffness, this.stiffness), super.updateOptions(t);
|
|
238
|
+
}
|
|
239
|
+
updateManually(t) {
|
|
240
|
+
this.setTarget(t), this.current = this.target;
|
|
241
|
+
}
|
|
242
|
+
handleAnimationFrame(t) {
|
|
243
|
+
v(this.current, 4) === v(this.target, 4) && (this.unlistenAnimationFrame(), this.current = this.target);
|
|
244
|
+
const n = this.current, z = Math.abs(n - this.target);
|
|
245
|
+
h(this, w, z / t.timeBetweenFrames);
|
|
246
|
+
const F = t.timeBetweenFrames / 1e3;
|
|
247
|
+
if (this.mass || this.stiffness) {
|
|
248
|
+
const Y = (this.target - this.current) * this.stiffness - s(this, l) * this.damping;
|
|
249
|
+
h(this, l, s(this, l) + Y / this.mass * F), this.current += s(this, l) * F;
|
|
250
|
+
} else
|
|
251
|
+
this.current = rt(this.current, this.target, this.damping, F);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
l = new WeakMap(), w = new WeakMap();
|
|
255
|
+
export {
|
|
256
|
+
at as A,
|
|
257
|
+
At as D
|
|
258
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var tt=Object.defineProperty,st=Object.defineProperties;var it=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var et=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var J=(r,i,t)=>i in r?tt(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t,R=(r,i)=>{for(var t in i||(i={}))et.call(i,t)&&J(r,t,i[t]);if(H)for(var t of H(i))rt.call(i,t)&&J(r,t,i[t]);return r},B=(r,i)=>st(r,it(i));var j=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var s=(r,i,t)=>(j(r,i,"read from private field"),t?t.call(r):i.get(r)),e=(r,i,t)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,t)},h=(r,i,t,n)=>(j(r,i,"write to private field"),n?n.call(r,t):i.set(r,t),t);var x=(r,i,t)=>(j(r,i,"access private method"),t);const U=require("./math-GDWEqu7y.cjs"),E=require("./number-yVpzMdbQ.cjs"),g=require("./polyfills-CrcS4RcO.cjs");require("./path-data-polyfill-CXsOR7Oc.cjs");const _=require("./Store-BQGNOHlY.cjs"),Q=require("./ticker/index.cjs"),ht=require("./order/index.cjs");var u,d,F,w,y,C,O,S,v,W,V,X,T,G,K,Y,z;class nt{constructor(i,t,n,P,A){e(this,v);e(this,V);e(this,T);e(this,K);e(this,u,void 0);e(this,d,void 0);e(this,F,void 0);e(this,w,void 0);e(this,y,!1);e(this,C,!1);e(this,O,!1);e(this,S,void 0);e(this,z,i=>{!s(this,O)&&s(this,u).initial!==s(this,u).current&&h(this,O,!0),s(this,O)&&(i.direction>0&&i.progress>=s(this,F).current?x(this,v,W).call(this):i.direction<0&&i.progress<=s(this,F).current&&x(this,V,X).call(this))});h(this,u,i),h(this,d,t),h(this,F,new _.Store(n,{passport:t.passport?{name:t.passport+"-start",manager:{type:"number"}}:void 0})),h(this,w,new _.Store(P,{passport:t.passport?{name:t.passport+"-set",manager:{type:"number"}}:void 0})),h(this,S,A),s(this,u).subscribe(s(this,z)),s(this,u).linked.add(this)}get targetAnimation(){return s(this,d)}get triggerAnimation(){return s(this,u)}destroy(){s(this,w).close(),s(this,F).close(),s(this,u).unsubscribe(s(this,z)),s(this,u).linked.delete(this)}}u=new WeakMap,d=new WeakMap,F=new WeakMap,w=new WeakMap,y=new WeakMap,C=new WeakMap,O=new WeakMap,S=new WeakMap,v=new WeakSet,W=function(){s(this,y)||(h(this,C,!1),h(this,y,!0),x(this,T,G).call(this,s(this,w).current))},V=new WeakSet,X=function(){s(this,y)&&!s(this,C)&&(h(this,y,!1),h(this,C,!0),x(this,T,G).call(this,s(this,d).initial))},T=new WeakSet,G=function(i){x(this,K,Y).call(this),s(this,d).updateOptions(s(this,S)),s(this,d).set(i)},K=new WeakSet,Y=function(){var i;(i=s(this,S))!=null&&i.once&&this.destroy()},z=new WeakMap;var D,M,N,f,o,b,I,a,c,l,k,p,L;class Z extends _.Store{constructor(t,n){super(t||0,n);e(this,D,void 0);e(this,M,ht.TICK_ORDER.ANIMATION);e(this,N,void 0);e(this,f,new _.Store(!1));e(this,o,new Set);e(this,b,null);e(this,I,0);e(this,a,0);e(this,c,-1/0);e(this,l,1/0);e(this,k,0);e(this,p,1);e(this,L,t=>{this.handleAnimationFrame(t)})}get linked(){return s(this,o)}get animationLink(){return s(this,b)}get direction(){return s(this,I)}get target(){return s(this,a)}get min(){return s(this,c)}set min(t){h(this,c,t),this.set(s(this,a),{equalize:!0})}get max(){return s(this,l)}set max(t){h(this,l,t),this.set(s(this,a),{equalize:!0})}get from(){return s(this,k)}get to(){return s(this,p)}get isRunning(){return s(this,f)}get currentDistance(){return Math.abs(s(this,p)-s(this,k))}get distance(){return Math.abs(s(this,l)-s(this,c))}get currentProgress(){return this.currentDistance?E.preciseNumber(Math.abs(this.current-s(this,k))/this.currentDistance,6):0}get progress(){return this.distance?E.preciseNumber(Math.abs(this.current-s(this,c))/this.distance,6):0}get entry(){return B(R({},super.entry),{from:s(this,k),to:s(this,p),currentDistance:this.currentDistance,distance:this.distance,direction:this.direction,currentProgress:this.currentProgress,progress:this.progress})}setTarget(t){h(this,I,Math.sign(t-s(this,a))),h(this,a,U.clamp(t,s(this,c),s(this,l))),h(this,k,this.current),h(this,p,t)}set(t,n){s(this,a)!==t&&(this.setTarget(t),n&&this.updateOptions(n),s(this,a)!==this.current&&this.start())}shift(t,n){this.set(s(this,a)+t,n)}reset(){this.set(this.initial,{equalize:!0}),super.reset(),s(this,o).forEach(t=>{t.targetAnimation.reset()})}close(){super.close(),this.unlistenAnimationFrame(),this.unlink(),s(this,o).clear()}listenAnimationFrame(){s(this,f).current||(s(this,f).current=!0,Q.ticker.subscribe(s(this,L),{maxFPS:s(this,D),order:s(this,M),culling:s(this,N)}))}unlistenAnimationFrame(){s(this,f).current&&(s(this,f).current=!1,Q.ticker.unsubscribe(s(this,L)),s(this,o).forEach(t=>{t.targetAnimation.unlistenAnimationFrame()}))}updateOptions(t){h(this,D,g.nullishCoalescing(t==null?void 0:t.maxFPS,s(this,D))),h(this,M,g.nullishCoalescing(t==null?void 0:t.order,s(this,M))),h(this,N,g.nullishCoalescing(t==null?void 0:t.culling,s(this,N))),h(this,c,g.nullishCoalescing(t==null?void 0:t.min,s(this,c))),h(this,l,g.nullishCoalescing(t==null?void 0:t.max,s(this,l))),t!=null&&t.equalize&&(this.unlistenAnimationFrame(),this.current=s(this,a))}linkTo(t,n,P,A){this.unlink(),h(this,b,new nt(t,this,n,P,A))}unlink(){s(this,b)&&(s(this,b).destroy(),h(this,b,null))}start(){this.listenAnimationFrame()}}D=new WeakMap,M=new WeakMap,N=new WeakMap,f=new WeakMap,o=new WeakMap,b=new WeakMap,I=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,k=new WeakMap,p=new WeakMap,L=new WeakMap;var m,q;class at extends Z{constructor(t,n){super(t,n);e(this,m,void 0);e(this,q,void 0);this.damping=20,this.stiffness=0,this.mass=0,h(this,m,0),h(this,q,0),this.updateOptions(B(R({},n),{equalize:!0}))}get velocity(){return s(this,m)}get speed(){return s(this,q)}get entry(){return B(R({},super.entry),{velocity:s(this,m),speed:s(this,q)})}updateOptions(t){this.damping=g.nullishCoalescing(t==null?void 0:t.damping,this.damping),this.mass=g.nullishCoalescing(t==null?void 0:t.mass,this.mass),this.stiffness=g.nullishCoalescing(t==null?void 0:t.stiffness,this.stiffness),super.updateOptions(t)}updateManually(t){this.setTarget(t),this.current=this.target}handleAnimationFrame(t){E.preciseNumber(this.current,4)===E.preciseNumber(this.target,4)&&(this.unlistenAnimationFrame(),this.current=this.target);const n=this.current,P=Math.abs(n-this.target);h(this,q,P/t.timeBetweenFrames);const A=t.timeBetweenFrames/1e3;if(this.mass||this.stiffness){const $=(this.target-this.current)*this.stiffness-s(this,m)*this.damping;h(this,m,s(this,m)+$/this.mass*A),this.current+=s(this,m)*A}else this.current=U.damp(this.current,this.target,this.damping,A)}}m=new WeakMap,q=new WeakMap;exports.Animation=Z;exports.Damped=at;
|
|
@@ -1,23 +1,58 @@
|
|
|
1
|
+
import { AnimationLink, AnimationLinkOptions } from './AnimationLink';
|
|
1
2
|
import { TickerAddOptions, TickerCallbackEntry } from '../ticker';
|
|
2
3
|
import { Store, StoreEntry, StoreOptions } from '../store';
|
|
3
4
|
|
|
4
5
|
export interface AnimationEntry extends StoreEntry<number> {
|
|
5
|
-
|
|
6
|
+
currentDistance: number;
|
|
7
|
+
distance: number;
|
|
8
|
+
currentProgress: number;
|
|
6
9
|
progress: number;
|
|
7
10
|
direction: number;
|
|
8
11
|
}
|
|
9
|
-
export interface AnimationOptions extends TickerAddOptions
|
|
12
|
+
export interface AnimationOptions extends TickerAddOptions {
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
equalize?: boolean;
|
|
10
16
|
}
|
|
11
|
-
export
|
|
17
|
+
export type AnimationConstructorOptions<Options extends AnimationOptions> = StoreOptions<number, 'number'> & Options;
|
|
18
|
+
export declare abstract class Animation<Entry extends AnimationEntry = AnimationEntry> extends Store<number, 'number', Entry> {
|
|
12
19
|
#private;
|
|
13
|
-
constructor(initial?: number);
|
|
20
|
+
constructor(initial?: number, options?: StoreOptions<number, 'number'>);
|
|
21
|
+
get linked(): Set<AnimationLink<AnimationLinkOptions>>;
|
|
22
|
+
get animationLink(): AnimationLink<AnimationLinkOptions> | null;
|
|
23
|
+
get direction(): number;
|
|
24
|
+
get target(): number;
|
|
25
|
+
get min(): number;
|
|
26
|
+
set min(value: number);
|
|
27
|
+
get max(): number;
|
|
28
|
+
set max(value: number);
|
|
29
|
+
get from(): number;
|
|
30
|
+
get to(): number;
|
|
14
31
|
get isRunning(): Store<boolean, keyof import('../store').StoreManagers, StoreEntry<boolean>>;
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
get currentDistance(): number;
|
|
33
|
+
get distance(): number;
|
|
34
|
+
get currentProgress(): number;
|
|
35
|
+
get progress(): number;
|
|
36
|
+
get entry(): Entry & {
|
|
37
|
+
from: number;
|
|
38
|
+
to: number;
|
|
39
|
+
currentDistance: number;
|
|
40
|
+
distance: number;
|
|
41
|
+
direction: number;
|
|
42
|
+
currentProgress: number;
|
|
43
|
+
progress: number;
|
|
44
|
+
};
|
|
45
|
+
setTarget(value: number): void;
|
|
46
|
+
set(value: number, options?: AnimationOptions): void;
|
|
47
|
+
shift(value: number, options?: AnimationOptions): void;
|
|
17
48
|
reset(): void;
|
|
18
49
|
close(): void;
|
|
19
50
|
listenAnimationFrame(): void;
|
|
20
51
|
unlistenAnimationFrame(): void;
|
|
21
|
-
updateOptions(options?:
|
|
52
|
+
updateOptions(options?: AnimationOptions): void;
|
|
53
|
+
linkTo<A extends Animation<any>>(animation: A, startValue: number, setValue: number, options?: Parameters<A['updateOptions']>[0] & AnimationLinkOptions): void;
|
|
54
|
+
unlink(): void;
|
|
55
|
+
protected start(): void;
|
|
22
56
|
protected abstract handleAnimationFrame(e: TickerCallbackEntry): void;
|
|
57
|
+
protected abstract updateManually(...args: any[]): any;
|
|
23
58
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Animation, AnimationOptions } from './Animation';
|
|
2
|
+
import { StoreOptions } from '../store';
|
|
3
|
+
|
|
4
|
+
export interface AnimationLinkOptions extends Omit<AnimationOptions, keyof StoreOptions<number>> {
|
|
5
|
+
once?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class AnimationLink<Options extends AnimationLinkOptions = AnimationLinkOptions> {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(triggerAnimation: Animation<any>, targetAnimation: Animation<any>, startValue: number, setValue: number, options?: Options | undefined);
|
|
10
|
+
get targetAnimation(): Animation<any>;
|
|
11
|
+
get triggerAnimation(): Animation<any>;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
import {
|
|
3
|
-
import { StoreEntry, StoreManagers, StoreOptions } from '../store';
|
|
1
|
+
import { Animation, AnimationConstructorOptions, AnimationEntry, AnimationOptions } from './Animation';
|
|
2
|
+
import { TickerCallbackEntry } from '../ticker';
|
|
4
3
|
|
|
5
|
-
export interface DampedOptions extends
|
|
6
|
-
min?: number;
|
|
7
|
-
max?: number;
|
|
4
|
+
export interface DampedOptions extends AnimationOptions {
|
|
8
5
|
stiffness?: number;
|
|
9
6
|
damping?: number;
|
|
10
7
|
mass?: number;
|
|
11
8
|
}
|
|
12
|
-
export interface DampedEntry extends
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
length: number;
|
|
16
|
-
progress: number;
|
|
17
|
-
direction: number;
|
|
9
|
+
export interface DampedEntry extends AnimationEntry {
|
|
10
|
+
velocity: number;
|
|
11
|
+
speed: number;
|
|
18
12
|
}
|
|
19
|
-
export declare class Damped extends Animation<
|
|
13
|
+
export declare class Damped extends Animation<DampedEntry> {
|
|
20
14
|
#private;
|
|
21
15
|
damping: number;
|
|
22
16
|
stiffness: number;
|
|
23
17
|
mass: number;
|
|
24
|
-
constructor(initial?: number, options?: DampedOptions);
|
|
25
|
-
get target(): number;
|
|
26
|
-
get direction(): number;
|
|
27
|
-
get min(): number;
|
|
28
|
-
set min(value: number);
|
|
29
|
-
get max(): number;
|
|
30
|
-
set max(value: number);
|
|
18
|
+
constructor(initial?: number, options?: AnimationConstructorOptions<DampedOptions>);
|
|
31
19
|
get velocity(): number;
|
|
32
20
|
get speed(): number;
|
|
33
|
-
get
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
get entry(): {
|
|
22
|
+
velocity: number;
|
|
23
|
+
speed: number;
|
|
24
|
+
currentDistance: number;
|
|
25
|
+
distance: number;
|
|
26
|
+
currentProgress: number;
|
|
27
|
+
progress: number;
|
|
28
|
+
direction: number;
|
|
29
|
+
current: number;
|
|
30
|
+
previous: number | undefined;
|
|
31
|
+
from: number;
|
|
32
|
+
to: number;
|
|
33
|
+
};
|
|
34
|
+
updateOptions(options?: DampedOptions): void;
|
|
35
|
+
updateManually(value: number): void;
|
|
41
36
|
protected handleAnimationFrame(e: TickerCallbackEntry): void;
|
|
42
37
|
}
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import { Animation, AnimationOptions } from './Animation';
|
|
1
|
+
import { Animation, AnimationConstructorOptions, AnimationOptions } from './Animation';
|
|
2
2
|
import { EasingFunction } from '../utils';
|
|
3
|
-
import {
|
|
4
|
-
import { StoreEntry, StoreManagers, StoreOptions } from '../store';
|
|
3
|
+
import { TickerCallbackEntry } from '../ticker';
|
|
5
4
|
|
|
6
5
|
export interface TweenedOptions extends AnimationOptions {
|
|
7
6
|
easing?: EasingFunction;
|
|
8
7
|
duration?: number;
|
|
9
|
-
}
|
|
10
|
-
export interface TweenedSetOptions extends Omit<TweenedOptions, keyof StoreOptions<number>> {
|
|
11
8
|
restart?: boolean;
|
|
12
9
|
}
|
|
13
|
-
export
|
|
14
|
-
length: number;
|
|
15
|
-
progress: number;
|
|
16
|
-
direction: number;
|
|
17
|
-
}
|
|
18
|
-
export declare class Tweened extends Animation<TweenedOptions, TweenedEntry> {
|
|
10
|
+
export declare class Tweened extends Animation {
|
|
19
11
|
#private;
|
|
20
|
-
constructor(initial?: number, options?: TweenedOptions
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
get progress(): number;
|
|
24
|
-
get entry(): TweenedEntry;
|
|
25
|
-
set(value: number, options?: TweenedSetOptions): void;
|
|
26
|
-
shift(value: number, options?: TweenedSetOptions): void;
|
|
27
|
-
updateOptions(options?: Omit<TweenedOptions, keyof StoreOptions<number, keyof StoreManagers>> | undefined): void;
|
|
12
|
+
constructor(initial?: number, options?: AnimationConstructorOptions<TweenedOptions>);
|
|
13
|
+
updateOptions(options?: TweenedOptions): void;
|
|
14
|
+
updateManually(elapsed: number): number;
|
|
28
15
|
protected handleAnimationFrame(e: TickerCallbackEntry): void;
|
|
16
|
+
protected start(): void;
|
|
29
17
|
}
|
package/lib/animation/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var b=Object.defineProperty,y=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var c=(t,i,e)=>i in t?b(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e,d=(t,i)=>{for(var e in i||(i={}))O.call(i,e)&&c(t,e,i[e]);if(h)for(var e of h(i))S.call(i,e)&&c(t,e,i[e]);return t},g=(t,i)=>y(t,F(i));var q=(t,i,e)=>{if(!i.has(t))throw TypeError("Cannot "+e)};var s=(t,i,e)=>(q(t,i,"read from private field"),e?e.call(t):i.get(t)),u=(t,i,e)=>{if(i.has(t))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(t):i.set(t,e)},l=(t,i,e,r)=>(q(t,i,"write to private field"),r?r.call(t,e):i.set(t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../Damped-CbWlWAbx.cjs"),p=require("../easings-DsS5-Kqc.cjs"),D=require("../math-GDWEqu7y.cjs"),M=require("../number-yVpzMdbQ.cjs"),A=require("../polyfills-CrcS4RcO.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");var a,n;class T extends m.Animation{constructor(e,r){super(e||0,r);u(this,a,p.linear);u(this,n,1e3);this.updateOptions(g(d({},r),{equalize:!0}))}updateOptions(e){super.updateOptions(e),l(this,a,A.nullishCoalescing(e==null?void 0:e.easing,s(this,a))),l(this,n,A.nullishCoalescing(e==null?void 0:e.duration,s(this,n))),e!=null&&e.restart&&(this.current=this.initial)}updateManually(e){const r=e/1e3/(s(this,n)/1e3),f=s(this,a).call(this,D.clamp(r,0,1));return this.current=M.preciseNumber(this.from+(this.to-this.from)*f,6),r}handleAnimationFrame(e){this.updateManually(e.timeElapsedSinceSubscription)>1&&this.unlistenAnimationFrame()}start(){this.unlistenAnimationFrame(),this.listenAnimationFrame()}}a=new WeakMap,n=new WeakMap;exports.Animation=m.Animation;exports.Damped=m.Damped;exports.Tweened=T;
|
package/lib/animation/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export { Animation, type AnimationOptions, type AnimationEntry, } from './Animation';
|
|
1
2
|
export { Damped, type DampedOptions, type DampedEntry } from './Damped';
|
|
2
|
-
export { Tweened, type TweenedOptions
|
|
3
|
+
export { Tweened, type TweenedOptions } from './Tweened';
|
package/lib/animation/index.js
CHANGED
|
@@ -1,74 +1,56 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
b.call(
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
if (!
|
|
1
|
+
var F = Object.defineProperty, g = Object.defineProperties;
|
|
2
|
+
var x = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var h = Object.getOwnPropertySymbols;
|
|
4
|
+
var O = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var l = (i, e, t) => e in i ? F(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, c = (i, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
O.call(e, t) && l(i, t, e[t]);
|
|
8
|
+
if (h)
|
|
9
|
+
for (var t of h(e))
|
|
10
|
+
b.call(e, t) && l(i, t, e[t]);
|
|
11
|
+
return i;
|
|
12
|
+
}, d = (i, e) => g(i, x(e));
|
|
13
|
+
var f = (i, e, t) => {
|
|
14
|
+
if (!e.has(i))
|
|
15
15
|
throw TypeError("Cannot " + t);
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
if (
|
|
17
|
+
var m = (i, e, t) => (f(i, e, "read from private field"), t ? t.call(i) : e.get(i)), n = (i, e, t) => {
|
|
18
|
+
if (e.has(i))
|
|
19
19
|
throw TypeError("Cannot add the same private member more than once");
|
|
20
|
-
|
|
21
|
-
}, u = (
|
|
22
|
-
import { A as
|
|
23
|
-
import { D as
|
|
24
|
-
import { l as
|
|
20
|
+
e instanceof WeakSet ? e.add(i) : e.set(i, t);
|
|
21
|
+
}, u = (i, e, t, r) => (f(i, e, "write to private field"), r ? r.call(i, t) : e.set(i, t), t);
|
|
22
|
+
import { A as y } from "../Damped-BJgyFENo.js";
|
|
23
|
+
import { D as v } from "../Damped-BJgyFENo.js";
|
|
24
|
+
import { l as D } from "../easings-BKi40vHz.js";
|
|
25
25
|
import { c as M } from "../math-BOBiC4TN.js";
|
|
26
|
-
import { p as
|
|
27
|
-
import { n as
|
|
26
|
+
import { p as S } from "../number-Bo5RdrA1.js";
|
|
27
|
+
import { n as p } from "../polyfills-DJUYczFm.js";
|
|
28
28
|
import "../path-data-polyfill-DgeDWYeI.js";
|
|
29
|
-
var
|
|
30
|
-
class
|
|
31
|
-
constructor(t,
|
|
32
|
-
super(t || 0);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
m(this, a, 0);
|
|
37
|
-
m(this, c, 0);
|
|
38
|
-
this.updateOptions(s);
|
|
39
|
-
}
|
|
40
|
-
get direction() {
|
|
41
|
-
return r(this, c);
|
|
42
|
-
}
|
|
43
|
-
get length() {
|
|
44
|
-
return r(this, a) - r(this, h);
|
|
45
|
-
}
|
|
46
|
-
get progress() {
|
|
47
|
-
return this.length ? A((this.current - r(this, h)) / this.length, 6) : 0;
|
|
48
|
-
}
|
|
49
|
-
get entry() {
|
|
50
|
-
return f(p({}, super.entry), {
|
|
51
|
-
length: this.length,
|
|
52
|
-
direction: this.direction,
|
|
53
|
-
progress: this.progress
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
set(t, s) {
|
|
57
|
-
s != null && s.restart && (this.current = this.initial), u(this, h, this.current), u(this, a, t), u(this, c, Math.sign(this.length)), this.updateOptions(s), r(this, n) ? (this.unlistenAnimationFrame(), this.listenAnimationFrame()) : (this.current = r(this, a), this.unlistenAnimationFrame());
|
|
58
|
-
}
|
|
59
|
-
shift(t, s) {
|
|
60
|
-
this.set(this.current + t, s);
|
|
29
|
+
var a, s;
|
|
30
|
+
class T extends y {
|
|
31
|
+
constructor(t, r) {
|
|
32
|
+
super(t || 0, r);
|
|
33
|
+
n(this, a, D);
|
|
34
|
+
n(this, s, 1e3);
|
|
35
|
+
this.updateOptions(d(c({}, r), { equalize: !0 }));
|
|
61
36
|
}
|
|
62
37
|
updateOptions(t) {
|
|
63
|
-
super.updateOptions(t), u(this,
|
|
38
|
+
super.updateOptions(t), u(this, a, p(t == null ? void 0 : t.easing, m(this, a))), u(this, s, p(t == null ? void 0 : t.duration, m(this, s))), t != null && t.restart && (this.current = this.initial);
|
|
39
|
+
}
|
|
40
|
+
updateManually(t) {
|
|
41
|
+
const r = t / 1e3 / (m(this, s) / 1e3), A = m(this, a).call(this, M(r, 0, 1));
|
|
42
|
+
return this.current = S(this.from + (this.to - this.from) * A, 6), r;
|
|
64
43
|
}
|
|
65
44
|
handleAnimationFrame(t) {
|
|
66
|
-
|
|
67
|
-
|
|
45
|
+
this.updateManually(t.timeElapsedSinceSubscription) > 1 && this.unlistenAnimationFrame();
|
|
46
|
+
}
|
|
47
|
+
start() {
|
|
48
|
+
this.unlistenAnimationFrame(), this.listenAnimationFrame();
|
|
68
49
|
}
|
|
69
50
|
}
|
|
70
|
-
|
|
51
|
+
a = new WeakMap(), s = new WeakMap();
|
|
71
52
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
53
|
+
y as Animation,
|
|
54
|
+
v as Damped,
|
|
55
|
+
T as Tweened
|
|
74
56
|
};
|
package/lib/canvas/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../css-property/index.cjs"),P=require("../custom-element/index.cjs");require("../Store-BQGNOHlY.cjs");const z=require("../math-GDWEqu7y.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const b=require("../tags-CueX-JLX.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../css-property/index.cjs"),P=require("../custom-element/index.cjs");require("../Store-BQGNOHlY.cjs");const z=require("../math-GDWEqu7y.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const b=require("../tags-CueX-JLX.cjs"),F=require("../createStylesheet-C8aQQ4hd.cjs"),M=require("../element-resizer/index.cjs"),C=require("../ticker/index.cjs");var B=Object.defineProperty,T=Object.getOwnPropertyDescriptor,A=(i,e,s,r)=>{for(var a=r>1?void 0:r?T(e,s):e,k=i.length-1,S;k>=0;k--)(S=i[k])&&(a=(r?S(e,s,a):S(a))||a);return r&&a&&B(e,s,a),a},y=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},t=(i,e,s)=>(y(i,e,"read from private field"),s?s.call(i):e.get(i)),n=(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)},h=(i,e,s,r)=>(y(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),u=(i,e,s)=>(y(i,e,"access private method"),s),l,c,d,o,p,v,m,w,f,R,E,q,x,_,g,W;const D=F.createStylesheet({":host, canvas":{display:"block",width:"100%",height:"100%"}});exports.CanvasElement=class extends P.CustomElement{constructor(){super(),n(this,f),n(this,E),n(this,g),n(this,l,new O.CSSProperty(this,"--fps",0)),n(this,c,null),n(this,d,null),n(this,o,0),n(this,p,0),n(this,v,1),n(this,m,0),n(this,w,1),n(this,x,e=>{h(this,v,z.clamp(devicePixelRatio,1,2)),h(this,o,e.contentRect.width),h(this,p,e.contentRect.height),t(this,c).width=t(this,o)*this.pixelRatio,t(this,c).height=t(this,p)*this.pixelRatio,this.context.scale(this.pixelRatio,this.pixelRatio),u(this,g,W).call(this)}),n(this,_,e=>{h(this,m,e.timestamp),h(this,w,e.timeBetweenFrames),u(this,g,W).call(this)}),this.openShadow(D),b.element(this,{children:b.canvas({ref:e=>{h(this,c,e),h(this,d,e.getContext("2d"))}})}),t(this,l).subscribe(e=>{typeof e.previous!="undefined"&&e.current!==e.previous&&u(this,f,R).call(this)})}get fpsCSSProperty(){return t(this,l)}get canvasElement(){return t(this,c)}get context(){return t(this,d)}get pixelRatio(){return t(this,v)}get width(){return t(this,o)}get height(){return t(this,p)}get detail(){return{width:t(this,o),height:t(this,p),element:this,canvasElement:t(this,c),pixelRatio:t(this,v),context:t(this,d),timestamp:t(this,m),timeBetweenFrames:t(this,w)}}connectedCallback(){t(this,l).observe(),M.elementResizer.subscribe(this,t(this,x)),u(this,f,R).call(this)}disconnectedCallback(){t(this,l).unobserve(),M.elementResizer.unsubscribe(t(this,x)),u(this,E,q).call(this)}};l=new WeakMap;c=new WeakMap;d=new WeakMap;o=new WeakMap;p=new WeakMap;v=new WeakMap;m=new WeakMap;w=new WeakMap;f=new WeakSet;R=function(){C.ticker.unsubscribe(t(this,_)),this.hasAttribute("static")||C.ticker.subscribe(t(this,_),{culling:this,maxFPS:t(this,l).current})};E=new WeakSet;q=function(){C.ticker.unsubscribe(t(this,_))};x=new WeakMap;_=new WeakMap;g=new WeakSet;W=function(){this.dispatchEvent(new CustomEvent("canvasRender",{composed:!0,detail:this.detail}))};exports.CanvasElement=A([P.define("e-canvas")],exports.CanvasElement);
|
package/lib/canvas/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface Canvas2DRenderDetail {
|
|
|
9
9
|
canvasElement: HTMLCanvasElement;
|
|
10
10
|
context: CanvasRenderingContext2D;
|
|
11
11
|
timestamp: number;
|
|
12
|
-
|
|
12
|
+
timeBetweenFrames: number;
|
|
13
13
|
}
|
|
14
14
|
export type Canvas2DRenderCallback = (entry: Canvas2DRenderDetail) => void;
|
|
15
15
|
export declare class CanvasElement extends CustomElement {
|