aptechka 0.11.4 → 0.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/client-lib/modal/index.cjs +1 -1
  2. package/client-lib/modal/index.js +7 -7
  3. package/client-lib/popover/index.cjs +1 -1
  4. package/client-lib/popover/index.js +67 -57
  5. package/package.json +1 -1
  6. package/server-lib/optimizer/index.js +11 -26
  7. package/server-lib/{server/optimizer → optimizer}/types.d.ts +2 -28
  8. package/server-lib/optimizer/utils.d.ts +1 -0
  9. package/server-lib/{server/utils → utils}/index.d.ts +1 -0
  10. package/server-lib/utils/index.js +4 -0
  11. package/server-lib/utils/math.d.ts +1 -0
  12. package/server-lib/server/optimizer/utils.d.ts +0 -4
  13. /package/server-lib/{server/optimizer → optimizer}/FFmpeg.d.ts +0 -0
  14. /package/server-lib/{server/optimizer → optimizer}/generateFavicon.d.ts +0 -0
  15. /package/server-lib/{server/optimizer → optimizer}/generateSequence.d.ts +0 -0
  16. /package/server-lib/{server/optimizer → optimizer}/generateSprite.d.ts +0 -0
  17. /package/server-lib/{server/optimizer → optimizer}/index.d.ts +0 -0
  18. /package/server-lib/{server/optimizer → optimizer}/inputFiles.d.ts +0 -0
  19. /package/server-lib/{server/optimizer → optimizer}/optimize.d.ts +0 -0
  20. /package/server-lib/{server/optimizer → optimizer}/optimizeImage.d.ts +0 -0
  21. /package/server-lib/{server/optimizer → optimizer}/optimizeVideo.d.ts +0 -0
  22. /package/server-lib/{server/optimizer → optimizer}/optimizer.d.ts +0 -0
  23. /package/server-lib/{server/utils → utils}/buffer.d.ts +0 -0
  24. /package/server-lib/{server/utils → utils}/fs.d.ts +0 -0
  25. /package/server-lib/{server/utils → utils}/path.d.ts +0 -0
  26. /package/server-lib/{server/utils → utils}/types.d.ts +0 -0
@@ -1 +1 @@
1
- "use strict";var d=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var i=(e,t,o)=>(d(e,t,"read from private field"),o?o.call(e):t.get(e)),a=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},c=(e,t,o,l)=>(d(e,t,"write to private field"),l?l.call(e,o):t.set(e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../Store-Cr3VaD9G.cjs");const h=require("../browser-CpzFX2xg.cjs");require("../ticker/index.cjs");const n=require("../tags-BdW7ATzD.cjs"),b=require("../createStylesheet-BBBiyAsF.cjs"),f=require("../popover/index.cjs"),m=require("../theme/index.cjs"),p=b.createStylesheet({":host":{position:"fixed",top:"0",left:"0",zIndex:"1",width:"100%",height:"100%",transitionProperty:"opacity",transitionDuration:"var(--transition-duration)"},":host::before":{content:'""',position:"fixed",top:"0",left:"0",zIndex:"-1",width:"100%",height:"100%",backgroundColor:"var(--backdrop, rgba(0, 0, 0, 0.8))"},".inner":{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden auto"},".overflow .inner":{alignItems:"flex-start"},".content":{position:"relative"},".close-button":{position:"absolute",zIndex:"1",top:"var(--close-button-top, 0.5em)",right:"var(--close-button-right, 0.5em)",background:"none",border:"none",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit"},".close-button-default":{width:"var(--close-button-size, 1.5em)",height:"var(--close-button-size, 1.5em)",display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"transform",transitionDuration:"var(--transition-duration)",willChange:"transform"},".close-button:hover .close-button-default":{transform:"scale(0.9)"},".close-button:active .close-button-default":{transform:"scale(0.7)"},".close-button-default::before, .close-button-default::after":{content:'""',position:"absolute",width:"var(--close-button-thickness, 0.1em)",height:"100%",backgroundColor:`var(--close-button-color, ${m.aptechkaTheme.colorMain.var})`},".close-button-default::before":{transform:"rotate(-45deg)"},".close-button-default::after":{transform:"rotate(45deg)"}});var s,r;class u extends f.PopoverElement{constructor(){super();a(this,s,null);a(this,r,null);h.isBrowser&&(this.attachShadow({mode:"open"}).adoptedStyleSheets.push(p),n.element(this,{children:n.div({class:"inner",outside:!0,children:n.div({class:"content",children:[n.element("e-popover-button",{type:"close",target:this.id,class:"close-button",lightChildren:[n.slot({name:"close-button",children:n.span({class:"close-button-default"})})]}),n.slot()]}),ref:l=>c(this,r,l)})}),c(this,s,new ResizeObserver(()=>{i(this,r).scrollHeight>i(this,r).clientHeight?this.classList.add("overflow"):this.classList.remove("overflow")})))}connectedCallback(){super.connectedCallback(),i(this,s).observe(this)}disconnectedCallback(){super.disconnectedCallback(),i(this,s).disconnect()}}s=new WeakMap,r=new WeakMap;customElements.get("e-modal")||customElements.define("e-modal",u);exports.ModalElement=u;
1
+ "use strict";var d=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var i=(e,t,o)=>(d(e,t,"read from private field"),o?o.call(e):t.get(e)),a=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},c=(e,t,o,l)=>(d(e,t,"write to private field"),l?l.call(e,o):t.set(e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../Store-Cr3VaD9G.cjs");const h=require("../browser-CpzFX2xg.cjs");require("../ticker/index.cjs");const n=require("../tags-BdW7ATzD.cjs"),b=require("../createStylesheet-BBBiyAsF.cjs"),f=require("../popover/index.cjs"),m=require("../theme/index.cjs"),p=b.createStylesheet({":host":{position:"fixed",top:"0",left:"0",zIndex:"1",width:"100%",height:"100%",transitionProperty:"opacity",transitionDuration:"var(--transition-duration)"},":host::before":{content:'""',position:"fixed",top:"0",left:"0",zIndex:"-1",width:"100%",height:"100%",backgroundColor:"var(--backdrop, rgba(0, 0, 0, 0.8))"},".inner":{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden auto"},".overflow .inner":{alignItems:"flex-start"},".content":{position:"relative"},".close-button":{position:"absolute",zIndex:"1",top:"var(--close-button-top, 0.5em)",right:"var(--close-button-right, 0.5em)",background:"none",border:"none",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit"},".close-button-default":{width:"var(--close-button-size, 1.5em)",height:"var(--close-button-size, 1.5em)",display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"transform",transitionDuration:"var(--transition-duration)",willChange:"transform"},".close-button:hover .close-button-default":{transform:"scale(0.9)"},".close-button:active .close-button-default":{transform:"scale(0.7)"},".close-button-default::before, .close-button-default::after":{content:'""',position:"absolute",width:"var(--close-button-thickness, 0.1em)",height:"100%",backgroundColor:`var(--close-button-color, ${m.aptechkaTheme.colorMain.var})`},".close-button-default::before":{transform:"rotate(-45deg)"},".close-button-default::after":{transform:"rotate(45deg)"}});var s,r;class u extends f.PopoverElement{constructor(){super();a(this,s,null);a(this,r,null);h.isBrowser&&(this.attachShadow({mode:"open"}).adoptedStyleSheets.push(p),n.element(this,{children:n.div({class:"inner",outside:!0,children:n.div({class:"content",children:[n.element("e-popover-button",{type:"close",target:"parent",class:"close-button",lightChildren:[n.slot({name:"close-button",children:n.span({class:"close-button-default"})})]}),n.slot()]}),ref:l=>c(this,r,l)})}),c(this,s,new ResizeObserver(()=>{i(this,r).scrollHeight>i(this,r).clientHeight?this.classList.add("overflow"):this.classList.remove("overflow")})))}connectedCallback(){super.connectedCallback(),i(this,s).observe(this)}disconnectedCallback(){super.disconnectedCallback(),i(this,s).disconnect()}}s=new WeakMap,r=new WeakMap;customElements.get("e-modal")||customElements.define("e-modal",u);exports.ModalElement=u;
@@ -2,11 +2,11 @@ var c = (t, e, o) => {
2
2
  if (!e.has(t))
3
3
  throw TypeError("Cannot " + o);
4
4
  };
5
- var i = (t, e, o) => (c(t, e, "read from private field"), o ? o.call(t) : e.get(t)), a = (t, e, o) => {
5
+ var r = (t, e, o) => (c(t, e, "read from private field"), o ? o.call(t) : e.get(t)), a = (t, e, o) => {
6
6
  if (e.has(t))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  e instanceof WeakSet ? e.add(t) : e.set(t, o);
9
- }, l = (t, e, o, r) => (c(t, e, "write to private field"), r ? r.call(t, o) : e.set(t, o), o);
9
+ }, l = (t, e, o, i) => (c(t, e, "write to private field"), i ? i.call(t, o) : e.set(t, o), o);
10
10
  import "../Store-Qr3SNOSf.js";
11
11
  import { i as f } from "../browser-0zX67oeU.js";
12
12
  import "../ticker/index.js";
@@ -105,7 +105,7 @@ class w extends p {
105
105
  children: [
106
106
  d("e-popover-button", {
107
107
  type: "close",
108
- target: this.id,
108
+ target: "parent",
109
109
  class: "close-button",
110
110
  lightChildren: [
111
111
  u({
@@ -117,17 +117,17 @@ class w extends p {
117
117
  u()
118
118
  ]
119
119
  }),
120
- ref: (r) => l(this, s, r)
120
+ ref: (i) => l(this, s, i)
121
121
  })
122
122
  }), l(this, n, new ResizeObserver(() => {
123
- i(this, s).scrollHeight > i(this, s).clientHeight ? this.classList.add("overflow") : this.classList.remove("overflow");
123
+ r(this, s).scrollHeight > r(this, s).clientHeight ? this.classList.add("overflow") : this.classList.remove("overflow");
124
124
  })));
125
125
  }
126
126
  connectedCallback() {
127
- super.connectedCallback(), i(this, n).observe(this);
127
+ super.connectedCallback(), r(this, n).observe(this);
128
128
  }
129
129
  disconnectedCallback() {
130
- super.disconnectedCallback(), i(this, n).disconnect();
130
+ super.disconnectedCallback(), r(this, n).disconnect();
131
131
  }
132
132
  }
133
133
  n = new WeakMap(), s = new WeakMap();
@@ -1 +1 @@
1
- "use strict";var q=(o,n,t)=>{if(!n.has(o))throw TypeError("Cannot "+t)};var e=(o,n,t)=>(q(o,n,"read from private field"),t?t.call(o):n.get(o)),i=(o,n,t)=>{if(n.has(o))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(o):n.set(o,t)},h=(o,n,t,a)=>(q(o,n,"write to private field"),a?a.call(o,t):n.set(o,t),t);var A=(o,n,t)=>(q(o,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../attribute/index.cjs"),I=require("../Store-Cr3VaD9G.cjs"),R=require("../style-At6aDoqG.cjs"),N=require("../browser-CpzFX2xg.cjs");require("../ticker/index.cjs");const j=require("../tags-BdW7ATzD.cjs");var m,l,y,p,d,u,_,x,v,L,f,E,b,M,g;const c=class c extends HTMLElement{constructor(){super();i(this,_);i(this,v);i(this,b);i(this,m,void 0);i(this,l,void 0);i(this,y,void 0);i(this,p,void 0);i(this,d,void 0);i(this,u,void 0);i(this,f,void 0);i(this,E,void 0);i(this,g,void 0);h(this,m,-1),h(this,l,new I.Store(!1)),h(this,p,new $.Attribute(this,"history",!1)),h(this,d,new $.Attribute(this,"single",!1)),h(this,u,!1),this.open=(t=!0)=>{if(e(this,l).current)return;e(this,l).current=!0,e(this,d).current&&(c.__opened.forEach(r=>r.close()),c.__opened=[]),c.__opened.push(this),h(this,m,c.__opened.length-1),e(this,p).current&&e(this,u)&&history.pushState("","",e(this,_,x)),clearTimeout(e(this,y)),this.classList.add("triggered"),this.style.display="block",this.dispatchEvent(new CustomEvent("popoverTriggered"));const a=()=>{addEventListener("click",e(this,f)),addEventListener("keydown",e(this,E)),this.style.opacity="1",this.classList.add("opened"),this.dispatchEvent(new CustomEvent("popoverOpened"))};t?setTimeout(a):a()},this.close=()=>{if(e(this,l).current){if(e(this,l).current=!1,c.__opened=c.__opened.filter(t=>t!==this),e(this,p).current){const t=new URL(location.href);t.searchParams.delete(e(this,v,L)),history.replaceState(null,"",t.href)}this.classList.remove("opened"),this.style.opacity="0",this.dispatchEvent(new CustomEvent("popoverClosing")),removeEventListener("click",e(this,f)),removeEventListener("keydown",e(this,E)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",this.dispatchEvent(new CustomEvent("popoverClosed"))},R.getElementTransitionDurationMS(this)+10)}},h(this,f,t=>{A(this,b,M).call(this,()=>{var O;const r=t.composedPath()[0],P=r instanceof HTMLElement&&(this.contains(r)||((O=this.shadowRoot)==null?void 0:O.contains(r))),B=r instanceof HTMLElement&&r.hasAttribute("outside");(!P||B)&&this.close()})}),h(this,E,t=>{A(this,b,M).call(this,()=>{t.code==="Escape"&&this.close()})}),h(this,g,()=>{h(this,u,!1),e(this,l).current&&e(this,p).current&&!location.search.includes(e(this,v,L))?this.close():!e(this,l).current&&e(this,p).current&&location.search.includes(e(this,v,L))&&this.open(),h(this,u,!0)}),this.setAttribute("popover-target","")}get history(){return e(this,p)}get single(){return e(this,d)}get opened(){return e(this,l)}connectedCallback(){e(this,p).observe(),e(this,d).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",e(this,g)),setTimeout(()=>{e(this,g).call(this)},0)}disconnectedCallback(){e(this,p).unobserve(),e(this,d).unobserve(),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,y)),removeEventListener("popstate",e(this,g))}};m=new WeakMap,l=new WeakMap,y=new WeakMap,p=new WeakMap,d=new WeakMap,u=new WeakMap,_=new WeakSet,x=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${e(this,v,L)}`},v=new WeakSet,L=function(){return`modal-${this.id}`},f=new WeakMap,E=new WeakMap,b=new WeakSet,M=function(t){(c.__opened[e(this,m)-1]||c.__opened.length===1)&&t()},g=new WeakMap,c.__opened=[];let S=c;customElements.get("e-popover")||customElements.define("e-popover",S);var s,T,w,C,k;class H extends HTMLElement{constructor(){super();i(this,s,void 0);i(this,T,()=>{this.classList.add("triggered")});i(this,w,()=>{this.classList.add("opened")});i(this,C,()=>{this.classList.remove("opened")});i(this,k,()=>{this.classList.remove("triggered")});N.isBrowser&&j.element(this,{tabindex:this.getAttribute("tabindex")||"0",onClick:()=>{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()}},onKeydown:t=>{t.code==="Space"&&t.currentTarget.click()}})}get popoverElement(){return e(this,s)}connectedCallback(){var a;const t=this.getAttribute("target");if(t){let r=null;t==="parent"?r=this.closest("[popover-target]"):t==="sibling"?r=(a=this.parentElement)==null?void 0:a.querySelector("[popover-target]"):r=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`),r instanceof HTMLElement?(h(this,s,r),e(this,s).addEventListener("popoverTriggered",e(this,T)),e(this,s).addEventListener("popoverOpened",e(this,w)),e(this,s).addEventListener("popoverClosing",e(this,C)),e(this,s).addEventListener("popoverClosed",e(this,k))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,s)&&(e(this,s).removeEventListener("popoverTriggered",e(this,T)),e(this,s).removeEventListener("popoverOpened",e(this,w)),e(this,s).removeEventListener("popoverClosing",e(this,C)),e(this,s).removeEventListener("popoverClosed",e(this,k)))}}s=new WeakMap,T=new WeakMap,w=new WeakMap,C=new WeakMap,k=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",H);exports.PopoverButtonElement=H;exports.PopoverElement=S;
1
+ "use strict";var M=(o,n,t)=>{if(!n.has(o))throw TypeError("Cannot "+t)};var e=(o,n,t)=>(M(o,n,"read from private field"),t?t.call(o):n.get(o)),i=(o,n,t)=>{if(n.has(o))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(o):n.set(o,t)},h=(o,n,t,a)=>(M(o,n,"write to private field"),a?a.call(o,t):n.set(o,t),t);var O=(o,n,t)=>(M(o,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("../attribute/index.cjs"),P=require("../Store-Cr3VaD9G.cjs"),B=require("../style-At6aDoqG.cjs"),I=require("../browser-CpzFX2xg.cjs");require("../ticker/index.cjs");const j=require("../tags-BdW7ATzD.cjs");var f,l,b,p,d,u,A,R,v,y,E,L,T,$,g;const c=class c extends HTMLElement{constructor(){super();i(this,A);i(this,v);i(this,T);i(this,f,void 0);i(this,l,void 0);i(this,b,void 0);i(this,p,void 0);i(this,d,void 0);i(this,u,void 0);i(this,E,void 0);i(this,L,void 0);i(this,g,void 0);h(this,f,-1),h(this,l,new P.Store(!1)),h(this,p,new H.Attribute(this,"history",!1)),h(this,d,new H.Attribute(this,"single",!1)),h(this,u,!1),this.open=(t=!0)=>{if(e(this,l).current)return;e(this,l).current=!0,e(this,d).current&&(c.__opened.forEach(r=>r.close()),c.__opened=[]),c.__opened.push(this),h(this,f,c.__opened.length-1),e(this,p).current&&e(this,u)&&history.pushState("","",e(this,A,R)),clearTimeout(e(this,b)),this.classList.add("triggered"),this.style.display="block",this.dispatchEvent(new CustomEvent("popoverTriggered"));const a=()=>{addEventListener("click",e(this,E)),addEventListener("keydown",e(this,L)),this.style.opacity="1",this.classList.add("opened"),this.dispatchEvent(new CustomEvent("popoverOpened"))};t?setTimeout(a):a()},this.close=()=>{if(e(this,l).current){if(e(this,l).current=!1,c.__opened=c.__opened.filter(t=>t!==this),e(this,p).current){const t=new URL(location.href);t.searchParams.delete(e(this,v,y)),history.replaceState(null,"",t.href)}this.classList.remove("opened"),this.style.opacity="0",this.dispatchEvent(new CustomEvent("popoverClosing")),removeEventListener("click",e(this,E)),removeEventListener("keydown",e(this,L)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",this.dispatchEvent(new CustomEvent("popoverClosed"))},B.getElementTransitionDurationMS(this)+10)}},h(this,E,t=>{O(this,T,$).call(this,()=>{var x;const r=t.composedPath()[0],_=r instanceof HTMLElement&&(this.contains(r)||((x=this.shadowRoot)==null?void 0:x.contains(r))),m=r instanceof HTMLElement&&r.hasAttribute("outside");(!_||m)&&this.close()})}),h(this,L,t=>{O(this,T,$).call(this,()=>{t.code==="Escape"&&this.close()})}),h(this,g,()=>{h(this,u,!1),e(this,l).current&&e(this,p).current&&!location.search.includes(e(this,v,y))?this.close():!e(this,l).current&&e(this,p).current&&location.search.includes(e(this,v,y))&&this.open(),h(this,u,!0)}),this.setAttribute("popover-target","")}get history(){return e(this,p)}get single(){return e(this,d)}get opened(){return e(this,l)}connectedCallback(){e(this,p).observe(),e(this,d).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",e(this,g)),setTimeout(()=>{e(this,g).call(this)},0)}disconnectedCallback(){e(this,p).unobserve(),e(this,d).unobserve(),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,b)),removeEventListener("popstate",e(this,g))}};f=new WeakMap,l=new WeakMap,b=new WeakMap,p=new WeakMap,d=new WeakMap,u=new WeakMap,A=new WeakSet,R=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${e(this,v,y)}`},v=new WeakSet,y=function(){return`modal-${this.id}`},E=new WeakMap,L=new WeakMap,T=new WeakSet,$=function(t){(c.__opened[e(this,f)-1]||c.__opened.length===1)&&t()},g=new WeakMap,c.__opened=[];let q=c;customElements.get("e-popover")||customElements.define("e-popover",q);var s,w,C,k,S;class N extends HTMLElement{constructor(){super();i(this,s,void 0);i(this,w,()=>{this.classList.add("triggered")});i(this,C,()=>{this.classList.add("opened")});i(this,k,()=>{this.classList.remove("opened")});i(this,S,()=>{this.classList.remove("triggered")});I.isBrowser&&j.element(this,{tabindex:this.getAttribute("tabindex")||"0",onClick:()=>{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()}},onKeydown:t=>{t.code==="Space"&&t.currentTarget.click()}})}get popoverElement(){return e(this,s)}connectedCallback(){var a;const t=this.getAttribute("target");if(t){let r=null;if(t==="parent"){const _=this.closest("[popover-target]");if(_)r=_;else{const m=this.getRootNode();m instanceof ShadowRoot?r=m.host.closest("[popover-target]"):m instanceof HTMLElement&&(r=m.closest("[popover-target]"))}}else t==="sibling"?r=(a=this.parentElement)==null?void 0:a.querySelector("[popover-target]"):r=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);r instanceof HTMLElement?(h(this,s,r),e(this,s).addEventListener("popoverTriggered",e(this,w)),e(this,s).addEventListener("popoverOpened",e(this,C)),e(this,s).addEventListener("popoverClosing",e(this,k)),e(this,s).addEventListener("popoverClosed",e(this,S))):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,C)),e(this,s).removeEventListener("popoverClosing",e(this,k)),e(this,s).removeEventListener("popoverClosed",e(this,S)))}}s=new WeakMap,w=new WeakMap,C=new WeakMap,k=new WeakMap,S=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",N);exports.PopoverButtonElement=N;exports.PopoverElement=q;
@@ -1,65 +1,65 @@
1
- var S = (o, n, t) => {
1
+ var M = (o, n, t) => {
2
2
  if (!n.has(o))
3
3
  throw TypeError("Cannot " + t);
4
4
  };
5
- var e = (o, n, t) => (S(o, n, "read from private field"), t ? t.call(o) : n.get(o)), i = (o, n, t) => {
5
+ var e = (o, n, t) => (M(o, n, "read from private field"), t ? t.call(o) : n.get(o)), i = (o, n, t) => {
6
6
  if (n.has(o))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  n instanceof WeakSet ? n.add(o) : n.set(o, t);
9
- }, h = (o, n, t, a) => (S(o, n, "write to private field"), a ? a.call(o, t) : n.set(o, t), t);
10
- var A = (o, n, t) => (S(o, n, "access private method"), t);
11
- import { Attribute as O } from "../attribute/index.js";
12
- import { S as R } from "../Store-Qr3SNOSf.js";
13
- import { g as B } from "../style-j2TwriJ_.js";
14
- import { i as N } from "../browser-0zX67oeU.js";
9
+ }, h = (o, n, t, a) => (M(o, n, "write to private field"), a ? a.call(o, t) : n.set(o, t), t);
10
+ var $ = (o, n, t) => (M(o, n, "access private method"), t);
11
+ import { Attribute as R } from "../attribute/index.js";
12
+ import { S as q } from "../Store-Qr3SNOSf.js";
13
+ import { g as I } from "../style-j2TwriJ_.js";
14
+ import { i as B } from "../browser-0zX67oeU.js";
15
15
  import "../ticker/index.js";
16
16
  import { e as D } from "../tags-C75owfOo.js";
17
- var g, c, y, l, d, u, _, H, v, L, f, E, b, x, m;
17
+ var f, c, T, l, d, u, A, N, v, y, E, L, b, H, g;
18
18
  const p = class p extends HTMLElement {
19
19
  constructor() {
20
20
  super();
21
- i(this, _);
21
+ i(this, A);
22
22
  i(this, v);
23
23
  i(this, b);
24
- i(this, g, void 0);
24
+ i(this, f, void 0);
25
25
  i(this, c, void 0);
26
- i(this, y, void 0);
26
+ i(this, T, void 0);
27
27
  i(this, l, void 0);
28
28
  i(this, d, void 0);
29
29
  i(this, u, void 0);
30
- i(this, f, void 0);
31
30
  i(this, E, void 0);
32
- i(this, m, void 0);
33
- h(this, g, -1), h(this, c, new R(!1)), h(this, l, new O(this, "history", !1)), h(this, d, new O(this, "single", !1)), h(this, u, !1), this.open = (t = !0) => {
31
+ i(this, L, void 0);
32
+ i(this, g, void 0);
33
+ h(this, f, -1), h(this, c, new q(!1)), h(this, l, new R(this, "history", !1)), h(this, d, new R(this, "single", !1)), h(this, u, !1), this.open = (t = !0) => {
34
34
  if (e(this, c).current)
35
35
  return;
36
- e(this, c).current = !0, e(this, d).current && (p.__opened.forEach((r) => r.close()), p.__opened = []), p.__opened.push(this), h(this, g, p.__opened.length - 1), e(this, l).current && e(this, u) && history.pushState("", "", e(this, _, H)), clearTimeout(e(this, y)), this.classList.add("triggered"), this.style.display = "block", this.dispatchEvent(new CustomEvent("popoverTriggered"));
36
+ e(this, c).current = !0, e(this, d).current && (p.__opened.forEach((r) => r.close()), p.__opened = []), p.__opened.push(this), h(this, f, p.__opened.length - 1), e(this, l).current && e(this, u) && history.pushState("", "", e(this, A, N)), clearTimeout(e(this, T)), this.classList.add("triggered"), this.style.display = "block", this.dispatchEvent(new CustomEvent("popoverTriggered"));
37
37
  const a = () => {
38
- addEventListener("click", e(this, f)), addEventListener("keydown", e(this, E)), this.style.opacity = "1", this.classList.add("opened"), this.dispatchEvent(new CustomEvent("popoverOpened"));
38
+ addEventListener("click", e(this, E)), addEventListener("keydown", e(this, L)), this.style.opacity = "1", this.classList.add("opened"), this.dispatchEvent(new CustomEvent("popoverOpened"));
39
39
  };
40
40
  t ? setTimeout(a) : a();
41
41
  }, this.close = () => {
42
42
  if (e(this, c).current) {
43
43
  if (e(this, c).current = !1, p.__opened = p.__opened.filter((t) => t !== this), e(this, l).current) {
44
44
  const t = new URL(location.href);
45
- t.searchParams.delete(e(this, v, L)), history.replaceState(null, "", t.href);
45
+ t.searchParams.delete(e(this, v, y)), history.replaceState(null, "", t.href);
46
46
  }
47
- this.classList.remove("opened"), this.style.opacity = "0", this.dispatchEvent(new CustomEvent("popoverClosing")), removeEventListener("click", e(this, f)), removeEventListener("keydown", e(this, E)), setTimeout(() => {
47
+ this.classList.remove("opened"), this.style.opacity = "0", this.dispatchEvent(new CustomEvent("popoverClosing")), removeEventListener("click", e(this, E)), removeEventListener("keydown", e(this, L)), setTimeout(() => {
48
48
  this.classList.remove("triggered"), this.style.display = "none", this.dispatchEvent(new CustomEvent("popoverClosed"));
49
- }, B(this) + 10);
49
+ }, I(this) + 10);
50
50
  }
51
- }, h(this, f, (t) => {
52
- A(this, b, x).call(this, () => {
53
- var M;
54
- const r = t.composedPath()[0], q = r instanceof HTMLElement && (this.contains(r) || ((M = this.shadowRoot) == null ? void 0 : M.contains(r))), I = r instanceof HTMLElement && r.hasAttribute("outside");
55
- (!q || I) && this.close();
51
+ }, h(this, E, (t) => {
52
+ $(this, b, H).call(this, () => {
53
+ var O;
54
+ const r = t.composedPath()[0], _ = r instanceof HTMLElement && (this.contains(r) || ((O = this.shadowRoot) == null ? void 0 : O.contains(r))), m = r instanceof HTMLElement && r.hasAttribute("outside");
55
+ (!_ || m) && this.close();
56
56
  });
57
- }), h(this, E, (t) => {
58
- A(this, b, x).call(this, () => {
57
+ }), h(this, L, (t) => {
58
+ $(this, b, H).call(this, () => {
59
59
  t.code === "Escape" && this.close();
60
60
  });
61
- }), h(this, m, () => {
62
- h(this, u, !1), e(this, c).current && e(this, l).current && !location.search.includes(e(this, v, L)) ? this.close() : !e(this, c).current && e(this, l).current && location.search.includes(e(this, v, L)) && this.open(), h(this, u, !0);
61
+ }), h(this, g, () => {
62
+ h(this, u, !1), e(this, c).current && e(this, l).current && !location.search.includes(e(this, v, y)) ? this.close() : !e(this, c).current && e(this, l).current && location.search.includes(e(this, v, y)) && this.open(), h(this, u, !0);
63
63
  }), this.setAttribute("popover-target", "");
64
64
  }
65
65
  get history() {
@@ -72,41 +72,41 @@ const p = class p extends HTMLElement {
72
72
  return e(this, c);
73
73
  }
74
74
  connectedCallback() {
75
- e(this, l).observe(), e(this, d).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", e(this, m)), setTimeout(() => {
76
- e(this, m).call(this);
75
+ e(this, l).observe(), e(this, d).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", e(this, g)), setTimeout(() => {
76
+ e(this, g).call(this);
77
77
  }, 0);
78
78
  }
79
79
  disconnectedCallback() {
80
- e(this, l).unobserve(), e(this, d).unobserve(), p.__opened = p.__opened.filter((t) => t !== this), clearTimeout(e(this, y)), removeEventListener("popstate", e(this, m));
80
+ e(this, l).unobserve(), e(this, d).unobserve(), p.__opened = p.__opened.filter((t) => t !== this), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, g));
81
81
  }
82
82
  };
83
- g = new WeakMap(), c = new WeakMap(), y = new WeakMap(), l = new WeakMap(), d = new WeakMap(), u = new WeakMap(), _ = new WeakSet(), H = function() {
84
- return `${location.pathname}${location.search ? location.search + "&" : "?"}${e(this, v, L)}`;
85
- }, v = new WeakSet(), L = function() {
83
+ f = new WeakMap(), c = new WeakMap(), T = new WeakMap(), l = new WeakMap(), d = new WeakMap(), u = new WeakMap(), A = new WeakSet(), N = function() {
84
+ return `${location.pathname}${location.search ? location.search + "&" : "?"}${e(this, v, y)}`;
85
+ }, v = new WeakSet(), y = function() {
86
86
  return `modal-${this.id}`;
87
- }, f = new WeakMap(), E = new WeakMap(), b = new WeakSet(), x = function(t) {
88
- (p.__opened[e(this, g) - 1] || p.__opened.length === 1) && t();
89
- }, m = new WeakMap(), p.__opened = [];
90
- let $ = p;
91
- customElements.get("e-popover") || customElements.define("e-popover", $);
92
- var s, T, w, C, k;
87
+ }, E = new WeakMap(), L = new WeakMap(), b = new WeakSet(), H = function(t) {
88
+ (p.__opened[e(this, f) - 1] || p.__opened.length === 1) && t();
89
+ }, g = new WeakMap(), p.__opened = [];
90
+ let x = p;
91
+ customElements.get("e-popover") || customElements.define("e-popover", x);
92
+ var s, w, C, k, S;
93
93
  class K extends HTMLElement {
94
94
  constructor() {
95
95
  super();
96
96
  i(this, s, void 0);
97
- i(this, T, () => {
97
+ i(this, w, () => {
98
98
  this.classList.add("triggered");
99
99
  });
100
- i(this, w, () => {
100
+ i(this, C, () => {
101
101
  this.classList.add("opened");
102
102
  });
103
- i(this, C, () => {
103
+ i(this, k, () => {
104
104
  this.classList.remove("opened");
105
105
  });
106
- i(this, k, () => {
106
+ i(this, S, () => {
107
107
  this.classList.remove("triggered");
108
108
  });
109
- N && D(this, {
109
+ B && D(this, {
110
110
  tabindex: this.getAttribute("tabindex") || "0",
111
111
  onClick: () => {
112
112
  if (e(this, s)) {
@@ -127,40 +127,50 @@ class K extends HTMLElement {
127
127
  const t = this.getAttribute("target");
128
128
  if (t) {
129
129
  let r = null;
130
- t === "parent" ? r = this.closest("[popover-target]") : t === "sibling" ? r = (a = this.parentElement) == null ? void 0 : a.querySelector("[popover-target]") : r = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`), r instanceof HTMLElement ? (h(this, s, r), e(this, s).addEventListener(
130
+ if (t === "parent") {
131
+ const _ = this.closest("[popover-target]");
132
+ if (_)
133
+ r = _;
134
+ else {
135
+ const m = this.getRootNode();
136
+ m instanceof ShadowRoot ? r = m.host.closest("[popover-target]") : m instanceof HTMLElement && (r = m.closest("[popover-target]"));
137
+ }
138
+ } else
139
+ t === "sibling" ? r = (a = this.parentElement) == null ? void 0 : a.querySelector("[popover-target]") : r = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
140
+ r instanceof HTMLElement ? (h(this, s, r), e(this, s).addEventListener(
131
141
  "popoverTriggered",
132
- e(this, T)
142
+ e(this, w)
133
143
  ), e(this, s).addEventListener(
134
144
  "popoverOpened",
135
- e(this, w)
145
+ e(this, C)
136
146
  ), e(this, s).addEventListener(
137
147
  "popoverClosing",
138
- e(this, C)
148
+ e(this, k)
139
149
  ), e(this, s).addEventListener(
140
150
  "popoverClosed",
141
- e(this, k)
151
+ e(this, S)
142
152
  )) : console.warn(this, `target ${t} not found`);
143
153
  }
144
154
  }
145
155
  disconnectedCallback() {
146
156
  e(this, s) && (e(this, s).removeEventListener(
147
157
  "popoverTriggered",
148
- e(this, T)
158
+ e(this, w)
149
159
  ), e(this, s).removeEventListener(
150
160
  "popoverOpened",
151
- e(this, w)
161
+ e(this, C)
152
162
  ), e(this, s).removeEventListener(
153
163
  "popoverClosing",
154
- e(this, C)
164
+ e(this, k)
155
165
  ), e(this, s).removeEventListener(
156
166
  "popoverClosed",
157
- e(this, k)
167
+ e(this, S)
158
168
  ));
159
169
  }
160
170
  }
161
- s = new WeakMap(), T = new WeakMap(), w = new WeakMap(), C = new WeakMap(), k = new WeakMap();
171
+ s = new WeakMap(), w = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap();
162
172
  customElements.get("e-popover-button") || customElements.define("e-popover-button", K);
163
173
  export {
164
174
  K as PopoverButtonElement,
165
- $ as PopoverElement
175
+ x as PopoverElement
166
176
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readFile, readdir } from "fs/promises";
2
2
  import { dirname, join, sep, extname } from "path";
3
3
  import Ffmpeg from "fluent-ffmpeg";
4
- import { getTmpPath, outputFile, getFolderFiles, removeExtension, clear, getBuffer, replaceExtension, outputFiles } from "../utils/index.js";
4
+ import { getTmpPath, outputFile, getFolderFiles, removeExtension, clear, getBuffer, clamp, replaceExtension, outputFiles } from "../utils/index.js";
5
5
  import favicons from "favicons";
6
6
  import { parse } from "node-html-parser";
7
7
  import { statSync } from "fs";
@@ -236,10 +236,6 @@ async function inputFiles({
236
236
  webp: false,
237
237
  destinationPath,
238
238
  ...(_d = settings == null ? void 0 : settings.image) == null ? void 0 : _d.call(settings, { destinationPath })
239
- },
240
- restrictions: {
241
- quality: { min: 0, max: 100 },
242
- scale: { min: 0, max: 1 }
243
239
  }
244
240
  });
245
241
  } else if (ALLOWED_VIDEO_EXTENSIONS.includes(
@@ -254,11 +250,6 @@ async function inputFiles({
254
250
  fps: 0,
255
251
  destinationPath,
256
252
  ...(_e = settings == null ? void 0 : settings.video) == null ? void 0 : _e.call(settings, { destinationPath })
257
- },
258
- restrictions: {
259
- quality: { min: 0, max: 100 },
260
- scale: { min: 0, max: 1 },
261
- fps: { min: 0, max: 300 }
262
253
  }
263
254
  });
264
255
  } else {
@@ -273,17 +264,14 @@ async function inputFiles({
273
264
  }
274
265
  return sources;
275
266
  }
276
- function clamp(number, min = 0, max = 0) {
277
- return Math.max(min, Math.min(number, max));
278
- }
279
- function getNumberSetting(value, restricstions) {
280
- if (typeof value === "number" && restricstions) {
281
- return clamp(value, restricstions.min, restricstions.max);
267
+ function getNumberSetting(value, min, max) {
268
+ if (typeof value === "number") {
269
+ return clamp(value, min, max);
282
270
  }
283
271
  return value;
284
272
  }
285
273
  async function optimizeImage(source) {
286
- const { settings, restrictions } = source;
274
+ const { settings } = source;
287
275
  const content = await getBuffer(source.content);
288
276
  const ext = extname(settings.destinationPath).toLowerCase();
289
277
  const image = sharp(content);
@@ -291,8 +279,8 @@ async function optimizeImage(source) {
291
279
  const width = meta.width;
292
280
  const height = meta.height;
293
281
  const output = [];
294
- const scale = getNumberSetting(settings.scale, restrictions == null ? void 0 : restrictions.scale);
295
- const quality = getNumberSetting(settings.quality, restrictions == null ? void 0 : restrictions.quality);
282
+ const scale = getNumberSetting(settings.scale, 0, 1);
283
+ const quality = getNumberSetting(settings.quality, 0, 100);
296
284
  if (width && height) {
297
285
  if (scale) {
298
286
  image.resize(Math.floor(width * scale), Math.floor(height * scale));
@@ -339,14 +327,11 @@ async function optimizeImage(source) {
339
327
  return output;
340
328
  }
341
329
  async function optimizeVideo(source) {
342
- const { settings, restrictions } = source;
330
+ const { settings } = source;
343
331
  const buffer = await getBuffer(source.content);
344
- const quality = getNumberSetting(
345
- (settings == null ? void 0 : settings.quality) || 80,
346
- restrictions == null ? void 0 : restrictions.quality
347
- );
348
- const fps = getNumberSetting((settings == null ? void 0 : settings.fps) || 0, restrictions == null ? void 0 : restrictions.fps);
349
- const scale = getNumberSetting((settings == null ? void 0 : settings.scale) || 1, restrictions == null ? void 0 : restrictions.scale);
332
+ const quality = getNumberSetting((settings == null ? void 0 : settings.quality) || 80, 0, 100);
333
+ const fps = getNumberSetting((settings == null ? void 0 : settings.fps) || 0, 0, 300);
334
+ const scale = getNumberSetting((settings == null ? void 0 : settings.scale) || 1, 0, 1);
350
335
  return FFmpeg({
351
336
  inputPath: settings.destinationPath,
352
337
  fileContent: buffer,
@@ -6,15 +6,11 @@ export type SourceDefaultSettings = {
6
6
  export type SourceSetting = {
7
7
  value: any;
8
8
  };
9
- export type Source<B = Buffer | File, T extends string = string, S extends SourceDefaultSettings = {}, R extends Partial<{
10
- [K in keyof S]: any;
11
- }> | undefined = undefined> = {
9
+ export type Source<B = Buffer | File, T extends string = string, S extends SourceDefaultSettings = {}> = {
12
10
  content: B;
13
11
  type: T;
14
12
  settings: S;
15
- } & (R extends undefined ? {} : {
16
- restrictions?: Partial<R>;
17
- });
13
+ };
18
14
  export type SkipSource = Source<Buffer | File, 'skip', {
19
15
  destinationPath: string;
20
16
  }>;
@@ -24,34 +20,12 @@ export type ImageSource = Source<Buffer | File, 'image', {
24
20
  scale?: number;
25
21
  placeholder?: boolean;
26
22
  webp?: boolean;
27
- }, {
28
- quality: {
29
- min: 0;
30
- max: 100;
31
- };
32
- scale: {
33
- min: 0;
34
- max: 1;
35
- };
36
23
  }>;
37
24
  export type VideoSource = Source<Buffer | File, 'video', {
38
25
  destinationPath: string;
39
26
  quality?: number;
40
27
  scale?: number;
41
28
  fps?: number;
42
- }, {
43
- quality: {
44
- min: 0;
45
- max: 100;
46
- };
47
- scale: {
48
- min: 0;
49
- max: 1;
50
- };
51
- fps: {
52
- min: 0;
53
- max: 300;
54
- };
55
29
  }>;
56
30
  export type FaviconSource = Source<Buffer | File, 'favicon', {
57
31
  destinationPath: string;
@@ -0,0 +1 @@
1
+ export declare function getNumberSetting<T extends number | undefined>(value: T, min: number, max: number): number | T;
@@ -1,4 +1,5 @@
1
1
  export { getBuffer } from './buffer';
2
2
  export { removeExtension, replaceExtension, getTmpPath } from './path';
3
3
  export { outputFile, outputFiles, clear, getFolderFiles } from './fs';
4
+ export { clamp } from './math';
4
5
  export type { WriteFileData, OutputItem, Output } from './types';
@@ -49,7 +49,11 @@ async function getFolderFiles(folderPath) {
49
49
  }
50
50
  return files;
51
51
  }
52
+ function clamp(number, min = 0, max = 0) {
53
+ return Math.max(min, Math.min(number, max));
54
+ }
52
55
  export {
56
+ clamp,
53
57
  clear,
54
58
  getBuffer,
55
59
  getFolderFiles,
@@ -0,0 +1 @@
1
+ export declare function clamp(number: number, min?: number, max?: number): number;
@@ -1,4 +0,0 @@
1
- export declare function getNumberSetting<T extends number | undefined>(value: T, restricstions?: {
2
- min: number;
3
- max: number;
4
- }): number | T;
File without changes
File without changes
File without changes
File without changes