aptechka 0.32.4 → 0.32.5
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 +19 -19
- package/package.json +1 -1
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var N=o=>{throw TypeError(o)};var H=(o,n,t)=>n.has(o)||N("Cannot "+t);var e=(o,n,t)=>(H(o,n,"read from private field"),t?t.call(o):n.get(o)),s=(o,n,t)=>n.has(o)?N("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,t),i=(o,n,t,l)=>(H(o,n,"write to private field"),l?l.call(o,t):n.set(o,t),t),k=(o,n,t)=>(H(o,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../attribute/index.cjs"),W=require("../Store-CDb6RMce.cjs"),
|
|
1
|
+
"use strict";var N=o=>{throw TypeError(o)};var H=(o,n,t)=>n.has(o)||N("Cannot "+t);var e=(o,n,t)=>(H(o,n,"read from private field"),t?t.call(o):n.get(o)),s=(o,n,t)=>n.has(o)?N("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,t),i=(o,n,t,l)=>(H(o,n,"write to private field"),l?l.call(o,t):n.set(o,t),t),k=(o,n,t)=>(H(o,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../attribute/index.cjs"),W=require("../Store-CDb6RMce.cjs"),M=require("../events-KVanG9sR.cjs"),F=require("../function-MthRj-GJ.cjs"),G=require("../style-At6aDoqG.cjs"),j=require("../window-resizer/vanilla/index.cjs"),J=require("../browser-CpzFX2xg.cjs");var y,a,_,d,u,v,g,m,p,D,E,z,b,$,f,T,S,w;const c=class c extends HTMLElement{constructor(){super(...arguments);s(this,p);s(this,y);s(this,a);s(this,_);s(this,d);s(this,u);s(this,v);s(this,g);s(this,m);s(this,E);s(this,b);s(this,f);s(this,T);s(this,S);s(this,w);i(this,y,-1),i(this,a,new W.Store(!1)),i(this,d,new O.Attribute(this,"history",!1)),i(this,u,new O.Attribute(this,"restore",!1)),i(this,v,new O.Attribute(this,"dominance",0)),i(this,g,!1),this.open=t=>{if(e(this,a).current)return;i(this,m,t==null?void 0:t.trigger),e(this,a).current=!0,e(this,v).current&&(c.__opened=c.__opened.filter(h=>this.dominance.current>=h.dominance.current?(h.close(),!1):!0)),c.__opened.push(this),i(this,y,c.__opened.length-1),e(this,d).current&&e(this,g)&&history.pushState("","",e(this,p,D)),clearTimeout(e(this,_)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,m)}});const l=()=>{addEventListener("click",e(this,E)),addEventListener("keydown",e(this,b)),e(this,w).call(this),this.style.opacity="1",this.classList.add("opened"),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,m)}})};t!=null&&t.skipTransition?l():setTimeout(l,10)},this.close=()=>{e(this,a).current&&(e(this,a).current=!1,c.__opened=c.__opened.filter(t=>t!==this),k(this,p,z).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",M.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,E)),removeEventListener("keydown",e(this,b)),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",M.dispatchEvent(this,"popoverClosed",{custom:!0})},G.getElementTransitionDurationMS(this)+10))},i(this,E,t=>{k(this,p,$).call(this,()=>{var I;const l=t.composedPath();if(l.find(B=>B instanceof HTMLElement&&B.hasAttribute("data-popover-content")))return;const h=l[0],x=h instanceof HTMLElement&&(this.contains(h)||((I=this.shadowRoot)==null?void 0:I.contains(h))),L=h instanceof HTMLElement&&h.hasAttribute("data-outside");(!x||L)&&this.close()})}),i(this,b,t=>{k(this,p,$).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,f,()=>{i(this,g,!1),e(this,a).current&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,a).current&&e(this,d).current&&location.search.includes(this.id)&&this.open(),i(this,g,!0)}),i(this,T,()=>{this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),e(this,S).call(this)}),i(this,S,F.debounce(()=>{e(this,w).call(this)},20)),i(this,w,()=>{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,u)}get dominance(){return e(this,v)}get opened(){return e(this,a)}get lastTrigger(){return e(this,m)}connectedCallback(){e(this,d).observe(),e(this,u).observe(),e(this,v).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,f)),setTimeout(()=>{e(this,u).current?e(this,f).call(this):(k(this,p,z).call(this),i(this,g,!0))},0),j.windowResizer.subscribe(e(this,T))}disconnectedCallback(){j.windowResizer.unsubscribe(e(this,T)),e(this,d).unobserve(),e(this,u).unobserve(),e(this,v).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,_)),removeEventListener("popstate",e(this,f)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};y=new WeakMap,a=new WeakMap,_=new WeakMap,d=new WeakMap,u=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,p=new WeakSet,D=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},E=new WeakMap,z=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},b=new WeakMap,$=function(t){(c.__opened[e(this,y)-1]||c.__opened.length===1)&&t()},f=new WeakMap,T=new WeakMap,S=new WeakMap,w=new WeakMap,c.__opened=[];let R=c;customElements.get("e-popover")||customElements.define("e-popover",R);var r,C,A,P,q;class U extends HTMLElement{constructor(){super();s(this,r);s(this,C,()=>{this.classList.add("triggered")});s(this,A,()=>{this.classList.add("opened")});s(this,P,()=>{this.classList.remove("opened")});s(this,q,()=>{this.classList.remove("triggered")});J.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,r)}connectedCallback(){var l;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let h=null;if(t==="parent"){const x=this.closest("[popover-target]");if(x)h=x;else{const L=this.getRootNode();L instanceof ShadowRoot?h=L.host.closest("[popover-target]"):L instanceof HTMLElement&&(h=L.closest("[popover-target]"))}}else t==="sibling"?h=(l=this.parentElement)==null?void 0:l.querySelector("[popover-target]"):h=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);h instanceof HTMLElement?(i(this,r,h),e(this,r).addEventListener("popoverTriggered",e(this,C)),e(this,r).addEventListener("popoverOpened",e(this,A)),e(this,r).addEventListener("popoverClosing",e(this,P)),e(this,r).addEventListener("popoverClosed",e(this,q))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,C)),e(this,r).removeEventListener("popoverOpened",e(this,A)),e(this,r).removeEventListener("popoverClosing",e(this,P)),e(this,r).removeEventListener("popoverClosed",e(this,q)))}}r=new WeakMap,C=new WeakMap,A=new WeakMap,P=new WeakMap,q=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",U);exports.PopoverButtonElement=U;exports.PopoverElement=R;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var B = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (o, n, t) => (
|
|
6
|
-
import { Attribute as
|
|
4
|
+
var R = (o, n, t) => n.has(o) || B("Cannot " + t);
|
|
5
|
+
var e = (o, n, t) => (R(o, n, "read from private field"), t ? t.call(o) : n.get(o)), s = (o, n, t) => n.has(o) ? B("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, t), i = (o, n, t, l) => (R(o, n, "write to private field"), l ? l.call(o, t) : n.set(o, t), t), k = (o, n, t) => (R(o, n, "access private method"), t);
|
|
6
|
+
import { Attribute as O } from "../attribute/index.js";
|
|
7
7
|
import { S as W } from "../Store-OTdcl6SX.js";
|
|
8
|
-
import { d as
|
|
8
|
+
import { d as P } from "../events-CsVF98U6.js";
|
|
9
9
|
import { d as j } from "../function-C10DGppn.js";
|
|
10
10
|
import { g as F } from "../style-j2TwriJ_.js";
|
|
11
11
|
import { windowResizer as D } from "../window-resizer/vanilla/index.js";
|
|
@@ -29,17 +29,17 @@ const c = class c extends HTMLElement {
|
|
|
29
29
|
s(this, T);
|
|
30
30
|
s(this, S);
|
|
31
31
|
s(this, w);
|
|
32
|
-
i(this, y, -1), i(this, a, new W(!1)), i(this, d, new
|
|
32
|
+
i(this, y, -1), i(this, a, new W(!1)), i(this, d, new O(this, "history", !1)), i(this, u, new O(this, "restore", !1)), i(this, g, new O(this, "dominance", 0)), i(this, m, !1), this.open = (t) => {
|
|
33
33
|
if (e(this, a).current)
|
|
34
34
|
return;
|
|
35
|
-
i(this, v, t == null ? void 0 : t.trigger), e(this, a).current = !0, e(this, g).current && (c.__opened = c.__opened.filter((h) => this.dominance.current >= h.dominance.current ? (h.close(), !1) : !0)), c.__opened.push(this), i(this, y, c.__opened.length - 1), e(this, d).current && e(this, m) && history.pushState("", "", e(this, p, U)), clearTimeout(e(this, C)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block",
|
|
35
|
+
i(this, v, t == null ? void 0 : t.trigger), e(this, a).current = !0, e(this, g).current && (c.__opened = c.__opened.filter((h) => this.dominance.current >= h.dominance.current ? (h.close(), !1) : !0)), c.__opened.push(this), i(this, y, c.__opened.length - 1), e(this, d).current && e(this, m) && history.pushState("", "", e(this, p, U)), clearTimeout(e(this, C)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", P(this, "popoverTriggered", {
|
|
36
36
|
custom: !0,
|
|
37
37
|
detail: {
|
|
38
38
|
trigger: e(this, v)
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
const l = () => {
|
|
42
|
-
addEventListener("click", e(this, E)), addEventListener("keydown", e(this, b)), e(this, w).call(this), this.style.opacity = "1", this.classList.add("opened"),
|
|
42
|
+
addEventListener("click", e(this, E)), addEventListener("keydown", e(this, b)), e(this, w).call(this), this.style.opacity = "1", this.classList.add("opened"), P(this, "popoverOpened", {
|
|
43
43
|
custom: !0,
|
|
44
44
|
detail: {
|
|
45
45
|
trigger: e(this, v)
|
|
@@ -48,10 +48,10 @@ const c = class c extends HTMLElement {
|
|
|
48
48
|
};
|
|
49
49
|
t != null && t.skipTransition ? l() : setTimeout(l, 10);
|
|
50
50
|
}, this.close = () => {
|
|
51
|
-
e(this, a).current && (e(this, a).current = !1, c.__opened = c.__opened.filter((t) => t !== this), k(this, p, z).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0",
|
|
51
|
+
e(this, a).current && (e(this, a).current = !1, c.__opened = c.__opened.filter((t) => t !== this), k(this, p, z).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", P(this, "popoverClosing", {
|
|
52
52
|
custom: !0
|
|
53
53
|
}), removeEventListener("click", e(this, E)), removeEventListener("keydown", e(this, b)), setTimeout(() => {
|
|
54
|
-
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none",
|
|
54
|
+
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", P(this, "popoverClosed", {
|
|
55
55
|
custom: !0
|
|
56
56
|
});
|
|
57
57
|
}, F(this) + 10));
|
|
@@ -73,9 +73,9 @@ const c = class c extends HTMLElement {
|
|
|
73
73
|
}), i(this, f, () => {
|
|
74
74
|
i(this, m, !1), e(this, a).current && e(this, d).current && !location.search.includes(this.id) ? this.close() : !e(this, a).current && e(this, d).current && location.search.includes(this.id) && this.open(), i(this, m, !0);
|
|
75
75
|
}), i(this, T, () => {
|
|
76
|
-
this.style.width
|
|
76
|
+
this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), e(this, S).call(this);
|
|
77
77
|
}), i(this, S, j(() => {
|
|
78
|
-
e(this, w).call(this)
|
|
78
|
+
e(this, w).call(this);
|
|
79
79
|
}, 20)), i(this, w, () => {
|
|
80
80
|
this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
|
|
81
81
|
});
|
|
@@ -116,7 +116,7 @@ y = new WeakMap(), a = new WeakMap(), C = new WeakMap(), d = new WeakMap(), u =
|
|
|
116
116
|
}, f = new WeakMap(), T = new WeakMap(), S = new WeakMap(), w = new WeakMap(), c.__opened = [];
|
|
117
117
|
let $ = c;
|
|
118
118
|
customElements.get("e-popover") || customElements.define("e-popover", $);
|
|
119
|
-
var r, _,
|
|
119
|
+
var r, _, A, x, H;
|
|
120
120
|
class J extends HTMLElement {
|
|
121
121
|
constructor() {
|
|
122
122
|
super();
|
|
@@ -124,10 +124,10 @@ class J extends HTMLElement {
|
|
|
124
124
|
s(this, _, () => {
|
|
125
125
|
this.classList.add("triggered");
|
|
126
126
|
});
|
|
127
|
-
s(this,
|
|
127
|
+
s(this, A, () => {
|
|
128
128
|
this.classList.add("opened");
|
|
129
129
|
});
|
|
130
|
-
s(this,
|
|
130
|
+
s(this, x, () => {
|
|
131
131
|
this.classList.remove("opened");
|
|
132
132
|
});
|
|
133
133
|
s(this, H, () => {
|
|
@@ -165,10 +165,10 @@ class J extends HTMLElement {
|
|
|
165
165
|
e(this, _)
|
|
166
166
|
), e(this, r).addEventListener(
|
|
167
167
|
"popoverOpened",
|
|
168
|
-
e(this,
|
|
168
|
+
e(this, A)
|
|
169
169
|
), e(this, r).addEventListener(
|
|
170
170
|
"popoverClosing",
|
|
171
|
-
e(this,
|
|
171
|
+
e(this, x)
|
|
172
172
|
), e(this, r).addEventListener(
|
|
173
173
|
"popoverClosed",
|
|
174
174
|
e(this, H)
|
|
@@ -181,17 +181,17 @@ class J extends HTMLElement {
|
|
|
181
181
|
e(this, _)
|
|
182
182
|
), e(this, r).removeEventListener(
|
|
183
183
|
"popoverOpened",
|
|
184
|
-
e(this,
|
|
184
|
+
e(this, A)
|
|
185
185
|
), e(this, r).removeEventListener(
|
|
186
186
|
"popoverClosing",
|
|
187
|
-
e(this,
|
|
187
|
+
e(this, x)
|
|
188
188
|
), e(this, r).removeEventListener(
|
|
189
189
|
"popoverClosed",
|
|
190
190
|
e(this, H)
|
|
191
191
|
));
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
r = new WeakMap(), _ = new WeakMap(),
|
|
194
|
+
r = new WeakMap(), _ = new WeakMap(), A = new WeakMap(), x = new WeakMap(), H = new WeakMap();
|
|
195
195
|
customElements.get("e-popover-button") || customElements.define("e-popover-button", J);
|
|
196
196
|
export {
|
|
197
197
|
J as PopoverButtonElement,
|