aptechka 0.1.12 → 0.1.15
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-Fy7tHx4d.js +33 -0
- package/lib/Damped-mdFs8WSd.cjs +1 -0
- package/lib/{WheelControls-CX9WUbBC.js → WheelControls-BN4XGOpG.js} +29 -34
- package/lib/WheelControls-Dc1xcVG6.cjs +1 -0
- package/lib/animation/Tweened.d.ts +0 -1
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +20 -26
- package/lib/component/Component.d.ts +7 -3
- package/lib/component/hooks/custom-element.d.ts +2 -0
- package/lib/component/index.cjs +1 -1
- package/lib/component/index.d.ts +2 -1
- package/lib/component/index.js +174 -139
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +20 -23
- package/lib/en3/{test → core}/En3Raycaster.d.ts +1 -1
- package/lib/en3/core/en3.d.ts +2 -0
- package/lib/en3/index.cjs +7 -7
- package/lib/en3/index.d.ts +1 -1
- package/lib/en3/index.js +540 -523
- package/lib/index-B-ZmkQyB.cjs +9 -0
- package/lib/{index-BWTXnG5n.js → index-Dizn7btU.js} +96 -96
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.d.ts +15 -0
- package/lib/layout-box/index.js +102 -93
- package/lib/morph/Morph.d.ts +1 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +130 -122
- package/lib/object-BZELAoVj.cjs +1 -0
- package/lib/object-R34VLqhp.js +85 -0
- package/lib/order/index.cjs +1 -1
- package/lib/order/index.d.ts +1 -0
- package/lib/order/index.js +1 -1
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +50 -50
- package/lib/resized/index.d.ts +11 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +101 -105
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +2 -2
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/studio/index.cjs +1 -1
- package/lib/studio/index.js +1 -1
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +15 -14
- package/lib/utils/object.d.ts +1 -0
- package/package.json +1 -1
- package/lib/Damped-BwpMU9Gi.cjs +0 -1
- package/lib/Damped-urvryQLo.js +0 -36
- package/lib/WheelControls-CfDeGCOU.cjs +0 -1
- package/lib/component/hooks/shadow.d.ts +0 -1
- package/lib/index-3G1lTMEf.cjs +0 -9
- package/lib/object-C1ph624j.cjs +0 -1
- package/lib/object-DIPjdukP.js +0 -73
package/lib/layout-box/index.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
var
|
|
2
|
-
if (!
|
|
3
|
-
throw TypeError("Cannot " +
|
|
1
|
+
var k = (i, e, s) => {
|
|
2
|
+
if (!e.has(i))
|
|
3
|
+
throw TypeError("Cannot " + s);
|
|
4
4
|
};
|
|
5
|
-
var t = (i,
|
|
6
|
-
if (
|
|
5
|
+
var t = (i, e, s) => (k(i, e, "read from private field"), s ? s.call(i) : e.get(i)), h = (i, e, s) => {
|
|
6
|
+
if (e.has(i))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
-
|
|
9
|
-
}, n = (i,
|
|
10
|
-
var L = (i,
|
|
8
|
+
e instanceof WeakSet ? e.add(i) : e.set(i, s);
|
|
9
|
+
}, n = (i, e, s, o) => (k(i, e, "write to private field"), o ? o.call(i, s) : e.set(i, s), s);
|
|
10
|
+
var L = (i, e, s) => (k(i, e, "access private method"), s);
|
|
11
11
|
import { cssUnitParser as lt } from "../css-unit-parser/index.js";
|
|
12
|
-
import { Ladder as
|
|
12
|
+
import { Ladder as K } from "../ladder/index.js";
|
|
13
13
|
import { TICK_ORDER as G } from "../order/index.js";
|
|
14
14
|
import { windowResizer as J } from "../window-resizer/index.js";
|
|
15
15
|
import { scrollEntries as ot } from "../scroll-entries/index.js";
|
|
16
16
|
import { ticker as N } from "../ticker/index.js";
|
|
17
17
|
import { i as Q } from "../browser-0zX67oeU.js";
|
|
18
18
|
import { g as j } from "../dom-BY7JhTx5.js";
|
|
19
|
-
import { g as
|
|
19
|
+
import { g as I, a as $ } from "../layout-HoBT_Da2.js";
|
|
20
20
|
function at(i) {
|
|
21
|
-
const
|
|
21
|
+
const e = Math.sqrt(
|
|
22
22
|
i.m11 * i.m11 + i.m12 * i.m12 + i.m13 * i.m13
|
|
23
|
-
),
|
|
23
|
+
), s = Math.sqrt(
|
|
24
24
|
i.m21 * i.m21 + i.m22 * i.m22 + i.m23 * i.m23
|
|
25
|
-
),
|
|
25
|
+
), o = Math.sqrt(
|
|
26
26
|
i.m31 * i.m31 + i.m32 * i.m32 + i.m33 * i.m33
|
|
27
27
|
), E = Math.atan2(i.m32, i.m33), H = Math.atan2(
|
|
28
28
|
-i.m31,
|
|
29
29
|
Math.sqrt(i.m32 * i.m32 + i.m33 * i.m33)
|
|
30
|
-
),
|
|
30
|
+
), U = Math.atan2(i.m21, i.m11), u = i.m41, C = i.m42, b = i.m43;
|
|
31
31
|
return {
|
|
32
|
-
scaleX:
|
|
33
|
-
scaleY:
|
|
34
|
-
scaleZ:
|
|
32
|
+
scaleX: e,
|
|
33
|
+
scaleY: s,
|
|
34
|
+
scaleZ: o,
|
|
35
35
|
rotationX: E,
|
|
36
36
|
rotationY: H,
|
|
37
|
-
rotationZ:
|
|
37
|
+
rotationZ: U,
|
|
38
38
|
translationX: u,
|
|
39
39
|
translationY: C,
|
|
40
40
|
translationZ: b
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
var a,
|
|
43
|
+
var a, p, f, _, R, O, v, x, T, y, M, P, S, d, w, X, Y, Z, m, z, g, c, r, l, A, F, B, tt, V, et, D, st, W, q;
|
|
44
44
|
class Mt {
|
|
45
|
-
constructor(
|
|
45
|
+
constructor(e, s) {
|
|
46
46
|
h(this, A);
|
|
47
47
|
h(this, B);
|
|
48
|
+
h(this, V);
|
|
48
49
|
h(this, D);
|
|
49
|
-
h(this, U);
|
|
50
50
|
h(this, a, null);
|
|
51
|
-
h(this,
|
|
52
|
-
h(this,
|
|
51
|
+
h(this, p, null);
|
|
52
|
+
h(this, f, []);
|
|
53
53
|
h(this, _, "auto");
|
|
54
54
|
h(this, R, "top");
|
|
55
55
|
h(this, O, !1);
|
|
56
56
|
h(this, v, !0);
|
|
57
57
|
h(this, x, !0);
|
|
58
58
|
h(this, T, !0);
|
|
59
|
-
h(this,
|
|
59
|
+
h(this, y, 0);
|
|
60
60
|
h(this, M, 0);
|
|
61
61
|
h(this, P, 0);
|
|
62
62
|
h(this, S, 0);
|
|
@@ -65,19 +65,19 @@ class Mt {
|
|
|
65
65
|
h(this, X, 0);
|
|
66
66
|
h(this, Y, 0);
|
|
67
67
|
h(this, Z, 0);
|
|
68
|
-
h(this,
|
|
68
|
+
h(this, m, { x: 0, y: 0, z: 0 });
|
|
69
69
|
h(this, z, { x: 0, y: 0, z: 0 });
|
|
70
|
-
h(this,
|
|
71
|
-
h(this, c, new
|
|
72
|
-
h(this, r, new
|
|
73
|
-
h(this,
|
|
70
|
+
h(this, g, { x: 1, y: 1, z: 1 });
|
|
71
|
+
h(this, c, new K({ x: 0, y: 0, z: 0 }));
|
|
72
|
+
h(this, r, new K({ x: 0, y: 0, z: 0 }));
|
|
73
|
+
h(this, l, new K({ x: 0, y: 0, z: 0 }));
|
|
74
74
|
h(this, W, () => {
|
|
75
|
-
Q && L(this,
|
|
75
|
+
Q && L(this, V, et).call(this);
|
|
76
76
|
});
|
|
77
77
|
h(this, q, () => {
|
|
78
|
-
L(this,
|
|
78
|
+
L(this, D, st).call(this), L(this, A, F).call(this);
|
|
79
79
|
});
|
|
80
|
-
Q && (n(this, a, j(
|
|
80
|
+
Q && (n(this, a, j(e) || document.body), n(this, p, j(s == null ? void 0 : s.containerElement) || document.body), n(this, _, (s == null ? void 0 : s.scrollAxis) || "auto"), n(this, R, (s == null ? void 0 : s.frontSide) || "top"), n(this, O, (s == null ? void 0 : s.cartesian) || !1), n(this, v, (s == null ? void 0 : s.sizeStep) !== void 0 ? s.sizeStep : !0), n(this, x, (s == null ? void 0 : s.positionStep) !== void 0 ? s.positionStep : !0), n(this, T, (s == null ? void 0 : s.transformStep) !== void 0 ? s.transformStep : !0), t(this, l).setStep("_size", "+", {
|
|
81
81
|
x: 1,
|
|
82
82
|
y: 1,
|
|
83
83
|
z: 1
|
|
@@ -85,7 +85,7 @@ class Mt {
|
|
|
85
85
|
x: 0,
|
|
86
86
|
y: 0,
|
|
87
87
|
z: 0
|
|
88
|
-
}), t(this,
|
|
88
|
+
}), t(this, l).setStep("_scale", "*", {
|
|
89
89
|
x: 1,
|
|
90
90
|
y: 1,
|
|
91
91
|
z: 1
|
|
@@ -98,19 +98,19 @@ class Mt {
|
|
|
98
98
|
y: 0,
|
|
99
99
|
z: 0
|
|
100
100
|
}), addEventListener("DOMContentLoaded", () => {
|
|
101
|
-
ot.getAll(this.element).forEach((
|
|
102
|
-
this.setScrollStep(() =>
|
|
101
|
+
ot.getAll(this.element).forEach((o) => {
|
|
102
|
+
this.setScrollStep(() => o);
|
|
103
103
|
});
|
|
104
104
|
}), N.subscribe(t(this, q), {
|
|
105
105
|
order: G.LAYOUT_BOX,
|
|
106
|
-
culling:
|
|
106
|
+
culling: s != null && s.culling ? this.element : void 0
|
|
107
107
|
}), J.subscribe(t(this, W), G.LAYOUT_BOX));
|
|
108
108
|
}
|
|
109
109
|
get element() {
|
|
110
110
|
return t(this, a);
|
|
111
111
|
}
|
|
112
112
|
get containerElement() {
|
|
113
|
-
return t(this,
|
|
113
|
+
return t(this, p);
|
|
114
114
|
}
|
|
115
115
|
get position() {
|
|
116
116
|
return t(this, r).current;
|
|
@@ -119,7 +119,7 @@ class Mt {
|
|
|
119
119
|
return t(this, c).current;
|
|
120
120
|
}
|
|
121
121
|
get scale() {
|
|
122
|
-
return t(this,
|
|
122
|
+
return t(this, l).current;
|
|
123
123
|
}
|
|
124
124
|
get left() {
|
|
125
125
|
return t(this, d);
|
|
@@ -131,7 +131,7 @@ class Mt {
|
|
|
131
131
|
return t(this, w);
|
|
132
132
|
}
|
|
133
133
|
get width() {
|
|
134
|
-
return t(this,
|
|
134
|
+
return t(this, y);
|
|
135
135
|
}
|
|
136
136
|
get height() {
|
|
137
137
|
return t(this, M);
|
|
@@ -139,68 +139,77 @@ class Mt {
|
|
|
139
139
|
get depth() {
|
|
140
140
|
return t(this, P);
|
|
141
141
|
}
|
|
142
|
-
bindObject(
|
|
143
|
-
|
|
142
|
+
bindObject(e) {
|
|
143
|
+
e.position && t(this, r).bind(e.position), e.rotation && t(this, c).bind(e.rotation), e.scale && t(this, l).bind(e.scale);
|
|
144
144
|
}
|
|
145
|
-
unbindObject(
|
|
146
|
-
|
|
145
|
+
unbindObject(e) {
|
|
146
|
+
e.position && t(this, r).unbind(e.position), e.rotation && t(this, c).unbind(e.rotation), e.scale && t(this, l).unbind(e.scale);
|
|
147
147
|
}
|
|
148
|
-
setScrollStep(
|
|
149
|
-
return t(this,
|
|
148
|
+
setScrollStep(e) {
|
|
149
|
+
return t(this, f).includes(e) || t(this, f).push(e), () => this.deleteScrollStep(e);
|
|
150
150
|
}
|
|
151
|
-
deleteScrollStep(
|
|
152
|
-
n(this,
|
|
153
|
-
(
|
|
151
|
+
deleteScrollStep(e) {
|
|
152
|
+
n(this, f, t(this, f).filter(
|
|
153
|
+
(s) => s !== e
|
|
154
154
|
));
|
|
155
155
|
}
|
|
156
156
|
destroy() {
|
|
157
|
-
N.unsubscribe(t(this, q)), J.unsubscribe(t(this, W)), t(this, r).close(), t(this, c).close(), t(this,
|
|
157
|
+
N.unsubscribe(t(this, q)), J.unsubscribe(t(this, W)), t(this, r).close(), t(this, c).close(), t(this, l).close();
|
|
158
158
|
}
|
|
159
|
-
setPositionStep(...
|
|
160
|
-
t(this, r).setStep(...
|
|
159
|
+
setPositionStep(...e) {
|
|
160
|
+
t(this, r).setStep(...e);
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
t(this,
|
|
162
|
+
getPositionStep(...e) {
|
|
163
|
+
return t(this, r).getStepValue(...e);
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
t(this,
|
|
165
|
+
setRotationStep(...e) {
|
|
166
|
+
t(this, c).setStep(...e);
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
t(this,
|
|
168
|
+
getRotationStep(...e) {
|
|
169
|
+
return t(this, c).getStepValue(...e);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
t(this,
|
|
171
|
+
setScaleStep(...e) {
|
|
172
|
+
t(this, l).setStep(...e);
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
t(this,
|
|
174
|
+
getScaleStep(...e) {
|
|
175
|
+
return t(this, l).getStepValue(...e);
|
|
176
|
+
}
|
|
177
|
+
deletePositionStep(...e) {
|
|
178
|
+
t(this, r).deleteStep(...e);
|
|
179
|
+
}
|
|
180
|
+
deleteRotationStep(...e) {
|
|
181
|
+
t(this, c).deleteStep(...e);
|
|
182
|
+
}
|
|
183
|
+
deleteScaleStep(...e) {
|
|
184
|
+
t(this, l).deleteStep(...e);
|
|
176
185
|
}
|
|
177
186
|
}
|
|
178
|
-
a = new WeakMap(),
|
|
179
|
-
t(this,
|
|
187
|
+
a = new WeakMap(), p = new WeakMap(), f = new WeakMap(), _ = new WeakMap(), R = new WeakMap(), O = new WeakMap(), v = new WeakMap(), x = new WeakMap(), T = new WeakMap(), y = new WeakMap(), M = new WeakMap(), P = new WeakMap(), S = new WeakMap(), d = new WeakMap(), w = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), Z = new WeakMap(), m = new WeakMap(), z = new WeakMap(), g = new WeakMap(), c = new WeakMap(), r = new WeakMap(), l = new WeakMap(), A = new WeakSet(), F = function() {
|
|
188
|
+
t(this, l).calculate(), t(this, r).calculate(), t(this, c).calculate();
|
|
180
189
|
}, B = new WeakSet(), tt = function() {
|
|
181
|
-
t(this,
|
|
182
|
-
x: t(this, v) ? t(this,
|
|
190
|
+
t(this, l).setStep("_size", "+", {
|
|
191
|
+
x: t(this, v) ? t(this, y) : 1,
|
|
183
192
|
y: t(this, v) ? t(this, M) : 1,
|
|
184
193
|
z: t(this, v) ? t(this, P) : 1
|
|
185
194
|
});
|
|
186
|
-
const
|
|
195
|
+
const e = t(this, x) ? t(this, X) : 0, s = t(this, x) ? t(this, Y) : 0, o = t(this, x) ? t(this, Z) : 0;
|
|
187
196
|
t(this, r).setStep("_position", "+", {
|
|
188
|
-
x:
|
|
189
|
-
y:
|
|
190
|
-
z:
|
|
191
|
-
}), t(this, T) ? (t(this,
|
|
192
|
-
x: t(this,
|
|
193
|
-
y: t(this,
|
|
194
|
-
z: t(this,
|
|
197
|
+
x: e,
|
|
198
|
+
y: s,
|
|
199
|
+
z: o
|
|
200
|
+
}), t(this, T) ? (t(this, l).setStep("_scale", "*", {
|
|
201
|
+
x: t(this, g).x,
|
|
202
|
+
y: t(this, g).y,
|
|
203
|
+
z: t(this, g).z
|
|
195
204
|
}), t(this, r).setStep("_translation", "+", {
|
|
196
|
-
x: t(this,
|
|
197
|
-
y: t(this,
|
|
198
|
-
z: t(this,
|
|
205
|
+
x: t(this, m).x,
|
|
206
|
+
y: t(this, m).y,
|
|
207
|
+
z: t(this, m).z
|
|
199
208
|
}), t(this, c).setStep("_rotation", "+", {
|
|
200
209
|
x: t(this, z).x,
|
|
201
210
|
y: t(this, z).y,
|
|
202
211
|
z: t(this, z).z
|
|
203
|
-
})) : (t(this,
|
|
212
|
+
})) : (t(this, l).setStep("_scale", "*", {
|
|
204
213
|
x: 1,
|
|
205
214
|
y: 1,
|
|
206
215
|
z: 1
|
|
@@ -213,31 +222,31 @@ a = new WeakMap(), f = new WeakMap(), m = new WeakMap(), _ = new WeakMap(), R =
|
|
|
213
222
|
y: 0,
|
|
214
223
|
z: 0
|
|
215
224
|
}));
|
|
216
|
-
},
|
|
217
|
-
const
|
|
218
|
-
n(this,
|
|
219
|
-
lt.parse(
|
|
225
|
+
}, V = new WeakSet(), et = function() {
|
|
226
|
+
const e = getComputedStyle(t(this, a));
|
|
227
|
+
n(this, y, Math.max(t(this, a).clientWidth, 1)), n(this, M, Math.max(t(this, a).clientHeight, 1)), n(this, P, Math.max(
|
|
228
|
+
lt.parse(e.getPropertyValue("--depth") || "0px"),
|
|
220
229
|
1
|
|
221
230
|
));
|
|
222
|
-
const
|
|
223
|
-
if (n(this, d,
|
|
231
|
+
const s = I(t(this, p)), o = $(t(this, p)), E = t(this, p).clientWidth, H = t(this, p).clientHeight;
|
|
232
|
+
if (n(this, d, I(t(this, a)) - s), n(this, S, $(t(this, a)) - o), t(this, _) === "z") {
|
|
224
233
|
const C = t(this, d) / E, b = t(this, S) / H;
|
|
225
|
-
n(this, d, (C - Math.floor(C)) * E), n(this, S, (b - Math.floor(b)) * H), t(this, R) === "left" ? n(this, w,
|
|
234
|
+
n(this, d, (C - Math.floor(C)) * E), n(this, S, (b - Math.floor(b)) * H), t(this, R) === "left" ? n(this, w, I(t(this, a)) - s - t(this, d)) : n(this, w, $(t(this, a)) - o - t(this, S));
|
|
226
235
|
}
|
|
227
236
|
if (n(this, d, t(this, d) + t(this, a).clientLeft), n(this, S, t(this, S) + t(this, a).clientTop), t(this, O)) {
|
|
228
|
-
const C = Math.round(E / 2), b = Math.round(H / 2), it = t(this,
|
|
237
|
+
const C = Math.round(E / 2), b = Math.round(H / 2), it = t(this, y) ? Math.round(t(this, y) / 2) : 0, ht = t(this, M) ? Math.round(t(this, M) / 2) : 0, nt = t(this, d) - C + it, rt = (t(this, S) - b + ht) * -1;
|
|
229
238
|
n(this, X, nt), n(this, Y, rt);
|
|
230
239
|
} else
|
|
231
240
|
n(this, X, t(this, d)), n(this, Y, t(this, S));
|
|
232
241
|
n(this, Z, t(this, w) * -1);
|
|
233
|
-
const
|
|
234
|
-
t(this,
|
|
235
|
-
},
|
|
236
|
-
for (let
|
|
237
|
-
const
|
|
238
|
-
let
|
|
239
|
-
t(this, _) !== "auto" && (
|
|
240
|
-
[
|
|
242
|
+
const U = new WebKitCSSMatrix(e.transform), u = at(U);
|
|
243
|
+
t(this, m).x = u.translationX, t(this, m).y = u.translationY, t(this, m).z = u.translationZ, t(this, g).x = u.scaleX, t(this, g).y = u.scaleY, t(this, g).z = u.scaleZ, t(this, z).x = u.rotationX, t(this, z).y = u.rotationY, t(this, z).z = u.rotationZ, L(this, B, tt).call(this), L(this, A, F).call(this);
|
|
244
|
+
}, D = new WeakSet(), st = function() {
|
|
245
|
+
for (let e = 0; e < t(this, f).length; e++) {
|
|
246
|
+
const s = t(this, f)[e]();
|
|
247
|
+
let o = s.axis;
|
|
248
|
+
t(this, _) !== "auto" && (o = t(this, _)), t(this, r).setStep(`_scroll_${e}`, "+", {
|
|
249
|
+
[o]: s.value * (o === "x" ? -1 : t(this, O) ? 1 : -1)
|
|
241
250
|
});
|
|
242
251
|
}
|
|
243
252
|
}, W = new WeakMap(), q = new WeakMap();
|
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -22,5 +22,6 @@ export declare class Morph {
|
|
|
22
22
|
constructor(parameters?: MorphParameters);
|
|
23
23
|
beforeNavigationEvent(callback: MorphNavigationCallback): () => void;
|
|
24
24
|
afterNavigationEvent(callback: MorphNavigationCallback): () => void;
|
|
25
|
+
prefetch(pathname: string): Promise<Document>;
|
|
25
26
|
navigate(pathname: string, historyAction?: MorphHistoryAction): Promise<void>;
|
|
26
27
|
}
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var V=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s);var m=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var i=(s,t,e)=>(m(s,t,"read from private field"),e?e.call(s):t.get(s)),n=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},r=(s,t,e,o)=>(m(s,t,"write to private field"),o?o.call(s,e):t.set(s,e),e);var f=(s,t,e)=>(m(s,t,"access private method"),e);var T=(s,t,e)=>new Promise((o,c)=>{var l=u=>{try{g(e.next(u))}catch(v){c(v)}},y=u=>{try{g(e.throw(u))}catch(v){c(v)}},g=u=>u.done?o(u.value):Promise.resolve(u.value).then(l,y);g((e=e.apply(s,t)).next())});var X=(s,t,e)=>(t=s[V("asyncIterator")])?t.call(s):(s=s[V("iterator")](),t={},e=(o,c)=>(c=s[o])&&(t[o]=l=>new Promise((y,g,u)=>(l=c.call(s,l),u=l.done,Promise.resolve(l.value).then(v=>y({value:v,done:u}),g)))),e("next"),e("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("../notifier/index.cjs"),st=require("../browser-CpzFX2xg.cjs");var M,d,w,N,P,S;class nt{constructor(t,e){n(this,M,void 0);n(this,d,void 0);n(this,w,void 0);n(this,N,void 0);n(this,P,t=>{t.preventDefault(),i(this,M).navigate(i(this,w),i(this,N))});n(this,S,()=>{i(this,M).prefetch(i(this,w))});r(this,M,e),r(this,d,t),r(this,w,i(this,d).getAttribute("href")||"/"),r(this,N,i(this,d).getAttribute("data-history-action")||"push"),i(this,d).addEventListener("click",i(this,P)),i(this,w)===location.pathname&&i(this,d).classList.add("current"),i(this,d).hasAttribute("data-prefetch")&&i(this,d).addEventListener("pointerenter",i(this,S))}destroy(){i(this,d).removeEventListener("click",i(this,P)),i(this,d).removeEventListener("pointerenter",i(this,S)),i(this,d).classList.remove("current")}}M=new WeakMap,d=new WeakMap,w=new WeakMap,N=new WeakMap,P=new WeakMap,S=new WeakMap;var a,k,A,C,x,j,E,L,H,D,q,R,z,B,$,W,G,F,J,K,p,O,Q,Y;class ot{constructor(t){n(this,R);n(this,B);n(this,W);n(this,F);n(this,K);n(this,O);n(this,a,null);n(this,k,null);n(this,A,null);n(this,C,null);n(this,x,[]);n(this,j,new DOMParser);n(this,E,new Map);n(this,L,void 0);n(this,H,null);n(this,D,new Z.Notifier);n(this,q,new Z.Notifier);n(this,Y,t=>{t.state&&this.navigate(t.state,"none")});st.isBrowser&&(r(this,a,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(r(this,a,t.base),t.base.endsWith("/")||r(this,a,i(this,a)+"/")):r(this,a,"/"),r(this,k,(t==null?void 0:t.waitForHeadToLoad)!==!1),r(this,A,(t==null?void 0:t.cachePages)!==!1),r(this,C,f(this,F,J).call(this,document)),r(this,H,location.pathname),f(this,W,G).call(this),addEventListener("popstate",i(this,Y)))}beforeNavigationEvent(t){return i(this,D).subscribe(t)}afterNavigationEvent(t){return i(this,q).subscribe(t)}prefetch(t){return T(this,null,function*(){return f(this,R,z).call(this,t)})}navigate(t,e="push"){return T(this,null,function*(){var c;if(t=f(this,B,$).call(this,t),i(this,L)===t||i(this,H)===t)return;r(this,L,t);const o=i(this,E).has(t);try{let l=!0;if(this.preprocessor)try{yield new Promise((h,b)=>{var I;(I=this.preprocessor)==null||I.call(this,{pathname:t,resolve:h,reject:b,isCached:o})})}catch(h){h?console.error(h):console.log("Route change canceled"),l=!1}if(i(this,D).notify({pathname:t,isCached:o}),!l||i(this,L)!==t)return;const y=i(this,E).get(t)||(yield f(this,R,z).call(this,t));if(i(this,L)!==t)return;const g=Array.from(document.head.children),u=Array.from(y.head.cloneNode(!0).children),v=f(this,K,p).call(this,g,u),tt=f(this,O,Q).call(this,g,v),U=f(this,O,Q).call(this,u,v);tt.forEach(h=>h.remove()),U.forEach(h=>document.head.appendChild(h));const _=U.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");i(this,k)&&_.length&&(yield new Promise(h=>T(this,null,function*(){let b=0;try{for(var I=X(_),ct,lt,ut;ct=!(lt=yield I.next()).done;ct=!1){const it=lt.value;it.onload=()=>{b++,b===_.length&&h()}}}catch(lt){ut=[lt]}finally{try{ct&&(lt=I.return)&&(yield lt.call(I))}finally{if(ut)throw ut[0]}}})));const et=f(this,F,J).call(this,y);i(this,C).forEach((h,b)=>{const I=et[b];h.innerHTML=I.innerHTML}),r(this,H,t),e==="push"?history.pushState(t,"",t+location.search):e==="replace"&&history.replaceState(t,"",t+location.search),f(this,W,G).call(this),(c=this.postprocessor)==null||c.call(this,{pathname:t,isCached:o}),i(this,q).notify({pathname:t,isCached:o})}catch(l){console.error(l)}r(this,L,void 0)})}}a=new WeakMap,k=new WeakMap,A=new WeakMap,C=new WeakMap,x=new WeakMap,j=new WeakMap,E=new WeakMap,L=new WeakMap,H=new WeakMap,D=new WeakMap,q=new WeakMap,R=new WeakSet,z=function(t){return T(this,null,function*(){const e=i(this,E).get(t);if(e)return e;const c=yield(yield fetch(t)).text(),l=i(this,j).parseFromString(c,"text/html");return i(this,A)&&i(this,E).set(t,l),l})},B=new WeakSet,$=function(t){return t=t.replace(i(this,a),""),t.startsWith("/")&&(t=t.slice(1)),i(this,a)+t},W=new WeakSet,G=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(e=>{var o;return(o=e.getAttribute("href"))==null?void 0:o.startsWith("/")});i(this,x).forEach(e=>e.destroy()),r(this,x,t.map(e=>new nt(e,this)))},F=new WeakSet,J=function(t){const e=t.querySelectorAll("[data-morph]");return e.length?[...e]:[t.body]},K=new WeakSet,p=function(t,e){return t.filter(o=>e.find(c=>c.outerHTML===o.outerHTML))},O=new WeakSet,Q=function(t,e){return t.filter(o=>!e.find(c=>c.outerHTML===o.outerHTML))},Y=new WeakMap;exports.Morph=ot;
|