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.
@@ -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 ce=r=>{throw TypeError(r)};var se=(r,n,t)=>n.has(r)||ce("Cannot "+t);var e=(r,n,t)=>(se(r,n,"read from private field"),t?t.call(r):n.get(r)),s=(r,n,t)=>n.has(r)?ce("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(r):n.set(r,t),h=(r,n,t,i)=>(se(r,n,"write to private field"),i?i.call(r,t):n.set(r,t),t),f=(r,n,t)=>(se(r,n,"access private method"),t);var le=(r,n,t)=>new Promise((i,l)=>{var R=m=>{try{E(t.next(m))}catch(o){l(o)}},Y=m=>{try{E(t.throw(m))}catch(o){l(o)}},E=m=>m.done?i(m.value):Promise.resolve(m.value).then(R,Y);E((t=t.apply(r,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("../device/index.cjs"),Se=require("../source/index.cjs"),we=require("../class-linked-status/index.cjs"),ae=require("../browser-CpzFX2xg.cjs"),ne=require("../events-KVanG9sR.cjs"),ye=require("../string-DhgS_iFl.cjs"),ie=require("../loading/index.cjs"),j=require("../css-property/index.cjs"),Q=require("../element-resizer/vanilla/index.cjs"),ue=require("../canvas-CU5Xjahf.cjs"),_=require("../ticker/vanilla/index.cjs"),Ce=require("../jss-GJLvaNfT.cjs"),xe=require("../math-GDWEqu7y.cjs");let Re=0;var u,a,S,B,p,V,k,c,M,F,J,Z,U,ee;class te extends HTMLElement{constructor(){super();s(this,F);s(this,u,null);s(this,a,null);s(this,S,!1);s(this,B,!1);s(this,p,!1);s(this,V,"");s(this,k,"");s(this,c,new we.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1}));s(this,M,null);s(this,Z,t=>{const i=t[0];e(this,p)&&(!e(this,B)||this.hasAttribute("reload-source"))&&i.isIntersecting&&(e(this,u).current&&e(this,u).current!==e(this,u).previous&&f(this,F,J).call(this,e(this,u).current),h(this,B,!0)),i.isIntersecting?ne.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&f(this,F,J).call(this,void 0),ne.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,U,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,p)&&!e(this,S)&&ie.loading.complete(e(this,k)),h(this,S,!0)});s(this,ee,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,p)&&!e(this,S)&&ie.loading.error(e(this,k)),h(this,S,!0)});ae.isBrowser&&window.IntersectionObserver&&(h(this,V,`source-consumer-${++Re}`),h(this,M,new IntersectionObserver(e(this,Z))))}get consumerElement(){return e(this,a)}get sourceManager(){return e(this,u)}get status(){return e(this,c)}get isLazy(){return e(this,p)}connectedCallback(){const t=this.getAttribute("srcset");t&&(h(this,a,this.createConsumer()),e(this,a).style.cssText=`
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,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(i=>{if(i.name!=="srcset"){const l=i.nodeValue||"",R=ye.kebabToCamel(i.name);R in e(this,a)&&(e(this,a)[R]=l||!0)}}),this.appendChild(e(this,a)),h(this,u,new Se.SourceManager({srcset:t})),h(this,p,this.hasAttribute("lazy")),e(this,u).subscribe(i=>{(!e(this,p)||e(this,p)&&e(this,B))&&f(this,F,J).call(this,i.current)}),e(this,M).observe(this),e(this,u).connect())}disconnectedCallback(){e(this,M).disconnect(),e(this,u).close(),e(this,a).onloadeddata=null,e(this,a).onload=null,e(this,a).onerror=null,e(this,a).remove(),e(this,c).reset()}}u=new WeakMap,a=new WeakMap,S=new WeakMap,B=new WeakMap,p=new WeakMap,V=new WeakMap,k=new WeakMap,c=new WeakMap,M=new WeakMap,F=new WeakSet,J=function(t){if(e(this,a).onloadeddata=null,e(this,a).onload=null,e(this,a).onerror=null,e(this,c).set("loaded",!1),e(this,c).set("error",!1),e(this,c).set("loading",!1),t){h(this,k,`${e(this,V)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0);const l=i?t.url:t.name+t.extension;this.consumeSource(l),!e(this,p)&&!e(this,S)&&ie.loading.add(e(this,k)),e(this,a).onloadeddata=()=>{e(this,U).call(this)},e(this,a).onload=()=>{e(this,U).call(this)},e(this,a).onerror=()=>{e(this,ee).call(this,l)}}else this.consumeSource(null)},Z=new WeakMap,U=new WeakMap,ee=new WeakMap;class de extends te{createConsumer(){return document.createElement("img")}consumeSource(n){if(n&&this.hasAttribute("webp")&&Ee.device.isWebp){const t=n.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=t}else this.consumerElement.src=n||""}}customElements.get("e-image")||customElements.define("e-image",de);var w,g,H,L,P,T,D,K,d,re,pe,N,$,he,be;class me extends HTMLElement{constructor(){super();s(this,d);s(this,w,new j.CSSProperty(this,"--fps",0));s(this,g,null);s(this,H,null);s(this,L,0);s(this,P,0);s(this,T,1);s(this,D,0);s(this,K,1);s(this,N,t=>{h(this,T,xe.clamp(devicePixelRatio,1,2)),h(this,L,t.contentRect.width),h(this,P,t.contentRect.height),e(this,g).width=e(this,L)*this.pixelRatio,e(this,g).height=e(this,P)*this.pixelRatio,this.context.scale(this.pixelRatio,this.pixelRatio),f(this,d,be).call(this),f(this,d,he).call(this)});s(this,$,t=>{h(this,D,t.timestamp),h(this,K,t.timeBetweenFrames),f(this,d,he).call(this)});if(ae.isBrowser){const t=this.attachShadow({mode:"open"});t.adoptedStyleSheets.push(Ce.createStylesheet({" :host, canvas":{display:"block",width:"100%",height:"100%"}})),h(this,g,document.createElement("canvas")),h(this,H,e(this,g).getContext("2d")),t.appendChild(e(this,g)),e(this,w).subscribe(i=>{typeof i.previous!="undefined"&&i.current!==i.previous&&f(this,d,re).call(this)})}}get fpsCSSProperty(){return e(this,w)}get canvasElement(){return e(this,g)}get context(){return e(this,H)}get pixelRatio(){return e(this,T)}get width(){return e(this,L)}get height(){return e(this,P)}get detail(){return{width:e(this,L),height:e(this,P),element:this,canvasElement:e(this,g),pixelRatio:e(this,T),context:e(this,H),timestamp:e(this,D),timeBetweenFrames:e(this,K)}}connectedCallback(){e(this,w).observe(),Q.elementResizer.subscribe(this,e(this,N)),f(this,d,re).call(this)}disconnectedCallback(){e(this,w).unobserve(),Q.elementResizer.unsubscribe(e(this,N)),f(this,d,pe).call(this)}}w=new WeakMap,g=new WeakMap,H=new WeakMap,L=new WeakMap,P=new WeakMap,T=new WeakMap,D=new WeakMap,K=new WeakMap,d=new WeakSet,re=function(){_.ticker.unsubscribe(e(this,$)),this.hasAttribute("static")||_.ticker.subscribe(e(this,$),{culling:this,maxFPS:e(this,w).current})},pe=function(){_.ticker.unsubscribe(e(this,$))},N=new WeakMap,$=new WeakMap,he=function(){this.dispatchEvent(new CustomEvent("canvasRender",{composed:!0,detail:this.detail}))},be=function(){this.dispatchEvent(new CustomEvent("canvasResize",{composed:!0,detail:this.detail}))};customElements.get("e-canvas")||customElements.define("e-canvas",me);function ke(r){const n=r.match(/\{([\d-]+)\}/);if(n){const t=n[1].split("-");if(t.length===2){const i=parseInt(t[0],10),l=parseInt(t[1],10);return{start:i,end:l}}}return null}var b,q,O,y,C,I,z,X,v,x;class fe extends te{constructor(t){super();s(this,b,[]);s(this,q,new j.CSSProperty(this,"--fit","contain"));s(this,O,new j.CSSProperty(this,"--autoplay",!1));s(this,y,new j.CSSProperty(this,"--offset-x",.5));s(this,C,new j.CSSProperty(this,"--offset-y",.5));s(this,I,null);s(this,z,0);s(this,X,1);s(this,v,()=>{if(e(this,b).length){const t=e(this,b)[0];e(this,q).current==="cover"?h(this,I,ue.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,y).current,e(this,C).current)):h(this,I,ue.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,y).current,e(this,C).current))}});s(this,x,t=>{if(this.status.isFalse("loaded")||!e(this,I))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,b)[e(this,z)];i&&t.detail.context.drawImage(i,...e(this,I)),e(this,O).current&&h(this,z,(e(this,z)+1)%e(this,b).length)});ae.isBrowser&&(h(this,X,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,q).subscribe(e(this,v)),e(this,y).subscribe(e(this,v)),e(this,C).subscribe(e(this,v)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,x))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,x))}))}setProgress(t){e(this,b).length&&h(this,z,Math.floor((e(this,b).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,O).observe(),e(this,q).observe(),e(this,y).observe(),e(this,C).observe(),Q.elementResizer.subscribe(this,e(this,v))}disconnectedCallback(){super.disconnectedCallback(),e(this,O).unobserve(),e(this,q).unobserve(),e(this,y).unobserve(),e(this,C).unobserve(),h(this,b,[]),Q.elementResizer.unsubscribe(e(this,v)),this.consumerElement.removeEventListener("canvasRender",e(this,x))}createConsumer(){return new me}consumeSource(t){return le(this,null,function*(){var i,l,R,Y;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,x));const E=[],m=ke(t);if(m)for(let o=m.start;o<=m.end;o++){const oe=t.replace(/\{([^}]+)\}/,o.toString().padStart(e(this,X),"0")),G=new Image;G.src=oe,E.push(G)}else{const o=new Image;o.src=t,E.push(o)}try{yield Promise.all(E.map((o,oe)=>new Promise((G,ve)=>{o.onload=()=>{G()},o.onerror=Le=>{ve(`${o.src} Image not found`)}}))),h(this,b,E),e(this,v).call(this),(l=(i=this.consumerElement).onload)==null||l.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,x))}catch(o){console.error(o),(Y=(R=this.consumerElement).onerror)==null||Y.call(R,new Event("error"))}}})}}b=new WeakMap,q=new WeakMap,O=new WeakMap,y=new WeakMap,C=new WeakMap,I=new WeakMap,z=new WeakMap,X=new WeakMap,v=new WeakMap,x=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",fe);var A,W;class ge extends te{constructor(){super(...arguments);s(this,A,0);s(this,W,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,A)&&h(this,A,t),ne.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,A)}}),this.consumerElement.readyState===4&&_.ticker.unsubscribe(e(this,W))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{_.ticker.subscribe(e(this,W)),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(),_.ticker.unsubscribe(e(this,W)),h(this,A,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||""}}A=new WeakMap,W=new WeakMap;customElements.get("e-video")||customElements.define("e-video",ge);exports.ImageElement=de;exports.SequenceElement=fe;exports.SourceElement=te;exports.VideoElement=ge;
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 ce = (n) => {
2
- throw TypeError(n);
1
+ var Y = (r) => {
2
+ throw TypeError(r);
3
3
  };
4
- var te = (n, r, t) => r.has(n) || ce("Cannot " + t);
5
- var e = (n, r, t) => (te(n, r, "read from private field"), t ? t.call(n) : r.get(n)), s = (n, r, t) => r.has(n) ? ce("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, t), h = (n, r, t, i) => (te(n, r, "write to private field"), i ? i.call(n, t) : r.set(n, t), t), b = (n, r, t) => (te(n, r, "access private method"), t);
6
- var le = (n, r, t) => new Promise((i, l) => {
7
- var L = (m) => {
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
- E(t.next(m));
10
- } catch (o) {
11
- l(o);
9
+ b(t.next(m));
10
+ } catch (h) {
11
+ l(h);
12
12
  }
13
- }, G = (m) => {
13
+ }, T = (m) => {
14
14
  try {
15
- E(t.throw(m));
16
- } catch (o) {
17
- l(o);
15
+ b(t.throw(m));
16
+ } catch (h) {
17
+ l(h);
18
18
  }
19
- }, E = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(L, G);
20
- E((t = t.apply(n, r)).next());
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 fe } from "../device/index.js";
23
- import { SourceManager as be } from "../source/index.js";
24
- import { ClassLinkedStatus as ge } from "../class-linked-status/index.js";
25
- import { i as he } from "../browser-0zX67oeU.js";
26
- import { d as ie } from "../events-CsVF98U6.js";
27
- import { k as ve } from "../string-f0Dnk0L1.js";
28
- import { loading as se } from "../loading/index.js";
29
- import { CSSProperty as V } from "../css-property/index.js";
30
- import { elementResizer as Z } from "../element-resizer/vanilla/index.js";
31
- import { c as Ee, a as we } from "../canvas-DeZ0SLUJ.js";
32
- import { ticker as F } from "../ticker/vanilla/index.js";
33
- import { c as Se } from "../jss-CjccJC-K.js";
34
- import { c as Ce } from "../math-BOBiC4TN.js";
35
- let ye = 0;
36
- var u, a, w, H, p, j, R, c, M, T, Q, _, D, ee;
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
- s(this, T);
41
- s(this, u, null);
42
- s(this, a, null);
43
- s(this, w, !1);
44
- s(this, H, !1);
45
- s(this, p, !1);
46
- s(this, j, "");
47
- s(this, R, "");
48
- s(this, c, new ge(this, {
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
- s(this, M, null);
54
- s(this, _, (t) => {
55
- const i = t[0];
56
- e(this, p) && (!e(this, H) || this.hasAttribute("reload-source")) && i.isIntersecting && (e(this, u).current && e(this, u).current !== e(this, u).previous && b(this, T, Q).call(this, e(this, u).current), h(this, H, !0)), i.isIntersecting ? ie(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && b(this, T, Q).call(this, void 0), ie(this, "sourceRelease", { custom: !0 }));
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
- s(this, D, () => {
59
- e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, p) && !e(this, w) && se.complete(e(this, R)), h(this, w, !0);
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
- s(this, ee, (t) => {
62
- e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, p) && !e(this, w) && se.error(e(this, R)), h(this, w, !0);
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
- he && window.IntersectionObserver && (h(this, j, `source-consumer-${++ye}`), h(this, M, new IntersectionObserver(
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, a);
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, p);
77
+ return e(this, d);
79
78
  }
80
79
  connectedCallback() {
81
80
  const t = this.getAttribute("srcset");
82
- t && (h(this, a, this.createConsumer()), e(this, a).style.cssText = `
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, a).classList.add("source-consumer"), Array.from(this.attributes).forEach((i) => {
87
- if (i.name !== "srcset") {
88
- const l = i.nodeValue || "", L = ve(i.name);
89
- L in e(this, a) && (e(this, a)[L] = l || !0);
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, a)), h(this, u, new be({
90
+ }), this.appendChild(e(this, o)), a(this, u, new ee({
92
91
  srcset: t
93
- })), h(this, p, this.hasAttribute("lazy")), e(this, u).subscribe((i) => {
94
- (!e(this, p) || e(this, p) && e(this, H)) && b(this, T, Q).call(this, i.current);
95
- }), e(this, M).observe(this), e(this, u).connect());
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, M).disconnect(), e(this, u).close(), e(this, a).onloadeddata = null, e(this, a).onload = null, e(this, a).onerror = null, e(this, a).remove(), e(this, c).reset();
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(), a = new WeakMap(), w = new WeakMap(), H = new WeakMap(), p = new WeakMap(), j = new WeakMap(), R = new WeakMap(), c = new WeakMap(), M = new WeakMap(), T = new WeakSet(), Q = function(t) {
102
- if (e(this, a).onloadeddata = null, e(this, a).onload = null, e(this, a).onerror = null, e(this, c).set("loaded", !1), e(this, c).set("error", !1), e(this, c).set("loading", !1), t) {
103
- h(this, R, `${e(this, j)}-${t.url}`);
104
- const i = this.hasAttribute("keep-source-parameters");
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 = i ? t.url : t.name + t.extension;
107
- this.consumeSource(l), !e(this, p) && !e(this, w) && se.add(e(this, R)), e(this, a).onloadeddata = () => {
108
- e(this, D).call(this);
109
- }, e(this, a).onload = () => {
110
- e(this, D).call(this);
111
- }, e(this, a).onerror = () => {
112
- e(this, ee).call(this, l);
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
- }, _ = new WeakMap(), D = new WeakMap(), ee = new WeakMap();
117
- class xe extends ae {
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(r) {
122
- if (r && this.hasAttribute("webp") && fe.isWebp) {
123
- const t = r.split(".").slice(0, -1).join(".") + ".webp";
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 = r || "";
125
+ this.consumerElement.src = s || "";
127
126
  }
128
127
  }
129
- customElements.get("e-image") || customElements.define("e-image", xe);
130
- var S, g, $, k, I, W, K, N, d, re, de, X, q, ne, me;
131
- class ue extends HTMLElement {
132
- constructor() {
133
- super();
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 i = parseInt(t[0], 10), l = parseInt(t[1], 10);
230
- return { start: i, end: l };
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, P, O, C, y, A, z, Y, v, x;
236
- class Re extends ae {
140
+ var f, w, P, E, v, L, k, $, p, y;
141
+ class ce extends N {
237
142
  constructor(t) {
238
143
  super();
239
- s(this, f, []);
240
- s(this, P, new V(
144
+ i(this, f, []);
145
+ i(this, w, new B(
241
146
  this,
242
147
  "--fit",
243
148
  "contain"
244
149
  ));
245
- s(this, O, new V(this, "--autoplay", !1));
246
- s(this, C, new V(this, "--offset-x", 0.5));
247
- s(this, y, new V(this, "--offset-y", 0.5));
248
- s(this, A, null);
249
- s(this, z, 0);
250
- s(this, Y, 1);
251
- s(this, v, () => {
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, P).current === "cover" ? h(this, A, Ee(
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, C).current,
260
- e(this, y).current
261
- )) : h(this, A, we(
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, C).current,
267
- e(this, y).current
171
+ e(this, E).current,
172
+ e(this, v).current
268
173
  ));
269
174
  }
270
175
  });
271
- s(this, x, (t) => {
272
- if (this.status.isFalse("loaded") || !e(this, A))
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 i = e(this, f)[e(this, z)];
276
- i && t.detail.context.drawImage(i, ...e(this, A)), e(this, O).current && h(this, z, (e(this, z) + 1) % e(this, f).length);
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
- he && (h(this, Y, parseInt(
183
+ Q && (a(this, $, parseInt(
279
184
  ((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
280
- )), e(this, P).subscribe(e(this, v)), e(this, C).subscribe(e(this, v)), e(this, y).subscribe(e(this, v)), this.addEventListener("sourceCapture", (i) => {
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, x)
188
+ e(this, y)
284
189
  );
285
- }), this.addEventListener("sourceRelease", (i) => {
190
+ }), this.addEventListener("sourceRelease", (n) => {
286
191
  this.consumerElement.removeEventListener(
287
192
  "canvasRender",
288
- e(this, x)
193
+ e(this, y)
289
194
  );
290
195
  }));
291
196
  }
292
197
  setProgress(t) {
293
- e(this, f).length && h(this, z, Math.floor((e(this, f).length - 1) * t));
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, O).observe(), e(this, P).observe(), e(this, C).observe(), e(this, y).observe(), Z.subscribe(this, e(this, v));
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, O).unobserve(), e(this, P).unobserve(), e(this, C).unobserve(), e(this, y).unobserve(), h(this, f, []), Z.unsubscribe(e(this, v)), this.consumerElement.removeEventListener(
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, x)
206
+ e(this, y)
302
207
  );
303
208
  }
304
209
  createConsumer() {
305
- return new ue();
210
+ return new ne();
306
211
  }
307
212
  consumeSource(t) {
308
- return le(this, null, function* () {
309
- var i, l, L, G;
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, x)
218
+ e(this, y)
314
219
  );
315
- const E = [], m = Le(t);
220
+ const b = [], m = he(t);
316
221
  if (m)
317
- for (let o = m.start; o <= m.end; o++) {
318
- const oe = t.replace(
222
+ for (let h = m.start; h <= m.end; h++) {
223
+ const X = t.replace(
319
224
  /\{([^}]+)\}/,
320
- o.toString().padStart(e(this, Y), "0")
321
- ), J = new Image();
322
- J.src = oe, E.push(J);
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 o = new Image();
326
- o.src = t, E.push(o);
230
+ const h = new Image();
231
+ h.src = t, b.push(h);
327
232
  }
328
233
  try {
329
234
  yield Promise.all(
330
- E.map((o, oe) => new Promise((J, pe) => {
331
- o.onload = () => {
332
- J();
333
- }, o.onerror = (Ie) => {
334
- pe(`${o.src} Image not found`);
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
- ), h(this, f, E), e(this, v).call(this), (l = (i = this.consumerElement).onload) == null || l.call(i, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
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, x)
244
+ e(this, y)
340
245
  );
341
- } catch (o) {
342
- console.error(o), (G = (L = this.consumerElement).onerror) == null || G.call(L, new Event("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(), P = new WeakMap(), O = new WeakMap(), C = new WeakMap(), y = new WeakMap(), A = new WeakMap(), z = new WeakMap(), Y = new WeakMap(), v = new WeakMap(), x = new WeakMap();
349
- customElements.get("e-sequence") || customElements.define("e-sequence", Re);
350
- var B, U;
351
- class ke extends ae {
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
- s(this, B, 0);
355
- s(this, U, () => {
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, B) && h(this, B, t), ie(this, "videoReadyStateChange", {
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, B)
266
+ progress: e(this, I)
362
267
  }
363
- }), this.consumerElement.readyState === 4 && F.unsubscribe(e(this, U));
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
- F.subscribe(e(this, U)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
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(), F.unsubscribe(e(this, U)), h(this, B, 0);
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
- B = new WeakMap(), U = new WeakMap();
390
- customElements.get("e-video") || customElements.define("e-video", ke);
294
+ I = new WeakMap(), z = new WeakMap();
295
+ customElements.get("e-video") || customElements.define("e-video", le);
391
296
  export {
392
- xe as ImageElement,
393
- Re as SequenceElement,
394
- ae as SourceElement,
395
- ke as VideoElement
297
+ ae as ImageElement,
298
+ ce as SequenceElement,
299
+ N as SourceElement,
300
+ le as VideoElement
396
301
  };
@@ -1,11 +1,11 @@
1
- "use strict";var f=s=>{throw TypeError(s)};var E=(s,t,n)=>t.has(s)||f("Cannot "+n);var e=(s,t,n)=>(E(s,t,"read from private field"),n?n.call(s):t.get(s)),h=(s,t,n)=>t.has(s)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,n),i=(s,t,n,d)=>(E(s,t,"write to private field"),d?d.call(s,n):t.set(s,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var p,o;class L{constructor(t){h(this,p);h(this,o);i(this,p,t.index),i(this,o,document.createElement("span")),e(this,o).classList.add("letter"),t.clone?e(this,o).innerHTML=`
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,p)}get element(){return e(this,o)}}p=new WeakMap,o=new WeakMap;var y,c,a;class T{constructor(t){h(this,y);h(this,c);h(this,a);i(this,y,t.index),i(this,c,document.createElement("span")),i(this,a,[]),t.letters&&t.lettersAcc!==void 0?(i(this,a,t.text.split("").map((n,d)=>new L({index:t.lettersAcc+d,text:n,clone:t.clone}))),e(this,c).append(...e(this,a).map(n=>n.element))):t.clone?e(this,c).innerHTML=`
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,y)}get element(){return e(this,c)}get letters(){return e(this,a)}}y=new WeakMap,c=new WeakMap,a=new WeakMap;var g,l,u;class b extends HTMLElement{constructor(){super(...arguments);h(this,g,"");h(this,l,[]);h(this,u,[])}get wordsArray(){return e(this,l)}get lettersArray(){return e(this,u)}get originalText(){return e(this,g)}connectedCallback(){var d;i(this,g,((d=this.textContent)==null?void 0:d.trim())||""),this.innerHTML="";let n=0;i(this,l,e(this,g).replace(/ +/g," ").split(" ").map((r,m)=>{const x=new T({index:m,text:r,letters:this.hasAttribute("letters"),lettersAcc:n,clone:this.hasAttribute("clone")});return n+=x.letters.length,e(this,u).push(...x.letters),x})),this.hasAttribute("index")&&(e(this,l).forEach(r=>{r.element.style.setProperty("--word-index",r.index.toString())}),e(this,u).forEach(r=>{r.element.style.setProperty("--letter-index",r.index.toString())})),e(this,l).forEach((r,m)=>{if(this.appendChild(r.element),m!==e(this,l).length-1){const x=document.createElement("span");x.innerHTML="&nbsp;",this.appendChild(x)}}),this.style.setProperty("--words-length",e(this,l).length.toString()),this.style.setProperty("--letters-length",e(this,u).length.toString())}disconnectedCallback(){i(this,l,[]),this.textContent=e(this,g),this.style.removeProperty("--words-length"),this.style.removeProperty("--letters-length")}}g=new WeakMap,l=new WeakMap,u=new WeakMap;customElements.get("e-slicer")||customElements.define("e-slicer",b);exports.Letter=L;exports.SlicerElement=b;exports.Word=T;
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="&nbsp;",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;
@@ -1,14 +1,15 @@
1
- var f = (s) => {
2
- throw TypeError(s);
1
+ var w = (i) => {
2
+ throw TypeError(i);
3
3
  };
4
- var E = (s, t, n) => t.has(s) || f("Cannot " + n);
5
- var e = (s, t, n) => (E(s, t, "read from private field"), n ? n.call(s) : t.get(s)), h = (s, t, n) => t.has(s) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, n), i = (s, t, n, d) => (E(s, t, "write to private field"), d ? d.call(s, n) : t.set(s, n), n);
6
- var u, o;
7
- class L {
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
- h(this, u);
10
- h(this, o);
11
- i(this, u, t.index), i(this, o, document.createElement("span")), e(this, o).classList.add("letter"), t.clone ? e(this, o).innerHTML = `
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, u);
20
+ return e(this, f);
20
21
  }
21
22
  get element() {
22
23
  return e(this, o);
23
24
  }
24
25
  }
25
- u = new WeakMap(), o = new WeakMap();
26
+ f = new WeakMap(), o = new WeakMap();
26
27
  var y, c, a;
27
- class T {
28
+ class H {
28
29
  constructor(t) {
29
- h(this, y);
30
- h(this, c);
31
- h(this, a);
32
- i(this, y, t.index), i(this, c, document.createElement("span")), i(this, a, []), t.letters && t.lettersAcc !== void 0 ? (i(this, a, t.text.split("").map((n, d) => new L({
33
- index: t.lettersAcc + d,
34
- text: n,
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((n) => n.element))) : t.clone ? e(this, c).innerHTML = `
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 g, l, x;
55
- class w extends HTMLElement {
55
+ var u, h, p, x, d, E, L;
56
+ class v extends HTMLElement {
56
57
  constructor() {
57
58
  super(...arguments);
58
- h(this, g, "");
59
- h(this, l, []);
60
- h(this, x, []);
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, l);
66
+ return e(this, h);
64
67
  }
65
68
  get lettersArray() {
66
- return e(this, x);
69
+ return e(this, p);
67
70
  }
68
71
  get originalText() {
69
- return e(this, g);
72
+ return e(this, u);
70
73
  }
71
74
  connectedCallback() {
72
- var d;
73
- i(this, g, ((d = this.textContent) == null ? void 0 : d.trim()) || ""), this.innerHTML = "";
74
- let n = 0;
75
- i(this, l, e(this, g).replace(/ +/g, " ").split(" ").map((r, m) => {
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 = "&nbsp;", 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
- i(this, l, []), this.textContent = e(this, g), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
81
+ var s;
82
+ m(this, d, L).call(this), (s = e(this, x)) == null || s.close();
100
83
  }
101
84
  }
102
- g = new WeakMap(), l = new WeakMap(), x = new WeakMap();
103
- customElements.get("e-slicer") || customElements.define("e-slicer", w);
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 = "&nbsp;", 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
- L as Letter,
106
- w as SlicerElement,
107
- T as Word
115
+ M as Letter,
116
+ v as SlicerElement,
117
+ H as Word
108
118
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.29.8",
3
+ "version": "0.30.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"