aptechka 0.39.2 → 0.39.4
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/morph/Morph.d.ts +6 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +139 -134
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +31 -31
- package/package.json +1 -1
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface MorphParameters {
|
|
|
9
9
|
export interface MorphNavigationEntry {
|
|
10
10
|
pathname: string;
|
|
11
11
|
isCached: boolean;
|
|
12
|
+
state?: any;
|
|
12
13
|
}
|
|
13
14
|
export interface MorphPreprocessorEntry extends MorphNavigationEntry {
|
|
14
15
|
resolve: () => void;
|
|
@@ -17,6 +18,10 @@ export interface MorphPreprocessorEntry extends MorphNavigationEntry {
|
|
|
17
18
|
export type MorphPreprocessor = (entry: MorphPreprocessorEntry) => void;
|
|
18
19
|
export type MorphNavigationCallback = (entry: MorphNavigationEntry) => void;
|
|
19
20
|
export type MorphPostprocessor = MorphNavigationCallback;
|
|
21
|
+
export interface MorphNavigateOptions {
|
|
22
|
+
historyAction?: ChangeHistoryAction;
|
|
23
|
+
state?: any;
|
|
24
|
+
}
|
|
20
25
|
export declare class Morph {
|
|
21
26
|
#private;
|
|
22
27
|
preprocessor?: MorphPreprocessor;
|
|
@@ -33,7 +38,7 @@ export declare class Morph {
|
|
|
33
38
|
beforeNavigationEvent(callback: MorphNavigationCallback): () => void;
|
|
34
39
|
afterNavigationEvent(callback: MorphNavigationCallback): () => void;
|
|
35
40
|
prefetch(path: string): Promise<Document>;
|
|
36
|
-
navigate(path: string, historyAction?:
|
|
41
|
+
navigate(path: string, { historyAction, state }?: MorphNavigateOptions): Promise<void>;
|
|
37
42
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
38
43
|
findLinks(): void;
|
|
39
44
|
}
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var nt=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),rt=s=>{throw TypeError(s)};var Q=(s,t,i)=>t.has(s)||rt("Cannot "+i);var e=(s,t,i)=>(Q(s,t,"read from private field"),i?i.call(s):t.get(s)),o=(s,t,i)=>t.has(s)?rt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),c=(s,t,i,n)=>(Q(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),L=(s,t,i)=>(Q(s,t,"access private method"),i);var N=(s,t,i)=>new Promise((n,l)=>{var d=m=>{try{p(i.next(m))}catch(w){l(w)}},a=m=>{try{p(i.throw(m))}catch(w){l(w)}},p=m=>m.done?n(m.value):Promise.resolve(m.value).then(d,a);p((i=i.apply(s,t)).next())});var at=(s,t,i)=>(t=s[nt("asyncIterator")])?t.call(s):(s=s[nt("iterator")](),t={},i=(n,l)=>(l=s[n])&&(t[n]=d=>new Promise((a,p,m)=>(d=l.call(s,d),m=d.done,Promise.resolve(d.value).then(w=>a({value:w,done:m}),p)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("../notifier/index.cjs"),ft=require("../browser-CpzFX2xg.cjs"),W=require("../url-DELd-VFC.cjs"),ht=require("../loading/index.cjs");var A,h,f,T,C,M,S,k;class ct{constructor(t,i){o(this,A);o(this,h);o(this,f);o(this,T);o(this,C);o(this,M);o(this,S,t=>{t.preventDefault(),e(this,A).links.forEach(i=>{var n;e(this,f)===e(i,f)||(n=e(i,M))!=null&&n.includes(e(this,f))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,A).navigate(e(this,f),{historyAction:e(this,T),state:e(this,C)})});o(this,k,()=>{e(this,A).prefetch(e(this,f)),e(this,h).removeEventListener("pointerenter",e(this,k))});var d,a;c(this,A,i),c(this,h,t),c(this,f,e(this,h).getAttribute("href")||"/"),c(this,T,e(this,h).getAttribute("data-history-action")||"push"),c(this,C,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,S));const n=i.normalizePath(e(this,f)),l=i.normalizePath(location.pathname);c(this,M,(d=e(this,h).getAttribute("data-match-paths"))==null?void 0:d.split(",").map(p=>i.normalizePath(p.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(n.pathname)&&e(this,h).classList.add("current"):n.pathname===l.pathname||(a=e(this,M))!=null&&a.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}destroy(){e(this,h).removeEventListener("click",e(this,S)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}A=new WeakMap,h=new WeakMap,f=new WeakMap,T=new WeakMap,C=new WeakMap,M=new WeakMap,S=new WeakMap,k=new WeakMap;var z,q,x,_,y,j,P,v,g,D,R,u,U,V,lt,X,K;class pt{constructor(t){o(this,u);o(this,z,null);o(this,q,null);o(this,x,null);o(this,_,null);o(this,y,[]);o(this,j,new DOMParser);o(this,P,new Map);o(this,v);o(this,g,null);o(this,D,new ot.Notifier);o(this,R,new ot.Notifier);o(this,K,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(ft.isBrowser){c(this,z,W.normalizeBase(t==null?void 0:t.base)),c(this,q,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,x,(t==null?void 0:t.cachePages)!==!1),c(this,_,L(this,u,V).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,g,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,g)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,K)),W.changeHistory("replace",e(this,g),i.parameters,i.hash)}}get currentPathname(){return e(this,g)}get links(){return e(this,y)}normalizePath(t){return W.splitPath(t,e(this,z))}beforeNavigationEvent(t){return e(this,D).subscribe(t)}afterNavigationEvent(t){return e(this,R).subscribe(t)}prefetch(t){return N(this,null,function*(){const i=this.normalizePath(t);return L(this,u,U).call(this,i.pathname)})}navigate(l){return N(this,arguments,function*(t,{historyAction:i="push",state:n}={}){var Z;const d=this.normalizePath(t);let{pathname:a,hash:p,parameters:m,leaf:w}=d;if(e(this,v)===a||e(this,g)===a)return;c(this,v,a);const F=e(this,P).has(a);try{ht.loading.add("__morph");let I=!0;if(e(this,D).notify({pathname:a,isCached:F,state:n}),this.preprocessor)try{yield new Promise((r,E)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:a,resolve:r,reject:E,isCached:F,state:n})})}catch(r){r?console.error(r):console.log("Route change canceled"),I=!1}if(!I||e(this,v)!==a)return;const $=e(this,P).get(a)||(yield L(this,u,U).call(this,a));if(e(this,v)!==a)return;const tt=Array.from(document.head.children),et=Array.from($.head.cloneNode(!0).children),it=L(this,u,lt).call(this,tt,et),dt=L(this,u,X).call(this,tt,it),O=L(this,u,X).call(this,et,it);O.forEach((r,E)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=r.getAttribute("src"),O[E]=b}}),O.forEach(r=>{document.head.appendChild(r)});const Y=O.filter(r=>(r.tagName==="STYLE"||r.tagName==="SCRIPT"||r.tagName==="LINK")&&r.getAttribute("rel")!=="canonical");e(this,q)&&Y.length&&(yield new Promise(r=>N(this,null,function*(){let E=0;try{for(var b=at(Y),mt,G,B;mt=!(G=yield b.next()).done;mt=!1){const H=G.value;H.onload=()=>{E++,E===Y.length&&r()}}}catch(G){B=[G]}finally{try{mt&&(G=b.return)&&(yield G.call(b))}finally{if(B)throw B[0]}}}))),dt.forEach(r=>{r.hasAttribute("data-permanent")||r.remove()}),c(this,g,a),W.changeHistory(i,a,m,p);const ut=L(this,u,V).call(this,$.body.cloneNode(!0));e(this,_).forEach((r,E)=>{const b=ut[E];let mt=[...r.childNodes],G=[...b.childNodes];mt.forEach(B=>{if(B instanceof HTMLElement){const H=B.getAttribute("data-remain");let st;G=G.filter(J=>J instanceof HTMLElement&&H&&J.getAttribute("data-remain")===H?(st=J,!1):!0),H&&st||B.remove()}else B.remove()}),r.append(...G)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",a),document.documentElement.setAttribute("data-current-leaf",w),(Z=this.postprocessor)==null||Z.call(this,{pathname:a,isCached:F,state:n}),e(this,R).notify({pathname:a,isCached:F,state:n}),ht.loading.complete("__morph")}catch(I){console.error(I)}c(this,v,void 0)})}addLinks(t){t.forEach(i=>{e(this,y).push(new ct(i,this))})}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var n;return((n=i.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")});e(this,y).forEach(i=>i.destroy()),c(this,y,t.map(i=>new ct(i,this)))}}z=new WeakMap,q=new WeakMap,x=new WeakMap,_=new WeakMap,y=new WeakMap,j=new WeakMap,P=new WeakMap,v=new WeakMap,g=new WeakMap,D=new WeakMap,R=new WeakMap,u=new WeakSet,U=function(t){return N(this,null,function*(){const i=e(this,P).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),d=e(this,j).parseFromString(l,"text/html");return e(this,x)&&e(this,P).set(t,d),d})},V=function(t){return[...t.querySelectorAll("[data-morph]")]},lt=function(t,i){return t.filter(n=>i.find(l=>l.outerHTML===n.outerHTML))},X=function(t,i){return t.filter(n=>!i.find(l=>l.outerHTML===n.outerHTML))},K=new WeakMap;exports.Morph=pt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,203 +1,208 @@
|
|
|
1
|
-
var
|
|
1
|
+
var st = (s, t) => (t = Symbol[s]) ? t : Symbol.for("Symbol." + s), nt = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (s, t, i) => (
|
|
6
|
-
var N = (s, t, i) => new Promise((
|
|
7
|
-
var d = (
|
|
4
|
+
var J = (s, t, i) => t.has(s) || nt("Cannot " + i);
|
|
5
|
+
var e = (s, t, i) => (J(s, t, "read from private field"), i ? i.call(s) : t.get(s)), o = (s, t, i) => t.has(s) ? nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, i), c = (s, t, i, n) => (J(s, t, "write to private field"), n ? n.call(s, i) : t.set(s, i), i), b = (s, t, i) => (J(s, t, "access private method"), i);
|
|
6
|
+
var N = (s, t, i) => new Promise((n, l) => {
|
|
7
|
+
var d = (m) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
|
|
9
|
+
p(i.next(m));
|
|
10
|
+
} catch (A) {
|
|
11
|
+
l(A);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, a = (m) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
15
|
+
p(i.throw(m));
|
|
16
|
+
} catch (A) {
|
|
17
|
+
l(A);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, p = (m) => m.done ? n(m.value) : Promise.resolve(m.value).then(d, a);
|
|
20
|
+
p((i = i.apply(s, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
import { Notifier as
|
|
24
|
-
import { i as
|
|
25
|
-
import { n as
|
|
26
|
-
import { loading as
|
|
27
|
-
var
|
|
28
|
-
class
|
|
22
|
+
var rt = (s, t, i) => (t = s[st("asyncIterator")]) ? t.call(s) : (s = s[st("iterator")](), t = {}, i = (n, l) => (l = s[n]) && (t[n] = (d) => new Promise((a, p, m) => (d = l.call(s, d), m = d.done, Promise.resolve(d.value).then((A) => a({ value: A, done: m }), p)))), i("next"), i("return"), t);
|
|
23
|
+
import { Notifier as at } from "../notifier/index.js";
|
|
24
|
+
import { i as ft } from "../browser-0zX67oeU.js";
|
|
25
|
+
import { n as pt, c as ot, s as gt } from "../url-BnTGHSgP.js";
|
|
26
|
+
import { loading as ht } from "../loading/index.js";
|
|
27
|
+
var w, h, f, T, C, k, z, H;
|
|
28
|
+
class ct {
|
|
29
29
|
constructor(t, i) {
|
|
30
|
-
o(this,
|
|
30
|
+
o(this, w);
|
|
31
31
|
o(this, h);
|
|
32
|
-
o(this,
|
|
32
|
+
o(this, f);
|
|
33
33
|
o(this, T);
|
|
34
|
+
o(this, C);
|
|
34
35
|
o(this, k);
|
|
35
|
-
o(this,
|
|
36
|
-
t.preventDefault(), e(this,
|
|
37
|
-
var
|
|
38
|
-
e(this,
|
|
39
|
-
}), e(this,
|
|
36
|
+
o(this, z, (t) => {
|
|
37
|
+
t.preventDefault(), e(this, w).links.forEach((i) => {
|
|
38
|
+
var n;
|
|
39
|
+
e(this, f) === e(i, f) || (n = e(i, k)) != null && n.includes(e(this, f)) ? e(i, h).classList.add("clicked") : e(i, h).classList.remove("clicked");
|
|
40
|
+
}), e(this, w).navigate(e(this, f), {
|
|
41
|
+
historyAction: e(this, T),
|
|
42
|
+
state: e(this, C)
|
|
43
|
+
});
|
|
40
44
|
});
|
|
41
45
|
o(this, H, () => {
|
|
42
|
-
e(this,
|
|
46
|
+
e(this, w).prefetch(e(this, f)), e(this, h).removeEventListener("pointerenter", e(this, H));
|
|
43
47
|
});
|
|
44
|
-
var d,
|
|
45
|
-
|
|
48
|
+
var d, a;
|
|
49
|
+
c(this, w, i), c(this, h, t), c(this, f, e(this, h).getAttribute("href") || "/"), c(this, T, e(this, h).getAttribute(
|
|
46
50
|
"data-history-action"
|
|
47
|
-
) || "push"), e(this, h).addEventListener("click", e(this,
|
|
48
|
-
const
|
|
49
|
-
|
|
51
|
+
) || "push"), c(this, C, e(this, h).getAttribute("data-state") || void 0), e(this, h).addEventListener("click", e(this, z));
|
|
52
|
+
const n = i.normalizePath(e(this, f)), l = i.normalizePath(location.pathname);
|
|
53
|
+
c(this, k, (d = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : d.split(",").map((p) => i.normalizePath(p.trim()).pathname)), e(this, h).hasAttribute("data-include") ? l.pathname.includes(n.pathname) && e(this, h).classList.add("current") : n.pathname === l.pathname || (a = e(this, k)) != null && a.includes(l.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, H));
|
|
50
54
|
}
|
|
51
55
|
destroy() {
|
|
52
|
-
e(this, h).removeEventListener("click", e(this,
|
|
56
|
+
e(this, h).removeEventListener("click", e(this, z)), e(this, h).removeEventListener("pointerenter", e(this, H)), e(this, h).classList.remove("current");
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
class
|
|
59
|
+
w = new WeakMap(), h = new WeakMap(), f = new WeakMap(), T = new WeakMap(), C = new WeakMap(), k = new WeakMap(), z = new WeakMap(), H = new WeakMap();
|
|
60
|
+
var S, x, D, R, y, W, P, v, g, _, F, u, Q, U, lt, V, K;
|
|
61
|
+
class wt {
|
|
58
62
|
constructor(t) {
|
|
59
63
|
o(this, u);
|
|
60
|
-
o(this, z, null);
|
|
61
64
|
o(this, S, null);
|
|
62
65
|
o(this, x, null);
|
|
63
66
|
o(this, D, null);
|
|
64
|
-
o(this,
|
|
65
|
-
o(this,
|
|
66
|
-
o(this,
|
|
67
|
-
o(this,
|
|
68
|
-
o(this,
|
|
69
|
-
o(this,
|
|
70
|
-
o(this, _, new
|
|
71
|
-
o(this,
|
|
72
|
-
|
|
67
|
+
o(this, R, null);
|
|
68
|
+
o(this, y, []);
|
|
69
|
+
o(this, W, new DOMParser());
|
|
70
|
+
o(this, P, /* @__PURE__ */ new Map());
|
|
71
|
+
o(this, v);
|
|
72
|
+
o(this, g, null);
|
|
73
|
+
o(this, _, new at());
|
|
74
|
+
o(this, F, new at());
|
|
75
|
+
o(this, K, (t) => {
|
|
76
|
+
t.state && this.navigate(t.state, { historyAction: "none" });
|
|
73
77
|
});
|
|
74
|
-
if (
|
|
75
|
-
|
|
78
|
+
if (ft) {
|
|
79
|
+
c(this, S, pt(t == null ? void 0 : t.base)), c(this, x, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), c(this, D, (t == null ? void 0 : t.cachePages) !== !1), c(this, R, b(this, u, U).call(this, document.body));
|
|
76
80
|
const i = this.normalizePath(location.pathname);
|
|
77
|
-
|
|
81
|
+
c(this, g, i.pathname), document.documentElement.setAttribute(
|
|
78
82
|
"data-current-pathname",
|
|
79
|
-
e(this,
|
|
83
|
+
e(this, g)
|
|
80
84
|
), document.documentElement.setAttribute(
|
|
81
85
|
"data-current-leaf",
|
|
82
86
|
i.leaf
|
|
83
|
-
), this.findLinks(), addEventListener("popstate", e(this,
|
|
87
|
+
), this.findLinks(), addEventListener("popstate", e(this, K)), ot(
|
|
84
88
|
"replace",
|
|
85
|
-
e(this,
|
|
89
|
+
e(this, g),
|
|
86
90
|
i.parameters,
|
|
87
91
|
i.hash
|
|
88
92
|
);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
get currentPathname() {
|
|
92
|
-
return e(this,
|
|
96
|
+
return e(this, g);
|
|
93
97
|
}
|
|
94
98
|
get links() {
|
|
95
|
-
return e(this,
|
|
99
|
+
return e(this, y);
|
|
96
100
|
}
|
|
97
101
|
normalizePath(t) {
|
|
98
|
-
return
|
|
102
|
+
return gt(t, e(this, S));
|
|
99
103
|
}
|
|
100
104
|
beforeNavigationEvent(t) {
|
|
101
|
-
return e(this,
|
|
105
|
+
return e(this, _).subscribe(t);
|
|
102
106
|
}
|
|
103
107
|
afterNavigationEvent(t) {
|
|
104
|
-
return e(this,
|
|
108
|
+
return e(this, F).subscribe(t);
|
|
105
109
|
}
|
|
106
110
|
prefetch(t) {
|
|
107
111
|
return N(this, null, function* () {
|
|
108
112
|
const i = this.normalizePath(t);
|
|
109
|
-
return
|
|
113
|
+
return b(this, u, Q).call(this, i.pathname);
|
|
110
114
|
});
|
|
111
115
|
}
|
|
112
|
-
navigate(
|
|
113
|
-
return N(this,
|
|
114
|
-
var
|
|
115
|
-
const
|
|
116
|
-
let { pathname:
|
|
117
|
-
if (e(this,
|
|
116
|
+
navigate(l) {
|
|
117
|
+
return N(this, arguments, function* (t, { historyAction: i = "push", state: n } = {}) {
|
|
118
|
+
var X;
|
|
119
|
+
const d = this.normalizePath(t);
|
|
120
|
+
let { pathname: a, hash: p, parameters: m, leaf: A } = d;
|
|
121
|
+
if (e(this, v) === a || e(this, g) === a)
|
|
118
122
|
return;
|
|
119
|
-
|
|
120
|
-
const
|
|
123
|
+
c(this, v, a);
|
|
124
|
+
const I = e(this, P).has(a);
|
|
121
125
|
try {
|
|
122
|
-
|
|
123
|
-
let
|
|
124
|
-
if (e(this,
|
|
125
|
-
pathname:
|
|
126
|
-
isCached:
|
|
126
|
+
ht.add("__morph");
|
|
127
|
+
let q = !0;
|
|
128
|
+
if (e(this, _).notify({
|
|
129
|
+
pathname: a,
|
|
130
|
+
isCached: I,
|
|
131
|
+
state: n
|
|
127
132
|
}), this.preprocessor)
|
|
128
133
|
try {
|
|
129
|
-
yield new Promise((r,
|
|
130
|
-
var
|
|
131
|
-
(
|
|
134
|
+
yield new Promise((r, E) => {
|
|
135
|
+
var L;
|
|
136
|
+
(L = this.preprocessor) == null || L.call(this, { pathname: a, resolve: r, reject: E, isCached: I, state: n });
|
|
132
137
|
});
|
|
133
138
|
} catch (r) {
|
|
134
|
-
r ? console.error(r) : console.log("Route change canceled"),
|
|
139
|
+
r ? console.error(r) : console.log("Route change canceled"), q = !1;
|
|
135
140
|
}
|
|
136
|
-
if (!
|
|
141
|
+
if (!q || e(this, v) !== a)
|
|
137
142
|
return;
|
|
138
|
-
const
|
|
139
|
-
if (e(this,
|
|
143
|
+
const Z = e(this, P).get(a) || (yield b(this, u, Q).call(this, a));
|
|
144
|
+
if (e(this, v) !== a)
|
|
140
145
|
return;
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
),
|
|
144
|
-
|
|
146
|
+
const $ = Array.from(document.head.children), tt = Array.from(
|
|
147
|
+
Z.head.cloneNode(!0).children
|
|
148
|
+
), et = b(this, u, lt).call(this, $, tt), dt = b(this, u, V).call(this, $, et), B = b(this, u, V).call(this, tt, et);
|
|
149
|
+
B.forEach((r, E) => {
|
|
145
150
|
if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
|
|
146
|
-
const
|
|
147
|
-
|
|
151
|
+
const L = document.createElement("script");
|
|
152
|
+
L.type = "module", L.src = r.getAttribute("src"), B[E] = L;
|
|
148
153
|
}
|
|
149
|
-
}),
|
|
154
|
+
}), B.forEach((r) => {
|
|
150
155
|
document.head.appendChild(r);
|
|
151
156
|
});
|
|
152
|
-
const
|
|
157
|
+
const Y = B.filter(
|
|
153
158
|
(r) => (r.tagName === "STYLE" || r.tagName === "SCRIPT" || r.tagName === "LINK") && r.getAttribute("rel") !== "canonical"
|
|
154
159
|
);
|
|
155
|
-
e(this,
|
|
156
|
-
let
|
|
160
|
+
e(this, x) && Y.length && (yield new Promise((r) => N(this, null, function* () {
|
|
161
|
+
let E = 0;
|
|
157
162
|
try {
|
|
158
|
-
for (var
|
|
159
|
-
const M =
|
|
163
|
+
for (var L = rt(Y), mt, j, O; mt = !(j = yield L.next()).done; mt = !1) {
|
|
164
|
+
const M = j.value;
|
|
160
165
|
M.onload = () => {
|
|
161
|
-
|
|
166
|
+
E++, E === Y.length && r();
|
|
162
167
|
};
|
|
163
168
|
}
|
|
164
|
-
} catch (
|
|
165
|
-
|
|
169
|
+
} catch (j) {
|
|
170
|
+
O = [j];
|
|
166
171
|
} finally {
|
|
167
172
|
try {
|
|
168
|
-
|
|
173
|
+
mt && (j = L.return) && (yield j.call(L));
|
|
169
174
|
} finally {
|
|
170
|
-
if (
|
|
171
|
-
throw
|
|
175
|
+
if (O)
|
|
176
|
+
throw O[0];
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
|
-
}))),
|
|
179
|
+
}))), dt.forEach((r) => {
|
|
175
180
|
r.hasAttribute("data-permanent") || r.remove();
|
|
176
|
-
}),
|
|
177
|
-
const
|
|
178
|
-
e(this,
|
|
179
|
-
const
|
|
180
|
-
let
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
const M =
|
|
184
|
-
let
|
|
185
|
-
|
|
186
|
-
(
|
|
187
|
-
), M &&
|
|
181
|
+
}), c(this, g, a), ot(i, a, m, p);
|
|
182
|
+
const ut = b(this, u, U).call(this, Z.body.cloneNode(!0));
|
|
183
|
+
e(this, R).forEach((r, E) => {
|
|
184
|
+
const L = ut[E];
|
|
185
|
+
let mt = [...r.childNodes], j = [...L.childNodes];
|
|
186
|
+
mt.forEach((O) => {
|
|
187
|
+
if (O instanceof HTMLElement) {
|
|
188
|
+
const M = O.getAttribute("data-remain");
|
|
189
|
+
let it;
|
|
190
|
+
j = j.filter(
|
|
191
|
+
(G) => G instanceof HTMLElement && M && G.getAttribute("data-remain") === M ? (it = G, !1) : !0
|
|
192
|
+
), M && it || O.remove();
|
|
188
193
|
} else
|
|
189
|
-
|
|
190
|
-
}), r.append(...
|
|
191
|
-
}), this.findLinks(), document.documentElement.setAttribute("data-current-pathname",
|
|
192
|
-
} catch (
|
|
193
|
-
console.error(
|
|
194
|
+
O.remove();
|
|
195
|
+
}), r.append(...j);
|
|
196
|
+
}), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", a), document.documentElement.setAttribute("data-current-leaf", A), (X = this.postprocessor) == null || X.call(this, { pathname: a, isCached: I, state: n }), e(this, F).notify({ pathname: a, isCached: I, state: n }), ht.complete("__morph");
|
|
197
|
+
} catch (q) {
|
|
198
|
+
console.error(q);
|
|
194
199
|
}
|
|
195
|
-
|
|
200
|
+
c(this, v, void 0);
|
|
196
201
|
});
|
|
197
202
|
}
|
|
198
203
|
addLinks(t) {
|
|
199
204
|
t.forEach((i) => {
|
|
200
|
-
e(this,
|
|
205
|
+
e(this, y).push(new ct(i, this));
|
|
201
206
|
});
|
|
202
207
|
}
|
|
203
208
|
findLinks() {
|
|
@@ -205,36 +210,36 @@ class bt {
|
|
|
205
210
|
...document.documentElement.querySelectorAll("a")
|
|
206
211
|
].filter(
|
|
207
212
|
(i) => {
|
|
208
|
-
var
|
|
209
|
-
return ((
|
|
213
|
+
var n;
|
|
214
|
+
return ((n = i.getAttribute("href")) == null ? void 0 : n.startsWith("/")) && !i.hasAttribute("download") && !i.hasAttribute("data-morph-skip");
|
|
210
215
|
}
|
|
211
216
|
);
|
|
212
|
-
e(this,
|
|
217
|
+
e(this, y).forEach((i) => i.destroy()), c(this, y, t.map((i) => new ct(i, this)));
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
|
-
|
|
220
|
+
S = new WeakMap(), x = new WeakMap(), D = new WeakMap(), R = new WeakMap(), y = new WeakMap(), W = new WeakMap(), P = new WeakMap(), v = new WeakMap(), g = new WeakMap(), _ = new WeakMap(), F = new WeakMap(), u = new WeakSet(), Q = function(t) {
|
|
216
221
|
return N(this, null, function* () {
|
|
217
|
-
const i = e(this,
|
|
222
|
+
const i = e(this, P).get(t);
|
|
218
223
|
if (i)
|
|
219
224
|
return i;
|
|
220
|
-
const
|
|
221
|
-
return e(this,
|
|
225
|
+
const l = yield (yield fetch(t)).text(), d = e(this, W).parseFromString(l, "text/html");
|
|
226
|
+
return e(this, D) && e(this, P).set(t, d), d;
|
|
222
227
|
});
|
|
223
|
-
},
|
|
228
|
+
}, U = function(t) {
|
|
224
229
|
return [...t.querySelectorAll("[data-morph]")];
|
|
225
|
-
},
|
|
230
|
+
}, lt = function(t, i) {
|
|
226
231
|
return t.filter(
|
|
227
|
-
(
|
|
228
|
-
(
|
|
232
|
+
(n) => i.find(
|
|
233
|
+
(l) => l.outerHTML === n.outerHTML
|
|
229
234
|
)
|
|
230
235
|
);
|
|
231
|
-
},
|
|
236
|
+
}, V = function(t, i) {
|
|
232
237
|
return t.filter(
|
|
233
|
-
(
|
|
234
|
-
(
|
|
238
|
+
(n) => !i.find(
|
|
239
|
+
(l) => l.outerHTML === n.outerHTML
|
|
235
240
|
)
|
|
236
241
|
);
|
|
237
|
-
},
|
|
242
|
+
}, K = new WeakMap();
|
|
238
243
|
export {
|
|
239
|
-
|
|
244
|
+
wt as Morph
|
|
240
245
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var G=n=>{throw TypeError(n)};var
|
|
1
|
+
"use strict";var G=n=>{throw TypeError(n)};var B=(n,c,t)=>c.has(n)||G("Cannot "+t);var e=(n,c,t)=>(B(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?G("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(B(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),b=(n,c,t)=>(B(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),V=require("../Store-CDb6RMce.cjs"),I=require("../events-KVanG9sR.cjs"),X=require("../function-MthRj-GJ.cjs"),Y=require("../style-At6aDoqG.cjs"),J=require("../window-resizer/vanilla/index.cjs"),Z=require("../browser-CpzFX2xg.cjs");var A,d,q,w,p,g,u,v,m,f,y,S,l,K,T,D,k,j,C,_,O,x,U;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,A);s(this,d);s(this,q);s(this,w);s(this,p);s(this,g);s(this,u);s(this,v);s(this,m);s(this,f);s(this,y);s(this,S);s(this,T);s(this,k);s(this,C);s(this,_);s(this,O);s(this,x);i(this,A,-1),i(this,d,new V.Store(!1)),i(this,p,new E.CSSProperty(this,"--history",!1)),i(this,g,new E.CSSProperty(this,"--restore",!1)),i(this,u,new E.CSSProperty(this,"--dominance",0)),i(this,v,new E.CSSProperty(this,"--group","")),i(this,m,new E.CSSProperty(this,"--click-outside",!1)),i(this,f,new E.CSSProperty(this,"--escape",!1)),i(this,y,!1),this.open=t=>{if(e(this,d).current)return;i(this,S,t==null?void 0:t.trigger),e(this,d).current=!0,e(this,u).current&&(a.__opened=a.__opened.filter(o=>o!==this&&b(this,l,U).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,A,a.__opened.length-1),e(this,p).current&&e(this,y)&&history.pushState("","",e(this,l,K)),clearTimeout(e(this,q)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,S)}});const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,S)}}),i(this,w,void 0)};t!=null&&t.skipTransition?h():i(this,w,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,w)&&b(this,l,U).call(this,this,t)?(t.close(),!1):!0),b(this,l,D).call(this),this.classList.remove("opened"),this.classList.add("closing"),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})},Y.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,m).current&&b(this,l,j).call(this,()=>{var W;const h=t.composedPath();if(h.find(F=>F instanceof HTMLElement&&F.hasAttribute("data-popover-content")))return;const o=h[0],$=o instanceof Node&&(this.contains(o)||((W=this.shadowRoot)==null?void 0:W.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!$||P)&&this.close()})}),i(this,k,t=>{e(this,f).current&&b(this,l,j).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,C,()=>{i(this,y,!1),e(this,d).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),i(this,y,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,O).call(this)}),i(this,O,X.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,p)}get restore(){return e(this,g)}get dominance(){return e(this,u)}get group(){return e(this,v)}get clickOutside(){return e(this,m)}get escape(){return e(this,f)}get opened(){return e(this,d)}get lastTrigger(){return e(this,S)}connectedCallback(){e(this,p).observe(),e(this,g).observe(),e(this,u).observe(),e(this,v).observe(),e(this,m).observe(),e(this,f).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,C)),setTimeout(()=>{e(this,g).current?e(this,C).call(this):(b(this,l,D).call(this),i(this,y,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,p).close(),e(this,g).close(),e(this,u).close(),e(this,v).close(),e(this,m).close(),e(this,f).close(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,q)),clearTimeout(e(this,w)),removeEventListener("popstate",e(this,C)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};A=new WeakMap,d=new WeakMap,q=new WeakMap,w=new WeakMap,p=new WeakMap,g=new WeakMap,u=new WeakMap,v=new WeakMap,m=new WeakMap,f=new WeakMap,y=new WeakMap,S=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},T=new WeakMap,D=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},k=new WeakMap,j=function(t){(a.__opened[e(this,A)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,u).current>h.dominance.current))&&t()},C=new WeakMap,_=new WeakMap,O=new WeakMap,x=new WeakMap,U=function(t,h){if(e(t,v).current===e(h,v).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let N=a;customElements.get("e-popover")||customElements.define("e-popover",N);var r,L,R,M,H,z;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,R,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,H,()=>{this.classList.remove("opened")});s(this,z,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});Z.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)&&(o.current!=="close"?(this.setAttribute("aria-has-popup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const $=this.closest("[popover-target]");if($)o=$;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,R)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,H)),e(this,r).addEventListener("popoverClosed",e(this,z))):console.warn(this,`target ${t} not found`)}e(this,L).observe()}disconnectedCallback(){e(this,L).unobserve(),this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,R)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,H)),e(this,r).removeEventListener("popoverClosed",e(this,z)))}}r=new WeakMap,L=new WeakMap,R=new WeakMap,M=new WeakMap,H=new WeakMap,z=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=N;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var G = (n) => {
|
|
2
2
|
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (n, c, t) => (
|
|
4
|
+
var q = (n, c, t) => c.has(n) || G("Cannot " + t);
|
|
5
|
+
var e = (n, c, t) => (q(n, c, "read from private field"), t ? t.call(n) : c.get(n)), s = (n, c, t) => c.has(n) ? G("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(n) : c.set(n, t), i = (n, c, t, h) => (q(n, c, "write to private field"), h ? h.call(n, t) : c.set(n, t), t), b = (n, c, t) => (q(n, c, "access private method"), t);
|
|
6
6
|
import { CSSProperty as E } from "../css-property/index.js";
|
|
7
7
|
import { S as Q } from "../Store-OTdcl6SX.js";
|
|
8
|
-
import { d as
|
|
8
|
+
import { d as N } from "../events-CsVF98U6.js";
|
|
9
9
|
import { d as V } from "../function-C10DGppn.js";
|
|
10
10
|
import { g as X } from "../style-j2TwriJ_.js";
|
|
11
11
|
import { windowResizer as J } from "../window-resizer/vanilla/index.js";
|
|
12
12
|
import { i as Y } from "../browser-0zX67oeU.js";
|
|
13
|
-
var C, d,
|
|
13
|
+
var C, d, O, T, p, g, u, v, m, f, y, w, l, K, k, D, A, U, S, _, H, P, W;
|
|
14
14
|
const a = class a extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
17
|
s(this, l);
|
|
18
18
|
s(this, C);
|
|
19
19
|
s(this, d);
|
|
20
|
-
s(this,
|
|
20
|
+
s(this, O);
|
|
21
21
|
s(this, T);
|
|
22
22
|
s(this, p);
|
|
23
23
|
s(this, g);
|
|
@@ -25,25 +25,25 @@ const a = class a extends HTMLElement {
|
|
|
25
25
|
s(this, v);
|
|
26
26
|
s(this, m);
|
|
27
27
|
s(this, f);
|
|
28
|
-
s(this,
|
|
28
|
+
s(this, y);
|
|
29
29
|
s(this, w);
|
|
30
30
|
s(this, k);
|
|
31
31
|
s(this, A);
|
|
32
32
|
s(this, S);
|
|
33
33
|
s(this, _);
|
|
34
|
-
s(this,
|
|
34
|
+
s(this, H);
|
|
35
35
|
s(this, P);
|
|
36
|
-
i(this, C, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this, g, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, v, new E(this, "--group", "")), i(this, m, new E(this, "--click-outside", !1)), i(this, f, new E(this, "--escape", !1)), i(this,
|
|
36
|
+
i(this, C, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this, g, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, v, new E(this, "--group", "")), i(this, m, new E(this, "--click-outside", !1)), i(this, f, new E(this, "--escape", !1)), i(this, y, !1), this.open = (t) => {
|
|
37
37
|
if (e(this, d).current)
|
|
38
38
|
return;
|
|
39
|
-
i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this, u).current && (a.__opened = a.__opened.filter((o) => o !== this && b(this, l, W).call(this, this, o) ? (o.close(), !1) : !0)), a.__opened.push(this), i(this, C, a.__opened.length - 1), e(this, p).current && e(this,
|
|
39
|
+
i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this, u).current && (a.__opened = a.__opened.filter((o) => o !== this && b(this, l, W).call(this, this, o) ? (o.close(), !1) : !0)), a.__opened.push(this), i(this, C, a.__opened.length - 1), e(this, p).current && e(this, y) && history.pushState("", "", e(this, l, K)), clearTimeout(e(this, O)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", N(this, "popoverTriggered", {
|
|
40
40
|
custom: !0,
|
|
41
41
|
detail: {
|
|
42
42
|
trigger: e(this, w)
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
const h = () => {
|
|
46
|
-
addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"),
|
|
46
|
+
addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), N(this, "popoverOpened", {
|
|
47
47
|
custom: !0,
|
|
48
48
|
detail: {
|
|
49
49
|
trigger: e(this, w)
|
|
@@ -52,10 +52,10 @@ const a = class a extends HTMLElement {
|
|
|
52
52
|
};
|
|
53
53
|
t != null && t.skipTransition ? h() : i(this, T, setTimeout(h, 10));
|
|
54
54
|
}, this.close = () => {
|
|
55
|
-
e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, a.__opened = a.__opened.filter((t) => t === this ? !1 : !e(t, T) && b(this, l, W).call(this, this, t) ? (t.close(), !1) : !0), b(this, l, D).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0",
|
|
55
|
+
e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, a.__opened = a.__opened.filter((t) => t === this ? !1 : !e(t, T) && b(this, l, W).call(this, this, t) ? (t.close(), !1) : !0), b(this, l, D).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", N(this, "popoverClosing", {
|
|
56
56
|
custom: !0
|
|
57
57
|
}), setTimeout(() => {
|
|
58
|
-
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none",
|
|
58
|
+
this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", N(this, "popoverClosed", {
|
|
59
59
|
custom: !0
|
|
60
60
|
});
|
|
61
61
|
}, X(this) + 10));
|
|
@@ -67,7 +67,7 @@ const a = class a extends HTMLElement {
|
|
|
67
67
|
(F) => F instanceof HTMLElement && F.hasAttribute("data-popover-content")
|
|
68
68
|
))
|
|
69
69
|
return;
|
|
70
|
-
const o = h[0], z = o instanceof
|
|
70
|
+
const o = h[0], z = o instanceof Node && (this.contains(o) || ((j = this.shadowRoot) == null ? void 0 : j.contains(o))), x = o instanceof HTMLElement && o.hasAttribute("data-outside");
|
|
71
71
|
(!z || x) && this.close();
|
|
72
72
|
});
|
|
73
73
|
}), i(this, A, (t) => {
|
|
@@ -75,10 +75,10 @@ const a = class a extends HTMLElement {
|
|
|
75
75
|
t.code === "Escape" && this.close();
|
|
76
76
|
});
|
|
77
77
|
}), i(this, S, () => {
|
|
78
|
-
i(this,
|
|
78
|
+
i(this, y, !1), e(this, d).current && e(this, p).current && !location.search.includes(this.id) ? this.close() : !e(this, d).current && e(this, p).current && location.search.includes(this.id) && this.open(), i(this, y, !0);
|
|
79
79
|
}), i(this, _, () => {
|
|
80
|
-
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this,
|
|
81
|
-
}), i(this,
|
|
80
|
+
this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, H).call(this);
|
|
81
|
+
}), i(this, H, V(() => {
|
|
82
82
|
e(this, P).call(this);
|
|
83
83
|
}, 10)), i(this, P, () => {
|
|
84
84
|
this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
|
|
@@ -110,14 +110,14 @@ const a = class a extends HTMLElement {
|
|
|
110
110
|
}
|
|
111
111
|
connectedCallback() {
|
|
112
112
|
e(this, p).observe(), e(this, g).observe(), e(this, u).observe(), e(this, v).observe(), e(this, m).observe(), e(this, f).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, S)), setTimeout(() => {
|
|
113
|
-
e(this, g).current ? e(this, S).call(this) : (b(this, l, D).call(this), i(this,
|
|
113
|
+
e(this, g).current ? e(this, S).call(this) : (b(this, l, D).call(this), i(this, y, !0));
|
|
114
114
|
}, 0), J.subscribe(e(this, _));
|
|
115
115
|
}
|
|
116
116
|
disconnectedCallback() {
|
|
117
|
-
J.unsubscribe(e(this, _)), e(this, p).close(), e(this, g).close(), e(this, u).close(), e(this, v).close(), e(this, m).close(), e(this, f).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), a.__opened = a.__opened.filter((t) => t !== this), clearTimeout(e(this,
|
|
117
|
+
J.unsubscribe(e(this, _)), e(this, p).close(), e(this, g).close(), e(this, u).close(), e(this, v).close(), e(this, m).close(), e(this, f).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), a.__opened = a.__opened.filter((t) => t !== this), clearTimeout(e(this, O)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, S)), removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height");
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
C = new WeakMap(), d = new WeakMap(),
|
|
120
|
+
C = new WeakMap(), d = new WeakMap(), O = new WeakMap(), T = new WeakMap(), p = new WeakMap(), g = new WeakMap(), u = new WeakMap(), v = new WeakMap(), m = new WeakMap(), f = new WeakMap(), y = new WeakMap(), w = new WeakMap(), l = new WeakSet(), K = function() {
|
|
121
121
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
|
|
122
122
|
}, k = new WeakMap(), D = function() {
|
|
123
123
|
if (e(this, p).current) {
|
|
@@ -126,19 +126,19 @@ C = new WeakMap(), d = new WeakMap(), H = new WeakMap(), T = new WeakMap(), p =
|
|
|
126
126
|
}
|
|
127
127
|
}, A = new WeakMap(), U = function(t) {
|
|
128
128
|
(a.__opened[e(this, C) - 1] || a.__opened.length === 1 || a.__opened.filter((h) => h !== this).every((h) => e(this, u).current > h.dominance.current)) && t();
|
|
129
|
-
}, S = new WeakMap(), _ = new WeakMap(),
|
|
129
|
+
}, S = new WeakMap(), _ = new WeakMap(), H = new WeakMap(), P = new WeakMap(), W = function(t, h) {
|
|
130
130
|
if (e(t, v).current === e(h, v).current && t.dominance.current >= h.dominance.current)
|
|
131
131
|
return !0;
|
|
132
132
|
}, a.__opened = [];
|
|
133
133
|
let B = a;
|
|
134
134
|
customElements.get("e-popover") || customElements.define("e-popover", B);
|
|
135
|
-
var r,
|
|
135
|
+
var r, L, M, R, $, I;
|
|
136
136
|
class Z extends HTMLElement {
|
|
137
137
|
constructor() {
|
|
138
138
|
super();
|
|
139
139
|
s(this, r);
|
|
140
|
-
s(this,
|
|
141
|
-
s(this,
|
|
140
|
+
s(this, L, new E(this, "--type", "open"));
|
|
141
|
+
s(this, M, () => {
|
|
142
142
|
this.classList.add("triggered");
|
|
143
143
|
});
|
|
144
144
|
s(this, R, () => {
|
|
@@ -152,7 +152,7 @@ class Z extends HTMLElement {
|
|
|
152
152
|
});
|
|
153
153
|
Y && (this.addEventListener("click", () => {
|
|
154
154
|
if (e(this, r)) {
|
|
155
|
-
const t = e(this,
|
|
155
|
+
const t = e(this, L).current;
|
|
156
156
|
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();
|
|
157
157
|
}
|
|
158
158
|
}), this.addEventListener("keydown", (t) => {
|
|
@@ -160,14 +160,14 @@ class Z extends HTMLElement {
|
|
|
160
160
|
}));
|
|
161
161
|
}
|
|
162
162
|
get type() {
|
|
163
|
-
return e(this,
|
|
163
|
+
return e(this, L);
|
|
164
164
|
}
|
|
165
165
|
get popoverElement() {
|
|
166
166
|
return e(this, r);
|
|
167
167
|
}
|
|
168
168
|
connectedCallback() {
|
|
169
169
|
var h;
|
|
170
|
-
e(this,
|
|
170
|
+
e(this, L).subscribe((o) => {
|
|
171
171
|
e(this, r) && (o.current !== "close" ? (this.setAttribute("aria-has-popup", "true"), this.setAttribute(
|
|
172
172
|
"aria-expanded",
|
|
173
173
|
e(this, r).opened.current ? "true" : "false"
|
|
@@ -187,7 +187,7 @@ class Z extends HTMLElement {
|
|
|
187
187
|
} else t === "sibling" ? o = (h = this.parentElement) == null ? void 0 : h.querySelector("[popover-target]") : o = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
|
|
188
188
|
o instanceof HTMLElement ? (i(this, r, o), e(this, r).addEventListener(
|
|
189
189
|
"popoverTriggered",
|
|
190
|
-
e(this,
|
|
190
|
+
e(this, M)
|
|
191
191
|
), e(this, r).addEventListener(
|
|
192
192
|
"popoverOpened",
|
|
193
193
|
e(this, R)
|
|
@@ -199,12 +199,12 @@ class Z extends HTMLElement {
|
|
|
199
199
|
e(this, I)
|
|
200
200
|
)) : console.warn(this, `target ${t} not found`);
|
|
201
201
|
}
|
|
202
|
-
e(this,
|
|
202
|
+
e(this, L).observe();
|
|
203
203
|
}
|
|
204
204
|
disconnectedCallback() {
|
|
205
|
-
e(this,
|
|
205
|
+
e(this, L).unobserve(), this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
|
|
206
206
|
"popoverTriggered",
|
|
207
|
-
e(this,
|
|
207
|
+
e(this, M)
|
|
208
208
|
), e(this, r).removeEventListener(
|
|
209
209
|
"popoverOpened",
|
|
210
210
|
e(this, R)
|
|
@@ -217,7 +217,7 @@ class Z extends HTMLElement {
|
|
|
217
217
|
));
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
r = new WeakMap(),
|
|
220
|
+
r = new WeakMap(), L = new WeakMap(), M = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), I = new WeakMap();
|
|
221
221
|
customElements.get("e-popover-button") || customElements.define("e-popover-button", Z);
|
|
222
222
|
export {
|
|
223
223
|
Z as PopoverButtonElement,
|