aptechka 0.42.3 → 0.42.5
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/morph/index.cjs +1 -1
- package/lib/morph/index.js +18 -18
- package/lib/source/index.cjs +2 -2
- package/lib/source/index.js +14 -14
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +20 -19
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ot=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),ht=n=>{throw TypeError(n)};var Q=(n,t,i)=>t.has(n)||ht("Cannot "+i);var e=(n,t,i)=>(Q(n,t,"read from private field"),i?i.call(n):t.get(n)),o=(n,t,i)=>t.has(n)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,i),c=(n,t,i,s)=>(Q(n,t,"write to private field"),s?s.call(n,i):t.set(n,i),i),
|
|
1
|
+
"use strict";var ot=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),ht=n=>{throw TypeError(n)};var Q=(n,t,i)=>t.has(n)||ht("Cannot "+i);var e=(n,t,i)=>(Q(n,t,"read from private field"),i?i.call(n):t.get(n)),o=(n,t,i)=>t.has(n)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,i),c=(n,t,i,s)=>(Q(n,t,"write to private field"),s?s.call(n,i):t.set(n,i),i),y=(n,t,i)=>(Q(n,t,"access private method"),i);var z=(n,t,i)=>new Promise((s,l)=>{var u=f=>{try{L(i.next(f))}catch(P){l(P)}},a=f=>{try{L(i.throw(f))}catch(P){l(P)}},L=f=>f.done?s(f.value):Promise.resolve(f.value).then(u,a);L((i=i.apply(n,t)).next())});var ct=(n,t,i)=>(t=n[ot("asyncIterator")])?t.call(n):(n=n[ot("iterator")](),t={},i=(s,l)=>(l=n[s])&&(t[s]=u=>new Promise((a,L,f)=>(u=l.call(n,u),f=u.done,Promise.resolve(u.value).then(P=>a({value:P,done:f}),L)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../browser-CpzFX2xg.cjs"),K=require("../events-KVanG9sR.cjs"),V=require("../url-BiHPIsKq.cjs"),dt=require("../loading/index.cjs");var T,h,p,q,x,H,D,k;class lt{constructor(t,i){o(this,T);o(this,h);o(this,p);o(this,q);o(this,x);o(this,H);o(this,D,t=>{t.preventDefault(),e(this,T).links.forEach(i=>{var s;e(this,p)===e(i,p)||(s=e(i,H))!=null&&s.includes(e(this,p))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,T).navigate(e(this,p),{historyAction:e(this,q),state:e(this,x)})});o(this,k,()=>{e(this,T).prefetch(e(this,p)),e(this,h).removeEventListener("pointerenter",e(this,k))});var u,a;c(this,T,i),c(this,h,t),c(this,p,e(this,h).getAttribute("href")||"/"),c(this,q,e(this,h).getAttribute("data-history-action")||"push"),c(this,x,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,D));const s=i.normalizePath(e(this,p)),l=i.normalizePath(location.pathname);c(this,H,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(L=>i.normalizePath(L.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(s.pathname)&&e(this,h).classList.add("current"):s.pathname===l.pathname||(a=e(this,H))!=null&&a.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,D)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}T=new WeakMap,h=new WeakMap,p=new WeakMap,q=new WeakMap,x=new WeakMap,H=new WeakMap,D=new WeakMap,k=new WeakMap;var I,O,R,S,E,Y,M,b,g,_,B,v,m,U,X,ut,Z,G;class gt{constructor(t){o(this,m);o(this,I,null);o(this,O,null);o(this,R,null);o(this,S,null);o(this,E,[]);o(this,Y,new DOMParser);o(this,M,new Map);o(this,b);o(this,g,null);o(this,_);o(this,B);o(this,v,[]);o(this,G,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(pt.isBrowser){c(this,I,V.normalizeBase(t==null?void 0:t.base)),c(this,O,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,R,(t==null?void 0:t.cachePages)!==!1),c(this,S,y(this,m,X).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,g,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,g)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,G)),V.changeHistory("replace",e(this,g),i.parameters,i.hash),e(this,S).map(s=>[...s.children]).flat().forEach(s=>{s instanceof HTMLElement&&s.classList.add("current")})}}get currentPathname(){return e(this,g)}get previousPathname(){return e(this,_)}get currentState(){return e(this,B)}get links(){return e(this,E)}normalizePath(t){return V.splitPath(t,e(this,I))}prefetch(t){return z(this,null,function*(){const i=this.normalizePath(t);return y(this,m,U).call(this,i.pathname)})}navigate(l){return z(this,arguments,function*(t,{historyAction:i="push",state:s}={}){var $;if(e(this,v).length)return;const u=this.normalizePath(t);let{pathname:a,hash:L,parameters:f,leaf:P}=u;if(e(this,b)===a||e(this,g)===a)return;c(this,B,s),c(this,b,a);const N=e(this,M).has(a);try{dt.loading.add("__morph");let F=!0;if(K.dispatchEvent(document,"morphBeforeNavigation",{detail:{pathname:a,isCached:N,state:s}}),this.preprocessor)try{yield new Promise((r,w)=>{var A;(A=this.preprocessor)==null||A.call(this,{pathname:a,resolve:r,reject:w,isCached:N,state:s})})}catch(r){r?console.error(r):console.log("Route change canceled"),F=!1}if(!F||e(this,b)!==a)return;const tt=e(this,M).get(a)||(yield y(this,m,U).call(this,a));if(e(this,b)!==a)return;const et=Array.from(document.head.children),it=Array.from(tt.head.cloneNode(!0).children),st=y(this,m,ut).call(this,et,it),mt=y(this,m,Z).call(this,et,st),W=y(this,m,Z).call(this,it,st);W.forEach((r,w)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const A=document.createElement("script");A.type="module",A.src=r.getAttribute("src"),W[w]=A}}),W.forEach(r=>{document.head.appendChild(r)});const J=W.filter(r=>!r.hasAttribute("data-no-waiting")&&(r.tagName==="STYLE"||r.tagName==="SCRIPT"||r.tagName==="LINK")&&r.getAttribute("rel")!=="canonical");e(this,O)&&J.length&&(yield new Promise(r=>z(this,null,function*(){let w=0;try{for(var A=ct(J),nt,C,rt;nt=!(C=yield A.next()).done;nt=!1){const j=C.value;j.onload=()=>{w++,w===J.length&&r()}}}catch(C){rt=[C]}finally{try{nt&&(C=A.return)&&(yield C.call(A))}finally{if(rt)throw rt[0]}}}))),mt.forEach(r=>{r.hasAttribute("data-permanent")||r.remove()}),c(this,_,e(this,g)),c(this,g,a),V.changeHistory(i,a,f,L);const ft=y(this,m,X).call(this,tt.body.cloneNode(!0));e(this,v).forEach(r=>clearTimeout(r)),c(this,v,[]),e(this,S).forEach((r,w)=>{const A=ft[w],nt=getComputedStyle(r).getPropertyValue("--morph-duration"),C=[...A.childNodes];if(nt){const rt=[...r.childNodes];rt.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old")}),C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("new")}),r.append(...C),setTimeout(()=>{C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("in")})},10);const j={element:r,pathname:a,isCached:N,state:s};K.dispatchEvent(document,"morphBeforeElementOut",{detail:j});const at=setTimeout(()=>{rt.forEach(d=>d.remove()),C.forEach(d=>{d instanceof HTMLElement&&(d.classList.remove("new","in"),d.classList.add("current"))}),K.dispatchEvent(document,"morphAfterElementOut",{detail:j}),c(this,v,e(this,v).filter(d=>d!==at))},(parseFloat(nt)||0)*1e3+10);e(this,v).push(at)}else r.innerHTML="",r.append(...C)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",a),document.documentElement.setAttribute("data-current-leaf",P),($=this.postprocessor)==null||$.call(this,{pathname:a,isCached:N,state:s}),K.dispatchEvent(document,"morphAfterNavigation",{detail:{pathname:a,isCached:N,state:s}}),dt.loading.complete("__morph")}catch(F){console.error(F)}c(this,b,void 0)})}addLink(t){e(this,E).push(new lt(t,this))}addLinks(t){t.forEach(i=>{this.addLink(i)})}removeLink(t){c(this,E,e(this,E).filter(i=>i.element===t?(i.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var s;return((s=i.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")&&!i.closest("[data-morph-skip]")});e(this,E).forEach(i=>i.destroy()),c(this,E,t.map(i=>new lt(i,this)))}}I=new WeakMap,O=new WeakMap,R=new WeakMap,S=new WeakMap,E=new WeakMap,Y=new WeakMap,M=new WeakMap,b=new WeakMap,g=new WeakMap,_=new WeakMap,B=new WeakMap,v=new WeakMap,m=new WeakSet,U=function(t){return z(this,null,function*(){const i=e(this,M).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),u=e(this,Y).parseFromString(l,"text/html");return e(this,R)&&e(this,M).set(t,u),u})},X=function(t){const i=[...t.querySelectorAll("[data-morph]")];return i.length?i:[t]},ut=function(t,i){return t.filter(s=>i.find(l=>l.outerHTML===s.outerHTML))},Z=function(t,i){return t.filter(s=>!i.find(l=>l.outerHTML===s.outerHTML))},G=new WeakMap;exports.Morph=gt;
|
package/lib/morph/index.js
CHANGED
|
@@ -6,23 +6,23 @@ var e = (n, t, s) => (J(n, t, "read from private field"), s ? s.call(n) : t.get(
|
|
|
6
6
|
var z = (n, t, s) => new Promise((i, l) => {
|
|
7
7
|
var u = (f) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
g(s.next(f));
|
|
10
10
|
} catch (b) {
|
|
11
11
|
l(b);
|
|
12
12
|
}
|
|
13
13
|
}, r = (f) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
15
|
+
g(s.throw(f));
|
|
16
16
|
} catch (b) {
|
|
17
17
|
l(b);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, g = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(u, r);
|
|
20
|
+
g((s = s.apply(n, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var ht = (n, t, s) => (t = n[rt("asyncIterator")]) ? t.call(n) : (n = n[rt("iterator")](), t = {}, s = (i, l) => (l = n[i]) && (t[i] = (u) => new Promise((r,
|
|
22
|
+
var ht = (n, t, s) => (t = n[rt("asyncIterator")]) ? t.call(n) : (n = n[rt("iterator")](), t = {}, s = (i, l) => (l = n[i]) && (t[i] = (u) => new Promise((r, g, f) => (u = l.call(n, u), f = u.done, Promise.resolve(u.value).then((b) => r({ value: b, done: f }), g)))), s("next"), s("return"), t);
|
|
23
23
|
import { i as pt } from "../browser-0zX67oeU.js";
|
|
24
24
|
import { d as V } from "../events-CsVF98U6.js";
|
|
25
|
-
import { n as Lt, c as ct, s as
|
|
25
|
+
import { n as Lt, c as ct, s as gt } from "../url-B5eH5z6S.js";
|
|
26
26
|
import { loading as dt } from "../loading/index.js";
|
|
27
27
|
var T, h, p, x, D, H, I, M;
|
|
28
28
|
class lt {
|
|
@@ -50,7 +50,7 @@ class lt {
|
|
|
50
50
|
"data-history-action"
|
|
51
51
|
) || "push"), c(this, D, e(this, h).getAttribute("data-state") || void 0), e(this, h).addEventListener("click", e(this, I));
|
|
52
52
|
const i = s.normalizePath(e(this, p)), l = s.normalizePath(location.pathname);
|
|
53
|
-
c(this, H, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((
|
|
53
|
+
c(this, H, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((g) => s.normalizePath(g.trim()).pathname)), e(this, h).hasAttribute("data-include") ? l.pathname.includes(i.pathname) && e(this, h).classList.add("current") : i.pathname === l.pathname || (r = e(this, H)) != null && r.includes(l.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, M));
|
|
54
54
|
}
|
|
55
55
|
get element() {
|
|
56
56
|
return e(this, h);
|
|
@@ -60,7 +60,7 @@ class lt {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
T = new WeakMap(), h = new WeakMap(), p = new WeakMap(), x = new WeakMap(), D = new WeakMap(), H = new WeakMap(), I = new WeakMap(), M = new WeakMap();
|
|
63
|
-
var R, B, F, N,
|
|
63
|
+
var R, B, F, N, E, Y, k, y, L, O, _, v, m, Q, U, ut, X, j;
|
|
64
64
|
class yt {
|
|
65
65
|
constructor(t) {
|
|
66
66
|
o(this, m);
|
|
@@ -68,7 +68,7 @@ class yt {
|
|
|
68
68
|
o(this, B, null);
|
|
69
69
|
o(this, F, null);
|
|
70
70
|
o(this, N, null);
|
|
71
|
-
o(this,
|
|
71
|
+
o(this, E, []);
|
|
72
72
|
o(this, Y, new DOMParser());
|
|
73
73
|
o(this, k, /* @__PURE__ */ new Map());
|
|
74
74
|
o(this, y);
|
|
@@ -108,10 +108,10 @@ class yt {
|
|
|
108
108
|
return e(this, _);
|
|
109
109
|
}
|
|
110
110
|
get links() {
|
|
111
|
-
return e(this,
|
|
111
|
+
return e(this, E);
|
|
112
112
|
}
|
|
113
113
|
normalizePath(t) {
|
|
114
|
-
return
|
|
114
|
+
return gt(t, e(this, R));
|
|
115
115
|
}
|
|
116
116
|
prefetch(t) {
|
|
117
117
|
return z(this, null, function* () {
|
|
@@ -125,7 +125,7 @@ class yt {
|
|
|
125
125
|
if (e(this, v).length)
|
|
126
126
|
return;
|
|
127
127
|
const u = this.normalizePath(t);
|
|
128
|
-
let { pathname: r, hash:
|
|
128
|
+
let { pathname: r, hash: g, parameters: f, leaf: b } = u;
|
|
129
129
|
if (e(this, y) === r || e(this, L) === r)
|
|
130
130
|
return;
|
|
131
131
|
c(this, _, i), c(this, y, r);
|
|
@@ -165,7 +165,7 @@ class yt {
|
|
|
165
165
|
document.head.appendChild(a);
|
|
166
166
|
});
|
|
167
167
|
const G = W.filter(
|
|
168
|
-
(a) => (a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK") && a.getAttribute("rel") !== "canonical"
|
|
168
|
+
(a) => !a.hasAttribute("data-no-waiting") && (a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK") && a.getAttribute("rel") !== "canonical"
|
|
169
169
|
);
|
|
170
170
|
e(this, B) && G.length && (yield new Promise((a) => z(this, null, function* () {
|
|
171
171
|
let A = 0;
|
|
@@ -188,7 +188,7 @@ class yt {
|
|
|
188
188
|
}
|
|
189
189
|
}))), mt.forEach((a) => {
|
|
190
190
|
a.hasAttribute("data-permanent") || a.remove();
|
|
191
|
-
}), c(this, O, e(this, L)), c(this, L, r), ct(s, r, f,
|
|
191
|
+
}), c(this, O, e(this, L)), c(this, L, r), ct(s, r, f, g);
|
|
192
192
|
const ft = P(this, m, U).call(this, $.body.cloneNode(!0));
|
|
193
193
|
e(this, v).forEach((a) => clearTimeout(a)), c(this, v, []), e(this, N).forEach((a, A) => {
|
|
194
194
|
const w = ft[A], it = getComputedStyle(a).getPropertyValue("--morph-duration"), S = [...w.childNodes];
|
|
@@ -236,7 +236,7 @@ class yt {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
addLink(t) {
|
|
239
|
-
e(this,
|
|
239
|
+
e(this, E).push(new lt(t, this));
|
|
240
240
|
}
|
|
241
241
|
addLinks(t) {
|
|
242
242
|
t.forEach((s) => {
|
|
@@ -244,7 +244,7 @@ class yt {
|
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
removeLink(t) {
|
|
247
|
-
c(this,
|
|
247
|
+
c(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
248
248
|
}
|
|
249
249
|
findLinks() {
|
|
250
250
|
const t = [
|
|
@@ -255,10 +255,10 @@ class yt {
|
|
|
255
255
|
return ((i = s.getAttribute("href")) == null ? void 0 : i.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
|
-
e(this,
|
|
258
|
+
e(this, E).forEach((s) => s.destroy()), c(this, E, t.map((s) => new lt(s, this)));
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
R = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(),
|
|
261
|
+
R = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(), E = new WeakMap(), Y = new WeakMap(), k = new WeakMap(), y = new WeakMap(), L = new WeakMap(), O = new WeakMap(), _ = new WeakMap(), v = new WeakMap(), m = new WeakSet(), Q = function(t) {
|
|
262
262
|
return z(this, null, function* () {
|
|
263
263
|
const s = e(this, k).get(t);
|
|
264
264
|
if (s)
|
package/lib/source/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var W=h=>{throw TypeError(h)};var G=(h,r,e)=>r.has(h)||W("Cannot "+e);var t=(h,r,e)=>(G(h,r,"read from private field"),e?e.call(h):r.get(h)),i=(h,r,e)=>r.has(h)?W("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(h):r.set(h,e),s=(h,r,e,o)=>(G(h,r,"write to private field"),o?o.call(h,e):r.set(h,e),e),_=(h,r,e)=>(G(h,r,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("../class-linked-status/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),U=require("../events-KVanG9sR.cjs"),et=require("../string-DhgS_iFl.cjs"),K=require("../loading/index.cjs"),st=require("../order/index.cjs"),Z=require("../window-resizer/index.cjs"),it=require("../Store-C2J4Q87x.cjs");var T,
|
|
1
|
+
"use strict";var W=h=>{throw TypeError(h)};var G=(h,r,e)=>r.has(h)||W("Cannot "+e);var t=(h,r,e)=>(G(h,r,"read from private field"),e?e.call(h):r.get(h)),i=(h,r,e)=>r.has(h)?W("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(h):r.set(h,e),s=(h,r,e,o)=>(G(h,r,"write to private field"),o?o.call(h,e):r.set(h,e),e),_=(h,r,e)=>(G(h,r,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("../class-linked-status/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),U=require("../events-KVanG9sR.cjs"),et=require("../string-DhgS_iFl.cjs"),K=require("../loading/index.cjs"),st=require("../order/index.cjs"),Z=require("../window-resizer/index.cjs"),it=require("../Store-C2J4Q87x.cjs");var T,E,$,q,u,f,M;class J{constructor(r){i(this,T);i(this,E);i(this,$);i(this,q);i(this,u);i(this,f);i(this,M);s(this,T,r);let e=r.split(".");const o=/\b\d{1,2}x\b/g,d=e.find(p=>p.match(o)&&parseInt(p));s(this,$,d?parseInt(d):1),d&&(e=e.slice(0,-1)),s(this,E,e.length>1?e.slice(0,-1).join("."):e.join("."));const l=/\d+max/g,x=/\d+min/g,B=/\d+mar/g,P=/\d+mir/g,H=e.find(p=>p.match(l)),n=e.find(p=>p.match(x)),b=e.find(p=>p.match(B)),N=e.find(p=>p.match(P));b?(s(this,u,parseInt(b)),s(this,f,"max"),s(this,q,`(max-aspect-ratio: ${t(this,u)})`)):N?(s(this,u,parseInt(N)),s(this,f,"max"),s(this,q,`(min-aspect-ratio: ${t(this,u)})`)):H?(s(this,u,parseInt(H)),s(this,f,"max"),s(this,q,`(max-width: ${t(this,u)}px)`)):n?(s(this,u,parseInt(n)),s(this,q,`(min-width: ${t(this,u)}px)`),s(this,f,"min")):(s(this,u,0),s(this,q,`(min-width: ${t(this,u)}px)`),s(this,f,"min")),s(this,E,t(this,E).replace(`.${t(this,u)}${t(this,f)}`,"")),s(this,M,e[e.length-1]===t(this,E)?"":"."+e[e.length-1]),s(this,M,t(this,M).replace(`.${t(this,u)}${t(this,f)}`,""))}get url(){return t(this,T)}get name(){return t(this,E)}get density(){return t(this,$)}get query(){return t(this,q)}get extension(){return t(this,M)}get queryType(){return t(this,f)}get queryValue(){return t(this,u)}}T=new WeakMap,E=new WeakMap,$=new WeakMap,q=new WeakMap,u=new WeakMap,f=new WeakMap,M=new WeakMap;let rt=0;var m,a,y,w,g,z,R,c,k,v,S,C,A,j,D,O,F;class nt extends HTMLElement{constructor(e){super();i(this,A);i(this,m,null);i(this,a,null);i(this,y,!1);i(this,w,!1);i(this,g,!1);i(this,z,"");i(this,R,"");i(this,c,new Y.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));i(this,k,null);i(this,v);i(this,S,null);i(this,C);i(this,D,e=>{const o=e[0];t(this,g)&&(!t(this,w)||this.hasAttribute("reload-source"))&&o.isIntersecting&&this.triggerLazyLoad(),o.isIntersecting?U.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(_(this,A,j).call(this,void 0),s(this,w,!1)),U.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,O,()=>{t(this,c).set("loaded",!0),t(this,c).set("error",!1),t(this,c).set("loading",!1),!t(this,g)&&!t(this,y)&&K.loading.complete(t(this,R)),U.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,v,setTimeout(()=>{t(this,c).set("clear",!0)},parseFloat(e)*1e3)):t(this,c).set("clear",!0),s(this,y,!0)});i(this,F,e=>{t(this,c).set("loaded",!1),t(this,c).set("error",!0),t(this,c).set("loading",!1),!t(this,g)&&!t(this,y)&&K.loading.error(t(this,R)),U.dispatchEvent(this,"sourceError",{custom:!0}),s(this,y,!0)});s(this,C,e==null?void 0:e.sourceSetOptions),tt.isBrowser&&window.IntersectionObserver&&s(this,k,new IntersectionObserver(t(this,D)))}get consumerElement(){return t(this,a)}get sourceManager(){return t(this,m)}get status(){return t(this,c)}get isLazy(){return t(this,g)}get currentURL(){return t(this,S)}get isFirstLoadHappened(){return t(this,y)}triggerLazyLoad(){!t(this,w)&&t(this,m).current&&t(this,m).current!==t(this,m).previous&&(s(this,w,!0),_(this,A,j).call(this,t(this,m).current))}connectedCallback(){s(this,z,`source-consumer-${++rt}`);const e=this.getAttribute("srcset")||"",o=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;o&&t(this,c).addElement(o),s(this,a,this.createConsumer()),t(this,a).style.cssText=`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
|
-
`,t(this,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(d=>{if(d.name!=="srcset"){const l=d.nodeValue||"",x=et.kebabToCamel(d.name);x in t(this,a)&&(t(this,a)[x]=l||!0)}}),this.appendChild(t(this,a)),s(this,m,new X({srcset:e,sourceSetOptions:t(this,C)})),s(this,g,this.hasAttribute("lazy")),t(this,m).subscribe(d=>{(!t(this,g)||t(this,g)&&t(this,
|
|
5
|
+
`,t(this,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(d=>{if(d.name!=="srcset"){const l=d.nodeValue||"",x=et.kebabToCamel(d.name);x in t(this,a)&&(t(this,a)[x]=l||!0)}}),this.appendChild(t(this,a)),s(this,m,new X({srcset:e,sourceSetOptions:t(this,C)})),s(this,g,this.hasAttribute("lazy")),t(this,m).subscribe(d=>{(!t(this,g)||t(this,g)&&t(this,w))&&_(this,A,j).call(this,d.current)}),t(this,m).connect(),t(this,k).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,v)),t(this,k).disconnect(),(e=t(this,m))==null||e.close(),t(this,a)&&(t(this,a).onloadeddata=null,t(this,a).onload=null,t(this,a).onerror=null,t(this,a).remove()),s(this,y,!1),s(this,w,!1),t(this,c).reset()}}m=new WeakMap,a=new WeakMap,y=new WeakMap,w=new WeakMap,g=new WeakMap,z=new WeakMap,R=new WeakMap,c=new WeakMap,k=new WeakMap,v=new WeakMap,S=new WeakMap,C=new WeakMap,A=new WeakSet,j=function(e){if(clearTimeout(t(this,v)),t(this,a).onloadeddata=null,t(this,a).onload=null,t(this,a).onerror=null,t(this,c).set("loaded",!1),t(this,c).set("error",!1),t(this,c).set("loading",!1),t(this,c).set("clear",!1),e){s(this,R,`${t(this,z)}-${e.url}`);const o=this.hasAttribute("keep-source-parameters");t(this,c).set("loading",!0),s(this,S,o?e.url:e.name+e.extension),this.consumeSource(t(this,S)),!t(this,g)&&!t(this,y)&&K.loading.add(t(this,R)),t(this,a).onloadeddata=()=>{t(this,O).call(this)},t(this,a).onload=()=>{t(this,O).call(this)},t(this,a).onerror=()=>{t(this,F).call(this,t(this,S))}}else s(this,S,null),this.consumeSource(null)},D=new WeakMap,O=new WeakMap,F=new WeakMap;var L;class Q{constructor(r,e){i(this,L);s(this,L,new Map);const o=(e==null?void 0:e.mediaBuckets)!==!1,d=typeof r=="string"?o?r.trim().split(",").map(n=>n.trim()).filter(n=>!!n):[r]:r,l=[];d.forEach(n=>{const b=new J(n);l.push([b.query,b])});const x=l.filter(n=>n[1].queryType.includes("max")).sort((n,b)=>b[1].queryValue-n[1].queryValue),B=l.filter(n=>n[1].queryType.includes("min")&&n[1].queryValue!==0).sort((n,b)=>n[1].queryValue-b[1].queryValue),P=l.filter(n=>n[0]==="(min-width: 0px)");(P?[...P,...x,...B]:[...x,...B]).forEach(n=>{t(this,L).has(n[0])||t(this,L).set(n[0],[]),t(this,L).get(n[0]).push(n[1])})}get mediaBuckets(){return t(this,L)}}L=new WeakMap;var V,I;class X extends it.Store{constructor(e){super(void 0);i(this,V);i(this,I,()=>{let e;t(this,V).mediaBuckets.forEach((l,x)=>{matchMedia(x).matches&&(e=l)});let o,d=0;e==null||e.forEach(l=>{l.density>d&&l.density<=Math.max(devicePixelRatio,1)&&(d=l.density,o=l)}),e!=null&&e.length&&!o&&(o=e[0]),this.current=o});s(this,V,new Q(e.srcset,e.sourceSetOptions))}close(){super.close(),this.disconnect()}connect(){Z.windowResizer.subscribe(t(this,I),st.RESIZE_ORDER.SOURCE_MANAGER),t(this,I).call(this)}disconnect(){Z.windowResizer.unsubscribe(t(this,I))}}V=new WeakMap,I=new WeakMap;exports.Source=J;exports.SourceElement=nt;exports.SourceManager=X;exports.SourceSet=Q;
|
package/lib/source/index.js
CHANGED
|
@@ -11,11 +11,11 @@ import { loading as K } from "../loading/index.js";
|
|
|
11
11
|
import { RESIZE_ORDER as Y } from "../order/index.js";
|
|
12
12
|
import { windowResizer as Z } from "../window-resizer/index.js";
|
|
13
13
|
import { S as tt } from "../Store-Cm3LPXlx.js";
|
|
14
|
-
var T,
|
|
14
|
+
var T, w, C, L, u, f, k;
|
|
15
15
|
class et {
|
|
16
16
|
constructor(r) {
|
|
17
17
|
i(this, T);
|
|
18
|
-
i(this,
|
|
18
|
+
i(this, w);
|
|
19
19
|
i(this, C);
|
|
20
20
|
i(this, L);
|
|
21
21
|
i(this, u);
|
|
@@ -24,12 +24,12 @@ class et {
|
|
|
24
24
|
s(this, T, r);
|
|
25
25
|
let e = r.split(".");
|
|
26
26
|
const o = /\b\d{1,2}x\b/g, d = e.find((g) => g.match(o) && parseInt(g));
|
|
27
|
-
s(this, C, d ? parseInt(d) : 1), d && (e = e.slice(0, -1)), s(this,
|
|
27
|
+
s(this, C, d ? parseInt(d) : 1), d && (e = e.slice(0, -1)), s(this, w, e.length > 1 ? e.slice(0, -1).join(".") : e.join("."));
|
|
28
28
|
const c = /\d+max/g, x = /\d+min/g, B = /\d+mar/g, P = /\d+mir/g, _ = e.find((g) => g.match(c)), h = e.find((g) => g.match(x)), b = e.find((g) => g.match(B)), N = e.find((g) => g.match(P));
|
|
29
|
-
b ? (s(this, u, parseInt(b)), s(this, f, "max"), s(this, L, `(max-aspect-ratio: ${t(this, u)})`)) : N ? (s(this, u, parseInt(N)), s(this, f, "max"), s(this, L, `(min-aspect-ratio: ${t(this, u)})`)) : _ ? (s(this, u, parseInt(_)), 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,
|
|
29
|
+
b ? (s(this, u, parseInt(b)), s(this, f, "max"), s(this, L, `(max-aspect-ratio: ${t(this, u)})`)) : N ? (s(this, u, parseInt(N)), s(this, f, "max"), s(this, L, `(min-aspect-ratio: ${t(this, u)})`)) : _ ? (s(this, u, parseInt(_)), 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(
|
|
30
30
|
`.${t(this, u)}${t(this, f)}`,
|
|
31
31
|
""
|
|
32
|
-
)), s(this, k, e[e.length - 1] === t(this,
|
|
32
|
+
)), s(this, k, e[e.length - 1] === t(this, w) ? "" : "." + e[e.length - 1]), s(this, k, t(this, k).replace(
|
|
33
33
|
`.${t(this, u)}${t(this, f)}`,
|
|
34
34
|
""
|
|
35
35
|
));
|
|
@@ -38,7 +38,7 @@ class et {
|
|
|
38
38
|
return t(this, T);
|
|
39
39
|
}
|
|
40
40
|
get name() {
|
|
41
|
-
return t(this,
|
|
41
|
+
return t(this, w);
|
|
42
42
|
}
|
|
43
43
|
get density() {
|
|
44
44
|
return t(this, C);
|
|
@@ -56,9 +56,9 @@ class et {
|
|
|
56
56
|
return t(this, u);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
T = new WeakMap(),
|
|
59
|
+
T = new WeakMap(), w = new WeakMap(), C = new WeakMap(), L = new WeakMap(), u = new WeakMap(), f = new WeakMap(), k = new WeakMap();
|
|
60
60
|
let st = 0;
|
|
61
|
-
var m, a, y,
|
|
61
|
+
var m, a, y, E, p, O, A, l, I, M, q, V, R, F, H, z, j;
|
|
62
62
|
class ft extends HTMLElement {
|
|
63
63
|
constructor(e) {
|
|
64
64
|
super();
|
|
@@ -66,7 +66,7 @@ class ft extends HTMLElement {
|
|
|
66
66
|
i(this, m, null);
|
|
67
67
|
i(this, a, null);
|
|
68
68
|
i(this, y, !1);
|
|
69
|
-
i(this,
|
|
69
|
+
i(this, E, !1);
|
|
70
70
|
i(this, p, !1);
|
|
71
71
|
i(this, O, "");
|
|
72
72
|
i(this, A, "");
|
|
@@ -82,7 +82,7 @@ class ft extends HTMLElement {
|
|
|
82
82
|
i(this, V);
|
|
83
83
|
i(this, H, (e) => {
|
|
84
84
|
const o = e[0];
|
|
85
|
-
t(this, p) && (!t(this,
|
|
85
|
+
t(this, p) && (!t(this, E) || this.hasAttribute("reload-source")) && o.isIntersecting && this.triggerLazyLoad(), o.isIntersecting ? D(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (U(this, R, F).call(this, void 0), s(this, E, !1)), D(this, "sourceRelease", { custom: !0 }));
|
|
86
86
|
});
|
|
87
87
|
i(this, z, () => {
|
|
88
88
|
t(this, l).set("loaded", !0), t(this, l).set("error", !1), t(this, l).set("loading", !1), !t(this, p) && !t(this, y) && K.complete(t(this, A)), D(this, "sourceLoaded", { custom: !0 });
|
|
@@ -117,7 +117,7 @@ class ft extends HTMLElement {
|
|
|
117
117
|
return t(this, y);
|
|
118
118
|
}
|
|
119
119
|
triggerLazyLoad() {
|
|
120
|
-
!t(this,
|
|
120
|
+
!t(this, E) && t(this, m).current && t(this, m).current !== t(this, m).previous && (s(this, E, !0), U(this, R, F).call(this, t(this, m).current));
|
|
121
121
|
}
|
|
122
122
|
connectedCallback() {
|
|
123
123
|
s(this, O, `source-consumer-${++st}`);
|
|
@@ -135,15 +135,15 @@ class ft extends HTMLElement {
|
|
|
135
135
|
srcset: e,
|
|
136
136
|
sourceSetOptions: t(this, V)
|
|
137
137
|
})), s(this, p, this.hasAttribute("lazy")), t(this, m).subscribe((d) => {
|
|
138
|
-
(!t(this, p) || t(this, p) && t(this,
|
|
138
|
+
(!t(this, p) || t(this, p) && t(this, E)) && U(this, R, F).call(this, d.current);
|
|
139
139
|
}), t(this, m).connect(), t(this, I).observe(this);
|
|
140
140
|
}
|
|
141
141
|
disconnectedCallback() {
|
|
142
142
|
var e;
|
|
143
|
-
clearTimeout(t(this, M)), t(this, I).disconnect(), (e = t(this, m)) == null || e.close(), t(this, a) && (t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, a).remove()), s(this, y, !1), s(this,
|
|
143
|
+
clearTimeout(t(this, M)), t(this, I).disconnect(), (e = t(this, m)) == null || e.close(), t(this, a) && (t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, a).remove()), s(this, y, !1), s(this, E, !1), t(this, l).reset();
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
m = new WeakMap(), a = new WeakMap(), y = new WeakMap(),
|
|
146
|
+
m = new WeakMap(), a = new WeakMap(), y = new WeakMap(), E = new WeakMap(), p = new WeakMap(), O = new WeakMap(), A = new WeakMap(), l = new WeakMap(), I = new WeakMap(), M = new WeakMap(), q = new WeakMap(), V = new WeakMap(), R = new WeakSet(), F = function(e) {
|
|
147
147
|
if (clearTimeout(t(this, M)), t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, l).set("loaded", !1), t(this, l).set("error", !1), t(this, l).set("loading", !1), t(this, l).set("clear", !1), e) {
|
|
148
148
|
s(this, A, `${t(this, O)}-${e.url}`);
|
|
149
149
|
const o = this.hasAttribute("keep-source-parameters");
|
package/lib/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=e=>{throw TypeError(e)};var d=(e,s,t)=>s.has(e)||h("Cannot "+t);var r=(e,s,t)=>(d(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)=>(d(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("../source/index.cjs");require("../window-resizer/index.cjs");require("../Store-C2J4Q87x.cjs");const b=require("../events-KVanG9sR.cjs"),o=require("../ticker/index.cjs");var i,a,n;class m extends E.SourceElement{constructor(){super(...arguments);u(this,i,0);u(this,a,!1);u(this,n,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>r(this,i)&&c(this,i,t),b.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:r(this,i)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(r(this,n)),r(this,a)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,a,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,a,!0)),o.ticker.subscribe(r(this,n))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(r(this,n)),c(this,i,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||""}}i=new WeakMap,a=new WeakMap,n=new WeakMap;customElements.get("e-video")||customElements.define("e-video",m);exports.VideoElement=m;
|
package/lib/video/index.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h = (e) => {
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var l = (e, s, t) => s.has(e) ||
|
|
5
|
-
var
|
|
6
|
-
import { SourceElement as
|
|
4
|
+
var l = (e, s, t) => s.has(e) || h("Cannot " + t);
|
|
5
|
+
var r = (e, s, t) => (l(e, s, "read from private field"), t ? t.call(e) : s.get(e)), o = (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, m) => (l(e, s, "write to private field"), m ? m.call(e, t) : s.set(e, t), t);
|
|
6
|
+
import { SourceElement as d } from "../source/index.js";
|
|
7
7
|
import "../window-resizer/index.js";
|
|
8
8
|
import "../Store-Cm3LPXlx.js";
|
|
9
|
-
import { d } from "../events-CsVF98U6.js";
|
|
10
|
-
import { ticker as
|
|
11
|
-
var
|
|
12
|
-
class
|
|
9
|
+
import { d as p } from "../events-CsVF98U6.js";
|
|
10
|
+
import { ticker as u } from "../ticker/index.js";
|
|
11
|
+
var i, a, n;
|
|
12
|
+
class E extends d {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
o(this, i, 0);
|
|
16
|
+
o(this, a, !1);
|
|
17
|
+
o(this, n, () => {
|
|
17
18
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
18
19
|
const t = this.consumerElement.readyState / 4;
|
|
19
|
-
t >
|
|
20
|
+
t > r(this, i) && c(this, i, t), p(this, "videoReadyStateChange", {
|
|
20
21
|
detail: {
|
|
21
22
|
readyState: this.consumerElement.readyState,
|
|
22
|
-
progress:
|
|
23
|
+
progress: r(this, i)
|
|
23
24
|
}
|
|
24
|
-
}), this.consumerElement.readyState === 4 &&
|
|
25
|
+
}), this.consumerElement.readyState === 4 && (u.unsubscribe(r(this, n)), r(this, a) && this.sourceManager.current && this.consumerElement.play());
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
connectedCallback() {
|
|
28
29
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
29
|
-
|
|
30
|
+
c(this, a, !1), this.hasAttribute("capture-autoplay") && (this.sourceManager.current ? this.consumerElement.play() : c(this, a, !0)), u.subscribe(r(this, n));
|
|
30
31
|
}), this.addEventListener("sourceRelease", () => {
|
|
31
32
|
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
|
|
32
33
|
"state-0",
|
|
@@ -38,17 +39,17 @@ class p extends h {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
disconnectedCallback() {
|
|
41
|
-
super.disconnectedCallback(),
|
|
42
|
+
super.disconnectedCallback(), u.unsubscribe(r(this, n)), c(this, i, 0);
|
|
42
43
|
}
|
|
43
44
|
createConsumer() {
|
|
44
45
|
return document.createElement("video");
|
|
45
46
|
}
|
|
46
47
|
consumeSource(t) {
|
|
47
|
-
this.consumerElement.src = t || ""
|
|
48
|
+
this.consumerElement.src = t || "";
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
customElements.get("e-video") || customElements.define("e-video",
|
|
51
|
+
i = new WeakMap(), a = new WeakMap(), n = new WeakMap();
|
|
52
|
+
customElements.get("e-video") || customElements.define("e-video", E);
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
E as VideoElement
|
|
54
55
|
};
|