aptechka 0.82.1 → 0.82.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +17 -11
- package/lib/slicer/index.cjs +1 -1
- package/lib/slicer/index.js +91 -82
- package/package.json +2 -2
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var he=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||he("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),oe=require("../index-CKTweR3M.cjs"),W=require("../events-KVanG9sR.cjs"),ge=require("../function-MthRj-GJ.cjs"),le=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-CPgw9bd5.cjs"),ae=require("../window-resizer/index.cjs"),Z=require("../Viewport-Cx50Hufs.cjs");var f,w,ee,te;class ve{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(Q=>Q instanceof HTMLElement&&Q.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),L=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||L)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,T,P,q,$,b,V,O,k,E,z,a,M,D,u,ue,S,_,F,A,I,X,U;const C=class C extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,T);r(this,P);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,k);r(this,E);r(this,z);r(this,a);r(this,M);r(this,D);r(this,F);r(this,A);r(this,I);r(this,X);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,T,new y.CSSProperty(this,"--restore",!1)),o(this,P,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,k,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new fe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,I).call(this)}),o(this,I,ge.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,k).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(C.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=C.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get dispatchResize(){return e(this,P)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,S).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ue)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{C.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,S).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,P).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,A).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,a).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},le.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),C.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,S).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},le.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,P).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,T).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,k).subscribe(()=>{e(this,A).call(this)}),ae.windowResizer.subscribe(e(this,A))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),C.stack.remove(e(this,b).current,this),ae.windowResizer.unsubscribe(e(this,A)),e(this,m).close(),e(this,T).close(),e(this,P).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,k).close(),this.removeAttribute("role"),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,k=new WeakMap,E=new WeakMap,z=new WeakMap,a=new WeakMap,M=new WeakMap,D=new WeakMap,u=new WeakSet,ue=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},S=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,A=new WeakMap,I=new WeakMap,X=new WeakMap,U=new WeakMap,C.stack=new ve;let j=C;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,x,ie,Y,J,K,N,re;class pe extends HTMLElement{constructor(){super();r(this,x);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,N,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,x,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let L=d.querySelector("[data-popover]");return!L&&(d!=null&&d.parentElement)&&(L=l(d.parentElement)),L};i=l(this.parentElement)||null}else{let l=t;if(isNaN(parseInt(l))&&(!t.startsWith(".")&&!t.startsWith("[")&&!t.startsWith("#")&&(l=`#${t}`),i=document.querySelector(l)||this.getRootNode().querySelector(l)),!i){const L=[...document.querySelectorAll("[data-popover-ids]")].find(Q=>{var ne;return(ne=Q.getAttribute("data-popover-ids"))==null?void 0:ne.split(",").find(de=>de.trim()===t)});L&&(i=L)}}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,N))):console.warn(this,`target ${t} not found`)}p(this,x,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,x,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,x,ie).call(this)}}h=new WeakMap,g=new WeakMap,x=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,N)))},Y=new WeakMap,J=new WeakMap,K=new WeakMap,N=new WeakMap,re=function(t){e(this,h)instanceof j&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",pe);exports.PopoverButtonElement=pe;exports.PopoverElement=j;
|
|
1
|
+
"use strict";var he=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||he("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../css-property/index.cjs"),Z=require("../Viewport-Cx50Hufs.cjs"),fe=require("../element-linked-store/index.cjs"),oe=require("../index-CKTweR3M.cjs"),W=require("../events-KVanG9sR.cjs"),ge=require("../function-MthRj-GJ.cjs"),le=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-CPgw9bd5.cjs"),ae=require("../window-resizer/index.cjs");var f,w,ee,te;class ve{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(Q=>Q instanceof HTMLElement&&Q.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),L=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||L)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,T,P,q,$,b,V,O,k,E,z,a,M,D,u,ue,S,_,F,A,I,X,U;const C=class C extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,T);r(this,P);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,k);r(this,E);r(this,z);r(this,a);r(this,M);r(this,D);r(this,F);r(this,A);r(this,I);r(this,X);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,T,new y.CSSProperty(this,"--restore",!1)),o(this,P,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,k,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new fe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,I).call(this)}),o(this,I,ge.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,k).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(C.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=C.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get dispatchResize(){return e(this,P)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,S).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ue)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{C.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,S).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,P).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,A).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,a).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},le.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),C.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,S).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},le.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,P).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,T).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,k).subscribe(()=>{e(this,A).call(this)}),ae.windowResizer.subscribe(e(this,A))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),C.stack.remove(e(this,b).current,this),ae.windowResizer.unsubscribe(e(this,A)),e(this,m).close(),e(this,T).close(),e(this,P).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,k).close(),this.removeAttribute("role"),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,k=new WeakMap,E=new WeakMap,z=new WeakMap,a=new WeakMap,M=new WeakMap,D=new WeakMap,u=new WeakSet,ue=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},S=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,A=new WeakMap,I=new WeakMap,X=new WeakMap,U=new WeakMap,C.stack=new ve;let j=C;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,x,ie,Y,J,K,N,re;class pe extends HTMLElement{constructor(){super();r(this,x);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,N,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,x,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let L=d.querySelector("[data-popover]");return!L&&(d!=null&&d.parentElement)&&(L=l(d.parentElement)),L};i=l(this.parentElement)||null}else{let l=t;if(isNaN(parseInt(l))&&(!t.startsWith(".")&&!t.startsWith("[")&&!t.startsWith("#")&&(l=`#${t}`),i=document.querySelector(l)||this.getRootNode().querySelector(l)),!i){const L=[...document.querySelectorAll("[data-popover-ids]")].find(Q=>{var ne;return(ne=Q.getAttribute("data-popover-ids"))==null?void 0:ne.split(",").find(de=>de.trim()===t)});L&&(i=L)}}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,N))):console.warn(this,`target ${t} not found`)}p(this,x,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,x,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,x,ie).call(this)}}h=new WeakMap,g=new WeakMap,x=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,N)))},Y=new WeakMap,J=new WeakMap,K=new WeakMap,N=new WeakMap,re=function(t){e(this,h)instanceof j&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",pe);exports.PopoverButtonElement=pe;exports.PopoverElement=j;
|
package/lib/popover/index.js
CHANGED
|
@@ -3,8 +3,9 @@ var nt = (c) => {
|
|
|
3
3
|
};
|
|
4
4
|
var st = (c, h, e) => h.has(c) || nt("Cannot " + e);
|
|
5
5
|
var t = (c, h, e) => (st(c, h, "read from private field"), e ? e.call(c) : h.get(c)), r = (c, h, e) => h.has(c) ? nt("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(c) : h.set(c, e), o = (c, h, e, s) => (st(c, h, "write to private field"), s ? s.call(c, e) : h.set(c, e), e), p = (c, h, e) => (st(c, h, "access private method"), e);
|
|
6
|
-
import { ElementLinkedStore as pt } from "../element-linked-store/index.js";
|
|
7
6
|
import { CSSProperty as E } from "../css-property/index.js";
|
|
7
|
+
import { v as Q } from "../Viewport-DGnJ31b4.js";
|
|
8
|
+
import { ElementLinkedStore as pt } from "../element-linked-store/index.js";
|
|
8
9
|
import { i as ot } from "../index-LReFyN6i.js";
|
|
9
10
|
import { d as W } from "../events-CsVF98U6.js";
|
|
10
11
|
import { d as dt } from "../function-C10DGppn.js";
|
|
@@ -12,7 +13,6 @@ import { g as lt } from "../style-j2TwriJ_.js";
|
|
|
12
13
|
import "construct-style-sheets-polyfill";
|
|
13
14
|
import { u as ft, p as gt } from "../url-DAl-mgbC.js";
|
|
14
15
|
import { windowResizer as ct } from "../window-resizer/index.js";
|
|
15
|
-
import { v as Q } from "../Viewport-DGnJ31b4.js";
|
|
16
16
|
var f, w, tt, et;
|
|
17
17
|
class mt {
|
|
18
18
|
constructor() {
|
|
@@ -221,9 +221,12 @@ const k = class k extends HTMLElement {
|
|
|
221
221
|
trigger: t(this, z)
|
|
222
222
|
},
|
|
223
223
|
bubbles: !0
|
|
224
|
-
}), o(this, R, void 0), o(this, B, setTimeout(
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
}), o(this, R, void 0), o(this, B, setTimeout(
|
|
225
|
+
() => {
|
|
226
|
+
t(this, a).set("transitionend", !0), W(this, "popoverTransitionend");
|
|
227
|
+
},
|
|
228
|
+
lt(this) + 10
|
|
229
|
+
));
|
|
227
230
|
};
|
|
228
231
|
e != null && e.skipTransition ? s() : o(this, R, requestAnimationFrame(s));
|
|
229
232
|
}
|
|
@@ -232,12 +235,15 @@ const k = class k extends HTMLElement {
|
|
|
232
235
|
t(this, a).set("transitionend", !1), t(this, a).set("opened", !1), t(this, a).set("closing", !0), p(this, u, T).call(this, !1, this.openClass), p(this, u, T).call(this, !0, this.closingClass), W(this, "popoverClosing", {
|
|
233
236
|
custom: !0,
|
|
234
237
|
bubbles: !0
|
|
235
|
-
}), o(this, G, setTimeout(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
}), o(this, G, setTimeout(
|
|
239
|
+
() => {
|
|
240
|
+
t(this, a).set("triggered", !1), t(this, a).set("beforeopen", !1), t(this, a).set("closing", !1), p(this, u, T).call(this, !1, this.closingClass), W(this, "popoverClosed", {
|
|
241
|
+
custom: !0,
|
|
242
|
+
bubbles: !0
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
lt(this) + 10
|
|
246
|
+
));
|
|
241
247
|
}, 10)));
|
|
242
248
|
}
|
|
243
249
|
connectedCallback() {
|
package/lib/slicer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=i=>{throw TypeError(i)};var H=(i,e,s)=>e.has(i)||P("Cannot "+s);var t=(i,e,s)=>(H(i,e,"read from private field"),s?s.call(i):e.get(i)),c=(i,e,s)=>e.has(i)?P("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),o=(i,e,s,g)=>(H(i,e,"write to private field"),g?g.call(i,s):e.set(i,s),s),L=(i,e,s)=>(H(i,e,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../media/index.cjs"),q=require("../index-CKTweR3M.cjs");require("construct-style-sheets-polyfill");var A,u;class D{constructor(e){c(this,A);c(this,u);o(this,A,e.index),o(this,u,document.createElement("span")),t(this,u).classList.add("letter"),e.clone?t(this,u).innerHTML=`<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>`:t(this,u).innerHTML=`<span class="original"><span class="value">${e.text}</span></span>`}get index(){return t(this,A)}get element(){return t(this,u)}}A=new WeakMap,u=new WeakMap;var M,h,p,x;class S{constructor(e){c(this,M);c(this,h);c(this,p);c(this,x);if(o(this,M,e.index),o(this,h,document.createElement("span")),o(this,p,[]),o(this,x,e.text.endsWith("\\n")),t(this,x)&&(e.text=e.text.replace("\\n","")),e.letters&&e.lettersAcc!==void 0){let s=0;const g=/([\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF\-–—])/,T=e.text.split(g).filter(y=>y.trim()!=="");T.length>1&&t(this,h).classList.add("words-inside"),T.forEach((y,w,n)=>{const l=y.split("").map(r=>{if(r!==" ")return new D({index:e.lettersAcc+s++,text:r,clone:e.clone})});if(o(this,p,l.filter(r=>r instanceof D)),n.length>1){const r=document.createElement("span");r.append(...t(this,p).map(a=>a.element)),t(this,h).append(r),w!==n.length-1&&t(this,h).append(r)}else t(this,h).append(...t(this,p).map(r=>r.element))})}else e.clone?t(this,h).innerHTML=`<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>`:t(this,h).innerHTML=`<span class="original"><span class="value">${e.text}</span></span>`;t(this,h).classList.add("word")}get index(){return t(this,M)}get element(){return t(this,h)}get letters(){return t(this,p)}get hasNewLine(){return t(this,x)}}M=new WeakMap,h=new WeakMap,p=new WeakMap,x=new WeakMap;var m,d,E,N,f,_,O;class $ extends HTMLElement{constructor(){super(...arguments);c(this,f);c(this,m,"");c(this,d,[]);c(this,E,[]);c(this,N,null)}get wordsArray(){return t(this,d)}get lettersArray(){return t(this,E)}get originalHTML(){return t(this,m)}connectedCallback(){this.classList.contains("splitted")||(o(this,m,this.innerHTML.trim()),this.hasAttribute("media")?(o(this,N,new k.Media(this.getAttribute("media"))),t(this,N).subscribe(s=>{s.current?L(this,f,_).call(this):!s.current&&s.previous&&L(this,f,O).call(this)})):L(this,f,_).call(this),this.classList.add("splitted"))}disconnectedCallback(){var s;L(this,f,O).call(this),(s=t(this,N))==null||s.close()}}m=new WeakMap,d=new WeakMap,E=new WeakMap,N=new WeakMap,f=new WeakSet,_=function(){const s=[];o(this,d,[]);let g=0,T=0;const y=n=>{var a;const l=(a=n.textContent)==null?void 0:a.trim();if(!l)return document.createDocumentFragment();const r=document.createDocumentFragment();return l.replace(/[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g," ").split(" ").forEach((F,v,C)=>{if(!F)return;const b=new S({index:g,text:F+(v<C.length-1?" ":""),letters:this.hasAttribute("letters"),lettersAcc:T,clone:this.hasAttribute("clone")});T+=b.letters.length,g+=1,t(this,E).push(...b.letters),t(this,d).push(b),r.appendChild(b.element)}),r},w=n=>{if(n.nodeType===Node.TEXT_NODE)return y(n);if(n.nodeType===Node.ELEMENT_NODE){const l=n.cloneNode(!1);return Array.from(n.childNodes).forEach(r=>{const a=w(r);a&&(a.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(a.childNodes).forEach((F,v,C)=>{l.append(F),v!==C.length-1&&l.append(new Text(" "))}):l.appendChild(a))}),l}return n.cloneNode()};Array.from(this.childNodes).forEach(n=>{const l=w(n);l.nodeType===Node.DOCUMENT_FRAGMENT_NODE?s.push(...Array.from(l.childNodes)):s.push(l)}),this.hasAttribute("index")&&(t(this,d).forEach(n=>{n.element.style.setProperty("--word-index",n.index.toString())}),t(this,E).forEach(n=>{n.element.style.setProperty("--letter-index",n.index.toString())})),this.innerHTML="",s.forEach((n,l)=>{this.appendChild(n),l<s.length-1&&n.nodeType===Node.ELEMENT_NODE&&this.appendChild(new Text(" "))}),this.style.setProperty("--words-length",t(this,d).length.toString()),this.style.setProperty("--letters-length",t(this,E).length.toString())},O=function(){o(this,d,[]),this.innerHTML=t(this,m),this.style.removeProperty("--words-length"),this.style.removeProperty("--letters-length")};q.isBrowser&&!customElements.get("e-slicer")&&customElements.define("e-slicer",$);exports.Letter=D;exports.SlicerElement=$;exports.Word=S;
|
package/lib/slicer/index.js
CHANGED
|
@@ -1,145 +1,154 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var P = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (
|
|
4
|
+
var b = (i, e, s) => e.has(i) || P("Cannot " + s);
|
|
5
|
+
var t = (i, e, s) => (b(i, e, "read from private field"), s ? s.call(i) : e.get(i)), h = (i, e, s) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, s), o = (i, e, s, g) => (b(i, e, "write to private field"), g ? g.call(i, s) : e.set(i, s), s), L = (i, e, s) => (b(i, e, "access private method"), s);
|
|
6
6
|
import { Media as $ } from "../media/index.js";
|
|
7
7
|
import { i as S } from "../index-LReFyN6i.js";
|
|
8
8
|
import "construct-style-sheets-polyfill";
|
|
9
|
-
var
|
|
9
|
+
var A, u;
|
|
10
10
|
class _ {
|
|
11
11
|
constructor(e) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
o(this,
|
|
12
|
+
h(this, A);
|
|
13
|
+
h(this, u);
|
|
14
|
+
o(this, A, e.index), o(this, u, document.createElement("span")), t(this, u).classList.add("letter"), e.clone ? t(this, u).innerHTML = `<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>` : t(this, u).innerHTML = `<span class="original"><span class="value">${e.text}</span></span>`;
|
|
15
15
|
}
|
|
16
16
|
get index() {
|
|
17
|
-
return t(this,
|
|
17
|
+
return t(this, A);
|
|
18
18
|
}
|
|
19
19
|
get element() {
|
|
20
|
-
return t(this,
|
|
20
|
+
return t(this, u);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
var
|
|
23
|
+
A = new WeakMap(), u = new WeakMap();
|
|
24
|
+
var M, c, p, m;
|
|
25
25
|
class k {
|
|
26
26
|
constructor(e) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (o(this,
|
|
27
|
+
h(this, M);
|
|
28
|
+
h(this, c);
|
|
29
|
+
h(this, p);
|
|
30
|
+
h(this, m);
|
|
31
|
+
if (o(this, M, e.index), o(this, c, document.createElement("span")), o(this, p, []), o(this, m, e.text.endsWith("\\n")), t(this, m) && (e.text = e.text.replace("\\n", "")), e.letters && e.lettersAcc !== void 0) {
|
|
32
32
|
let s = 0;
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
const g = /([\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF\-–—])/, T = e.text.split(g).filter((y) => y.trim() !== "");
|
|
34
|
+
T.length > 1 && t(this, c).classList.add("words-inside"), T.forEach((y, w, n) => {
|
|
35
|
+
const l = y.split("").map((r) => {
|
|
36
|
+
if (r !== " ")
|
|
37
|
+
return new _({
|
|
38
|
+
index: e.lettersAcc + s++,
|
|
39
|
+
text: r,
|
|
40
|
+
clone: e.clone
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
if (o(this, p, l.filter((r) => r instanceof _)), n.length > 1) {
|
|
44
|
+
const r = document.createElement("span");
|
|
45
|
+
r.append(
|
|
46
|
+
...t(this, p).map((a) => a.element)
|
|
47
|
+
), t(this, c).append(r), w !== n.length - 1 && t(this, c).append(r);
|
|
48
|
+
} else
|
|
49
|
+
t(this, c).append(
|
|
50
|
+
...t(this, p).map((r) => r.element)
|
|
51
|
+
);
|
|
40
52
|
});
|
|
41
|
-
o(this, g, p.filter((h) => h instanceof _)), t(this, c).append(
|
|
42
|
-
...t(this, g).map((h) => h.element)
|
|
43
|
-
);
|
|
44
53
|
} else
|
|
45
54
|
e.clone ? t(this, c).innerHTML = `<span class="original"><span class="value">${e.text}</span></span><span class="clone" aria-hidden><span class="value">${e.text}</span></span>` : t(this, c).innerHTML = `<span class="original"><span class="value">${e.text}</span></span>`;
|
|
46
55
|
t(this, c).classList.add("word");
|
|
47
56
|
}
|
|
48
57
|
get index() {
|
|
49
|
-
return t(this,
|
|
58
|
+
return t(this, M);
|
|
50
59
|
}
|
|
51
60
|
get element() {
|
|
52
61
|
return t(this, c);
|
|
53
62
|
}
|
|
54
63
|
get letters() {
|
|
55
|
-
return t(this,
|
|
64
|
+
return t(this, p);
|
|
56
65
|
}
|
|
57
66
|
get hasNewLine() {
|
|
58
|
-
return t(this,
|
|
67
|
+
return t(this, m);
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
|
-
|
|
62
|
-
var
|
|
70
|
+
M = new WeakMap(), c = new WeakMap(), p = new WeakMap(), m = new WeakMap();
|
|
71
|
+
var x, d, E, N, f, D, O;
|
|
63
72
|
class G extends HTMLElement {
|
|
64
73
|
constructor() {
|
|
65
74
|
super(...arguments);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
h(this, f);
|
|
76
|
+
h(this, x, "");
|
|
77
|
+
h(this, d, []);
|
|
78
|
+
h(this, E, []);
|
|
79
|
+
h(this, N, null);
|
|
71
80
|
}
|
|
72
81
|
get wordsArray() {
|
|
73
|
-
return t(this,
|
|
82
|
+
return t(this, d);
|
|
74
83
|
}
|
|
75
84
|
get lettersArray() {
|
|
76
|
-
return t(this,
|
|
85
|
+
return t(this, E);
|
|
77
86
|
}
|
|
78
87
|
get originalHTML() {
|
|
79
|
-
return t(this,
|
|
88
|
+
return t(this, x);
|
|
80
89
|
}
|
|
81
90
|
connectedCallback() {
|
|
82
|
-
this.classList.contains("splitted") || (o(this,
|
|
83
|
-
s.current ?
|
|
84
|
-
})) :
|
|
91
|
+
this.classList.contains("splitted") || (o(this, x, this.innerHTML.trim()), this.hasAttribute("media") ? (o(this, N, new $(this.getAttribute("media"))), t(this, N).subscribe((s) => {
|
|
92
|
+
s.current ? L(this, f, D).call(this) : !s.current && s.previous && L(this, f, O).call(this);
|
|
93
|
+
})) : L(this, f, D).call(this), this.classList.add("splitted"));
|
|
85
94
|
}
|
|
86
95
|
disconnectedCallback() {
|
|
87
96
|
var s;
|
|
88
|
-
|
|
97
|
+
L(this, f, O).call(this), (s = t(this, N)) == null || s.close();
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
|
-
|
|
100
|
+
x = new WeakMap(), d = new WeakMap(), E = new WeakMap(), N = new WeakMap(), f = new WeakSet(), D = function() {
|
|
92
101
|
const s = [];
|
|
93
|
-
o(this,
|
|
94
|
-
let
|
|
95
|
-
const
|
|
96
|
-
var
|
|
97
|
-
const l = (
|
|
102
|
+
o(this, d, []);
|
|
103
|
+
let g = 0, T = 0;
|
|
104
|
+
const y = (n) => {
|
|
105
|
+
var a;
|
|
106
|
+
const l = (a = n.textContent) == null ? void 0 : a.trim();
|
|
98
107
|
if (!l) return document.createDocumentFragment();
|
|
99
|
-
const
|
|
108
|
+
const r = document.createDocumentFragment();
|
|
100
109
|
return l.replace(
|
|
101
110
|
/[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g,
|
|
102
111
|
" "
|
|
103
|
-
).split(" ").forEach((
|
|
104
|
-
if (!
|
|
105
|
-
const
|
|
106
|
-
index:
|
|
107
|
-
text:
|
|
112
|
+
).split(" ").forEach((F, C, H) => {
|
|
113
|
+
if (!F) return;
|
|
114
|
+
const v = new k({
|
|
115
|
+
index: g,
|
|
116
|
+
text: F + (C < H.length - 1 ? " " : ""),
|
|
108
117
|
letters: this.hasAttribute("letters"),
|
|
109
|
-
lettersAcc:
|
|
118
|
+
lettersAcc: T,
|
|
110
119
|
clone: this.hasAttribute("clone")
|
|
111
120
|
});
|
|
112
|
-
|
|
113
|
-
}),
|
|
114
|
-
},
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
117
|
-
if (
|
|
118
|
-
const l =
|
|
119
|
-
return Array.from(
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
l.append(
|
|
123
|
-
}) : l.appendChild(
|
|
121
|
+
T += v.letters.length, g += 1, t(this, E).push(...v.letters), t(this, d).push(v), r.appendChild(v.element);
|
|
122
|
+
}), r;
|
|
123
|
+
}, w = (n) => {
|
|
124
|
+
if (n.nodeType === Node.TEXT_NODE)
|
|
125
|
+
return y(n);
|
|
126
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
127
|
+
const l = n.cloneNode(!1);
|
|
128
|
+
return Array.from(n.childNodes).forEach((r) => {
|
|
129
|
+
const a = w(r);
|
|
130
|
+
a && (a.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? Array.from(a.childNodes).forEach((F, C, H) => {
|
|
131
|
+
l.append(F), C !== H.length - 1 && l.append(new Text(" "));
|
|
132
|
+
}) : l.appendChild(a));
|
|
124
133
|
}), l;
|
|
125
134
|
}
|
|
126
|
-
return
|
|
135
|
+
return n.cloneNode();
|
|
127
136
|
};
|
|
128
|
-
Array.from(this.childNodes).forEach((
|
|
129
|
-
const l =
|
|
137
|
+
Array.from(this.childNodes).forEach((n) => {
|
|
138
|
+
const l = w(n);
|
|
130
139
|
l.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? s.push(...Array.from(l.childNodes)) : s.push(l);
|
|
131
|
-
}), this.hasAttribute("index") && (t(this,
|
|
132
|
-
|
|
133
|
-
}), t(this,
|
|
134
|
-
|
|
140
|
+
}), this.hasAttribute("index") && (t(this, d).forEach((n) => {
|
|
141
|
+
n.element.style.setProperty("--word-index", n.index.toString());
|
|
142
|
+
}), t(this, E).forEach((n) => {
|
|
143
|
+
n.element.style.setProperty(
|
|
135
144
|
"--letter-index",
|
|
136
|
-
|
|
145
|
+
n.index.toString()
|
|
137
146
|
);
|
|
138
|
-
})), this.innerHTML = "", s.forEach((
|
|
139
|
-
this.appendChild(
|
|
140
|
-
}), this.style.setProperty("--words-length", t(this,
|
|
141
|
-
},
|
|
142
|
-
o(this,
|
|
147
|
+
})), this.innerHTML = "", s.forEach((n, l) => {
|
|
148
|
+
this.appendChild(n), l < s.length - 1 && n.nodeType === Node.ELEMENT_NODE && this.appendChild(new Text(" "));
|
|
149
|
+
}), this.style.setProperty("--words-length", t(this, d).length.toString()), this.style.setProperty("--letters-length", t(this, E).length.toString());
|
|
150
|
+
}, O = function() {
|
|
151
|
+
o(this, d, []), this.innerHTML = t(this, x), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
|
|
143
152
|
};
|
|
144
153
|
S && !customElements.get("e-slicer") && customElements.define("e-slicer", G);
|
|
145
154
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aptechka",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/denisavitski/aptechka.git"
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
},
|
|
451
451
|
"devDependencies": {
|
|
452
452
|
"@types/node": "^24.1.0",
|
|
453
|
-
"@types/three": "^0.
|
|
453
|
+
"@types/three": "^0.179.0",
|
|
454
454
|
"tsx": "^4.20.3",
|
|
455
455
|
"vite": "^7.0.6",
|
|
456
456
|
"vite-plugin-dts": "^4.5.4",
|