aptechka 0.42.4 → 0.42.6
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/controls/index.cjs +1 -1
- package/lib/controls/index.js +58 -58
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +18 -18
- package/package.json +1 -1
package/lib/controls/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var V=h=>{throw TypeError(h)};var F=(h,n,e)=>n.has(h)||V("Cannot "+e);var t=(h,n,e)=>(F(h,n,"read from private field"),e?e.call(h):n.get(h)),s=(h,n,e)=>n.has(h)?V("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(h):n.set(h,e),i=(h,n,e,r)=>(F(h,n,"write to private field"),r?r.call(h,e):n.set(h,e),e),k=(h,n,e)=>(F(h,n,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("../notifier/index.cjs"),
|
|
1
|
+
"use strict";var V=h=>{throw TypeError(h)};var F=(h,n,e)=>n.has(h)||V("Cannot "+e);var t=(h,n,e)=>(F(h,n,"read from private field"),e?e.call(h):n.get(h)),s=(h,n,e)=>n.has(h)?V("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(h):n.set(h,e),i=(h,n,e,r)=>(F(h,n,"write to private field"),r?r.call(h,e):n.set(h,e),e),k=(h,n,e)=>(F(h,n,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("../notifier/index.cjs"),o=require("../browser-CpzFX2xg.cjs"),Q=require("../dom-JBOkFLTh.cjs"),q=require("../ticker/index.cjs");require("../Store-C2J4Q87x.cjs");const J=require("../easings-GegIwET5.cjs"),Z=require("../Tweened-Dn6CMA-p.cjs"),$=require("../gestures-DHLrn6Q8.cjs"),_=require("../polyfills-BANSrI_m.cjs"),p=require("../order/index.cjs");var R;class Y{constructor(){s(this,R,new G.Notifier)}get changeEvent(){return t(this,R)}}R=new WeakMap;var g,c,u,H;class ee extends Y{constructor(e){super();s(this,g,null);s(this,c,null);s(this,u,"offsetHeight");s(this,H,e=>{const r=e.shiftKey?-1:1;let a;e.code==="Space"?a=r*t(this,c)[t(this,u)]*.4:e.code==="ArrowLeft"?a=-1*t(this,c)[t(this,u)]*.2:e.code==="ArrowRight"?a=1*t(this,c)[t(this,u)]*.2:e.code==="ArrowUp"?a=-1*t(this,c)[t(this,u)]*.2:e.code==="ArrowDown"?a=1*t(this,c)[t(this,u)]*.2:e.code==="PageUp"?a=-1*t(this,c)[t(this,u)]:e.code==="PageDown"?a=1*t(this,c)[t(this,u)]:e.code==="Home"?a=0:e.code==="End"&&(a=t(this,u)==="offsetWidth"?t(this,c).scrollWidth:t(this,c).scrollHeight),a&&(e.stopPropagation(),this.changeEvent.notify("keyboard",a))});o.isBrowser&&(i(this,g,e!=null&&e.element&&Q.getElement(e.element)||window),i(this,c,t(this,g)instanceof HTMLElement?t(this,g):document.documentElement),this.dimension=e==null?void 0:e.dimension)}set dimension(e){i(this,u,e==="width"?"offsetWidth":"offsetHeight")}connect(){o.isBrowser&&t(this,g).addEventListener("keydown",t(this,H))}disconnect(){o.isBrowser&&t(this,g).removeEventListener("keydown",t(this,H))}}g=new WeakMap,c=new WeakMap,u=new WeakMap,H=new WeakMap;var b,x,P,z,d,T,f,w,O,U,C,W,B;class te extends Y{constructor(e){super();s(this,w);s(this,b);s(this,x);s(this,P);s(this,z);s(this,d);s(this,T);s(this,f);s(this,C);s(this,W);s(this,B);this.direction=1,i(this,d,new Z.Tweened(0,{easing:J.easeInQuad})),i(this,f,!1),i(this,C,r=>{t(this,d).current!==1&&this.changeEvent.notify("autoplay",r.timeBetweenFrames*t(this,b)*this.direction*(1-t(this,d).current))}),i(this,W,()=>{t(this,d).current!==1&&this.changeEvent.notify("autoplay",Math.sign(t(this,b))*this.direction*(1-t(this,d).current))}),i(this,B,()=>{t(this,x)&&(document.hidden?t(this,d).set(1,{equalize:!0}):t(this,d).set(0,{equalize:!0}))}),i(this,b,(e==null?void 0:e.speed)||1),i(this,x,(e==null?void 0:e.interval)||!1),i(this,P,e)}set interval(e){i(this,x,e),t(this,f)&&k(this,w,O).call(this)}set speed(e){i(this,b,e),t(this,f)&&k(this,w,O).call(this)}connect(){t(this,f)||(i(this,f,!0),k(this,w,O).call(this))}disconnect(){t(this,f)&&(i(this,f,!1),k(this,w,U).call(this))}pauseAndContinue(e,r){t(this,f)&&e&&(clearTimeout(t(this,T)),t(this,d).set(1,{duration:Math.min(e,1e3),equalize:r}),i(this,T,setTimeout(()=>{t(this,d).set(0,{duration:Math.min(e,5e3),equalize:r})},e)))}}b=new WeakMap,x=new WeakMap,P=new WeakMap,z=new WeakMap,d=new WeakMap,T=new WeakMap,f=new WeakMap,w=new WeakSet,O=function(){k(this,w,U).call(this),t(this,x)?i(this,z,setInterval(t(this,W),Math.abs(t(this,b)))):q.ticker.subscribe(t(this,C),t(this,P)),document.addEventListener("visibilitychange",t(this,B))},U=function(){clearInterval(t(this,z)),q.ticker.unsubscribe(t(this,C)),clearTimeout(t(this,T)),t(this,d).close(),document.removeEventListener("visibilitychange",t(this,B))},C=new WeakMap,W=new WeakMap,B=new WeakMap;var A,v,D,X;class ie extends Y{constructor(e){super();s(this,A,null);s(this,v);s(this,D);s(this,X,e=>{let r=0;if(!(this.axis==="x"&&Math.abs(e.deltaY)>Math.abs(e.deltaX)*1||this.axis==="y"&&Math.abs(e.deltaX)>Math.abs(e.deltaY)*1))if(e.preventDefault(),r=(this.axis==="max"?Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY:this.axis==="x"?e.deltaX:e.deltaY)*this.speed,e.stopPropagation(),this.debounce){const a=Date.now();if(a-t(this,D)>40&&(r=100*Math.sign(r)),i(this,D,a),Math.abs(r)<100||t(this,v))return;this.changeEvent.notify("wheel",r),i(this,v,setTimeout(()=>{i(this,v,void 0)},80))}else this.changeEvent.notify("wheel",r)});this.axis=(e==null?void 0:e.axis)||"y",this.speed=(e==null?void 0:e.speed)||1,this.debounce=(e==null?void 0:e.debounce)||!1,i(this,D,Date.now()),o.isBrowser&&i(this,A,e!=null&&e.element&&Q.getElement(e.element)||window)}connect(){o.isBrowser&&t(this,A).addEventListener("wheel",t(this,X),{passive:!1})}disconnect(){o.isBrowser&&(t(this,A).removeEventListener("wheel",t(this,X)),clearTimeout(t(this,v)))}}A=new WeakMap,v=new WeakMap,D=new WeakMap,X=new WeakMap;var L,m,l,I,y;const E=class E extends Y{constructor(e){super();s(this,m);s(this,l);s(this,I);s(this,y);this.inertion=1,i(this,m,null),i(this,l,0),i(this,I,r=>{if(r.composedPath().find(M=>M instanceof HTMLElement&&M.hasAttribute("drag-dead-zone")))return;this.swipe||q.ticker.unsubscribe(t(this,y));let a=r,S=!1;i(this,l,0),document.documentElement.classList.add("grabbing");let K=0,N=0;$.setupDrag(M=>{t(E,L)&&t(E,L)!==t(this,m)||(K=a.x-M.x,N=a.y-M.y,this.axis==="x"?i(this,l,K):i(this,l,N),a=M,S=this.axis==="x"&&Math.abs(K)>Math.abs(N)||this.axis==="y"&&Math.abs(N)>Math.abs(K),S&&(document.documentElement.classList.add("dragging"),i(E,L,t(this,m)),this.changeEvent.notify("drag",t(this,l))))},()=>{i(E,L,null),S&&!this.swipe&&this.inertion?(i(this,l,t(this,l)*this.inertion),q.ticker.subscribe(t(this,y),{order:p.TICK_ORDER.CONTROLS-1})):this.swipe&&this.changeEvent.notify("drag-end",t(this,l)),document.documentElement.classList.remove("grabbing"),document.documentElement.classList.remove("dragging")})}),i(this,y,()=>{Math.floor(Math.abs(t(this,l)))||q.ticker.unsubscribe(t(this,y)),i(this,l,t(this,l)*.95),i(this,l,_.preciseNumber(t(this,l),3)),this.changeEvent.notify("drag",t(this,l))}),this.axis=(e==null?void 0:e.axis)||"y",this.swipe=(e==null?void 0:e.swipe)||!1,o.isBrowser&&i(this,m,e!=null&&e.element&&Q.getElement(e.element)||document.documentElement)}connect(){o.isBrowser&&t(this,m).addEventListener("pointerdown",t(this,I))}disconnect(){o.isBrowser&&(t(this,m).removeEventListener("pointerdown",t(this,I)),q.ticker.unsubscribe(t(this,y)))}};L=new WeakMap,m=new WeakMap,l=new WeakMap,I=new WeakMap,y=new WeakMap,s(E,L,null);let j=E;exports.AutoplayControls=te;exports.Controls=Y;exports.DragControls=j;exports.KeyboardControls=ee;exports.WheelControls=ie;
|
package/lib/controls/index.js
CHANGED
|
@@ -23,80 +23,80 @@ class B {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
O = new WeakMap();
|
|
26
|
-
var
|
|
27
|
-
class
|
|
26
|
+
var g, d, m, P;
|
|
27
|
+
class me extends B {
|
|
28
28
|
constructor(e) {
|
|
29
29
|
super();
|
|
30
|
-
s(this,
|
|
30
|
+
s(this, g, null);
|
|
31
31
|
s(this, d, null);
|
|
32
|
-
s(this,
|
|
32
|
+
s(this, m, "offsetHeight");
|
|
33
33
|
s(this, P, (e) => {
|
|
34
34
|
const a = e.shiftKey ? -1 : 1;
|
|
35
35
|
let r;
|
|
36
|
-
e.code === "Space" ? r = a * t(this, d)[t(this,
|
|
36
|
+
e.code === "Space" ? r = a * t(this, d)[t(this, m)] * 0.4 : e.code === "ArrowLeft" ? r = -1 * t(this, d)[t(this, m)] * 0.2 : e.code === "ArrowRight" ? r = 1 * t(this, d)[t(this, m)] * 0.2 : e.code === "ArrowUp" ? r = -1 * t(this, d)[t(this, m)] * 0.2 : e.code === "ArrowDown" ? r = 1 * t(this, d)[t(this, m)] * 0.2 : e.code === "PageUp" ? r = -1 * t(this, d)[t(this, m)] : e.code === "PageDown" ? r = 1 * t(this, d)[t(this, m)] : e.code === "Home" ? r = 0 : e.code === "End" && (r = t(this, m) === "offsetWidth" ? t(this, d).scrollWidth : t(this, d).scrollHeight), r && (e.stopPropagation(), this.changeEvent.notify("keyboard", r));
|
|
37
37
|
});
|
|
38
|
-
o && (i(this,
|
|
38
|
+
o && (i(this, g, e != null && e.element && Q(e.element) || window), i(this, d, t(this, g) instanceof HTMLElement ? t(this, g) : document.documentElement), this.dimension = e == null ? void 0 : e.dimension);
|
|
39
39
|
}
|
|
40
40
|
set dimension(e) {
|
|
41
|
-
i(this,
|
|
41
|
+
i(this, m, e === "width" ? "offsetWidth" : "offsetHeight");
|
|
42
42
|
}
|
|
43
43
|
connect() {
|
|
44
|
-
o && t(this,
|
|
44
|
+
o && t(this, g).addEventListener(
|
|
45
45
|
"keydown",
|
|
46
46
|
t(this, P)
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
disconnect() {
|
|
50
|
-
o && t(this,
|
|
50
|
+
o && t(this, g).removeEventListener(
|
|
51
51
|
"keydown",
|
|
52
52
|
t(this, P)
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
class
|
|
56
|
+
g = new WeakMap(), d = new WeakMap(), m = new WeakMap(), P = new WeakMap();
|
|
57
|
+
var w, v, X, Y, c, C, f, b, K, U, A, q, I;
|
|
58
|
+
class fe extends B {
|
|
59
59
|
constructor(e) {
|
|
60
60
|
super();
|
|
61
61
|
s(this, b);
|
|
62
|
-
s(this,
|
|
63
|
-
s(this,
|
|
62
|
+
s(this, w);
|
|
63
|
+
s(this, v);
|
|
64
64
|
s(this, X);
|
|
65
65
|
s(this, Y);
|
|
66
66
|
s(this, c);
|
|
67
67
|
s(this, C);
|
|
68
|
-
s(this,
|
|
68
|
+
s(this, f);
|
|
69
69
|
s(this, A);
|
|
70
70
|
s(this, q);
|
|
71
71
|
s(this, I);
|
|
72
|
-
this.direction = 1, i(this, c, new Z(0, { easing: J })), i(this,
|
|
72
|
+
this.direction = 1, i(this, c, new Z(0, { easing: J })), i(this, f, !1), i(this, A, (a) => {
|
|
73
73
|
t(this, c).current !== 1 && this.changeEvent.notify(
|
|
74
74
|
"autoplay",
|
|
75
|
-
a.timeBetweenFrames * t(this,
|
|
75
|
+
a.timeBetweenFrames * t(this, w) * this.direction * (1 - t(this, c).current)
|
|
76
76
|
);
|
|
77
77
|
}), i(this, q, () => {
|
|
78
78
|
t(this, c).current !== 1 && this.changeEvent.notify(
|
|
79
79
|
"autoplay",
|
|
80
|
-
Math.sign(t(this,
|
|
80
|
+
Math.sign(t(this, w)) * this.direction * (1 - t(this, c).current)
|
|
81
81
|
);
|
|
82
82
|
}), i(this, I, () => {
|
|
83
|
-
t(this,
|
|
84
|
-
}), i(this,
|
|
83
|
+
t(this, v) && (document.hidden ? t(this, c).set(1, { equalize: !0 }) : t(this, c).set(0, { equalize: !0 }));
|
|
84
|
+
}), i(this, w, (e == null ? void 0 : e.speed) || 1), i(this, v, (e == null ? void 0 : e.interval) || !1), i(this, X, e);
|
|
85
85
|
}
|
|
86
86
|
set interval(e) {
|
|
87
|
-
i(this,
|
|
87
|
+
i(this, v, e), t(this, f) && T(this, b, K).call(this);
|
|
88
88
|
}
|
|
89
89
|
set speed(e) {
|
|
90
|
-
i(this,
|
|
90
|
+
i(this, w, e), t(this, f) && T(this, b, K).call(this);
|
|
91
91
|
}
|
|
92
92
|
connect() {
|
|
93
|
-
t(this,
|
|
93
|
+
t(this, f) || (i(this, f, !0), T(this, b, K).call(this));
|
|
94
94
|
}
|
|
95
95
|
disconnect() {
|
|
96
|
-
t(this,
|
|
96
|
+
t(this, f) && (i(this, f, !1), T(this, b, U).call(this));
|
|
97
97
|
}
|
|
98
98
|
pauseAndContinue(e, a) {
|
|
99
|
-
t(this,
|
|
99
|
+
t(this, f) && e && (clearTimeout(t(this, C)), t(this, c).set(1, {
|
|
100
100
|
duration: Math.min(e, 1e3),
|
|
101
101
|
equalize: a
|
|
102
102
|
}), i(this, C, setTimeout(() => {
|
|
@@ -107,10 +107,10 @@ class ue extends B {
|
|
|
107
107
|
}, e)));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
T(this, b, U).call(this), t(this,
|
|
110
|
+
w = new WeakMap(), v = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), c = new WeakMap(), C = new WeakMap(), f = new WeakMap(), b = new WeakSet(), K = function() {
|
|
111
|
+
T(this, b, U).call(this), t(this, v) ? i(this, Y, setInterval(
|
|
112
112
|
t(this, q),
|
|
113
|
-
Math.abs(t(this,
|
|
113
|
+
Math.abs(t(this, w))
|
|
114
114
|
)) : k.subscribe(t(this, A), t(this, X)), document.addEventListener(
|
|
115
115
|
"visibilitychange",
|
|
116
116
|
t(this, I)
|
|
@@ -121,22 +121,22 @@ g = new WeakMap(), x = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), c =
|
|
|
121
121
|
t(this, I)
|
|
122
122
|
);
|
|
123
123
|
}, A = new WeakMap(), q = new WeakMap(), I = new WeakMap();
|
|
124
|
-
var D,
|
|
125
|
-
class
|
|
124
|
+
var D, x, H, N;
|
|
125
|
+
class ue extends B {
|
|
126
126
|
constructor(e) {
|
|
127
127
|
super();
|
|
128
128
|
s(this, D, null);
|
|
129
|
-
s(this,
|
|
129
|
+
s(this, x);
|
|
130
130
|
s(this, H);
|
|
131
131
|
s(this, N, (e) => {
|
|
132
132
|
let a = 0;
|
|
133
133
|
if (!(this.axis === "x" && Math.abs(e.deltaY) > Math.abs(e.deltaX) * 1 || this.axis === "y" && Math.abs(e.deltaX) > Math.abs(e.deltaY) * 1))
|
|
134
134
|
if (e.preventDefault(), a = (this.axis === "max" ? Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY : this.axis === "x" ? e.deltaX : e.deltaY) * this.speed, e.stopPropagation(), this.debounce) {
|
|
135
135
|
const r = Date.now();
|
|
136
|
-
if (r - t(this, H) > 40 && (a = 100 * Math.sign(a)), i(this, H, r), Math.abs(a) < 100 || t(this,
|
|
136
|
+
if (r - t(this, H) > 40 && (a = 100 * Math.sign(a)), i(this, H, r), Math.abs(a) < 100 || t(this, x))
|
|
137
137
|
return;
|
|
138
|
-
this.changeEvent.notify("wheel", a), i(this,
|
|
139
|
-
i(this,
|
|
138
|
+
this.changeEvent.notify("wheel", a), i(this, x, setTimeout(() => {
|
|
139
|
+
i(this, x, void 0);
|
|
140
140
|
}, 80));
|
|
141
141
|
} else
|
|
142
142
|
this.changeEvent.notify("wheel", a);
|
|
@@ -156,57 +156,57 @@ class me extends B {
|
|
|
156
156
|
o && (t(this, D).removeEventListener(
|
|
157
157
|
"wheel",
|
|
158
158
|
t(this, N)
|
|
159
|
-
), clearTimeout(t(this,
|
|
159
|
+
), clearTimeout(t(this, x)));
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
D = new WeakMap(),
|
|
163
|
-
var
|
|
164
|
-
const
|
|
162
|
+
D = new WeakMap(), x = new WeakMap(), H = new WeakMap(), N = new WeakMap();
|
|
163
|
+
var L, u, l, z, E;
|
|
164
|
+
const y = class y extends B {
|
|
165
165
|
constructor(e) {
|
|
166
166
|
super();
|
|
167
|
-
s(this,
|
|
167
|
+
s(this, u);
|
|
168
168
|
s(this, l);
|
|
169
169
|
s(this, z);
|
|
170
|
-
s(this,
|
|
171
|
-
this.inertion = 1, i(this,
|
|
170
|
+
s(this, E);
|
|
171
|
+
this.inertion = 1, i(this, u, null), i(this, l, 0), i(this, z, (a) => {
|
|
172
172
|
if (a.composedPath().find(
|
|
173
|
-
(
|
|
173
|
+
(M) => M instanceof HTMLElement && M.hasAttribute("drag-dead-zone")
|
|
174
174
|
))
|
|
175
175
|
return;
|
|
176
|
-
this.swipe || k.unsubscribe(t(this,
|
|
176
|
+
this.swipe || k.unsubscribe(t(this, E));
|
|
177
177
|
let r = a, F = !1;
|
|
178
178
|
i(this, l, 0), document.documentElement.classList.add("grabbing");
|
|
179
179
|
let R = 0, W = 0;
|
|
180
180
|
$(
|
|
181
|
-
(
|
|
182
|
-
t(
|
|
181
|
+
(M) => {
|
|
182
|
+
t(y, L) && t(y, L) !== t(this, u) || (R = r.x - M.x, W = r.y - M.y, this.axis === "x" ? i(this, l, R) : i(this, l, W), r = M, F = this.axis === "x" && Math.abs(R) > Math.abs(W) || this.axis === "y" && Math.abs(W) > Math.abs(R), F && (document.documentElement.classList.add("dragging"), i(y, L, t(this, u)), this.changeEvent.notify("drag", t(this, l))));
|
|
183
183
|
},
|
|
184
184
|
() => {
|
|
185
|
-
i(
|
|
185
|
+
i(y, L, null), F && !this.swipe && this.inertion ? (i(this, l, t(this, l) * this.inertion), k.subscribe(t(this, E), {
|
|
186
186
|
order: _.CONTROLS - 1
|
|
187
|
-
})) : this.swipe && this.changeEvent.notify("drag-end", t(this, l)), document.documentElement.classList.remove("grabbing");
|
|
187
|
+
})) : this.swipe && this.changeEvent.notify("drag-end", t(this, l)), document.documentElement.classList.remove("grabbing"), document.documentElement.classList.remove("dragging");
|
|
188
188
|
}
|
|
189
189
|
);
|
|
190
|
-
}), i(this,
|
|
191
|
-
Math.floor(Math.abs(t(this, l))) || k.unsubscribe(t(this,
|
|
192
|
-
}), this.axis = (e == null ? void 0 : e.axis) || "y", this.swipe = (e == null ? void 0 : e.swipe) || !1, o && i(this,
|
|
190
|
+
}), i(this, E, () => {
|
|
191
|
+
Math.floor(Math.abs(t(this, l))) || k.unsubscribe(t(this, E)), i(this, l, t(this, l) * 0.95), i(this, l, p(t(this, l), 3)), this.changeEvent.notify("drag", t(this, l));
|
|
192
|
+
}), this.axis = (e == null ? void 0 : e.axis) || "y", this.swipe = (e == null ? void 0 : e.swipe) || !1, o && i(this, u, e != null && e.element && Q(e.element) || document.documentElement);
|
|
193
193
|
}
|
|
194
194
|
connect() {
|
|
195
|
-
o && t(this,
|
|
195
|
+
o && t(this, u).addEventListener("pointerdown", t(this, z));
|
|
196
196
|
}
|
|
197
197
|
disconnect() {
|
|
198
|
-
o && (t(this,
|
|
198
|
+
o && (t(this, u).removeEventListener(
|
|
199
199
|
"pointerdown",
|
|
200
200
|
t(this, z)
|
|
201
|
-
), k.unsubscribe(t(this,
|
|
201
|
+
), k.unsubscribe(t(this, E)));
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
|
|
205
|
-
let j =
|
|
204
|
+
L = new WeakMap(), u = new WeakMap(), l = new WeakMap(), z = new WeakMap(), E = new WeakMap(), s(y, L, null);
|
|
205
|
+
let j = y;
|
|
206
206
|
export {
|
|
207
|
-
|
|
207
|
+
fe as AutoplayControls,
|
|
208
208
|
B as Controls,
|
|
209
209
|
j as DragControls,
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
me as KeyboardControls,
|
|
211
|
+
ue as WheelControls
|
|
212
212
|
};
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ot=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),ht=n=>{throw TypeError(n)};var Q=(n,t,i)=>t.has(n)||ht("Cannot "+i);var e=(n,t,i)=>(Q(n,t,"read from private field"),i?i.call(n):t.get(n)),o=(n,t,i)=>t.has(n)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,i),c=(n,t,i,s)=>(Q(n,t,"write to private field"),s?s.call(n,i):t.set(n,i),i),
|
|
1
|
+
"use strict";var ot=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),ht=n=>{throw TypeError(n)};var Q=(n,t,i)=>t.has(n)||ht("Cannot "+i);var e=(n,t,i)=>(Q(n,t,"read from private field"),i?i.call(n):t.get(n)),o=(n,t,i)=>t.has(n)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,i),c=(n,t,i,s)=>(Q(n,t,"write to private field"),s?s.call(n,i):t.set(n,i),i),y=(n,t,i)=>(Q(n,t,"access private method"),i);var z=(n,t,i)=>new Promise((s,l)=>{var u=f=>{try{L(i.next(f))}catch(P){l(P)}},a=f=>{try{L(i.throw(f))}catch(P){l(P)}},L=f=>f.done?s(f.value):Promise.resolve(f.value).then(u,a);L((i=i.apply(n,t)).next())});var ct=(n,t,i)=>(t=n[ot("asyncIterator")])?t.call(n):(n=n[ot("iterator")](),t={},i=(s,l)=>(l=n[s])&&(t[s]=u=>new Promise((a,L,f)=>(u=l.call(n,u),f=u.done,Promise.resolve(u.value).then(P=>a({value:P,done:f}),L)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../browser-CpzFX2xg.cjs"),K=require("../events-KVanG9sR.cjs"),V=require("../url-BiHPIsKq.cjs"),dt=require("../loading/index.cjs");var T,h,p,q,x,H,D,k;class lt{constructor(t,i){o(this,T);o(this,h);o(this,p);o(this,q);o(this,x);o(this,H);o(this,D,t=>{t.preventDefault(),e(this,T).links.forEach(i=>{var s;e(this,p)===e(i,p)||(s=e(i,H))!=null&&s.includes(e(this,p))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,T).navigate(e(this,p),{historyAction:e(this,q),state:e(this,x)})});o(this,k,()=>{e(this,T).prefetch(e(this,p)),e(this,h).removeEventListener("pointerenter",e(this,k))});var u,a;c(this,T,i),c(this,h,t),c(this,p,e(this,h).getAttribute("href")||"/"),c(this,q,e(this,h).getAttribute("data-history-action")||"push"),c(this,x,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,D));const s=i.normalizePath(e(this,p)),l=i.normalizePath(location.pathname);c(this,H,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(L=>i.normalizePath(L.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(s.pathname)&&e(this,h).classList.add("current"):s.pathname===l.pathname||(a=e(this,H))!=null&&a.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,D)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}T=new WeakMap,h=new WeakMap,p=new WeakMap,q=new WeakMap,x=new WeakMap,H=new WeakMap,D=new WeakMap,k=new WeakMap;var I,O,R,S,E,Y,M,b,g,_,B,v,m,U,X,ut,Z,G;class gt{constructor(t){o(this,m);o(this,I,null);o(this,O,null);o(this,R,null);o(this,S,null);o(this,E,[]);o(this,Y,new DOMParser);o(this,M,new Map);o(this,b);o(this,g,null);o(this,_);o(this,B);o(this,v,[]);o(this,G,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(pt.isBrowser){c(this,I,V.normalizeBase(t==null?void 0:t.base)),c(this,O,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,R,(t==null?void 0:t.cachePages)!==!1),c(this,S,y(this,m,X).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,g,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,g)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,G)),V.changeHistory("replace",e(this,g),i.parameters,i.hash),e(this,S).map(s=>[...s.children]).flat().forEach(s=>{s instanceof HTMLElement&&s.classList.add("current")})}}get currentPathname(){return e(this,g)}get previousPathname(){return e(this,_)}get currentState(){return e(this,B)}get links(){return e(this,E)}normalizePath(t){return V.splitPath(t,e(this,I))}prefetch(t){return z(this,null,function*(){const i=this.normalizePath(t);return y(this,m,U).call(this,i.pathname)})}navigate(l){return z(this,arguments,function*(t,{historyAction:i="push",state:s}={}){var $;if(e(this,v).length)return;const u=this.normalizePath(t);let{pathname:a,hash:L,parameters:f,leaf:P}=u;if(e(this,b)===a||e(this,g)===a)return;c(this,B,s),c(this,b,a);const N=e(this,M).has(a);try{dt.loading.add("__morph");let F=!0;if(K.dispatchEvent(document,"morphBeforeNavigation",{detail:{pathname:a,isCached:N,state:s}}),this.preprocessor)try{yield new Promise((r,w)=>{var A;(A=this.preprocessor)==null||A.call(this,{pathname:a,resolve:r,reject:w,isCached:N,state:s})})}catch(r){r?console.error(r):console.log("Route change canceled"),F=!1}if(!F||e(this,b)!==a)return;const tt=e(this,M).get(a)||(yield y(this,m,U).call(this,a));if(e(this,b)!==a)return;const et=Array.from(document.head.children),it=Array.from(tt.head.cloneNode(!0).children),st=y(this,m,ut).call(this,et,it),mt=y(this,m,Z).call(this,et,st),W=y(this,m,Z).call(this,it,st);W.forEach((r,w)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const A=document.createElement("script");A.type="module",A.src=r.getAttribute("src"),W[w]=A}}),W.forEach(r=>{document.head.appendChild(r)});const J=W.filter(r=>!r.hasAttribute("data-no-waiting")&&(r.tagName==="STYLE"||r.tagName==="SCRIPT"||r.tagName==="LINK")&&r.getAttribute("rel")!=="canonical");e(this,O)&&J.length&&(yield new Promise(r=>z(this,null,function*(){let w=0;try{for(var A=ct(J),nt,C,rt;nt=!(C=yield A.next()).done;nt=!1){const j=C.value;j.onload=()=>{w++,w===J.length&&r()}}}catch(C){rt=[C]}finally{try{nt&&(C=A.return)&&(yield C.call(A))}finally{if(rt)throw rt[0]}}}))),mt.forEach(r=>{r.hasAttribute("data-permanent")||r.remove()}),c(this,_,e(this,g)),c(this,g,a),V.changeHistory(i,a,f,L);const ft=y(this,m,X).call(this,tt.body.cloneNode(!0));e(this,v).forEach(r=>clearTimeout(r)),c(this,v,[]),e(this,S).forEach((r,w)=>{const A=ft[w],nt=getComputedStyle(r).getPropertyValue("--morph-duration"),C=[...A.childNodes];if(nt){const rt=[...r.childNodes];rt.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old")}),C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("new")}),r.append(...C),setTimeout(()=>{C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("in")})},10);const j={element:r,pathname:a,isCached:N,state:s};K.dispatchEvent(document,"morphBeforeElementOut",{detail:j});const at=setTimeout(()=>{rt.forEach(d=>d.remove()),C.forEach(d=>{d instanceof HTMLElement&&(d.classList.remove("new","in"),d.classList.add("current"))}),K.dispatchEvent(document,"morphAfterElementOut",{detail:j}),c(this,v,e(this,v).filter(d=>d!==at))},(parseFloat(nt)||0)*1e3+10);e(this,v).push(at)}else r.innerHTML="",r.append(...C)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",a),document.documentElement.setAttribute("data-current-leaf",P),($=this.postprocessor)==null||$.call(this,{pathname:a,isCached:N,state:s}),K.dispatchEvent(document,"morphAfterNavigation",{detail:{pathname:a,isCached:N,state:s}}),dt.loading.complete("__morph")}catch(F){console.error(F)}c(this,b,void 0)})}addLink(t){e(this,E).push(new lt(t,this))}addLinks(t){t.forEach(i=>{this.addLink(i)})}removeLink(t){c(this,E,e(this,E).filter(i=>i.element===t?(i.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var s;return((s=i.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")&&!i.closest("[data-morph-skip]")});e(this,E).forEach(i=>i.destroy()),c(this,E,t.map(i=>new lt(i,this)))}}I=new WeakMap,O=new WeakMap,R=new WeakMap,S=new WeakMap,E=new WeakMap,Y=new WeakMap,M=new WeakMap,b=new WeakMap,g=new WeakMap,_=new WeakMap,B=new WeakMap,v=new WeakMap,m=new WeakSet,U=function(t){return z(this,null,function*(){const i=e(this,M).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),u=e(this,Y).parseFromString(l,"text/html");return e(this,R)&&e(this,M).set(t,u),u})},X=function(t){const i=[...t.querySelectorAll("[data-morph]")];return i.length?i:[t]},ut=function(t,i){return t.filter(s=>i.find(l=>l.outerHTML===s.outerHTML))},Z=function(t,i){return t.filter(s=>!i.find(l=>l.outerHTML===s.outerHTML))},G=new WeakMap;exports.Morph=gt;
|
package/lib/morph/index.js
CHANGED
|
@@ -6,23 +6,23 @@ var e = (n, t, s) => (J(n, t, "read from private field"), s ? s.call(n) : t.get(
|
|
|
6
6
|
var z = (n, t, s) => new Promise((i, l) => {
|
|
7
7
|
var u = (f) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
g(s.next(f));
|
|
10
10
|
} catch (b) {
|
|
11
11
|
l(b);
|
|
12
12
|
}
|
|
13
13
|
}, r = (f) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
15
|
+
g(s.throw(f));
|
|
16
16
|
} catch (b) {
|
|
17
17
|
l(b);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, g = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(u, r);
|
|
20
|
+
g((s = s.apply(n, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var ht = (n, t, s) => (t = n[rt("asyncIterator")]) ? t.call(n) : (n = n[rt("iterator")](), t = {}, s = (i, l) => (l = n[i]) && (t[i] = (u) => new Promise((r,
|
|
22
|
+
var ht = (n, t, s) => (t = n[rt("asyncIterator")]) ? t.call(n) : (n = n[rt("iterator")](), t = {}, s = (i, l) => (l = n[i]) && (t[i] = (u) => new Promise((r, g, f) => (u = l.call(n, u), f = u.done, Promise.resolve(u.value).then((b) => r({ value: b, done: f }), g)))), s("next"), s("return"), t);
|
|
23
23
|
import { i as pt } from "../browser-0zX67oeU.js";
|
|
24
24
|
import { d as V } from "../events-CsVF98U6.js";
|
|
25
|
-
import { n as Lt, c as ct, s as
|
|
25
|
+
import { n as Lt, c as ct, s as gt } from "../url-B5eH5z6S.js";
|
|
26
26
|
import { loading as dt } from "../loading/index.js";
|
|
27
27
|
var T, h, p, x, D, H, I, M;
|
|
28
28
|
class lt {
|
|
@@ -50,7 +50,7 @@ class lt {
|
|
|
50
50
|
"data-history-action"
|
|
51
51
|
) || "push"), c(this, D, e(this, h).getAttribute("data-state") || void 0), e(this, h).addEventListener("click", e(this, I));
|
|
52
52
|
const i = s.normalizePath(e(this, p)), l = s.normalizePath(location.pathname);
|
|
53
|
-
c(this, H, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((
|
|
53
|
+
c(this, H, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((g) => s.normalizePath(g.trim()).pathname)), e(this, h).hasAttribute("data-include") ? l.pathname.includes(i.pathname) && e(this, h).classList.add("current") : i.pathname === l.pathname || (r = e(this, H)) != null && r.includes(l.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, M));
|
|
54
54
|
}
|
|
55
55
|
get element() {
|
|
56
56
|
return e(this, h);
|
|
@@ -60,7 +60,7 @@ class lt {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
T = new WeakMap(), h = new WeakMap(), p = new WeakMap(), x = new WeakMap(), D = new WeakMap(), H = new WeakMap(), I = new WeakMap(), M = new WeakMap();
|
|
63
|
-
var R, B, F, N,
|
|
63
|
+
var R, B, F, N, E, Y, k, y, L, O, _, v, m, Q, U, ut, X, j;
|
|
64
64
|
class yt {
|
|
65
65
|
constructor(t) {
|
|
66
66
|
o(this, m);
|
|
@@ -68,7 +68,7 @@ class yt {
|
|
|
68
68
|
o(this, B, null);
|
|
69
69
|
o(this, F, null);
|
|
70
70
|
o(this, N, null);
|
|
71
|
-
o(this,
|
|
71
|
+
o(this, E, []);
|
|
72
72
|
o(this, Y, new DOMParser());
|
|
73
73
|
o(this, k, /* @__PURE__ */ new Map());
|
|
74
74
|
o(this, y);
|
|
@@ -108,10 +108,10 @@ class yt {
|
|
|
108
108
|
return e(this, _);
|
|
109
109
|
}
|
|
110
110
|
get links() {
|
|
111
|
-
return e(this,
|
|
111
|
+
return e(this, E);
|
|
112
112
|
}
|
|
113
113
|
normalizePath(t) {
|
|
114
|
-
return
|
|
114
|
+
return gt(t, e(this, R));
|
|
115
115
|
}
|
|
116
116
|
prefetch(t) {
|
|
117
117
|
return z(this, null, function* () {
|
|
@@ -125,7 +125,7 @@ class yt {
|
|
|
125
125
|
if (e(this, v).length)
|
|
126
126
|
return;
|
|
127
127
|
const u = this.normalizePath(t);
|
|
128
|
-
let { pathname: r, hash:
|
|
128
|
+
let { pathname: r, hash: g, parameters: f, leaf: b } = u;
|
|
129
129
|
if (e(this, y) === r || e(this, L) === r)
|
|
130
130
|
return;
|
|
131
131
|
c(this, _, i), c(this, y, r);
|
|
@@ -165,7 +165,7 @@ class yt {
|
|
|
165
165
|
document.head.appendChild(a);
|
|
166
166
|
});
|
|
167
167
|
const G = W.filter(
|
|
168
|
-
(a) => (a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK") && a.getAttribute("rel") !== "canonical"
|
|
168
|
+
(a) => !a.hasAttribute("data-no-waiting") && (a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK") && a.getAttribute("rel") !== "canonical"
|
|
169
169
|
);
|
|
170
170
|
e(this, B) && G.length && (yield new Promise((a) => z(this, null, function* () {
|
|
171
171
|
let A = 0;
|
|
@@ -188,7 +188,7 @@ class yt {
|
|
|
188
188
|
}
|
|
189
189
|
}))), mt.forEach((a) => {
|
|
190
190
|
a.hasAttribute("data-permanent") || a.remove();
|
|
191
|
-
}), c(this, O, e(this, L)), c(this, L, r), ct(s, r, f,
|
|
191
|
+
}), c(this, O, e(this, L)), c(this, L, r), ct(s, r, f, g);
|
|
192
192
|
const ft = P(this, m, U).call(this, $.body.cloneNode(!0));
|
|
193
193
|
e(this, v).forEach((a) => clearTimeout(a)), c(this, v, []), e(this, N).forEach((a, A) => {
|
|
194
194
|
const w = ft[A], it = getComputedStyle(a).getPropertyValue("--morph-duration"), S = [...w.childNodes];
|
|
@@ -236,7 +236,7 @@ class yt {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
addLink(t) {
|
|
239
|
-
e(this,
|
|
239
|
+
e(this, E).push(new lt(t, this));
|
|
240
240
|
}
|
|
241
241
|
addLinks(t) {
|
|
242
242
|
t.forEach((s) => {
|
|
@@ -244,7 +244,7 @@ class yt {
|
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
removeLink(t) {
|
|
247
|
-
c(this,
|
|
247
|
+
c(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
248
248
|
}
|
|
249
249
|
findLinks() {
|
|
250
250
|
const t = [
|
|
@@ -255,10 +255,10 @@ class yt {
|
|
|
255
255
|
return ((i = s.getAttribute("href")) == null ? void 0 : i.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
|
-
e(this,
|
|
258
|
+
e(this, E).forEach((s) => s.destroy()), c(this, E, t.map((s) => new lt(s, this)));
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
R = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(),
|
|
261
|
+
R = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(), E = new WeakMap(), Y = new WeakMap(), k = new WeakMap(), y = new WeakMap(), L = new WeakMap(), O = new WeakMap(), _ = new WeakMap(), v = new WeakMap(), m = new WeakSet(), Q = function(t) {
|
|
262
262
|
return z(this, null, function* () {
|
|
263
263
|
const s = e(this, k).get(t);
|
|
264
264
|
if (s)
|