aptechka 0.1.14 → 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/index.cjs +1 -1
- package/lib/animation/index.js +21 -24
- 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/index.cjs +1 -1
- package/lib/morph/index.js +71 -75
- 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/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;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
var ot = Object.defineProperty;
|
|
2
1
|
var X = (s, t) => (t = Symbol[s]) ? t : Symbol.for("Symbol." + s);
|
|
3
|
-
var
|
|
4
|
-
var j = (s, t, e) => (nt(s, typeof t != "symbol" ? t + "" : t, e), e), z = (s, t, e) => {
|
|
2
|
+
var z = (s, t, e) => {
|
|
5
3
|
if (!t.has(s))
|
|
6
4
|
throw TypeError("Cannot " + e);
|
|
7
5
|
};
|
|
8
|
-
var i = (s, t, e) => (z(s, t, "read from private field"), e ? e.call(s) : t.get(s)),
|
|
6
|
+
var i = (s, t, e) => (z(s, t, "read from private field"), e ? e.call(s) : t.get(s)), n = (s, t, e) => {
|
|
9
7
|
if (t.has(s))
|
|
10
8
|
throw TypeError("Cannot add the same private member more than once");
|
|
11
9
|
t instanceof WeakSet ? t.add(s) : t.set(s, e);
|
|
12
|
-
}, r = (s, t, e,
|
|
10
|
+
}, r = (s, t, e, o) => (z(s, t, "write to private field"), o ? o.call(s, e) : t.set(s, e), e);
|
|
13
11
|
var d = (s, t, e) => (z(s, t, "access private method"), e);
|
|
14
|
-
var T = (s, t, e) => new Promise((
|
|
12
|
+
var T = (s, t, e) => new Promise((o, c) => {
|
|
15
13
|
var l = (f) => {
|
|
16
14
|
try {
|
|
17
15
|
g(e.next(f));
|
|
@@ -24,23 +22,23 @@ var T = (s, t, e) => new Promise((n, c) => {
|
|
|
24
22
|
} catch (L) {
|
|
25
23
|
c(L);
|
|
26
24
|
}
|
|
27
|
-
}, g = (f) => f.done ?
|
|
25
|
+
}, g = (f) => f.done ? o(f.value) : Promise.resolve(f.value).then(l, y);
|
|
28
26
|
g((e = e.apply(s, t)).next());
|
|
29
27
|
});
|
|
30
|
-
var Z = (s, t, e) => (t = s[X("asyncIterator")]) ? t.call(s) : (s = s[X("iterator")](), t = {}, e = (
|
|
28
|
+
var Z = (s, t, e) => (t = s[X("asyncIterator")]) ? t.call(s) : (s = s[X("iterator")](), t = {}, e = (o, c) => (c = s[o]) && (t[o] = (l) => new Promise((y, g, f) => (l = c.call(s, l), f = l.done, Promise.resolve(l.value).then((L) => y({ value: L, done: f }), g)))), e("next"), e("return"), t);
|
|
31
29
|
import { Notifier as _ } from "../notifier/index.js";
|
|
32
|
-
import { i as
|
|
30
|
+
import { i as st } from "../browser-0zX67oeU.js";
|
|
33
31
|
var H, u, E, N, P, S;
|
|
34
|
-
class
|
|
32
|
+
class nt {
|
|
35
33
|
constructor(t, e) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
n(this, H, void 0);
|
|
35
|
+
n(this, u, void 0);
|
|
36
|
+
n(this, E, void 0);
|
|
37
|
+
n(this, N, void 0);
|
|
38
|
+
n(this, P, (t) => {
|
|
41
39
|
t.preventDefault(), i(this, H).navigate(i(this, E), i(this, N));
|
|
42
40
|
});
|
|
43
|
-
|
|
41
|
+
n(this, S, () => {
|
|
44
42
|
i(this, H).prefetch(i(this, E));
|
|
45
43
|
});
|
|
46
44
|
r(this, H, e), r(this, u, t), r(this, E, i(this, u).getAttribute("href") || "/"), r(this, N, i(this, u).getAttribute(
|
|
@@ -52,32 +50,30 @@ class ht {
|
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
H = new WeakMap(), u = new WeakMap(), E = new WeakMap(), N = new WeakMap(), P = new WeakMap(), S = new WeakMap();
|
|
55
|
-
var a, k, A, C, x,
|
|
56
|
-
class
|
|
53
|
+
var a, k, A, C, x, O, w, v, M, D, R, W, G, B, $, m, J, F, Q, K, p, q, U, Y;
|
|
54
|
+
class ct {
|
|
57
55
|
constructor(t) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
o(this, R, new _());
|
|
77
|
-
o(this, K, (t) => {
|
|
56
|
+
n(this, W);
|
|
57
|
+
n(this, B);
|
|
58
|
+
n(this, m);
|
|
59
|
+
n(this, F);
|
|
60
|
+
n(this, K);
|
|
61
|
+
n(this, q);
|
|
62
|
+
n(this, a, null);
|
|
63
|
+
n(this, k, null);
|
|
64
|
+
n(this, A, null);
|
|
65
|
+
n(this, C, null);
|
|
66
|
+
n(this, x, []);
|
|
67
|
+
n(this, O, new DOMParser());
|
|
68
|
+
n(this, w, /* @__PURE__ */ new Map());
|
|
69
|
+
n(this, v, void 0);
|
|
70
|
+
n(this, M, null);
|
|
71
|
+
n(this, D, new _());
|
|
72
|
+
n(this, R, new _());
|
|
73
|
+
n(this, Y, (t) => {
|
|
78
74
|
t.state && this.navigate(t.state, "none");
|
|
79
75
|
});
|
|
80
|
-
|
|
76
|
+
st && (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, d(this, F, Q).call(this, document)), r(this, M, location.pathname), d(this, m, J).call(this), addEventListener("popstate", i(this, Y)));
|
|
81
77
|
}
|
|
82
78
|
beforeNavigationEvent(t) {
|
|
83
79
|
return i(this, D).subscribe(t);
|
|
@@ -93,24 +89,24 @@ class ut {
|
|
|
93
89
|
navigate(t, e = "push") {
|
|
94
90
|
return T(this, null, function* () {
|
|
95
91
|
var c;
|
|
96
|
-
if (t = d(this,
|
|
92
|
+
if (t = d(this, B, $).call(this, t), i(this, v) === t || i(this, M) === t)
|
|
97
93
|
return;
|
|
98
94
|
r(this, v, t);
|
|
99
|
-
const
|
|
95
|
+
const o = i(this, w).has(t);
|
|
100
96
|
try {
|
|
101
97
|
let l = !0;
|
|
102
98
|
if (this.preprocessor)
|
|
103
99
|
try {
|
|
104
100
|
yield new Promise((h, b) => {
|
|
105
|
-
var
|
|
106
|
-
(
|
|
101
|
+
var I;
|
|
102
|
+
(I = this.preprocessor) == null || I.call(this, { pathname: t, resolve: h, reject: b, isCached: o });
|
|
107
103
|
});
|
|
108
104
|
} catch (h) {
|
|
109
105
|
h ? console.error(h) : console.log("Route change canceled"), l = !1;
|
|
110
106
|
}
|
|
111
107
|
if (i(this, D).notify({
|
|
112
108
|
pathname: t,
|
|
113
|
-
isCached:
|
|
109
|
+
isCached: o
|
|
114
110
|
}), !l || i(this, v) !== t)
|
|
115
111
|
return;
|
|
116
112
|
const y = i(this, w).get(t) || (yield d(this, W, G).call(this, t));
|
|
@@ -118,36 +114,36 @@ class ut {
|
|
|
118
114
|
return;
|
|
119
115
|
const g = Array.from(document.head.children), f = Array.from(
|
|
120
116
|
y.head.cloneNode(!0).children
|
|
121
|
-
), L = d(this,
|
|
122
|
-
|
|
123
|
-
const
|
|
117
|
+
), L = d(this, K, p).call(this, g, f), tt = d(this, q, U).call(this, g, L), V = d(this, q, U).call(this, f, L);
|
|
118
|
+
tt.forEach((h) => h.remove()), V.forEach((h) => document.head.appendChild(h));
|
|
119
|
+
const j = V.filter(
|
|
124
120
|
(h) => h.tagName === "STYLE" || h.tagName === "SCRIPT" || h.tagName === "LINK"
|
|
125
121
|
);
|
|
126
|
-
i(this, k) &&
|
|
122
|
+
i(this, k) && j.length && (yield new Promise((h) => T(this, null, function* () {
|
|
127
123
|
let b = 0;
|
|
128
124
|
try {
|
|
129
|
-
for (var
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
b++, b ===
|
|
125
|
+
for (var I = Z(j), ut, dt, at; ut = !(dt = yield I.next()).done; ut = !1) {
|
|
126
|
+
const it = dt.value;
|
|
127
|
+
it.onload = () => {
|
|
128
|
+
b++, b === j.length && h();
|
|
133
129
|
};
|
|
134
130
|
}
|
|
135
|
-
} catch (
|
|
136
|
-
|
|
131
|
+
} catch (dt) {
|
|
132
|
+
at = [dt];
|
|
137
133
|
} finally {
|
|
138
134
|
try {
|
|
139
|
-
|
|
135
|
+
ut && (dt = I.return) && (yield dt.call(I));
|
|
140
136
|
} finally {
|
|
141
|
-
if (
|
|
142
|
-
throw
|
|
137
|
+
if (at)
|
|
138
|
+
throw at[0];
|
|
143
139
|
}
|
|
144
140
|
}
|
|
145
141
|
})));
|
|
146
|
-
const
|
|
142
|
+
const et = d(this, F, Q).call(this, y);
|
|
147
143
|
i(this, C).forEach((h, b) => {
|
|
148
|
-
const
|
|
149
|
-
h.innerHTML =
|
|
150
|
-
}), r(this, M, t), e === "push" ? history.pushState(t, "", t + location.search) : e === "replace" && history.replaceState(t, "", t + location.search), d(this, m, J).call(this), (c = this.postprocessor) == null || c.call(this, { pathname: t, isCached:
|
|
144
|
+
const I = et[b];
|
|
145
|
+
h.innerHTML = I.innerHTML;
|
|
146
|
+
}), r(this, M, t), e === "push" ? history.pushState(t, "", t + location.search) : e === "replace" && history.replaceState(t, "", t + location.search), d(this, m, J).call(this), (c = this.postprocessor) == null || c.call(this, { pathname: t, isCached: o }), i(this, R).notify({ pathname: t, isCached: o });
|
|
151
147
|
} catch (l) {
|
|
152
148
|
console.error(l);
|
|
153
149
|
}
|
|
@@ -155,40 +151,40 @@ class ut {
|
|
|
155
151
|
});
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
|
-
a = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), x = new WeakMap(),
|
|
154
|
+
a = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), x = new WeakMap(), O = new WeakMap(), w = new WeakMap(), v = new WeakMap(), M = new WeakMap(), D = new WeakMap(), R = new WeakMap(), W = new WeakSet(), G = function(t) {
|
|
159
155
|
return T(this, null, function* () {
|
|
160
156
|
const e = i(this, w).get(t);
|
|
161
157
|
if (e)
|
|
162
158
|
return e;
|
|
163
|
-
const c = yield (yield fetch(t)).text(), l = i(this,
|
|
159
|
+
const c = yield (yield fetch(t)).text(), l = i(this, O).parseFromString(c, "text/html");
|
|
164
160
|
return i(this, A) && i(this, w).set(t, l), l;
|
|
165
161
|
});
|
|
166
|
-
},
|
|
162
|
+
}, B = new WeakSet(), $ = function(t) {
|
|
167
163
|
return t = t.replace(i(this, a), ""), t.startsWith("/") && (t = t.slice(1)), i(this, a) + t;
|
|
168
164
|
}, m = new WeakSet(), J = function() {
|
|
169
165
|
const t = [
|
|
170
166
|
...document.documentElement.querySelectorAll("a")
|
|
171
167
|
].filter((e) => {
|
|
172
|
-
var
|
|
173
|
-
return (
|
|
168
|
+
var o;
|
|
169
|
+
return (o = e.getAttribute("href")) == null ? void 0 : o.startsWith("/");
|
|
174
170
|
});
|
|
175
|
-
i(this, x).forEach((e) => e.destroy()), r(this, x, t.map((e) => new
|
|
171
|
+
i(this, x).forEach((e) => e.destroy()), r(this, x, t.map((e) => new nt(e, this)));
|
|
176
172
|
}, F = new WeakSet(), Q = function(t) {
|
|
177
173
|
const e = t.querySelectorAll("[data-morph]");
|
|
178
174
|
return e.length ? [...e] : [t.body];
|
|
179
|
-
},
|
|
175
|
+
}, K = new WeakSet(), p = function(t, e) {
|
|
180
176
|
return t.filter(
|
|
181
|
-
(
|
|
182
|
-
(c) => c.outerHTML ===
|
|
177
|
+
(o) => e.find(
|
|
178
|
+
(c) => c.outerHTML === o.outerHTML
|
|
183
179
|
)
|
|
184
180
|
);
|
|
185
|
-
},
|
|
181
|
+
}, q = new WeakSet(), U = function(t, e) {
|
|
186
182
|
return t.filter(
|
|
187
|
-
(
|
|
188
|
-
(c) => c.outerHTML ===
|
|
183
|
+
(o) => !e.find(
|
|
184
|
+
(c) => c.outerHTML === o.outerHTML
|
|
189
185
|
)
|
|
190
186
|
);
|
|
191
|
-
},
|
|
187
|
+
}, Y = new WeakMap();
|
|
192
188
|
export {
|
|
193
|
-
|
|
189
|
+
ct as Morph
|
|
194
190
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function s(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function c(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Node)return e;const t=Array.isArray(e)?[]:{};for(const r in e)e.hasOwnProperty(r)&&(t[r]=c(e[r]));return t}function f(e,t,r=s){for(const n in t)r(t[n])?(e[n]||Object.assign(e,{[n]:{}}),f(e[n],t[n],r)):Object.assign(e,{[n]:t[n]});return e}function u(e){return e===null||typeof e=="undefined"}function i(e,t){if(typeof e!=typeof t)return!1;if([e,t].some(r=>u(r)))return e===t;if(Array.isArray(e)){const r=e.length>t.length?e:t,n=e.length>t.length?t:e;return r.every((o,p)=>i(o,n[p]))}if(typeof e!="object"||e instanceof Node||typeof e=="object"&&e.constructor.toString().startsWith("class"))return e===t;for(const r in e){if(!t.hasOwnProperty(r))return!1;if(typeof e[r]=="object"&&typeof t[r]=="object"){if(!i(e[r],t[r]))return!1}else if(e[r]!==t[r])return!1}return!0}function y(e,t){const r={};for(const n in e)t.includes(n)&&(r[n]=e[n]);return r}function l(e,t){const r={};for(const n in e)t.includes(n)||(r[n]=e[n]);return r}function a(e){var t;return typeof e=="function"&&((t=Object.getOwnPropertyDescriptor(e,"prototype"))==null?void 0:t.writable)===!1}function O(e,...t){t.forEach(r=>{Object.getOwnPropertyNames(r.prototype).forEach(n=>{console.log(n),Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(r.prototype,n)||Object.create(null))})})}exports.cloneDeep=c;exports.compareObjects=i;exports.isESClass=a;exports.isNullish=u;exports.isObject=s;exports.mergeDeep=f;exports.mixin=O;exports.omit=l;exports.pick=y;
|