aptechka 0.69.10 → 0.69.12
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/{SourceElement-CvsoT5yg.js → SourceElement-CpB95xQn.js} +63 -62
- package/lib/SourceElement-DCZneQrE.cjs +5 -0
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +1 -1
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/morph/Morph.d.ts +4 -5
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +132 -131
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +1 -1
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +1 -1
- package/package.json +1 -1
- package/lib/SourceElement-DX6W2-19.cjs +0 -5
|
@@ -12,21 +12,21 @@ import { loading as W } from "./loading/index.js";
|
|
|
12
12
|
import { RESIZE_ORDER as st } from "./order/index.js";
|
|
13
13
|
import { windowResizer as Q } from "./window-resizer/index.js";
|
|
14
14
|
import { S as it } from "./Store-0BVty6AZ.js";
|
|
15
|
-
var
|
|
15
|
+
var O, w, C, L, u, f, k;
|
|
16
16
|
class rt {
|
|
17
17
|
constructor(n) {
|
|
18
|
-
i(this, T);
|
|
19
|
-
i(this, w);
|
|
20
18
|
i(this, O);
|
|
19
|
+
i(this, w);
|
|
20
|
+
i(this, C);
|
|
21
21
|
i(this, L);
|
|
22
22
|
i(this, u);
|
|
23
23
|
i(this, f);
|
|
24
24
|
i(this, k);
|
|
25
|
-
s(this,
|
|
25
|
+
s(this, O, n);
|
|
26
26
|
let e = n.split(".");
|
|
27
|
-
const l = /\b\d{1,2}x\b/g,
|
|
28
|
-
s(this,
|
|
29
|
-
const c = /\d+max/g, x = /\d+min/g,
|
|
27
|
+
const l = /\b\d{1,2}x\b/g, m = e.find((g) => g.match(l) && parseInt(g));
|
|
28
|
+
s(this, C, m ? parseInt(m) : 1), m && (e = e.slice(0, -1)), s(this, w, e.length > 1 ? e.slice(0, -1).join(".") : e.join("."));
|
|
29
|
+
const c = /\d+max/g, x = /\d+min/g, v = /\d+mar/g, D = /\d+mir/g, K = e.find((g) => g.match(c)), h = e.find((g) => g.match(x)), b = e.find((g) => g.match(v)), Z = e.find((g) => g.match(D));
|
|
30
30
|
b ? (s(this, u, parseInt(b)), s(this, f, "max"), s(this, L, `(max-aspect-ratio: ${t(this, u)})`)) : Z ? (s(this, u, parseInt(Z)), s(this, f, "max"), s(this, L, `(min-aspect-ratio: ${t(this, u)})`)) : K ? (s(this, u, parseInt(K)), s(this, f, "max"), s(this, L, `(max-width: ${t(this, u)}px)`)) : h ? (s(this, u, parseInt(h)), s(this, L, `(min-width: ${t(this, u)}px)`), s(this, f, "min")) : (s(this, u, 0), s(this, L, `(min-width: ${t(this, u)}px)`), s(this, f, "min")), s(this, w, t(this, w).replace(
|
|
31
31
|
`.${t(this, u)}${t(this, f)}`,
|
|
32
32
|
""
|
|
@@ -36,13 +36,13 @@ class rt {
|
|
|
36
36
|
));
|
|
37
37
|
}
|
|
38
38
|
get url() {
|
|
39
|
-
return t(this,
|
|
39
|
+
return t(this, O);
|
|
40
40
|
}
|
|
41
41
|
get name() {
|
|
42
42
|
return t(this, w);
|
|
43
43
|
}
|
|
44
44
|
get density() {
|
|
45
|
-
return t(this,
|
|
45
|
+
return t(this, C);
|
|
46
46
|
}
|
|
47
47
|
get query() {
|
|
48
48
|
return t(this, L);
|
|
@@ -57,19 +57,19 @@ class rt {
|
|
|
57
57
|
return t(this, u);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
O = new WeakMap(), w = new WeakMap(), C = new WeakMap(), L = new WeakMap(), u = new WeakMap(), f = new WeakMap(), k = new WeakMap();
|
|
61
61
|
var S;
|
|
62
62
|
class X {
|
|
63
63
|
constructor(n, e) {
|
|
64
64
|
i(this, S);
|
|
65
65
|
s(this, S, /* @__PURE__ */ new Map());
|
|
66
|
-
const l = (e == null ? void 0 : e.mediaBuckets) !== !1,
|
|
67
|
-
|
|
66
|
+
const l = (e == null ? void 0 : e.mediaBuckets) !== !1, m = typeof n == "string" ? l ? n.trim().split(",").map((h) => h.trim()).filter((h) => !!h) : [n] : n, c = [];
|
|
67
|
+
m.forEach((h) => {
|
|
68
68
|
const b = new rt(h);
|
|
69
69
|
c.push([b.query, b]);
|
|
70
70
|
});
|
|
71
|
-
const x = c.filter((h) => h[1].queryType.includes("max")).sort((h, b) => b[1].queryValue - h[1].queryValue),
|
|
72
|
-
(D ? [...D, ...x, ...
|
|
71
|
+
const x = c.filter((h) => h[1].queryType.includes("max")).sort((h, b) => b[1].queryValue - h[1].queryValue), v = c.filter((h) => h[1].queryType.includes("min") && h[1].queryValue !== 0).sort((h, b) => h[1].queryValue - b[1].queryValue), D = c.filter((h) => h[0] === "(min-width: 0px)");
|
|
72
|
+
(D ? [...D, ...x, ...v] : [...x, ...v]).forEach((h) => {
|
|
73
73
|
t(this, S).has(h[0]) || t(this, S).set(h[0], []), t(this, S).get(h[0]).push(h[1]);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -78,50 +78,50 @@ class X {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
S = new WeakMap();
|
|
81
|
-
var
|
|
81
|
+
var M, A;
|
|
82
82
|
class nt extends it {
|
|
83
83
|
constructor(e) {
|
|
84
84
|
super(void 0);
|
|
85
|
-
i(this,
|
|
86
|
-
i(this,
|
|
85
|
+
i(this, M);
|
|
86
|
+
i(this, A, () => {
|
|
87
87
|
let e;
|
|
88
|
-
t(this,
|
|
88
|
+
t(this, M).mediaBuckets.forEach((c, x) => {
|
|
89
89
|
matchMedia(x).matches && (e = c);
|
|
90
90
|
});
|
|
91
|
-
let l,
|
|
91
|
+
let l, m = 0;
|
|
92
92
|
e == null || e.forEach((c) => {
|
|
93
|
-
c.density >
|
|
93
|
+
c.density > m && c.density <= Math.max(devicePixelRatio, 1) && (m = c.density, l = c);
|
|
94
94
|
}), e != null && e.length && !l && (l = e[0]), this.current = l;
|
|
95
95
|
});
|
|
96
|
-
s(this,
|
|
96
|
+
s(this, M, new X(e.srcset, e.sourceSetOptions));
|
|
97
97
|
}
|
|
98
98
|
updateSource(e) {
|
|
99
|
-
s(this,
|
|
99
|
+
s(this, M, new X(e.srcset, e.sourceSetOptions)), t(this, A).call(this);
|
|
100
100
|
}
|
|
101
101
|
close() {
|
|
102
102
|
super.close(), this.disconnect();
|
|
103
103
|
}
|
|
104
104
|
connect() {
|
|
105
|
-
Q.subscribe(t(this,
|
|
105
|
+
Q.subscribe(t(this, A), st.SOURCE_MANAGER), t(this, A).call(this);
|
|
106
106
|
}
|
|
107
107
|
disconnect() {
|
|
108
|
-
Q.unsubscribe(t(this,
|
|
108
|
+
Q.unsubscribe(t(this, A));
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
M = new WeakMap(), A = new WeakMap();
|
|
112
112
|
let ht = 0;
|
|
113
|
-
var
|
|
113
|
+
var d, r, y, E, p, V, I, a, R, $, q, z, T, j, _, B, G, P, U;
|
|
114
114
|
class yt extends HTMLElement {
|
|
115
115
|
constructor(e) {
|
|
116
116
|
super();
|
|
117
|
-
i(this,
|
|
118
|
-
i(this,
|
|
117
|
+
i(this, T);
|
|
118
|
+
i(this, d, null);
|
|
119
119
|
i(this, r, null);
|
|
120
120
|
i(this, y, !1);
|
|
121
121
|
i(this, E, !1);
|
|
122
122
|
i(this, p, !1);
|
|
123
|
-
i(this,
|
|
124
|
-
i(this,
|
|
123
|
+
i(this, V, "");
|
|
124
|
+
i(this, I, "");
|
|
125
125
|
i(this, a, new Y(this, {
|
|
126
126
|
loading: !1,
|
|
127
127
|
loaded: !1,
|
|
@@ -129,31 +129,31 @@ class yt extends HTMLElement {
|
|
|
129
129
|
clear: !1,
|
|
130
130
|
playing: !1
|
|
131
131
|
}));
|
|
132
|
-
i(this,
|
|
133
|
-
i(this,
|
|
132
|
+
i(this, R, null);
|
|
133
|
+
i(this, $);
|
|
134
134
|
i(this, q, null);
|
|
135
|
-
i(this,
|
|
135
|
+
i(this, z);
|
|
136
136
|
i(this, _, (e) => {
|
|
137
137
|
const l = e[0];
|
|
138
|
-
t(this, p) && (!t(this, E) || this.hasAttribute("reload-source")) && l.isIntersecting && this.triggerLazyLoad(), l.isIntersecting ? H(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (F(this,
|
|
138
|
+
t(this, p) && (!t(this, E) || this.hasAttribute("reload-source")) && l.isIntersecting && this.triggerLazyLoad(), l.isIntersecting ? H(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (F(this, T, j).call(this, void 0), s(this, E, !1)), H(this, "sourceRelease", { custom: !0 }));
|
|
139
139
|
});
|
|
140
|
-
i(this,
|
|
141
|
-
t(this, a).set("loaded", !0), t(this, a).set("error", !1), t(this, a).set("loading", !1), !t(this, p) && !t(this, y) && W.complete(t(this,
|
|
140
|
+
i(this, B, () => {
|
|
141
|
+
t(this, a).set("loaded", !0), t(this, a).set("error", !1), t(this, a).set("loading", !1), !t(this, p) && !t(this, y) && W.complete(t(this, I)), H(this, "sourceLoaded", { custom: !0 });
|
|
142
142
|
const e = getComputedStyle(this).getPropertyValue("--clear-duration");
|
|
143
|
-
e ? s(this,
|
|
143
|
+
e ? s(this, $, setTimeout(() => {
|
|
144
144
|
t(this, a).set("clear", !0);
|
|
145
145
|
}, parseFloat(e) * 1e3)) : t(this, a).set("clear", !0), s(this, y, !0);
|
|
146
146
|
});
|
|
147
147
|
i(this, G, (e) => {
|
|
148
|
-
t(this, a).set("loaded", !1), t(this, a).set("error", !0), t(this, a).set("loading", !1), !t(this, p) && !t(this, y) && W.error(t(this,
|
|
148
|
+
t(this, a).set("loaded", !1), t(this, a).set("error", !0), t(this, a).set("loading", !1), !t(this, p) && !t(this, y) && W.error(t(this, I)), H(this, "sourceError", { custom: !0 }), s(this, y, !0);
|
|
149
149
|
});
|
|
150
|
-
i(this,
|
|
150
|
+
i(this, P, () => {
|
|
151
151
|
t(this, a).set("playing", !0);
|
|
152
152
|
});
|
|
153
|
-
i(this,
|
|
153
|
+
i(this, U, () => {
|
|
154
154
|
t(this, a).set("playing", !1);
|
|
155
155
|
});
|
|
156
|
-
s(this,
|
|
156
|
+
s(this, z, e == null ? void 0 : e.sourceSetOptions), tt && window.IntersectionObserver && s(this, R, new IntersectionObserver(
|
|
157
157
|
t(this, _)
|
|
158
158
|
));
|
|
159
159
|
}
|
|
@@ -161,7 +161,7 @@ class yt extends HTMLElement {
|
|
|
161
161
|
return t(this, r);
|
|
162
162
|
}
|
|
163
163
|
get sourceManager() {
|
|
164
|
-
return t(this,
|
|
164
|
+
return t(this, d);
|
|
165
165
|
}
|
|
166
166
|
get status() {
|
|
167
167
|
return t(this, a);
|
|
@@ -176,46 +176,47 @@ class yt extends HTMLElement {
|
|
|
176
176
|
return t(this, y);
|
|
177
177
|
}
|
|
178
178
|
triggerLazyLoad() {
|
|
179
|
-
!t(this, E) && t(this,
|
|
179
|
+
!t(this, E) && t(this, d).current && t(this, d).current !== t(this, d).previous && (s(this, E, !0), F(this, T, j).call(this, t(this, d).current));
|
|
180
180
|
}
|
|
181
181
|
connectedCallback() {
|
|
182
|
-
|
|
182
|
+
var m;
|
|
183
|
+
s(this, V, `source-consumer-${++ht}`);
|
|
183
184
|
const e = this.getAttribute("srcset") || "", l = this.hasAttribute("notify") ? this.closest(this.getAttribute("notify")) : null;
|
|
184
|
-
l && t(this, a).addElement(l), s(this, r, this.createConsumer()), t(this, r).style.cssText = `
|
|
185
|
+
l && t(this, a).addElement(l), (m = this.querySelector(".source-consumer")) == null || m.remove(), s(this, r, this.createConsumer()), t(this, r).style.cssText = `
|
|
185
186
|
display: block;
|
|
186
187
|
width: 100%;
|
|
187
188
|
height: 100%;
|
|
188
|
-
`, t(this, r).classList.add("source-consumer"), t(this, r).addEventListener("play", t(this,
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
|
|
189
|
+
`, t(this, r).classList.add("source-consumer"), t(this, r).addEventListener("play", t(this, P)), t(this, r).addEventListener("pause", t(this, U)), Array.from(this.attributes).forEach((c) => {
|
|
190
|
+
if (c.name !== "srcset") {
|
|
191
|
+
const x = c.nodeValue || "", v = et(c.name);
|
|
192
|
+
v in t(this, r) && (t(this, r)[v] = x || !0);
|
|
192
193
|
}
|
|
193
|
-
}), this.appendChild(t(this, r)), s(this,
|
|
194
|
+
}), this.appendChild(t(this, r)), s(this, d, new nt({
|
|
194
195
|
srcset: e,
|
|
195
|
-
sourceSetOptions: t(this,
|
|
196
|
-
})), s(this, p, this.hasAttribute("lazy")), t(this,
|
|
197
|
-
(!t(this, p) || t(this, p) && t(this, E)) && F(this,
|
|
198
|
-
}), t(this,
|
|
196
|
+
sourceSetOptions: t(this, z)
|
|
197
|
+
})), s(this, p, this.hasAttribute("lazy")), t(this, d).subscribe((c) => {
|
|
198
|
+
(!t(this, p) || t(this, p) && t(this, E)) && F(this, T, j).call(this, c.current);
|
|
199
|
+
}), t(this, d).connect(), t(this, R).observe(this);
|
|
199
200
|
}
|
|
200
201
|
disconnectedCallback() {
|
|
201
202
|
var e;
|
|
202
|
-
clearTimeout(t(this,
|
|
203
|
+
clearTimeout(t(this, $)), t(this, R).disconnect(), (e = t(this, d)) == null || e.close(), t(this, r) && (t(this, r).removeEventListener("play", t(this, P)), t(this, r).removeEventListener("pause", t(this, U)), t(this, r).onloadeddata = null, t(this, r).onload = null, t(this, r).onerror = null, t(this, r).remove()), s(this, y, !1), s(this, E, !1), t(this, a).reset();
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
|
-
|
|
206
|
-
if (clearTimeout(t(this,
|
|
207
|
-
s(this,
|
|
206
|
+
d = new WeakMap(), r = new WeakMap(), y = new WeakMap(), E = new WeakMap(), p = new WeakMap(), V = new WeakMap(), I = new WeakMap(), a = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), q = new WeakMap(), z = new WeakMap(), T = new WeakSet(), j = function(e) {
|
|
207
|
+
if (clearTimeout(t(this, $)), t(this, r).onloadeddata = null, t(this, r).onload = null, t(this, r).onerror = null, t(this, a).set("loaded", !1), t(this, a).set("error", !1), t(this, a).set("loading", !1), t(this, a).set("clear", !1), t(this, a).set("playing", !1), e) {
|
|
208
|
+
s(this, I, `${t(this, V)}-${e.url}`);
|
|
208
209
|
const l = this.hasAttribute("keep-source-parameters");
|
|
209
|
-
t(this, a).set("loading", !0), s(this, q, l ? e.url : e.name + e.extension), this.consumeSource(t(this, q)), !t(this, p) && !t(this, y) && W.add(t(this,
|
|
210
|
-
t(this,
|
|
210
|
+
t(this, a).set("loading", !0), s(this, q, l ? e.url : e.name + e.extension), this.consumeSource(t(this, q)), !t(this, p) && !t(this, y) && W.add(t(this, I)), t(this, r).onloadeddata = () => {
|
|
211
|
+
t(this, B).call(this);
|
|
211
212
|
}, t(this, r).onload = () => {
|
|
212
|
-
t(this,
|
|
213
|
+
t(this, B).call(this);
|
|
213
214
|
}, t(this, r).onerror = () => {
|
|
214
215
|
t(this, G).call(this, t(this, q));
|
|
215
216
|
};
|
|
216
217
|
} else
|
|
217
218
|
s(this, q, null), this.consumeSource(null);
|
|
218
|
-
}, _ = new WeakMap(),
|
|
219
|
+
}, _ = new WeakMap(), B = new WeakMap(), G = new WeakMap(), P = new WeakMap(), U = new WeakMap();
|
|
219
220
|
export {
|
|
220
221
|
rt as S,
|
|
221
222
|
yt as a,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var Q=o=>{throw TypeError(o)};var N=(o,n,e)=>n.has(o)||Q("Cannot "+e);var t=(o,n,e)=>(N(o,n,"read from private field"),e?e.call(o):n.get(o)),i=(o,n,e)=>n.has(o)?Q("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),s=(o,n,e,c)=>(N(o,n,"write to private field"),c?c.call(o,e):n.set(o,e),e),D=(o,n,e)=>(N(o,n,"access private method"),e);const et=require("./element-linked-store/index.cjs"),st=require("./index-DekP7OZe.cjs"),F=require("./events-KVanG9sR.cjs"),it=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");const W=require("./loading/index.cjs"),rt=require("./order/index.cjs"),X=require("./window-resizer/index.cjs"),nt=require("./Store-Cd1GlEmZ.cjs");var z,q,O,L,u,f,R;class Y{constructor(n){i(this,z);i(this,q);i(this,O);i(this,L);i(this,u);i(this,f);i(this,R);s(this,z,n);let e=n.split(".");const c=/\b\d{1,2}x\b/g,m=e.find(g=>g.match(c)&&parseInt(g));s(this,O,m?parseInt(m):1),m&&(e=e.slice(0,-1)),s(this,q,e.length>1?e.slice(0,-1).join("."):e.join("."));const l=/\d+max/g,x=/\d+min/g,v=/\d+mar/g,U=/\d+mir/g,K=e.find(g=>g.match(l)),h=e.find(g=>g.match(x)),E=e.find(g=>g.match(v)),J=e.find(g=>g.match(U));E?(s(this,u,parseInt(E)),s(this,f,"max"),s(this,L,`(max-aspect-ratio: ${t(this,u)})`)):J?(s(this,u,parseInt(J)),s(this,f,"max"),s(this,L,`(min-aspect-ratio: ${t(this,u)})`)):K?(s(this,u,parseInt(K)),s(this,f,"max"),s(this,L,`(max-width: ${t(this,u)}px)`)):h?(s(this,u,parseInt(h)),s(this,L,`(min-width: ${t(this,u)}px)`),s(this,f,"min")):(s(this,u,0),s(this,L,`(min-width: ${t(this,u)}px)`),s(this,f,"min")),s(this,q,t(this,q).replace(`.${t(this,u)}${t(this,f)}`,"")),s(this,R,e[e.length-1]===t(this,q)?"":"."+e[e.length-1]),s(this,R,t(this,R).replace(`.${t(this,u)}${t(this,f)}`,""))}get url(){return t(this,z)}get name(){return t(this,q)}get density(){return t(this,O)}get query(){return t(this,L)}get extension(){return t(this,R)}get queryType(){return t(this,f)}get queryValue(){return t(this,u)}}z=new WeakMap,q=new WeakMap,O=new WeakMap,L=new WeakMap,u=new WeakMap,f=new WeakMap,R=new WeakMap;var S;class Z{constructor(n,e){i(this,S);s(this,S,new Map);const c=(e==null?void 0:e.mediaBuckets)!==!1,m=typeof n=="string"?c?n.trim().split(",").map(h=>h.trim()).filter(h=>!!h):[n]:n,l=[];m.forEach(h=>{const E=new Y(h);l.push([E.query,E])});const x=l.filter(h=>h[1].queryType.includes("max")).sort((h,E)=>E[1].queryValue-h[1].queryValue),v=l.filter(h=>h[1].queryType.includes("min")&&h[1].queryValue!==0).sort((h,E)=>h[1].queryValue-E[1].queryValue),U=l.filter(h=>h[0]==="(min-width: 0px)");(U?[...U,...x,...v]:[...x,...v]).forEach(h=>{t(this,S).has(h[0])||t(this,S).set(h[0],[]),t(this,S).get(h[0]).push(h[1])})}get mediaBuckets(){return t(this,S)}}S=new WeakMap;var A,k;class tt extends nt.Store{constructor(e){super(void 0);i(this,A);i(this,k,()=>{let e;t(this,A).mediaBuckets.forEach((l,x)=>{matchMedia(x).matches&&(e=l)});let c,m=0;e==null||e.forEach(l=>{l.density>m&&l.density<=Math.max(devicePixelRatio,1)&&(m=l.density,c=l)}),e!=null&&e.length&&!c&&(c=e[0]),this.current=c});s(this,A,new Z(e.srcset,e.sourceSetOptions))}updateSource(e){s(this,A,new Z(e.srcset,e.sourceSetOptions)),t(this,k).call(this)}close(){super.close(),this.disconnect()}connect(){X.windowResizer.subscribe(t(this,k),rt.RESIZE_ORDER.SOURCE_MANAGER),t(this,k).call(this)}disconnect(){X.windowResizer.unsubscribe(t(this,k))}}A=new WeakMap,k=new WeakMap;let ht=0;var d,r,y,b,p,C,M,a,I,$,w,V,T,H,j,B,G,_,P;class at extends HTMLElement{constructor(e){super();i(this,T);i(this,d,null);i(this,r,null);i(this,y,!1);i(this,b,!1);i(this,p,!1);i(this,C,"");i(this,M,"");i(this,a,new et.ElementLinkedStore(this,{loading:!1,loaded:!1,error:!1,clear:!1,playing:!1}));i(this,I,null);i(this,$);i(this,w,null);i(this,V);i(this,j,e=>{const c=e[0];t(this,p)&&(!t(this,b)||this.hasAttribute("reload-source"))&&c.isIntersecting&&this.triggerLazyLoad(),c.isIntersecting?F.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(D(this,T,H).call(this,void 0),s(this,b,!1)),F.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,B,()=>{t(this,a).set("loaded",!0),t(this,a).set("error",!1),t(this,a).set("loading",!1),!t(this,p)&&!t(this,y)&&W.loading.complete(t(this,M)),F.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,$,setTimeout(()=>{t(this,a).set("clear",!0)},parseFloat(e)*1e3)):t(this,a).set("clear",!0),s(this,y,!0)});i(this,G,e=>{t(this,a).set("loaded",!1),t(this,a).set("error",!0),t(this,a).set("loading",!1),!t(this,p)&&!t(this,y)&&W.loading.error(t(this,M)),F.dispatchEvent(this,"sourceError",{custom:!0}),s(this,y,!0)});i(this,_,()=>{t(this,a).set("playing",!0)});i(this,P,()=>{t(this,a).set("playing",!1)});s(this,V,e==null?void 0:e.sourceSetOptions),st.isBrowser&&window.IntersectionObserver&&s(this,I,new IntersectionObserver(t(this,j)))}get consumerElement(){return t(this,r)}get sourceManager(){return t(this,d)}get status(){return t(this,a)}get isLazy(){return t(this,p)}get currentURL(){return t(this,w)}get isFirstLoadHappened(){return t(this,y)}triggerLazyLoad(){!t(this,b)&&t(this,d).current&&t(this,d).current!==t(this,d).previous&&(s(this,b,!0),D(this,T,H).call(this,t(this,d).current))}connectedCallback(){var m;s(this,C,`source-consumer-${++ht}`);const e=this.getAttribute("srcset")||"",c=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;c&&t(this,a).addElement(c),(m=this.querySelector(".source-consumer"))==null||m.remove(),s(this,r,this.createConsumer()),t(this,r).style.cssText=`
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
`,t(this,r).classList.add("source-consumer"),t(this,r).addEventListener("play",t(this,_)),t(this,r).addEventListener("pause",t(this,P)),Array.from(this.attributes).forEach(l=>{if(l.name!=="srcset"){const x=l.nodeValue||"",v=it.kebabToCamel(l.name);v in t(this,r)&&(t(this,r)[v]=x||!0)}}),this.appendChild(t(this,r)),s(this,d,new tt({srcset:e,sourceSetOptions:t(this,V)})),s(this,p,this.hasAttribute("lazy")),t(this,d).subscribe(l=>{(!t(this,p)||t(this,p)&&t(this,b))&&D(this,T,H).call(this,l.current)}),t(this,d).connect(),t(this,I).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,$)),t(this,I).disconnect(),(e=t(this,d))==null||e.close(),t(this,r)&&(t(this,r).removeEventListener("play",t(this,_)),t(this,r).removeEventListener("pause",t(this,P)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,r).remove()),s(this,y,!1),s(this,b,!1),t(this,a).reset()}}d=new WeakMap,r=new WeakMap,y=new WeakMap,b=new WeakMap,p=new WeakMap,C=new WeakMap,M=new WeakMap,a=new WeakMap,I=new WeakMap,$=new WeakMap,w=new WeakMap,V=new WeakMap,T=new WeakSet,H=function(e){if(clearTimeout(t(this,$)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,a).set("loaded",!1),t(this,a).set("error",!1),t(this,a).set("loading",!1),t(this,a).set("clear",!1),t(this,a).set("playing",!1),e){s(this,M,`${t(this,C)}-${e.url}`);const c=this.hasAttribute("keep-source-parameters");t(this,a).set("loading",!0),s(this,w,c?e.url:e.name+e.extension),this.consumeSource(t(this,w)),!t(this,p)&&!t(this,y)&&W.loading.add(t(this,M)),t(this,r).onloadeddata=()=>{t(this,B).call(this)},t(this,r).onload=()=>{t(this,B).call(this)},t(this,r).onerror=()=>{t(this,G).call(this,t(this,w))}}else s(this,w,null),this.consumeSource(null)},j=new WeakMap,B=new WeakMap,G=new WeakMap,_=new WeakMap,P=new WeakMap;exports.Source=Y;exports.SourceElement=at;exports.SourceManager=tt;exports.SourceSet=Z;
|
package/lib/iframe/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var u=r=>{throw TypeError(r)};var a=(r,t,e)=>t.has(r)||u("Cannot "+e);var s=(r,t,e)=>(a(r,t,"read from private field"),e?e.call(r):t.get(r)),o=(r,t,e)=>t.has(r)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(a(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../SourceElement-
|
|
1
|
+
"use strict";var u=r=>{throw TypeError(r)};var a=(r,t,e)=>t.has(r)||u("Cannot "+e);var s=(r,t,e)=>(a(r,t,"read from private field"),e?e.call(r):t.get(r)),o=(r,t,e)=>t.has(r)?u("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,i)=>(a(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../SourceElement-DCZneQrE.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const f=require("../index-DekP7OZe.cjs");require("construct-style-sheets-polyfill");var n,l,m;class E extends h.SourceElement{constructor(){super({sourceSetOptions:{mediaBuckets:!1}});o(this,n,null);o(this,l,()=>{var e,i;(i=(e=this.consumerElement).onload)==null||i.call(e,new Event("load"))});o(this,m,()=>{var e,i;(i=(e=this.consumerElement).onload)==null||i.call(e,new Event("error"))})}createConsumer(){return document.createElement("div")}consumeSource(e){s(this,n)&&(s(this,n).onload=null,s(this,n).onerror=null),this.consumerElement.innerHTML=(e==null?void 0:e.replace(/\\u003C/g,"<").replace(/\\u003E/g,">").replace(/\\"/g,'"'))||"",c(this,n,this.consumerElement.querySelector("iframe")),s(this,n)&&(s(this,n).onload=s(this,l),s(this,n).onerror=s(this,m))}}n=new WeakMap,l=new WeakMap,m=new WeakMap;f.isBrowser&&!customElements.get("e-iframe")&&customElements.define("e-iframe",E);exports.IFrameElement=E;
|
package/lib/iframe/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var a = (r) => {
|
|
|
3
3
|
};
|
|
4
4
|
var u = (r, t, e) => t.has(r) || a("Cannot " + e);
|
|
5
5
|
var s = (r, t, e) => (u(r, t, "read from private field"), e ? e.call(r) : t.get(r)), i = (r, t, e) => t.has(r) ? a("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), c = (r, t, e, o) => (u(r, t, "write to private field"), o ? o.call(r, e) : t.set(r, e), e);
|
|
6
|
-
import { a as E } from "../SourceElement-
|
|
6
|
+
import { a as E } from "../SourceElement-CpB95xQn.js";
|
|
7
7
|
import "../window-resizer/index.js";
|
|
8
8
|
import "../Store-0BVty6AZ.js";
|
|
9
9
|
import { i as f } from "../index-Bv9zgfdb.js";
|
package/lib/image/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Viewport-DB0qAZPJ.cjs"),i=require("../SourceElement-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Viewport-DB0qAZPJ.cjs"),i=require("../SourceElement-DCZneQrE.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const n=require("../index-DekP7OZe.cjs");require("construct-style-sheets-polyfill");class t extends i.SourceElement{createConsumer(){return document.createElement("img")}consumeSource(e){if(e&&this.hasAttribute("webp")&&s.device.isWebp){const r=e.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=r}else this.consumerElement.src=e||""}}n.isBrowser&&!customElements.get("e-image")&&customElements.define("e-image",t);exports.ImageElement=t;
|
package/lib/image/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as m } from "../Viewport-DA10iWAO.js";
|
|
2
|
-
import { a as s } from "../SourceElement-
|
|
2
|
+
import { a as s } from "../SourceElement-CpB95xQn.js";
|
|
3
3
|
import "../window-resizer/index.js";
|
|
4
4
|
import "../Store-0BVty6AZ.js";
|
|
5
5
|
import { i } from "../index-Bv9zgfdb.js";
|
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -12,12 +12,11 @@ export interface MorphNavigationEntry {
|
|
|
12
12
|
path: string;
|
|
13
13
|
submorph?: Array<string>;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface MorphNavigationDocumentFetchedEntry extends MorphNavigationEntry {
|
|
16
16
|
document: Document;
|
|
17
17
|
}
|
|
18
|
-
export interface MorphChildrenActionEntry {
|
|
18
|
+
export interface MorphChildrenActionEntry extends MorphNavigationDocumentFetchedEntry {
|
|
19
19
|
morphElement: HTMLElement;
|
|
20
|
-
path: string;
|
|
21
20
|
}
|
|
22
21
|
export interface MorphPreprocessorEntry extends MorphNavigationEntry {
|
|
23
22
|
resolve: () => void;
|
|
@@ -40,8 +39,8 @@ export interface MorphScrollDetail {
|
|
|
40
39
|
}
|
|
41
40
|
export interface MorphEvents {
|
|
42
41
|
morphNavigation: CustomEvent<MorphNavigationEntry>;
|
|
43
|
-
morphStart: CustomEvent<
|
|
44
|
-
morphComplete: CustomEvent<
|
|
42
|
+
morphStart: CustomEvent<MorphNavigationDocumentFetchedEntry>;
|
|
43
|
+
morphComplete: CustomEvent<MorphNavigationDocumentFetchedEntry>;
|
|
45
44
|
morphNewChildrenAdded: CustomEvent<MorphChildrenActionEntry>;
|
|
46
45
|
morphOldChildrenRemoved: CustomEvent<MorphChildrenActionEntry>;
|
|
47
46
|
morphScroll: CustomEvent<MorphScrollDetail>;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Wt=Object.defineProperty,Yt=Object.defineProperties;var Xt=Object.getOwnPropertyDescriptors;var Ct=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var Tt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),Mt=r=>{throw TypeError(r)};var xt=(r,t,s)=>t in r?Wt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,Nt=(r,t)=>{for(var s in t||(t={}))jt.call(t,s)&&xt(r,s,t[s]);if(Ct)for(var s of Ct(t))Ut.call(t,s)&&xt(r,s,t[s]);return r},Ht=(r,t)=>Yt(r,Xt(t));var pt=(r,t,s)=>t.has(r)||Mt("Cannot "+s);var e=(r,t,s)=>(pt(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(pt(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(pt(r,t,"access private method"),s);var W=(r,t,s)=>new Promise((i,u)=>{var w=g=>{try{v(s.next(g))}catch(O){u(O)}},N=g=>{try{v(s.throw(g))}catch(O){u(O)}},v=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,N);v((s=s.apply(r,t)).next())});var qt=(r,t,s)=>(t=r[Tt("asyncIterator")])?t.call(r):(r=r[Tt("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=w=>new Promise((N,v,g)=>(w=u.call(r,w),g=w.done,Promise.resolve(w.value).then(O=>N({value:O,done:g}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Rt=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),Kt=require("../polyfills-Df4r-ETT.cjs"),Dt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ct=require("../url-BT4fssbO.cjs"),$t=require("../css-value-parser/index.cjs");class Vt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Rt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Vt);var C,l,D,st,$;class Et{constructor(t,s){a(this,C);a(this,l);a(this,D);a(this,st,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,D,e(this,l).getAttribute("href")||"/");const u=e(this,l).getAttribute("data-history-action")||"push",w=e(this,l).hasAttribute("data-center-scroll"),N=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=N?$t.cssValueParser.parse(N):void 0,g=e(this,l).hasAttribute("data-revalidate"),O=e(this,l).hasAttribute("data-keep-search-parameters"),h=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(H=>H.trim()),ot=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,D),{historyAction:u,centerScroll:w,offsetScroll:v,revalidate:g,keepSearchParameters:O,submorph:h,clearState:ot})}});a(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,D),t),e(this,l).removeEventListener("pointerenter",e(this,$))});n(this,C,s),n(this,l,t),n(this,D,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,st)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,$))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,D));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,st)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,D=new WeakMap,st=new WeakMap,$=new WeakMap;const Gt=new DOMParser;var T,I,b,P,X,R,G,j,V;class It{constructor(t,s){a(this,T);a(this,I);a(this,b,{x:0,y:0});a(this,P,null);a(this,X,null);a(this,R,null);a(this,G,null);a(this,j,null);a(this,V,null);n(this,T,t),n(this,I,s)}get path(){return e(this,I)}get scrollState(){return e(this,b)}get document(){return e(this,R)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,j))==null?void 0:t.abort(`[${e(this,I)}] page loading cancelled`)}fetch(t){return W(this,null,function*(){return e(this,V)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&!t||e(this,P)&&e(this,T).isPopstateNavigation?e(this,V):(n(this,V,new Promise(s=>W(this,null,function*(){try{n(this,j,new AbortController);const u=yield(yield fetch(e(this,I),{signal:e(this,j).signal})).text(),w=Gt.parseFromString(u,"text/html");this.setInitialDocument(w)}catch(i){console.warn(i)}finally{n(this,j,null),n(this,V,null),s()}}))),e(this,V))})}cloneDocument(){n(this,R,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,R).title)t=e(this,R).title;else{const s=e(this,R).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,b).x=0,e(this,b).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,b).x=0,e(this,b).y=0):(e(this,b).x=e(this,T).scrollValue.left,e(this,b).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,b).y,left:e(this,b).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,G,t)}clearState(){const t=e(this,G);return n(this,G,null),t}}T=new WeakMap,I=new WeakMap,b=new WeakMap,P=new WeakMap,X=new WeakMap,R=new WeakMap,G=new WeakMap,j=new WeakMap,V=new WeakMap;var A,J,E,z,f,it,B,x,L,rt,M,U,Q,Z,nt,c,ht,St,zt,vt,wt,yt,bt,ut,_;const et=class et{constructor(t){a(this,c);a(this,A,null);a(this,J,null);a(this,E,[]);a(this,z);a(this,f,null);a(this,it);a(this,B,[]);a(this,x,!1);a(this,L,null);a(this,rt,!1);a(this,M,new Map);a(this,U,null);a(this,Q,0);a(this,Z,0);a(this,nt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ut,t=>W(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,x,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,x,!1))}));a(this,_,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Z),u=t-e(this,Q);n(this,Z,s),n(this,Q,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),Y.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Rt.isBrowser&&!et.instance){et.instance=this,n(this,A,{base:ct.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,J,p(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,f,s.path);const i=new It(this,e(this,f));i.setInitialDocument(document),e(this,M).set(e(this,f),i),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ut)),ct.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,U,new Vt),p(this,c,yt).call(this,document)}}get currentPath(){return e(this,f)}get previousPathname(){return e(this,it)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,x)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,M).get(e(this,f));s&&s.saveState(t)}getState(){const t=e(this,M).get(e(this,f));return t==null?void 0:t.clearState()}normalizePath(t){return ct.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return W(this,null,function*(){if(e(this,B).length)return;const i=p(this,c,ht).call(this,t);i==null||i.fetch(s)})}navigate(O){return W(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:N,submorph:v,clearState:g}={}){var ot;if(e(this,B).length)return;const h=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(e(this,z)===h.path||e(this,f)===h.path){e(this,x)||p(this,c,bt).call(this,h.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}n(this,z,h.path),e(this,E).forEach(H=>{H.checkCurrent(h.path)});try{let H=!0;if(this.preprocessor)try{yield new Promise((o,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{path:t,resolve:o,reject:k,submorph:v})})}catch(o){o?console.error(o):console.log("Route change canceled"),H=!1}if(!H||e(this,z)!==h.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const dt={path:h.path,submorph:v};Y.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=p(this,c,ht).call(this,e(this,f)),m=p(this,c,ht).call(this,t);if(e(this,M).forEach(o=>{o.path!==h.path&&o.abort()}),yield m==null?void 0:m.fetch(w),e(this,z)!==h.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,x)||(m.clearScrollState(),m.clearDocumentState()),g&&m.clearState(),m.cloneDocument(),e(this,U).textContent=m.title,document.body.appendChild(e(this,U)),Y.dispatchEvent(document,"morphStart",{detail:dt});const Lt=Array.from(document.head.children),Pt=Array.from(m.document.head.children),At=p(this,c,zt).call(this,Lt,Pt),Bt=p(this,c,vt).call(this,Lt,At),at=p(this,c,vt).call(this,Pt,At);at.forEach((o,k)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=o.getAttribute("src"),at[k]=y}}),at.forEach(o=>{document.head.appendChild(o)});const ft=at.filter(o=>{if(o.hasAttribute("data-no-waiting"))return!1;if(p(this,c,wt).call(this,o))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(o=>W(this,null,function*(){let k=0;try{for(var y=qt(ft),tt,F,K;tt=!(F=yield y.next()).done;tt=!1){const lt=F.value;lt.onload=()=>{k++,k===ft.length&&o()}}}catch(F){K=[F]}finally{try{tt&&(F=y.return)&&(yield F.call(y))}finally{if(K)throw K[0]}}}))),yield Dt.wait(10);const kt=[];Bt.forEach(o=>{o.hasAttribute("data-permanent")||(p(this,c,wt).call(this,o)?kt.push(o):o.remove())});const Ot=p(this,c,St).call(this,m.document.body);e(this,A).morphInsideScrollContainer||p(this,c,yt).call(this,m.document),document.documentElement.setAttribute("data-current-pathname",h.pathname),document.documentElement.setAttribute("data-current-leaf",h.leaf),ct.changeHistory({action:s,pathname:h.pathname,searchParameters:h.parameters||(N?location.search:""),hash:h.hash}),e(this,U).remove(),n(this,it,e(this,f)),n(this,f,h.path),e(this,J).forEach((o,k)=>{const y=Ot[k],tt=getComputedStyle(o).getPropertyValue("--morph-duration");let F=[],K=[];v?v.forEach(d=>{const S=o.querySelector(d),q=y.querySelector(d);S&&q&&(K.push(S),F.push(q))}):(F.push(...y.childNodes),K.push(...o.childNodes)),K.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),F.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),v?F.forEach((d,S)=>{var q;(q=K[S].parentElement)==null||q.insertBefore(d,K[S])}):o.prepend(...F),Kt.requestIdleCallback(()=>{F.forEach(d=>{var S;d instanceof HTMLElement&&((S=d.parentElement)==null||S.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("in"))})});const lt={morphElement:o,path:h.path};Y.dispatchEvent(document,"morphNewChildrenAdded",{detail:lt});const Ft=new Promise(d=>{setTimeout(()=>{K.forEach(S=>S.remove()),F.forEach(S=>{var q;S instanceof HTMLElement&&((q=S.parentElement)==null||q.style.removeProperty("--new-content-height"),S.classList.remove("in","new"))}),Y.dispatchEvent(document,"morphOldChildrenRemoved",{detail:lt}),d()},(parseFloat(tt)||0)*1e3+10)});e(this,B).push(Ft)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-m.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),Y.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:m.scrollState}),h.hash?(m.clearScrollState(),p(this,c,bt).call(this,h.hash,{centerScroll:i,offsetScroll:u})):e(this,x)?m.restoreScrollPosition():m.renewScrollPosition(),yield Promise.all(e(this,B)),kt.forEach(o=>o.remove()),n(this,B,[]),e(this,J).forEach(o=>{o.querySelectorAll("script").forEach(y=>{const tt=document.createElement("script");tt.type="module",tt.src=y.getAttribute("src"),y.replaceWith(tt)})}),Y.dispatchEvent(document,"morphComplete",{detail:Ht(Nt({},dt),{document:m.document})}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(H){console.error(H)}n(this,z,void 0)})}addLink(t){e(this,E).push(new Et(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,nt));e(this,E).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,nt));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new Et(s,this)))}};A=new WeakMap,J=new WeakMap,E=new WeakMap,z=new WeakMap,f=new WeakMap,it=new WeakMap,B=new WeakMap,x=new WeakMap,L=new WeakMap,rt=new WeakMap,M=new WeakMap,U=new WeakMap,Q=new WeakMap,Z=new WeakMap,nt=new WeakMap,c=new WeakSet,ht=function(t){let s=e(this,M).get(t);return s||(s=new It(this,t),e(this,M).set(t,s)),s},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},zt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,_)),n(this,Z,0),n(this,Q,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,_)),e(this,_).call(this)},bt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Dt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ut=new WeakMap,_=new WeakMap,et.instance=null;let gt=et;exports.Morph=gt;
|
|
1
|
+
"use strict";var Yt=Object.defineProperty,Xt=Object.defineProperties;var jt=Object.getOwnPropertyDescriptors;var Mt=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var Nt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),qt=r=>{throw TypeError(r)};var Ht=(r,t,s)=>t in r?Yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,pt=(r,t)=>{for(var s in t||(t={}))Ut.call(t,s)&&Ht(r,s,t[s]);if(Mt)for(var s of Mt(t))Kt.call(t,s)&&Ht(r,s,t[s]);return r},Et=(r,t)=>Xt(r,jt(t));var gt=(r,t,s)=>t.has(r)||qt("Cannot "+s);var e=(r,t,s)=>(gt(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(gt(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(gt(r,t,"access private method"),s);var W=(r,t,s)=>new Promise((i,h)=>{var y=g=>{try{v(s.next(g))}catch(F){h(F)}},N=g=>{try{v(s.throw(g))}catch(F){h(F)}},v=g=>g.done?i(g.value):Promise.resolve(g.value).then(y,N);v((s=s.apply(r,t)).next())});var Dt=(r,t,s)=>(t=r[Nt("asyncIterator")])?t.call(r):(r=r[Nt("iterator")](),t={},s=(i,h)=>(h=r[i])&&(t[i]=y=>new Promise((N,v,g)=>(y=h.call(r,y),g=y.done,Promise.resolve(y.value).then(F=>N({value:F,done:g}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vt=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),$t=require("../polyfills-Df4r-ETT.cjs"),It=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ct=require("../url-BT4fssbO.cjs"),Gt=require("../css-value-parser/index.cjs");class zt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Vt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",zt);var C,l,D,st,$;class St{constructor(t,s){a(this,C);a(this,l);a(this,D);a(this,st,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,D,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",y=e(this,l).hasAttribute("data-center-scroll"),N=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=N?Gt.cssValueParser.parse(N):void 0,g=e(this,l).hasAttribute("data-revalidate"),F=e(this,l).hasAttribute("data-keep-search-parameters"),u=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(H=>H.trim()),ot=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,D),{historyAction:h,centerScroll:y,offsetScroll:v,revalidate:g,keepSearchParameters:F,submorph:u,clearState:ot})}});a(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,D),t),e(this,l).removeEventListener("pointerenter",e(this,$))});n(this,C,s),n(this,l,t),n(this,D,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,st)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,$))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,D));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,st)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,D=new WeakMap,st=new WeakMap,$=new WeakMap;const Jt=new DOMParser;var T,I,b,P,X,R,G,j,V;class Rt{constructor(t,s){a(this,T);a(this,I);a(this,b,{x:0,y:0});a(this,P,null);a(this,X,null);a(this,R,null);a(this,G,null);a(this,j,null);a(this,V,null);n(this,T,t),n(this,I,s)}get path(){return e(this,I)}get scrollState(){return e(this,b)}get document(){return e(this,R)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,j))==null?void 0:t.abort(`[${e(this,I)}] page loading cancelled`)}fetch(t){return W(this,null,function*(){return e(this,V)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&!t||e(this,P)&&e(this,T).isPopstateNavigation?e(this,V):(n(this,V,new Promise(s=>W(this,null,function*(){try{n(this,j,new AbortController);const h=yield(yield fetch(e(this,I),{signal:e(this,j).signal})).text(),y=Jt.parseFromString(h,"text/html");this.setInitialDocument(y)}catch(i){console.warn(i)}finally{n(this,j,null),n(this,V,null),s()}}))),e(this,V))})}cloneDocument(){n(this,R,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,R).title)t=e(this,R).title;else{const s=e(this,R).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,b).x=0,e(this,b).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,b).x=0,e(this,b).y=0):(e(this,b).x=e(this,T).scrollValue.left,e(this,b).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,b).y,left:e(this,b).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,G,t)}clearState(){const t=e(this,G);return n(this,G,null),t}}T=new WeakMap,I=new WeakMap,b=new WeakMap,P=new WeakMap,X=new WeakMap,R=new WeakMap,G=new WeakMap,j=new WeakMap,V=new WeakMap;var A,J,E,z,f,it,B,x,L,rt,M,U,Q,Z,nt,c,ht,yt,Bt,wt,bt,Lt,Pt,ut,_;const et=class et{constructor(t){a(this,c);a(this,A,null);a(this,J,null);a(this,E,[]);a(this,z);a(this,f,null);a(this,it);a(this,B,[]);a(this,x,!1);a(this,L,null);a(this,rt,!1);a(this,M,new Map);a(this,U,null);a(this,Q,0);a(this,Z,0);a(this,nt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ut,t=>W(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,x,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,x,!1))}));a(this,_,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Z),h=t-e(this,Q);n(this,Z,s),n(this,Q,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),Y.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Vt.isBrowser&&!et.instance){et.instance=this,n(this,A,{base:ct.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,J,p(this,c,yt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,f,s.path);const i=new Rt(this,e(this,f));i.setInitialDocument(document),e(this,M).set(e(this,f),i),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ut)),ct.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,U,new zt),p(this,c,Lt).call(this,document)}}get currentPath(){return e(this,f)}get previousPathname(){return e(this,it)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,x)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,M).get(e(this,f));s&&s.saveState(t)}getState(){const t=e(this,M).get(e(this,f));return t==null?void 0:t.clearState()}normalizePath(t){return ct.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return W(this,null,function*(){if(e(this,B).length)return;const i=p(this,c,ht).call(this,t);i==null||i.fetch(s)})}navigate(F){return W(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:y,keepSearchParameters:N,submorph:v,clearState:g}={}){var ot;if(e(this,B).length)return;const u=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(e(this,z)===u.path||e(this,f)===u.path){e(this,x)||p(this,c,Pt).call(this,u.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,z,u.path),e(this,E).forEach(H=>{H.checkCurrent(u.path)});try{let H=!0;if(this.preprocessor)try{yield new Promise((o,k)=>{var w;(w=this.preprocessor)==null||w.call(this,{path:t,resolve:o,reject:k,submorph:v})})}catch(o){o?console.error(o):console.log("Route change canceled"),H=!1}if(!H||e(this,z)!==u.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const At={path:u.path,submorph:v};Y.dispatchEvent(document,"morphNavigation",{detail:At});const dt=p(this,c,ht).call(this,e(this,f)),m=p(this,c,ht).call(this,t);if(e(this,M).forEach(o=>{o.path!==u.path&&o.abort()}),yield m==null?void 0:m.fetch(y),e(this,z)!==u.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}dt.clearState(),dt.saveScrollState(),dt.saveDocumentState(),e(this,x)||(m.clearScrollState(),m.clearDocumentState()),g&&m.clearState(),m.cloneDocument(),e(this,U).textContent=m.title,document.body.appendChild(e(this,U));const mt=Et(pt({},At),{document:m.document});Y.dispatchEvent(document,"morphStart",{detail:mt});const kt=Array.from(document.head.children),Ct=Array.from(m.document.head.children),Tt=p(this,c,Bt).call(this,kt,Ct),Ft=p(this,c,wt).call(this,kt,Tt),at=p(this,c,wt).call(this,Ct,Tt);at.forEach((o,k)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=o.getAttribute("src"),at[k]=w}}),at.forEach(o=>{document.head.appendChild(o)});const ft=at.filter(o=>{if(o.hasAttribute("data-no-waiting"))return!1;if(p(this,c,bt).call(this,o))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(o=>W(this,null,function*(){let k=0;try{for(var w=Dt(ft),tt,O,K;tt=!(O=yield w.next()).done;tt=!1){const lt=O.value;lt.onload=()=>{k++,k===ft.length&&o()}}}catch(O){K=[O]}finally{try{tt&&(O=w.return)&&(yield O.call(w))}finally{if(K)throw K[0]}}}))),yield It.wait(10);const xt=[];Ft.forEach(o=>{o.hasAttribute("data-permanent")||(p(this,c,bt).call(this,o)?xt.push(o):o.remove())});const Ot=p(this,c,yt).call(this,m.document.body);e(this,A).morphInsideScrollContainer||p(this,c,Lt).call(this,m.document),document.documentElement.setAttribute("data-current-pathname",u.pathname),document.documentElement.setAttribute("data-current-leaf",u.leaf),ct.changeHistory({action:s,pathname:u.pathname,searchParameters:u.parameters||(N?location.search:""),hash:u.hash}),e(this,U).remove(),n(this,it,e(this,f)),n(this,f,u.path),e(this,J).forEach((o,k)=>{const w=Ot[k],tt=getComputedStyle(o).getPropertyValue("--morph-duration");let O=[],K=[];v?v.forEach(d=>{const S=o.querySelector(d),q=w.querySelector(d);S&&q&&(K.push(S),O.push(q))}):(O.push(...w.childNodes),K.push(...o.childNodes)),K.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),O.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),v?O.forEach((d,S)=>{var q;(q=K[S].parentElement)==null||q.insertBefore(d,K[S])}):o.prepend(...O),$t.requestIdleCallback(()=>{O.forEach(d=>{var S;d instanceof HTMLElement&&((S=d.parentElement)==null||S.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("in"))})});const lt=Et(pt({},mt),{morphElement:o});Y.dispatchEvent(document,"morphNewChildrenAdded",{detail:lt});const Wt=new Promise(d=>{setTimeout(()=>{K.forEach(S=>S.remove()),O.forEach(S=>{var q;S instanceof HTMLElement&&((q=S.parentElement)==null||q.style.removeProperty("--new-content-height"),S.classList.remove("in","new"))}),Y.dispatchEvent(document,"morphOldChildrenRemoved",{detail:lt}),d()},(parseFloat(tt)||0)*1e3+10)});e(this,B).push(Wt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-m.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),Y.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:m.scrollState}),u.hash?(m.clearScrollState(),p(this,c,Pt).call(this,u.hash,{centerScroll:i,offsetScroll:h})):e(this,x)?m.restoreScrollPosition():m.renewScrollPosition(),yield Promise.all(e(this,B)),xt.forEach(o=>o.remove()),n(this,B,[]),e(this,J).forEach(o=>{o.querySelectorAll("script").forEach(w=>{const tt=document.createElement("script");tt.type="module",tt.src=w.getAttribute("src"),w.replaceWith(tt)})}),Y.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(H){console.error(H)}n(this,z,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,nt));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,nt));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,J=new WeakMap,E=new WeakMap,z=new WeakMap,f=new WeakMap,it=new WeakMap,B=new WeakMap,x=new WeakMap,L=new WeakMap,rt=new WeakMap,M=new WeakMap,U=new WeakMap,Q=new WeakMap,Z=new WeakMap,nt=new WeakMap,c=new WeakSet,ht=function(t){let s=e(this,M).get(t);return s||(s=new Rt(this,t),e(this,M).set(t,s)),s},yt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Bt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},bt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Lt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,_)),n(this,Z,0),n(this,Q,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,_)),e(this,_).call(this)},Pt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&It.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ut=new WeakMap,_=new WeakMap,et.instance=null;let vt=et;exports.Morph=vt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Wt = Object.defineProperty, Yt = Object.defineProperties;
|
|
2
|
+
var Xt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Tt = Object.getOwnPropertySymbols;
|
|
4
|
+
var Ut = Object.prototype.hasOwnProperty, jt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var xt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), Mt = (r) => {
|
|
6
6
|
throw TypeError(r);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var Nt = (r, t, s) => t in r ? Wt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s, ft = (r, t) => {
|
|
9
9
|
for (var s in t || (t = {}))
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var s of
|
|
13
|
-
|
|
10
|
+
Ut.call(t, s) && Nt(r, s, t[s]);
|
|
11
|
+
if (Tt)
|
|
12
|
+
for (var s of Tt(t))
|
|
13
|
+
jt.call(t, s) && Nt(r, s, t[s]);
|
|
14
14
|
return r;
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var e = (r, t, s) => (
|
|
18
|
-
var W = (r, t, s) => new Promise((i,
|
|
19
|
-
var y = (
|
|
15
|
+
}, pt = (r, t) => Yt(r, Xt(t));
|
|
16
|
+
var Et = (r, t, s) => t.has(r) || Mt("Cannot " + s);
|
|
17
|
+
var e = (r, t, s) => (Et(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => t.has(r) ? Mt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), n = (r, t, s, i) => (Et(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), p = (r, t, s) => (Et(r, t, "access private method"), s);
|
|
18
|
+
var W = (r, t, s) => new Promise((i, h) => {
|
|
19
|
+
var y = (g) => {
|
|
20
20
|
try {
|
|
21
|
-
w(s.next(
|
|
22
|
-
} catch (
|
|
23
|
-
|
|
21
|
+
w(s.next(g));
|
|
22
|
+
} catch (B) {
|
|
23
|
+
h(B);
|
|
24
24
|
}
|
|
25
|
-
}, M = (
|
|
25
|
+
}, M = (g) => {
|
|
26
26
|
try {
|
|
27
|
-
w(s.throw(
|
|
28
|
-
} catch (
|
|
29
|
-
|
|
27
|
+
w(s.throw(g));
|
|
28
|
+
} catch (B) {
|
|
29
|
+
h(B);
|
|
30
30
|
}
|
|
31
|
-
}, w = (
|
|
31
|
+
}, w = (g) => g.done ? i(g.value) : Promise.resolve(g.value).then(y, M);
|
|
32
32
|
w((s = s.apply(r, t)).next());
|
|
33
33
|
});
|
|
34
|
-
var
|
|
35
|
-
import { i as
|
|
34
|
+
var Ht = (r, t, s) => (t = r[xt("asyncIterator")]) ? t.call(r) : (r = r[xt("iterator")](), t = {}, s = (i, h) => (h = r[i]) && (t[i] = (y) => new Promise((M, w, g) => (y = h.call(r, y), g = y.done, Promise.resolve(y.value).then((B) => M({ value: B, done: g }), w)))), s("next"), s("return"), t);
|
|
35
|
+
import { i as Vt } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as Y } from "../events-CsVF98U6.js";
|
|
37
|
-
import { r as
|
|
38
|
-
import { w as
|
|
37
|
+
import { r as Kt } from "../polyfills-DJrTJQky.js";
|
|
38
|
+
import { w as $t, s as Gt } from "../scroll-DPkCFTxg.js";
|
|
39
39
|
import "construct-style-sheets-polyfill";
|
|
40
|
-
import { n as
|
|
41
|
-
import { cssValueParser as
|
|
42
|
-
class
|
|
40
|
+
import { n as Jt, c as Dt, s as Qt } from "../url-Cb0SFRMc.js";
|
|
41
|
+
import { cssValueParser as Zt } from "../css-value-parser/index.js";
|
|
42
|
+
class qt extends HTMLElement {
|
|
43
43
|
connectedCallback() {
|
|
44
44
|
const t = {
|
|
45
45
|
"aria-live": "assertive",
|
|
@@ -50,9 +50,9 @@ class Vt extends HTMLElement {
|
|
|
50
50
|
this.setAttribute(s, i);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Vt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", qt);
|
|
54
54
|
var C, l, I, st, $;
|
|
55
|
-
class
|
|
55
|
+
class gt {
|
|
56
56
|
constructor(t, s) {
|
|
57
57
|
a(this, C);
|
|
58
58
|
a(this, l);
|
|
@@ -63,18 +63,18 @@ class pt {
|
|
|
63
63
|
history.back();
|
|
64
64
|
else {
|
|
65
65
|
n(this, I, e(this, l).getAttribute("href") || "/");
|
|
66
|
-
const
|
|
66
|
+
const h = e(this, l).getAttribute(
|
|
67
67
|
"data-history-action"
|
|
68
|
-
) || "push", y = e(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ?
|
|
68
|
+
) || "push", y = e(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ? Zt.parse(M) : void 0, g = e(this, l).hasAttribute("data-revalidate"), B = e(this, l).hasAttribute(
|
|
69
69
|
"data-keep-search-parameters"
|
|
70
|
-
),
|
|
70
|
+
), u = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((H) => H.trim()), ot = e(this, l).hasAttribute("data-clear-state");
|
|
71
71
|
e(this, C).navigate(e(this, I), {
|
|
72
|
-
historyAction:
|
|
72
|
+
historyAction: h,
|
|
73
73
|
centerScroll: y,
|
|
74
74
|
offsetScroll: w,
|
|
75
|
-
revalidate:
|
|
76
|
-
keepSearchParameters:
|
|
77
|
-
submorph:
|
|
75
|
+
revalidate: g,
|
|
76
|
+
keepSearchParameters: B,
|
|
77
|
+
submorph: u,
|
|
78
78
|
clearState: ot
|
|
79
79
|
});
|
|
80
80
|
}
|
|
@@ -97,9 +97,9 @@ class pt {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
C = new WeakMap(), l = new WeakMap(), I = new WeakMap(), st = new WeakMap(), $ = new WeakMap();
|
|
100
|
-
const
|
|
100
|
+
const _t = new DOMParser();
|
|
101
101
|
var T, R, b, P, X, V, G, U, q;
|
|
102
|
-
class
|
|
102
|
+
class It {
|
|
103
103
|
constructor(t, s) {
|
|
104
104
|
a(this, T);
|
|
105
105
|
a(this, R);
|
|
@@ -135,9 +135,9 @@ class Dt {
|
|
|
135
135
|
return e(this, q) || e(this, P) && e(this, P).documentElement.hasAttribute("data-cache") && !t || e(this, P) && e(this, T).isPopstateNavigation ? e(this, q) : (n(this, q, new Promise((s) => W(this, null, function* () {
|
|
136
136
|
try {
|
|
137
137
|
n(this, U, new AbortController());
|
|
138
|
-
const
|
|
138
|
+
const h = yield (yield fetch(e(this, R), {
|
|
139
139
|
signal: e(this, U).signal
|
|
140
|
-
})).text(), y =
|
|
140
|
+
})).text(), y = _t.parseFromString(h, "text/html");
|
|
141
141
|
this.setInitialDocument(y);
|
|
142
142
|
} catch (i) {
|
|
143
143
|
console.warn(i);
|
|
@@ -199,17 +199,17 @@ class Dt {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
T = new WeakMap(), R = new WeakMap(), b = new WeakMap(), P = new WeakMap(), X = new WeakMap(), V = new WeakMap(), G = new WeakMap(), U = new WeakMap(), q = new WeakMap();
|
|
202
|
-
var A, J,
|
|
202
|
+
var A, J, E, z, f, it, F, x, L, rt, N, j, Q, Z, nt, c, ct, St, zt, wt, yt, vt, bt, ht, _;
|
|
203
203
|
const et = class et {
|
|
204
204
|
constructor(t) {
|
|
205
|
-
a(this,
|
|
205
|
+
a(this, c);
|
|
206
206
|
a(this, A, null);
|
|
207
207
|
a(this, J, null);
|
|
208
|
-
a(this,
|
|
208
|
+
a(this, E, []);
|
|
209
209
|
a(this, z);
|
|
210
210
|
a(this, f, null);
|
|
211
211
|
a(this, it);
|
|
212
|
-
a(this,
|
|
212
|
+
a(this, F, []);
|
|
213
213
|
a(this, x, !1);
|
|
214
214
|
a(this, L, null);
|
|
215
215
|
a(this, rt, !1);
|
|
@@ -221,12 +221,12 @@ const et = class et {
|
|
|
221
221
|
var s;
|
|
222
222
|
return ((s = t.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !t.hasAttribute("download") && !t.hasAttribute("data-morph-skip") && !t.closest("[data-morph-skip]") && t.getAttribute("target") !== "_blank";
|
|
223
223
|
});
|
|
224
|
-
a(this,
|
|
224
|
+
a(this, ht, (t) => W(this, null, function* () {
|
|
225
225
|
var s;
|
|
226
226
|
(s = t.state) != null && s.path && (t.preventDefault(), n(this, x, !0), yield this.navigate(t.state.path, { historyAction: "none" }), n(this, x, !1));
|
|
227
227
|
}));
|
|
228
228
|
a(this, _, () => {
|
|
229
|
-
const { left: t, top: s } = this.scrollValue, i = s - e(this, Z),
|
|
229
|
+
const { left: t, top: s } = this.scrollValue, i = s - e(this, Z), h = t - e(this, Q);
|
|
230
230
|
n(this, Z, s), n(this, Q, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
|
|
231
231
|
"scroll-y-forward",
|
|
232
232
|
i > 0
|
|
@@ -235,10 +235,10 @@ const et = class et {
|
|
|
235
235
|
i < 0
|
|
236
236
|
), document.documentElement.classList.toggle(
|
|
237
237
|
"scroll-x-forward",
|
|
238
|
-
|
|
238
|
+
h > 0
|
|
239
239
|
), document.documentElement.classList.toggle(
|
|
240
240
|
"scroll-x-backward",
|
|
241
|
-
|
|
241
|
+
h < 0
|
|
242
242
|
), Y(document, "morphScroll", {
|
|
243
243
|
detail: {
|
|
244
244
|
left: t,
|
|
@@ -246,31 +246,31 @@ const et = class et {
|
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
});
|
|
249
|
-
if (
|
|
249
|
+
if (Vt && !et.instance) {
|
|
250
250
|
et.instance = this, n(this, A, {
|
|
251
|
-
base:
|
|
251
|
+
base: Jt(t == null ? void 0 : t.base),
|
|
252
252
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
253
253
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
254
254
|
scrollSelector: t == null ? void 0 : t.scrollSelector,
|
|
255
255
|
morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
|
|
256
|
-
}), n(this, J, p(this,
|
|
256
|
+
}), n(this, J, p(this, c, St).call(this, document.body));
|
|
257
257
|
const s = this.normalizePath(
|
|
258
258
|
location.pathname + location.hash + location.search
|
|
259
259
|
);
|
|
260
260
|
n(this, f, s.path);
|
|
261
|
-
const i = new
|
|
261
|
+
const i = new It(this, e(this, f));
|
|
262
262
|
i.setInitialDocument(document), e(this, N).set(e(this, f), i), document.documentElement.setAttribute(
|
|
263
263
|
"data-current-pathname",
|
|
264
264
|
e(this, f)
|
|
265
265
|
), document.documentElement.setAttribute(
|
|
266
266
|
"data-current-leaf",
|
|
267
267
|
s.leaf
|
|
268
|
-
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this,
|
|
268
|
+
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ht)), Dt({
|
|
269
269
|
action: "replace",
|
|
270
270
|
pathname: s.pathname,
|
|
271
271
|
searchParameters: s.parameters,
|
|
272
272
|
hash: s.hash
|
|
273
|
-
}), n(this, j, new
|
|
273
|
+
}), n(this, j, new qt()), p(this, c, vt).call(this, document);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
get currentPath() {
|
|
@@ -280,7 +280,7 @@ const et = class et {
|
|
|
280
280
|
return e(this, it);
|
|
281
281
|
}
|
|
282
282
|
get links() {
|
|
283
|
-
return e(this,
|
|
283
|
+
return e(this, E);
|
|
284
284
|
}
|
|
285
285
|
get scrollElement() {
|
|
286
286
|
return e(this, L);
|
|
@@ -301,45 +301,45 @@ const et = class et {
|
|
|
301
301
|
return t == null ? void 0 : t.clearState();
|
|
302
302
|
}
|
|
303
303
|
normalizePath(t) {
|
|
304
|
-
return
|
|
304
|
+
return Qt(t, {
|
|
305
305
|
base: e(this, A).base,
|
|
306
306
|
trailingSlash: e(this, A).trailingSlash
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
prefetch(t, s) {
|
|
310
310
|
return W(this, null, function* () {
|
|
311
|
-
if (e(this,
|
|
311
|
+
if (e(this, F).length)
|
|
312
312
|
return;
|
|
313
|
-
const i = p(this,
|
|
313
|
+
const i = p(this, c, ct).call(this, t);
|
|
314
314
|
i == null || i.fetch(s);
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
navigate(
|
|
317
|
+
navigate(B) {
|
|
318
318
|
return W(this, arguments, function* (t, {
|
|
319
319
|
historyAction: s = "push",
|
|
320
320
|
centerScroll: i,
|
|
321
|
-
offsetScroll:
|
|
321
|
+
offsetScroll: h,
|
|
322
322
|
revalidate: y,
|
|
323
323
|
keepSearchParameters: M,
|
|
324
324
|
submorph: w,
|
|
325
|
-
clearState:
|
|
325
|
+
clearState: g
|
|
326
326
|
} = {}) {
|
|
327
327
|
var ot;
|
|
328
|
-
if (e(this,
|
|
328
|
+
if (e(this, F).length)
|
|
329
329
|
return;
|
|
330
|
-
const
|
|
330
|
+
const u = this.normalizePath(
|
|
331
331
|
((ot = this.pathnameModifier) == null ? void 0 : ot.call(this, t)) || t
|
|
332
332
|
);
|
|
333
|
-
if (e(this, z) ===
|
|
334
|
-
e(this, x) || p(this,
|
|
333
|
+
if (e(this, z) === u.path || e(this, f) === u.path) {
|
|
334
|
+
e(this, x) || p(this, c, bt).call(this, u.hash || 0, {
|
|
335
335
|
centerScroll: i,
|
|
336
|
-
offsetScroll:
|
|
336
|
+
offsetScroll: h,
|
|
337
337
|
behavior: "smooth"
|
|
338
338
|
});
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
|
-
n(this, z,
|
|
342
|
-
H.checkCurrent(
|
|
341
|
+
n(this, z, u.path), e(this, E).forEach((H) => {
|
|
342
|
+
H.checkCurrent(u.path);
|
|
343
343
|
});
|
|
344
344
|
try {
|
|
345
345
|
let H = !0;
|
|
@@ -357,32 +357,36 @@ const et = class et {
|
|
|
357
357
|
} catch (o) {
|
|
358
358
|
o ? console.error(o) : console.log("Route change canceled"), H = !1;
|
|
359
359
|
}
|
|
360
|
-
if (!H || e(this, z) !==
|
|
361
|
-
e(this,
|
|
360
|
+
if (!H || e(this, z) !== u.path) {
|
|
361
|
+
e(this, E).forEach((o) => {
|
|
362
362
|
o.checkCurrent(e(this, f));
|
|
363
363
|
});
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const
|
|
367
|
-
path:
|
|
366
|
+
const Lt = {
|
|
367
|
+
path: u.path,
|
|
368
368
|
submorph: w
|
|
369
369
|
};
|
|
370
370
|
Y(document, "morphNavigation", {
|
|
371
|
-
detail:
|
|
371
|
+
detail: Lt
|
|
372
372
|
});
|
|
373
|
-
const
|
|
373
|
+
const ut = p(this, c, ct).call(this, e(this, f)), m = p(this, c, ct).call(this, t);
|
|
374
374
|
if (e(this, N).forEach((o) => {
|
|
375
|
-
o.path !==
|
|
376
|
-
}), yield m == null ? void 0 : m.fetch(y), e(this, z) !==
|
|
377
|
-
e(this,
|
|
375
|
+
o.path !== u.path && o.abort();
|
|
376
|
+
}), yield m == null ? void 0 : m.fetch(y), e(this, z) !== u.path) {
|
|
377
|
+
e(this, E).forEach((o) => {
|
|
378
378
|
o.checkCurrent(e(this, f));
|
|
379
379
|
});
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
ut.clearState(), ut.saveScrollState(), ut.saveDocumentState(), e(this, x) || (m.clearScrollState(), m.clearDocumentState()), g && m.clearState(), m.cloneDocument(), e(this, j).textContent = m.title, document.body.appendChild(e(this, j));
|
|
383
|
+
const dt = pt(ft({}, Lt), {
|
|
384
|
+
document: m.document
|
|
384
385
|
});
|
|
385
|
-
|
|
386
|
+
Y(document, "morphStart", {
|
|
387
|
+
detail: dt
|
|
388
|
+
});
|
|
389
|
+
const Pt = Array.from(document.head.children), At = Array.from(m.document.head.children), kt = p(this, c, zt).call(this, Pt, At), Ft = p(this, c, wt).call(this, Pt, kt), at = p(this, c, wt).call(this, At, kt);
|
|
386
390
|
at.forEach((o, k) => {
|
|
387
391
|
if (o.tagName === "SCRIPT" && o.getAttribute("src")) {
|
|
388
392
|
const v = document.createElement("script");
|
|
@@ -394,13 +398,13 @@ const et = class et {
|
|
|
394
398
|
const mt = at.filter((o) => {
|
|
395
399
|
if (o.hasAttribute("data-no-waiting"))
|
|
396
400
|
return !1;
|
|
397
|
-
if (p(this,
|
|
401
|
+
if (p(this, c, yt).call(this, o))
|
|
398
402
|
return !0;
|
|
399
403
|
});
|
|
400
404
|
e(this, A).waitForHeadToLoad && mt.length && (yield new Promise((o) => W(this, null, function* () {
|
|
401
405
|
let k = 0;
|
|
402
406
|
try {
|
|
403
|
-
for (var v =
|
|
407
|
+
for (var v = Ht(mt), tt, O, K; tt = !(O = yield v.next()).done; tt = !1) {
|
|
404
408
|
const lt = O.value;
|
|
405
409
|
lt.onload = () => {
|
|
406
410
|
k++, k === mt.length && o();
|
|
@@ -416,24 +420,24 @@ const et = class et {
|
|
|
416
420
|
throw K[0];
|
|
417
421
|
}
|
|
418
422
|
}
|
|
419
|
-
}))), yield
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
o.hasAttribute("data-permanent") || (p(this,
|
|
423
|
+
}))), yield $t(10);
|
|
424
|
+
const Ct = [];
|
|
425
|
+
Ft.forEach((o) => {
|
|
426
|
+
o.hasAttribute("data-permanent") || (p(this, c, yt).call(this, o) ? Ct.push(o) : o.remove());
|
|
423
427
|
});
|
|
424
|
-
const Bt = p(this,
|
|
425
|
-
e(this, A).morphInsideScrollContainer || p(this,
|
|
428
|
+
const Bt = p(this, c, St).call(this, m.document.body);
|
|
429
|
+
e(this, A).morphInsideScrollContainer || p(this, c, vt).call(this, m.document), document.documentElement.setAttribute(
|
|
426
430
|
"data-current-pathname",
|
|
427
|
-
|
|
431
|
+
u.pathname
|
|
428
432
|
), document.documentElement.setAttribute(
|
|
429
433
|
"data-current-leaf",
|
|
430
|
-
|
|
431
|
-
),
|
|
434
|
+
u.leaf
|
|
435
|
+
), Dt({
|
|
432
436
|
action: s,
|
|
433
|
-
pathname:
|
|
434
|
-
searchParameters:
|
|
435
|
-
hash:
|
|
436
|
-
}), e(this, j).remove(), n(this, it, e(this, f)), n(this, f,
|
|
437
|
+
pathname: u.pathname,
|
|
438
|
+
searchParameters: u.parameters || (M ? location.search : ""),
|
|
439
|
+
hash: u.hash
|
|
440
|
+
}), e(this, j).remove(), n(this, it, e(this, f)), n(this, f, u.path), e(this, J).forEach((o, k) => {
|
|
437
441
|
const v = Bt[k], tt = getComputedStyle(o).getPropertyValue("--morph-duration");
|
|
438
442
|
let O = [], K = [];
|
|
439
443
|
w ? w.forEach((d) => {
|
|
@@ -449,7 +453,7 @@ const et = class et {
|
|
|
449
453
|
d,
|
|
450
454
|
K[S]
|
|
451
455
|
);
|
|
452
|
-
}) : o.prepend(...O),
|
|
456
|
+
}) : o.prepend(...O), Kt(() => {
|
|
453
457
|
O.forEach((d) => {
|
|
454
458
|
var S;
|
|
455
459
|
d instanceof HTMLElement && ((S = d.parentElement) == null || S.style.setProperty(
|
|
@@ -458,14 +462,13 @@ const et = class et {
|
|
|
458
462
|
), d.classList.add("in"));
|
|
459
463
|
});
|
|
460
464
|
});
|
|
461
|
-
const lt = {
|
|
462
|
-
morphElement: o
|
|
463
|
-
|
|
464
|
-
};
|
|
465
|
+
const lt = pt(ft({}, dt), {
|
|
466
|
+
morphElement: o
|
|
467
|
+
});
|
|
465
468
|
Y(document, "morphNewChildrenAdded", {
|
|
466
469
|
detail: lt
|
|
467
470
|
});
|
|
468
|
-
const
|
|
471
|
+
const Ot = new Promise((d) => {
|
|
469
472
|
setTimeout(() => {
|
|
470
473
|
K.forEach((S) => S.remove()), O.forEach((S) => {
|
|
471
474
|
var D;
|
|
@@ -477,7 +480,7 @@ const et = class et {
|
|
|
477
480
|
}), d();
|
|
478
481
|
}, (parseFloat(tt) || 0) * 1e3 + 10);
|
|
479
482
|
});
|
|
480
|
-
e(this,
|
|
483
|
+
e(this, F).push(Ot);
|
|
481
484
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
482
485
|
"--new-document-scroll-position",
|
|
483
486
|
(this.scrollValue.top - m.scrollState.y) * 1 + "px"
|
|
@@ -486,18 +489,16 @@ const et = class et {
|
|
|
486
489
|
this.scrollValue.top + "px"
|
|
487
490
|
), Y(document, "morphBeforeNavigationScroll", {
|
|
488
491
|
detail: m.scrollState
|
|
489
|
-
}),
|
|
492
|
+
}), u.hash ? (m.clearScrollState(), p(this, c, bt).call(this, u.hash, {
|
|
490
493
|
centerScroll: i,
|
|
491
|
-
offsetScroll:
|
|
492
|
-
})) : e(this, x) ? m.restoreScrollPosition() : m.renewScrollPosition(), yield Promise.all(e(this,
|
|
494
|
+
offsetScroll: h
|
|
495
|
+
})) : e(this, x) ? m.restoreScrollPosition() : m.renewScrollPosition(), yield Promise.all(e(this, F)), Ct.forEach((o) => o.remove()), n(this, F, []), e(this, J).forEach((o) => {
|
|
493
496
|
o.querySelectorAll("script").forEach((v) => {
|
|
494
497
|
const tt = document.createElement("script");
|
|
495
498
|
tt.type = "module", tt.src = v.getAttribute("src"), v.replaceWith(tt);
|
|
496
499
|
});
|
|
497
500
|
}), Y(document, "morphComplete", {
|
|
498
|
-
detail:
|
|
499
|
-
document: m.document
|
|
500
|
-
})
|
|
501
|
+
detail: dt
|
|
501
502
|
}), document.documentElement.style.removeProperty(
|
|
502
503
|
"--new-document-scroll-position"
|
|
503
504
|
), window.dispatchEvent(new Event("resize"));
|
|
@@ -508,7 +509,7 @@ const et = class et {
|
|
|
508
509
|
});
|
|
509
510
|
}
|
|
510
511
|
addLink(t) {
|
|
511
|
-
e(this,
|
|
512
|
+
e(this, E).push(new gt(t, this));
|
|
512
513
|
}
|
|
513
514
|
addLinks(t) {
|
|
514
515
|
t.forEach((s) => {
|
|
@@ -516,62 +517,62 @@ const et = class et {
|
|
|
516
517
|
});
|
|
517
518
|
}
|
|
518
519
|
removeLink(t) {
|
|
519
|
-
n(this,
|
|
520
|
+
n(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
520
521
|
}
|
|
521
522
|
destroyOldLinks(t) {
|
|
522
|
-
n(this,
|
|
523
|
+
n(this, E, e(this, E).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
523
524
|
}
|
|
524
525
|
findNewLinks(t) {
|
|
525
526
|
const s = [...t.querySelectorAll("a")].filter(
|
|
526
527
|
e(this, nt)
|
|
527
528
|
);
|
|
528
|
-
e(this,
|
|
529
|
-
...s.map((i) => new
|
|
529
|
+
e(this, E).push(
|
|
530
|
+
...s.map((i) => new gt(i, this))
|
|
530
531
|
);
|
|
531
532
|
}
|
|
532
533
|
findLinks() {
|
|
533
534
|
const t = [
|
|
534
535
|
...document.documentElement.querySelectorAll("a")
|
|
535
536
|
].filter(e(this, nt));
|
|
536
|
-
e(this,
|
|
537
|
+
e(this, E).forEach((s) => s.destroy()), n(this, E, t.map((s) => new gt(s, this)));
|
|
537
538
|
}
|
|
538
539
|
};
|
|
539
|
-
A = new WeakMap(), J = new WeakMap(),
|
|
540
|
+
A = new WeakMap(), J = new WeakMap(), E = new WeakMap(), z = new WeakMap(), f = new WeakMap(), it = new WeakMap(), F = new WeakMap(), x = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), N = new WeakMap(), j = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), nt = new WeakMap(), c = new WeakSet(), ct = function(t) {
|
|
540
541
|
let s = e(this, N).get(t);
|
|
541
|
-
return s || (s = new
|
|
542
|
-
},
|
|
542
|
+
return s || (s = new It(this, t), e(this, N).set(t, s)), s;
|
|
543
|
+
}, St = function(t) {
|
|
543
544
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
544
545
|
return s.length ? s : [t];
|
|
545
|
-
},
|
|
546
|
+
}, zt = function(t, s) {
|
|
546
547
|
return t.filter(
|
|
547
548
|
(i) => s.find(
|
|
548
|
-
(
|
|
549
|
+
(h) => h.outerHTML === i.outerHTML
|
|
549
550
|
)
|
|
550
551
|
);
|
|
551
|
-
},
|
|
552
|
+
}, wt = function(t, s) {
|
|
552
553
|
return t.filter(
|
|
553
554
|
(i) => !s.find(
|
|
554
|
-
(
|
|
555
|
+
(h) => h.outerHTML === i.outerHTML
|
|
555
556
|
)
|
|
556
557
|
);
|
|
557
|
-
},
|
|
558
|
+
}, yt = function(t) {
|
|
558
559
|
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
559
|
-
},
|
|
560
|
+
}, vt = function(t) {
|
|
560
561
|
var s, i;
|
|
561
562
|
(s = e(this, L)) == null || s.removeEventListener(
|
|
562
563
|
"scroll",
|
|
563
564
|
e(this, _)
|
|
564
565
|
), n(this, Z, 0), n(this, Q, 0), n(this, L, e(this, A).scrollSelector && t.querySelector(e(this, A).scrollSelector) || window), n(this, rt, e(this, L) === window), (i = e(this, L)) == null || i.addEventListener("scroll", e(this, _)), e(this, _).call(this);
|
|
565
|
-
},
|
|
566
|
+
}, bt = function(t, s) {
|
|
566
567
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
567
|
-
(typeof i == "number" || i) &&
|
|
568
|
+
(typeof i == "number" || i) && Gt(i, {
|
|
568
569
|
scrollElement: e(this, L),
|
|
569
570
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
570
571
|
center: s == null ? void 0 : s.centerScroll,
|
|
571
572
|
offset: s == null ? void 0 : s.offsetScroll
|
|
572
573
|
});
|
|
573
|
-
},
|
|
574
|
-
let
|
|
574
|
+
}, ht = new WeakMap(), _ = new WeakMap(), et.instance = null;
|
|
575
|
+
let Rt = et;
|
|
575
576
|
export {
|
|
576
|
-
|
|
577
|
+
Rt as Morph
|
|
577
578
|
};
|
package/lib/sequence/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var x=s=>{throw TypeError(s)};var I=(s,n,e)=>n.has(s)||x("Cannot "+e);var t=(s,n,e)=>(I(s,n,"read from private field"),e?e.call(s):n.get(s)),c=(s,n,e)=>n.has(s)?x("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(s):n.set(s,e),l=(s,n,e,i)=>(I(s,n,"write to private field"),i?i.call(s,e):n.set(s,e),e);var L=(s,n,e)=>new Promise((i,f)=>{var w=o=>{try{u(e.next(o))}catch(r){f(r)}},y=o=>{try{u(e.throw(o))}catch(r){f(r)}},u=o=>o.done?i(o.value):Promise.resolve(o.value).then(w,y);u((e=e.apply(s,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../css-property/index.cjs"),R=require("../element-resizer/index.cjs"),k=require("../index-DekP7OZe.cjs"),z=require("../canvas-CU5Xjahf.cjs");require("construct-style-sheets-polyfill");const H=require("../SourceElement-
|
|
1
|
+
"use strict";var x=s=>{throw TypeError(s)};var I=(s,n,e)=>n.has(s)||x("Cannot "+e);var t=(s,n,e)=>(I(s,n,"read from private field"),e?e.call(s):n.get(s)),c=(s,n,e)=>n.has(s)?x("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(s):n.set(s,e),l=(s,n,e,i)=>(I(s,n,"write to private field"),i?i.call(s,e):n.set(s,e),e);var L=(s,n,e)=>new Promise((i,f)=>{var w=o=>{try{u(e.next(o))}catch(r){f(r)}},y=o=>{try{u(e.throw(o))}catch(r){f(r)}},u=o=>o.done?i(o.value):Promise.resolve(o.value).then(w,y);u((e=e.apply(s,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../css-property/index.cjs"),R=require("../element-resizer/index.cjs"),k=require("../index-DekP7OZe.cjs"),z=require("../canvas-CU5Xjahf.cjs");require("construct-style-sheets-polyfill");const H=require("../SourceElement-DCZneQrE.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const M=require("../canvas/index.cjs");function W(s){const n=s.match(/\{([\d-]+)\}/);if(n){const e=n[1].split("-");if(e.length===2){const i=parseInt(e[0],10),f=parseInt(e[1],10);return{start:i,end:f}}}return null}var h,E,S,m,d,b,g,p,a,v;class B extends H.SourceElement{constructor(e){super();c(this,h,[]);c(this,E,new q.CSSProperty(this,"--fit","contain"));c(this,S,new q.CSSProperty(this,"--autoplay",!1));c(this,m,new q.CSSProperty(this,"--offset-x",.5));c(this,d,new q.CSSProperty(this,"--offset-y",.5));c(this,b,null);c(this,g,0);c(this,p,1);c(this,a,()=>{if(t(this,h).length){const e=t(this,h)[0];t(this,E).current==="cover"?l(this,b,z.cover(e.naturalWidth,e.naturalHeight,this.consumerElement.width,this.consumerElement.height,t(this,m).current,t(this,d).current)):l(this,b,z.contain(e.naturalWidth,e.naturalHeight,this.consumerElement.width,this.consumerElement.height,t(this,m).current,t(this,d).current))}});c(this,v,e=>{if(this.status.isFalse("loaded")||!t(this,b))return;e.detail.context.clearRect(0,0,e.detail.width,e.detail.height);const i=t(this,h)[t(this,g)];i&&e.detail.context.drawImage(i,...t(this,b)),t(this,S).current&&l(this,g,(t(this,g)+1)%t(this,h).length)});k.isBrowser&&(l(this,p,parseInt(((e==null?void 0:e.pad)||this.getAttribute("pad")||"1").toString())),t(this,E).subscribe(t(this,a)),t(this,m).subscribe(t(this,a)),t(this,d).subscribe(t(this,a)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",t(this,v))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",t(this,v))}))}setProgress(e){t(this,h).length&&l(this,g,Math.floor((t(this,h).length-1)*e))}connectedCallback(){super.connectedCallback(),t(this,S).observe(),t(this,E).observe(),t(this,m).observe(),t(this,d).observe(),R.elementResizer.subscribe(this,t(this,a))}disconnectedCallback(){super.disconnectedCallback(),t(this,S).unobserve(),t(this,E).unobserve(),t(this,m).unobserve(),t(this,d).unobserve(),l(this,h,[]),R.elementResizer.unsubscribe(t(this,a)),this.consumerElement.removeEventListener("canvasRender",t(this,v))}createConsumer(){return new M.CanvasElement}consumeSource(e){return L(this,null,function*(){var i,f,w,y;if(e){this.consumerElement.removeEventListener("canvasRender",t(this,v));const u=[],o=W(e);if(o)for(let r=o.start;r<=o.end;r++){const P=e.replace(/\{([^}]+)\}/,r.toString().padStart(t(this,p),"0")),C=new Image;C.src=P,u.push(C)}else{const r=new Image;r.src=e,u.push(r)}try{yield Promise.all(u.map((r,P)=>new Promise((C,_)=>{r.onload=()=>{C()},r.onerror=j=>{_(`${r.src} Image not found`)}}))),l(this,h,u),t(this,a).call(this),(f=(i=this.consumerElement).onload)==null||f.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",t(this,v))}catch(r){console.error(r),(y=(w=this.consumerElement).onerror)==null||y.call(w,new Event("error"))}}})}}h=new WeakMap,E=new WeakMap,S=new WeakMap,m=new WeakMap,d=new WeakMap,b=new WeakMap,g=new WeakMap,p=new WeakMap,a=new WeakMap,v=new WeakMap;k.isBrowser&&!customElements.get("e-sequence")&&customElements.define("e-sequence",B);exports.SequenceElement=B;
|
package/lib/sequence/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { elementResizer as k } from "../element-resizer/index.js";
|
|
|
24
24
|
import { i as q } from "../index-Bv9zgfdb.js";
|
|
25
25
|
import { c as B, a as H } from "../canvas-DeZ0SLUJ.js";
|
|
26
26
|
import "construct-style-sheets-polyfill";
|
|
27
|
-
import { a as W } from "../SourceElement-
|
|
27
|
+
import { a as W } from "../SourceElement-CpB95xQn.js";
|
|
28
28
|
import "../window-resizer/index.js";
|
|
29
29
|
import "../Store-0BVty6AZ.js";
|
|
30
30
|
import { CanvasElement as A } from "../canvas/index.js";
|
package/lib/source/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../SourceElement-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../SourceElement-DCZneQrE.cjs");exports.Source=e.Source;exports.SourceElement=e.SourceElement;exports.SourceManager=e.SourceManager;exports.SourceSet=e.SourceSet;
|
package/lib/source/index.js
CHANGED
package/lib/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var i=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-
|
|
1
|
+
"use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var i=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-DCZneQrE.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const p=require("../index-DekP7OZe.cjs"),b=require("../events-KVanG9sR.cjs");require("construct-style-sheets-polyfill");const o=require("../ticker/index.cjs");var r,n,a;class d extends E.SourceElement{constructor(){super(...arguments);u(this,r,0);u(this,n,!1);u(this,a,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>i(this,r)&&c(this,r,t),b.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:i(this,r)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(i(this,a)),i(this,n)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,n,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,n,!0)),o.ticker.subscribe(i(this,a))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&this.consumerElement.pause(),this.hasAttribute("release-pause")&&this.consumerElement.pause(),this.hasAttribute("release-stop")&&(this.consumerElement.pause(),this.consumerElement.currentTime=0),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")}),this.addEventListener("click",()=>{this.hasAttribute("click-controls")&&(this.consumerElement.paused?this.consumerElement.play():this.consumerElement.pause())})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(i(this,a)),c(this,r,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.hasAttribute("volume")&&(this.consumerElement.volume=parseFloat(this.getAttribute("volume")||"1"))}}r=new WeakMap,n=new WeakMap,a=new WeakMap;p.isBrowser&&!customElements.get("e-video")&&customElements.define("e-video",d);exports.VideoElement=d;
|
package/lib/video/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var l = (e) => {
|
|
|
3
3
|
};
|
|
4
4
|
var h = (e, s, t) => s.has(e) || l("Cannot " + t);
|
|
5
5
|
var i = (e, s, t) => (h(e, s, "read from private field"), t ? t.call(e) : s.get(e)), c = (e, s, t) => s.has(e) ? l("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), o = (e, s, t, m) => (h(e, s, "write to private field"), m ? m.call(e, t) : s.set(e, t), t);
|
|
6
|
-
import { a as d } from "../SourceElement-
|
|
6
|
+
import { a as d } from "../SourceElement-CpB95xQn.js";
|
|
7
7
|
import "../window-resizer/index.js";
|
|
8
8
|
import "../Store-0BVty6AZ.js";
|
|
9
9
|
import { i as p } from "../index-Bv9zgfdb.js";
|
package/lib/youtube/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=s=>{throw TypeError(s)};var E=(s,r,t)=>r.has(s)||v("Cannot "+t);var e=(s,r,t)=>(E(s,r,"read from private field"),t?t.call(s):r.get(s)),o=(s,r,t)=>r.has(s)?v("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,t),u=(s,r,t,a)=>(E(s,r,"write to private field"),a?a.call(s,t):r.set(s,t),t),w=(s,r,t)=>(E(s,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../SourceElement-
|
|
1
|
+
"use strict";var v=s=>{throw TypeError(s)};var E=(s,r,t)=>r.has(s)||v("Cannot "+t);var e=(s,r,t)=>(E(s,r,"read from private field"),t?t.call(s):r.get(s)),o=(s,r,t)=>r.has(s)?v("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,t),u=(s,r,t,a)=>(E(s,r,"write to private field"),a?a.call(s,t):r.set(s,t),t),w=(s,r,t)=>(E(s,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("../SourceElement-DCZneQrE.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const L=require("../index-DekP7OZe.cjs"),T=require("../events-KVanG9sR.cjs"),_=require("../string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");var i,c,n,y,l,f,b,R,p,I;const d=class d extends A.SourceElement{constructor(){super();o(this,p);o(this,i);o(this,c);o(this,n,!1);o(this,y,!1);o(this,l,()=>{u(this,n,e(this,n)||this.hasAttribute("autoplay")&&!this.hasAttribute("capture-autoplay")),u(this,i,new window.YT.Player(e(this,c),{playerVars:{mute:this.hasAttribute("muted")?1:0,controls:this.hasAttribute("controls")?1:0},events:{onReady:e(this,f),onError:e(this,b),onStateChange:e(this,R)}}))});o(this,f,()=>{u(this,y,!0),w(this,p,I).call(this)});o(this,b,t=>{var a,h;console.error("YouTube: Ошибка при загрузке видео:",this.currentURL,t),(h=(a=this.consumerElement).onerror)==null||h.call(a,new Event("error"))});o(this,R,()=>{});u(this,c,"yt-"+_.generateId(10)),d.__apiReady||(window.onYouTubeIframeAPIReady=()=>{d.__apiReady=!0,T.dispatchEvent(window,"youTubeIframeAPIReady")}),this.addEventListener("sourceCapture",()=>{this.hasAttribute("capture-autoplay")&&(e(this,y)?e(this,i).playVideo():u(this,n,!0))}),this.addEventListener("sourceRelease",()=>{e(this,i)&&this.hasAttribute("capture-autoplay")&&(e(this,i).pauseVideo(),this.hasAttribute("replay")&&e(this,i).seekTo(0))})}static __onYouTubeIframeAPIReady(){this.__apiReady=!0}createConsumer(){const t=document.createElement("div");return t.id=e(this,c),t}consumeSource(t){var a;if(t){if(!document.getElementById("youtube-script")){const h=document.createElement("script");h.id,h.src="https://www.youtube.com/iframe_api";const g=document.getElementsByTagName("script")[0];(a=g.parentNode)==null||a.insertBefore(h,g)}e(this,i)?w(this,p,I).call(this):d.__apiReady?e(this,l).call(this):addEventListener("youTubeIframeAPIReady",e(this,l))}else e(this,i)&&e(this,i).stopVideo()}disconnectedCallback(){super.disconnectedCallback(),e(this,i)&&e(this,i).destroy(),removeEventListener("youTubeIframeAPIReady",e(this,l))}};i=new WeakMap,c=new WeakMap,n=new WeakMap,y=new WeakMap,l=new WeakMap,f=new WeakMap,b=new WeakMap,R=new WeakMap,p=new WeakSet,I=function(){var t,a;this.currentURL&&(this.currentURL.startsWith("http")?e(this,i).loadVideoByUrl(this.currentURL):e(this,i).loadVideoById(this.currentURL)),e(this,n)?e(this,i).playVideo():e(this,i).stopVideo(),u(this,n,!1),(a=(t=this.consumerElement).onload)==null||a.call(t,new Event("load"))},d.__apiReady=!1;let m=d;L.isBrowser&&!customElements.get("e-youtube")&&customElements.define("e-youtube",m);exports.YouTubeElement=m;
|
package/lib/youtube/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var L = (s) => {
|
|
|
3
3
|
};
|
|
4
4
|
var b = (s, r, t) => r.has(s) || L("Cannot " + t);
|
|
5
5
|
var e = (s, r, t) => (b(s, r, "read from private field"), t ? t.call(s) : r.get(s)), o = (s, r, t) => r.has(s) ? L("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(s) : r.set(s, t), u = (s, r, t, a) => (b(s, r, "write to private field"), a ? a.call(s, t) : r.set(s, t), t), E = (s, r, t) => (b(s, r, "access private method"), t);
|
|
6
|
-
import { a as g } from "../SourceElement-
|
|
6
|
+
import { a as g } from "../SourceElement-CpB95xQn.js";
|
|
7
7
|
import "../window-resizer/index.js";
|
|
8
8
|
import "../Store-0BVty6AZ.js";
|
|
9
9
|
import { i as v } from "../index-Bv9zgfdb.js";
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";var Q=o=>{throw TypeError(o)};var N=(o,n,e)=>n.has(o)||Q("Cannot "+e);var t=(o,n,e)=>(N(o,n,"read from private field"),e?e.call(o):n.get(o)),i=(o,n,e)=>n.has(o)?Q("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),s=(o,n,e,c)=>(N(o,n,"write to private field"),c?c.call(o,e):n.set(o,e),e),D=(o,n,e)=>(N(o,n,"access private method"),e);const et=require("./element-linked-store/index.cjs"),st=require("./index-DekP7OZe.cjs"),F=require("./events-KVanG9sR.cjs"),it=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");const W=require("./loading/index.cjs"),rt=require("./order/index.cjs"),X=require("./window-resizer/index.cjs"),nt=require("./Store-Cd1GlEmZ.cjs");var T,q,z,L,u,f,v;class Y{constructor(n){i(this,T);i(this,q);i(this,z);i(this,L);i(this,u);i(this,f);i(this,v);s(this,T,n);let e=n.split(".");const c=/\b\d{1,2}x\b/g,d=e.find(g=>g.match(c)&&parseInt(g));s(this,z,d?parseInt(d):1),d&&(e=e.slice(0,-1)),s(this,q,e.length>1?e.slice(0,-1).join("."):e.join("."));const l=/\d+max/g,x=/\d+min/g,P=/\d+mar/g,U=/\d+mir/g,K=e.find(g=>g.match(l)),h=e.find(g=>g.match(x)),E=e.find(g=>g.match(P)),J=e.find(g=>g.match(U));E?(s(this,u,parseInt(E)),s(this,f,"max"),s(this,L,`(max-aspect-ratio: ${t(this,u)})`)):J?(s(this,u,parseInt(J)),s(this,f,"max"),s(this,L,`(min-aspect-ratio: ${t(this,u)})`)):K?(s(this,u,parseInt(K)),s(this,f,"max"),s(this,L,`(max-width: ${t(this,u)}px)`)):h?(s(this,u,parseInt(h)),s(this,L,`(min-width: ${t(this,u)}px)`),s(this,f,"min")):(s(this,u,0),s(this,L,`(min-width: ${t(this,u)}px)`),s(this,f,"min")),s(this,q,t(this,q).replace(`.${t(this,u)}${t(this,f)}`,"")),s(this,v,e[e.length-1]===t(this,q)?"":"."+e[e.length-1]),s(this,v,t(this,v).replace(`.${t(this,u)}${t(this,f)}`,""))}get url(){return t(this,T)}get name(){return t(this,q)}get density(){return t(this,z)}get query(){return t(this,L)}get extension(){return t(this,v)}get queryType(){return t(this,f)}get queryValue(){return t(this,u)}}T=new WeakMap,q=new WeakMap,z=new WeakMap,L=new WeakMap,u=new WeakMap,f=new WeakMap,v=new WeakMap;var w;class Z{constructor(n,e){i(this,w);s(this,w,new Map);const c=(e==null?void 0:e.mediaBuckets)!==!1,d=typeof n=="string"?c?n.trim().split(",").map(h=>h.trim()).filter(h=>!!h):[n]:n,l=[];d.forEach(h=>{const E=new Y(h);l.push([E.query,E])});const x=l.filter(h=>h[1].queryType.includes("max")).sort((h,E)=>E[1].queryValue-h[1].queryValue),P=l.filter(h=>h[1].queryType.includes("min")&&h[1].queryValue!==0).sort((h,E)=>h[1].queryValue-E[1].queryValue),U=l.filter(h=>h[0]==="(min-width: 0px)");(U?[...U,...x,...P]:[...x,...P]).forEach(h=>{t(this,w).has(h[0])||t(this,w).set(h[0],[]),t(this,w).get(h[0]).push(h[1])})}get mediaBuckets(){return t(this,w)}}w=new WeakMap;var M,R;class tt extends nt.Store{constructor(e){super(void 0);i(this,M);i(this,R,()=>{let e;t(this,M).mediaBuckets.forEach((l,x)=>{matchMedia(x).matches&&(e=l)});let c,d=0;e==null||e.forEach(l=>{l.density>d&&l.density<=Math.max(devicePixelRatio,1)&&(d=l.density,c=l)}),e!=null&&e.length&&!c&&(c=e[0]),this.current=c});s(this,M,new Z(e.srcset,e.sourceSetOptions))}updateSource(e){s(this,M,new Z(e.srcset,e.sourceSetOptions)),t(this,R).call(this)}close(){super.close(),this.disconnect()}connect(){X.windowResizer.subscribe(t(this,R),rt.RESIZE_ORDER.SOURCE_MANAGER),t(this,R).call(this)}disconnect(){X.windowResizer.unsubscribe(t(this,R))}}M=new WeakMap,R=new WeakMap;let ht=0;var m,r,y,b,p,O,k,a,A,I,S,C,$,H,j,V,G,B,_;class at extends HTMLElement{constructor(e){super();i(this,$);i(this,m,null);i(this,r,null);i(this,y,!1);i(this,b,!1);i(this,p,!1);i(this,O,"");i(this,k,"");i(this,a,new et.ElementLinkedStore(this,{loading:!1,loaded:!1,error:!1,clear:!1,playing:!1}));i(this,A,null);i(this,I);i(this,S,null);i(this,C);i(this,j,e=>{const c=e[0];t(this,p)&&(!t(this,b)||this.hasAttribute("reload-source"))&&c.isIntersecting&&this.triggerLazyLoad(),c.isIntersecting?F.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(D(this,$,H).call(this,void 0),s(this,b,!1)),F.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,V,()=>{t(this,a).set("loaded",!0),t(this,a).set("error",!1),t(this,a).set("loading",!1),!t(this,p)&&!t(this,y)&&W.loading.complete(t(this,k)),F.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,I,setTimeout(()=>{t(this,a).set("clear",!0)},parseFloat(e)*1e3)):t(this,a).set("clear",!0),s(this,y,!0)});i(this,G,e=>{t(this,a).set("loaded",!1),t(this,a).set("error",!0),t(this,a).set("loading",!1),!t(this,p)&&!t(this,y)&&W.loading.error(t(this,k)),F.dispatchEvent(this,"sourceError",{custom:!0}),s(this,y,!0)});i(this,B,()=>{t(this,a).set("playing",!0)});i(this,_,()=>{t(this,a).set("playing",!1)});s(this,C,e==null?void 0:e.sourceSetOptions),st.isBrowser&&window.IntersectionObserver&&s(this,A,new IntersectionObserver(t(this,j)))}get consumerElement(){return t(this,r)}get sourceManager(){return t(this,m)}get status(){return t(this,a)}get isLazy(){return t(this,p)}get currentURL(){return t(this,S)}get isFirstLoadHappened(){return t(this,y)}triggerLazyLoad(){!t(this,b)&&t(this,m).current&&t(this,m).current!==t(this,m).previous&&(s(this,b,!0),D(this,$,H).call(this,t(this,m).current))}connectedCallback(){s(this,O,`source-consumer-${++ht}`);const e=this.getAttribute("srcset")||"",c=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;c&&t(this,a).addElement(c),s(this,r,this.createConsumer()),t(this,r).style.cssText=`
|
|
2
|
-
display: block;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
`,t(this,r).classList.add("source-consumer"),t(this,r).addEventListener("play",t(this,B)),t(this,r).addEventListener("pause",t(this,_)),Array.from(this.attributes).forEach(d=>{if(d.name!=="srcset"){const l=d.nodeValue||"",x=it.kebabToCamel(d.name);x in t(this,r)&&(t(this,r)[x]=l||!0)}}),this.appendChild(t(this,r)),s(this,m,new tt({srcset:e,sourceSetOptions:t(this,C)})),s(this,p,this.hasAttribute("lazy")),t(this,m).subscribe(d=>{(!t(this,p)||t(this,p)&&t(this,b))&&D(this,$,H).call(this,d.current)}),t(this,m).connect(),t(this,A).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,I)),t(this,A).disconnect(),(e=t(this,m))==null||e.close(),t(this,r)&&(t(this,r).removeEventListener("play",t(this,B)),t(this,r).removeEventListener("pause",t(this,_)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,r).remove()),s(this,y,!1),s(this,b,!1),t(this,a).reset()}}m=new WeakMap,r=new WeakMap,y=new WeakMap,b=new WeakMap,p=new WeakMap,O=new WeakMap,k=new WeakMap,a=new WeakMap,A=new WeakMap,I=new WeakMap,S=new WeakMap,C=new WeakMap,$=new WeakSet,H=function(e){if(clearTimeout(t(this,I)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,a).set("loaded",!1),t(this,a).set("error",!1),t(this,a).set("loading",!1),t(this,a).set("clear",!1),t(this,a).set("playing",!1),e){s(this,k,`${t(this,O)}-${e.url}`);const c=this.hasAttribute("keep-source-parameters");t(this,a).set("loading",!0),s(this,S,c?e.url:e.name+e.extension),this.consumeSource(t(this,S)),!t(this,p)&&!t(this,y)&&W.loading.add(t(this,k)),t(this,r).onloadeddata=()=>{t(this,V).call(this)},t(this,r).onload=()=>{t(this,V).call(this)},t(this,r).onerror=()=>{t(this,G).call(this,t(this,S))}}else s(this,S,null),this.consumeSource(null)},j=new WeakMap,V=new WeakMap,G=new WeakMap,B=new WeakMap,_=new WeakMap;exports.Source=Y;exports.SourceElement=at;exports.SourceManager=tt;exports.SourceSet=Z;
|