aptechka 0.11.5 → 0.11.7
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.
|
@@ -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:
|
|
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
|
|
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,
|
|
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:
|
|
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: (
|
|
120
|
+
ref: (i) => l(this, s, i)
|
|
121
121
|
})
|
|
122
122
|
}), l(this, n, new ResizeObserver(() => {
|
|
123
|
-
|
|
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(),
|
|
127
|
+
super.connectedCallback(), r(this, n).observe(this);
|
|
128
128
|
}
|
|
129
129
|
disconnectedCallback() {
|
|
130
|
-
super.disconnectedCallback(),
|
|
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
|
|
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
|
|
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) => (
|
|
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) => (
|
|
10
|
-
var
|
|
11
|
-
import { Attribute as
|
|
12
|
-
import { S as
|
|
13
|
-
import { g as
|
|
14
|
-
import { i as
|
|
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
|
|
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,
|
|
24
|
+
i(this, f, void 0);
|
|
25
25
|
i(this, c, void 0);
|
|
26
|
-
i(this,
|
|
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,
|
|
33
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
},
|
|
49
|
+
}, I(this) + 10);
|
|
50
50
|
}
|
|
51
|
-
}, h(this,
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
const r = t.composedPath()[0],
|
|
55
|
-
(!
|
|
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,
|
|
58
|
-
|
|
57
|
+
}), h(this, L, (t) => {
|
|
58
|
+
$(this, b, H).call(this, () => {
|
|
59
59
|
t.code === "Escape" && this.close();
|
|
60
60
|
});
|
|
61
|
-
}), h(this,
|
|
62
|
-
h(this, u, !1), e(this, c).current && e(this, l).current && !location.search.includes(e(this, v,
|
|
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,
|
|
76
|
-
e(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,
|
|
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
|
-
|
|
84
|
-
return `${location.pathname}${location.search ? location.search + "&" : "?"}${e(this, v,
|
|
85
|
-
}, v = new WeakSet(),
|
|
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
|
-
},
|
|
88
|
-
(p.__opened[e(this,
|
|
89
|
-
},
|
|
90
|
-
let
|
|
91
|
-
customElements.get("e-popover") || customElements.define("e-popover",
|
|
92
|
-
var s,
|
|
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,
|
|
97
|
+
i(this, w, () => {
|
|
98
98
|
this.classList.add("triggered");
|
|
99
99
|
});
|
|
100
|
-
i(this,
|
|
100
|
+
i(this, C, () => {
|
|
101
101
|
this.classList.add("opened");
|
|
102
102
|
});
|
|
103
|
-
i(this,
|
|
103
|
+
i(this, k, () => {
|
|
104
104
|
this.classList.remove("opened");
|
|
105
105
|
});
|
|
106
|
-
i(this,
|
|
106
|
+
i(this, S, () => {
|
|
107
107
|
this.classList.remove("triggered");
|
|
108
108
|
});
|
|
109
|
-
|
|
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
|
-
|
|
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,
|
|
142
|
+
e(this, w)
|
|
133
143
|
), e(this, s).addEventListener(
|
|
134
144
|
"popoverOpened",
|
|
135
|
-
e(this,
|
|
145
|
+
e(this, C)
|
|
136
146
|
), e(this, s).addEventListener(
|
|
137
147
|
"popoverClosing",
|
|
138
|
-
e(this,
|
|
148
|
+
e(this, k)
|
|
139
149
|
), e(this, s).addEventListener(
|
|
140
150
|
"popoverClosed",
|
|
141
|
-
e(this,
|
|
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,
|
|
158
|
+
e(this, w)
|
|
149
159
|
), e(this, s).removeEventListener(
|
|
150
160
|
"popoverOpened",
|
|
151
|
-
e(this,
|
|
161
|
+
e(this, C)
|
|
152
162
|
), e(this, s).removeEventListener(
|
|
153
163
|
"popoverClosing",
|
|
154
|
-
e(this,
|
|
164
|
+
e(this, k)
|
|
155
165
|
), e(this, s).removeEventListener(
|
|
156
166
|
"popoverClosed",
|
|
157
|
-
e(this,
|
|
167
|
+
e(this, S)
|
|
158
168
|
));
|
|
159
169
|
}
|
|
160
170
|
}
|
|
161
|
-
s = 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
|
-
|
|
175
|
+
x as PopoverElement
|
|
166
176
|
};
|
package/package.json
CHANGED
|
@@ -234,6 +234,7 @@ async function inputFiles({
|
|
|
234
234
|
quality: 80,
|
|
235
235
|
scale: 1,
|
|
236
236
|
webp: false,
|
|
237
|
+
forceJPG: false,
|
|
237
238
|
destinationPath,
|
|
238
239
|
...(_d = settings == null ? void 0 : settings.image) == null ? void 0 : _d.call(settings, { destinationPath })
|
|
239
240
|
}
|
|
@@ -273,7 +274,6 @@ function getNumberSetting(value, min, max) {
|
|
|
273
274
|
async function optimizeImage(source) {
|
|
274
275
|
const { settings } = source;
|
|
275
276
|
const content = await getBuffer(source.content);
|
|
276
|
-
const ext = extname(settings.destinationPath).toLowerCase();
|
|
277
277
|
const image = sharp(content);
|
|
278
278
|
const meta = await image.metadata();
|
|
279
279
|
const width = meta.width;
|
|
@@ -281,6 +281,8 @@ async function optimizeImage(source) {
|
|
|
281
281
|
const output = [];
|
|
282
282
|
const scale = getNumberSetting(settings.scale, 0, 1);
|
|
283
283
|
const quality = getNumberSetting(settings.quality, 0, 100);
|
|
284
|
+
let destinationPath = settings.destinationPath;
|
|
285
|
+
let ext = extname(destinationPath).toLowerCase();
|
|
284
286
|
if (width && height) {
|
|
285
287
|
if (scale) {
|
|
286
288
|
image.resize(Math.floor(width * scale), Math.floor(height * scale));
|
|
@@ -292,17 +294,26 @@ async function optimizeImage(source) {
|
|
|
292
294
|
quality
|
|
293
295
|
});
|
|
294
296
|
} else if (ext === ".png") {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
if (settings.forceJPG) {
|
|
298
|
+
const bg = typeof settings.forceJPG === "string" ? settings.forceJPG : "#ffffff";
|
|
299
|
+
image.jpeg({
|
|
300
|
+
mozjpeg: true
|
|
301
|
+
}).flatten({ background: bg });
|
|
302
|
+
destinationPath = replaceExtension(settings.destinationPath, "jpg");
|
|
303
|
+
ext = ".jpg";
|
|
304
|
+
} else {
|
|
305
|
+
image.png({
|
|
306
|
+
compressionLevel: 9,
|
|
307
|
+
adaptiveFiltering: true,
|
|
308
|
+
quality,
|
|
309
|
+
effort: 8
|
|
310
|
+
});
|
|
311
|
+
}
|
|
301
312
|
}
|
|
302
313
|
const buffer = await image.toBuffer();
|
|
303
314
|
output.push({
|
|
304
315
|
data: buffer,
|
|
305
|
-
destinationPath
|
|
316
|
+
destinationPath
|
|
306
317
|
});
|
|
307
318
|
if (settings == null ? void 0 : settings.webp) {
|
|
308
319
|
const buffer2 = await image.webp({
|
|
@@ -311,17 +322,14 @@ async function optimizeImage(source) {
|
|
|
311
322
|
}).toBuffer();
|
|
312
323
|
output.push({
|
|
313
324
|
data: buffer2,
|
|
314
|
-
destinationPath: replaceExtension(
|
|
325
|
+
destinationPath: replaceExtension(destinationPath, "webp")
|
|
315
326
|
});
|
|
316
327
|
}
|
|
317
328
|
if (settings == null ? void 0 : settings.placeholder) {
|
|
318
329
|
const buffer2 = await image.resize(20, 20).blur(10).toBuffer();
|
|
319
330
|
output.push({
|
|
320
331
|
data: buffer2,
|
|
321
|
-
destinationPath: replaceExtension(
|
|
322
|
-
settings.destinationPath,
|
|
323
|
-
`placeholder${ext}`
|
|
324
|
-
)
|
|
332
|
+
destinationPath: replaceExtension(destinationPath, `placeholder${ext}`)
|
|
325
333
|
});
|
|
326
334
|
}
|
|
327
335
|
return output;
|