aptechka 0.40.1 → 0.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +14 -14
- package/package.json +1 -1
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-BiHPIsKq.cjs"),J=require("../window-resizer/vanilla/index.cjs"),ee=require("../browser-CpzFX2xg.cjs");var
|
|
1
|
+
"use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-BiHPIsKq.cjs"),J=require("../window-resizer/vanilla/index.cjs"),ee=require("../browser-CpzFX2xg.cjs");var C,d,O,S,u,m,p,g,f,y,b,w,l,K,T,N,A,B,k,_,R,x,D;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,C);s(this,d);s(this,O);s(this,S);s(this,u);s(this,m);s(this,p);s(this,g);s(this,f);s(this,y);s(this,b);s(this,w);s(this,T);s(this,A);s(this,k);s(this,_);s(this,R);s(this,x);this.urlValue="",i(this,C,-1),i(this,d,new X.Store(!1)),i(this,u,new E.CSSProperty(this,"--history",!1)),i(this,m,new E.CSSProperty(this,"--restore",!1)),i(this,p,new E.CSSProperty(this,"--dominance",0)),i(this,g,new E.CSSProperty(this,"--group","")),i(this,f,new E.CSSProperty(this,"--click-outside",!1)),i(this,y,new E.CSSProperty(this,"--escape",!1)),i(this,b,!1),this.open=t=>{if(e(this,d).current)return;i(this,w,t==null?void 0:t.trigger),e(this,p).current&&(a.__opened=a.__opened.filter(o=>o!==this&&v(this,l,D).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,C,a.__opened.length-1),clearTimeout(e(this,O)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,w)}}),e(this,u).current&&e(this,b)&&history.pushState(history.state,"",e(this,l,K)),e(this,d).current=!0;const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,A)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,w)}}),i(this,S,void 0),this.setAttribute("aria-hidden","false")};t!=null&&t.skipTransition?h():i(this,S,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,S)&&v(this,l,D).call(this,this,t)?(t.close(),!1):!0),v(this,l,N).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.setAttribute("aria-hidden","true"),this.style.opacity="0",I.dispatchEvent(this,"popoverClosing",{custom:!0}),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",I.dispatchEvent(this,"popoverClosed",{custom:!0})},Z.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,f).current&&v(this,l,B).call(this,()=>{var U;const h=t.composedPath();if(h.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const o=h[0],z=o instanceof Node&&(this.contains(o)||((U=this.shadowRoot)==null?void 0:U.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!z||P)&&this.close()})}),i(this,A,t=>{e(this,y).current&&v(this,l,B).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,k,()=>{i(this,b,!1),e(this,d).current&&e(this,u).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,u).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),i(this,b,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,R).call(this)}),i(this,R,Y.debounce(()=>{e(this,x).call(this)},10)),i(this,x,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,u)}get restore(){return e(this,m)}get dominance(){return e(this,p)}get group(){return e(this,g)}get clickOutside(){return e(this,f)}get escape(){return e(this,y)}get opened(){return e(this,d)}get lastTrigger(){return e(this,w)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d).current&&G.updateSearchParameter(this.id,t)}connectedCallback(){e(this,u).observe(),e(this,m).observe(),e(this,p).observe(),e(this,g).observe(),e(this,f).observe(),e(this,y).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("role","dialog"),this.setAttribute("aria-hidden","true"),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,k)),setTimeout(()=>{e(this,m).current?(this.urlValue=G.parseSearchParameters(location.search)[this.id],e(this,k).call(this)):(v(this,l,N).call(this),i(this,b,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,u).close(),e(this,m).close(),e(this,p).close(),e(this,g).close(),e(this,f).close(),e(this,y).close(),this.style.opacity="",this.style.display="",this.removeAttribute("role"),this.removeAttribute("aria-hidden"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,O)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,k)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),v(this,l,N).call(this)}};C=new WeakMap,d=new WeakMap,O=new WeakMap,S=new WeakMap,u=new WeakMap,m=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap,y=new WeakMap,b=new WeakMap,w=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},T=new WeakMap,N=function(){if(e(this,u).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},A=new WeakMap,B=function(t){(a.__opened[e(this,C)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,p).current>h.dominance.current))&&t()},k=new WeakMap,_=new WeakMap,R=new WeakMap,x=new WeakMap,D=function(t,h){if(e(t,g).current===e(h,g).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let q=a;customElements.get("e-popover")||customElements.define("e-popover",q);var r,L,V,M,$,H;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,V,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,$,()=>{this.classList.remove("opened")});s(this,H,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});ee.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=e(this,L).current;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 type(){return e(this,L)}get popoverElement(){return e(this,r)}connectedCallback(){var h;e(this,L).subscribe(o=>{e(this,r)instanceof q&&(o.current!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const z=this.closest("[popover-target]");if(z)o=z;else{const P=this.getRootNode();P instanceof ShadowRoot?o=P.host.closest("[popover-target]"):P instanceof HTMLElement&&(o=P.closest("[popover-target]"))}}else t==="sibling"?o=(h=this.parentElement)==null?void 0:h.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(i(this,r,o),e(this,r).addEventListener("popoverTriggered",e(this,V)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,$)),e(this,r).addEventListener("popoverClosed",e(this,H))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,L).observe()}disconnectedCallback(){e(this,L).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,V)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,$)),e(this,r).removeEventListener("popoverClosed",e(this,H)))}}r=new WeakMap,L=new WeakMap,V=new WeakMap,M=new WeakMap,$=new WeakMap,H=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=q;
|
package/lib/popover/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { g as X } from "../style-j2TwriJ_.js";
|
|
|
11
11
|
import { u as Y, p as Z } from "../url-B5eH5z6S.js";
|
|
12
12
|
import { windowResizer as G } from "../window-resizer/vanilla/index.js";
|
|
13
13
|
import { i as ee } from "../browser-0zX67oeU.js";
|
|
14
|
-
var x, d, V, T, p, v, u, g, f, y, L, w, l, J,
|
|
14
|
+
var x, d, V, T, p, v, u, g, f, y, L, w, l, J, A, N, k, B, S, _, O, P, D;
|
|
15
15
|
const c = class c extends HTMLElement {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
@@ -28,8 +28,8 @@ const c = class c extends HTMLElement {
|
|
|
28
28
|
s(this, y);
|
|
29
29
|
s(this, L);
|
|
30
30
|
s(this, w);
|
|
31
|
-
s(this, k);
|
|
32
31
|
s(this, A);
|
|
32
|
+
s(this, k);
|
|
33
33
|
s(this, S);
|
|
34
34
|
s(this, _);
|
|
35
35
|
s(this, O);
|
|
@@ -44,23 +44,23 @@ const c = class c extends HTMLElement {
|
|
|
44
44
|
}
|
|
45
45
|
}), e(this, p).current && e(this, L) && history.pushState(history.state, "", e(this, l, J)), e(this, d).current = !0;
|
|
46
46
|
const h = () => {
|
|
47
|
-
addEventListener("click", e(this,
|
|
47
|
+
addEventListener("click", e(this, A)), addEventListener("keydown", e(this, k)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), z(this, "popoverOpened", {
|
|
48
48
|
custom: !0,
|
|
49
49
|
detail: {
|
|
50
50
|
trigger: e(this, w)
|
|
51
51
|
}
|
|
52
|
-
}), i(this, T, void 0);
|
|
52
|
+
}), i(this, T, void 0), this.setAttribute("aria-hidden", "false");
|
|
53
53
|
};
|
|
54
54
|
t != null && t.skipTransition ? h() : i(this, T, setTimeout(h, 10));
|
|
55
55
|
}, this.close = () => {
|
|
56
|
-
e(this, d).current && (removeEventListener("click", e(this,
|
|
56
|
+
e(this, d).current && (removeEventListener("click", e(this, A)), removeEventListener("keydown", e(this, k)), e(this, d).current = !1, c.__opened = c.__opened.filter((t) => t === this ? !1 : !e(t, T) && m(this, l, D).call(this, this, t) ? (t.close(), !1) : !0), m(this, l, N).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.setAttribute("aria-hidden", "true"), this.style.opacity = "0", z(this, "popoverClosing", {
|
|
57
57
|
custom: !0
|
|
58
58
|
}), setTimeout(() => {
|
|
59
59
|
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", z(this, "popoverClosed", {
|
|
60
60
|
custom: !0
|
|
61
61
|
});
|
|
62
62
|
}, X(this) + 10));
|
|
63
|
-
}, i(this,
|
|
63
|
+
}, i(this, A, (t) => {
|
|
64
64
|
e(this, f).current && m(this, l, B).call(this, () => {
|
|
65
65
|
var U;
|
|
66
66
|
const h = t.composedPath();
|
|
@@ -71,7 +71,7 @@ const c = class c extends HTMLElement {
|
|
|
71
71
|
const o = h[0], I = o instanceof Node && (this.contains(o) || ((U = this.shadowRoot) == null ? void 0 : U.contains(o))), C = o instanceof HTMLElement && o.hasAttribute("data-outside");
|
|
72
72
|
(!I || C) && this.close();
|
|
73
73
|
});
|
|
74
|
-
}), i(this,
|
|
74
|
+
}), i(this, k, (t) => {
|
|
75
75
|
e(this, y).current && m(this, l, B).call(this, () => {
|
|
76
76
|
t.code === "Escape" && this.close();
|
|
77
77
|
});
|
|
@@ -116,22 +116,22 @@ const c = class c extends HTMLElement {
|
|
|
116
116
|
this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, d).current && Y(this.id, t);
|
|
117
117
|
}
|
|
118
118
|
connectedCallback() {
|
|
119
|
-
e(this, p).observe(), e(this, v).observe(), e(this, u).observe(), e(this, g).observe(), e(this, f).observe(), e(this, y).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("
|
|
119
|
+
e(this, p).observe(), e(this, v).observe(), e(this, u).observe(), e(this, g).observe(), e(this, f).observe(), e(this, y).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("role", "dialog"), this.setAttribute("aria-hidden", "true"), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, S)), setTimeout(() => {
|
|
120
120
|
e(this, v).current ? (this.urlValue = Z(location.search)[this.id], e(this, S).call(this)) : (m(this, l, N).call(this), i(this, L, !0));
|
|
121
121
|
}, 0), G.subscribe(e(this, _));
|
|
122
122
|
}
|
|
123
123
|
disconnectedCallback() {
|
|
124
|
-
G.unsubscribe(e(this, _)), e(this, p).close(), e(this, v).close(), e(this, u).close(), e(this, g).close(), e(this, f).close(), e(this, y).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("
|
|
124
|
+
G.unsubscribe(e(this, _)), e(this, p).close(), e(this, v).close(), e(this, u).close(), e(this, g).close(), e(this, f).close(), e(this, y).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("role"), this.removeAttribute("aria-hidden"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, V)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, S)), removeEventListener("click", e(this, A)), removeEventListener("keydown", e(this, k)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), m(this, l, N).call(this);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
x = new WeakMap(), d = new WeakMap(), V = new WeakMap(), T = new WeakMap(), p = new WeakMap(), v = new WeakMap(), u = new WeakMap(), g = new WeakMap(), f = new WeakMap(), y = new WeakMap(), L = new WeakMap(), w = new WeakMap(), l = new WeakSet(), J = function() {
|
|
128
128
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
129
|
-
},
|
|
129
|
+
}, A = new WeakMap(), N = function() {
|
|
130
130
|
if (e(this, p).current) {
|
|
131
131
|
const t = new URL(location.href);
|
|
132
132
|
t.searchParams.delete(this.id), history.replaceState(history.state, "", t.href);
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, k = new WeakMap(), B = function(t) {
|
|
135
135
|
(c.__opened[e(this, x) - 1] || c.__opened.length === 1 || c.__opened.filter((h) => h !== this).every((h) => e(this, u).current > h.dominance.current)) && t();
|
|
136
136
|
}, S = new WeakMap(), _ = new WeakMap(), O = new WeakMap(), P = new WeakMap(), D = function(t, h) {
|
|
137
137
|
if (e(t, g).current === e(h, g).current && t.dominance.current >= h.dominance.current)
|
|
@@ -175,10 +175,10 @@ class te extends HTMLElement {
|
|
|
175
175
|
connectedCallback() {
|
|
176
176
|
var h;
|
|
177
177
|
e(this, b).subscribe((o) => {
|
|
178
|
-
e(this, r) instanceof W && (o.current !== "close" ? (this.setAttribute("aria-
|
|
178
|
+
e(this, r) instanceof W && (o.current !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
|
|
179
179
|
"aria-expanded",
|
|
180
180
|
e(this, r).opened.current ? "true" : "false"
|
|
181
|
-
), this.setAttribute("aria-controls", e(this, r).id || "")) : (this.removeAttribute("aria-
|
|
181
|
+
), this.setAttribute("aria-controls", e(this, r).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
|
|
182
182
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
183
183
|
const t = this.getAttribute("target");
|
|
184
184
|
if (t) {
|
|
@@ -209,7 +209,7 @@ class te extends HTMLElement {
|
|
|
209
209
|
this.isConnected && e(this, b).observe();
|
|
210
210
|
}
|
|
211
211
|
disconnectedCallback() {
|
|
212
|
-
e(this, b).unobserve(), this.removeAttribute("aria-
|
|
212
|
+
e(this, b).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
|
|
213
213
|
"popoverTriggered",
|
|
214
214
|
e(this, $)
|
|
215
215
|
), e(this, r).removeEventListener(
|