aptechka 0.54.4 → 0.54.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.
- package/lib/loading/index.cjs +1 -1
- package/lib/loading/index.js +30 -31
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +26 -26
- package/package.json +1 -1
package/lib/loading/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=i=>{throw TypeError(i)};var v=(i,t,s)=>t.has(i)||m("Cannot "+s);var e=(i,t,s)=>(v(i,t,"read from private field"),s?s.call(i):t.get(i)),r=(i,t,s)=>t.has(i)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),n=(i,t,s,d)=>(v(i,t,"write to private field"),d?d.call(i,s):t.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../events-KVanG9sR.cjs"),E=require("../function-MthRj-GJ.cjs");require("../index-Cqw2NKev.cjs");var o,a,h,l,u,c,p;class S{constructor(){r(this,o,new Map);r(this,a,!1);r(this,h,0);r(this,l,0);r(this,u,E.debounce(()=>{e(this,a)||(n(this,a,!0),g.dispatchEvent(document,"loadingStart"),e(this,c).call(this))},0));r(this,c,t=>{if(!e(this,a))return;const s=e(this,o).size,d=Array.from(e(this,o)).filter(b=>b[1]).length,f=d/s;n(this,h,d),n(this,l,f),g.dispatchEvent(document,"loadingProgress",{detail:{total:s,loaded:d,progress:f,resourceName:t}}),f===1&&e(this,p).call(this)});r(this,p,E.debounce(()=>{n(this,a,!1),g.dispatchEvent(document,"loadingComplete",{detail:{total:e(this,o).size}}),n(this,h,0),n(this,l,0),e(this,o).clear()},0))}get total(){return e(this,o).size}get loaded(){return e(this,h)}get progress(){return e(this,l)}get map(){return e(this,o)}add(t){e(this,o).set(t,!1),e(this,u).call(this)}complete(t){e(this,o).set(t,!0),e(this,c).call(this,t)}error(t){e(this,o).has(t)&&(console.error(`Failed to load ${t}`),e(this,o).delete(t),g.dispatchEvent(document,"loadingError",{detail:{name:t}})),e(this,c).call(this)}}o=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,u=new WeakMap,c=new WeakMap,p=new WeakMap;const q=new S;exports.loading=q;
|
package/lib/loading/index.js
CHANGED
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var z = (i, t, e) => t.has(i) ||
|
|
5
|
-
var s = (i, t, e) => (z(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ?
|
|
6
|
-
import { d as
|
|
7
|
-
import { d as
|
|
4
|
+
var z = (i, t, e) => t.has(i) || u("Cannot " + e);
|
|
5
|
+
var s = (i, t, e) => (z(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ? u("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), a = (i, t, e, h) => (z(i, t, "write to private field"), h ? h.call(i, e) : t.set(i, e), e);
|
|
6
|
+
import { d as p } from "../events-CsVF98U6.js";
|
|
7
|
+
import { d as w } from "../function-C10DGppn.js";
|
|
8
8
|
import "../index-euf5anj6.js";
|
|
9
|
-
var o,
|
|
10
|
-
class
|
|
9
|
+
var o, d, l, n, c, g, m;
|
|
10
|
+
class S {
|
|
11
11
|
constructor() {
|
|
12
12
|
r(this, o, /* @__PURE__ */ new Map());
|
|
13
|
-
r(this,
|
|
13
|
+
r(this, d, !1);
|
|
14
14
|
r(this, l, 0);
|
|
15
15
|
r(this, n, 0);
|
|
16
|
-
r(this,
|
|
17
|
-
|
|
18
|
-
s(this, h) || (a(this, h, !0), c(document, "loadingStart"), s(this, p).call(this));
|
|
16
|
+
r(this, c, w(() => {
|
|
17
|
+
s(this, d) || (a(this, d, !0), p(document, "loadingStart"), s(this, g).call(this));
|
|
19
18
|
}, 0));
|
|
20
|
-
r(this,
|
|
21
|
-
if (!s(this,
|
|
19
|
+
r(this, g, (t) => {
|
|
20
|
+
if (!s(this, d))
|
|
22
21
|
return;
|
|
23
|
-
const e = s(this, o).size,
|
|
24
|
-
a(this, l,
|
|
22
|
+
const e = s(this, o).size, h = Array.from(s(this, o)).filter((E) => E[1]).length, f = h / e;
|
|
23
|
+
a(this, l, h), a(this, n, f), p(document, "loadingProgress", {
|
|
25
24
|
detail: {
|
|
26
25
|
total: e,
|
|
27
|
-
loaded:
|
|
28
|
-
progress:
|
|
26
|
+
loaded: h,
|
|
27
|
+
progress: f,
|
|
29
28
|
resourceName: t
|
|
30
29
|
}
|
|
31
|
-
}),
|
|
30
|
+
}), f === 1 && s(this, m).call(this);
|
|
32
31
|
});
|
|
33
|
-
r(this,
|
|
34
|
-
a(this,
|
|
32
|
+
r(this, m, w(() => {
|
|
33
|
+
a(this, d, !1), p(document, "loadingComplete", {
|
|
35
34
|
detail: {
|
|
36
35
|
total: s(this, o).size
|
|
37
36
|
}
|
|
38
|
-
}), a(this, l, 0), a(this, n, 0),
|
|
37
|
+
}), a(this, l, 0), a(this, n, 0), s(this, o).clear();
|
|
39
38
|
}, 0));
|
|
40
39
|
}
|
|
41
40
|
get total() {
|
|
42
|
-
return s(this,
|
|
41
|
+
return s(this, o).size;
|
|
43
42
|
}
|
|
44
43
|
get loaded() {
|
|
45
|
-
return s(this,
|
|
44
|
+
return s(this, l);
|
|
46
45
|
}
|
|
47
46
|
get progress() {
|
|
48
|
-
return s(this,
|
|
47
|
+
return s(this, n);
|
|
49
48
|
}
|
|
50
49
|
get map() {
|
|
51
50
|
return s(this, o);
|
|
52
51
|
}
|
|
53
52
|
add(t) {
|
|
54
|
-
s(this, o).set(t, !1), s(this,
|
|
53
|
+
s(this, o).set(t, !1), s(this, c).call(this);
|
|
55
54
|
}
|
|
56
55
|
complete(t) {
|
|
57
|
-
s(this, o).set(t, !0), s(this,
|
|
56
|
+
s(this, o).set(t, !0), s(this, g).call(this, t);
|
|
58
57
|
}
|
|
59
58
|
error(t) {
|
|
60
|
-
s(this, o).has(t) && (console.error(`Failed to load ${t}`), s(this, o).delete(t),
|
|
59
|
+
s(this, o).has(t) && (console.error(`Failed to load ${t}`), s(this, o).delete(t), p(document, "loadingError", {
|
|
61
60
|
detail: {
|
|
62
61
|
name: t
|
|
63
62
|
}
|
|
64
|
-
})), s(this,
|
|
63
|
+
})), s(this, g).call(this);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
o = new WeakMap(),
|
|
68
|
-
const
|
|
66
|
+
o = new WeakMap(), d = new WeakMap(), l = new WeakMap(), n = new WeakMap(), c = new WeakMap(), g = new WeakMap(), m = new WeakMap();
|
|
67
|
+
const y = new S();
|
|
69
68
|
export {
|
|
70
|
-
|
|
69
|
+
y as loading
|
|
71
70
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=c=>{throw TypeError(c)};var J=(c,r,t)=>r.has(c)||Z("Cannot "+t);var e=(c,r,t)=>(J(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?Z("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(J(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),m=(c,r,t)=>(J(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("../element-linked-store/index.cjs"),b=require("../css-property/index.cjs"),X=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),ie=require("../function-MthRj-GJ.cjs"),re=require("../style-At6aDoqG.cjs"),I=require("../url-D1CgmwZ_.cjs"),N=require("../window-resizer/index.cjs");var a,f,D,F;class oe{constructor(){i(this,a,new Map);i(this,f,[]);i(this,D,r=>{var s;const t=[...e(this,f)].reverse().find(o=>o.clickOutside.current);if(t){const o=r.composedPath();if(o.find(Y=>Y instanceof HTMLElement&&Y.hasAttribute("data-popover-content")))return;const l=o[0],q=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),te=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!q||te)&&t.close()}});i(this,F,r=>{if(r.code==="Escape"){const t=[...e(this,f)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,D)),addEventListener("keydown",e(this,F))}get groups(){return e(this,a)}get stack(){return e(this,f)}add(r,t){if(t.closeRest.current)e(this,a).forEach(o=>{o.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let o=e(this,a).get(r);o==null||o.forEach(l=>{l.close()})}let s=e(this,a).get(r);s!=null&&s.length||(s=[],e(this,a).set(r,s)),e(this,f).push(t),s.push(t)}remove(r,t){if(n(this,f,e(this,f).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,a).forEach(o=>{o.forEach(l=>s.push(l))}),e(this,a).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,a).get(r);e(this,a).delete(r),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,a).get(r);s&&(s=s.filter(o=>o!==t),e(this,a).set(r,s))}}}a=new WeakMap,f=new WeakMap,D=new WeakMap,F=new WeakMap;var p,$,T,d,y,P,k,g,C,A,L,R,u,S,_,j,x,M,H,O;const E=class E extends HTMLElement{constructor(){super();i(this,S);i(this,p);i(this,$);i(this,T);i(this,d);i(this,y);i(this,P);i(this,k);i(this,g);i(this,C);i(this,A);i(this,L);i(this,R);i(this,u);i(this,x);i(this,M);i(this,H);i(this,O);this.urlValue="",n(this,p,!1),n(this,d,new b.CSSProperty(this,"--history",!1)),n(this,y,new b.CSSProperty(this,"--restore",!1)),n(this,P,new b.CSSProperty(this,"--close-rest",!1)),n(this,k,new b.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new b.CSSProperty(this,"--group","")),n(this,C,new b.CSSProperty(this,"--click-outside",!1)),n(this,A,new b.CSSProperty(this,"--escape",!1)),n(this,L,!1),n(this,u,new se.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1})),n(this,x,()=>{n(this,L,!1),e(this,p)&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,p)&&e(this,d).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,L,!0)}),n(this,M,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,H).call(this)}),n(this,H,ie.debounce(()=>{e(this,O).call(this)},10)),n(this,O,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,u).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),o=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!o)}})}get history(){return e(this,d)}get restore(){return e(this,y)}get closeRest(){return e(this,P)}get closeRestInGroup(){return e(this,k)}get group(){return e(this,g)}get clickOutside(){return e(this,C)}get escape(){return e(this,A)}get opened(){return e(this,p)}get lastTrigger(){return e(this,R)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,p)&&I.updateSearchParameter(this.id,t)}open(t){if(e(this,p))return;n(this,R,t==null?void 0:t.trigger),clearTimeout(e(this,$)),e(this,u).set("closing",!1),e(this,u).set("triggered",!0),U.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,R)}}),e(this,d).current&&e(this,L)&&history.pushState(history.state,"",e(this,S,_)),n(this,p,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,O).call(this),e(this,u).set("opened",!0),U.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,R)}}),n(this,T,void 0)};t!=null&&t.skipTransition?s():n(this,T,setTimeout(s,10))}close(){e(this,p)&&(clearTimeout(e(this,T)),E.stack.remove(e(this,g).current,this),n(this,p,!1),m(this,S,j).call(this),e(this,u).set("opened",!1),e(this,u).set("closing",!0),U.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,$,setTimeout(()=>{e(this,u).set("triggered",!1),e(this,u).set("closing",!1),U.dispatchEvent(this,"popoverClosed",{custom:!0})},re.getElementTransitionDurationMS(this)+10)))}connectedCallback(){e(this,d).observe(),e(this,y).observe(),e(this,P).observe(),e(this,k).observe(),e(this,g).observe(),e(this,C).observe(),e(this,A).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,x)),setTimeout(()=>{e(this,y).current?(this.urlValue=I.parseSearchParameters(location.search)[this.id],e(this,x).call(this)):(m(this,S,j).call(this),n(this,L,!0))},0),N.windowResizer.subscribe(e(this,M))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),N.windowResizer.unsubscribe(e(this,M)),e(this,u).close(),e(this,d).close(),e(this,y).close(),e(this,P).close(),e(this,k).close(),e(this,g).close(),e(this,C).close(),e(this,A).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,x)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),m(this,S,j).call(this)}};p=new WeakMap,$=new WeakMap,T=new WeakMap,d=new WeakMap,y=new WeakMap,P=new WeakMap,k=new WeakMap,g=new WeakMap,C=new WeakMap,A=new WeakMap,L=new WeakMap,R=new WeakMap,u=new WeakMap,S=new WeakSet,_=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},j=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},x=new WeakMap,M=new WeakMap,H=new WeakMap,O=new WeakMap,E.stack=new oe;let V=E;X.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",V);var h,v,w,K,z,W,B,G,Q;class ee extends HTMLElement{constructor(){super();i(this,w);i(this,h);i(this,v,new b.CSSProperty(this,"--type","open"));i(this,z,()=>{this.classList.add("triggered")});i(this,W,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});i(this,B,()=>{this.classList.remove("opened")});i(this,G,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});X.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,v).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,v)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(m(this,w,K).call(this),t){let o=null;if(t==="parent"){const l=this.closest("[popover
|
|
1
|
+
"use strict";var Z=c=>{throw TypeError(c)};var J=(c,r,t)=>r.has(c)||Z("Cannot "+t);var e=(c,r,t)=>(J(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?Z("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(J(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),m=(c,r,t)=>(J(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("../element-linked-store/index.cjs"),b=require("../css-property/index.cjs"),X=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),ie=require("../function-MthRj-GJ.cjs"),re=require("../style-At6aDoqG.cjs"),I=require("../url-D1CgmwZ_.cjs"),N=require("../window-resizer/index.cjs");var a,f,D,F;class oe{constructor(){i(this,a,new Map);i(this,f,[]);i(this,D,r=>{var s;const t=[...e(this,f)].reverse().find(o=>o.clickOutside.current);if(t){const o=r.composedPath();if(o.find(Y=>Y instanceof HTMLElement&&Y.hasAttribute("data-popover-content")))return;const l=o[0],q=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),te=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!q||te)&&t.close()}});i(this,F,r=>{if(r.code==="Escape"){const t=[...e(this,f)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,D)),addEventListener("keydown",e(this,F))}get groups(){return e(this,a)}get stack(){return e(this,f)}add(r,t){if(t.closeRest.current)e(this,a).forEach(o=>{o.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let o=e(this,a).get(r);o==null||o.forEach(l=>{l.close()})}let s=e(this,a).get(r);s!=null&&s.length||(s=[],e(this,a).set(r,s)),e(this,f).push(t),s.push(t)}remove(r,t){if(n(this,f,e(this,f).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,a).forEach(o=>{o.forEach(l=>s.push(l))}),e(this,a).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,a).get(r);e(this,a).delete(r),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,a).get(r);s&&(s=s.filter(o=>o!==t),e(this,a).set(r,s))}}}a=new WeakMap,f=new WeakMap,D=new WeakMap,F=new WeakMap;var p,$,T,d,y,P,k,g,C,A,L,R,u,S,_,j,x,M,H,O;const E=class E extends HTMLElement{constructor(){super();i(this,S);i(this,p);i(this,$);i(this,T);i(this,d);i(this,y);i(this,P);i(this,k);i(this,g);i(this,C);i(this,A);i(this,L);i(this,R);i(this,u);i(this,x);i(this,M);i(this,H);i(this,O);this.urlValue="",n(this,p,!1),n(this,d,new b.CSSProperty(this,"--history",!1)),n(this,y,new b.CSSProperty(this,"--restore",!1)),n(this,P,new b.CSSProperty(this,"--close-rest",!1)),n(this,k,new b.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new b.CSSProperty(this,"--group","")),n(this,C,new b.CSSProperty(this,"--click-outside",!1)),n(this,A,new b.CSSProperty(this,"--escape",!1)),n(this,L,!1),n(this,u,new se.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1})),n(this,x,()=>{n(this,L,!1),e(this,p)&&e(this,d).current&&!location.search.includes(this.id)?this.close():!e(this,p)&&e(this,d).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,L,!0)}),n(this,M,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,H).call(this)}),n(this,H,ie.debounce(()=>{e(this,O).call(this)},10)),n(this,O,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,u).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),o=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!o)}})}get history(){return e(this,d)}get restore(){return e(this,y)}get closeRest(){return e(this,P)}get closeRestInGroup(){return e(this,k)}get group(){return e(this,g)}get clickOutside(){return e(this,C)}get escape(){return e(this,A)}get opened(){return e(this,p)}get lastTrigger(){return e(this,R)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,p)&&I.updateSearchParameter(this.id,t)}open(t){if(e(this,p))return;n(this,R,t==null?void 0:t.trigger),clearTimeout(e(this,$)),e(this,u).set("closing",!1),e(this,u).set("triggered",!0),U.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,R)}}),e(this,d).current&&e(this,L)&&history.pushState(history.state,"",e(this,S,_)),n(this,p,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,O).call(this),e(this,u).set("opened",!0),U.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,R)}}),n(this,T,void 0)};t!=null&&t.skipTransition?s():n(this,T,setTimeout(s,10))}close(){e(this,p)&&(clearTimeout(e(this,T)),E.stack.remove(e(this,g).current,this),n(this,p,!1),m(this,S,j).call(this),e(this,u).set("opened",!1),e(this,u).set("closing",!0),U.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,$,setTimeout(()=>{e(this,u).set("triggered",!1),e(this,u).set("closing",!1),U.dispatchEvent(this,"popoverClosed",{custom:!0})},re.getElementTransitionDurationMS(this)+10)))}connectedCallback(){e(this,d).observe(),e(this,y).observe(),e(this,P).observe(),e(this,k).observe(),e(this,g).observe(),e(this,C).observe(),e(this,A).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,x)),setTimeout(()=>{e(this,y).current?(this.urlValue=I.parseSearchParameters(location.search)[this.id],e(this,x).call(this)):(m(this,S,j).call(this),n(this,L,!0))},0),N.windowResizer.subscribe(e(this,M))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),N.windowResizer.unsubscribe(e(this,M)),e(this,u).close(),e(this,d).close(),e(this,y).close(),e(this,P).close(),e(this,k).close(),e(this,g).close(),e(this,C).close(),e(this,A).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,x)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),m(this,S,j).call(this)}};p=new WeakMap,$=new WeakMap,T=new WeakMap,d=new WeakMap,y=new WeakMap,P=new WeakMap,k=new WeakMap,g=new WeakMap,C=new WeakMap,A=new WeakMap,L=new WeakMap,R=new WeakMap,u=new WeakMap,S=new WeakSet,_=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},j=function(){if(e(this,d).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},x=new WeakMap,M=new WeakMap,H=new WeakMap,O=new WeakMap,E.stack=new oe;let V=E;X.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",V);var h,v,w,K,z,W,B,G,Q;class ee extends HTMLElement{constructor(){super();i(this,w);i(this,h);i(this,v,new b.CSSProperty(this,"--type","open"));i(this,z,()=>{this.classList.add("triggered")});i(this,W,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});i(this,B,()=>{this.classList.remove("opened")});i(this,G,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});X.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,v).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,v)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(m(this,w,K).call(this),t){let o=null;if(t==="parent"){const l=this.closest("[popover]");if(l)o=l;else{const q=this.getRootNode();q instanceof ShadowRoot?o=q.host.closest("[popover]"):q instanceof HTMLElement&&(o=q.closest("[popover]"))}}else t==="sibling"?o=(s=this.parentElement)==null?void 0:s.querySelector("[popover]"):(!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),o=document.querySelector(t)||this.getRootNode().querySelector(t));o instanceof HTMLElement?(n(this,h,o),e(this,h).addEventListener("popoverTriggered",e(this,z)),e(this,h).addEventListener("popoverOpened",e(this,W)),e(this,h).addEventListener("popoverClosing",e(this,B)),e(this,h).addEventListener("popoverClosed",e(this,G))):console.warn(this,`target ${t} not found`)}m(this,w,Q).call(this,e(this,v).current)}connectedCallback(){e(this,v).subscribe(s=>{m(this,w,Q).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,v).observe()}disconnectedCallback(){e(this,v).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),m(this,w,K).call(this)}}h=new WeakMap,v=new WeakMap,w=new WeakSet,K=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,z)),e(this,h).removeEventListener("popoverOpened",e(this,W)),e(this,h).removeEventListener("popoverClosing",e(this,B)),e(this,h).removeEventListener("popoverClosed",e(this,G)))},z=new WeakMap,W=new WeakMap,B=new WeakMap,G=new WeakMap,Q=function(t){e(this,h)instanceof V&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};X.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ee);exports.PopoverButtonElement=ee;exports.PopoverElement=V;
|
package/lib/popover/index.js
CHANGED
|
@@ -11,10 +11,10 @@ import { d as te } from "../function-C10DGppn.js";
|
|
|
11
11
|
import { g as se } from "../style-j2TwriJ_.js";
|
|
12
12
|
import { u as ie, p as re } from "../url-B6BNcw6_.js";
|
|
13
13
|
import { windowResizer as I } from "../window-resizer/index.js";
|
|
14
|
-
var
|
|
14
|
+
var a, g, j, F;
|
|
15
15
|
class oe {
|
|
16
16
|
constructor() {
|
|
17
|
-
i(this,
|
|
17
|
+
i(this, a, /* @__PURE__ */ new Map());
|
|
18
18
|
i(this, g, []);
|
|
19
19
|
i(this, j, (r) => {
|
|
20
20
|
var s;
|
|
@@ -25,7 +25,7 @@ class oe {
|
|
|
25
25
|
(Y) => Y instanceof HTMLElement && Y.hasAttribute("data-popover-content")
|
|
26
26
|
))
|
|
27
27
|
return;
|
|
28
|
-
const
|
|
28
|
+
const l = o[0], $ = l instanceof Node && (t.contains(l) || ((s = t.shadowRoot) == null ? void 0 : s.contains(l))), _ = l instanceof HTMLElement && l.hasAttribute("data-outside");
|
|
29
29
|
(!$ || _) && t.close();
|
|
30
30
|
}
|
|
31
31
|
});
|
|
@@ -38,45 +38,45 @@ class oe {
|
|
|
38
38
|
addEventListener("click", e(this, j)), addEventListener("keydown", e(this, F));
|
|
39
39
|
}
|
|
40
40
|
get groups() {
|
|
41
|
-
return e(this,
|
|
41
|
+
return e(this, a);
|
|
42
42
|
}
|
|
43
43
|
get stack() {
|
|
44
44
|
return e(this, g);
|
|
45
45
|
}
|
|
46
46
|
add(r, t) {
|
|
47
47
|
if (t.closeRest.current)
|
|
48
|
-
e(this,
|
|
49
|
-
o.forEach((
|
|
50
|
-
|
|
48
|
+
e(this, a).forEach((o) => {
|
|
49
|
+
o.forEach((l) => {
|
|
50
|
+
l.close();
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
else if (t.closeRestInGroup.current) {
|
|
54
|
-
let o = e(this,
|
|
55
|
-
o == null || o.forEach((
|
|
56
|
-
|
|
54
|
+
let o = e(this, a).get(r);
|
|
55
|
+
o == null || o.forEach((l) => {
|
|
56
|
+
l.close();
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
let s = e(this,
|
|
60
|
-
s != null && s.length || (s = [], e(this,
|
|
59
|
+
let s = e(this, a).get(r);
|
|
60
|
+
s != null && s.length || (s = [], e(this, a).set(r, s)), e(this, g).push(t), s.push(t);
|
|
61
61
|
}
|
|
62
62
|
remove(r, t) {
|
|
63
63
|
if (h(this, g, e(this, g).filter((s) => s !== t)), t.closeRest.current) {
|
|
64
64
|
let s = [];
|
|
65
|
-
e(this,
|
|
66
|
-
o.forEach((
|
|
67
|
-
}), e(this,
|
|
65
|
+
e(this, a).forEach((o) => {
|
|
66
|
+
o.forEach((l) => s.push(l));
|
|
67
|
+
}), e(this, a).clear(), s.forEach((o) => o.close());
|
|
68
68
|
} else if (t.closeRestInGroup.current) {
|
|
69
|
-
const s = e(this,
|
|
70
|
-
e(this,
|
|
69
|
+
const s = e(this, a).get(r);
|
|
70
|
+
e(this, a).delete(r), s == null || s.forEach((o) => {
|
|
71
71
|
o.close();
|
|
72
72
|
});
|
|
73
73
|
} else {
|
|
74
|
-
let s = e(this,
|
|
75
|
-
s && (s = s.filter((o) => o !== t), e(this,
|
|
74
|
+
let s = e(this, a).get(r);
|
|
75
|
+
s && (s = s.filter((o) => o !== t), e(this, a).set(r, s));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
a = new WeakMap(), g = new WeakMap(), j = new WeakMap(), F = new WeakMap();
|
|
80
80
|
var p, V, w, d, L, A, P, f, S, R, y, C, u, T, N, U, x, M, H, O;
|
|
81
81
|
const E = class E extends HTMLElement {
|
|
82
82
|
constructor() {
|
|
@@ -127,7 +127,7 @@ const E = class E extends HTMLElement {
|
|
|
127
127
|
`${this.group.current}-closing`,
|
|
128
128
|
t.current.closing
|
|
129
129
|
);
|
|
130
|
-
const s = E.stack.groups.get(this.group.current), o = s == null ? void 0 : s.find((
|
|
130
|
+
const s = E.stack.groups.get(this.group.current), o = s == null ? void 0 : s.find((l) => l.opened);
|
|
131
131
|
document.documentElement.classList.toggle(
|
|
132
132
|
`${this.group.current}-opened`,
|
|
133
133
|
!!o
|
|
@@ -254,14 +254,14 @@ class he extends HTMLElement {
|
|
|
254
254
|
if (m(this, k, K).call(this), t) {
|
|
255
255
|
let o = null;
|
|
256
256
|
if (t === "parent") {
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
o =
|
|
257
|
+
const l = this.closest("[popover]");
|
|
258
|
+
if (l)
|
|
259
|
+
o = l;
|
|
260
260
|
else {
|
|
261
261
|
const $ = this.getRootNode();
|
|
262
|
-
$ instanceof ShadowRoot ? o = $.host.closest("[popover
|
|
262
|
+
$ instanceof ShadowRoot ? o = $.host.closest("[popover]") : $ instanceof HTMLElement && (o = $.closest("[popover]"));
|
|
263
263
|
}
|
|
264
|
-
} else t === "sibling" ? o = (s = this.parentElement) == null ? void 0 : s.querySelector("[popover
|
|
264
|
+
} else t === "sibling" ? o = (s = this.parentElement) == null ? void 0 : s.querySelector("[popover]") : (!t.startsWith(".") && !t.startsWith("[") && (t = `#${t}`), o = document.querySelector(t) || this.getRootNode().querySelector(t));
|
|
265
265
|
o instanceof HTMLElement ? (h(this, n, o), e(this, n).addEventListener(
|
|
266
266
|
"popoverTriggered",
|
|
267
267
|
e(this, W)
|