aptechka 0.33.1 → 0.33.2
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 +12 -12
- package/package.json +1 -1
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var U=o=>{throw TypeError(o)};var I=(o,h,t)=>h.has(o)||U("Cannot "+t);var e=(o,h,t)=>(I(o,h,"read from private field"),t?t.call(o):h.get(o)),s=(o,h,t)=>h.has(o)?U("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(o):h.set(o,t),r=(o,h,t,c)=>(I(o,h,"write to private field"),c?c.call(o,t):h.set(o,t),t),P=(o,h,t)=>(I(o,h,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../css-property/index.cjs"),J=require("../Store-CDb6RMce.cjs"),z=require("../events-KVanG9sR.cjs"),K=require("../function-MthRj-GJ.cjs"),Q=require("../style-At6aDoqG.cjs"),W=require("../window-resizer/vanilla/index.cjs"),V=require("../browser-CpzFX2xg.cjs");var S,l,_,d,v,p,g,m,f,b,u,F,T,B,k,N,L,A,x,C;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,u);s(this,S);s(this,l);s(this,_);s(this,d);s(this,v);s(this,p);s(this,g);s(this,m);s(this,f);s(this,b);s(this,T);s(this,k);s(this,L);s(this,A);s(this,x);s(this,C);r(this,S,-1),r(this,l,new J.Store(!1)),r(this,d,new w.CSSProperty(this,"--history",!1)),r(this,v,new w.CSSProperty(this,"--restore",!1)),r(this,p,new w.CSSProperty(this,"--dominance",0)),r(this,g,new w.CSSProperty(this,"--click-outside",!1)),r(this,m,new w.CSSProperty(this,"--escape",!1)),r(this,f,!1),this.open=t=>{if(e(this,l).current)return;r(this,b,t==null?void 0:t.trigger),e(this,l).current=!0,e(this,p).current&&(a.__opened=a.__opened.filter(n=>this.dominance.current>=n.dominance.current?(n.close(),!1):!0)),a.__opened.push(this),r(this,S,a.__opened.length-1),e(this,d).current&&e(this,f)&&history.pushState("","",e(this,u,F)),clearTimeout(e(this,_)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",z.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,b)}});const c=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,C).call(this),this.style.opacity="1",this.classList.add("opened"),z.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,b)}})};t!=null&&t.skipTransition?c():setTimeout(c,10)},this.close=()=>{e(this,l).current&&(e(this,l).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:e(t,p).current<this.dominance.current?(t.close(),!1):!0),P(this,u,B).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",z.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",z.dispatchEvent(this,"popoverClosed",{custom:!0})},Q.getElementTransitionDurationMS(this)+10))},r(this,T,t=>{e(this,g).current&&P(this,u,N).call(this,()=>{var j;const c=t.composedPath();if(c.find(D=>D instanceof HTMLElement&&D.hasAttribute("data-popover-content")))return;const n=c[0],H=n instanceof HTMLElement&&(this.contains(n)||((j=this.shadowRoot)==null?void 0:j.contains(n))),E=n instanceof HTMLElement&&n.hasAttribute("data-outside");(!H||E)&&this.close()})}),r(this,k,t=>{e(this,m).current&&P(this,u,N).call(this,()=>{t.code==="Escape"&&this.close()})}),r(this,L,()=>{r(this,f,!1),e(this,l).current&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,l).current&&e(this,d).current&&location.search.includes(this.id)&&this.open(),r(this,f,!0)}),r(this,A,()=>{this.style.
|
|
1
|
+
"use strict";var U=o=>{throw TypeError(o)};var I=(o,h,t)=>h.has(o)||U("Cannot "+t);var e=(o,h,t)=>(I(o,h,"read from private field"),t?t.call(o):h.get(o)),s=(o,h,t)=>h.has(o)?U("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(o):h.set(o,t),r=(o,h,t,c)=>(I(o,h,"write to private field"),c?c.call(o,t):h.set(o,t),t),P=(o,h,t)=>(I(o,h,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../css-property/index.cjs"),J=require("../Store-CDb6RMce.cjs"),z=require("../events-KVanG9sR.cjs"),K=require("../function-MthRj-GJ.cjs"),Q=require("../style-At6aDoqG.cjs"),W=require("../window-resizer/vanilla/index.cjs"),V=require("../browser-CpzFX2xg.cjs");var S,l,_,d,v,p,g,m,f,b,u,F,T,B,k,N,L,A,x,C;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,u);s(this,S);s(this,l);s(this,_);s(this,d);s(this,v);s(this,p);s(this,g);s(this,m);s(this,f);s(this,b);s(this,T);s(this,k);s(this,L);s(this,A);s(this,x);s(this,C);r(this,S,-1),r(this,l,new J.Store(!1)),r(this,d,new w.CSSProperty(this,"--history",!1)),r(this,v,new w.CSSProperty(this,"--restore",!1)),r(this,p,new w.CSSProperty(this,"--dominance",0)),r(this,g,new w.CSSProperty(this,"--click-outside",!1)),r(this,m,new w.CSSProperty(this,"--escape",!1)),r(this,f,!1),this.open=t=>{if(e(this,l).current)return;r(this,b,t==null?void 0:t.trigger),e(this,l).current=!0,e(this,p).current&&(a.__opened=a.__opened.filter(n=>this.dominance.current>=n.dominance.current?(n.close(),!1):!0)),a.__opened.push(this),r(this,S,a.__opened.length-1),e(this,d).current&&e(this,f)&&history.pushState("","",e(this,u,F)),clearTimeout(e(this,_)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",z.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,b)}});const c=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,C).call(this),this.style.opacity="1",this.classList.add("opened"),z.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,b)}})};t!=null&&t.skipTransition?c():setTimeout(c,10)},this.close=()=>{e(this,l).current&&(e(this,l).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:e(t,p).current<this.dominance.current?(t.close(),!1):!0),P(this,u,B).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",z.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",z.dispatchEvent(this,"popoverClosed",{custom:!0})},Q.getElementTransitionDurationMS(this)+10))},r(this,T,t=>{e(this,g).current&&P(this,u,N).call(this,()=>{var j;const c=t.composedPath();if(c.find(D=>D instanceof HTMLElement&&D.hasAttribute("data-popover-content")))return;const n=c[0],H=n instanceof HTMLElement&&(this.contains(n)||((j=this.shadowRoot)==null?void 0:j.contains(n))),E=n instanceof HTMLElement&&n.hasAttribute("data-outside");(!H||E)&&this.close()})}),r(this,k,t=>{e(this,m).current&&P(this,u,N).call(this,()=>{t.code==="Escape"&&this.close()})}),r(this,L,()=>{r(this,f,!1),e(this,l).current&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,l).current&&e(this,d).current&&location.search.includes(this.id)&&this.open(),r(this,f,!0)}),r(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,x).call(this)}),r(this,x,K.debounce(()=>{e(this,C).call(this)},10)),r(this,C,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,d)}get restore(){return e(this,v)}get dominance(){return e(this,p)}get clickOutside(){return e(this,g)}get escape(){return e(this,m)}get opened(){return e(this,l)}get lastTrigger(){return e(this,b)}connectedCallback(){e(this,d).observe(),e(this,v).observe(),e(this,p).observe(),e(this,g).observe(),e(this,m).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,L)),setTimeout(()=>{e(this,v).current?e(this,L).call(this):(P(this,u,B).call(this),r(this,f,!0))},0),W.windowResizer.subscribe(e(this,A))}disconnectedCallback(){W.windowResizer.unsubscribe(e(this,A)),e(this,d).unobserve(),e(this,v).unobserve(),e(this,p).unobserve(),e(this,g).unobserve(),e(this,m).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,_)),removeEventListener("popstate",e(this,L)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};S=new WeakMap,l=new WeakMap,_=new WeakMap,d=new WeakMap,v=new WeakMap,p=new WeakMap,g=new WeakMap,m=new WeakMap,f=new WeakMap,b=new WeakMap,u=new WeakSet,F=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},T=new WeakMap,B=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},k=new WeakMap,N=function(t){(a.__opened[e(this,S)-1]||a.__opened.length===1||a.__opened.filter(c=>c!==this).every(c=>e(this,p).current>c.dominance.current))&&t()},L=new WeakMap,A=new WeakMap,x=new WeakMap,C=new WeakMap,a.__opened=[];let $=a;customElements.get("e-popover")||customElements.define("e-popover",$);var i,y,q,M,O,R;class G extends HTMLElement{constructor(){super();s(this,i);s(this,y,new w.CSSProperty(this,"--type","open"));s(this,q,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,O,()=>{this.classList.remove("opened")});s(this,R,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});V.isBrowser&&(this.addEventListener("click",()=>{if(e(this,i)){const t=e(this,y).current;t==="open"||t==="toggle"&&!e(this,i).opened.current?e(this,i).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,i).opened.current)&&e(this,i).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,y)}get popoverElement(){return e(this,i)}connectedCallback(){var c;e(this,y).subscribe(n=>{e(this,i)&&(n.current!=="close"?(this.setAttribute("aria-has-popup","true"),this.setAttribute("aria-expanded",e(this,i).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,i).id||"")):(this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let n=null;if(t==="parent"){const H=this.closest("[popover-target]");if(H)n=H;else{const E=this.getRootNode();E instanceof ShadowRoot?n=E.host.closest("[popover-target]"):E instanceof HTMLElement&&(n=E.closest("[popover-target]"))}}else t==="sibling"?n=(c=this.parentElement)==null?void 0:c.querySelector("[popover-target]"):n=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);n instanceof HTMLElement?(r(this,i,n),e(this,i).addEventListener("popoverTriggered",e(this,q)),e(this,i).addEventListener("popoverOpened",e(this,M)),e(this,i).addEventListener("popoverClosing",e(this,O)),e(this,i).addEventListener("popoverClosed",e(this,R))):console.warn(this,`target ${t} not found`)}e(this,y).observe()}disconnectedCallback(){e(this,y).unobserve(),this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,i)&&(e(this,i).removeEventListener("popoverTriggered",e(this,q)),e(this,i).removeEventListener("popoverOpened",e(this,M)),e(this,i).removeEventListener("popoverClosing",e(this,O)),e(this,i).removeEventListener("popoverClosed",e(this,R)))}}i=new WeakMap,y=new WeakMap,q=new WeakMap,M=new WeakMap,O=new WeakMap,R=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",G);exports.PopoverButtonElement=G;exports.PopoverElement=$;
|
package/lib/popover/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { d as J } from "../function-C10DGppn.js";
|
|
|
10
10
|
import { g as K } from "../style-j2TwriJ_.js";
|
|
11
11
|
import { windowResizer as j } from "../window-resizer/vanilla/index.js";
|
|
12
12
|
import { i as Q } from "../browser-0zX67oeU.js";
|
|
13
|
-
var w, l, _, d, v, p,
|
|
13
|
+
var w, l, _, d, v, p, g, m, f, y, u, F, k, N, A, B, L, S, P, x;
|
|
14
14
|
const c = class c extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
@@ -21,8 +21,8 @@ const c = class c extends HTMLElement {
|
|
|
21
21
|
s(this, d);
|
|
22
22
|
s(this, v);
|
|
23
23
|
s(this, p);
|
|
24
|
-
s(this, m);
|
|
25
24
|
s(this, g);
|
|
25
|
+
s(this, m);
|
|
26
26
|
s(this, f);
|
|
27
27
|
s(this, y);
|
|
28
28
|
s(this, k);
|
|
@@ -31,7 +31,7 @@ const c = class c extends HTMLElement {
|
|
|
31
31
|
s(this, S);
|
|
32
32
|
s(this, P);
|
|
33
33
|
s(this, x);
|
|
34
|
-
r(this, w, -1), r(this, l, new G(!1)), r(this, d, new T(this, "--history", !1)), r(this, v, new T(this, "--restore", !1)), r(this, p, new T(this, "--dominance", 0)), r(this,
|
|
34
|
+
r(this, w, -1), r(this, l, new G(!1)), r(this, d, new T(this, "--history", !1)), r(this, v, new T(this, "--restore", !1)), r(this, p, new T(this, "--dominance", 0)), r(this, g, new T(this, "--click-outside", !1)), r(this, m, new T(this, "--escape", !1)), r(this, f, !1), this.open = (t) => {
|
|
35
35
|
if (e(this, l).current)
|
|
36
36
|
return;
|
|
37
37
|
r(this, y, t == null ? void 0 : t.trigger), e(this, l).current = !0, e(this, p).current && (c.__opened = c.__opened.filter((n) => this.dominance.current >= n.dominance.current ? (n.close(), !1) : !0)), c.__opened.push(this), r(this, w, c.__opened.length - 1), e(this, d).current && e(this, f) && history.pushState("", "", e(this, u, F)), clearTimeout(e(this, _)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", z(this, "popoverTriggered", {
|
|
@@ -58,7 +58,7 @@ const c = class c extends HTMLElement {
|
|
|
58
58
|
});
|
|
59
59
|
}, K(this) + 10));
|
|
60
60
|
}, r(this, k, (t) => {
|
|
61
|
-
e(this,
|
|
61
|
+
e(this, g).current && C(this, u, B).call(this, () => {
|
|
62
62
|
var D;
|
|
63
63
|
const a = t.composedPath();
|
|
64
64
|
if (a.find(
|
|
@@ -69,16 +69,16 @@ const c = class c extends HTMLElement {
|
|
|
69
69
|
(!$ || E) && this.close();
|
|
70
70
|
});
|
|
71
71
|
}), r(this, A, (t) => {
|
|
72
|
-
e(this,
|
|
72
|
+
e(this, m).current && C(this, u, B).call(this, () => {
|
|
73
73
|
t.code === "Escape" && this.close();
|
|
74
74
|
});
|
|
75
75
|
}), r(this, L, () => {
|
|
76
76
|
r(this, f, !1), e(this, l).current && e(this, d).current && !location.search.includes(this.id) ? this.close() : !e(this, l).current && e(this, d).current && location.search.includes(this.id) && this.open(), r(this, f, !0);
|
|
77
77
|
}), r(this, S, () => {
|
|
78
|
-
this.style.
|
|
78
|
+
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, P).call(this);
|
|
79
79
|
}), r(this, P, J(() => {
|
|
80
80
|
e(this, x).call(this);
|
|
81
|
-
},
|
|
81
|
+
}, 10)), r(this, x, () => {
|
|
82
82
|
this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -92,10 +92,10 @@ const c = class c extends HTMLElement {
|
|
|
92
92
|
return e(this, p);
|
|
93
93
|
}
|
|
94
94
|
get clickOutside() {
|
|
95
|
-
return e(this,
|
|
95
|
+
return e(this, g);
|
|
96
96
|
}
|
|
97
97
|
get escape() {
|
|
98
|
-
return e(this,
|
|
98
|
+
return e(this, m);
|
|
99
99
|
}
|
|
100
100
|
get opened() {
|
|
101
101
|
return e(this, l);
|
|
@@ -104,15 +104,15 @@ const c = class c extends HTMLElement {
|
|
|
104
104
|
return e(this, y);
|
|
105
105
|
}
|
|
106
106
|
connectedCallback() {
|
|
107
|
-
e(this, d).observe(), e(this, v).observe(), e(this, p).observe(), e(this,
|
|
107
|
+
e(this, d).observe(), e(this, v).observe(), e(this, p).observe(), e(this, g).observe(), e(this, m).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, L)), setTimeout(() => {
|
|
108
108
|
e(this, v).current ? e(this, L).call(this) : (C(this, u, N).call(this), r(this, f, !0));
|
|
109
109
|
}, 0), j.subscribe(e(this, S));
|
|
110
110
|
}
|
|
111
111
|
disconnectedCallback() {
|
|
112
|
-
j.unsubscribe(e(this, S)), e(this, d).unobserve(), e(this, v).unobserve(), e(this, p).unobserve(), e(this,
|
|
112
|
+
j.unsubscribe(e(this, S)), e(this, d).unobserve(), e(this, v).unobserve(), e(this, p).unobserve(), e(this, g).unobserve(), e(this, m).unobserve(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, _)), removeEventListener("popstate", e(this, L)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height");
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
w = new WeakMap(), l = new WeakMap(), _ = new WeakMap(), d = new WeakMap(), v = new WeakMap(), p = new WeakMap(),
|
|
115
|
+
w = new WeakMap(), l = new WeakMap(), _ = new WeakMap(), d = new WeakMap(), v = new WeakMap(), p = new WeakMap(), g = new WeakMap(), m = new WeakMap(), f = new WeakMap(), y = new WeakMap(), u = new WeakSet(), F = function() {
|
|
116
116
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
|
|
117
117
|
}, k = new WeakMap(), N = function() {
|
|
118
118
|
if (e(this, d).current) {
|