aptechka 0.30.15 → 0.31.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.
@@ -2,4 +2,4 @@
2
2
  display: block;
3
3
  width: 100%;
4
4
  height: 100%;
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))&&B(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,z=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,z)}-${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,_).call(this)},e(this,o).onload=()=>{e(this,_).call(this)},e(this,o).onerror=()=>{e(this,V).call(this,l)}}else this.consumeSource(null)},W=new WeakMap,_=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 H.CSSProperty(this,"--fit","contain"));i(this,R,new H.CSSProperty(this,"--autoplay",!1));i(this,E,new H.CSSProperty(this,"--offset-x",.5));i(this,v,new H.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,T;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")),$=new Image;$.src=N,g.push($)}else{const c=new Image;c.src=t,g.push(c)}try{yield Promise.all(g.map((c,N)=>new Promise(($,se)=>{c.onload=()=>{$()},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),(T=(y=this.consumerElement).onerror)==null||T.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;
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))&&B(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,z=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,z)}-${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,_).call(this)},e(this,o).onload=()=>{e(this,_).call(this)},e(this,o).onerror=()=>{e(this,V).call(this,l)}}else this.consumeSource(null)},W=new WeakMap,_=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 H.CSSProperty(this,"--fit","contain"));i(this,R,new H.CSSProperty(this,"--autoplay",!1));i(this,E,new H.CSSProperty(this,"--offset-x",.5));i(this,v,new H.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,T;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")),$=new Image;$.src=N,g.push($)}else{const c=new Image;c.src=t,g.push(c)}try{yield Promise.all(g.map((c,N)=>new Promise(($,se)=>{c.onload=()=>{$()},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),(T=(y=this.consumerElement).onerror)==null||T.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||"",this.consumerElement.autoplay=!0}}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;
@@ -291,7 +291,7 @@ class le extends N {
291
291
  return document.createElement("video");
292
292
  }
293
293
  consumeSource(t) {
294
- this.consumerElement.src = t || "";
294
+ this.consumerElement.src = t || "", this.consumerElement.autoplay = !0;
295
295
  }
296
296
  }
297
297
  I = new WeakMap(), z = new WeakMap();
@@ -2,8 +2,12 @@ import { Attribute } from '../attribute';
2
2
  import { Store } from '../store/vanilla';
3
3
 
4
4
  export interface PopoverEvents {
5
- popoverTriggered: CustomEvent;
6
- popoverOpened: CustomEvent;
5
+ popoverTriggered: CustomEvent<{
6
+ trigger: any;
7
+ }>;
8
+ popoverOpened: CustomEvent<{
9
+ trigger: any;
10
+ }>;
7
11
  popoverClosing: CustomEvent;
8
12
  popoverClosed: CustomEvent;
9
13
  }
@@ -14,7 +18,11 @@ export declare class PopoverElement extends HTMLElement {
14
18
  get restore(): Attribute<false>;
15
19
  get single(): Attribute<false>;
16
20
  get opened(): Store<boolean>;
17
- open: (useTransition?: boolean) => void;
21
+ get lastTrigger(): any;
22
+ open: (options?: {
23
+ skipTransition?: boolean;
24
+ trigger?: any;
25
+ }) => void;
18
26
  close: () => void;
19
27
  protected connectedCallback(): void;
20
28
  protected disconnectedCallback(): void;
@@ -1 +1 @@
1
- "use strict";var R=i=>{throw TypeError(i)};var q=(i,r,t)=>r.has(i)||R("Cannot "+t);var e=(i,r,t)=>(q(i,r,"read from private field"),t?t.call(i):r.get(i)),o=(i,r,t)=>r.has(i)?R("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,t),h=(i,r,t,l)=>(q(i,r,"write to private field"),l?l.call(i,t):r.set(i,t),t),b=(i,r,t)=>(q(i,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../attribute/index.cjs"),N=require("../Store-CDb6RMce.cjs"),A=require("../events-KVanG9sR.cjs"),j=require("../style-At6aDoqG.cjs"),D=require("../browser-CpzFX2xg.cjs");var L,a,T,p,u,v,g,d,I,E,O,y,x,m;const c=class c extends HTMLElement{constructor(){super(...arguments);o(this,d);o(this,L);o(this,a);o(this,T);o(this,p);o(this,u);o(this,v);o(this,g);o(this,E);o(this,y);o(this,m);h(this,L,-1),h(this,a,new N.Store(!1)),h(this,p,new H.Attribute(this,"history",!1)),h(this,u,new H.Attribute(this,"restore",!1)),h(this,v,new H.Attribute(this,"single",!1)),h(this,g,!1),this.open=(t=!0)=>{if(e(this,a).current)return;e(this,a).current=!0,e(this,v).current&&(c.__opened.forEach(n=>n.close()),c.__opened=[]),c.__opened.push(this),h(this,L,c.__opened.length-1),e(this,p).current&&e(this,g)&&history.pushState("","",e(this,d,I)),clearTimeout(e(this,T)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",A.dispatchEvent(this,"popoverTriggered",{custom:!0});const l=()=>{addEventListener("click",e(this,E)),addEventListener("keydown",e(this,y)),this.style.opacity="1",this.classList.add("opened"),A.dispatchEvent(this,"popoverOpened",{custom:!0})};t?setTimeout(l,10):l()},this.close=()=>{e(this,a).current&&(e(this,a).current=!1,c.__opened=c.__opened.filter(t=>t!==this),b(this,d,O).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",A.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,E)),removeEventListener("keydown",e(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",A.dispatchEvent(this,"popoverClosed",{custom:!0})},j.getElementTransitionDurationMS(this)+10))},h(this,E,t=>{b(this,d,x).call(this,()=>{var $;const l=t.composedPath();if(l.find(P=>P instanceof HTMLElement&&P.hasAttribute("data-popover-content")))return;const n=l[0],_=n instanceof HTMLElement&&(this.contains(n)||(($=this.shadowRoot)==null?void 0:$.contains(n))),f=n instanceof HTMLElement&&n.hasAttribute("data-outside");(!_||f)&&this.close()})}),h(this,y,t=>{b(this,d,x).call(this,()=>{t.code==="Escape"&&this.close()})}),h(this,m,()=>{h(this,g,!1),e(this,a).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,a).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),h(this,g,!0)})}get history(){return e(this,p)}get restore(){return e(this,u)}get single(){return e(this,v)}get opened(){return e(this,a)}connectedCallback(){e(this,p).observe(),e(this,u).observe(),e(this,v).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,m)),setTimeout(()=>{e(this,u).current?e(this,m).call(this):(b(this,d,O).call(this),h(this,g,!0))},0)}disconnectedCallback(){e(this,p).unobserve(),e(this,u).unobserve(),e(this,v).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,m))}};L=new WeakMap,a=new WeakMap,T=new WeakMap,p=new WeakMap,u=new WeakMap,v=new WeakMap,g=new WeakMap,d=new WeakSet,I=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},E=new WeakMap,O=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},y=new WeakMap,x=function(t){(c.__opened[e(this,L)-1]||c.__opened.length===1)&&t()},m=new WeakMap,c.__opened=[];let M=c;customElements.get("e-popover")||customElements.define("e-popover",M);var s,w,k,S,C;class B extends HTMLElement{constructor(){super();o(this,s);o(this,w,()=>{this.classList.add("triggered")});o(this,k,()=>{this.classList.add("opened")});o(this,S,()=>{this.classList.remove("opened")});o(this,C,()=>{this.classList.remove("triggered")});D.isBrowser&&(this.addEventListener("click",()=>{if(e(this,s)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,s).opened.current?e(this,s).open():(t==="close"||t==="toggle"&&e(this,s).opened.current)&&e(this,s).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,s)}connectedCallback(){var l;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let n=null;if(t==="parent"){const _=this.closest("[popover-target]");if(_)n=_;else{const f=this.getRootNode();f instanceof ShadowRoot?n=f.host.closest("[popover-target]"):f instanceof HTMLElement&&(n=f.closest("[popover-target]"))}}else t==="sibling"?n=(l=this.parentElement)==null?void 0:l.querySelector("[popover-target]"):n=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);n instanceof HTMLElement?(h(this,s,n),e(this,s).addEventListener("popoverTriggered",e(this,w)),e(this,s).addEventListener("popoverOpened",e(this,k)),e(this,s).addEventListener("popoverClosing",e(this,S)),e(this,s).addEventListener("popoverClosed",e(this,C))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,s)&&(e(this,s).removeEventListener("popoverTriggered",e(this,w)),e(this,s).removeEventListener("popoverOpened",e(this,k)),e(this,s).removeEventListener("popoverClosing",e(this,S)),e(this,s).removeEventListener("popoverClosed",e(this,C)))}}s=new WeakMap,w=new WeakMap,k=new WeakMap,S=new WeakMap,C=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",B);exports.PopoverButtonElement=B;exports.PopoverElement=M;
1
+ "use strict";var I=i=>{throw TypeError(i)};var H=(i,o,t)=>o.has(i)||I("Cannot "+t);var e=(i,o,t)=>(H(i,o,"read from private field"),t?t.call(i):o.get(i)),r=(i,o,t)=>o.has(i)?I("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(i):o.set(i,t),n=(i,o,t,l)=>(H(i,o,"write to private field"),l?l.call(i,t):o.set(i,t),t),T=(i,o,t)=>(H(i,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../attribute/index.cjs"),j=require("../Store-CDb6RMce.cjs"),M=require("../events-KVanG9sR.cjs"),D=require("../style-At6aDoqG.cjs"),U=require("../browser-CpzFX2xg.cjs");var E,a,w,d,u,g,v,m,p,B,y,x,b,$,f;const c=class c extends HTMLElement{constructor(){super(...arguments);r(this,p);r(this,E);r(this,a);r(this,w);r(this,d);r(this,u);r(this,g);r(this,v);r(this,m);r(this,y);r(this,b);r(this,f);n(this,E,-1),n(this,a,new j.Store(!1)),n(this,d,new O.Attribute(this,"history",!1)),n(this,u,new O.Attribute(this,"restore",!1)),n(this,g,new O.Attribute(this,"single",!1)),n(this,v,!1),this.open=t=>{if(e(this,a).current)return;n(this,m,t==null?void 0:t.trigger),e(this,a).current=!0,e(this,g).current&&(c.__opened.forEach(h=>h.close()),c.__opened=[]),c.__opened.push(this),n(this,E,c.__opened.length-1),e(this,d).current&&e(this,v)&&history.pushState("","",e(this,p,B)),clearTimeout(e(this,w)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,m)}});const l=()=>{addEventListener("click",e(this,y)),addEventListener("keydown",e(this,b)),this.style.opacity="1",this.classList.add("opened"),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,m)}})};t!=null&&t.skipTransition?l():setTimeout(l,10)},this.close=()=>{e(this,a).current&&(e(this,a).current=!1,c.__opened=c.__opened.filter(t=>t!==this),T(this,p,x).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",M.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,y)),removeEventListener("keydown",e(this,b)),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",M.dispatchEvent(this,"popoverClosed",{custom:!0})},D.getElementTransitionDurationMS(this)+10))},n(this,y,t=>{T(this,p,$).call(this,()=>{var P;const l=t.composedPath();if(l.find(R=>R instanceof HTMLElement&&R.hasAttribute("data-popover-content")))return;const h=l[0],A=h instanceof HTMLElement&&(this.contains(h)||((P=this.shadowRoot)==null?void 0:P.contains(h))),L=h instanceof HTMLElement&&h.hasAttribute("data-outside");(!A||L)&&this.close()})}),n(this,b,t=>{T(this,p,$).call(this,()=>{t.code==="Escape"&&this.close()})}),n(this,f,()=>{n(this,v,!1),e(this,a).current&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,a).current&&e(this,d).current&&location.search.includes(this.id)&&this.open(),n(this,v,!0)})}get history(){return e(this,d)}get restore(){return e(this,u)}get single(){return e(this,g)}get opened(){return e(this,a)}get lastTrigger(){return e(this,m)}connectedCallback(){e(this,d).observe(),e(this,u).observe(),e(this,g).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,f)),setTimeout(()=>{e(this,u).current?e(this,f).call(this):(T(this,p,x).call(this),n(this,v,!0))},0)}disconnectedCallback(){e(this,d).unobserve(),e(this,u).unobserve(),e(this,g).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,w)),removeEventListener("popstate",e(this,f))}};E=new WeakMap,a=new WeakMap,w=new WeakMap,d=new WeakMap,u=new WeakMap,g=new WeakMap,v=new WeakMap,m=new WeakMap,p=new WeakSet,B=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},y=new WeakMap,x=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},b=new WeakMap,$=function(t){(c.__opened[e(this,E)-1]||c.__opened.length===1)&&t()},f=new WeakMap,c.__opened=[];let q=c;customElements.get("e-popover")||customElements.define("e-popover",q);var s,k,S,C,_;class N extends HTMLElement{constructor(){super();r(this,s);r(this,k,()=>{this.classList.add("triggered")});r(this,S,()=>{this.classList.add("opened")});r(this,C,()=>{this.classList.remove("opened")});r(this,_,()=>{this.classList.remove("triggered")});U.isBrowser&&(this.addEventListener("click",()=>{if(e(this,s)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,s).opened.current?e(this,s).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,s).opened.current)&&e(this,s).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,s)}connectedCallback(){var l;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let h=null;if(t==="parent"){const A=this.closest("[popover-target]");if(A)h=A;else{const L=this.getRootNode();L instanceof ShadowRoot?h=L.host.closest("[popover-target]"):L instanceof HTMLElement&&(h=L.closest("[popover-target]"))}}else t==="sibling"?h=(l=this.parentElement)==null?void 0:l.querySelector("[popover-target]"):h=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);h instanceof HTMLElement?(n(this,s,h),e(this,s).addEventListener("popoverTriggered",e(this,k)),e(this,s).addEventListener("popoverOpened",e(this,S)),e(this,s).addEventListener("popoverClosing",e(this,C)),e(this,s).addEventListener("popoverClosed",e(this,_))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,s)&&(e(this,s).removeEventListener("popoverTriggered",e(this,k)),e(this,s).removeEventListener("popoverOpened",e(this,S)),e(this,s).removeEventListener("popoverClosing",e(this,C)),e(this,s).removeEventListener("popoverClosed",e(this,_)))}}s=new WeakMap,k=new WeakMap,S=new WeakMap,C=new WeakMap,_=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",N);exports.PopoverButtonElement=N;exports.PopoverElement=q;
@@ -1,121 +1,131 @@
1
- var q = (i) => {
1
+ var N = (i) => {
2
2
  throw TypeError(i);
3
3
  };
4
- var M = (i, r, t) => r.has(i) || q("Cannot " + t);
5
- var e = (i, r, t) => (M(i, r, "read from private field"), t ? t.call(i) : r.get(i)), o = (i, r, t) => r.has(i) ? q("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(i) : r.set(i, t), h = (i, r, t, l) => (M(i, r, "write to private field"), l ? l.call(i, t) : r.set(i, t), t), b = (i, r, t) => (M(i, r, "access private method"), t);
6
- import { Attribute as H } from "../attribute/index.js";
7
- import { S as B } from "../Store-OTdcl6SX.js";
8
- import { d as A } from "../events-CsVF98U6.js";
9
- import { g as P } from "../style-j2TwriJ_.js";
10
- import { i as D } from "../browser-0zX67oeU.js";
11
- var L, a, T, p, u, v, g, d, N, E, O, y, $, m;
4
+ var H = (i, o, t) => o.has(i) || N("Cannot " + t);
5
+ var e = (i, o, t) => (H(i, o, "read from private field"), t ? t.call(i) : o.get(i)), r = (i, o, t) => o.has(i) ? N("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(i) : o.set(i, t), n = (i, o, t, a) => (H(i, o, "write to private field"), a ? a.call(i, t) : o.set(i, t), t), b = (i, o, t) => (H(i, o, "access private method"), t);
6
+ import { Attribute as x } from "../attribute/index.js";
7
+ import { S as P } from "../Store-OTdcl6SX.js";
8
+ import { d as M } from "../events-CsVF98U6.js";
9
+ import { g as D } from "../style-j2TwriJ_.js";
10
+ import { i as U } from "../browser-0zX67oeU.js";
11
+ var E, l, k, d, u, g, v, m, p, B, y, $, T, R, f;
12
12
  const c = class c extends HTMLElement {
13
13
  constructor() {
14
14
  super(...arguments);
15
- o(this, d);
16
- o(this, L);
17
- o(this, a);
18
- o(this, T);
19
- o(this, p);
20
- o(this, u);
21
- o(this, v);
22
- o(this, g);
23
- o(this, E);
24
- o(this, y);
25
- o(this, m);
26
- h(this, L, -1), h(this, a, new B(!1)), h(this, p, new H(this, "history", !1)), h(this, u, new H(this, "restore", !1)), h(this, v, new H(this, "single", !1)), h(this, g, !1), this.open = (t = !0) => {
27
- if (e(this, a).current)
15
+ r(this, p);
16
+ r(this, E);
17
+ r(this, l);
18
+ r(this, k);
19
+ r(this, d);
20
+ r(this, u);
21
+ r(this, g);
22
+ r(this, v);
23
+ r(this, m);
24
+ r(this, y);
25
+ r(this, T);
26
+ r(this, f);
27
+ n(this, E, -1), n(this, l, new P(!1)), n(this, d, new x(this, "history", !1)), n(this, u, new x(this, "restore", !1)), n(this, g, new x(this, "single", !1)), n(this, v, !1), this.open = (t) => {
28
+ if (e(this, l).current)
28
29
  return;
29
- e(this, a).current = !0, e(this, v).current && (c.__opened.forEach((n) => n.close()), c.__opened = []), c.__opened.push(this), h(this, L, c.__opened.length - 1), e(this, p).current && e(this, g) && history.pushState("", "", e(this, d, N)), clearTimeout(e(this, T)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", A(this, "popoverTriggered", {
30
- custom: !0
30
+ n(this, m, t == null ? void 0 : t.trigger), e(this, l).current = !0, e(this, g).current && (c.__opened.forEach((h) => h.close()), c.__opened = []), c.__opened.push(this), n(this, E, c.__opened.length - 1), e(this, d).current && e(this, v) && history.pushState("", "", e(this, p, B)), clearTimeout(e(this, k)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", M(this, "popoverTriggered", {
31
+ custom: !0,
32
+ detail: {
33
+ trigger: e(this, m)
34
+ }
31
35
  });
32
- const l = () => {
33
- addEventListener("click", e(this, E)), addEventListener("keydown", e(this, y)), this.style.opacity = "1", this.classList.add("opened"), A(this, "popoverOpened", {
34
- custom: !0
36
+ const a = () => {
37
+ addEventListener("click", e(this, y)), addEventListener("keydown", e(this, T)), this.style.opacity = "1", this.classList.add("opened"), M(this, "popoverOpened", {
38
+ custom: !0,
39
+ detail: {
40
+ trigger: e(this, m)
41
+ }
35
42
  });
36
43
  };
37
- t ? setTimeout(l, 10) : l();
44
+ t != null && t.skipTransition ? a() : setTimeout(a, 10);
38
45
  }, this.close = () => {
39
- e(this, a).current && (e(this, a).current = !1, c.__opened = c.__opened.filter((t) => t !== this), b(this, d, O).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", A(this, "popoverClosing", {
46
+ e(this, l).current && (e(this, l).current = !1, c.__opened = c.__opened.filter((t) => t !== this), b(this, p, $).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", M(this, "popoverClosing", {
40
47
  custom: !0
41
- }), removeEventListener("click", e(this, E)), removeEventListener("keydown", e(this, y)), setTimeout(() => {
42
- this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", A(this, "popoverClosed", {
48
+ }), removeEventListener("click", e(this, y)), removeEventListener("keydown", e(this, T)), setTimeout(() => {
49
+ this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", M(this, "popoverClosed", {
43
50
  custom: !0
44
51
  });
45
- }, P(this) + 10));
46
- }, h(this, E, (t) => {
47
- b(this, d, $).call(this, () => {
48
- var R;
49
- const l = t.composedPath();
50
- if (l.find(
51
- (I) => I instanceof HTMLElement && I.hasAttribute("data-popover-content")
52
+ }, D(this) + 10));
53
+ }, n(this, y, (t) => {
54
+ b(this, p, R).call(this, () => {
55
+ var I;
56
+ const a = t.composedPath();
57
+ if (a.find(
58
+ (q) => q instanceof HTMLElement && q.hasAttribute("data-popover-content")
52
59
  ))
53
60
  return;
54
- const n = l[0], _ = n instanceof HTMLElement && (this.contains(n) || ((R = this.shadowRoot) == null ? void 0 : R.contains(n))), f = n instanceof HTMLElement && n.hasAttribute("data-outside");
55
- (!_ || f) && this.close();
61
+ const h = a[0], A = h instanceof HTMLElement && (this.contains(h) || ((I = this.shadowRoot) == null ? void 0 : I.contains(h))), L = h instanceof HTMLElement && h.hasAttribute("data-outside");
62
+ (!A || L) && this.close();
56
63
  });
57
- }), h(this, y, (t) => {
58
- b(this, d, $).call(this, () => {
64
+ }), n(this, T, (t) => {
65
+ b(this, p, R).call(this, () => {
59
66
  t.code === "Escape" && this.close();
60
67
  });
61
- }), h(this, m, () => {
62
- h(this, g, !1), e(this, a).current && e(this, p).current && !location.search.includes(this.id) ? this.close() : !e(this, a).current && e(this, p).current && location.search.includes(this.id) && this.open(), h(this, g, !0);
68
+ }), n(this, f, () => {
69
+ n(this, v, !1), e(this, l).current && e(this, d).current && !location.search.includes(this.id) ? this.close() : !e(this, l).current && e(this, d).current && location.search.includes(this.id) && this.open(), n(this, v, !0);
63
70
  });
64
71
  }
65
72
  get history() {
66
- return e(this, p);
73
+ return e(this, d);
67
74
  }
68
75
  get restore() {
69
76
  return e(this, u);
70
77
  }
71
78
  get single() {
72
- return e(this, v);
79
+ return e(this, g);
73
80
  }
74
81
  get opened() {
75
- return e(this, a);
82
+ return e(this, l);
83
+ }
84
+ get lastTrigger() {
85
+ return e(this, m);
76
86
  }
77
87
  connectedCallback() {
78
- e(this, p).observe(), e(this, u).observe(), e(this, v).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, m)), setTimeout(() => {
79
- e(this, u).current ? e(this, m).call(this) : (b(this, d, O).call(this), h(this, g, !0));
88
+ e(this, d).observe(), e(this, u).observe(), e(this, g).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, f)), setTimeout(() => {
89
+ e(this, u).current ? e(this, f).call(this) : (b(this, p, $).call(this), n(this, v, !0));
80
90
  }, 0);
81
91
  }
82
92
  disconnectedCallback() {
83
- e(this, p).unobserve(), e(this, u).unobserve(), e(this, v).unobserve(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, m));
93
+ e(this, d).unobserve(), e(this, u).unobserve(), e(this, g).unobserve(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, k)), removeEventListener("popstate", e(this, f));
84
94
  }
85
95
  };
86
- L = new WeakMap(), a = new WeakMap(), T = new WeakMap(), p = new WeakMap(), u = new WeakMap(), v = new WeakMap(), g = new WeakMap(), d = new WeakSet(), N = function() {
96
+ E = new WeakMap(), l = new WeakMap(), k = new WeakMap(), d = new WeakMap(), u = new WeakMap(), g = new WeakMap(), v = new WeakMap(), m = new WeakMap(), p = new WeakSet(), B = function() {
87
97
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
88
- }, E = new WeakMap(), O = function() {
89
- if (e(this, p).current) {
98
+ }, y = new WeakMap(), $ = function() {
99
+ if (e(this, d).current) {
90
100
  const t = new URL(location.href);
91
101
  t.searchParams.delete(this.id), history.replaceState(null, "", t.href);
92
102
  }
93
- }, y = new WeakMap(), $ = function(t) {
94
- (c.__opened[e(this, L) - 1] || c.__opened.length === 1) && t();
95
- }, m = new WeakMap(), c.__opened = [];
96
- let x = c;
97
- customElements.get("e-popover") || customElements.define("e-popover", x);
98
- var s, w, k, C, S;
99
- class U extends HTMLElement {
103
+ }, T = new WeakMap(), R = function(t) {
104
+ (c.__opened[e(this, E) - 1] || c.__opened.length === 1) && t();
105
+ }, f = new WeakMap(), c.__opened = [];
106
+ let O = c;
107
+ customElements.get("e-popover") || customElements.define("e-popover", O);
108
+ var s, w, C, S, _;
109
+ class j extends HTMLElement {
100
110
  constructor() {
101
111
  super();
102
- o(this, s);
103
- o(this, w, () => {
112
+ r(this, s);
113
+ r(this, w, () => {
104
114
  this.classList.add("triggered");
105
115
  });
106
- o(this, k, () => {
116
+ r(this, C, () => {
107
117
  this.classList.add("opened");
108
118
  });
109
- o(this, C, () => {
119
+ r(this, S, () => {
110
120
  this.classList.remove("opened");
111
121
  });
112
- o(this, S, () => {
122
+ r(this, _, () => {
113
123
  this.classList.remove("triggered");
114
124
  });
115
- D && (this.addEventListener("click", () => {
125
+ U && (this.addEventListener("click", () => {
116
126
  if (e(this, s)) {
117
127
  const t = this.getAttribute("type") || "open";
118
- t === "open" || t === "toggle" && !e(this, s).opened.current ? e(this, s).open() : (t === "close" || t === "toggle" && e(this, s).opened.current) && e(this, s).close();
128
+ t === "open" || t === "toggle" && !e(this, s).opened.current ? e(this, s).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, s).opened.current) && e(this, s).close();
119
129
  }
120
130
  }), this.addEventListener("keydown", (t) => {
121
131
  t.code === "Space" && t.currentTarget.click();
@@ -125,32 +135,32 @@ class U extends HTMLElement {
125
135
  return e(this, s);
126
136
  }
127
137
  connectedCallback() {
128
- var l;
138
+ var a;
129
139
  this.hasAttribute("tabindex") || (this.tabIndex = 0);
130
140
  const t = this.getAttribute("target");
131
141
  if (t) {
132
- let n = null;
142
+ let h = null;
133
143
  if (t === "parent") {
134
- const _ = this.closest("[popover-target]");
135
- if (_)
136
- n = _;
144
+ const A = this.closest("[popover-target]");
145
+ if (A)
146
+ h = A;
137
147
  else {
138
- const f = this.getRootNode();
139
- f instanceof ShadowRoot ? n = f.host.closest("[popover-target]") : f instanceof HTMLElement && (n = f.closest("[popover-target]"));
148
+ const L = this.getRootNode();
149
+ L instanceof ShadowRoot ? h = L.host.closest("[popover-target]") : L instanceof HTMLElement && (h = L.closest("[popover-target]"));
140
150
  }
141
- } else t === "sibling" ? n = (l = this.parentElement) == null ? void 0 : l.querySelector("[popover-target]") : n = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
142
- n instanceof HTMLElement ? (h(this, s, n), e(this, s).addEventListener(
151
+ } else t === "sibling" ? h = (a = this.parentElement) == null ? void 0 : a.querySelector("[popover-target]") : h = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
152
+ h instanceof HTMLElement ? (n(this, s, h), e(this, s).addEventListener(
143
153
  "popoverTriggered",
144
154
  e(this, w)
145
155
  ), e(this, s).addEventListener(
146
156
  "popoverOpened",
147
- e(this, k)
157
+ e(this, C)
148
158
  ), e(this, s).addEventListener(
149
159
  "popoverClosing",
150
- e(this, C)
160
+ e(this, S)
151
161
  ), e(this, s).addEventListener(
152
162
  "popoverClosed",
153
- e(this, S)
163
+ e(this, _)
154
164
  )) : console.warn(this, `target ${t} not found`);
155
165
  }
156
166
  }
@@ -160,19 +170,19 @@ class U extends HTMLElement {
160
170
  e(this, w)
161
171
  ), e(this, s).removeEventListener(
162
172
  "popoverOpened",
163
- e(this, k)
173
+ e(this, C)
164
174
  ), e(this, s).removeEventListener(
165
175
  "popoverClosing",
166
- e(this, C)
176
+ e(this, S)
167
177
  ), e(this, s).removeEventListener(
168
178
  "popoverClosed",
169
- e(this, S)
179
+ e(this, _)
170
180
  ));
171
181
  }
172
182
  }
173
- s = new WeakMap(), w = new WeakMap(), k = new WeakMap(), C = new WeakMap(), S = new WeakMap();
174
- customElements.get("e-popover-button") || customElements.define("e-popover-button", U);
183
+ s = new WeakMap(), w = new WeakMap(), C = new WeakMap(), S = new WeakMap(), _ = new WeakMap();
184
+ customElements.get("e-popover-button") || customElements.define("e-popover-button", j);
175
185
  export {
176
- U as PopoverButtonElement,
177
- x as PopoverElement
186
+ j as PopoverButtonElement,
187
+ O as PopoverElement
178
188
  };
@@ -5,7 +5,7 @@ export declare class SlicerElement extends HTMLElement {
5
5
  #private;
6
6
  get wordsArray(): Word[];
7
7
  get lettersArray(): Letter[];
8
- get originalText(): string;
8
+ get originalHTML(): string;
9
9
  protected connectedCallback(): void;
10
10
  protected disconnectedCallback(): void;
11
11
  }
@@ -1,11 +1,11 @@
1
- "use strict";var w=n=>{throw TypeError(n)};var A=(n,t,s)=>t.has(n)||w("Cannot "+s);var e=(n,t,s)=>(A(n,t,"read from private field"),s?s.call(n):t.get(n)),l=(n,t,s)=>t.has(n)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),r=(n,t,s,i)=>(A(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),f=(n,t,s)=>(A(n,t,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../media/index.cjs");var m,o;class M{constructor(t){l(this,m);l(this,o);r(this,m,t.index),r(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 M=(i,t,s)=>t.has(i)||T("Cannot "+s);var e=(i,t,s)=>(M(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),h=(i,t,s,a)=>(M(i,t,"write to private field"),a?a.call(i,s):t.set(i,s),s),m=(i,t,s)=>(M(i,t,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../media/index.cjs");var y,o;class H{constructor(t){l(this,y);l(this,o);h(this,y,t.index),h(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,m)}get element(){return e(this,o)}}m=new WeakMap,o=new WeakMap;var y,c,a,x;class S{constructor(t){l(this,y);l(this,c);l(this,a);l(this,x);r(this,y,t.index),r(this,c,document.createElement("span")),r(this,a,[]),r(this,x,t.text.endsWith("\\n")),e(this,x)&&(t.text=t.text.replace("\\n","")),t.letters&&t.lettersAcc!==void 0?(r(this,a,t.text.split("").map((s,i)=>new M({index:t.lettersAcc+i,text:s,clone:t.clone}))),e(this,c).append(...e(this,a).map(s=>s.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 L,r,u,g;class S{constructor(t){l(this,L);l(this,r);l(this,u);l(this,g);h(this,L,t.index),h(this,r,document.createElement("span")),h(this,u,[]),h(this,g,t.text.endsWith("\\n")),e(this,g)&&(t.text=t.text.replace("\\n","")),t.letters&&t.lettersAcc!==void 0?(h(this,u,t.text.split("").map((s,a)=>new H({index:t.lettersAcc+a,text:s,clone:t.clone}))),e(this,r).append(...e(this,u).map(s=>s.element))):t.clone?e(this,r).innerHTML=`
7
7
  <span class="original">${t.text}</span>
8
8
  <span class="clone" aria-hidden>${t.text}</span>
9
- `:e(this,c).innerHTML=`
9
+ `:e(this,r).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)}get hasNewLine(){return e(this,x)}}y=new WeakMap,c=new WeakMap,a=new WeakMap,x=new WeakMap;var u,h,g,p,d,E,T;class v extends HTMLElement{constructor(){super(...arguments);l(this,d);l(this,u,"");l(this,h,[]);l(this,g,[]);l(this,p,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,p,new H.Media(this.getAttribute("media"))),e(this,p).subscribe(i=>{i.current?f(this,d,E).call(this):!i.current&&i.previous&&f(this,d,T).call(this)})):f(this,d,E).call(this)}disconnectedCallback(){var s;f(this,d,T).call(this),(s=e(this,p))==null||s.close()}}u=new WeakMap,h=new WeakMap,g=new WeakMap,p=new WeakMap,d=new WeakSet,E=function(){this.innerHTML="";let s=0;r(this,h,e(this,u).replace(/ +/g," ").split(" ").map((i,b)=>{const L=new S({index:b,text:i,letters:this.hasAttribute("letters"),lettersAcc:s,clone:this.hasAttribute("clone")});return s+=L.letters.length,e(this,g).push(...L.letters),L})),this.hasAttribute("index")&&(e(this,h).forEach(i=>{i.element.style.setProperty("--word-index",i.index.toString())}),e(this,g).forEach(i=>{i.element.style.setProperty("--letter-index",i.index.toString())})),e(this,h).forEach((i,b)=>{this.appendChild(i.element),b!==e(this,h).length-1&&i.element.insertAdjacentHTML("beforeend","&nbsp;"),i.hasNewLine&&i.element.after(document.createElement("br"))}),this.style.setProperty("--words-length",e(this,h).length.toString()),this.style.setProperty("--letters-length",e(this,g).length.toString())},T=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",v);exports.Letter=M;exports.SlicerElement=v;exports.Word=S;
11
+ `,e(this,r).classList.add("word")}get index(){return e(this,L)}get element(){return e(this,r)}get letters(){return e(this,u)}get hasNewLine(){return e(this,g)}}L=new WeakMap,r=new WeakMap,u=new WeakMap,g=new WeakMap;var p,c,x,f,d,b,A;class v extends HTMLElement{constructor(){super(...arguments);l(this,d);l(this,p,"");l(this,c,[]);l(this,x,[]);l(this,f,null)}get wordsArray(){return e(this,c)}get lettersArray(){return e(this,x)}get originalHTML(){return e(this,p)}connectedCallback(){h(this,p,this.innerHTML.trim()),this.hasAttribute("media")?(h(this,f,new $.Media(this.getAttribute("media"))),e(this,f).subscribe(s=>{s.current?m(this,d,b).call(this):!s.current&&s.previous&&m(this,d,A).call(this)})):m(this,d,b).call(this)}disconnectedCallback(){var s;m(this,d,A).call(this),(s=e(this,f))==null||s.close()}}p=new WeakMap,c=new WeakMap,x=new WeakMap,f=new WeakMap,d=new WeakSet,b=function(){console.log(this.childNodes);const s=[];h(this,c,[]);let a=0,E=0;this.childNodes.forEach(n=>{n.nodeName==="#text"&&n.textContent?n.textContent.trim().replace(/ +/g," ").split(" ").map(P=>{const w=new S({index:a,text:P+" ",letters:this.hasAttribute("letters"),lettersAcc:E,clone:this.hasAttribute("clone")});E+=w.letters.length,a+=1,e(this,x).push(...w.letters),e(this,c).push(w),s.push(w.element)}):s.push(n)}),this.hasAttribute("index")&&(e(this,c).forEach(n=>{n.element.style.setProperty("--word-index",n.index.toString())}),e(this,x).forEach(n=>{n.element.style.setProperty("--letter-index",n.index.toString())})),this.innerHTML="",s.forEach(n=>{this.appendChild(n)}),this.style.setProperty("--words-length",e(this,c).length.toString()),this.style.setProperty("--letters-length",e(this,x).length.toString())},A=function(){h(this,c,[]),this.innerHTML=e(this,p),this.style.removeProperty("--words-length"),this.style.removeProperty("--letters-length")};customElements.get("e-slicer")||customElements.define("e-slicer",v);exports.Letter=H;exports.SlicerElement=v;exports.Word=S;
@@ -1,15 +1,15 @@
1
- var T = (n) => {
2
- throw TypeError(n);
1
+ var T = (i) => {
2
+ throw TypeError(i);
3
3
  };
4
- var A = (n, t, s) => t.has(n) || T("Cannot " + s);
5
- var e = (n, t, s) => (A(n, t, "read from private field"), s ? s.call(n) : t.get(n)), l = (n, t, s) => t.has(n) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), h = (n, t, s, i) => (A(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), f = (n, t, s) => (A(n, t, "access private method"), s);
6
- import { Media as M } from "../media/index.js";
7
- var m, o;
8
- class H {
4
+ var A = (i, t, s) => t.has(i) || T("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) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), h = (i, t, s, a) => (A(i, t, "write to private field"), a ? a.call(i, s) : t.set(i, s), s), m = (i, t, s) => (A(i, t, "access private method"), s);
6
+ import { Media as v } from "../media/index.js";
7
+ var L, o;
8
+ class P {
9
9
  constructor(t) {
10
- l(this, m);
10
+ l(this, L);
11
11
  l(this, o);
12
- h(this, m, t.index), h(this, o, document.createElement("span")), e(this, o).classList.add("letter"), t.clone ? e(this, o).innerHTML = `
12
+ h(this, L, t.index), h(this, o, document.createElement("span")), e(this, o).classList.add("letter"), t.clone ? e(this, o).innerHTML = `
13
13
  <span class="original">${t.text}</span>
14
14
  <span class="clone" aria-hidden>${t.text}</span>
15
15
  ` : e(this, o).innerHTML = `
@@ -17,103 +17,106 @@ class H {
17
17
  `;
18
18
  }
19
19
  get index() {
20
- return e(this, m);
20
+ return e(this, L);
21
21
  }
22
22
  get element() {
23
23
  return e(this, o);
24
24
  }
25
25
  }
26
- m = new WeakMap(), o = new WeakMap();
27
- var y, c, a, g;
28
- class v {
26
+ L = new WeakMap(), o = new WeakMap();
27
+ var y, r, u, g;
28
+ class $ {
29
29
  constructor(t) {
30
30
  l(this, y);
31
- l(this, c);
32
- l(this, a);
31
+ l(this, r);
32
+ l(this, u);
33
33
  l(this, g);
34
- h(this, y, t.index), h(this, c, document.createElement("span")), h(this, a, []), h(this, g, t.text.endsWith("\\n")), e(this, g) && (t.text = t.text.replace("\\n", "")), t.letters && t.lettersAcc !== void 0 ? (h(this, a, t.text.split("").map((s, i) => new H({
35
- index: t.lettersAcc + i,
34
+ h(this, y, t.index), h(this, r, document.createElement("span")), h(this, u, []), h(this, g, t.text.endsWith("\\n")), e(this, g) && (t.text = t.text.replace("\\n", "")), t.letters && t.lettersAcc !== void 0 ? (h(this, u, t.text.split("").map((s, a) => new P({
35
+ index: t.lettersAcc + a,
36
36
  text: s,
37
37
  clone: t.clone
38
- }))), e(this, c).append(...e(this, a).map((s) => s.element))) : t.clone ? e(this, c).innerHTML = `
38
+ }))), e(this, r).append(...e(this, u).map((s) => s.element))) : t.clone ? e(this, r).innerHTML = `
39
39
  <span class="original">${t.text}</span>
40
40
  <span class="clone" aria-hidden>${t.text}</span>
41
- ` : e(this, c).innerHTML = `
41
+ ` : e(this, r).innerHTML = `
42
42
  <span class="value">${t.text}</span>
43
- `, e(this, c).classList.add("word");
43
+ `, e(this, r).classList.add("word");
44
44
  }
45
45
  get index() {
46
46
  return e(this, y);
47
47
  }
48
48
  get element() {
49
- return e(this, c);
49
+ return e(this, r);
50
50
  }
51
51
  get letters() {
52
- return e(this, a);
52
+ return e(this, u);
53
53
  }
54
54
  get hasNewLine() {
55
55
  return e(this, g);
56
56
  }
57
57
  }
58
- y = new WeakMap(), c = new WeakMap(), a = new WeakMap(), g = new WeakMap();
59
- var u, r, x, p, d, E, w;
60
- class P extends HTMLElement {
58
+ y = new WeakMap(), r = new WeakMap(), u = new WeakMap(), g = new WeakMap();
59
+ var p, c, x, f, d, M, E;
60
+ class C extends HTMLElement {
61
61
  constructor() {
62
62
  super(...arguments);
63
63
  l(this, d);
64
- l(this, u, "");
65
- l(this, r, []);
64
+ l(this, p, "");
65
+ l(this, c, []);
66
66
  l(this, x, []);
67
- l(this, p, null);
67
+ l(this, f, null);
68
68
  }
69
69
  get wordsArray() {
70
- return e(this, r);
70
+ return e(this, c);
71
71
  }
72
72
  get lettersArray() {
73
73
  return e(this, x);
74
74
  }
75
- get originalText() {
76
- return e(this, u);
75
+ get originalHTML() {
76
+ return e(this, p);
77
77
  }
78
78
  connectedCallback() {
79
- var s;
80
- h(this, u, ((s = this.textContent) == null ? void 0 : s.trim()) || ""), this.hasAttribute("media") ? (h(this, p, new M(this.getAttribute("media"))), e(this, p).subscribe((i) => {
81
- i.current ? f(this, d, E).call(this) : !i.current && i.previous && f(this, d, w).call(this);
82
- })) : f(this, d, E).call(this);
79
+ h(this, p, this.innerHTML.trim()), this.hasAttribute("media") ? (h(this, f, new v(this.getAttribute("media"))), e(this, f).subscribe((s) => {
80
+ s.current ? m(this, d, M).call(this) : !s.current && s.previous && m(this, d, E).call(this);
81
+ })) : m(this, d, M).call(this);
83
82
  }
84
83
  disconnectedCallback() {
85
84
  var s;
86
- f(this, d, w).call(this), (s = e(this, p)) == null || s.close();
85
+ m(this, d, E).call(this), (s = e(this, f)) == null || s.close();
87
86
  }
88
87
  }
89
- u = new WeakMap(), r = new WeakMap(), x = new WeakMap(), p = new WeakMap(), d = new WeakSet(), E = function() {
90
- this.innerHTML = "";
91
- let s = 0;
92
- h(this, r, e(this, u).replace(/ +/g, " ").split(" ").map((i, L) => {
93
- const b = new v({
94
- index: L,
95
- text: i,
96
- letters: this.hasAttribute("letters"),
97
- lettersAcc: s,
98
- clone: this.hasAttribute("clone")
99
- });
100
- return s += b.letters.length, e(this, x).push(...b.letters), b;
101
- })), this.hasAttribute("index") && (e(this, r).forEach((i) => {
102
- i.element.style.setProperty("--word-index", i.index.toString());
103
- }), e(this, x).forEach((i) => {
104
- i.element.style.setProperty(
88
+ p = new WeakMap(), c = new WeakMap(), x = new WeakMap(), f = new WeakMap(), d = new WeakSet(), M = function() {
89
+ console.log(this.childNodes);
90
+ const s = [];
91
+ h(this, c, []);
92
+ let a = 0, H = 0;
93
+ this.childNodes.forEach((n) => {
94
+ n.nodeName === "#text" && n.textContent ? n.textContent.trim().replace(/ +/g, " ").split(" ").map((b) => {
95
+ const w = new $({
96
+ index: a,
97
+ text: b + " ",
98
+ letters: this.hasAttribute("letters"),
99
+ lettersAcc: H,
100
+ clone: this.hasAttribute("clone")
101
+ });
102
+ H += w.letters.length, a += 1, e(this, x).push(...w.letters), e(this, c).push(w), s.push(w.element);
103
+ }) : s.push(n);
104
+ }), this.hasAttribute("index") && (e(this, c).forEach((n) => {
105
+ n.element.style.setProperty("--word-index", n.index.toString());
106
+ }), e(this, x).forEach((n) => {
107
+ n.element.style.setProperty(
105
108
  "--letter-index",
106
- i.index.toString()
109
+ n.index.toString()
107
110
  );
108
- })), e(this, r).forEach((i, L) => {
109
- this.appendChild(i.element), L !== e(this, r).length - 1 && i.element.insertAdjacentHTML("beforeend", "&nbsp;"), i.hasNewLine && i.element.after(document.createElement("br"));
110
- }), this.style.setProperty("--words-length", e(this, r).length.toString()), this.style.setProperty("--letters-length", e(this, x).length.toString());
111
- }, w = function() {
112
- h(this, r, []), this.textContent = e(this, u), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
111
+ })), this.innerHTML = "", s.forEach((n) => {
112
+ this.appendChild(n);
113
+ }), this.style.setProperty("--words-length", e(this, c).length.toString()), this.style.setProperty("--letters-length", e(this, x).length.toString());
114
+ }, E = function() {
115
+ h(this, c, []), this.innerHTML = e(this, p), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
113
116
  };
114
- customElements.get("e-slicer") || customElements.define("e-slicer", P);
117
+ customElements.get("e-slicer") || customElements.define("e-slicer", C);
115
118
  export {
116
- H as Letter,
117
- P as SlicerElement,
118
- v as Word
119
+ P as Letter,
120
+ C as SlicerElement,
121
+ $ as Word
119
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.30.15",
3
+ "version": "0.31.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"