aptechka 0.68.5 → 0.68.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.
- package/lib/css-value-parser/index.cjs +1 -1
- package/lib/css-value-parser/index.js +11 -10
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +125 -113
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../css-unit-parser/index.cjs"),w=require("../Viewport-DB0qAZPJ.cjs"),c=class c{parse(s,r){var h;const t=parseFloat(s),o=!isNaN(t),i=o?(h=s.match(/[a-z]+$/i))==null?void 0:h[0]:void 0;return o&&!i?t:i?i==="px"?t:i==="oh"?((r==null?void 0:r.offsetHeight)||0)*(t/100):i==="ow"?((r==null?void 0:r.offsetWidth)||0)*(t/100):i==="ohmh"?(((r==null?void 0:r.offsetHeight)||0)-w.viewport.height)*(t/100):i==="owmw"?(((r==null?void 0:r.offsetWidth)||0)-w.viewport.width)*(t/100):i&&c.CSS_UNITS.has(i)?u.cssUnitParser.parse(s):s:s.includes("calc")?s.includes("raw!")?s.replace("raw!",""):u.cssUnitParser.parse(s):s==="true"?!0:s==="false"?!1:s}};c.CSS_UNITS=new Set(["px","rem","vw","vh","vmin","vmax","em","cm","mm","Q","in","pc","pt","ex","ch","lh","rlh","vb","vi","svw","svh","lvw","lvh","dvw","dvh"]);let f=c;const e=new f;exports.cssValueParser=e;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { cssUnitParser as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { cssUnitParser as p } from "../css-unit-parser/index.js";
|
|
2
|
+
import { v as w } from "../Viewport-DA10iWAO.js";
|
|
3
|
+
const t = class t {
|
|
4
|
+
parse(s, r) {
|
|
5
|
+
var c;
|
|
6
|
+
const f = parseFloat(s), o = !isNaN(f), i = o ? (c = s.match(/[a-z]+$/i)) == null ? void 0 : c[0] : void 0;
|
|
7
|
+
return o && !i ? f : i ? i === "px" ? f : i === "oh" ? ((r == null ? void 0 : r.offsetHeight) || 0) * (f / 100) : i === "ow" ? ((r == null ? void 0 : r.offsetWidth) || 0) * (f / 100) : i === "ohmh" ? (((r == null ? void 0 : r.offsetHeight) || 0) - w.height) * (f / 100) : i === "owmw" ? (((r == null ? void 0 : r.offsetWidth) || 0) - w.width) * (f / 100) : i && t.CSS_UNITS.has(i) ? p.parse(s) : s : s.includes("calc") ? s.includes("raw!") ? s.replace("raw!", "") : p.parse(s) : s === "true" ? !0 : s === "false" ? !1 : s;
|
|
7
8
|
}
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
t.CSS_UNITS = /* @__PURE__ */ new Set([
|
|
10
11
|
"px",
|
|
11
12
|
"rem",
|
|
12
13
|
"vw",
|
|
@@ -33,8 +34,8 @@ c.CSS_UNITS = /* @__PURE__ */ new Set([
|
|
|
33
34
|
"dvw",
|
|
34
35
|
"dvh"
|
|
35
36
|
]);
|
|
36
|
-
let
|
|
37
|
-
const
|
|
37
|
+
let h = t;
|
|
38
|
+
const d = new h();
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
+
d as cssValueParser
|
|
40
41
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),y=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-BT4fssbO.cjs"),re=require("../window-resizer/index.cjs"),F=require("../Viewport-DB0qAZPJ.cjs");var u,b,J,K;class le{constructor(){r(this,u,new Map);r(this,b,[]);r(this,J,o=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,b).push(t),s.push(t)}remove(o,t){if(n(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,b=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,C,B,v,w,A,x,g,R,q,L,T,O,a,P,oe,I,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,C);r(this,B);r(this,v);r(this,w);r(this,A);r(this,x);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,A,new m.CSSProperty(this,"--close-rest",!1)),n(this,x,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"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,a).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),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),this.openClass&&this.openClass.split(" ").map(i=>{document.documentElement.classList.add(i.trim())}),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)},bubbles:!0}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),y(this,P,I).call(this),this.openClass&&this.openClass.split(" ").map(t=>{document.documentElement.classList.remove(t.trim())}),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,A).observe(),e(this,x).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,A).close(),e(this,x).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,A=new WeakMap,x=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,N;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}y(this,k,N).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,N).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,N=function(t){e(this,h)instanceof z&&(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")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
|
1
|
+
"use strict";var ie=c=>{throw TypeError(c)};var N=(c,n,t)=>n.has(c)||ie("Cannot "+t);var e=(c,n,t)=>(N(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?ie("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(N(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),y=(c,n,t)=>(N(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const le=require("../element-linked-store/index.cjs"),g=require("../css-property/index.cjs"),te=require("../index-DekP7OZe.cjs"),I=require("../events-KVanG9sR.cjs"),ae=require("../function-MthRj-GJ.cjs"),re=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const oe=require("../url-BT4fssbO.cjs"),ne=require("../window-resizer/index.cjs"),J=require("../Viewport-DB0qAZPJ.cjs");var u,b,Q,Z;class ue{constructor(){r(this,u,new Map);r(this,b,[]);r(this,Q,n=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(se=>se instanceof HTMLElement&&se.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),W=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||W)&&t.close()}});r(this,Z,n=>{if(n.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,Q)),addEventListener("keydown",e(this,Z))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(n,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(n);s!=null&&s.length||(s=[],e(this,u).set(n,s)),e(this,b).push(t),s.push(t)}remove(n,t){if(o(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(n);e(this,u).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(n);s&&(s=s.filter(i=>i!==t),e(this,u).set(n,s))}}}u=new WeakMap,b=new WeakMap,Q=new WeakMap,Z=new WeakMap;var f,M,B,C,H,v,w,A,x,m,R,q,L,S,$,a,O,P,he,K,V,T,D,U,z;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,B);r(this,C);r(this,H);r(this,v);r(this,w);r(this,A);r(this,x);r(this,m);r(this,R);r(this,q);r(this,L);r(this,S);r(this,$);r(this,a);r(this,O);r(this,V);r(this,T);r(this,D);r(this,U);r(this,z);this.urlValue="",o(this,f,!1),o(this,v,new g.CSSProperty(this,"--history",!1)),o(this,w,new g.CSSProperty(this,"--restore",!1)),o(this,A,new g.CSSProperty(this,"--close-rest",!1)),o(this,x,new g.CSSProperty(this,"--close-rest-in-group",!1)),o(this,m,new g.CSSProperty(this,"--group","")),o(this,R,new g.CSSProperty(this,"--click-outside",!1)),o(this,q,new g.CSSProperty(this,"--escape",!1)),o(this,L,new g.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,S,!1),o(this,a,new le.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),o(this,O,[]),o(this,V,()=>{o(this,S,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,S,!0)}),o(this,T,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,D).call(this)}),o(this,D,ae.debounce(()=>{e(this,U).call(this)},10)),o(this,U,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>J.viewport.width?s=J.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>J.viewport.height?i=J.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,z,()=>{this.close()}),e(this,m).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,a).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),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,m)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&oe.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,M)),clearTimeout(e(this,B)),this.openClass&&this.openClass.split(" ").map(i=>{document.documentElement.classList.add(i.trim())}),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,v).current&&e(this,S)&&history.pushState(history.state,"",e(this,P,he)),o(this,f,!0);const s=()=>{E.stack.add(e(this,m).current,this),e(this,T).call(this),e(this,a).set("opened",!0),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,C,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0)},re.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,H)),E.stack.remove(e(this,m).current,this),o(this,f,!1),y(this,P,K).call(this),this.openClass&&this.openClass.split(" ").map(t=>{document.documentElement.classList.remove(t.trim())}),e(this,a).set("transitionend",!1),o(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),I.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),I.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},re.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,O,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,O).forEach(t=>{t.addEventListener("click",e(this,z))}),e(this,v).observe(),e(this,w).observe(),e(this,A).observe(),e(this,x).observe(),e(this,m).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=oe.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,K).call(this),o(this,S,!0))},0),e(this,L).subscribe(()=>{e(this,T).call(this)}),ne.windowResizer.subscribe(e(this,T))}disconnectedCallback(){e(this,O).forEach(t=>{t.removeEventListener("click",e(this,z))}),E.stack.remove(e(this,m).current,this),ne.windowResizer.unsubscribe(e(this,T)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,A).close(),e(this,x).close(),e(this,m).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,M)),clearTimeout(e(this,B)),clearTimeout(e(this,C)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,K).call(this)}};f=new WeakMap,M=new WeakMap,B=new WeakMap,C=new WeakMap,H=new WeakMap,v=new WeakMap,w=new WeakMap,A=new WeakMap,x=new WeakMap,m=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,S=new WeakMap,$=new WeakMap,a=new WeakMap,O=new WeakMap,P=new WeakSet,he=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},K=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,T=new WeakMap,D=new WeakMap,U=new WeakMap,z=new WeakMap,E.stack=new ue;let G=E;te.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",G);var h,d,k,_,j,X,Y,F,ee;class ce extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new g.CSSProperty(this,"--type","open"));r(this,j,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,Y,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,F,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});te.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).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"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,_).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let W=p.querySelector("[data-popover]");return!W&&(p!=null&&p.parentElement)&&(W=l(p.parentElement)),W};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,j)),e(this,h).addEventListener("popoverOpened",e(this,X)),e(this,h).addEventListener("popoverClosing",e(this,Y)),e(this,h).addEventListener("popoverClosed",e(this,F))):console.warn(this,`target ${t} not found`)}y(this,k,ee).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,ee).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,_).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,_=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,j)),e(this,h).removeEventListener("popoverOpened",e(this,X)),e(this,h).removeEventListener("popoverClosing",e(this,Y)),e(this,h).removeEventListener("popoverClosed",e(this,F)))},j=new WeakMap,X=new WeakMap,Y=new WeakMap,F=new WeakMap,ee=function(t){e(this,h)instanceof G&&(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")))};te.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ce);exports.PopoverButtonElement=ce;exports.PopoverElement=G;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var
|
|
1
|
+
var it = (c) => {
|
|
2
2
|
throw TypeError(c);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (c,
|
|
6
|
-
import { ElementLinkedStore as
|
|
7
|
-
import { CSSProperty as
|
|
8
|
-
import { i as
|
|
9
|
-
import { d as
|
|
10
|
-
import { d as
|
|
11
|
-
import { g as
|
|
4
|
+
var N = (c, h, e) => h.has(c) || it("Cannot " + e);
|
|
5
|
+
var t = (c, h, e) => (N(c, h, "read from private field"), e ? e.call(c) : h.get(c)), r = (c, h, e) => h.has(c) ? it("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(c) : h.set(c, e), o = (c, h, e, s) => (N(c, h, "write to private field"), s ? s.call(c, e) : h.set(c, e), e), E = (c, h, e) => (N(c, h, "access private method"), e);
|
|
6
|
+
import { ElementLinkedStore as nt } from "../element-linked-store/index.js";
|
|
7
|
+
import { CSSProperty as g } from "../css-property/index.js";
|
|
8
|
+
import { i as et } from "../index-Bv9zgfdb.js";
|
|
9
|
+
import { d as F } from "../events-CsVF98U6.js";
|
|
10
|
+
import { d as ct } from "../function-C10DGppn.js";
|
|
11
|
+
import { g as rt } from "../style-j2TwriJ_.js";
|
|
12
12
|
import "construct-style-sheets-polyfill";
|
|
13
|
-
import { u as
|
|
14
|
-
import { windowResizer as
|
|
15
|
-
import { v as
|
|
16
|
-
var u, b,
|
|
17
|
-
class
|
|
13
|
+
import { u as lt, p as at } from "../url-Cb0SFRMc.js";
|
|
14
|
+
import { windowResizer as ot } from "../window-resizer/index.js";
|
|
15
|
+
import { v as I } from "../Viewport-DA10iWAO.js";
|
|
16
|
+
var u, b, Q, Z;
|
|
17
|
+
class ut {
|
|
18
18
|
constructor() {
|
|
19
19
|
r(this, u, /* @__PURE__ */ new Map());
|
|
20
20
|
r(this, b, []);
|
|
21
|
-
r(this,
|
|
21
|
+
r(this, Q, (h) => {
|
|
22
22
|
var s;
|
|
23
23
|
const e = [...t(this, b)].reverse().find((i) => i.clickOutside.current);
|
|
24
24
|
if (e) {
|
|
25
|
-
const i =
|
|
25
|
+
const i = h.composedPath();
|
|
26
26
|
if (i.find(
|
|
27
|
-
(
|
|
27
|
+
(st) => st instanceof HTMLElement && st.hasAttribute("data-popover-content")
|
|
28
28
|
))
|
|
29
29
|
return;
|
|
30
|
-
const l = i[0], p = l instanceof Node && (e.contains(l) || ((s = e.shadowRoot) == null ? void 0 : s.contains(l))),
|
|
31
|
-
(!p ||
|
|
30
|
+
const l = i[0], p = l instanceof Node && (e.contains(l) || ((s = e.shadowRoot) == null ? void 0 : s.contains(l))), z = l instanceof HTMLElement && l.hasAttribute("data-outside");
|
|
31
|
+
(!p || z) && e.close();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
r(this,
|
|
35
|
-
if (
|
|
34
|
+
r(this, Z, (h) => {
|
|
35
|
+
if (h.code === "Escape") {
|
|
36
36
|
const e = [...t(this, b)].reverse().find((s) => s.escape.current);
|
|
37
37
|
e && e.close();
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
document.documentElement.addEventListener(
|
|
41
41
|
"click",
|
|
42
|
-
t(this,
|
|
43
|
-
), addEventListener("keydown", t(this,
|
|
42
|
+
t(this, Q)
|
|
43
|
+
), addEventListener("keydown", t(this, Z));
|
|
44
44
|
}
|
|
45
45
|
get groups() {
|
|
46
46
|
return t(this, u);
|
|
@@ -48,7 +48,7 @@ class lt {
|
|
|
48
48
|
get stack() {
|
|
49
49
|
return t(this, b);
|
|
50
50
|
}
|
|
51
|
-
add(
|
|
51
|
+
add(h, e) {
|
|
52
52
|
if (e.closeRest.current)
|
|
53
53
|
t(this, u).forEach((i) => {
|
|
54
54
|
i.forEach((l) => {
|
|
@@ -56,80 +56,84 @@ class lt {
|
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
else if (e.closeRestInGroup.current) {
|
|
59
|
-
let i = t(this, u).get(
|
|
59
|
+
let i = t(this, u).get(h);
|
|
60
60
|
i == null || i.forEach((l) => {
|
|
61
61
|
l.close();
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
let s = t(this, u).get(
|
|
65
|
-
s != null && s.length || (s = [], t(this, u).set(
|
|
64
|
+
let s = t(this, u).get(h);
|
|
65
|
+
s != null && s.length || (s = [], t(this, u).set(h, s)), t(this, b).push(e), s.push(e);
|
|
66
66
|
}
|
|
67
|
-
remove(
|
|
68
|
-
if (
|
|
67
|
+
remove(h, e) {
|
|
68
|
+
if (o(this, b, t(this, b).filter((s) => s !== e)), e.closeRest.current) {
|
|
69
69
|
let s = [];
|
|
70
70
|
t(this, u).forEach((i) => {
|
|
71
71
|
i.forEach((l) => s.push(l));
|
|
72
72
|
}), t(this, u).clear(), s.forEach((i) => i.close());
|
|
73
73
|
} else if (e.closeRestInGroup.current) {
|
|
74
|
-
const s = t(this, u).get(
|
|
75
|
-
t(this, u).delete(
|
|
74
|
+
const s = t(this, u).get(h);
|
|
75
|
+
t(this, u).delete(h), s == null || s.forEach((i) => {
|
|
76
76
|
i.close();
|
|
77
77
|
});
|
|
78
78
|
} else {
|
|
79
|
-
let s = t(this, u).get(
|
|
80
|
-
s && (s = s.filter((i) => i !== e), t(this, u).set(
|
|
79
|
+
let s = t(this, u).get(h);
|
|
80
|
+
s && (s = s.filter((i) => i !== e), t(this, u).set(h, s));
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
u = new WeakMap(), b = new WeakMap(),
|
|
85
|
-
var f,
|
|
86
|
-
const
|
|
84
|
+
u = new WeakMap(), b = new WeakMap(), Q = new WeakMap(), Z = new WeakMap();
|
|
85
|
+
var f, H, W, P, q, m, L, x, S, v, R, $, w, T, O, a, V, A, ht, J, M, k, B, D, G;
|
|
86
|
+
const y = class y extends HTMLElement {
|
|
87
87
|
constructor() {
|
|
88
88
|
super();
|
|
89
89
|
r(this, A);
|
|
90
90
|
r(this, f);
|
|
91
|
-
r(this, M);
|
|
92
91
|
r(this, H);
|
|
93
|
-
r(this, C);
|
|
94
92
|
r(this, W);
|
|
93
|
+
r(this, P);
|
|
94
|
+
r(this, q);
|
|
95
95
|
r(this, m);
|
|
96
|
-
r(this,
|
|
96
|
+
r(this, L);
|
|
97
97
|
r(this, x);
|
|
98
98
|
r(this, S);
|
|
99
|
-
r(this,
|
|
99
|
+
r(this, v);
|
|
100
100
|
r(this, R);
|
|
101
101
|
r(this, $);
|
|
102
|
-
r(this,
|
|
102
|
+
r(this, w);
|
|
103
103
|
r(this, T);
|
|
104
104
|
r(this, O);
|
|
105
105
|
r(this, a);
|
|
106
106
|
r(this, V);
|
|
107
|
+
r(this, M);
|
|
107
108
|
r(this, k);
|
|
108
|
-
r(this,
|
|
109
|
-
r(this,
|
|
110
|
-
|
|
109
|
+
r(this, B);
|
|
110
|
+
r(this, D);
|
|
111
|
+
r(this, G);
|
|
112
|
+
this.urlValue = "", o(this, f, !1), o(this, m, new g(this, "--history", !1)), o(this, L, new g(this, "--restore", !1)), o(this, x, new g(this, "--close-rest", !1)), o(this, S, new g(
|
|
111
113
|
this,
|
|
112
114
|
"--close-rest-in-group",
|
|
113
115
|
!1
|
|
114
|
-
)),
|
|
116
|
+
)), o(this, v, new g(this, "--group", "")), o(this, R, new g(this, "--click-outside", !1)), o(this, $, new g(this, "--escape", !1)), o(this, w, new g(this, "--check-viewport-bounds", !1)), o(this, T, !1), o(this, a, new nt(this, {
|
|
115
117
|
opened: !1,
|
|
116
118
|
closing: !1,
|
|
117
119
|
triggered: !1,
|
|
118
120
|
transitionend: !1
|
|
119
|
-
})),
|
|
120
|
-
|
|
121
|
-
}),
|
|
122
|
-
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), this.style.setProperty("--viewport-offset-x", "0px"), this.style.setProperty("--viewport-offset-y", "0px"), t(this,
|
|
123
|
-
}),
|
|
124
|
-
t(this,
|
|
125
|
-
}, 10)),
|
|
126
|
-
if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this,
|
|
121
|
+
})), o(this, V, []), o(this, M, () => {
|
|
122
|
+
o(this, T, !1), t(this, f) && t(this, m).current && !location.search.includes(this.id) ? this.close() : !t(this, f) && t(this, m).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), o(this, T, !0);
|
|
123
|
+
}), o(this, k, () => {
|
|
124
|
+
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), this.style.setProperty("--viewport-offset-x", "0px"), this.style.setProperty("--viewport-offset-y", "0px"), t(this, B).call(this);
|
|
125
|
+
}), o(this, B, ct(() => {
|
|
126
|
+
t(this, D).call(this);
|
|
127
|
+
}, 10)), o(this, D, () => {
|
|
128
|
+
if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this, w).current) {
|
|
127
129
|
const e = this.getBoundingClientRect();
|
|
128
130
|
let s = 0, i = 0;
|
|
129
|
-
e.right >
|
|
131
|
+
e.right > I.width ? s = I.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > I.height ? i = I.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
|
|
130
132
|
}
|
|
131
|
-
}),
|
|
132
|
-
|
|
133
|
+
}), o(this, G, () => {
|
|
134
|
+
this.close();
|
|
135
|
+
}), t(this, v).subscribe((e) => {
|
|
136
|
+
e.previous && (y.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
|
|
133
137
|
`${this.group.previous}-closing`
|
|
134
138
|
), document.documentElement.classList.remove(
|
|
135
139
|
`${this.group.previous}-opened`
|
|
@@ -140,7 +144,7 @@ const E = class E extends HTMLElement {
|
|
|
140
144
|
`${this.group.current}-closing`,
|
|
141
145
|
e.current.closing
|
|
142
146
|
);
|
|
143
|
-
const s =
|
|
147
|
+
const s = y.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((l) => l.opened);
|
|
144
148
|
document.documentElement.classList.toggle(
|
|
145
149
|
`${this.group.current}-opened`,
|
|
146
150
|
!!i
|
|
@@ -155,7 +159,7 @@ const E = class E extends HTMLElement {
|
|
|
155
159
|
return t(this, m);
|
|
156
160
|
}
|
|
157
161
|
get restore() {
|
|
158
|
-
return t(this,
|
|
162
|
+
return t(this, L);
|
|
159
163
|
}
|
|
160
164
|
get closeRest() {
|
|
161
165
|
return t(this, x);
|
|
@@ -164,7 +168,7 @@ const E = class E extends HTMLElement {
|
|
|
164
168
|
return t(this, S);
|
|
165
169
|
}
|
|
166
170
|
get group() {
|
|
167
|
-
return t(this,
|
|
171
|
+
return t(this, v);
|
|
168
172
|
}
|
|
169
173
|
get clickOutside() {
|
|
170
174
|
return t(this, R);
|
|
@@ -182,88 +186,96 @@ const E = class E extends HTMLElement {
|
|
|
182
186
|
return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
|
|
183
187
|
}
|
|
184
188
|
updateUrlValue(e) {
|
|
185
|
-
this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this, f) &&
|
|
189
|
+
this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this, f) && lt(this.id, e);
|
|
186
190
|
}
|
|
187
191
|
open(e) {
|
|
188
192
|
if (t(this, f))
|
|
189
193
|
return;
|
|
190
|
-
|
|
194
|
+
o(this, O, e == null ? void 0 : e.trigger), clearTimeout(t(this, H)), clearTimeout(t(this, W)), this.openClass && this.openClass.split(" ").map((i) => {
|
|
191
195
|
document.documentElement.classList.add(i.trim());
|
|
192
|
-
}), t(this, a).set("closing", !1), t(this, a).set("triggered", !0),
|
|
196
|
+
}), t(this, a).set("closing", !1), t(this, a).set("triggered", !0), F(this, "popoverTriggered", {
|
|
193
197
|
custom: !0,
|
|
194
198
|
detail: {
|
|
195
199
|
trigger: t(this, O)
|
|
196
200
|
}
|
|
197
|
-
}), t(this, m).current && t(this, T) && history.pushState(history.state, "", t(this, A,
|
|
201
|
+
}), t(this, m).current && t(this, T) && history.pushState(history.state, "", t(this, A, ht)), o(this, f, !0);
|
|
198
202
|
const s = () => {
|
|
199
|
-
|
|
203
|
+
y.stack.add(t(this, v).current, this), t(this, k).call(this), t(this, a).set("opened", !0), F(this, "popoverOpened", {
|
|
200
204
|
custom: !0,
|
|
201
205
|
detail: {
|
|
202
206
|
trigger: t(this, O)
|
|
203
207
|
},
|
|
204
208
|
bubbles: !0
|
|
205
|
-
}),
|
|
209
|
+
}), o(this, P, void 0), o(this, q, setTimeout(() => {
|
|
206
210
|
t(this, a).set("transitionend", !0);
|
|
207
|
-
},
|
|
211
|
+
}, rt(this) + 10));
|
|
208
212
|
};
|
|
209
|
-
e != null && e.skipTransition ? s() :
|
|
213
|
+
e != null && e.skipTransition ? s() : o(this, P, setTimeout(s, 10));
|
|
210
214
|
}
|
|
211
215
|
close() {
|
|
212
|
-
t(this, f) && (clearTimeout(t(this,
|
|
216
|
+
t(this, f) && (clearTimeout(t(this, P)), clearTimeout(t(this, q)), y.stack.remove(t(this, v).current, this), o(this, f, !1), E(this, A, J).call(this), this.openClass && this.openClass.split(" ").map((e) => {
|
|
213
217
|
document.documentElement.classList.remove(e.trim());
|
|
214
|
-
}), t(this, a).set("transitionend", !1),
|
|
215
|
-
t(this, a).set("opened", !1), t(this, a).set("closing", !0),
|
|
218
|
+
}), t(this, a).set("transitionend", !1), o(this, H, setTimeout(() => {
|
|
219
|
+
t(this, a).set("opened", !1), t(this, a).set("closing", !0), F(this, "popoverClosing", {
|
|
216
220
|
custom: !0,
|
|
217
221
|
bubbles: !0
|
|
218
|
-
}),
|
|
219
|
-
t(this, a).set("triggered", !1), t(this, a).set("closing", !1),
|
|
222
|
+
}), o(this, W, setTimeout(() => {
|
|
223
|
+
t(this, a).set("triggered", !1), t(this, a).set("closing", !1), F(this, "popoverClosed", {
|
|
220
224
|
custom: !0,
|
|
221
225
|
bubbles: !0
|
|
222
226
|
});
|
|
223
|
-
},
|
|
227
|
+
}, rt(this) + 10));
|
|
224
228
|
}, 10)));
|
|
225
229
|
}
|
|
226
230
|
connectedCallback() {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
o(this, V, [
|
|
232
|
+
...this.querySelectorAll(
|
|
233
|
+
`[data-popover-close${this.id ? `="${this.id}"` : ""}]`
|
|
234
|
+
)
|
|
235
|
+
]), t(this, V).forEach((e) => {
|
|
236
|
+
e.addEventListener("click", t(this, G));
|
|
237
|
+
}), t(this, m).observe(), t(this, L).observe(), t(this, x).observe(), t(this, S).observe(), t(this, v).observe(), t(this, R).observe(), t(this, $).observe(), t(this, w).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, M)), setTimeout(() => {
|
|
238
|
+
t(this, L).current ? (this.urlValue = at(location.search)[this.id], t(this, M).call(this)) : (E(this, A, J).call(this), o(this, T, !0));
|
|
239
|
+
}, 0), t(this, w).subscribe(() => {
|
|
230
240
|
t(this, k).call(this);
|
|
231
|
-
}),
|
|
241
|
+
}), ot.subscribe(t(this, k));
|
|
232
242
|
}
|
|
233
243
|
disconnectedCallback() {
|
|
234
|
-
|
|
244
|
+
t(this, V).forEach((e) => {
|
|
245
|
+
e.removeEventListener("click", t(this, G));
|
|
246
|
+
}), y.stack.remove(t(this, v).current, this), ot.unsubscribe(t(this, k)), t(this, a).close(), t(this, m).close(), t(this, L).close(), t(this, x).close(), t(this, S).close(), t(this, v).close(), t(this, R).close(), t(this, $).close(), t(this, w).close(), this.removeAttribute("role"), clearTimeout(t(this, H)), clearTimeout(t(this, W)), clearTimeout(t(this, P)), clearTimeout(t(this, q)), removeEventListener("popstate", t(this, M)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), E(this, A, J).call(this);
|
|
235
247
|
}
|
|
236
248
|
};
|
|
237
|
-
f = new WeakMap(),
|
|
249
|
+
f = new WeakMap(), H = new WeakMap(), W = new WeakMap(), P = new WeakMap(), q = new WeakMap(), m = new WeakMap(), L = new WeakMap(), x = new WeakMap(), S = new WeakMap(), v = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), w = new WeakMap(), T = new WeakMap(), O = new WeakMap(), a = new WeakMap(), V = new WeakMap(), A = new WeakSet(), ht = function() {
|
|
238
250
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
239
|
-
},
|
|
251
|
+
}, J = function() {
|
|
240
252
|
if (t(this, m).current) {
|
|
241
253
|
const e = new URL(location.href);
|
|
242
254
|
e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
|
|
243
255
|
}
|
|
244
|
-
},
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
var n, d,
|
|
248
|
-
class
|
|
256
|
+
}, M = new WeakMap(), k = new WeakMap(), B = new WeakMap(), D = new WeakMap(), G = new WeakMap(), y.stack = new ut();
|
|
257
|
+
let K = y;
|
|
258
|
+
et && !customElements.get("e-popover") && customElements.define("e-popover", K);
|
|
259
|
+
var n, d, C, _, U, X, Y, j, tt;
|
|
260
|
+
class pt extends HTMLElement {
|
|
249
261
|
constructor() {
|
|
250
262
|
super();
|
|
251
|
-
r(this,
|
|
263
|
+
r(this, C);
|
|
252
264
|
r(this, n);
|
|
253
|
-
r(this, d, new
|
|
254
|
-
r(this,
|
|
265
|
+
r(this, d, new g(this, "--type", "open"));
|
|
266
|
+
r(this, U, () => {
|
|
255
267
|
t(this, d).current !== "close" && this.classList.add("triggered");
|
|
256
268
|
});
|
|
257
|
-
r(this,
|
|
269
|
+
r(this, X, () => {
|
|
258
270
|
t(this, d).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
|
|
259
271
|
});
|
|
260
|
-
r(this,
|
|
272
|
+
r(this, Y, () => {
|
|
261
273
|
t(this, d).current !== "close" && this.classList.remove("opened");
|
|
262
274
|
});
|
|
263
|
-
r(this,
|
|
275
|
+
r(this, j, () => {
|
|
264
276
|
t(this, d).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
|
|
265
277
|
});
|
|
266
|
-
|
|
278
|
+
et && (this.addEventListener("click", () => {
|
|
267
279
|
if (t(this, n)) {
|
|
268
280
|
const e = t(this, d).current;
|
|
269
281
|
e === "open" || e === "toggle" && !t(this, n).opened ? t(this, n).open({ trigger: this }) : (e === "close" || e === "toggle" && t(this, n).opened) && t(this, n).close();
|
|
@@ -280,7 +292,7 @@ class at extends HTMLElement {
|
|
|
280
292
|
}
|
|
281
293
|
changePopover(e) {
|
|
282
294
|
var s;
|
|
283
|
-
if (
|
|
295
|
+
if (E(this, C, _).call(this), e) {
|
|
284
296
|
let i = null;
|
|
285
297
|
if (e === "parent") {
|
|
286
298
|
const l = this.closest("[data-popover]");
|
|
@@ -296,61 +308,61 @@ class at extends HTMLElement {
|
|
|
296
308
|
const l = (p) => {
|
|
297
309
|
if (!p)
|
|
298
310
|
return null;
|
|
299
|
-
let
|
|
300
|
-
return !
|
|
311
|
+
let z = p.querySelector("[data-popover]");
|
|
312
|
+
return !z && (p != null && p.parentElement) && (z = l(p.parentElement)), z;
|
|
301
313
|
};
|
|
302
314
|
i = l(this.parentElement) || null;
|
|
303
315
|
} else
|
|
304
316
|
!e.startsWith(".") && !e.startsWith("[") && (e = `#${e}`), i = document.querySelector(e) || this.getRootNode().querySelector(e);
|
|
305
|
-
i instanceof HTMLElement ? (
|
|
317
|
+
i instanceof HTMLElement ? (o(this, n, i), t(this, n).addEventListener(
|
|
306
318
|
"popoverTriggered",
|
|
307
|
-
t(this,
|
|
319
|
+
t(this, U)
|
|
308
320
|
), t(this, n).addEventListener(
|
|
309
321
|
"popoverOpened",
|
|
310
|
-
t(this,
|
|
322
|
+
t(this, X)
|
|
311
323
|
), t(this, n).addEventListener(
|
|
312
324
|
"popoverClosing",
|
|
313
|
-
t(this,
|
|
325
|
+
t(this, Y)
|
|
314
326
|
), t(this, n).addEventListener(
|
|
315
327
|
"popoverClosed",
|
|
316
|
-
t(this,
|
|
328
|
+
t(this, j)
|
|
317
329
|
)) : console.warn(this, `target ${e} not found`);
|
|
318
330
|
}
|
|
319
|
-
|
|
331
|
+
E(this, C, tt).call(this, t(this, d).current);
|
|
320
332
|
}
|
|
321
333
|
connectedCallback() {
|
|
322
334
|
t(this, d).subscribe((s) => {
|
|
323
|
-
|
|
335
|
+
E(this, C, tt).call(this, s.current);
|
|
324
336
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("role") || this.setAttribute("role", "button");
|
|
325
337
|
const e = this.getAttribute("target");
|
|
326
338
|
e && this.changePopover(e), this.isConnected && t(this, d).observe();
|
|
327
339
|
}
|
|
328
340
|
disconnectedCallback() {
|
|
329
|
-
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"),
|
|
341
|
+
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), E(this, C, _).call(this);
|
|
330
342
|
}
|
|
331
343
|
}
|
|
332
|
-
n = new WeakMap(), d = new WeakMap(),
|
|
344
|
+
n = new WeakMap(), d = new WeakMap(), C = new WeakSet(), _ = function() {
|
|
333
345
|
t(this, n) && (t(this, n).removeEventListener(
|
|
334
346
|
"popoverTriggered",
|
|
335
|
-
t(this,
|
|
347
|
+
t(this, U)
|
|
336
348
|
), t(this, n).removeEventListener(
|
|
337
349
|
"popoverOpened",
|
|
338
|
-
t(this,
|
|
350
|
+
t(this, X)
|
|
339
351
|
), t(this, n).removeEventListener(
|
|
340
352
|
"popoverClosing",
|
|
341
|
-
t(this,
|
|
353
|
+
t(this, Y)
|
|
342
354
|
), t(this, n).removeEventListener(
|
|
343
355
|
"popoverClosed",
|
|
344
|
-
t(this,
|
|
356
|
+
t(this, j)
|
|
345
357
|
));
|
|
346
|
-
},
|
|
347
|
-
t(this, n) instanceof
|
|
358
|
+
}, U = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), j = new WeakMap(), tt = function(e) {
|
|
359
|
+
t(this, n) instanceof K && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
|
|
348
360
|
"aria-expanded",
|
|
349
361
|
t(this, n).opened ? "true" : "false"
|
|
350
362
|
), this.setAttribute("aria-controls", t(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
|
|
351
363
|
};
|
|
352
|
-
|
|
364
|
+
et && !customElements.get("e-popover-button") && customElements.define("e-popover-button", pt);
|
|
353
365
|
export {
|
|
354
|
-
|
|
355
|
-
|
|
366
|
+
pt as PopoverButtonElement,
|
|
367
|
+
K as PopoverElement
|
|
356
368
|
};
|