aptechka 0.39.7 → 0.39.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var he=a=>{throw TypeError(a)};var ie=(a,n,t)=>n.has(a)||he("Cannot "+t);var e=(a,n,t)=>(ie(a,n,"read from private field"),t?t.call(a):n.get(a)),s=(a,n,t)=>n.has(a)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,t),r=(a,n,t,i)=>(ie(a,n,"write to private field"),i?i.call(a,t):n.set(a,t),t),T=(a,n,t)=>(ie(a,n,"access private method"),t);var ce=(a,n,t)=>new Promise((i,o)=>{var y=m=>{try{g(t.next(m))}catch(l){o(l)}},R=m=>{try{g(t.throw(m))}catch(l){o(l)}},g=m=>m.done?i(m.value):Promise.resolve(m.value).then(y,R);g((t=t.apply(a,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var he=a=>{throw TypeError(a)};var ie=(a,n,t)=>n.has(a)||he("Cannot "+t);var e=(a,n,t)=>(ie(a,n,"read from private field"),t?t.call(a):n.get(a)),s=(a,n,t)=>n.has(a)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,t),r=(a,n,t,i)=>(ie(a,n,"write to private field"),i?i.call(a,t):n.set(a,t),t),T=(a,n,t)=>(ie(a,n,"access private method"),t);var ce=(a,n,t)=>new Promise((i,o)=>{var y=m=>{try{g(t.next(m))}catch(l){o(l)}},R=m=>{try{g(t.throw(m))}catch(l){o(l)}},g=m=>m.done?i(m.value):Promise.resolve(m.value).then(y,R);g((t=t.apply(a,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("../device/index.cjs"),ge=require("../source/index.cjs"),ve=require("../class-linked-status/index.cjs"),de=require("../browser-CpzFX2xg.cjs"),_=require("../events-KVanG9sR.cjs"),me=require("../string-DhgS_iFl.cjs"),re=require("../loading/index.cjs"),X=require("../css-property/index.cjs"),ue=require("../element-resizer/vanilla/index.cjs"),le=require("../canvas-CU5Xjahf.cjs"),Se=require("../canvas/index.cjs"),ne=require("../ticker/vanilla/index.cjs");let Le=0;var d,h,b,V,f,F,I,c,z,U,v,B,G,Q,O,Z;class D extends HTMLElement{constructor(){super();s(this,B);s(this,d,null);s(this,h,null);s(this,b,!1);s(this,V,!1);s(this,f,!1);s(this,F,"");s(this,I,"");s(this,c,new ve.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));s(this,z,null);s(this,U);s(this,v,null);s(this,Q,t=>{const i=t[0];e(this,f)&&(!e(this,V)||this.hasAttribute("reload-source"))&&i.isIntersecting&&this.triggerLazyLoad(),i.isIntersecting?_.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&T(this,B,G).call(this,void 0),_.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,O,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,f)&&!e(this,b)&&re.loading.complete(e(this,I)),_.dispatchEvent(this,"sourceLoaded",{custom:!0});const t=getComputedStyle(this).getPropertyValue("--clear-duration");t?r(this,U,setTimeout(()=>{e(this,c).set("clear",!0)},parseFloat(t)*1e3)):e(this,c).set("clear",!0),r(this,b,!0)});s(this,Z,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,f)&&!e(this,b)&&re.loading.error(e(this,I)),_.dispatchEvent(this,"sourceError",{custom:!0}),r(this,b,!0)});de.isBrowser&&window.IntersectionObserver&&(r(this,F,`source-consumer-${++Le}`),r(this,z,new IntersectionObserver(e(this,Q))))}get consumerElement(){return e(this,h)}get sourceManager(){return e(this,d)}get status(){return e(this,c)}get isLazy(){return e(this,f)}get currentURL(){return e(this,v)}get isFirstLoadHappened(){return e(this,b)}triggerLazyLoad(){e(this,d).current&&e(this,d).current!==e(this,d).previous&&T(this,B,G).call(this,e(this,d).current),r(this,V,!0)}connectedCallback(){const t=this.getAttribute("srcset");if(!t)return;const i=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;i&&e(this,c).addElement(i),r(this,h,this.createConsumer()),e(this,h).style.cssText=`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
|
-
`,e(this,h).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const y=o.nodeValue||"",R=me.kebabToCamel(o.name);R in e(this,h)&&(e(this,h)[R]=y||!0)}}),this.appendChild(e(this,h)),r(this,d,new
|
|
5
|
+
`,e(this,h).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const y=o.nodeValue||"",R=me.kebabToCamel(o.name);R in e(this,h)&&(e(this,h)[R]=y||!0)}}),this.appendChild(e(this,h)),r(this,d,new ge.SourceManager({srcset:t})),r(this,f,this.hasAttribute("lazy")),e(this,d).subscribe(o=>{(!e(this,f)||e(this,f)&&e(this,V))&&T(this,B,G).call(this,o.current)}),e(this,z).observe(this),e(this,d).connect()}disconnectedCallback(){e(this,z).disconnect(),e(this,d).close(),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,e(this,h).remove(),e(this,c).reset(),clearTimeout(e(this,U))}}d=new WeakMap,h=new WeakMap,b=new WeakMap,V=new WeakMap,f=new WeakMap,F=new WeakMap,I=new WeakMap,c=new WeakMap,z=new WeakMap,U=new WeakMap,v=new WeakMap,B=new WeakSet,G=function(t){if(clearTimeout(e(this,U)),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,e(this,c).set("loaded",!1),e(this,c).set("error",!1),e(this,c).set("loading",!1),e(this,c).set("clear",!1),t){r(this,I,`${e(this,F)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0),r(this,v,i?t.url:t.name+t.extension),this.consumeSource(e(this,v)),!e(this,f)&&!e(this,b)&&re.loading.add(e(this,I)),e(this,h).onloadeddata=()=>{e(this,O).call(this)},e(this,h).onload=()=>{e(this,O).call(this)},e(this,h).onerror=()=>{e(this,Z).call(this,e(this,v))}}else r(this,v,null),this.consumeSource(null)},Q=new WeakMap,O=new WeakMap,Z=new WeakMap;class fe extends D{createConsumer(){return document.createElement("img")}consumeSource(n){if(n&&this.hasAttribute("webp")&&Ee.device.isWebp){const t=n.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=t}else this.consumerElement.src=n||""}}customElements.get("e-image")||customElements.define("e-image",fe);function we(a){const n=a.match(/\{([\d-]+)\}/);if(n){const t=n[1].split("-");if(t.length===2){const i=parseInt(t[0],10),o=parseInt(t[1],10);return{start:i,end:o}}}return null}var p,A,M,S,L,P,k,Y,E,w;class pe extends D{constructor(t){super();s(this,p,[]);s(this,A,new X.CSSProperty(this,"--fit","contain"));s(this,M,new X.CSSProperty(this,"--autoplay",!1));s(this,S,new X.CSSProperty(this,"--offset-x",.5));s(this,L,new X.CSSProperty(this,"--offset-y",.5));s(this,P,null);s(this,k,0);s(this,Y,1);s(this,E,()=>{if(e(this,p).length){const t=e(this,p)[0];e(this,A).current==="cover"?r(this,P,le.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,S).current,e(this,L).current)):r(this,P,le.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,S).current,e(this,L).current))}});s(this,w,t=>{if(this.status.isFalse("loaded")||!e(this,P))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,p)[e(this,k)];i&&t.detail.context.drawImage(i,...e(this,P)),e(this,M).current&&r(this,k,(e(this,k)+1)%e(this,p).length)});de.isBrowser&&(r(this,Y,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,A).subscribe(e(this,E)),e(this,S).subscribe(e(this,E)),e(this,L).subscribe(e(this,E)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,w))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,w))}))}setProgress(t){e(this,p).length&&r(this,k,Math.floor((e(this,p).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,M).observe(),e(this,A).observe(),e(this,S).observe(),e(this,L).observe(),ue.elementResizer.subscribe(this,e(this,E))}disconnectedCallback(){super.disconnectedCallback(),e(this,M).unobserve(),e(this,A).unobserve(),e(this,S).unobserve(),e(this,L).unobserve(),r(this,p,[]),ue.elementResizer.unsubscribe(e(this,E)),this.consumerElement.removeEventListener("canvasRender",e(this,w))}createConsumer(){return new Se.CanvasElement}consumeSource(t){return ce(this,null,function*(){var i,o,y,R;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,w));const g=[],m=we(t);if(m)for(let l=m.start;l<=m.end;l++){const oe=t.replace(/\{([^}]+)\}/,l.toString().padStart(e(this,Y),"0")),K=new Image;K.src=oe,g.push(K)}else{const l=new Image;l.src=t,g.push(l)}try{yield Promise.all(g.map((l,oe)=>new Promise((K,be)=>{l.onload=()=>{K()},l.onerror=Ce=>{be(`${l.src} Image not found`)}}))),r(this,p,g),e(this,E).call(this),(o=(i=this.consumerElement).onload)==null||o.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,w))}catch(l){console.error(l),(R=(y=this.consumerElement).onerror)==null||R.call(y,new Event("error"))}}})}}p=new WeakMap,A=new WeakMap,M=new WeakMap,S=new WeakMap,L=new WeakMap,P=new WeakMap,k=new WeakMap,Y=new WeakMap,E=new WeakMap,w=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",pe);var x,H;class ye extends D{constructor(){super(...arguments);s(this,x,0);s(this,H,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,x)&&r(this,x,t),_.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,x)}}),this.consumerElement.readyState===4&&ne.ticker.unsubscribe(e(this,H))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{ne.ticker.subscribe(e(this,H)),this.hasAttribute("capture-autoplay")&&this.consumerElement.play()}),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(),ne.ticker.unsubscribe(e(this,H)),r(this,x,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.consumerElement.autoplay=!0}}x=new WeakMap,H=new WeakMap;customElements.get("e-video")||customElements.define("e-video",ye);var u,W,C,N,$,ee,te,se,j,ae;const q=class q extends D{constructor(){super();s(this,j);s(this,u);s(this,W);s(this,C,!1);s(this,N,!1);s(this,$,()=>{r(this,C,e(this,C)||this.hasAttribute("autoplay")&&!this.hasAttribute("capture-autoplay")),r(this,u,new window.YT.Player(e(this,W),{playerVars:{mute:this.hasAttribute("muted")?1:0,controls:this.hasAttribute("controls")?1:0},events:{onReady:e(this,ee),onError:e(this,te),onStateChange:e(this,se)}}))});s(this,ee,()=>{r(this,N,!0),T(this,j,ae).call(this)});s(this,te,t=>{var i,o;console.error("YouTube: Ошибка при загрузке видео:",this.currentURL,t),(o=(i=this.consumerElement).onerror)==null||o.call(i,new Event("error"))});s(this,se,()=>{});r(this,W,"yt-"+me.generateId(10)),q.__apiReady||(window.onYouTubeIframeAPIReady=()=>{q.__apiReady=!0,_.dispatchEvent(window,"youTubeIframeAPIReady")}),this.addEventListener("sourceCapture",()=>{this.hasAttribute("capture-autoplay")&&(e(this,N)?e(this,u).playVideo():r(this,C,!0))}),this.addEventListener("sourceRelease",()=>{e(this,u)&&this.hasAttribute("capture-autoplay")&&(e(this,u).pauseVideo(),this.hasAttribute("replay")&&e(this,u).seekTo(0))})}static __onYouTubeIframeAPIReady(){this.__apiReady=!0}createConsumer(){const t=document.createElement("div");return t.id=e(this,W),t}consumeSource(t){var i;if(t){if(!document.getElementById("youtube-script")){const o=document.createElement("script");o.id,o.src="https://www.youtube.com/iframe_api";const y=document.getElementsByTagName("script")[0];(i=y.parentNode)==null||i.insertBefore(o,y)}e(this,u)?T(this,j,ae).call(this):q.__apiReady?e(this,$).call(this):addEventListener("youTubeIframeAPIReady",e(this,$))}else e(this,u)&&e(this,u).stopVideo()}disconnectedCallback(){super.disconnectedCallback(),e(this,u)&&e(this,u).destroy(),removeEventListener("youTubeIframeAPIReady",e(this,$))}};u=new WeakMap,W=new WeakMap,C=new WeakMap,N=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,se=new WeakMap,j=new WeakSet,ae=function(){var t,i;this.currentURL&&(this.currentURL.startsWith("http")?e(this,u).loadVideoByUrl(this.currentURL):e(this,u).loadVideoById(this.currentURL)),e(this,C)?e(this,u).playVideo():e(this,u).stopVideo(),r(this,C,!1),(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))},q.__apiReady=!1;let J=q;customElements.get("e-youtube")||customElements.define("e-youtube",J);exports.ImageElement=fe;exports.SequenceElement=pe;exports.SourceElement=D;exports.VideoElement=ye;exports.YouTubeElement=J;
|
|
@@ -6,41 +6,41 @@ var e = (a, n, t) => (se(a, n, "read from private field"), t ? t.call(a) : n.get
|
|
|
6
6
|
var ce = (a, n, t) => new Promise((i, o) => {
|
|
7
7
|
var y = (m) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
E(t.next(m));
|
|
10
10
|
} catch (l) {
|
|
11
11
|
o(l);
|
|
12
12
|
}
|
|
13
13
|
}, R = (m) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
15
|
+
E(t.throw(m));
|
|
16
16
|
} catch (l) {
|
|
17
17
|
o(l);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, E = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(y, R);
|
|
20
|
+
E((t = t.apply(a, n)).next());
|
|
21
21
|
});
|
|
22
22
|
import { device as me } from "../device/index.js";
|
|
23
23
|
import { SourceManager as fe } from "../source/index.js";
|
|
24
24
|
import { ClassLinkedStatus as pe } from "../class-linked-status/index.js";
|
|
25
25
|
import { i as le } from "../browser-0zX67oeU.js";
|
|
26
|
-
import { d as
|
|
26
|
+
import { d as V } from "../events-CsVF98U6.js";
|
|
27
27
|
import { k as ye, g as be } from "../string-f0Dnk0L1.js";
|
|
28
28
|
import { loading as ie } from "../loading/index.js";
|
|
29
|
-
import { CSSProperty as
|
|
29
|
+
import { CSSProperty as K } from "../css-property/index.js";
|
|
30
30
|
import { elementResizer as ue } from "../element-resizer/vanilla/index.js";
|
|
31
31
|
import { c as ge, a as Ee } from "../canvas-DeZ0SLUJ.js";
|
|
32
32
|
import { CanvasElement as ve } from "../canvas/index.js";
|
|
33
33
|
import { ticker as re } from "../ticker/vanilla/index.js";
|
|
34
|
-
let
|
|
35
|
-
var d, h,
|
|
34
|
+
let Le = 0;
|
|
35
|
+
var d, h, b, z, f, q, I, c, _, B, v, H, X, G, N, J;
|
|
36
36
|
class te extends HTMLElement {
|
|
37
37
|
constructor() {
|
|
38
38
|
super();
|
|
39
|
-
s(this,
|
|
39
|
+
s(this, H);
|
|
40
40
|
s(this, d, null);
|
|
41
41
|
s(this, h, null);
|
|
42
|
-
s(this,
|
|
43
|
-
s(this,
|
|
42
|
+
s(this, b, !1);
|
|
43
|
+
s(this, z, !1);
|
|
44
44
|
s(this, f, !1);
|
|
45
45
|
s(this, q, "");
|
|
46
46
|
s(this, I, "");
|
|
@@ -50,24 +50,24 @@ class te extends HTMLElement {
|
|
|
50
50
|
error: !1,
|
|
51
51
|
clear: !1
|
|
52
52
|
}));
|
|
53
|
-
s(this,
|
|
54
|
-
s(this,
|
|
53
|
+
s(this, _, null);
|
|
54
|
+
s(this, B);
|
|
55
55
|
s(this, v, null);
|
|
56
56
|
s(this, G, (t) => {
|
|
57
57
|
const i = t[0];
|
|
58
|
-
e(this, f) && (!e(this,
|
|
58
|
+
e(this, f) && (!e(this, z) || this.hasAttribute("reload-source")) && i.isIntersecting && this.triggerLazyLoad(), i.isIntersecting ? V(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && x(this, H, X).call(this, void 0), V(this, "sourceRelease", { custom: !0 }));
|
|
59
59
|
});
|
|
60
|
-
s(this,
|
|
61
|
-
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, f) && !e(this,
|
|
60
|
+
s(this, N, () => {
|
|
61
|
+
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, f) && !e(this, b) && ie.complete(e(this, I)), V(this, "sourceLoaded", { custom: !0 });
|
|
62
62
|
const t = getComputedStyle(this).getPropertyValue("--clear-duration");
|
|
63
|
-
t ? r(this,
|
|
63
|
+
t ? r(this, B, setTimeout(() => {
|
|
64
64
|
e(this, c).set("clear", !0);
|
|
65
|
-
}, parseFloat(t) * 1e3)) : e(this, c).set("clear", !0), r(this,
|
|
65
|
+
}, parseFloat(t) * 1e3)) : e(this, c).set("clear", !0), r(this, b, !0);
|
|
66
66
|
});
|
|
67
67
|
s(this, J, (t) => {
|
|
68
|
-
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, f) && !e(this,
|
|
68
|
+
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, f) && !e(this, b) && ie.error(e(this, I)), V(this, "sourceError", { custom: !0 }), r(this, b, !0);
|
|
69
69
|
});
|
|
70
|
-
le && window.IntersectionObserver && (r(this, q, `source-consumer-${++
|
|
70
|
+
le && window.IntersectionObserver && (r(this, q, `source-consumer-${++Le}`), r(this, _, new IntersectionObserver(
|
|
71
71
|
e(this, G)
|
|
72
72
|
)));
|
|
73
73
|
}
|
|
@@ -86,8 +86,11 @@ class te extends HTMLElement {
|
|
|
86
86
|
get currentURL() {
|
|
87
87
|
return e(this, v);
|
|
88
88
|
}
|
|
89
|
+
get isFirstLoadHappened() {
|
|
90
|
+
return e(this, b);
|
|
91
|
+
}
|
|
89
92
|
triggerLazyLoad() {
|
|
90
|
-
e(this, d).current && e(this, d).current !== e(this, d).previous && x(this,
|
|
93
|
+
e(this, d).current && e(this, d).current !== e(this, d).previous && x(this, H, X).call(this, e(this, d).current), r(this, z, !0);
|
|
91
94
|
}
|
|
92
95
|
connectedCallback() {
|
|
93
96
|
const t = this.getAttribute("srcset");
|
|
@@ -105,28 +108,28 @@ class te extends HTMLElement {
|
|
|
105
108
|
}), this.appendChild(e(this, h)), r(this, d, new fe({
|
|
106
109
|
srcset: t
|
|
107
110
|
})), r(this, f, this.hasAttribute("lazy")), e(this, d).subscribe((o) => {
|
|
108
|
-
(!e(this, f) || e(this, f) && e(this,
|
|
109
|
-
}), e(this,
|
|
111
|
+
(!e(this, f) || e(this, f) && e(this, z)) && x(this, H, X).call(this, o.current);
|
|
112
|
+
}), e(this, _).observe(this), e(this, d).connect();
|
|
110
113
|
}
|
|
111
114
|
disconnectedCallback() {
|
|
112
|
-
e(this,
|
|
115
|
+
e(this, _).disconnect(), e(this, d).close(), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, e(this, h).remove(), e(this, c).reset(), clearTimeout(e(this, B));
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
d = new WeakMap(), h = new WeakMap(),
|
|
116
|
-
if (clearTimeout(e(this,
|
|
118
|
+
d = new WeakMap(), h = new WeakMap(), b = new WeakMap(), z = new WeakMap(), f = new WeakMap(), q = new WeakMap(), I = new WeakMap(), c = new WeakMap(), _ = new WeakMap(), B = new WeakMap(), v = new WeakMap(), H = new WeakSet(), X = function(t) {
|
|
119
|
+
if (clearTimeout(e(this, B)), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, e(this, c).set("loaded", !1), e(this, c).set("error", !1), e(this, c).set("loading", !1), e(this, c).set("clear", !1), t) {
|
|
117
120
|
r(this, I, `${e(this, q)}-${t.url}`);
|
|
118
121
|
const i = this.hasAttribute("keep-source-parameters");
|
|
119
|
-
e(this, c).set("loading", !0), r(this, v, i ? t.url : t.name + t.extension), this.consumeSource(e(this, v)), !e(this, f) && !e(this,
|
|
120
|
-
e(this,
|
|
122
|
+
e(this, c).set("loading", !0), r(this, v, i ? t.url : t.name + t.extension), this.consumeSource(e(this, v)), !e(this, f) && !e(this, b) && ie.add(e(this, I)), e(this, h).onloadeddata = () => {
|
|
123
|
+
e(this, N).call(this);
|
|
121
124
|
}, e(this, h).onload = () => {
|
|
122
|
-
e(this,
|
|
125
|
+
e(this, N).call(this);
|
|
123
126
|
}, e(this, h).onerror = () => {
|
|
124
127
|
e(this, J).call(this, e(this, v));
|
|
125
128
|
};
|
|
126
129
|
} else
|
|
127
130
|
r(this, v, null), this.consumeSource(null);
|
|
128
|
-
}, G = new WeakMap(),
|
|
129
|
-
class
|
|
131
|
+
}, G = new WeakMap(), N = new WeakMap(), J = new WeakMap();
|
|
132
|
+
class we extends te {
|
|
130
133
|
createConsumer() {
|
|
131
134
|
return document.createElement("img");
|
|
132
135
|
}
|
|
@@ -138,7 +141,7 @@ class Le extends te {
|
|
|
138
141
|
this.consumerElement.src = n || "";
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
|
-
customElements.get("e-image") || customElements.define("e-image",
|
|
144
|
+
customElements.get("e-image") || customElements.define("e-image", we);
|
|
142
145
|
function Ce(a) {
|
|
143
146
|
const n = a.match(/\{([\d-]+)\}/);
|
|
144
147
|
if (n) {
|
|
@@ -150,23 +153,23 @@ function Ce(a) {
|
|
|
150
153
|
}
|
|
151
154
|
return null;
|
|
152
155
|
}
|
|
153
|
-
var p, A, M,
|
|
156
|
+
var p, A, M, L, w, k, P, O, g, C;
|
|
154
157
|
class Se extends te {
|
|
155
158
|
constructor(t) {
|
|
156
159
|
super();
|
|
157
160
|
s(this, p, []);
|
|
158
|
-
s(this, A, new
|
|
161
|
+
s(this, A, new K(
|
|
159
162
|
this,
|
|
160
163
|
"--fit",
|
|
161
164
|
"contain"
|
|
162
165
|
));
|
|
163
|
-
s(this, M, new
|
|
164
|
-
s(this,
|
|
165
|
-
s(this,
|
|
166
|
+
s(this, M, new K(this, "--autoplay", !1));
|
|
167
|
+
s(this, L, new K(this, "--offset-x", 0.5));
|
|
168
|
+
s(this, w, new K(this, "--offset-y", 0.5));
|
|
166
169
|
s(this, k, null);
|
|
167
170
|
s(this, P, 0);
|
|
168
|
-
s(this,
|
|
169
|
-
s(this,
|
|
171
|
+
s(this, O, 1);
|
|
172
|
+
s(this, g, () => {
|
|
170
173
|
if (e(this, p).length) {
|
|
171
174
|
const t = e(this, p)[0];
|
|
172
175
|
e(this, A).current === "cover" ? r(this, k, ge(
|
|
@@ -174,15 +177,15 @@ class Se extends te {
|
|
|
174
177
|
t.naturalHeight,
|
|
175
178
|
this.consumerElement.width,
|
|
176
179
|
this.consumerElement.height,
|
|
177
|
-
e(this,
|
|
178
|
-
e(this,
|
|
180
|
+
e(this, L).current,
|
|
181
|
+
e(this, w).current
|
|
179
182
|
)) : r(this, k, Ee(
|
|
180
183
|
t.naturalWidth,
|
|
181
184
|
t.naturalHeight,
|
|
182
185
|
this.consumerElement.width,
|
|
183
186
|
this.consumerElement.height,
|
|
184
|
-
e(this,
|
|
185
|
-
e(this,
|
|
187
|
+
e(this, L).current,
|
|
188
|
+
e(this, w).current
|
|
186
189
|
));
|
|
187
190
|
}
|
|
188
191
|
});
|
|
@@ -193,9 +196,9 @@ class Se extends te {
|
|
|
193
196
|
const i = e(this, p)[e(this, P)];
|
|
194
197
|
i && t.detail.context.drawImage(i, ...e(this, k)), e(this, M).current && r(this, P, (e(this, P) + 1) % e(this, p).length);
|
|
195
198
|
});
|
|
196
|
-
le && (r(this,
|
|
199
|
+
le && (r(this, O, parseInt(
|
|
197
200
|
((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
|
|
198
|
-
)), e(this, A).subscribe(e(this,
|
|
201
|
+
)), e(this, A).subscribe(e(this, g)), e(this, L).subscribe(e(this, g)), e(this, w).subscribe(e(this, g)), this.addEventListener("sourceCapture", (i) => {
|
|
199
202
|
this.consumerElement.addEventListener(
|
|
200
203
|
"canvasRender",
|
|
201
204
|
e(this, C)
|
|
@@ -211,10 +214,10 @@ class Se extends te {
|
|
|
211
214
|
e(this, p).length && r(this, P, Math.floor((e(this, p).length - 1) * t));
|
|
212
215
|
}
|
|
213
216
|
connectedCallback() {
|
|
214
|
-
super.connectedCallback(), e(this, M).observe(), e(this, A).observe(), e(this,
|
|
217
|
+
super.connectedCallback(), e(this, M).observe(), e(this, A).observe(), e(this, L).observe(), e(this, w).observe(), ue.subscribe(this, e(this, g));
|
|
215
218
|
}
|
|
216
219
|
disconnectedCallback() {
|
|
217
|
-
super.disconnectedCallback(), e(this, M).unobserve(), e(this, A).unobserve(), e(this,
|
|
220
|
+
super.disconnectedCallback(), e(this, M).unobserve(), e(this, A).unobserve(), e(this, L).unobserve(), e(this, w).unobserve(), r(this, p, []), ue.unsubscribe(e(this, g)), this.consumerElement.removeEventListener(
|
|
218
221
|
"canvasRender",
|
|
219
222
|
e(this, C)
|
|
220
223
|
);
|
|
@@ -230,29 +233,29 @@ class Se extends te {
|
|
|
230
233
|
"canvasRender",
|
|
231
234
|
e(this, C)
|
|
232
235
|
);
|
|
233
|
-
const
|
|
236
|
+
const E = [], m = Ce(t);
|
|
234
237
|
if (m)
|
|
235
238
|
for (let l = m.start; l <= m.end; l++) {
|
|
236
239
|
const oe = t.replace(
|
|
237
240
|
/\{([^}]+)\}/,
|
|
238
|
-
l.toString().padStart(e(this,
|
|
239
|
-
),
|
|
240
|
-
|
|
241
|
+
l.toString().padStart(e(this, O), "0")
|
|
242
|
+
), j = new Image();
|
|
243
|
+
j.src = oe, E.push(j);
|
|
241
244
|
}
|
|
242
245
|
else {
|
|
243
246
|
const l = new Image();
|
|
244
|
-
l.src = t,
|
|
247
|
+
l.src = t, E.push(l);
|
|
245
248
|
}
|
|
246
249
|
try {
|
|
247
250
|
yield Promise.all(
|
|
248
|
-
|
|
251
|
+
E.map((l, oe) => new Promise((j, de) => {
|
|
249
252
|
l.onload = () => {
|
|
250
|
-
|
|
253
|
+
j();
|
|
251
254
|
}, l.onerror = (Ie) => {
|
|
252
255
|
de(`${l.src} Image not found`);
|
|
253
256
|
};
|
|
254
257
|
}))
|
|
255
|
-
), r(this, p,
|
|
258
|
+
), r(this, p, E), e(this, g).call(this), (o = (i = this.consumerElement).onload) == null || o.call(i, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
|
|
256
259
|
"canvasRender",
|
|
257
260
|
e(this, C)
|
|
258
261
|
);
|
|
@@ -263,7 +266,7 @@ class Se extends te {
|
|
|
263
266
|
});
|
|
264
267
|
}
|
|
265
268
|
}
|
|
266
|
-
p = new WeakMap(), A = new WeakMap(), M = new WeakMap(),
|
|
269
|
+
p = new WeakMap(), A = new WeakMap(), M = new WeakMap(), L = new WeakMap(), w = new WeakMap(), k = new WeakMap(), P = new WeakMap(), O = new WeakMap(), g = new WeakMap(), C = new WeakMap();
|
|
267
270
|
customElements.get("e-sequence") || customElements.define("e-sequence", Se);
|
|
268
271
|
var T, W;
|
|
269
272
|
class Re extends te {
|
|
@@ -273,7 +276,7 @@ class Re extends te {
|
|
|
273
276
|
s(this, W, () => {
|
|
274
277
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
275
278
|
const t = this.consumerElement.readyState / 4;
|
|
276
|
-
t > e(this, T) && r(this, T, t),
|
|
279
|
+
t > e(this, T) && r(this, T, t), V(this, "videoReadyStateChange", {
|
|
277
280
|
detail: {
|
|
278
281
|
readyState: this.consumerElement.readyState,
|
|
279
282
|
progress: e(this, T)
|
|
@@ -306,16 +309,16 @@ class Re extends te {
|
|
|
306
309
|
}
|
|
307
310
|
T = new WeakMap(), W = new WeakMap();
|
|
308
311
|
customElements.get("e-video") || customElements.define("e-video", Re);
|
|
309
|
-
var u, $, S,
|
|
310
|
-
const
|
|
312
|
+
var u, $, S, Y, F, Q, Z, ee, D, ae;
|
|
313
|
+
const U = class U extends te {
|
|
311
314
|
constructor() {
|
|
312
315
|
super();
|
|
313
|
-
s(this,
|
|
316
|
+
s(this, D);
|
|
314
317
|
s(this, u);
|
|
315
318
|
s(this, $);
|
|
316
319
|
s(this, S, !1);
|
|
317
|
-
s(this,
|
|
318
|
-
s(this,
|
|
320
|
+
s(this, Y, !1);
|
|
321
|
+
s(this, F, () => {
|
|
319
322
|
r(this, S, e(this, S) || this.hasAttribute("autoplay") && !this.hasAttribute("capture-autoplay")), r(this, u, new window.YT.Player(e(this, $), {
|
|
320
323
|
playerVars: {
|
|
321
324
|
mute: this.hasAttribute("muted") ? 1 : 0,
|
|
@@ -329,7 +332,7 @@ const V = class V extends te {
|
|
|
329
332
|
}));
|
|
330
333
|
});
|
|
331
334
|
s(this, Q, () => {
|
|
332
|
-
r(this,
|
|
335
|
+
r(this, Y, !0), x(this, D, ae).call(this);
|
|
333
336
|
});
|
|
334
337
|
s(this, Z, (t) => {
|
|
335
338
|
var i, o;
|
|
@@ -337,10 +340,10 @@ const V = class V extends te {
|
|
|
337
340
|
});
|
|
338
341
|
s(this, ee, () => {
|
|
339
342
|
});
|
|
340
|
-
r(this, $, "yt-" + be(10)),
|
|
341
|
-
|
|
343
|
+
r(this, $, "yt-" + be(10)), U.__apiReady || (window.onYouTubeIframeAPIReady = () => {
|
|
344
|
+
U.__apiReady = !0, V(window, "youTubeIframeAPIReady");
|
|
342
345
|
}), this.addEventListener("sourceCapture", () => {
|
|
343
|
-
this.hasAttribute("capture-autoplay") && (e(this,
|
|
346
|
+
this.hasAttribute("capture-autoplay") && (e(this, Y) ? e(this, u).playVideo() : r(this, S, !0));
|
|
344
347
|
}), this.addEventListener("sourceRelease", () => {
|
|
345
348
|
e(this, u) && this.hasAttribute("capture-autoplay") && (e(this, u).pauseVideo(), this.hasAttribute("replay") && e(this, u).seekTo(0));
|
|
346
349
|
});
|
|
@@ -361,21 +364,21 @@ const V = class V extends te {
|
|
|
361
364
|
const y = document.getElementsByTagName("script")[0];
|
|
362
365
|
(i = y.parentNode) == null || i.insertBefore(o, y);
|
|
363
366
|
}
|
|
364
|
-
e(this, u) ? x(this,
|
|
367
|
+
e(this, u) ? x(this, D, ae).call(this) : U.__apiReady ? e(this, F).call(this) : addEventListener("youTubeIframeAPIReady", e(this, F));
|
|
365
368
|
} else e(this, u) && e(this, u).stopVideo();
|
|
366
369
|
}
|
|
367
370
|
disconnectedCallback() {
|
|
368
|
-
super.disconnectedCallback(), e(this, u) && e(this, u).destroy(), removeEventListener("youTubeIframeAPIReady", e(this,
|
|
371
|
+
super.disconnectedCallback(), e(this, u) && e(this, u).destroy(), removeEventListener("youTubeIframeAPIReady", e(this, F));
|
|
369
372
|
}
|
|
370
373
|
};
|
|
371
|
-
u = new WeakMap(), $ = new WeakMap(), S = new WeakMap(),
|
|
374
|
+
u = new WeakMap(), $ = new WeakMap(), S = new WeakMap(), Y = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), ee = new WeakMap(), D = new WeakSet(), ae = function() {
|
|
372
375
|
var t, i;
|
|
373
376
|
this.currentURL && (this.currentURL.startsWith("http") ? e(this, u).loadVideoByUrl(this.currentURL) : e(this, u).loadVideoById(this.currentURL)), e(this, S) ? e(this, u).playVideo() : e(this, u).stopVideo(), r(this, S, !1), (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
|
|
374
|
-
},
|
|
375
|
-
let ne =
|
|
377
|
+
}, U.__apiReady = !1;
|
|
378
|
+
let ne = U;
|
|
376
379
|
customElements.get("e-youtube") || customElements.define("e-youtube", ne);
|
|
377
380
|
export {
|
|
378
|
-
|
|
381
|
+
we as ImageElement,
|
|
379
382
|
Se as SequenceElement,
|
|
380
383
|
te as SourceElement,
|
|
381
384
|
Re as VideoElement,
|
|
@@ -4,6 +4,8 @@ import { ClassLinkedStatus } from '../../class-linked-status';
|
|
|
4
4
|
export interface SourceEvents {
|
|
5
5
|
sourceCapture: CustomEvent;
|
|
6
6
|
sourceRelease: CustomEvent;
|
|
7
|
+
sourceLoaded: CustomEvent;
|
|
8
|
+
sourceError: CustomEvent;
|
|
7
9
|
}
|
|
8
10
|
export declare abstract class SourceElement<T extends HTMLElement> extends HTMLElement {
|
|
9
11
|
#private;
|
|
@@ -18,6 +20,7 @@ export declare abstract class SourceElement<T extends HTMLElement> extends HTMLE
|
|
|
18
20
|
}>;
|
|
19
21
|
get isLazy(): boolean;
|
|
20
22
|
get currentURL(): string | null;
|
|
23
|
+
get isFirstLoadHappened(): boolean;
|
|
21
24
|
triggerLazyLoad(): void;
|
|
22
25
|
protected abstract createConsumer(): T;
|
|
23
26
|
protected abstract consumeSource(url: string | null): void;
|