aptechka 0.29.8 → 0.30.0
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/canvas/index.cjs +1 -0
- package/lib/canvas/index.js +108 -0
- package/lib/media-elements/index.cjs +2 -2
- package/lib/media-elements/index.js +153 -248
- package/lib/slicer/index.cjs +3 -3
- package/lib/slicer/index.js +68 -58
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var f=i=>{throw TypeError(i)};var R=(i,s,e)=>s.has(i)||f("Cannot "+e);var t=(i,s,e)=>(R(i,s,"read from private field"),e?e.call(i):s.get(i)),n=(i,s,e)=>s.has(i)?f("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(i):s.set(i,e),a=(i,s,e,d)=>(R(i,s,"write to private field"),d?d.call(i,e):s.set(i,e),e),o=(i,s,e)=>(R(i,s,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../css-property/index.cjs"),C=require("../element-resizer/vanilla/index.cjs"),w=require("../ticker/vanilla/index.cjs"),z=require("../browser-CpzFX2xg.cjs"),_=require("../jss-GJLvaNfT.cjs"),B=require("../math-GDWEqu7y.cjs");var c,r,m,l,u,p,b,g,h,E,k,x,v,S,P;class y extends HTMLElement{constructor(){super();n(this,h);n(this,c,new q.CSSProperty(this,"--fps",0));n(this,r,null);n(this,m,null);n(this,l,0);n(this,u,0);n(this,p,1);n(this,b,0);n(this,g,1);n(this,x,e=>{a(this,p,B.clamp(devicePixelRatio,1,2)),a(this,l,e.contentRect.width),a(this,u,e.contentRect.height),t(this,r).width=t(this,l)*this.pixelRatio,t(this,r).height=t(this,u)*this.pixelRatio,this.context.scale(this.pixelRatio,this.pixelRatio),o(this,h,P).call(this),o(this,h,S).call(this)});n(this,v,e=>{a(this,b,e.timestamp),a(this,g,e.timeBetweenFrames),o(this,h,S).call(this)});if(z.isBrowser){const e=this.attachShadow({mode:"open"});e.adoptedStyleSheets.push(_.createStylesheet({" :host, canvas":{display:"block",width:"100%",height:"100%"}})),a(this,r,document.createElement("canvas")),a(this,m,t(this,r).getContext("2d")),e.appendChild(t(this,r)),t(this,c).subscribe(d=>{typeof d.previous!="undefined"&&d.current!==d.previous&&o(this,h,E).call(this)})}}get fpsCSSProperty(){return t(this,c)}get canvasElement(){return t(this,r)}get context(){return t(this,m)}get pixelRatio(){return t(this,p)}get width(){return t(this,l)}get height(){return t(this,u)}get detail(){return{width:t(this,l),height:t(this,u),element:this,canvasElement:t(this,r),pixelRatio:t(this,p),context:t(this,m),timestamp:t(this,b),timeBetweenFrames:t(this,g)}}connectedCallback(){t(this,c).observe(),C.elementResizer.subscribe(this,t(this,x)),o(this,h,E).call(this)}disconnectedCallback(){t(this,c).unobserve(),C.elementResizer.unsubscribe(t(this,x)),o(this,h,k).call(this)}}c=new WeakMap,r=new WeakMap,m=new WeakMap,l=new WeakMap,u=new WeakMap,p=new WeakMap,b=new WeakMap,g=new WeakMap,h=new WeakSet,E=function(){w.ticker.unsubscribe(t(this,v)),this.hasAttribute("static")||w.ticker.subscribe(t(this,v),{culling:this,maxFPS:t(this,c).current})},k=function(){w.ticker.unsubscribe(t(this,v))},x=new WeakMap,v=new WeakMap,S=function(){this.dispatchEvent(new CustomEvent("canvasRender",{composed:!0,detail:this.detail}))},P=function(){this.dispatchEvent(new CustomEvent("canvasResize",{composed:!0,detail:this.detail}))};customElements.get("e-canvas")||customElements.define("e-canvas",y);exports.CanvasElement=y;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var S = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
|
+
};
|
|
4
|
+
var x = (i, s, e) => s.has(i) || S("Cannot " + e);
|
|
5
|
+
var t = (i, s, e) => (x(i, s, "read from private field"), e ? e.call(i) : s.get(i)), h = (i, s, e) => s.has(i) ? S("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, e), a = (i, s, e, p) => (x(i, s, "write to private field"), p ? p.call(i, e) : s.set(i, e), e), c = (i, s, e) => (x(i, s, "access private method"), e);
|
|
6
|
+
import { CSSProperty as P } from "../css-property/index.js";
|
|
7
|
+
import { elementResizer as C } from "../element-resizer/vanilla/index.js";
|
|
8
|
+
import { ticker as w } from "../ticker/vanilla/index.js";
|
|
9
|
+
import { i as z } from "../browser-0zX67oeU.js";
|
|
10
|
+
import { c as B } from "../jss-CjccJC-K.js";
|
|
11
|
+
import { c as F } from "../math-BOBiC4TN.js";
|
|
12
|
+
var o, r, d, m, l, u, b, f, n, R, y, g, v, E, k;
|
|
13
|
+
class L extends HTMLElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
h(this, n);
|
|
17
|
+
h(this, o, new P(this, "--fps", 0));
|
|
18
|
+
h(this, r, null);
|
|
19
|
+
h(this, d, null);
|
|
20
|
+
h(this, m, 0);
|
|
21
|
+
h(this, l, 0);
|
|
22
|
+
h(this, u, 1);
|
|
23
|
+
h(this, b, 0);
|
|
24
|
+
h(this, f, 1);
|
|
25
|
+
h(this, g, (e) => {
|
|
26
|
+
a(this, u, F(devicePixelRatio, 1, 2)), a(this, m, e.contentRect.width), a(this, l, e.contentRect.height), t(this, r).width = t(this, m) * this.pixelRatio, t(this, r).height = t(this, l) * this.pixelRatio, this.context.scale(this.pixelRatio, this.pixelRatio), c(this, n, k).call(this), c(this, n, E).call(this);
|
|
27
|
+
});
|
|
28
|
+
h(this, v, (e) => {
|
|
29
|
+
a(this, b, e.timestamp), a(this, f, e.timeBetweenFrames), c(this, n, E).call(this);
|
|
30
|
+
});
|
|
31
|
+
if (z) {
|
|
32
|
+
const e = this.attachShadow({ mode: "open" });
|
|
33
|
+
e.adoptedStyleSheets.push(
|
|
34
|
+
B({
|
|
35
|
+
" :host, canvas": {
|
|
36
|
+
display: "block",
|
|
37
|
+
width: "100%",
|
|
38
|
+
height: "100%"
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
), a(this, r, document.createElement("canvas")), a(this, d, t(this, r).getContext("2d")), e.appendChild(t(this, r)), t(this, o).subscribe((p) => {
|
|
42
|
+
typeof p.previous != "undefined" && p.current !== p.previous && c(this, n, R).call(this);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
get fpsCSSProperty() {
|
|
47
|
+
return t(this, o);
|
|
48
|
+
}
|
|
49
|
+
get canvasElement() {
|
|
50
|
+
return t(this, r);
|
|
51
|
+
}
|
|
52
|
+
get context() {
|
|
53
|
+
return t(this, d);
|
|
54
|
+
}
|
|
55
|
+
get pixelRatio() {
|
|
56
|
+
return t(this, u);
|
|
57
|
+
}
|
|
58
|
+
get width() {
|
|
59
|
+
return t(this, m);
|
|
60
|
+
}
|
|
61
|
+
get height() {
|
|
62
|
+
return t(this, l);
|
|
63
|
+
}
|
|
64
|
+
get detail() {
|
|
65
|
+
return {
|
|
66
|
+
width: t(this, m),
|
|
67
|
+
height: t(this, l),
|
|
68
|
+
element: this,
|
|
69
|
+
canvasElement: t(this, r),
|
|
70
|
+
pixelRatio: t(this, u),
|
|
71
|
+
context: t(this, d),
|
|
72
|
+
timestamp: t(this, b),
|
|
73
|
+
timeBetweenFrames: t(this, f)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
connectedCallback() {
|
|
77
|
+
t(this, o).observe(), C.subscribe(this, t(this, g)), c(this, n, R).call(this);
|
|
78
|
+
}
|
|
79
|
+
disconnectedCallback() {
|
|
80
|
+
t(this, o).unobserve(), C.unsubscribe(t(this, g)), c(this, n, y).call(this);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
o = new WeakMap(), r = new WeakMap(), d = new WeakMap(), m = new WeakMap(), l = new WeakMap(), u = new WeakMap(), b = new WeakMap(), f = new WeakMap(), n = new WeakSet(), R = function() {
|
|
84
|
+
w.unsubscribe(t(this, v)), this.hasAttribute("static") || w.subscribe(t(this, v), {
|
|
85
|
+
culling: this,
|
|
86
|
+
maxFPS: t(this, o).current
|
|
87
|
+
});
|
|
88
|
+
}, y = function() {
|
|
89
|
+
w.unsubscribe(t(this, v));
|
|
90
|
+
}, g = new WeakMap(), v = new WeakMap(), E = function() {
|
|
91
|
+
this.dispatchEvent(
|
|
92
|
+
new CustomEvent("canvasRender", {
|
|
93
|
+
composed: !0,
|
|
94
|
+
detail: this.detail
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
}, k = function() {
|
|
98
|
+
this.dispatchEvent(
|
|
99
|
+
new CustomEvent("canvasResize", {
|
|
100
|
+
composed: !0,
|
|
101
|
+
detail: this.detail
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
customElements.get("e-canvas") || customElements.define("e-canvas", L);
|
|
106
|
+
export {
|
|
107
|
+
L as CanvasElement
|
|
108
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var X=r=>{throw TypeError(r)};var F=(r,s,t)=>s.has(r)||X("Cannot "+t);var e=(r,s,t)=>(F(r,s,"read from private field"),t?t.call(r):s.get(r)),i=(r,s,t)=>s.has(r)?X("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(r):s.set(r,t),a=(r,s,t,n)=>(F(r,s,"write to private field"),n?n.call(r,t):s.set(r,t),t),$=(r,s,t)=>(F(r,s,"access private method"),t);var Y=(r,s,t)=>new Promise((n,l)=>{var y=d=>{try{g(t.next(d))}catch(c){l(c)}},H=d=>{try{g(t.throw(d))}catch(c){l(c)}},g=d=>d.done?n(d.value):Promise.resolve(d.value).then(y,H);g((t=t.apply(r,s)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("../device/index.cjs"),re=require("../source/index.cjs"),ne=require("../class-linked-status/index.cjs"),Q=require("../browser-CpzFX2xg.cjs"),K=require("../events-KVanG9sR.cjs"),oe=require("../string-DhgS_iFl.cjs"),U=require("../loading/index.cjs"),B=require("../css-property/index.cjs"),G=require("../element-resizer/vanilla/index.cjs"),J=require("../canvas-CU5Xjahf.cjs"),ae=require("../canvas/index.cjs"),D=require("../ticker/vanilla/index.cjs");let ce=0;var u,o,p,q,m,_,C,h,I,P,O,W,z,V;class j extends HTMLElement{constructor(){super();i(this,P);i(this,u,null);i(this,o,null);i(this,p,!1);i(this,q,!1);i(this,m,!1);i(this,_,"");i(this,C,"");i(this,h,new ne.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1}));i(this,I,null);i(this,W,t=>{const n=t[0];e(this,m)&&(!e(this,q)||this.hasAttribute("reload-source"))&&n.isIntersecting&&(e(this,u).current&&e(this,u).current!==e(this,u).previous&&$(this,P,O).call(this,e(this,u).current),a(this,q,!0)),n.isIntersecting?K.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&$(this,P,O).call(this,void 0),K.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,z,()=>{e(this,h).set("loaded",!0),e(this,h).set("error",!1),e(this,h).set("loading",!1),!e(this,m)&&!e(this,p)&&U.loading.complete(e(this,C)),a(this,p,!0)});i(this,V,t=>{e(this,h).set("loaded",!1),e(this,h).set("error",!0),e(this,h).set("loading",!1),!e(this,m)&&!e(this,p)&&U.loading.error(e(this,C)),a(this,p,!0)});Q.isBrowser&&window.IntersectionObserver&&(a(this,_,`source-consumer-${++ce}`),a(this,I,new IntersectionObserver(e(this,W))))}get consumerElement(){return e(this,o)}get sourceManager(){return e(this,u)}get status(){return e(this,h)}get isLazy(){return e(this,m)}connectedCallback(){const t=this.getAttribute("srcset");t&&(a(this,o,this.createConsumer()),e(this,o).style.cssText=`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
|
-
`,e(this,
|
|
5
|
+
`,e(this,o).classList.add("source-consumer"),Array.from(this.attributes).forEach(n=>{if(n.name!=="srcset"){const l=n.nodeValue||"",y=oe.kebabToCamel(n.name);y in e(this,o)&&(e(this,o)[y]=l||!0)}}),this.appendChild(e(this,o)),a(this,u,new re.SourceManager({srcset:t})),a(this,m,this.hasAttribute("lazy")),e(this,u).subscribe(n=>{(!e(this,m)||e(this,m)&&e(this,q))&&$(this,P,O).call(this,n.current)}),e(this,I).observe(this),e(this,u).connect())}disconnectedCallback(){e(this,I).disconnect(),e(this,u).close(),e(this,o).onloadeddata=null,e(this,o).onload=null,e(this,o).onerror=null,e(this,o).remove(),e(this,h).reset()}}u=new WeakMap,o=new WeakMap,p=new WeakMap,q=new WeakMap,m=new WeakMap,_=new WeakMap,C=new WeakMap,h=new WeakMap,I=new WeakMap,P=new WeakSet,O=function(t){if(e(this,o).onloadeddata=null,e(this,o).onload=null,e(this,o).onerror=null,e(this,h).set("loaded",!1),e(this,h).set("error",!1),e(this,h).set("loading",!1),t){a(this,C,`${e(this,_)}-${t.url}`);const n=this.hasAttribute("keep-source-parameters");e(this,h).set("loading",!0);const l=n?t.url:t.name+t.extension;this.consumeSource(l),!e(this,m)&&!e(this,p)&&U.loading.add(e(this,C)),e(this,o).onloadeddata=()=>{e(this,z).call(this)},e(this,o).onload=()=>{e(this,z).call(this)},e(this,o).onerror=()=>{e(this,V).call(this,l)}}else this.consumeSource(null)},W=new WeakMap,z=new WeakMap,V=new WeakMap;class Z extends j{createConsumer(){return document.createElement("img")}consumeSource(s){if(s&&this.hasAttribute("webp")&&ie.device.isWebp){const t=s.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=t}else this.consumerElement.src=s||""}}customElements.get("e-image")||customElements.define("e-image",Z);function he(r){const s=r.match(/\{([\d-]+)\}/);if(s){const t=s[1].split("-");if(t.length===2){const n=parseInt(t[0],10),l=parseInt(t[1],10);return{start:n,end:l}}}return null}var f,w,R,E,v,L,k,M,b,S;class ee extends j{constructor(t){super();i(this,f,[]);i(this,w,new B.CSSProperty(this,"--fit","contain"));i(this,R,new B.CSSProperty(this,"--autoplay",!1));i(this,E,new B.CSSProperty(this,"--offset-x",.5));i(this,v,new B.CSSProperty(this,"--offset-y",.5));i(this,L,null);i(this,k,0);i(this,M,1);i(this,b,()=>{if(e(this,f).length){const t=e(this,f)[0];e(this,w).current==="cover"?a(this,L,J.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,E).current,e(this,v).current)):a(this,L,J.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,E).current,e(this,v).current))}});i(this,S,t=>{if(this.status.isFalse("loaded")||!e(this,L))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const n=e(this,f)[e(this,k)];n&&t.detail.context.drawImage(n,...e(this,L)),e(this,R).current&&a(this,k,(e(this,k)+1)%e(this,f).length)});Q.isBrowser&&(a(this,M,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,w).subscribe(e(this,b)),e(this,E).subscribe(e(this,b)),e(this,v).subscribe(e(this,b)),this.addEventListener("sourceCapture",n=>{this.consumerElement.addEventListener("canvasRender",e(this,S))}),this.addEventListener("sourceRelease",n=>{this.consumerElement.removeEventListener("canvasRender",e(this,S))}))}setProgress(t){e(this,f).length&&a(this,k,Math.floor((e(this,f).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,R).observe(),e(this,w).observe(),e(this,E).observe(),e(this,v).observe(),G.elementResizer.subscribe(this,e(this,b))}disconnectedCallback(){super.disconnectedCallback(),e(this,R).unobserve(),e(this,w).unobserve(),e(this,E).unobserve(),e(this,v).unobserve(),a(this,f,[]),G.elementResizer.unsubscribe(e(this,b)),this.consumerElement.removeEventListener("canvasRender",e(this,S))}createConsumer(){return new ae.CanvasElement}consumeSource(t){return Y(this,null,function*(){var n,l,y,H;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,S));const g=[],d=he(t);if(d)for(let c=d.start;c<=d.end;c++){const N=t.replace(/\{([^}]+)\}/,c.toString().padStart(e(this,M),"0")),T=new Image;T.src=N,g.push(T)}else{const c=new Image;c.src=t,g.push(c)}try{yield Promise.all(g.map((c,N)=>new Promise((T,se)=>{c.onload=()=>{T()},c.onerror=le=>{se(`${c.src} Image not found`)}}))),a(this,f,g),e(this,b).call(this),(l=(n=this.consumerElement).onload)==null||l.call(n,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,S))}catch(c){console.error(c),(H=(y=this.consumerElement).onerror)==null||H.call(y,new Event("error"))}}})}}f=new WeakMap,w=new WeakMap,R=new WeakMap,E=new WeakMap,v=new WeakMap,L=new WeakMap,k=new WeakMap,M=new WeakMap,b=new WeakMap,S=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",ee);var x,A;class te extends j{constructor(){super(...arguments);i(this,x,0);i(this,A,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,x)&&a(this,x,t),K.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,x)}}),this.consumerElement.readyState===4&&D.ticker.unsubscribe(e(this,A))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{D.ticker.subscribe(e(this,A)),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(),D.ticker.unsubscribe(e(this,A)),a(this,x,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||""}}x=new WeakMap,A=new WeakMap;customElements.get("e-video")||customElements.define("e-video",te);exports.ImageElement=Z;exports.SequenceElement=ee;exports.SourceElement=j;exports.VideoElement=te;
|
|
@@ -1,72 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var Y = (r) => {
|
|
2
|
+
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (
|
|
6
|
-
var
|
|
7
|
-
var
|
|
4
|
+
var V = (r, s, t) => s.has(r) || Y("Cannot " + t);
|
|
5
|
+
var e = (r, s, t) => (V(r, s, "read from private field"), t ? t.call(r) : s.get(r)), i = (r, s, t) => s.has(r) ? Y("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), a = (r, s, t, n) => (V(r, s, "write to private field"), n ? n.call(r, t) : s.set(r, t), t), q = (r, s, t) => (V(r, s, "access private method"), t);
|
|
6
|
+
var G = (r, s, t) => new Promise((n, l) => {
|
|
7
|
+
var S = (m) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
l(
|
|
9
|
+
b(t.next(m));
|
|
10
|
+
} catch (h) {
|
|
11
|
+
l(h);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, T = (m) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
l(
|
|
15
|
+
b(t.throw(m));
|
|
16
|
+
} catch (h) {
|
|
17
|
+
l(h);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, b = (m) => m.done ? n(m.value) : Promise.resolve(m.value).then(S, T);
|
|
20
|
+
b((t = t.apply(r, s)).next());
|
|
21
21
|
});
|
|
22
|
-
import { device as
|
|
23
|
-
import { SourceManager as
|
|
24
|
-
import { ClassLinkedStatus as
|
|
25
|
-
import { i as
|
|
26
|
-
import { d as
|
|
27
|
-
import { k as
|
|
28
|
-
import { loading as
|
|
29
|
-
import { CSSProperty as
|
|
30
|
-
import { elementResizer as
|
|
31
|
-
import { c as
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class ae extends HTMLElement {
|
|
22
|
+
import { device as _ } from "../device/index.js";
|
|
23
|
+
import { SourceManager as ee } from "../source/index.js";
|
|
24
|
+
import { ClassLinkedStatus as te } from "../class-linked-status/index.js";
|
|
25
|
+
import { i as Q } from "../browser-0zX67oeU.js";
|
|
26
|
+
import { d as K } from "../events-CsVF98U6.js";
|
|
27
|
+
import { k as se } from "../string-f0Dnk0L1.js";
|
|
28
|
+
import { loading as j } from "../loading/index.js";
|
|
29
|
+
import { CSSProperty as B } from "../css-property/index.js";
|
|
30
|
+
import { elementResizer as J } from "../element-resizer/vanilla/index.js";
|
|
31
|
+
import { c as ie, a as re } from "../canvas-DeZ0SLUJ.js";
|
|
32
|
+
import { CanvasElement as ne } from "../canvas/index.js";
|
|
33
|
+
import { ticker as D } from "../ticker/vanilla/index.js";
|
|
34
|
+
let oe = 0;
|
|
35
|
+
var u, o, g, x, d, H, C, c, A, R, O, F, M, U;
|
|
36
|
+
class N extends HTMLElement {
|
|
38
37
|
constructor() {
|
|
39
38
|
super();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
i(this, R);
|
|
40
|
+
i(this, u, null);
|
|
41
|
+
i(this, o, null);
|
|
42
|
+
i(this, g, !1);
|
|
43
|
+
i(this, x, !1);
|
|
44
|
+
i(this, d, !1);
|
|
45
|
+
i(this, H, "");
|
|
46
|
+
i(this, C, "");
|
|
47
|
+
i(this, c, new te(this, {
|
|
49
48
|
loading: !1,
|
|
50
49
|
loaded: !1,
|
|
51
50
|
error: !1
|
|
52
51
|
}));
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
e(this,
|
|
52
|
+
i(this, A, null);
|
|
53
|
+
i(this, F, (t) => {
|
|
54
|
+
const n = t[0];
|
|
55
|
+
e(this, d) && (!e(this, x) || this.hasAttribute("reload-source")) && n.isIntersecting && (e(this, u).current && e(this, u).current !== e(this, u).previous && q(this, R, O).call(this, e(this, u).current), a(this, x, !0)), n.isIntersecting ? K(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && q(this, R, O).call(this, void 0), K(this, "sourceRelease", { custom: !0 }));
|
|
57
56
|
});
|
|
58
|
-
|
|
59
|
-
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this,
|
|
57
|
+
i(this, M, () => {
|
|
58
|
+
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, d) && !e(this, g) && j.complete(e(this, C)), a(this, g, !0);
|
|
60
59
|
});
|
|
61
|
-
|
|
62
|
-
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this,
|
|
60
|
+
i(this, U, (t) => {
|
|
61
|
+
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, d) && !e(this, g) && j.error(e(this, C)), a(this, g, !0);
|
|
63
62
|
});
|
|
64
|
-
|
|
65
|
-
e(this,
|
|
63
|
+
Q && window.IntersectionObserver && (a(this, H, `source-consumer-${++oe}`), a(this, A, new IntersectionObserver(
|
|
64
|
+
e(this, F)
|
|
66
65
|
)));
|
|
67
66
|
}
|
|
68
67
|
get consumerElement() {
|
|
69
|
-
return e(this,
|
|
68
|
+
return e(this, o);
|
|
70
69
|
}
|
|
71
70
|
get sourceManager() {
|
|
72
71
|
return e(this, u);
|
|
@@ -75,297 +74,203 @@ class ae extends HTMLElement {
|
|
|
75
74
|
return e(this, c);
|
|
76
75
|
}
|
|
77
76
|
get isLazy() {
|
|
78
|
-
return e(this,
|
|
77
|
+
return e(this, d);
|
|
79
78
|
}
|
|
80
79
|
connectedCallback() {
|
|
81
80
|
const t = this.getAttribute("srcset");
|
|
82
|
-
t && (
|
|
81
|
+
t && (a(this, o, this.createConsumer()), e(this, o).style.cssText = `
|
|
83
82
|
display: block;
|
|
84
83
|
width: 100%;
|
|
85
84
|
height: 100%;
|
|
86
|
-
`, e(this,
|
|
87
|
-
if (
|
|
88
|
-
const l =
|
|
89
|
-
|
|
85
|
+
`, e(this, o).classList.add("source-consumer"), Array.from(this.attributes).forEach((n) => {
|
|
86
|
+
if (n.name !== "srcset") {
|
|
87
|
+
const l = n.nodeValue || "", S = se(n.name);
|
|
88
|
+
S in e(this, o) && (e(this, o)[S] = l || !0);
|
|
90
89
|
}
|
|
91
|
-
}), this.appendChild(e(this,
|
|
90
|
+
}), this.appendChild(e(this, o)), a(this, u, new ee({
|
|
92
91
|
srcset: t
|
|
93
|
-
})),
|
|
94
|
-
(!e(this,
|
|
95
|
-
}), e(this,
|
|
92
|
+
})), a(this, d, this.hasAttribute("lazy")), e(this, u).subscribe((n) => {
|
|
93
|
+
(!e(this, d) || e(this, d) && e(this, x)) && q(this, R, O).call(this, n.current);
|
|
94
|
+
}), e(this, A).observe(this), e(this, u).connect());
|
|
96
95
|
}
|
|
97
96
|
disconnectedCallback() {
|
|
98
|
-
e(this,
|
|
97
|
+
e(this, A).disconnect(), e(this, u).close(), e(this, o).onloadeddata = null, e(this, o).onload = null, e(this, o).onerror = null, e(this, o).remove(), e(this, c).reset();
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
|
-
u = new WeakMap(),
|
|
102
|
-
if (e(this,
|
|
103
|
-
|
|
104
|
-
const
|
|
100
|
+
u = new WeakMap(), o = new WeakMap(), g = new WeakMap(), x = new WeakMap(), d = new WeakMap(), H = new WeakMap(), C = new WeakMap(), c = new WeakMap(), A = new WeakMap(), R = new WeakSet(), O = function(t) {
|
|
101
|
+
if (e(this, o).onloadeddata = null, e(this, o).onload = null, e(this, o).onerror = null, e(this, c).set("loaded", !1), e(this, c).set("error", !1), e(this, c).set("loading", !1), t) {
|
|
102
|
+
a(this, C, `${e(this, H)}-${t.url}`);
|
|
103
|
+
const n = this.hasAttribute("keep-source-parameters");
|
|
105
104
|
e(this, c).set("loading", !0);
|
|
106
|
-
const l =
|
|
107
|
-
this.consumeSource(l), !e(this,
|
|
108
|
-
e(this,
|
|
109
|
-
}, e(this,
|
|
110
|
-
e(this,
|
|
111
|
-
}, e(this,
|
|
112
|
-
e(this,
|
|
105
|
+
const l = n ? t.url : t.name + t.extension;
|
|
106
|
+
this.consumeSource(l), !e(this, d) && !e(this, g) && j.add(e(this, C)), e(this, o).onloadeddata = () => {
|
|
107
|
+
e(this, M).call(this);
|
|
108
|
+
}, e(this, o).onload = () => {
|
|
109
|
+
e(this, M).call(this);
|
|
110
|
+
}, e(this, o).onerror = () => {
|
|
111
|
+
e(this, U).call(this, l);
|
|
113
112
|
};
|
|
114
113
|
} else
|
|
115
114
|
this.consumeSource(null);
|
|
116
|
-
},
|
|
117
|
-
class
|
|
115
|
+
}, F = new WeakMap(), M = new WeakMap(), U = new WeakMap();
|
|
116
|
+
class ae extends N {
|
|
118
117
|
createConsumer() {
|
|
119
118
|
return document.createElement("img");
|
|
120
119
|
}
|
|
121
|
-
consumeSource(
|
|
122
|
-
if (
|
|
123
|
-
const t =
|
|
120
|
+
consumeSource(s) {
|
|
121
|
+
if (s && this.hasAttribute("webp") && _.isWebp) {
|
|
122
|
+
const t = s.split(".").slice(0, -1).join(".") + ".webp";
|
|
124
123
|
this.consumerElement.src = t;
|
|
125
124
|
} else
|
|
126
|
-
this.consumerElement.src =
|
|
125
|
+
this.consumerElement.src = s || "";
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
|
-
customElements.get("e-image") || customElements.define("e-image",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
s(this, d);
|
|
135
|
-
s(this, S, new V(this, "--fps", 0));
|
|
136
|
-
s(this, g, null);
|
|
137
|
-
s(this, $, null);
|
|
138
|
-
s(this, k, 0);
|
|
139
|
-
s(this, I, 0);
|
|
140
|
-
s(this, W, 1);
|
|
141
|
-
s(this, K, 0);
|
|
142
|
-
s(this, N, 1);
|
|
143
|
-
s(this, X, (t) => {
|
|
144
|
-
h(this, W, Ce(devicePixelRatio, 1, 2)), h(this, k, t.contentRect.width), h(this, I, t.contentRect.height), e(this, g).width = e(this, k) * this.pixelRatio, e(this, g).height = e(this, I) * this.pixelRatio, this.context.scale(this.pixelRatio, this.pixelRatio), b(this, d, me).call(this), b(this, d, ne).call(this);
|
|
145
|
-
});
|
|
146
|
-
s(this, q, (t) => {
|
|
147
|
-
h(this, K, t.timestamp), h(this, N, t.timeBetweenFrames), b(this, d, ne).call(this);
|
|
148
|
-
});
|
|
149
|
-
if (he) {
|
|
150
|
-
const t = this.attachShadow({ mode: "open" });
|
|
151
|
-
t.adoptedStyleSheets.push(
|
|
152
|
-
Se({
|
|
153
|
-
" :host, canvas": {
|
|
154
|
-
display: "block",
|
|
155
|
-
width: "100%",
|
|
156
|
-
height: "100%"
|
|
157
|
-
}
|
|
158
|
-
})
|
|
159
|
-
), h(this, g, document.createElement("canvas")), h(this, $, e(this, g).getContext("2d")), t.appendChild(e(this, g)), e(this, S).subscribe((i) => {
|
|
160
|
-
typeof i.previous != "undefined" && i.current !== i.previous && b(this, d, re).call(this);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
get fpsCSSProperty() {
|
|
165
|
-
return e(this, S);
|
|
166
|
-
}
|
|
167
|
-
get canvasElement() {
|
|
168
|
-
return e(this, g);
|
|
169
|
-
}
|
|
170
|
-
get context() {
|
|
171
|
-
return e(this, $);
|
|
172
|
-
}
|
|
173
|
-
get pixelRatio() {
|
|
174
|
-
return e(this, W);
|
|
175
|
-
}
|
|
176
|
-
get width() {
|
|
177
|
-
return e(this, k);
|
|
178
|
-
}
|
|
179
|
-
get height() {
|
|
180
|
-
return e(this, I);
|
|
181
|
-
}
|
|
182
|
-
get detail() {
|
|
183
|
-
return {
|
|
184
|
-
width: e(this, k),
|
|
185
|
-
height: e(this, I),
|
|
186
|
-
element: this,
|
|
187
|
-
canvasElement: e(this, g),
|
|
188
|
-
pixelRatio: e(this, W),
|
|
189
|
-
context: e(this, $),
|
|
190
|
-
timestamp: e(this, K),
|
|
191
|
-
timeBetweenFrames: e(this, N)
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
connectedCallback() {
|
|
195
|
-
e(this, S).observe(), Z.subscribe(this, e(this, X)), b(this, d, re).call(this);
|
|
196
|
-
}
|
|
197
|
-
disconnectedCallback() {
|
|
198
|
-
e(this, S).unobserve(), Z.unsubscribe(e(this, X)), b(this, d, de).call(this);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
S = new WeakMap(), g = new WeakMap(), $ = new WeakMap(), k = new WeakMap(), I = new WeakMap(), W = new WeakMap(), K = new WeakMap(), N = new WeakMap(), d = new WeakSet(), re = function() {
|
|
202
|
-
F.unsubscribe(e(this, q)), this.hasAttribute("static") || F.subscribe(e(this, q), {
|
|
203
|
-
culling: this,
|
|
204
|
-
maxFPS: e(this, S).current
|
|
205
|
-
});
|
|
206
|
-
}, de = function() {
|
|
207
|
-
F.unsubscribe(e(this, q));
|
|
208
|
-
}, X = new WeakMap(), q = new WeakMap(), ne = function() {
|
|
209
|
-
this.dispatchEvent(
|
|
210
|
-
new CustomEvent("canvasRender", {
|
|
211
|
-
composed: !0,
|
|
212
|
-
detail: this.detail
|
|
213
|
-
})
|
|
214
|
-
);
|
|
215
|
-
}, me = function() {
|
|
216
|
-
this.dispatchEvent(
|
|
217
|
-
new CustomEvent("canvasResize", {
|
|
218
|
-
composed: !0,
|
|
219
|
-
detail: this.detail
|
|
220
|
-
})
|
|
221
|
-
);
|
|
222
|
-
};
|
|
223
|
-
customElements.get("e-canvas") || customElements.define("e-canvas", ue);
|
|
224
|
-
function Le(n) {
|
|
225
|
-
const r = n.match(/\{([\d-]+)\}/);
|
|
226
|
-
if (r) {
|
|
227
|
-
const t = r[1].split("-");
|
|
128
|
+
customElements.get("e-image") || customElements.define("e-image", ae);
|
|
129
|
+
function he(r) {
|
|
130
|
+
const s = r.match(/\{([\d-]+)\}/);
|
|
131
|
+
if (s) {
|
|
132
|
+
const t = s[1].split("-");
|
|
228
133
|
if (t.length === 2) {
|
|
229
|
-
const
|
|
230
|
-
return { start:
|
|
134
|
+
const n = parseInt(t[0], 10), l = parseInt(t[1], 10);
|
|
135
|
+
return { start: n, end: l };
|
|
231
136
|
}
|
|
232
137
|
}
|
|
233
138
|
return null;
|
|
234
139
|
}
|
|
235
|
-
var f,
|
|
236
|
-
class
|
|
140
|
+
var f, w, P, E, v, L, k, $, p, y;
|
|
141
|
+
class ce extends N {
|
|
237
142
|
constructor(t) {
|
|
238
143
|
super();
|
|
239
|
-
|
|
240
|
-
|
|
144
|
+
i(this, f, []);
|
|
145
|
+
i(this, w, new B(
|
|
241
146
|
this,
|
|
242
147
|
"--fit",
|
|
243
148
|
"contain"
|
|
244
149
|
));
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
150
|
+
i(this, P, new B(this, "--autoplay", !1));
|
|
151
|
+
i(this, E, new B(this, "--offset-x", 0.5));
|
|
152
|
+
i(this, v, new B(this, "--offset-y", 0.5));
|
|
153
|
+
i(this, L, null);
|
|
154
|
+
i(this, k, 0);
|
|
155
|
+
i(this, $, 1);
|
|
156
|
+
i(this, p, () => {
|
|
252
157
|
if (e(this, f).length) {
|
|
253
158
|
const t = e(this, f)[0];
|
|
254
|
-
e(this,
|
|
159
|
+
e(this, w).current === "cover" ? a(this, L, ie(
|
|
255
160
|
t.naturalWidth,
|
|
256
161
|
t.naturalHeight,
|
|
257
162
|
this.consumerElement.width,
|
|
258
163
|
this.consumerElement.height,
|
|
259
|
-
e(this,
|
|
260
|
-
e(this,
|
|
261
|
-
)) :
|
|
164
|
+
e(this, E).current,
|
|
165
|
+
e(this, v).current
|
|
166
|
+
)) : a(this, L, re(
|
|
262
167
|
t.naturalWidth,
|
|
263
168
|
t.naturalHeight,
|
|
264
169
|
this.consumerElement.width,
|
|
265
170
|
this.consumerElement.height,
|
|
266
|
-
e(this,
|
|
267
|
-
e(this,
|
|
171
|
+
e(this, E).current,
|
|
172
|
+
e(this, v).current
|
|
268
173
|
));
|
|
269
174
|
}
|
|
270
175
|
});
|
|
271
|
-
|
|
272
|
-
if (this.status.isFalse("loaded") || !e(this,
|
|
176
|
+
i(this, y, (t) => {
|
|
177
|
+
if (this.status.isFalse("loaded") || !e(this, L))
|
|
273
178
|
return;
|
|
274
179
|
t.detail.context.clearRect(0, 0, t.detail.width, t.detail.height);
|
|
275
|
-
const
|
|
276
|
-
|
|
180
|
+
const n = e(this, f)[e(this, k)];
|
|
181
|
+
n && t.detail.context.drawImage(n, ...e(this, L)), e(this, P).current && a(this, k, (e(this, k) + 1) % e(this, f).length);
|
|
277
182
|
});
|
|
278
|
-
|
|
183
|
+
Q && (a(this, $, parseInt(
|
|
279
184
|
((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
|
|
280
|
-
)), e(this,
|
|
185
|
+
)), e(this, w).subscribe(e(this, p)), e(this, E).subscribe(e(this, p)), e(this, v).subscribe(e(this, p)), this.addEventListener("sourceCapture", (n) => {
|
|
281
186
|
this.consumerElement.addEventListener(
|
|
282
187
|
"canvasRender",
|
|
283
|
-
e(this,
|
|
188
|
+
e(this, y)
|
|
284
189
|
);
|
|
285
|
-
}), this.addEventListener("sourceRelease", (
|
|
190
|
+
}), this.addEventListener("sourceRelease", (n) => {
|
|
286
191
|
this.consumerElement.removeEventListener(
|
|
287
192
|
"canvasRender",
|
|
288
|
-
e(this,
|
|
193
|
+
e(this, y)
|
|
289
194
|
);
|
|
290
195
|
}));
|
|
291
196
|
}
|
|
292
197
|
setProgress(t) {
|
|
293
|
-
e(this, f).length &&
|
|
198
|
+
e(this, f).length && a(this, k, Math.floor((e(this, f).length - 1) * t));
|
|
294
199
|
}
|
|
295
200
|
connectedCallback() {
|
|
296
|
-
super.connectedCallback(), e(this,
|
|
201
|
+
super.connectedCallback(), e(this, P).observe(), e(this, w).observe(), e(this, E).observe(), e(this, v).observe(), J.subscribe(this, e(this, p));
|
|
297
202
|
}
|
|
298
203
|
disconnectedCallback() {
|
|
299
|
-
super.disconnectedCallback(), e(this,
|
|
204
|
+
super.disconnectedCallback(), e(this, P).unobserve(), e(this, w).unobserve(), e(this, E).unobserve(), e(this, v).unobserve(), a(this, f, []), J.unsubscribe(e(this, p)), this.consumerElement.removeEventListener(
|
|
300
205
|
"canvasRender",
|
|
301
|
-
e(this,
|
|
206
|
+
e(this, y)
|
|
302
207
|
);
|
|
303
208
|
}
|
|
304
209
|
createConsumer() {
|
|
305
|
-
return new
|
|
210
|
+
return new ne();
|
|
306
211
|
}
|
|
307
212
|
consumeSource(t) {
|
|
308
|
-
return
|
|
309
|
-
var
|
|
213
|
+
return G(this, null, function* () {
|
|
214
|
+
var n, l, S, T;
|
|
310
215
|
if (t) {
|
|
311
216
|
this.consumerElement.removeEventListener(
|
|
312
217
|
"canvasRender",
|
|
313
|
-
e(this,
|
|
218
|
+
e(this, y)
|
|
314
219
|
);
|
|
315
|
-
const
|
|
220
|
+
const b = [], m = he(t);
|
|
316
221
|
if (m)
|
|
317
|
-
for (let
|
|
318
|
-
const
|
|
222
|
+
for (let h = m.start; h <= m.end; h++) {
|
|
223
|
+
const X = t.replace(
|
|
319
224
|
/\{([^}]+)\}/,
|
|
320
|
-
|
|
321
|
-
),
|
|
322
|
-
|
|
225
|
+
h.toString().padStart(e(this, $), "0")
|
|
226
|
+
), W = new Image();
|
|
227
|
+
W.src = X, b.push(W);
|
|
323
228
|
}
|
|
324
229
|
else {
|
|
325
|
-
const
|
|
326
|
-
|
|
230
|
+
const h = new Image();
|
|
231
|
+
h.src = t, b.push(h);
|
|
327
232
|
}
|
|
328
233
|
try {
|
|
329
234
|
yield Promise.all(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
},
|
|
334
|
-
|
|
235
|
+
b.map((h, X) => new Promise((W, Z) => {
|
|
236
|
+
h.onload = () => {
|
|
237
|
+
W();
|
|
238
|
+
}, h.onerror = (ue) => {
|
|
239
|
+
Z(`${h.src} Image not found`);
|
|
335
240
|
};
|
|
336
241
|
}))
|
|
337
|
-
),
|
|
242
|
+
), a(this, f, b), e(this, p).call(this), (l = (n = this.consumerElement).onload) == null || l.call(n, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
|
|
338
243
|
"canvasRender",
|
|
339
|
-
e(this,
|
|
244
|
+
e(this, y)
|
|
340
245
|
);
|
|
341
|
-
} catch (
|
|
342
|
-
console.error(
|
|
246
|
+
} catch (h) {
|
|
247
|
+
console.error(h), (T = (S = this.consumerElement).onerror) == null || T.call(S, new Event("error"));
|
|
343
248
|
}
|
|
344
249
|
}
|
|
345
250
|
});
|
|
346
251
|
}
|
|
347
252
|
}
|
|
348
|
-
f = new WeakMap(),
|
|
349
|
-
customElements.get("e-sequence") || customElements.define("e-sequence",
|
|
350
|
-
var
|
|
351
|
-
class
|
|
253
|
+
f = new WeakMap(), w = new WeakMap(), P = new WeakMap(), E = new WeakMap(), v = new WeakMap(), L = new WeakMap(), k = new WeakMap(), $ = new WeakMap(), p = new WeakMap(), y = new WeakMap();
|
|
254
|
+
customElements.get("e-sequence") || customElements.define("e-sequence", ce);
|
|
255
|
+
var I, z;
|
|
256
|
+
class le extends N {
|
|
352
257
|
constructor() {
|
|
353
258
|
super(...arguments);
|
|
354
|
-
|
|
355
|
-
|
|
259
|
+
i(this, I, 0);
|
|
260
|
+
i(this, z, () => {
|
|
356
261
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
357
262
|
const t = this.consumerElement.readyState / 4;
|
|
358
|
-
t > e(this,
|
|
263
|
+
t > e(this, I) && a(this, I, t), K(this, "videoReadyStateChange", {
|
|
359
264
|
detail: {
|
|
360
265
|
readyState: this.consumerElement.readyState,
|
|
361
|
-
progress: e(this,
|
|
266
|
+
progress: e(this, I)
|
|
362
267
|
}
|
|
363
|
-
}), this.consumerElement.readyState === 4 &&
|
|
268
|
+
}), this.consumerElement.readyState === 4 && D.unsubscribe(e(this, z));
|
|
364
269
|
});
|
|
365
270
|
}
|
|
366
271
|
connectedCallback() {
|
|
367
272
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
368
|
-
|
|
273
|
+
D.subscribe(e(this, z)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
|
|
369
274
|
}), this.addEventListener("sourceRelease", () => {
|
|
370
275
|
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
|
|
371
276
|
"state-0",
|
|
@@ -377,7 +282,7 @@ class ke extends ae {
|
|
|
377
282
|
});
|
|
378
283
|
}
|
|
379
284
|
disconnectedCallback() {
|
|
380
|
-
super.disconnectedCallback(),
|
|
285
|
+
super.disconnectedCallback(), D.unsubscribe(e(this, z)), a(this, I, 0);
|
|
381
286
|
}
|
|
382
287
|
createConsumer() {
|
|
383
288
|
return document.createElement("video");
|
|
@@ -386,11 +291,11 @@ class ke extends ae {
|
|
|
386
291
|
this.consumerElement.src = t || "";
|
|
387
292
|
}
|
|
388
293
|
}
|
|
389
|
-
|
|
390
|
-
customElements.get("e-video") || customElements.define("e-video",
|
|
294
|
+
I = new WeakMap(), z = new WeakMap();
|
|
295
|
+
customElements.get("e-video") || customElements.define("e-video", le);
|
|
391
296
|
export {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
297
|
+
ae as ImageElement,
|
|
298
|
+
ce as SequenceElement,
|
|
299
|
+
N as SourceElement,
|
|
300
|
+
le as VideoElement
|
|
396
301
|
};
|
package/lib/slicer/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var T=i=>{throw TypeError(i)};var E=(i,t,s)=>t.has(i)||T("Cannot "+s);var e=(i,t,s)=>(E(i,t,"read from private field"),s?s.call(i):t.get(i)),l=(i,t,s)=>t.has(i)?T("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),r=(i,t,s,n)=>(E(i,t,"write to private field"),n?n.call(i,s):t.set(i,s),s),m=(i,t,s)=>(E(i,t,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../media/index.cjs");var y,o;class w{constructor(t){l(this,y);l(this,o);r(this,y,t.index),r(this,o,document.createElement("span")),e(this,o).classList.add("letter"),t.clone?e(this,o).innerHTML=`
|
|
2
2
|
<span class="original">${t.text}</span>
|
|
3
3
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
4
4
|
`:e(this,o).innerHTML=`
|
|
5
5
|
<span class="value">${t.text}</span>
|
|
6
|
-
`}get index(){return e(this,
|
|
6
|
+
`}get index(){return e(this,y)}get element(){return e(this,o)}}y=new WeakMap,o=new WeakMap;var f,c,a;class M{constructor(t){l(this,f);l(this,c);l(this,a);r(this,f,t.index),r(this,c,document.createElement("span")),r(this,a,[]),t.letters&&t.lettersAcc!==void 0?(r(this,a,t.text.split("").map((s,n)=>new w({index:t.lettersAcc+n,text:s,clone:t.clone}))),e(this,c).append(...e(this,a).map(s=>s.element))):t.clone?e(this,c).innerHTML=`
|
|
7
7
|
<span class="original">${t.text}</span>
|
|
8
8
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
9
9
|
`:e(this,c).innerHTML=`
|
|
10
10
|
<span class="value">${t.text}</span>
|
|
11
|
-
`,e(this,c).classList.add("word")}get index(){return e(this,
|
|
11
|
+
`,e(this,c).classList.add("word")}get index(){return e(this,f)}get element(){return e(this,c)}get letters(){return e(this,a)}}f=new WeakMap,c=new WeakMap,a=new WeakMap;var u,h,g,x,d,L,A;class S extends HTMLElement{constructor(){super(...arguments);l(this,d);l(this,u,"");l(this,h,[]);l(this,g,[]);l(this,x,null)}get wordsArray(){return e(this,h)}get lettersArray(){return e(this,g)}get originalText(){return e(this,u)}connectedCallback(){var s;r(this,u,((s=this.textContent)==null?void 0:s.trim())||""),this.hasAttribute("media")?(r(this,x,new v.Media(this.getAttribute("media"))),e(this,x).subscribe(n=>{n.current?m(this,d,L).call(this):!n.current&&n.previous&&m(this,d,A).call(this)})):m(this,d,L).call(this)}disconnectedCallback(){var s;m(this,d,A).call(this),(s=e(this,x))==null||s.close()}}u=new WeakMap,h=new WeakMap,g=new WeakMap,x=new WeakMap,d=new WeakSet,L=function(){this.innerHTML="";let s=0;r(this,h,e(this,u).replace(/ +/g," ").split(" ").map((n,b)=>{const p=new M({index:b,text:n,letters:this.hasAttribute("letters"),lettersAcc:s,clone:this.hasAttribute("clone")});return s+=p.letters.length,e(this,g).push(...p.letters),p})),this.hasAttribute("index")&&(e(this,h).forEach(n=>{n.element.style.setProperty("--word-index",n.index.toString())}),e(this,g).forEach(n=>{n.element.style.setProperty("--letter-index",n.index.toString())})),e(this,h).forEach((n,b)=>{if(this.appendChild(n.element),b!==e(this,h).length-1){const p=document.createElement("span");p.innerHTML=" ",this.appendChild(p)}}),this.style.setProperty("--words-length",e(this,h).length.toString()),this.style.setProperty("--letters-length",e(this,g).length.toString())},A=function(){r(this,h,[]),this.textContent=e(this,u),this.style.removeProperty("--words-length"),this.style.removeProperty("--letters-length")};customElements.get("e-slicer")||customElements.define("e-slicer",S);exports.Letter=w;exports.SlicerElement=S;exports.Word=M;
|
package/lib/slicer/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var w = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var A = (i, t, s) => t.has(i) || w("Cannot " + s);
|
|
5
|
+
var e = (i, t, s) => (A(i, t, "read from private field"), s ? s.call(i) : t.get(i)), l = (i, t, s) => t.has(i) ? w("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), r = (i, t, s, n) => (A(i, t, "write to private field"), n ? n.call(i, s) : t.set(i, s), s), m = (i, t, s) => (A(i, t, "access private method"), s);
|
|
6
|
+
import { Media as T } from "../media/index.js";
|
|
7
|
+
var f, o;
|
|
8
|
+
class M {
|
|
8
9
|
constructor(t) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
l(this, f);
|
|
11
|
+
l(this, o);
|
|
12
|
+
r(this, f, t.index), r(this, o, document.createElement("span")), e(this, o).classList.add("letter"), t.clone ? e(this, o).innerHTML = `
|
|
12
13
|
<span class="original">${t.text}</span>
|
|
13
14
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
14
15
|
` : e(this, o).innerHTML = `
|
|
@@ -16,24 +17,24 @@ class L {
|
|
|
16
17
|
`;
|
|
17
18
|
}
|
|
18
19
|
get index() {
|
|
19
|
-
return e(this,
|
|
20
|
+
return e(this, f);
|
|
20
21
|
}
|
|
21
22
|
get element() {
|
|
22
23
|
return e(this, o);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
f = new WeakMap(), o = new WeakMap();
|
|
26
27
|
var y, c, a;
|
|
27
|
-
class
|
|
28
|
+
class H {
|
|
28
29
|
constructor(t) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
index: t.lettersAcc +
|
|
34
|
-
text:
|
|
30
|
+
l(this, y);
|
|
31
|
+
l(this, c);
|
|
32
|
+
l(this, a);
|
|
33
|
+
r(this, y, t.index), r(this, c, document.createElement("span")), r(this, a, []), t.letters && t.lettersAcc !== void 0 ? (r(this, a, t.text.split("").map((s, n) => new M({
|
|
34
|
+
index: t.lettersAcc + n,
|
|
35
|
+
text: s,
|
|
35
36
|
clone: t.clone
|
|
36
|
-
}))), e(this, c).append(...e(this, a).map((
|
|
37
|
+
}))), e(this, c).append(...e(this, a).map((s) => s.element))) : t.clone ? e(this, c).innerHTML = `
|
|
37
38
|
<span class="original">${t.text}</span>
|
|
38
39
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
39
40
|
` : e(this, c).innerHTML = `
|
|
@@ -51,58 +52,67 @@ class T {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
y = new WeakMap(), c = new WeakMap(), a = new WeakMap();
|
|
54
|
-
var
|
|
55
|
-
class
|
|
55
|
+
var u, h, p, x, d, E, L;
|
|
56
|
+
class v extends HTMLElement {
|
|
56
57
|
constructor() {
|
|
57
58
|
super(...arguments);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
l(this, d);
|
|
60
|
+
l(this, u, "");
|
|
61
|
+
l(this, h, []);
|
|
62
|
+
l(this, p, []);
|
|
63
|
+
l(this, x, null);
|
|
61
64
|
}
|
|
62
65
|
get wordsArray() {
|
|
63
|
-
return e(this,
|
|
66
|
+
return e(this, h);
|
|
64
67
|
}
|
|
65
68
|
get lettersArray() {
|
|
66
|
-
return e(this,
|
|
69
|
+
return e(this, p);
|
|
67
70
|
}
|
|
68
71
|
get originalText() {
|
|
69
|
-
return e(this,
|
|
72
|
+
return e(this, u);
|
|
70
73
|
}
|
|
71
74
|
connectedCallback() {
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const p = new T({
|
|
77
|
-
index: m,
|
|
78
|
-
text: r,
|
|
79
|
-
letters: this.hasAttribute("letters"),
|
|
80
|
-
lettersAcc: n,
|
|
81
|
-
clone: this.hasAttribute("clone")
|
|
82
|
-
});
|
|
83
|
-
return n += p.letters.length, e(this, x).push(...p.letters), p;
|
|
84
|
-
})), this.hasAttribute("index") && (e(this, l).forEach((r) => {
|
|
85
|
-
r.element.style.setProperty("--word-index", r.index.toString());
|
|
86
|
-
}), e(this, x).forEach((r) => {
|
|
87
|
-
r.element.style.setProperty(
|
|
88
|
-
"--letter-index",
|
|
89
|
-
r.index.toString()
|
|
90
|
-
);
|
|
91
|
-
})), e(this, l).forEach((r, m) => {
|
|
92
|
-
if (this.appendChild(r.element), m !== e(this, l).length - 1) {
|
|
93
|
-
const p = document.createElement("span");
|
|
94
|
-
p.innerHTML = " ", this.appendChild(p);
|
|
95
|
-
}
|
|
96
|
-
}), this.style.setProperty("--words-length", e(this, l).length.toString()), this.style.setProperty("--letters-length", e(this, x).length.toString());
|
|
75
|
+
var s;
|
|
76
|
+
r(this, u, ((s = this.textContent) == null ? void 0 : s.trim()) || ""), this.hasAttribute("media") ? (r(this, x, new T(this.getAttribute("media"))), e(this, x).subscribe((n) => {
|
|
77
|
+
n.current ? m(this, d, E).call(this) : !n.current && n.previous && m(this, d, L).call(this);
|
|
78
|
+
})) : m(this, d, E).call(this);
|
|
97
79
|
}
|
|
98
80
|
disconnectedCallback() {
|
|
99
|
-
|
|
81
|
+
var s;
|
|
82
|
+
m(this, d, L).call(this), (s = e(this, x)) == null || s.close();
|
|
100
83
|
}
|
|
101
84
|
}
|
|
102
|
-
|
|
103
|
-
|
|
85
|
+
u = new WeakMap(), h = new WeakMap(), p = new WeakMap(), x = new WeakMap(), d = new WeakSet(), E = function() {
|
|
86
|
+
this.innerHTML = "";
|
|
87
|
+
let s = 0;
|
|
88
|
+
r(this, h, e(this, u).replace(/ +/g, " ").split(" ").map((n, b) => {
|
|
89
|
+
const g = new H({
|
|
90
|
+
index: b,
|
|
91
|
+
text: n,
|
|
92
|
+
letters: this.hasAttribute("letters"),
|
|
93
|
+
lettersAcc: s,
|
|
94
|
+
clone: this.hasAttribute("clone")
|
|
95
|
+
});
|
|
96
|
+
return s += g.letters.length, e(this, p).push(...g.letters), g;
|
|
97
|
+
})), this.hasAttribute("index") && (e(this, h).forEach((n) => {
|
|
98
|
+
n.element.style.setProperty("--word-index", n.index.toString());
|
|
99
|
+
}), e(this, p).forEach((n) => {
|
|
100
|
+
n.element.style.setProperty(
|
|
101
|
+
"--letter-index",
|
|
102
|
+
n.index.toString()
|
|
103
|
+
);
|
|
104
|
+
})), e(this, h).forEach((n, b) => {
|
|
105
|
+
if (this.appendChild(n.element), b !== e(this, h).length - 1) {
|
|
106
|
+
const g = document.createElement("span");
|
|
107
|
+
g.innerHTML = " ", this.appendChild(g);
|
|
108
|
+
}
|
|
109
|
+
}), this.style.setProperty("--words-length", e(this, h).length.toString()), this.style.setProperty("--letters-length", e(this, p).length.toString());
|
|
110
|
+
}, L = function() {
|
|
111
|
+
r(this, h, []), this.textContent = e(this, u), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
|
|
112
|
+
};
|
|
113
|
+
customElements.get("e-slicer") || customElements.define("e-slicer", v);
|
|
104
114
|
export {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
M as Letter,
|
|
116
|
+
v as SlicerElement,
|
|
117
|
+
H as Word
|
|
108
118
|
};
|