aptechka 0.40.4 → 0.40.6
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/media-elements/iframe/index.d.ts +3 -2
- package/lib/media-elements/index.cjs +2 -2
- package/lib/media-elements/index.d.ts +1 -1
- package/lib/media-elements/index.js +147 -141
- package/lib/media-elements/source/index.d.ts +5 -1
- package/lib/source/SourceManager.d.ts +2 -0
- package/lib/source/SourceSet.d.ts +4 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +53 -53
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SourceElement } from '../source';
|
|
2
2
|
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class IFrameElement extends SourceElement<HTMLElement> {
|
|
4
4
|
#private;
|
|
5
|
+
constructor();
|
|
5
6
|
protected createConsumer(): HTMLDivElement;
|
|
6
7
|
protected consumeSource(code: string | null): void;
|
|
7
8
|
}
|
|
8
9
|
declare global {
|
|
9
10
|
interface HTMLElementTagNameMap {
|
|
10
|
-
'e-iframe':
|
|
11
|
+
'e-iframe': IFrameElement;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var de=a=>{throw TypeError(a)};var oe=(a,n,t)=>n.has(a)||de("Cannot "+t);var e=(a,n,t)=>(oe(a,n,"read from private field"),t?t.call(a):n.get(a)),s=(a,n,t)=>n.has(a)?de("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,t),r=(a,n,t,i)=>(oe(a,n,"write to private field"),i?i.call(a,t):n.set(a,t),t),q=(a,n,t)=>(oe(a,n,"access private method"),t);var me=(a,n,t)=>new Promise((i,o)=>{var E=m=>{try{v(t.next(m))}catch(l){o(l)}},A=m=>{try{v(t.throw(m))}catch(l){o(l)}},v=m=>m.done?i(m.value):Promise.resolve(m.value).then(E,A);v((t=t.apply(a,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("../source/index.cjs"),Ce=require("../class-linked-status/index.cjs"),Ee=require("../browser-CpzFX2xg.cjs"),V=require("../events-KVanG9sR.cjs"),ye=require("../string-DhgS_iFl.cjs"),he=require("../loading/index.cjs"),Re=require("../device/index.cjs"),J=require("../css-property/index.cjs"),fe=require("../element-resizer/vanilla/index.cjs"),pe=require("../canvas-CU5Xjahf.cjs"),Ie=require("../canvas/index.cjs"),ce=require("../ticker/vanilla/index.cjs");let Ae=0;var d,h,y,S,f,Y,k,c,B,U,L,N,O,Q,ee,j,te;class $ extends HTMLElement{constructor(t){super();s(this,O);s(this,d,null);s(this,h,null);s(this,y,!1);s(this,S,!1);s(this,f,!1);s(this,Y,"");s(this,k,"");s(this,c,new Ce.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));s(this,B,null);s(this,U);s(this,L,null);s(this,N);s(this,ee,t=>{const i=t[0];e(this,f)&&(!e(this,S)||this.hasAttribute("reload-source"))&&i.isIntersecting&&this.triggerLazyLoad(),i.isIntersecting?V.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&q(this,O,Q).call(this,void 0),V.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,j,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,f)&&!e(this,y)&&he.loading.complete(e(this,k)),V.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,y,!0)});s(this,te,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,f)&&!e(this,y)&&he.loading.error(e(this,k)),V.dispatchEvent(this,"sourceError",{custom:!0}),r(this,y,!0)});r(this,N,t==null?void 0:t.sourceSetOptions),Ee.isBrowser&&window.IntersectionObserver&&r(this,B,new IntersectionObserver(e(this,ee)))}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,L)}get isFirstLoadHappened(){return e(this,y)}triggerLazyLoad(){!e(this,S)&&e(this,d).current&&e(this,d).current!==e(this,d).previous&&(r(this,S,!0),q(this,O,Q).call(this,e(this,d).current))}connectedCallback(){r(this,Y,`source-consumer-${++Ae}`);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 E=o.nodeValue||"",A=
|
|
5
|
+
`,e(this,h).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const E=o.nodeValue||"",A=ye.kebabToCamel(o.name);A in e(this,h)&&(e(this,h)[A]=E||!0)}}),this.appendChild(e(this,h)),r(this,d,new we.SourceManager({srcset:t,sourceSetOptions:e(this,N)})),r(this,f,this.hasAttribute("lazy")),e(this,d).subscribe(o=>{(!e(this,f)||e(this,f)&&e(this,S))&&q(this,O,Q).call(this,o.current)}),e(this,d).connect(),e(this,B).observe(this)}disconnectedCallback(){e(this,B).disconnect(),e(this,d).close(),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,r(this,y,!1),r(this,S,!1),e(this,h).remove(),e(this,c).reset(),clearTimeout(e(this,U))}}d=new WeakMap,h=new WeakMap,y=new WeakMap,S=new WeakMap,f=new WeakMap,Y=new WeakMap,k=new WeakMap,c=new WeakMap,B=new WeakMap,U=new WeakMap,L=new WeakMap,N=new WeakMap,O=new WeakSet,Q=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,k,`${e(this,Y)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0),r(this,L,i?t.url:t.name+t.extension),this.consumeSource(e(this,L)),!e(this,f)&&!e(this,y)&&he.loading.add(e(this,k)),e(this,h).onloadeddata=()=>{e(this,j).call(this)},e(this,h).onload=()=>{e(this,j).call(this)},e(this,h).onerror=()=>{e(this,te).call(this,e(this,L))}}else r(this,L,null),this.consumeSource(null)},ee=new WeakMap,j=new WeakMap,te=new WeakMap;var b,se,ie;class be extends ${constructor(){super({sourceSetOptions:{mediaBuckets:!1}});s(this,b,null);s(this,se,()=>{var t,i;(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))});s(this,ie,()=>{var t,i;(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("error"))})}createConsumer(){return document.createElement("div")}consumeSource(t){e(this,b)&&(e(this,b).onload=null,e(this,b).onerror=null),this.consumerElement.innerHTML=(t==null?void 0:t.replace(/\\u003C/g,"<").replace(/\\u003E/g,">").replace(/\\"/g,'"'))||"",r(this,b,this.consumerElement.querySelector("iframe")),e(this,b)&&(e(this,b).onload=e(this,se),e(this,b).onerror=e(this,ie))}}b=new WeakMap,se=new WeakMap,ie=new WeakMap;customElements.get("e-iframe")||customElements.define("e-iframe",be);class ge extends ${createConsumer(){return document.createElement("img")}consumeSource(n){if(n&&this.hasAttribute("webp")&&Re.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",ge);function ke(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,P,M,w,C,x,T,D,g,R;class ve extends ${constructor(t){super();s(this,p,[]);s(this,P,new J.CSSProperty(this,"--fit","contain"));s(this,M,new J.CSSProperty(this,"--autoplay",!1));s(this,w,new J.CSSProperty(this,"--offset-x",.5));s(this,C,new J.CSSProperty(this,"--offset-y",.5));s(this,x,null);s(this,T,0);s(this,D,1);s(this,g,()=>{if(e(this,p).length){const t=e(this,p)[0];e(this,P).current==="cover"?r(this,x,pe.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,w).current,e(this,C).current)):r(this,x,pe.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,w).current,e(this,C).current))}});s(this,R,t=>{if(this.status.isFalse("loaded")||!e(this,x))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,p)[e(this,T)];i&&t.detail.context.drawImage(i,...e(this,x)),e(this,M).current&&r(this,T,(e(this,T)+1)%e(this,p).length)});Ee.isBrowser&&(r(this,D,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,P).subscribe(e(this,g)),e(this,w).subscribe(e(this,g)),e(this,C).subscribe(e(this,g)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,R))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,R))}))}setProgress(t){e(this,p).length&&r(this,T,Math.floor((e(this,p).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,M).observe(),e(this,P).observe(),e(this,w).observe(),e(this,C).observe(),fe.elementResizer.subscribe(this,e(this,g))}disconnectedCallback(){super.disconnectedCallback(),e(this,M).unobserve(),e(this,P).unobserve(),e(this,w).unobserve(),e(this,C).unobserve(),r(this,p,[]),fe.elementResizer.unsubscribe(e(this,g)),this.consumerElement.removeEventListener("canvasRender",e(this,R))}createConsumer(){return new Ie.CanvasElement}consumeSource(t){return me(this,null,function*(){var i,o,E,A;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,R));const v=[],m=ke(t);if(m)for(let l=m.start;l<=m.end;l++){const le=t.replace(/\{([^}]+)\}/,l.toString().padStart(e(this,D),"0")),G=new Image;G.src=le,v.push(G)}else{const l=new Image;l.src=t,v.push(l)}try{yield Promise.all(v.map((l,le)=>new Promise((G,Le)=>{l.onload=()=>{G()},l.onerror=Pe=>{Le(`${l.src} Image not found`)}}))),r(this,p,v),e(this,g).call(this),(o=(i=this.consumerElement).onload)==null||o.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,R))}catch(l){console.error(l),(A=(E=this.consumerElement).onerror)==null||A.call(E,new Event("error"))}}})}}p=new WeakMap,P=new WeakMap,M=new WeakMap,w=new WeakMap,C=new WeakMap,x=new WeakMap,T=new WeakMap,D=new WeakMap,g=new WeakMap,R=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",ve);var _,F;class Se extends ${constructor(){super(...arguments);s(this,_,0);s(this,F,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,_)&&r(this,_,t),V.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,_)}}),this.consumerElement.readyState===4&&ce.ticker.unsubscribe(e(this,F))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{ce.ticker.subscribe(e(this,F)),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(),ce.ticker.unsubscribe(e(this,F)),r(this,_,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.consumerElement.autoplay=!0}}_=new WeakMap,F=new WeakMap;customElements.get("e-video")||customElements.define("e-video",Se);var u,H,I,K,W,re,ne,ae,X,ue;const z=class z extends ${constructor(){super();s(this,X);s(this,u);s(this,H);s(this,I,!1);s(this,K,!1);s(this,W,()=>{r(this,I,e(this,I)||this.hasAttribute("autoplay")&&!this.hasAttribute("capture-autoplay")),r(this,u,new window.YT.Player(e(this,H),{playerVars:{mute:this.hasAttribute("muted")?1:0,controls:this.hasAttribute("controls")?1:0},events:{onReady:e(this,re),onError:e(this,ne),onStateChange:e(this,ae)}}))});s(this,re,()=>{r(this,K,!0),q(this,X,ue).call(this)});s(this,ne,t=>{var i,o;console.error("YouTube: Ошибка при загрузке видео:",this.currentURL,t),(o=(i=this.consumerElement).onerror)==null||o.call(i,new Event("error"))});s(this,ae,()=>{});r(this,H,"yt-"+ye.generateId(10)),z.__apiReady||(window.onYouTubeIframeAPIReady=()=>{z.__apiReady=!0,V.dispatchEvent(window,"youTubeIframeAPIReady")}),this.addEventListener("sourceCapture",()=>{this.hasAttribute("capture-autoplay")&&(e(this,K)?e(this,u).playVideo():r(this,I,!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,H),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 E=document.getElementsByTagName("script")[0];(i=E.parentNode)==null||i.insertBefore(o,E)}e(this,u)?q(this,X,ue).call(this):z.__apiReady?e(this,W).call(this):addEventListener("youTubeIframeAPIReady",e(this,W))}else e(this,u)&&e(this,u).stopVideo()}disconnectedCallback(){super.disconnectedCallback(),e(this,u)&&e(this,u).destroy(),removeEventListener("youTubeIframeAPIReady",e(this,W))}};u=new WeakMap,H=new WeakMap,I=new WeakMap,K=new WeakMap,W=new WeakMap,re=new WeakMap,ne=new WeakMap,ae=new WeakMap,X=new WeakSet,ue=function(){var t,i;this.currentURL&&(this.currentURL.startsWith("http")?e(this,u).loadVideoByUrl(this.currentURL):e(this,u).loadVideoById(this.currentURL)),e(this,I)?e(this,u).playVideo():e(this,u).stopVideo(),r(this,I,!1),(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))},z.__apiReady=!1;let Z=z;customElements.get("e-youtube")||customElements.define("e-youtube",Z);exports.IFrameElement=be;exports.ImageElement=ge;exports.SequenceElement=ve;exports.SourceElement=$;exports.VideoElement=Se;exports.YouTubeElement=Z;
|
|
@@ -1,74 +1,75 @@
|
|
|
1
|
-
var
|
|
1
|
+
var de = (a) => {
|
|
2
2
|
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (a, n, t) => (
|
|
6
|
-
var
|
|
4
|
+
var ae = (a, n, t) => n.has(a) || de("Cannot " + t);
|
|
5
|
+
var e = (a, n, t) => (ae(a, n, "read from private field"), t ? t.call(a) : n.get(a)), s = (a, n, t) => n.has(a) ? de("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), r = (a, n, t, i) => (ae(a, n, "write to private field"), i ? i.call(a, t) : n.set(a, t), t), U = (a, n, t) => (ae(a, n, "access private method"), t);
|
|
6
|
+
var me = (a, n, t) => new Promise((i, o) => {
|
|
7
7
|
var y = (m) => {
|
|
8
8
|
try {
|
|
9
9
|
v(t.next(m));
|
|
10
|
-
} catch (
|
|
11
|
-
o(
|
|
10
|
+
} catch (l) {
|
|
11
|
+
o(l);
|
|
12
12
|
}
|
|
13
13
|
}, A = (m) => {
|
|
14
14
|
try {
|
|
15
15
|
v(t.throw(m));
|
|
16
|
-
} catch (
|
|
17
|
-
o(
|
|
16
|
+
} catch (l) {
|
|
17
|
+
o(l);
|
|
18
18
|
}
|
|
19
19
|
}, v = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(y, A);
|
|
20
20
|
v((t = t.apply(a, n)).next());
|
|
21
21
|
});
|
|
22
|
-
import { SourceManager as
|
|
23
|
-
import { ClassLinkedStatus as
|
|
24
|
-
import { i as
|
|
22
|
+
import { SourceManager as Ee } from "../source/index.js";
|
|
23
|
+
import { ClassLinkedStatus as be } from "../class-linked-status/index.js";
|
|
24
|
+
import { i as pe } from "../browser-0zX67oeU.js";
|
|
25
25
|
import { d as z } from "../events-CsVF98U6.js";
|
|
26
|
-
import { k as
|
|
27
|
-
import { loading as
|
|
28
|
-
import { device as
|
|
29
|
-
import { CSSProperty as
|
|
30
|
-
import { elementResizer as
|
|
31
|
-
import { c as
|
|
26
|
+
import { k as ge, g as ve } from "../string-f0Dnk0L1.js";
|
|
27
|
+
import { loading as oe } from "../loading/index.js";
|
|
28
|
+
import { device as Le } from "../device/index.js";
|
|
29
|
+
import { CSSProperty as J } from "../css-property/index.js";
|
|
30
|
+
import { elementResizer as fe } from "../element-resizer/vanilla/index.js";
|
|
31
|
+
import { c as we, a as Se } from "../canvas-DeZ0SLUJ.js";
|
|
32
32
|
import { CanvasElement as Ce } from "../canvas/index.js";
|
|
33
|
-
import { ticker as
|
|
34
|
-
let
|
|
35
|
-
var d, h, E, L, f,
|
|
36
|
-
class
|
|
37
|
-
constructor() {
|
|
33
|
+
import { ticker as he } from "../ticker/vanilla/index.js";
|
|
34
|
+
let Re = 0;
|
|
35
|
+
var d, h, E, L, f, q, k, c, _, O, w, N, H, Q, Z, Y, ee;
|
|
36
|
+
class X extends HTMLElement {
|
|
37
|
+
constructor(t) {
|
|
38
38
|
super();
|
|
39
|
-
s(this,
|
|
39
|
+
s(this, H);
|
|
40
40
|
s(this, d, null);
|
|
41
41
|
s(this, h, null);
|
|
42
42
|
s(this, E, !1);
|
|
43
43
|
s(this, L, !1);
|
|
44
44
|
s(this, f, !1);
|
|
45
|
-
s(this,
|
|
45
|
+
s(this, q, "");
|
|
46
46
|
s(this, k, "");
|
|
47
|
-
s(this, c, new
|
|
47
|
+
s(this, c, new be(this, {
|
|
48
48
|
loading: !1,
|
|
49
49
|
loaded: !1,
|
|
50
50
|
error: !1,
|
|
51
51
|
clear: !1
|
|
52
52
|
}));
|
|
53
|
-
s(this,
|
|
54
|
-
s(this,
|
|
53
|
+
s(this, _, null);
|
|
54
|
+
s(this, O);
|
|
55
55
|
s(this, w, null);
|
|
56
|
-
s(this,
|
|
56
|
+
s(this, N);
|
|
57
|
+
s(this, Z, (t) => {
|
|
57
58
|
const i = t[0];
|
|
58
|
-
e(this, f) && (!e(this, L) || this.hasAttribute("reload-source")) && i.isIntersecting && this.triggerLazyLoad(), i.isIntersecting ? z(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && U(this,
|
|
59
|
+
e(this, f) && (!e(this, L) || this.hasAttribute("reload-source")) && i.isIntersecting && this.triggerLazyLoad(), i.isIntersecting ? z(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && U(this, H, Q).call(this, void 0), z(this, "sourceRelease", { custom: !0 }));
|
|
59
60
|
});
|
|
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, E) &&
|
|
61
|
+
s(this, Y, () => {
|
|
62
|
+
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, f) && !e(this, E) && oe.complete(e(this, k)), z(this, "sourceLoaded", { custom: !0 });
|
|
62
63
|
const t = getComputedStyle(this).getPropertyValue("--clear-duration");
|
|
63
|
-
t ? r(this,
|
|
64
|
+
t ? r(this, O, setTimeout(() => {
|
|
64
65
|
e(this, c).set("clear", !0);
|
|
65
66
|
}, parseFloat(t) * 1e3)) : e(this, c).set("clear", !0), r(this, E, !0);
|
|
66
67
|
});
|
|
67
|
-
s(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, E) &&
|
|
68
|
+
s(this, ee, (t) => {
|
|
69
|
+
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, f) && !e(this, E) && oe.error(e(this, k)), z(this, "sourceError", { custom: !0 }), r(this, E, !0);
|
|
69
70
|
});
|
|
70
|
-
|
|
71
|
-
e(this,
|
|
71
|
+
r(this, N, t == null ? void 0 : t.sourceSetOptions), pe && window.IntersectionObserver && r(this, _, new IntersectionObserver(
|
|
72
|
+
e(this, Z)
|
|
72
73
|
));
|
|
73
74
|
}
|
|
74
75
|
get consumerElement() {
|
|
@@ -90,10 +91,10 @@ class K extends HTMLElement {
|
|
|
90
91
|
return e(this, E);
|
|
91
92
|
}
|
|
92
93
|
triggerLazyLoad() {
|
|
93
|
-
!e(this, L) && e(this, d).current && e(this, d).current !== e(this, d).previous && (r(this, L, !0), U(this,
|
|
94
|
+
!e(this, L) && e(this, d).current && e(this, d).current !== e(this, d).previous && (r(this, L, !0), U(this, H, Q).call(this, e(this, d).current));
|
|
94
95
|
}
|
|
95
96
|
connectedCallback() {
|
|
96
|
-
r(this,
|
|
97
|
+
r(this, q, `source-consumer-${++Re}`);
|
|
97
98
|
const t = this.getAttribute("srcset");
|
|
98
99
|
if (!t) return;
|
|
99
100
|
const i = this.hasAttribute("notify") ? this.closest(this.getAttribute("notify")) : null;
|
|
@@ -103,43 +104,48 @@ class K extends HTMLElement {
|
|
|
103
104
|
height: 100%;
|
|
104
105
|
`, e(this, h).classList.add("source-consumer"), Array.from(this.attributes).forEach((o) => {
|
|
105
106
|
if (o.name !== "srcset") {
|
|
106
|
-
const y = o.nodeValue || "", A =
|
|
107
|
+
const y = o.nodeValue || "", A = ge(o.name);
|
|
107
108
|
A in e(this, h) && (e(this, h)[A] = y || !0);
|
|
108
109
|
}
|
|
109
|
-
}), this.appendChild(e(this, h)), r(this, d, new
|
|
110
|
-
srcset: t
|
|
110
|
+
}), this.appendChild(e(this, h)), r(this, d, new Ee({
|
|
111
|
+
srcset: t,
|
|
112
|
+
sourceSetOptions: e(this, N)
|
|
111
113
|
})), r(this, f, this.hasAttribute("lazy")), e(this, d).subscribe((o) => {
|
|
112
|
-
(!e(this, f) || e(this, f) && e(this, L)) && U(this,
|
|
113
|
-
}), e(this, d).connect(), e(this,
|
|
114
|
+
(!e(this, f) || e(this, f) && e(this, L)) && U(this, H, Q).call(this, o.current);
|
|
115
|
+
}), e(this, d).connect(), e(this, _).observe(this);
|
|
114
116
|
}
|
|
115
117
|
disconnectedCallback() {
|
|
116
|
-
e(this,
|
|
118
|
+
e(this, _).disconnect(), e(this, d).close(), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, r(this, E, !1), r(this, L, !1), e(this, h).remove(), e(this, c).reset(), clearTimeout(e(this, O));
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
|
-
d = new WeakMap(), h = new WeakMap(), E = new WeakMap(), L = new WeakMap(), f = new WeakMap(),
|
|
120
|
-
if (clearTimeout(e(this,
|
|
121
|
-
r(this, k, `${e(this,
|
|
121
|
+
d = new WeakMap(), h = new WeakMap(), E = new WeakMap(), L = new WeakMap(), f = new WeakMap(), q = new WeakMap(), k = new WeakMap(), c = new WeakMap(), _ = new WeakMap(), O = new WeakMap(), w = new WeakMap(), N = new WeakMap(), H = new WeakSet(), Q = function(t) {
|
|
122
|
+
if (clearTimeout(e(this, O)), 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) {
|
|
123
|
+
r(this, k, `${e(this, q)}-${t.url}`);
|
|
122
124
|
const i = this.hasAttribute("keep-source-parameters");
|
|
123
|
-
e(this, c).set("loading", !0), r(this, w, i ? t.url : t.name + t.extension), this.consumeSource(e(this, w)), !e(this, f) && !e(this, E) &&
|
|
124
|
-
e(this,
|
|
125
|
+
e(this, c).set("loading", !0), r(this, w, i ? t.url : t.name + t.extension), this.consumeSource(e(this, w)), !e(this, f) && !e(this, E) && oe.add(e(this, k)), e(this, h).onloadeddata = () => {
|
|
126
|
+
e(this, Y).call(this);
|
|
125
127
|
}, e(this, h).onload = () => {
|
|
126
|
-
e(this,
|
|
128
|
+
e(this, Y).call(this);
|
|
127
129
|
}, e(this, h).onerror = () => {
|
|
128
|
-
e(this,
|
|
130
|
+
e(this, ee).call(this, e(this, w));
|
|
129
131
|
};
|
|
130
132
|
} else
|
|
131
133
|
r(this, w, null), this.consumeSource(null);
|
|
132
|
-
},
|
|
133
|
-
var b,
|
|
134
|
-
class
|
|
134
|
+
}, Z = new WeakMap(), Y = new WeakMap(), ee = new WeakMap();
|
|
135
|
+
var b, te, se;
|
|
136
|
+
class Ie extends X {
|
|
135
137
|
constructor() {
|
|
136
|
-
super(
|
|
138
|
+
super({
|
|
139
|
+
sourceSetOptions: {
|
|
140
|
+
mediaBuckets: !1
|
|
141
|
+
}
|
|
142
|
+
});
|
|
137
143
|
s(this, b, null);
|
|
138
|
-
s(this,
|
|
144
|
+
s(this, te, () => {
|
|
139
145
|
var t, i;
|
|
140
146
|
(i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
|
|
141
147
|
});
|
|
142
|
-
s(this,
|
|
148
|
+
s(this, se, () => {
|
|
143
149
|
var t, i;
|
|
144
150
|
(i = (t = this.consumerElement).onload) == null || i.call(t, new Event("error"));
|
|
145
151
|
});
|
|
@@ -148,25 +154,25 @@ class Re extends K {
|
|
|
148
154
|
return document.createElement("div");
|
|
149
155
|
}
|
|
150
156
|
consumeSource(t) {
|
|
151
|
-
e(this, b) && (e(this, b).onload = null, e(this, b).onerror = null), this.consumerElement.innerHTML = (t == null ? void 0 : t.replace(/\\u003C/g, "<").replace(/\\u003E/g, ">").replace(/\\"/g, '"')) || "", r(this, b, this.consumerElement.querySelector("iframe")), e(this, b) && (e(this, b).onload = e(this,
|
|
157
|
+
e(this, b) && (e(this, b).onload = null, e(this, b).onerror = null), this.consumerElement.innerHTML = (t == null ? void 0 : t.replace(/\\u003C/g, "<").replace(/\\u003E/g, ">").replace(/\\"/g, '"')) || "", r(this, b, this.consumerElement.querySelector("iframe")), e(this, b) && (e(this, b).onload = e(this, te), e(this, b).onerror = e(this, se));
|
|
152
158
|
}
|
|
153
159
|
}
|
|
154
|
-
b = new WeakMap(),
|
|
155
|
-
customElements.get("e-iframe") || customElements.define("e-iframe",
|
|
156
|
-
class
|
|
160
|
+
b = new WeakMap(), te = new WeakMap(), se = new WeakMap();
|
|
161
|
+
customElements.get("e-iframe") || customElements.define("e-iframe", Ie);
|
|
162
|
+
class Ae extends X {
|
|
157
163
|
createConsumer() {
|
|
158
164
|
return document.createElement("img");
|
|
159
165
|
}
|
|
160
166
|
consumeSource(n) {
|
|
161
|
-
if (n && this.hasAttribute("webp") &&
|
|
167
|
+
if (n && this.hasAttribute("webp") && Le.isWebp) {
|
|
162
168
|
const t = n.split(".").slice(0, -1).join(".") + ".webp";
|
|
163
169
|
this.consumerElement.src = t;
|
|
164
170
|
} else
|
|
165
171
|
this.consumerElement.src = n || "";
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
|
-
customElements.get("e-image") || customElements.define("e-image",
|
|
169
|
-
function
|
|
174
|
+
customElements.get("e-image") || customElements.define("e-image", Ae);
|
|
175
|
+
function ke(a) {
|
|
170
176
|
const n = a.match(/\{([\d-]+)\}/);
|
|
171
177
|
if (n) {
|
|
172
178
|
const t = n[1].split("-");
|
|
@@ -177,39 +183,39 @@ function Ae(a) {
|
|
|
177
183
|
}
|
|
178
184
|
return null;
|
|
179
185
|
}
|
|
180
|
-
var p, P,
|
|
181
|
-
class
|
|
186
|
+
var p, P, M, S, C, T, x, D, g, R;
|
|
187
|
+
class Pe extends X {
|
|
182
188
|
constructor(t) {
|
|
183
189
|
super();
|
|
184
190
|
s(this, p, []);
|
|
185
|
-
s(this, P, new
|
|
191
|
+
s(this, P, new J(
|
|
186
192
|
this,
|
|
187
193
|
"--fit",
|
|
188
194
|
"contain"
|
|
189
195
|
));
|
|
190
|
-
s(this,
|
|
191
|
-
s(this,
|
|
192
|
-
s(this,
|
|
196
|
+
s(this, M, new J(this, "--autoplay", !1));
|
|
197
|
+
s(this, S, new J(this, "--offset-x", 0.5));
|
|
198
|
+
s(this, C, new J(this, "--offset-y", 0.5));
|
|
193
199
|
s(this, T, null);
|
|
194
200
|
s(this, x, 0);
|
|
195
|
-
s(this,
|
|
201
|
+
s(this, D, 1);
|
|
196
202
|
s(this, g, () => {
|
|
197
203
|
if (e(this, p).length) {
|
|
198
204
|
const t = e(this, p)[0];
|
|
199
|
-
e(this, P).current === "cover" ? r(this, T,
|
|
205
|
+
e(this, P).current === "cover" ? r(this, T, we(
|
|
200
206
|
t.naturalWidth,
|
|
201
207
|
t.naturalHeight,
|
|
202
208
|
this.consumerElement.width,
|
|
203
209
|
this.consumerElement.height,
|
|
204
|
-
e(this,
|
|
205
|
-
e(this,
|
|
206
|
-
)) : r(this, T,
|
|
210
|
+
e(this, S).current,
|
|
211
|
+
e(this, C).current
|
|
212
|
+
)) : r(this, T, Se(
|
|
207
213
|
t.naturalWidth,
|
|
208
214
|
t.naturalHeight,
|
|
209
215
|
this.consumerElement.width,
|
|
210
216
|
this.consumerElement.height,
|
|
211
|
-
e(this,
|
|
212
|
-
e(this,
|
|
217
|
+
e(this, S).current,
|
|
218
|
+
e(this, C).current
|
|
213
219
|
));
|
|
214
220
|
}
|
|
215
221
|
});
|
|
@@ -218,11 +224,11 @@ class ke extends K {
|
|
|
218
224
|
return;
|
|
219
225
|
t.detail.context.clearRect(0, 0, t.detail.width, t.detail.height);
|
|
220
226
|
const i = e(this, p)[e(this, x)];
|
|
221
|
-
i && t.detail.context.drawImage(i, ...e(this, T)), e(this,
|
|
227
|
+
i && t.detail.context.drawImage(i, ...e(this, T)), e(this, M).current && r(this, x, (e(this, x) + 1) % e(this, p).length);
|
|
222
228
|
});
|
|
223
|
-
|
|
229
|
+
pe && (r(this, D, parseInt(
|
|
224
230
|
((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
|
|
225
|
-
)), e(this, P).subscribe(e(this, g)), e(this,
|
|
231
|
+
)), e(this, P).subscribe(e(this, g)), e(this, S).subscribe(e(this, g)), e(this, C).subscribe(e(this, g)), this.addEventListener("sourceCapture", (i) => {
|
|
226
232
|
this.consumerElement.addEventListener(
|
|
227
233
|
"canvasRender",
|
|
228
234
|
e(this, R)
|
|
@@ -238,10 +244,10 @@ class ke extends K {
|
|
|
238
244
|
e(this, p).length && r(this, x, Math.floor((e(this, p).length - 1) * t));
|
|
239
245
|
}
|
|
240
246
|
connectedCallback() {
|
|
241
|
-
super.connectedCallback(), e(this,
|
|
247
|
+
super.connectedCallback(), e(this, M).observe(), e(this, P).observe(), e(this, S).observe(), e(this, C).observe(), fe.subscribe(this, e(this, g));
|
|
242
248
|
}
|
|
243
249
|
disconnectedCallback() {
|
|
244
|
-
super.disconnectedCallback(), e(this,
|
|
250
|
+
super.disconnectedCallback(), e(this, M).unobserve(), e(this, P).unobserve(), e(this, S).unobserve(), e(this, C).unobserve(), r(this, p, []), fe.unsubscribe(e(this, g)), this.consumerElement.removeEventListener(
|
|
245
251
|
"canvasRender",
|
|
246
252
|
e(this, R)
|
|
247
253
|
);
|
|
@@ -250,54 +256,54 @@ class ke extends K {
|
|
|
250
256
|
return new Ce();
|
|
251
257
|
}
|
|
252
258
|
consumeSource(t) {
|
|
253
|
-
return
|
|
259
|
+
return me(this, null, function* () {
|
|
254
260
|
var i, o, y, A;
|
|
255
261
|
if (t) {
|
|
256
262
|
this.consumerElement.removeEventListener(
|
|
257
263
|
"canvasRender",
|
|
258
264
|
e(this, R)
|
|
259
265
|
);
|
|
260
|
-
const v = [], m =
|
|
266
|
+
const v = [], m = ke(t);
|
|
261
267
|
if (m)
|
|
262
|
-
for (let
|
|
268
|
+
for (let l = m.start; l <= m.end; l++) {
|
|
263
269
|
const le = t.replace(
|
|
264
270
|
/\{([^}]+)\}/,
|
|
265
|
-
|
|
266
|
-
),
|
|
267
|
-
|
|
271
|
+
l.toString().padStart(e(this, D), "0")
|
|
272
|
+
), G = new Image();
|
|
273
|
+
G.src = le, v.push(G);
|
|
268
274
|
}
|
|
269
275
|
else {
|
|
270
|
-
const
|
|
271
|
-
|
|
276
|
+
const l = new Image();
|
|
277
|
+
l.src = t, v.push(l);
|
|
272
278
|
}
|
|
273
279
|
try {
|
|
274
280
|
yield Promise.all(
|
|
275
|
-
v.map((
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
},
|
|
279
|
-
|
|
281
|
+
v.map((l, le) => new Promise((G, ye) => {
|
|
282
|
+
l.onload = () => {
|
|
283
|
+
G();
|
|
284
|
+
}, l.onerror = (xe) => {
|
|
285
|
+
ye(`${l.src} Image not found`);
|
|
280
286
|
};
|
|
281
287
|
}))
|
|
282
288
|
), r(this, p, v), e(this, g).call(this), (o = (i = this.consumerElement).onload) == null || o.call(i, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
|
|
283
289
|
"canvasRender",
|
|
284
290
|
e(this, R)
|
|
285
291
|
);
|
|
286
|
-
} catch (
|
|
287
|
-
console.error(
|
|
292
|
+
} catch (l) {
|
|
293
|
+
console.error(l), (A = (y = this.consumerElement).onerror) == null || A.call(y, new Event("error"));
|
|
288
294
|
}
|
|
289
295
|
}
|
|
290
296
|
});
|
|
291
297
|
}
|
|
292
298
|
}
|
|
293
|
-
p = new WeakMap(), P = new WeakMap(),
|
|
294
|
-
customElements.get("e-sequence") || customElements.define("e-sequence",
|
|
295
|
-
var V,
|
|
296
|
-
class
|
|
299
|
+
p = new WeakMap(), P = new WeakMap(), M = new WeakMap(), S = new WeakMap(), C = new WeakMap(), T = new WeakMap(), x = new WeakMap(), D = new WeakMap(), g = new WeakMap(), R = new WeakMap();
|
|
300
|
+
customElements.get("e-sequence") || customElements.define("e-sequence", Pe);
|
|
301
|
+
var V, F;
|
|
302
|
+
class Te extends X {
|
|
297
303
|
constructor() {
|
|
298
304
|
super(...arguments);
|
|
299
305
|
s(this, V, 0);
|
|
300
|
-
s(this,
|
|
306
|
+
s(this, F, () => {
|
|
301
307
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
302
308
|
const t = this.consumerElement.readyState / 4;
|
|
303
309
|
t > e(this, V) && r(this, V, t), z(this, "videoReadyStateChange", {
|
|
@@ -305,12 +311,12 @@ class Pe extends K {
|
|
|
305
311
|
readyState: this.consumerElement.readyState,
|
|
306
312
|
progress: e(this, V)
|
|
307
313
|
}
|
|
308
|
-
}), this.consumerElement.readyState === 4 &&
|
|
314
|
+
}), this.consumerElement.readyState === 4 && he.unsubscribe(e(this, F));
|
|
309
315
|
});
|
|
310
316
|
}
|
|
311
317
|
connectedCallback() {
|
|
312
318
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
313
|
-
|
|
319
|
+
he.subscribe(e(this, F)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
|
|
314
320
|
}), this.addEventListener("sourceRelease", () => {
|
|
315
321
|
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
|
|
316
322
|
"state-0",
|
|
@@ -322,7 +328,7 @@ class Pe extends K {
|
|
|
322
328
|
});
|
|
323
329
|
}
|
|
324
330
|
disconnectedCallback() {
|
|
325
|
-
super.disconnectedCallback(),
|
|
331
|
+
super.disconnectedCallback(), he.unsubscribe(e(this, F)), r(this, V, 0);
|
|
326
332
|
}
|
|
327
333
|
createConsumer() {
|
|
328
334
|
return document.createElement("video");
|
|
@@ -331,45 +337,45 @@ class Pe extends K {
|
|
|
331
337
|
this.consumerElement.src = t || "", this.consumerElement.autoplay = !0;
|
|
332
338
|
}
|
|
333
339
|
}
|
|
334
|
-
V = new WeakMap(),
|
|
335
|
-
customElements.get("e-video") || customElements.define("e-video",
|
|
336
|
-
var
|
|
337
|
-
const
|
|
340
|
+
V = new WeakMap(), F = new WeakMap();
|
|
341
|
+
customElements.get("e-video") || customElements.define("e-video", Te);
|
|
342
|
+
var u, W, I, j, $, ie, re, ne, K, ue;
|
|
343
|
+
const B = class B extends X {
|
|
338
344
|
constructor() {
|
|
339
345
|
super();
|
|
340
|
-
s(this,
|
|
341
|
-
s(this,
|
|
342
|
-
s(this,
|
|
346
|
+
s(this, K);
|
|
347
|
+
s(this, u);
|
|
348
|
+
s(this, W);
|
|
343
349
|
s(this, I, !1);
|
|
344
|
-
s(this,
|
|
345
|
-
s(this,
|
|
346
|
-
r(this, I, e(this, I) || this.hasAttribute("autoplay") && !this.hasAttribute("capture-autoplay")), r(this,
|
|
350
|
+
s(this, j, !1);
|
|
351
|
+
s(this, $, () => {
|
|
352
|
+
r(this, I, e(this, I) || this.hasAttribute("autoplay") && !this.hasAttribute("capture-autoplay")), r(this, u, new window.YT.Player(e(this, W), {
|
|
347
353
|
playerVars: {
|
|
348
354
|
mute: this.hasAttribute("muted") ? 1 : 0,
|
|
349
355
|
controls: this.hasAttribute("controls") ? 1 : 0
|
|
350
356
|
},
|
|
351
357
|
events: {
|
|
352
|
-
onReady: e(this,
|
|
353
|
-
onError: e(this,
|
|
354
|
-
onStateChange: e(this,
|
|
358
|
+
onReady: e(this, ie),
|
|
359
|
+
onError: e(this, re),
|
|
360
|
+
onStateChange: e(this, ne)
|
|
355
361
|
}
|
|
356
362
|
}));
|
|
357
363
|
});
|
|
358
|
-
s(this,
|
|
359
|
-
r(this,
|
|
364
|
+
s(this, ie, () => {
|
|
365
|
+
r(this, j, !0), U(this, K, ue).call(this);
|
|
360
366
|
});
|
|
361
|
-
s(this,
|
|
367
|
+
s(this, re, (t) => {
|
|
362
368
|
var i, o;
|
|
363
369
|
console.error("YouTube: Ошибка при загрузке видео:", this.currentURL, t), (o = (i = this.consumerElement).onerror) == null || o.call(i, new Event("error"));
|
|
364
370
|
});
|
|
365
|
-
s(this,
|
|
371
|
+
s(this, ne, () => {
|
|
366
372
|
});
|
|
367
|
-
r(this,
|
|
368
|
-
|
|
373
|
+
r(this, W, "yt-" + ve(10)), B.__apiReady || (window.onYouTubeIframeAPIReady = () => {
|
|
374
|
+
B.__apiReady = !0, z(window, "youTubeIframeAPIReady");
|
|
369
375
|
}), this.addEventListener("sourceCapture", () => {
|
|
370
|
-
this.hasAttribute("capture-autoplay") && (e(this,
|
|
376
|
+
this.hasAttribute("capture-autoplay") && (e(this, j) ? e(this, u).playVideo() : r(this, I, !0));
|
|
371
377
|
}), this.addEventListener("sourceRelease", () => {
|
|
372
|
-
e(this,
|
|
378
|
+
e(this, u) && this.hasAttribute("capture-autoplay") && (e(this, u).pauseVideo(), this.hasAttribute("replay") && e(this, u).seekTo(0));
|
|
373
379
|
});
|
|
374
380
|
}
|
|
375
381
|
static __onYouTubeIframeAPIReady() {
|
|
@@ -377,7 +383,7 @@ const _ = class _ extends K {
|
|
|
377
383
|
}
|
|
378
384
|
createConsumer() {
|
|
379
385
|
const t = document.createElement("div");
|
|
380
|
-
return t.id = e(this,
|
|
386
|
+
return t.id = e(this, W), t;
|
|
381
387
|
}
|
|
382
388
|
consumeSource(t) {
|
|
383
389
|
var i;
|
|
@@ -388,24 +394,24 @@ const _ = class _ extends K {
|
|
|
388
394
|
const y = document.getElementsByTagName("script")[0];
|
|
389
395
|
(i = y.parentNode) == null || i.insertBefore(o, y);
|
|
390
396
|
}
|
|
391
|
-
e(this,
|
|
392
|
-
} else e(this,
|
|
397
|
+
e(this, u) ? U(this, K, ue).call(this) : B.__apiReady ? e(this, $).call(this) : addEventListener("youTubeIframeAPIReady", e(this, $));
|
|
398
|
+
} else e(this, u) && e(this, u).stopVideo();
|
|
393
399
|
}
|
|
394
400
|
disconnectedCallback() {
|
|
395
|
-
super.disconnectedCallback(), e(this,
|
|
401
|
+
super.disconnectedCallback(), e(this, u) && e(this, u).destroy(), removeEventListener("youTubeIframeAPIReady", e(this, $));
|
|
396
402
|
}
|
|
397
403
|
};
|
|
398
|
-
|
|
404
|
+
u = new WeakMap(), W = new WeakMap(), I = new WeakMap(), j = new WeakMap(), $ = new WeakMap(), ie = new WeakMap(), re = new WeakMap(), ne = new WeakMap(), K = new WeakSet(), ue = function() {
|
|
399
405
|
var t, i;
|
|
400
|
-
this.currentURL && (this.currentURL.startsWith("http") ? e(this,
|
|
401
|
-
},
|
|
402
|
-
let
|
|
403
|
-
customElements.get("e-youtube") || customElements.define("e-youtube",
|
|
406
|
+
this.currentURL && (this.currentURL.startsWith("http") ? e(this, u).loadVideoByUrl(this.currentURL) : e(this, u).loadVideoById(this.currentURL)), e(this, I) ? e(this, u).playVideo() : e(this, u).stopVideo(), r(this, I, !1), (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
|
|
407
|
+
}, B.__apiReady = !1;
|
|
408
|
+
let ce = B;
|
|
409
|
+
customElements.get("e-youtube") || customElements.define("e-youtube", ce);
|
|
404
410
|
export {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
+
Ie as IFrameElement,
|
|
412
|
+
Ae as ImageElement,
|
|
413
|
+
Pe as SequenceElement,
|
|
414
|
+
X as SourceElement,
|
|
415
|
+
Te as VideoElement,
|
|
416
|
+
ce as YouTubeElement
|
|
411
417
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SourceManager } from '../../source';
|
|
2
2
|
import { ClassLinkedStatus } from '../../class-linked-status';
|
|
3
|
+
import { SourceSetOptions } from '../../source/SourceSet';
|
|
3
4
|
|
|
4
5
|
export interface SourceEvents {
|
|
5
6
|
sourceCapture: CustomEvent;
|
|
@@ -7,9 +8,12 @@ export interface SourceEvents {
|
|
|
7
8
|
sourceLoaded: CustomEvent;
|
|
8
9
|
sourceError: CustomEvent;
|
|
9
10
|
}
|
|
11
|
+
export interface SourceElementOptions {
|
|
12
|
+
sourceSetOptions?: SourceSetOptions;
|
|
13
|
+
}
|
|
10
14
|
export declare abstract class SourceElement<T extends HTMLElement> extends HTMLElement {
|
|
11
15
|
#private;
|
|
12
|
-
constructor();
|
|
16
|
+
constructor(options?: SourceElementOptions);
|
|
13
17
|
get consumerElement(): T;
|
|
14
18
|
get sourceManager(): SourceManager;
|
|
15
19
|
get status(): ClassLinkedStatus<{
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Store } from '../store/vanilla';
|
|
2
2
|
import { Source } from './SourceClass';
|
|
3
|
+
import { SourceSetOptions } from './SourceSet';
|
|
3
4
|
|
|
4
5
|
export type SourceManagerSourceSet = string | Array<string>;
|
|
5
6
|
export interface SourceManagerParameters {
|
|
6
7
|
srcset: SourceManagerSourceSet;
|
|
8
|
+
sourceSetOptions?: SourceSetOptions;
|
|
7
9
|
}
|
|
8
10
|
export declare class SourceManager extends Store<Source | undefined> {
|
|
9
11
|
#private;
|
|
@@ -2,8 +2,11 @@ import { Source } from './SourceClass';
|
|
|
2
2
|
|
|
3
3
|
export type SourceSetMediaSources = Array<Source>;
|
|
4
4
|
export type SourceSetMediaBucket = Map<string, SourceSetMediaSources>;
|
|
5
|
+
export interface SourceSetOptions {
|
|
6
|
+
mediaBuckets?: boolean;
|
|
7
|
+
}
|
|
5
8
|
export declare class SourceSet {
|
|
6
9
|
#private;
|
|
7
|
-
constructor(sourceSet: string | Array<string
|
|
10
|
+
constructor(sourceSet: string | Array<string>, options?: SourceSetOptions);
|
|
8
11
|
get mediaBuckets(): SourceSetMediaBucket;
|
|
9
12
|
}
|
package/lib/source/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=r=>{throw TypeError(r)};var
|
|
1
|
+
"use strict";var b=r=>{throw TypeError(r)};var k=(r,n,t)=>n.has(r)||b("Cannot "+t);var e=(r,n,t)=>(k(r,n,"read from private field"),t?t.call(r):n.get(r)),u=(r,n,t)=>n.has(r)?b("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(r):n.set(r,t),s=(r,n,t,h)=>(k(r,n,"write to private field"),h?h.call(r,t):n.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../order/index.cjs"),B=require("../window-resizer/vanilla/index.cjs"),z=require("../Store-C2J4Q87x.cjs");var w,p,M,d,a,o,f;class I{constructor(n){u(this,w);u(this,p);u(this,M);u(this,d);u(this,a);u(this,o);u(this,f);s(this,w,n);const t=n.split(".");s(this,p,t.length>1?t.slice(0,-1).join("."):t.join("."));const h=/\d+x/g,y=t.find(l=>l.match(h));s(this,M,y?parseInt(y):1);const c=/\d+max/g,g=/\d+min/g,S=/\d+mar/g,E=/\d+mir/g,$=t.find(l=>l.match(c)),i=t.find(l=>l.match(g)),m=t.find(l=>l.match(S)),V=t.find(l=>l.match(E));m?(s(this,a,parseInt(m)),s(this,o,"max"),s(this,d,`(max-aspect-ratio: ${e(this,a)})`)):V?(s(this,a,parseInt(V)),s(this,o,"max"),s(this,d,`(min-aspect-ratio: ${e(this,a)})`)):$?(s(this,a,parseInt($)),s(this,o,"max"),s(this,d,`(max-width: ${e(this,a)}px)`)):i?(s(this,a,parseInt(i)),s(this,d,`(min-width: ${e(this,a)}px)`),s(this,o,"min")):(s(this,a,0),s(this,d,`(min-width: ${e(this,a)}px)`),s(this,o,"min")),s(this,p,e(this,p).replace(`.${e(this,a)}${e(this,o)}`,"")),s(this,f,t[t.length-1]===e(this,p)?"":"."+t[t.length-1]),s(this,f,e(this,f).replace(`.${e(this,a)}${e(this,o)}`,""))}get url(){return e(this,w)}get name(){return e(this,p)}get density(){return e(this,M)}get query(){return e(this,d)}get extension(){return e(this,f)}get queryType(){return e(this,o)}get queryValue(){return e(this,a)}}w=new WeakMap,p=new WeakMap,M=new WeakMap,d=new WeakMap,a=new WeakMap,o=new WeakMap,f=new WeakMap;var x;class T{constructor(n,t){u(this,x);s(this,x,new Map);const h=(t==null?void 0:t.mediaBuckets)!==!1,y=typeof n=="string"?h?n.trim().split(",").map(i=>i.trim()).filter(i=>!!i):[n]:n,c=[];y.forEach(i=>{const m=new I(i);c.push([m.query,m])});const g=c.filter(i=>i[1].queryType.includes("max")).sort((i,m)=>m[1].queryValue-i[1].queryValue),S=c.filter(i=>i[1].queryType.includes("min")&&i[1].queryValue!==0).sort((i,m)=>i[1].queryValue-m[1].queryValue),E=c.filter(i=>i[0]==="(min-width: 0px)");(E?[...E,...g,...S]:[...g,...S]).forEach(i=>{e(this,x).has(i[0])||e(this,x).set(i[0],[]),e(this,x).get(i[0]).push(i[1])})}get mediaBuckets(){return e(this,x)}}x=new WeakMap;var R,q;class A extends z.Store{constructor(t){super(void 0);u(this,R);u(this,q,()=>{let t;e(this,R).mediaBuckets.forEach((c,g)=>{matchMedia(g).matches&&(t=c)});let h,y=0;t==null||t.forEach(c=>{c.density>y&&c.density<=Math.max(devicePixelRatio,1)&&(y=c.density,h=c)}),t!=null&&t.length&&!h&&(h=t[0]),this.current=h});s(this,R,new T(t.srcset,t.sourceSetOptions))}close(){super.close(),this.disconnect()}connect(){B.windowResizer.subscribe(e(this,q),_.RESIZE_ORDER.SOURCE_MANAGER),e(this,q).call(this)}disconnect(){B.windowResizer.unsubscribe(e(this,q))}}R=new WeakMap,q=new WeakMap;exports.Source=I;exports.SourceManager=A;exports.SourceSet=T;
|
package/lib/source/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var
|
|
1
|
+
var B = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (r, n, t) => (
|
|
6
|
-
import { RESIZE_ORDER as
|
|
7
|
-
import { windowResizer as
|
|
4
|
+
var I = (r, n, t) => n.has(r) || B("Cannot " + t);
|
|
5
|
+
var e = (r, n, t) => (I(r, n, "read from private field"), t ? t.call(r) : n.get(r)), m = (r, n, t) => n.has(r) ? B("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, t), i = (r, n, t, c) => (I(r, n, "write to private field"), c ? c.call(r, t) : n.set(r, t), t);
|
|
6
|
+
import { RESIZE_ORDER as A } from "../order/index.js";
|
|
7
|
+
import { windowResizer as b } from "../window-resizer/vanilla/index.js";
|
|
8
8
|
import { S } from "../Store-Cm3LPXlx.js";
|
|
9
|
-
var w,
|
|
9
|
+
var w, p, E, d, h, o, y;
|
|
10
10
|
class T {
|
|
11
11
|
constructor(n) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
m(this, w);
|
|
13
|
+
m(this, p);
|
|
14
|
+
m(this, E);
|
|
15
|
+
m(this, d);
|
|
16
|
+
m(this, h);
|
|
17
|
+
m(this, o);
|
|
18
|
+
m(this, y);
|
|
19
|
+
i(this, w, n);
|
|
20
20
|
const t = n.split(".");
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
`.${e(this, h)}${e(this,
|
|
21
|
+
i(this, p, t.length > 1 ? t.slice(0, -1).join(".") : t.join("."));
|
|
22
|
+
const c = /\d+x/g, x = t.find((l) => l.match(c));
|
|
23
|
+
i(this, E, x ? parseInt(x) : 1);
|
|
24
|
+
const a = /\d+max/g, g = /\d+min/g, R = /\d+mar/g, $ = /\d+mir/g, V = t.find((l) => l.match(a)), s = t.find((l) => l.match(g)), u = t.find((l) => l.match(R)), k = t.find((l) => l.match($));
|
|
25
|
+
u ? (i(this, h, parseInt(u)), i(this, o, "max"), i(this, d, `(max-aspect-ratio: ${e(this, h)})`)) : k ? (i(this, h, parseInt(k)), i(this, o, "max"), i(this, d, `(min-aspect-ratio: ${e(this, h)})`)) : V ? (i(this, h, parseInt(V)), i(this, o, "max"), i(this, d, `(max-width: ${e(this, h)}px)`)) : s ? (i(this, h, parseInt(s)), i(this, d, `(min-width: ${e(this, h)}px)`), i(this, o, "min")) : (i(this, h, 0), i(this, d, `(min-width: ${e(this, h)}px)`), i(this, o, "min")), i(this, p, e(this, p).replace(
|
|
26
|
+
`.${e(this, h)}${e(this, o)}`,
|
|
27
27
|
""
|
|
28
|
-
)),
|
|
29
|
-
`.${e(this, h)}${e(this,
|
|
28
|
+
)), i(this, y, t[t.length - 1] === e(this, p) ? "" : "." + t[t.length - 1]), i(this, y, e(this, y).replace(
|
|
29
|
+
`.${e(this, h)}${e(this, o)}`,
|
|
30
30
|
""
|
|
31
31
|
));
|
|
32
32
|
}
|
|
@@ -34,75 +34,75 @@ class T {
|
|
|
34
34
|
return e(this, w);
|
|
35
35
|
}
|
|
36
36
|
get name() {
|
|
37
|
-
return e(this,
|
|
37
|
+
return e(this, p);
|
|
38
38
|
}
|
|
39
39
|
get density() {
|
|
40
40
|
return e(this, E);
|
|
41
41
|
}
|
|
42
42
|
get query() {
|
|
43
|
-
return e(this,
|
|
43
|
+
return e(this, d);
|
|
44
44
|
}
|
|
45
45
|
get extension() {
|
|
46
46
|
return e(this, y);
|
|
47
47
|
}
|
|
48
48
|
get queryType() {
|
|
49
|
-
return e(this,
|
|
49
|
+
return e(this, o);
|
|
50
50
|
}
|
|
51
51
|
get queryValue() {
|
|
52
52
|
return e(this, h);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
w = new WeakMap(),
|
|
56
|
-
var
|
|
57
|
-
class
|
|
58
|
-
constructor(n) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const t = typeof n == "string" ? n.trim().split(",").map((
|
|
62
|
-
|
|
63
|
-
const u = new T(
|
|
55
|
+
w = new WeakMap(), p = new WeakMap(), E = new WeakMap(), d = new WeakMap(), h = new WeakMap(), o = new WeakMap(), y = new WeakMap();
|
|
56
|
+
var f;
|
|
57
|
+
class O {
|
|
58
|
+
constructor(n, t) {
|
|
59
|
+
m(this, f);
|
|
60
|
+
i(this, f, /* @__PURE__ */ new Map());
|
|
61
|
+
const c = (t == null ? void 0 : t.mediaBuckets) !== !1, x = typeof n == "string" ? c ? n.trim().split(",").map((s) => s.trim()).filter((s) => !!s) : [n] : n, a = [];
|
|
62
|
+
x.forEach((s) => {
|
|
63
|
+
const u = new T(s);
|
|
64
64
|
a.push([u.query, u]);
|
|
65
65
|
});
|
|
66
|
-
const
|
|
67
|
-
(
|
|
68
|
-
e(this,
|
|
66
|
+
const g = a.filter((s) => s[1].queryType.includes("max")).sort((s, u) => u[1].queryValue - s[1].queryValue), R = a.filter((s) => s[1].queryType.includes("min") && s[1].queryValue !== 0).sort((s, u) => s[1].queryValue - u[1].queryValue), $ = a.filter((s) => s[0] === "(min-width: 0px)");
|
|
67
|
+
($ ? [...$, ...g, ...R] : [...g, ...R]).forEach((s) => {
|
|
68
|
+
e(this, f).has(s[0]) || e(this, f).set(s[0], []), e(this, f).get(s[0]).push(s[1]);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
get mediaBuckets() {
|
|
72
|
-
return e(this,
|
|
72
|
+
return e(this, f);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
var
|
|
75
|
+
f = new WeakMap();
|
|
76
|
+
var M, q;
|
|
77
77
|
class _ extends S {
|
|
78
78
|
constructor(t) {
|
|
79
79
|
super(void 0);
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
m(this, M);
|
|
81
|
+
m(this, q, () => {
|
|
82
82
|
let t;
|
|
83
|
-
e(this,
|
|
84
|
-
matchMedia(g).matches && (t =
|
|
83
|
+
e(this, M).mediaBuckets.forEach((a, g) => {
|
|
84
|
+
matchMedia(g).matches && (t = a);
|
|
85
85
|
});
|
|
86
|
-
let
|
|
87
|
-
t == null || t.forEach((
|
|
88
|
-
|
|
89
|
-
}), t != null && t.length && !
|
|
86
|
+
let c, x = 0;
|
|
87
|
+
t == null || t.forEach((a) => {
|
|
88
|
+
a.density > x && a.density <= Math.max(devicePixelRatio, 1) && (x = a.density, c = a);
|
|
89
|
+
}), t != null && t.length && !c && (c = t[0]), this.current = c;
|
|
90
90
|
});
|
|
91
|
-
|
|
91
|
+
i(this, M, new O(t.srcset, t.sourceSetOptions));
|
|
92
92
|
}
|
|
93
93
|
close() {
|
|
94
94
|
super.close(), this.disconnect();
|
|
95
95
|
}
|
|
96
96
|
connect() {
|
|
97
|
-
|
|
97
|
+
b.subscribe(e(this, q), A.SOURCE_MANAGER), e(this, q).call(this);
|
|
98
98
|
}
|
|
99
99
|
disconnect() {
|
|
100
|
-
|
|
100
|
+
b.unsubscribe(e(this, q));
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
M = new WeakMap(), q = new WeakMap();
|
|
104
104
|
export {
|
|
105
105
|
T as Source,
|
|
106
106
|
_ as SourceManager,
|
|
107
|
-
|
|
107
|
+
O as SourceSet
|
|
108
108
|
};
|