aptechka 0.29.2 → 0.29.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/loading/index.cjs +1 -1
- package/lib/loading/index.d.ts +4 -0
- package/lib/loading/index.js +33 -28
- package/lib/media-elements/index.cjs +2 -2
- package/lib/media-elements/index.js +107 -105
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +16 -16
- package/package.json +1 -1
package/lib/loading/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=i=>{throw TypeError(i)};var f=(i,t,s)=>t.has(i)||p("Cannot "+s);var e=(i,t,s)=>(f(i,t,"read from private field"),s?s.call(i):t.get(i)),a=(i,t,s)=>t.has(i)?p("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),g=(i,t,s,l)=>(f(i,t,"write to private field"),l?l.call(i,s):t.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../events-KVanG9sR.cjs"),w=require("../function-MthRj-GJ.cjs");var o,n,h,d,c;class v{constructor(){a(this,o,new Map);a(this,n,!1);a(this,h,w.debounce(()=>{e(this,n)||(g(this,n,!0),r.dispatchEvent(window,"loadingStart"),e(this,d).call(this))},0));a(this,d,()=>{if(!e(this,n))return;const t=e(this,o).size,s=Array.from(e(this,o)).filter(u=>u[1]).length,l=s/t;r.dispatchEvent(window,"loadingProgress",{detail:{total:t,loaded:s,progress:l}}),l===1&&e(this,c).call(this)});a(this,c,w.debounce(()=>{g(this,n,!1),r.dispatchEvent(window,"loadingComplete",{detail:{total:e(this,o).size}}),e(this,o).clear()},0))}get map(){return e(this,o)}add(t){e(this,o).set(t,!1),e(this,h).call(this)}complete(t){e(this,o).set(t,!0),e(this,d).call(this)}error(t){e(this,o).has(t)&&(console.error(`Failed to load ${t}`),e(this,o).delete(t),r.dispatchEvent(window,"loadingError",{detail:{name:t}})),e(this,d).call(this)}}o=new WeakMap,n=new WeakMap,h=new WeakMap,d=new WeakMap,c=new WeakMap;const m=new v;exports.loading=m;
|
package/lib/loading/index.d.ts
CHANGED
|
@@ -8,9 +8,13 @@ export interface LoadingEvents {
|
|
|
8
8
|
loadingComplete: CustomEvent<{
|
|
9
9
|
total: number;
|
|
10
10
|
}>;
|
|
11
|
+
loadingError: CustomEvent<{
|
|
12
|
+
name: string;
|
|
13
|
+
}>;
|
|
11
14
|
}
|
|
12
15
|
declare class Loading {
|
|
13
16
|
#private;
|
|
17
|
+
get map(): Map<string, boolean>;
|
|
14
18
|
add(resourceName: string): void;
|
|
15
19
|
complete(resourceName: string): void;
|
|
16
20
|
error(resourceName: string): void;
|
package/lib/loading/index.js
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var c = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var g = (
|
|
5
|
-
var
|
|
6
|
-
import { d as
|
|
4
|
+
var g = (s, t, e) => t.has(s) || c("Cannot " + e);
|
|
5
|
+
var i = (s, t, e) => (g(s, t, "read from private field"), e ? e.call(s) : t.get(s)), r = (s, t, e) => t.has(s) ? c("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), p = (s, t, e, l) => (g(s, t, "write to private field"), l ? l.call(s, e) : t.set(s, e), e);
|
|
6
|
+
import { d as n } from "../events-CsVF98U6.js";
|
|
7
7
|
import { d as w } from "../function-C10DGppn.js";
|
|
8
|
-
var o, a, h, d,
|
|
8
|
+
var o, a, h, d, f;
|
|
9
9
|
class u {
|
|
10
10
|
constructor() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
detail: {}
|
|
16
|
-
}), s(this, d).call(this));
|
|
11
|
+
r(this, o, /* @__PURE__ */ new Map());
|
|
12
|
+
r(this, a, !1);
|
|
13
|
+
r(this, h, w(() => {
|
|
14
|
+
i(this, a) || (p(this, a, !0), n(window, "loadingStart"), i(this, d).call(this));
|
|
17
15
|
}, 0));
|
|
18
|
-
|
|
19
|
-
if (!
|
|
16
|
+
r(this, d, () => {
|
|
17
|
+
if (!i(this, a))
|
|
20
18
|
return;
|
|
21
|
-
const t =
|
|
22
|
-
|
|
19
|
+
const t = i(this, o).size, e = Array.from(i(this, o)).filter((m) => m[1]).length, l = e / t;
|
|
20
|
+
n(window, "loadingProgress", {
|
|
23
21
|
detail: {
|
|
24
22
|
total: t,
|
|
25
23
|
loaded: e,
|
|
26
|
-
progress:
|
|
24
|
+
progress: l
|
|
27
25
|
}
|
|
28
|
-
}),
|
|
26
|
+
}), l === 1 && i(this, f).call(this);
|
|
29
27
|
});
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
r(this, f, w(() => {
|
|
29
|
+
p(this, a, !1), n(window, "loadingComplete", {
|
|
32
30
|
detail: {
|
|
33
|
-
total:
|
|
31
|
+
total: i(this, o).size
|
|
34
32
|
}
|
|
35
|
-
}),
|
|
33
|
+
}), i(this, o).clear();
|
|
36
34
|
}, 0));
|
|
37
35
|
}
|
|
36
|
+
get map() {
|
|
37
|
+
return i(this, o);
|
|
38
|
+
}
|
|
38
39
|
add(t) {
|
|
39
|
-
|
|
40
|
+
i(this, o).set(t, !1), i(this, h).call(this);
|
|
40
41
|
}
|
|
41
42
|
complete(t) {
|
|
42
|
-
|
|
43
|
+
i(this, o).set(t, !0), i(this, d).call(this);
|
|
43
44
|
}
|
|
44
45
|
error(t) {
|
|
45
|
-
|
|
46
|
+
i(this, o).has(t) && (console.error(`Failed to load ${t}`), i(this, o).delete(t), n(window, "loadingError", {
|
|
47
|
+
detail: {
|
|
48
|
+
name: t
|
|
49
|
+
}
|
|
50
|
+
})), i(this, d).call(this);
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
o = new WeakMap(), a = new WeakMap(), h = new WeakMap(), d = new WeakMap(),
|
|
49
|
-
const
|
|
53
|
+
o = new WeakMap(), a = new WeakMap(), h = new WeakMap(), d = new WeakMap(), f = new WeakMap();
|
|
54
|
+
const b = new u();
|
|
50
55
|
export {
|
|
51
|
-
|
|
56
|
+
b as loading
|
|
52
57
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ce=n=>{throw TypeError(n)};var se=(n,h,t)=>h.has(n)||ce("Cannot "+t);var e=(n,h,t)=>(se(n,h,"read from private field"),t?t.call(n):h.get(n)),s=(n,h,t)=>h.has(n)?ce("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(n):h.set(n,t),r=(n,h,t,i)=>(se(n,h,"write to private field"),i?i.call(n,t):h.set(n,t),t),b=(n,h,t)=>(se(n,h,"access private method"),t);var le=(n,h,t)=>new Promise((i,l)=>{var R=m=>{try{E(t.next(m))}catch(o){l(o)}},Y=m=>{try{E(t.throw(m))}catch(o){l(o)}},E=m=>m.done?i(m.value):Promise.resolve(m.value).then(R,Y);E((t=t.apply(n,h)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("../source/index.cjs"),Se=require("../class-linked-status/index.cjs"),ae=require("../browser-CpzFX2xg.cjs"),ne=require("../events-KVanG9sR.cjs"),ye=require("../string-DhgS_iFl.cjs"),ie=require("../loading/index.cjs"),W=require("../css-property/index.cjs"),Q=require("../element-resizer/vanilla/index.cjs"),ue=require("../canvas-CU5Xjahf.cjs"),B=require("../ticker/vanilla/index.cjs"),we=require("../jss-GJLvaNfT.cjs"),Ce=require("../math-GDWEqu7y.cjs");let xe=0;var u,a,S,_,p,j,k,c,M,F,J,Z,D,ee;class te extends HTMLElement{constructor(){super();s(this,F);s(this,u,null);s(this,a,null);s(this,S,!1);s(this,_,!1);s(this,p,!1);s(this,j,"");s(this,k,"");s(this,c,new Se.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1}));s(this,M,null);s(this,Z,t=>{const i=t[0];e(this,p)&&(!e(this,_)||this.hasAttribute("reload-source"))&&i.isIntersecting&&(e(this,u).current&&e(this,u).current!==e(this,u).previous&&b(this,F,J).call(this,e(this,u).current),r(this,_,!0)),i.isIntersecting?ne.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&b(this,F,J).call(this,void 0),ne.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,D,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,p)&&!e(this,S)&&ie.loading.complete(e(this,k)),r(this,S,!0)});s(this,ee,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,p)&&!e(this,S)&&ie.loading.error(e(this,k)),r(this,S,!0)});ae.isBrowser&&window.IntersectionObserver&&(r(this,j,`source-consumer-${++xe}`),r(this,M,new IntersectionObserver(e(this,Z))))}get consumerElement(){return e(this,a)}get sourceManager(){return e(this,u)}get status(){return e(this,c)}get isLazy(){return e(this,p)}connectedCallback(){const t=this.getAttribute("srcset");t&&(r(this,a,this.createConsumer()),e(this,a).style.cssText=`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
|
-
`,e(this,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(i=>{if(i.name!=="srcset"){const l=i.nodeValue||"",R=
|
|
5
|
+
`,e(this,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(i=>{if(i.name!=="srcset"){const l=i.nodeValue||"",R=ye.kebabToCamel(i.name);R in e(this,a)&&(e(this,a)[R]=l||!0)}}),this.appendChild(e(this,a)),r(this,u,new Ee.SourceManager({srcset:t})),r(this,p,this.hasAttribute("lazy")),e(this,u).subscribe(i=>{(!e(this,p)||e(this,p)&&e(this,_))&&b(this,F,J).call(this,i.current)}),e(this,M).observe(this),e(this,u).connect())}disconnectedCallback(){e(this,M).disconnect(),e(this,u).close(),e(this,a).onloadeddata=null,e(this,a).onload=null,e(this,a).onerror=null,e(this,a).remove(),e(this,c).reset()}}u=new WeakMap,a=new WeakMap,S=new WeakMap,_=new WeakMap,p=new WeakMap,j=new WeakMap,k=new WeakMap,c=new WeakMap,M=new WeakMap,F=new WeakSet,J=function(t){if(e(this,a).onloadeddata=null,e(this,a).onload=null,e(this,a).onerror=null,e(this,c).set("loaded",!1),e(this,c).set("error",!1),e(this,c).set("loading",!1),t){r(this,k,`${e(this,j)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0);const l=i?t.url:t.name+t.extension;this.consumeSource(l),!e(this,p)&&!e(this,S)&&ie.loading.add(e(this,k)),e(this,a).onloadeddata=()=>{e(this,D).call(this)},e(this,a).onload=()=>{e(this,D).call(this)},e(this,a).onerror=()=>{e(this,ee).call(this,l)}}else this.consumeSource(null)},Z=new WeakMap,D=new WeakMap,ee=new WeakMap;class de extends te{createConsumer(){return document.createElement("img")}consumeSource(h){this.consumerElement.src=h||""}}customElements.get("e-image")||customElements.define("e-image",de);var y,g,H,L,P,T,K,N,d,re,pe,U,$,he,fe;class me extends HTMLElement{constructor(){super();s(this,d);s(this,y,new W.CSSProperty(this,"--fps",0));s(this,g,null);s(this,H,null);s(this,L,0);s(this,P,0);s(this,T,1);s(this,K,0);s(this,N,1);s(this,U,t=>{r(this,T,Ce.clamp(devicePixelRatio,1,2)),r(this,L,t.contentRect.width),r(this,P,t.contentRect.height),e(this,g).width=e(this,L)*this.pixelRatio,e(this,g).height=e(this,P)*this.pixelRatio,this.context.scale(this.pixelRatio,this.pixelRatio),b(this,d,fe).call(this),b(this,d,he).call(this)});s(this,$,t=>{r(this,K,t.timestamp),r(this,N,t.timeBetweenFrames),b(this,d,he).call(this)});if(ae.isBrowser){const t=this.attachShadow({mode:"open"});t.adoptedStyleSheets.push(we.createStylesheet({" :host, canvas":{display:"block",width:"100%",height:"100%"}})),r(this,g,document.createElement("canvas")),r(this,H,e(this,g).getContext("2d")),t.appendChild(e(this,g)),e(this,y).subscribe(i=>{typeof i.previous!="undefined"&&i.current!==i.previous&&b(this,d,re).call(this)})}}get fpsCSSProperty(){return e(this,y)}get canvasElement(){return e(this,g)}get context(){return e(this,H)}get pixelRatio(){return e(this,T)}get width(){return e(this,L)}get height(){return e(this,P)}get detail(){return{width:e(this,L),height:e(this,P),element:this,canvasElement:e(this,g),pixelRatio:e(this,T),context:e(this,H),timestamp:e(this,K),timeBetweenFrames:e(this,N)}}connectedCallback(){e(this,y).observe(),Q.elementResizer.subscribe(this,e(this,U)),b(this,d,re).call(this)}disconnectedCallback(){e(this,y).unobserve(),Q.elementResizer.unsubscribe(e(this,U)),b(this,d,pe).call(this)}}y=new WeakMap,g=new WeakMap,H=new WeakMap,L=new WeakMap,P=new WeakMap,T=new WeakMap,K=new WeakMap,N=new WeakMap,d=new WeakSet,re=function(){B.ticker.unsubscribe(e(this,$)),this.hasAttribute("static")||B.ticker.subscribe(e(this,$),{culling:this,maxFPS:e(this,y).current})},pe=function(){B.ticker.unsubscribe(e(this,$))},U=new WeakMap,$=new WeakMap,he=function(){this.dispatchEvent(new CustomEvent("canvasRender",{composed:!0,detail:this.detail}))},fe=function(){this.dispatchEvent(new CustomEvent("canvasResize",{composed:!0,detail:this.detail}))};customElements.get("e-canvas")||customElements.define("e-canvas",me);function Re(n){const h=n.match(/\{([\d-]+)\}/);if(h){const t=h[1].split("-");if(t.length===2){const i=parseInt(t[0],10),l=parseInt(t[1],10);return{start:i,end:l}}}return null}var f,q,O,w,C,I,z,X,v,x;class be extends te{constructor(t){super();s(this,f,[]);s(this,q,new W.CSSProperty(this,"--fit","contain"));s(this,O,new W.CSSProperty(this,"--autoplay",!1));s(this,w,new W.CSSProperty(this,"--offset-x",.5));s(this,C,new W.CSSProperty(this,"--offset-y",.5));s(this,I,null);s(this,z,0);s(this,X,1);s(this,v,()=>{if(e(this,f).length){const t=e(this,f)[0];e(this,q).current==="cover"?r(this,I,ue.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,w).current,e(this,C).current)):r(this,I,ue.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,w).current,e(this,C).current))}});s(this,x,t=>{if(this.status.isFalse("loaded")||!e(this,I))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,f)[e(this,z)];i&&t.detail.context.drawImage(i,...e(this,I)),e(this,O).current&&r(this,z,(e(this,z)+1)%e(this,f).length)});ae.isBrowser&&(r(this,X,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,q).subscribe(e(this,v)),e(this,w).subscribe(e(this,v)),e(this,C).subscribe(e(this,v)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,x))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,x))}))}setProgress(t){e(this,f).length&&r(this,z,Math.floor((e(this,f).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,O).observe(),e(this,q).observe(),e(this,w).observe(),e(this,C).observe(),Q.elementResizer.subscribe(this,e(this,v))}disconnectedCallback(){super.disconnectedCallback(),e(this,O).unobserve(),e(this,q).unobserve(),e(this,w).unobserve(),e(this,C).unobserve(),r(this,f,[]),Q.elementResizer.unsubscribe(e(this,v)),this.consumerElement.removeEventListener("canvasRender",e(this,x))}createConsumer(){return new me}consumeSource(t){return le(this,null,function*(){var i,l,R,Y;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,x));const E=[],m=Re(t);if(m)for(let o=m.start;o<=m.end;o++){const oe=t.replace(/\{([^}]+)\}/,o.toString().padStart(e(this,X),"0")),G=new Image;G.src=oe,E.push(G)}else{const o=new Image;o.src=t,E.push(o)}try{yield Promise.all(E.map((o,oe)=>new Promise((G,ve)=>{o.onload=()=>{G()},o.onerror=ke=>{ve(`${o.src} Image not found`)}}))),r(this,f,E),e(this,v).call(this),(l=(i=this.consumerElement).onload)==null||l.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,x))}catch(o){console.error(o),(Y=(R=this.consumerElement).onerror)==null||Y.call(R,new Event("error"))}}})}}f=new WeakMap,q=new WeakMap,O=new WeakMap,w=new WeakMap,C=new WeakMap,I=new WeakMap,z=new WeakMap,X=new WeakMap,v=new WeakMap,x=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",be);var A,V;class ge extends te{constructor(){super(...arguments);s(this,A,0);s(this,V,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,A)&&r(this,A,t),ne.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,A)}}),this.consumerElement.readyState===4&&B.ticker.unsubscribe(e(this,V))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{B.ticker.subscribe(e(this,V)),this.hasAttribute("capture-autoplay")&&this.consumerElement.play()}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),B.ticker.unsubscribe(e(this,V)),r(this,A,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||""}}A=new WeakMap,V=new WeakMap;customElements.get("e-video")||customElements.define("e-video",ge);exports.ImageElement=de;exports.SequenceElement=be;exports.SourceElement=te;exports.VideoElement=ge;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ce = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (r,
|
|
6
|
-
var
|
|
4
|
+
var te = (r, h, t) => h.has(r) || ce("Cannot " + t);
|
|
5
|
+
var e = (r, h, t) => (te(r, h, "read from private field"), t ? t.call(r) : h.get(r)), s = (r, h, t) => h.has(r) ? ce("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(r) : h.set(r, t), n = (r, h, t, i) => (te(r, h, "write to private field"), i ? i.call(r, t) : h.set(r, t), t), b = (r, h, t) => (te(r, h, "access private method"), t);
|
|
6
|
+
var le = (r, h, t) => new Promise((i, l) => {
|
|
7
7
|
var L = (m) => {
|
|
8
8
|
try {
|
|
9
9
|
E(t.next(m));
|
|
@@ -17,23 +17,23 @@ var ce = (r, n, t) => new Promise((i, l) => {
|
|
|
17
17
|
l(o);
|
|
18
18
|
}
|
|
19
19
|
}, E = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(L, G);
|
|
20
|
-
E((t = t.apply(r,
|
|
20
|
+
E((t = t.apply(r, h)).next());
|
|
21
21
|
});
|
|
22
|
-
import { SourceManager as
|
|
23
|
-
import { ClassLinkedStatus as
|
|
24
|
-
import { i as
|
|
25
|
-
import { d as
|
|
26
|
-
import { k as
|
|
27
|
-
import { loading as
|
|
22
|
+
import { SourceManager as fe } from "../source/index.js";
|
|
23
|
+
import { ClassLinkedStatus as be } from "../class-linked-status/index.js";
|
|
24
|
+
import { i as he } from "../browser-0zX67oeU.js";
|
|
25
|
+
import { d as ie } from "../events-CsVF98U6.js";
|
|
26
|
+
import { k as ge } from "../string-f0Dnk0L1.js";
|
|
27
|
+
import { loading as se } from "../loading/index.js";
|
|
28
28
|
import { CSSProperty as D } from "../css-property/index.js";
|
|
29
|
-
import { elementResizer as
|
|
30
|
-
import { c as
|
|
29
|
+
import { elementResizer as Z } from "../element-resizer/vanilla/index.js";
|
|
30
|
+
import { c as ve, a as Ee } from "../canvas-DeZ0SLUJ.js";
|
|
31
31
|
import { ticker as F } from "../ticker/vanilla/index.js";
|
|
32
|
-
import { c as
|
|
33
|
-
import { c as
|
|
34
|
-
let
|
|
35
|
-
var u, a, w, H, p, R, c, M, T, Q,
|
|
36
|
-
class
|
|
32
|
+
import { c as we } from "../jss-CjccJC-K.js";
|
|
33
|
+
import { c as Se } from "../math-BOBiC4TN.js";
|
|
34
|
+
let Ce = 0;
|
|
35
|
+
var u, a, w, H, p, K, R, c, M, T, Q, _, N, ee;
|
|
36
|
+
class ae extends HTMLElement {
|
|
37
37
|
constructor() {
|
|
38
38
|
super();
|
|
39
39
|
s(this, T);
|
|
@@ -42,25 +42,26 @@ class he extends HTMLElement {
|
|
|
42
42
|
s(this, w, !1);
|
|
43
43
|
s(this, H, !1);
|
|
44
44
|
s(this, p, !1);
|
|
45
|
+
s(this, K, "");
|
|
45
46
|
s(this, R, "");
|
|
46
|
-
s(this, c, new
|
|
47
|
+
s(this, c, new be(this, {
|
|
47
48
|
loading: !1,
|
|
48
49
|
loaded: !1,
|
|
49
50
|
error: !1
|
|
50
51
|
}));
|
|
51
52
|
s(this, M, null);
|
|
52
|
-
s(this,
|
|
53
|
+
s(this, _, (t) => {
|
|
53
54
|
const i = t[0];
|
|
54
|
-
e(this, p) && (!e(this, H) || this.hasAttribute("reload-source")) && i.isIntersecting && (e(this, u).current && e(this, u).current !== e(this, u).previous && b(this, T, Q).call(this, e(this, u).current),
|
|
55
|
+
e(this, p) && (!e(this, H) || this.hasAttribute("reload-source")) && i.isIntersecting && (e(this, u).current && e(this, u).current !== e(this, u).previous && b(this, T, Q).call(this, e(this, u).current), n(this, H, !0)), i.isIntersecting ? ie(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && b(this, T, Q).call(this, void 0), ie(this, "sourceRelease", { custom: !0 }));
|
|
55
56
|
});
|
|
56
|
-
s(this,
|
|
57
|
-
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, p) && !e(this, w) &&
|
|
57
|
+
s(this, N, () => {
|
|
58
|
+
e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, p) && !e(this, w) && se.complete(e(this, R)), n(this, w, !0);
|
|
58
59
|
});
|
|
59
|
-
s(this,
|
|
60
|
-
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, p) && !e(this, w) &&
|
|
60
|
+
s(this, ee, (t) => {
|
|
61
|
+
e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, p) && !e(this, w) && se.error(e(this, R)), n(this, w, !0);
|
|
61
62
|
});
|
|
62
|
-
|
|
63
|
-
e(this,
|
|
63
|
+
he && window.IntersectionObserver && (n(this, K, `source-consumer-${++Ce}`), n(this, M, new IntersectionObserver(
|
|
64
|
+
e(this, _)
|
|
64
65
|
)));
|
|
65
66
|
}
|
|
66
67
|
get consumerElement() {
|
|
@@ -77,18 +78,18 @@ class he extends HTMLElement {
|
|
|
77
78
|
}
|
|
78
79
|
connectedCallback() {
|
|
79
80
|
const t = this.getAttribute("srcset");
|
|
80
|
-
t && (
|
|
81
|
+
t && (n(this, a, this.createConsumer()), e(this, a).style.cssText = `
|
|
81
82
|
display: block;
|
|
82
83
|
width: 100%;
|
|
83
84
|
height: 100%;
|
|
84
85
|
`, e(this, a).classList.add("source-consumer"), Array.from(this.attributes).forEach((i) => {
|
|
85
86
|
if (i.name !== "srcset") {
|
|
86
|
-
const l = i.nodeValue || "", L =
|
|
87
|
+
const l = i.nodeValue || "", L = ge(i.name);
|
|
87
88
|
L in e(this, a) && (e(this, a)[L] = l || !0);
|
|
88
89
|
}
|
|
89
|
-
}), this.appendChild(e(this, a)),
|
|
90
|
+
}), this.appendChild(e(this, a)), n(this, u, new fe({
|
|
90
91
|
srcset: t
|
|
91
|
-
})),
|
|
92
|
+
})), n(this, p, this.hasAttribute("lazy")), e(this, u).subscribe((i) => {
|
|
92
93
|
(!e(this, p) || e(this, p) && e(this, H)) && b(this, T, Q).call(this, i.current);
|
|
93
94
|
}), e(this, M).observe(this), e(this, u).connect());
|
|
94
95
|
}
|
|
@@ -96,61 +97,62 @@ class he extends HTMLElement {
|
|
|
96
97
|
e(this, M).disconnect(), e(this, u).close(), e(this, a).onloadeddata = null, e(this, a).onload = null, e(this, a).onerror = null, e(this, a).remove(), e(this, c).reset();
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
u = new WeakMap(), a = new WeakMap(), w = new WeakMap(), H = new WeakMap(), p = new WeakMap(), R = new WeakMap(), c = new WeakMap(), M = new WeakMap(), T = new WeakSet(), Q = function(t) {
|
|
100
|
+
u = new WeakMap(), a = new WeakMap(), w = new WeakMap(), H = new WeakMap(), p = new WeakMap(), K = new WeakMap(), R = new WeakMap(), c = new WeakMap(), M = new WeakMap(), T = new WeakSet(), Q = function(t) {
|
|
100
101
|
if (e(this, a).onloadeddata = null, e(this, a).onload = null, e(this, a).onerror = null, e(this, c).set("loaded", !1), e(this, c).set("error", !1), e(this, c).set("loading", !1), t) {
|
|
102
|
+
n(this, R, `${e(this, K)}-${t.url}`);
|
|
101
103
|
const i = this.hasAttribute("keep-source-parameters");
|
|
102
104
|
e(this, c).set("loading", !0);
|
|
103
105
|
const l = i ? t.url : t.name + t.extension;
|
|
104
|
-
this.consumeSource(l), !e(this, p) && !e(this, w) &&
|
|
105
|
-
e(this,
|
|
106
|
+
this.consumeSource(l), !e(this, p) && !e(this, w) && se.add(e(this, R)), e(this, a).onloadeddata = () => {
|
|
107
|
+
e(this, N).call(this);
|
|
106
108
|
}, e(this, a).onload = () => {
|
|
107
|
-
e(this,
|
|
109
|
+
e(this, N).call(this);
|
|
108
110
|
}, e(this, a).onerror = () => {
|
|
109
|
-
e(this,
|
|
111
|
+
e(this, ee).call(this, l);
|
|
110
112
|
};
|
|
111
113
|
} else
|
|
112
114
|
this.consumeSource(null);
|
|
113
|
-
},
|
|
114
|
-
class
|
|
115
|
+
}, _ = new WeakMap(), N = new WeakMap(), ee = new WeakMap();
|
|
116
|
+
class ye extends ae {
|
|
115
117
|
createConsumer() {
|
|
116
118
|
return document.createElement("img");
|
|
117
119
|
}
|
|
118
|
-
consumeSource(
|
|
119
|
-
this.consumerElement.src =
|
|
120
|
+
consumeSource(h) {
|
|
121
|
+
this.consumerElement.src = h || "";
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
|
-
customElements.get("e-image") || customElements.define("e-image",
|
|
123
|
-
var S, g,
|
|
124
|
-
class
|
|
124
|
+
customElements.get("e-image") || customElements.define("e-image", ye);
|
|
125
|
+
var S, g, $, k, I, q, U, X, d, re, de, Y, O, ne, me;
|
|
126
|
+
class ue extends HTMLElement {
|
|
125
127
|
constructor() {
|
|
126
128
|
super();
|
|
127
129
|
s(this, d);
|
|
128
130
|
s(this, S, new D(this, "--fps", 0));
|
|
129
131
|
s(this, g, null);
|
|
130
|
-
s(this,
|
|
132
|
+
s(this, $, null);
|
|
131
133
|
s(this, k, 0);
|
|
132
134
|
s(this, I, 0);
|
|
133
|
-
s(this,
|
|
134
|
-
s(this,
|
|
135
|
+
s(this, q, 1);
|
|
136
|
+
s(this, U, 0);
|
|
135
137
|
s(this, X, 1);
|
|
136
138
|
s(this, Y, (t) => {
|
|
137
|
-
|
|
139
|
+
n(this, q, Se(devicePixelRatio, 1, 2)), n(this, k, t.contentRect.width), n(this, I, t.contentRect.height), e(this, g).width = e(this, k) * this.pixelRatio, e(this, g).height = e(this, I) * this.pixelRatio, this.context.scale(this.pixelRatio, this.pixelRatio), b(this, d, me).call(this), b(this, d, ne).call(this);
|
|
138
140
|
});
|
|
139
|
-
s(this,
|
|
140
|
-
|
|
141
|
+
s(this, O, (t) => {
|
|
142
|
+
n(this, U, t.timestamp), n(this, X, t.timeBetweenFrames), b(this, d, ne).call(this);
|
|
141
143
|
});
|
|
142
|
-
if (
|
|
144
|
+
if (he) {
|
|
143
145
|
const t = this.attachShadow({ mode: "open" });
|
|
144
146
|
t.adoptedStyleSheets.push(
|
|
145
|
-
|
|
147
|
+
we({
|
|
146
148
|
" :host, canvas": {
|
|
147
149
|
display: "block",
|
|
148
150
|
width: "100%",
|
|
149
151
|
height: "100%"
|
|
150
152
|
}
|
|
151
153
|
})
|
|
152
|
-
),
|
|
153
|
-
typeof i.previous != "undefined" && i.current !== i.previous && b(this, d,
|
|
154
|
+
), n(this, g, document.createElement("canvas")), n(this, $, e(this, g).getContext("2d")), t.appendChild(e(this, g)), e(this, S).subscribe((i) => {
|
|
155
|
+
typeof i.previous != "undefined" && i.current !== i.previous && b(this, d, re).call(this);
|
|
154
156
|
});
|
|
155
157
|
}
|
|
156
158
|
}
|
|
@@ -161,10 +163,10 @@ class le extends HTMLElement {
|
|
|
161
163
|
return e(this, g);
|
|
162
164
|
}
|
|
163
165
|
get context() {
|
|
164
|
-
return e(this,
|
|
166
|
+
return e(this, $);
|
|
165
167
|
}
|
|
166
168
|
get pixelRatio() {
|
|
167
|
-
return e(this,
|
|
169
|
+
return e(this, q);
|
|
168
170
|
}
|
|
169
171
|
get width() {
|
|
170
172
|
return e(this, k);
|
|
@@ -178,34 +180,34 @@ class le extends HTMLElement {
|
|
|
178
180
|
height: e(this, I),
|
|
179
181
|
element: this,
|
|
180
182
|
canvasElement: e(this, g),
|
|
181
|
-
pixelRatio: e(this,
|
|
182
|
-
context: e(this,
|
|
183
|
-
timestamp: e(this,
|
|
183
|
+
pixelRatio: e(this, q),
|
|
184
|
+
context: e(this, $),
|
|
185
|
+
timestamp: e(this, U),
|
|
184
186
|
timeBetweenFrames: e(this, X)
|
|
185
187
|
};
|
|
186
188
|
}
|
|
187
189
|
connectedCallback() {
|
|
188
|
-
e(this, S).observe(),
|
|
190
|
+
e(this, S).observe(), Z.subscribe(this, e(this, Y)), b(this, d, re).call(this);
|
|
189
191
|
}
|
|
190
192
|
disconnectedCallback() {
|
|
191
|
-
e(this, S).unobserve(),
|
|
193
|
+
e(this, S).unobserve(), Z.unsubscribe(e(this, Y)), b(this, d, de).call(this);
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
|
-
S = new WeakMap(), g = new WeakMap(),
|
|
195
|
-
F.unsubscribe(e(this,
|
|
196
|
+
S = new WeakMap(), g = new WeakMap(), $ = new WeakMap(), k = new WeakMap(), I = new WeakMap(), q = new WeakMap(), U = new WeakMap(), X = new WeakMap(), d = new WeakSet(), re = function() {
|
|
197
|
+
F.unsubscribe(e(this, O)), this.hasAttribute("static") || F.subscribe(e(this, O), {
|
|
196
198
|
culling: this,
|
|
197
199
|
maxFPS: e(this, S).current
|
|
198
200
|
});
|
|
199
|
-
},
|
|
200
|
-
F.unsubscribe(e(this,
|
|
201
|
-
}, Y = new WeakMap(),
|
|
201
|
+
}, de = function() {
|
|
202
|
+
F.unsubscribe(e(this, O));
|
|
203
|
+
}, Y = new WeakMap(), O = new WeakMap(), ne = function() {
|
|
202
204
|
this.dispatchEvent(
|
|
203
205
|
new CustomEvent("canvasRender", {
|
|
204
206
|
composed: !0,
|
|
205
207
|
detail: this.detail
|
|
206
208
|
})
|
|
207
209
|
);
|
|
208
|
-
},
|
|
210
|
+
}, me = function() {
|
|
209
211
|
this.dispatchEvent(
|
|
210
212
|
new CustomEvent("canvasResize", {
|
|
211
213
|
composed: !0,
|
|
@@ -213,11 +215,11 @@ S = new WeakMap(), g = new WeakMap(), q = new WeakMap(), k = new WeakMap(), I =
|
|
|
213
215
|
})
|
|
214
216
|
);
|
|
215
217
|
};
|
|
216
|
-
customElements.get("e-canvas") || customElements.define("e-canvas",
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
-
const t =
|
|
218
|
+
customElements.get("e-canvas") || customElements.define("e-canvas", ue);
|
|
219
|
+
function xe(r) {
|
|
220
|
+
const h = r.match(/\{([\d-]+)\}/);
|
|
221
|
+
if (h) {
|
|
222
|
+
const t = h[1].split("-");
|
|
221
223
|
if (t.length === 2) {
|
|
222
224
|
const i = parseInt(t[0], 10), l = parseInt(t[1], 10);
|
|
223
225
|
return { start: i, end: l };
|
|
@@ -225,8 +227,8 @@ function ye(r) {
|
|
|
225
227
|
}
|
|
226
228
|
return null;
|
|
227
229
|
}
|
|
228
|
-
var f, P,
|
|
229
|
-
class
|
|
230
|
+
var f, P, W, C, y, A, z, j, v, x;
|
|
231
|
+
class Le extends ae {
|
|
230
232
|
constructor(t) {
|
|
231
233
|
super();
|
|
232
234
|
s(this, f, []);
|
|
@@ -235,7 +237,7 @@ class xe extends he {
|
|
|
235
237
|
"--fit",
|
|
236
238
|
"contain"
|
|
237
239
|
));
|
|
238
|
-
s(this,
|
|
240
|
+
s(this, W, new D(this, "--autoplay", !1));
|
|
239
241
|
s(this, C, new D(this, "--offset-x", 0.5));
|
|
240
242
|
s(this, y, new D(this, "--offset-y", 0.5));
|
|
241
243
|
s(this, A, null);
|
|
@@ -244,14 +246,14 @@ class xe extends he {
|
|
|
244
246
|
s(this, v, () => {
|
|
245
247
|
if (e(this, f).length) {
|
|
246
248
|
const t = e(this, f)[0];
|
|
247
|
-
e(this, P).current === "cover" ?
|
|
249
|
+
e(this, P).current === "cover" ? n(this, A, ve(
|
|
248
250
|
t.naturalWidth,
|
|
249
251
|
t.naturalHeight,
|
|
250
252
|
this.consumerElement.width,
|
|
251
253
|
this.consumerElement.height,
|
|
252
254
|
e(this, C).current,
|
|
253
255
|
e(this, y).current
|
|
254
|
-
)) :
|
|
256
|
+
)) : n(this, A, Ee(
|
|
255
257
|
t.naturalWidth,
|
|
256
258
|
t.naturalHeight,
|
|
257
259
|
this.consumerElement.width,
|
|
@@ -266,9 +268,9 @@ class xe extends he {
|
|
|
266
268
|
return;
|
|
267
269
|
t.detail.context.clearRect(0, 0, t.detail.width, t.detail.height);
|
|
268
270
|
const i = e(this, f)[e(this, z)];
|
|
269
|
-
i && t.detail.context.drawImage(i, ...e(this, A)), e(this,
|
|
271
|
+
i && t.detail.context.drawImage(i, ...e(this, A)), e(this, W).current && n(this, z, (e(this, z) + 1) % e(this, f).length);
|
|
270
272
|
});
|
|
271
|
-
|
|
273
|
+
he && (n(this, j, parseInt(
|
|
272
274
|
((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
|
|
273
275
|
)), e(this, P).subscribe(e(this, v)), e(this, C).subscribe(e(this, v)), e(this, y).subscribe(e(this, v)), this.addEventListener("sourceCapture", (i) => {
|
|
274
276
|
this.consumerElement.addEventListener(
|
|
@@ -283,36 +285,36 @@ class xe extends he {
|
|
|
283
285
|
}));
|
|
284
286
|
}
|
|
285
287
|
setProgress(t) {
|
|
286
|
-
e(this, f).length &&
|
|
288
|
+
e(this, f).length && n(this, z, Math.floor((e(this, f).length - 1) * t));
|
|
287
289
|
}
|
|
288
290
|
connectedCallback() {
|
|
289
|
-
super.connectedCallback(), e(this,
|
|
291
|
+
super.connectedCallback(), e(this, W).observe(), e(this, P).observe(), e(this, C).observe(), e(this, y).observe(), Z.subscribe(this, e(this, v));
|
|
290
292
|
}
|
|
291
293
|
disconnectedCallback() {
|
|
292
|
-
super.disconnectedCallback(), e(this,
|
|
294
|
+
super.disconnectedCallback(), e(this, W).unobserve(), e(this, P).unobserve(), e(this, C).unobserve(), e(this, y).unobserve(), n(this, f, []), Z.unsubscribe(e(this, v)), this.consumerElement.removeEventListener(
|
|
293
295
|
"canvasRender",
|
|
294
296
|
e(this, x)
|
|
295
297
|
);
|
|
296
298
|
}
|
|
297
299
|
createConsumer() {
|
|
298
|
-
return new
|
|
300
|
+
return new ue();
|
|
299
301
|
}
|
|
300
302
|
consumeSource(t) {
|
|
301
|
-
return
|
|
303
|
+
return le(this, null, function* () {
|
|
302
304
|
var i, l, L, G;
|
|
303
305
|
if (t) {
|
|
304
306
|
this.consumerElement.removeEventListener(
|
|
305
307
|
"canvasRender",
|
|
306
308
|
e(this, x)
|
|
307
309
|
);
|
|
308
|
-
const E = [], m =
|
|
310
|
+
const E = [], m = xe(t);
|
|
309
311
|
if (m)
|
|
310
312
|
for (let o = m.start; o <= m.end; o++) {
|
|
311
|
-
const
|
|
313
|
+
const oe = t.replace(
|
|
312
314
|
/\{([^}]+)\}/,
|
|
313
315
|
o.toString().padStart(e(this, j), "0")
|
|
314
316
|
), J = new Image();
|
|
315
|
-
J.src =
|
|
317
|
+
J.src = oe, E.push(J);
|
|
316
318
|
}
|
|
317
319
|
else {
|
|
318
320
|
const o = new Image();
|
|
@@ -320,14 +322,14 @@ class xe extends he {
|
|
|
320
322
|
}
|
|
321
323
|
try {
|
|
322
324
|
yield Promise.all(
|
|
323
|
-
E.map((o,
|
|
325
|
+
E.map((o, oe) => new Promise((J, pe) => {
|
|
324
326
|
o.onload = () => {
|
|
325
327
|
J();
|
|
326
|
-
}, o.onerror = (
|
|
327
|
-
|
|
328
|
+
}, o.onerror = (ke) => {
|
|
329
|
+
pe(`${o.src} Image not found`);
|
|
328
330
|
};
|
|
329
331
|
}))
|
|
330
|
-
),
|
|
332
|
+
), n(this, f, E), e(this, v).call(this), (l = (i = this.consumerElement).onload) == null || l.call(i, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
|
|
331
333
|
"canvasRender",
|
|
332
334
|
e(this, x)
|
|
333
335
|
);
|
|
@@ -338,27 +340,27 @@ class xe extends he {
|
|
|
338
340
|
});
|
|
339
341
|
}
|
|
340
342
|
}
|
|
341
|
-
f = new WeakMap(), P = new WeakMap(),
|
|
342
|
-
customElements.get("e-sequence") || customElements.define("e-sequence",
|
|
343
|
-
var B,
|
|
344
|
-
class
|
|
343
|
+
f = new WeakMap(), P = new WeakMap(), W = new WeakMap(), C = new WeakMap(), y = new WeakMap(), A = new WeakMap(), z = new WeakMap(), j = new WeakMap(), v = new WeakMap(), x = new WeakMap();
|
|
344
|
+
customElements.get("e-sequence") || customElements.define("e-sequence", Le);
|
|
345
|
+
var B, V;
|
|
346
|
+
class Re extends ae {
|
|
345
347
|
constructor() {
|
|
346
348
|
super(...arguments);
|
|
347
349
|
s(this, B, 0);
|
|
348
|
-
s(this,
|
|
350
|
+
s(this, V, () => {
|
|
349
351
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
350
352
|
const t = this.consumerElement.readyState / 4;
|
|
351
|
-
t > e(this, B) &&
|
|
353
|
+
t > e(this, B) && n(this, B, t), ie(this, "videoReadyStateChange", {
|
|
352
354
|
detail: {
|
|
353
355
|
readyState: this.consumerElement.readyState,
|
|
354
356
|
progress: e(this, B)
|
|
355
357
|
}
|
|
356
|
-
}), this.consumerElement.readyState === 4 && F.unsubscribe(e(this,
|
|
358
|
+
}), this.consumerElement.readyState === 4 && F.unsubscribe(e(this, V));
|
|
357
359
|
});
|
|
358
360
|
}
|
|
359
361
|
connectedCallback() {
|
|
360
362
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
361
|
-
F.subscribe(e(this,
|
|
363
|
+
F.subscribe(e(this, V)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
|
|
362
364
|
}), this.addEventListener("sourceRelease", () => {
|
|
363
365
|
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
|
|
364
366
|
"state-0",
|
|
@@ -370,7 +372,7 @@ class Le extends he {
|
|
|
370
372
|
});
|
|
371
373
|
}
|
|
372
374
|
disconnectedCallback() {
|
|
373
|
-
super.disconnectedCallback(), F.unsubscribe(e(this,
|
|
375
|
+
super.disconnectedCallback(), F.unsubscribe(e(this, V)), n(this, B, 0);
|
|
374
376
|
}
|
|
375
377
|
createConsumer() {
|
|
376
378
|
return document.createElement("video");
|
|
@@ -379,11 +381,11 @@ class Le extends he {
|
|
|
379
381
|
this.consumerElement.src = t || "";
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
|
-
B = new WeakMap(),
|
|
383
|
-
customElements.get("e-video") || customElements.define("e-video",
|
|
384
|
+
B = new WeakMap(), V = new WeakMap();
|
|
385
|
+
customElements.get("e-video") || customElements.define("e-video", Re);
|
|
384
386
|
export {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
ye as ImageElement,
|
|
388
|
+
Le as SequenceElement,
|
|
389
|
+
ae as SourceElement,
|
|
390
|
+
Re as VideoElement
|
|
389
391
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=i=>{throw TypeError(i)};var M=(i,r,t)=>r.has(i)||P("Cannot "+t);var e=(i,r,t)=>(M(i,r,"read from private field"),t?t.call(i):r.get(i)),o=(i,r,t)=>r.has(i)?P("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,t),h=(i,r,t,d)=>(M(i,r,"write to private field"),d?d.call(i,t):r.set(i,t),t),b=(i,r,t)=>(M(i,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../attribute/index.cjs"),B=require("../Store-CDb6RMce.cjs"),A=require("../events-KVanG9sR.cjs"),N=require("../style-At6aDoqG.cjs"),j=require("../browser-CpzFX2xg.cjs");var E,l,T,p,u,v,g,a,R,L,x,y,H,f;const c=class c extends HTMLElement{constructor(){super(...arguments);o(this,a);o(this,E);o(this,l);o(this,T);o(this,p);o(this,u);o(this,v);o(this,g);o(this,L);o(this,y);o(this,f);h(this,E,-1),h(this,l,new B.Store(!1)),h(this,p,new O.Attribute(this,"history",!1)),h(this,u,new O.Attribute(this,"restore",!1)),h(this,v,new O.Attribute(this,"single",!1)),h(this,g,!1),this.open=(t=!0)=>{if(e(this,l).current)return;e(this,l).current=!0,e(this,v).current&&(c.__opened.forEach(n=>n.close()),c.__opened=[]),c.__opened.push(this),h(this,E,c.__opened.length-1),e(this,p).current&&e(this,g)&&history.pushState("","",e(this,a,R)),clearTimeout(e(this,T)),this.classList.add("triggered"),this.style.display="block",A.dispatchEvent(this,"popoverTriggered",{custom:!0});const d=()=>{addEventListener("click",e(this,L)),addEventListener("keydown",e(this,y)),this.style.opacity="1",this.classList.add("opened"),A.dispatchEvent(this,"popoverOpened",{custom:!0})};t?setTimeout(d):d()},this.close=()=>{e(this,l).current&&(e(this,l).current=!1,c.__opened=c.__opened.filter(t=>t!==this),b(this,a,x).call(this),this.classList.remove("opened"),this.style.opacity="0",A.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,L)),removeEventListener("keydown",e(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",A.dispatchEvent(this,"popoverClosed",{custom:!0})},N.getElementTransitionDurationMS(this)+10))},h(this,L,t=>{b(this,a,H).call(this,()=>{var $;const n=t.composedPath()[0],_=n instanceof HTMLElement&&(this.contains(n)||(($=this.shadowRoot)==null?void 0:$.contains(n))),m=n instanceof HTMLElement&&n.hasAttribute("outside");(!_||m)&&this.close()})}),h(this,y,t=>{b(this,a,H).call(this,()=>{t.code==="Escape"&&this.close()})}),h(this,f,()=>{h(this,g,!1),e(this,l).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,l).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),h(this,g,!0)})}get history(){return e(this,p)}get restore(){return e(this,u)}get single(){return e(this,v)}get opened(){return e(this,l)}connectedCallback(){e(this,p).observe(),e(this,u).observe(),e(this,v).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),addEventListener("popstate",e(this,f)),setTimeout(()=>{e(this,u).current?e(this,f).call(this):(b(this,a,x).call(this),h(this,g,!0))},0)}disconnectedCallback(){e(this,p).unobserve(),e(this,u).unobserve(),e(this,v).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,f))}};E=new WeakMap,l=new WeakMap,T=new WeakMap,p=new WeakMap,u=new WeakMap,v=new WeakMap,g=new WeakMap,a=new WeakSet,R=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},L=new WeakMap,x=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},y=new WeakMap,H=function(t){(c.__opened[e(this,E)-1]||c.__opened.length===1)&&t()},f=new WeakMap,c.__opened=[];let q=c;customElements.get("e-popover")||customElements.define("e-popover",q);var s,w,k,S,C;class I extends HTMLElement{constructor(){super();o(this,s);o(this,w,()=>{this.classList.add("triggered")});o(this,k,()=>{this.classList.add("opened")});o(this,S,()=>{this.classList.remove("opened")});o(this,C,()=>{this.classList.remove("triggered")});j.isBrowser&&(this.addEventListener("click",()=>{if(e(this,s)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,s).opened.current?e(this,s).open():(t==="close"||t==="toggle"&&e(this,s).opened.current)&&e(this,s).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,s)}connectedCallback(){var d;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let n=null;if(t==="parent"){const _=this.closest("[popover-target]");if(_)n=_;else{const m=this.getRootNode();m instanceof ShadowRoot?n=m.host.closest("[popover-target]"):m instanceof HTMLElement&&(n=m.closest("[popover-target]"))}}else t==="sibling"?n=(d=this.parentElement)==null?void 0:d.querySelector("[popover-target]"):n=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);n instanceof HTMLElement?(h(this,s,n),e(this,s).addEventListener("popoverTriggered",e(this,w)),e(this,s).addEventListener("popoverOpened",e(this,k)),e(this,s).addEventListener("popoverClosing",e(this,S)),e(this,s).addEventListener("popoverClosed",e(this,C))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,s)&&(e(this,s).removeEventListener("popoverTriggered",e(this,w)),e(this,s).removeEventListener("popoverOpened",e(this,k)),e(this,s).removeEventListener("popoverClosing",e(this,S)),e(this,s).removeEventListener("popoverClosed",e(this,C)))}}s=new WeakMap,w=new WeakMap,k=new WeakMap,S=new WeakMap,C=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",I);exports.PopoverButtonElement=I;exports.PopoverElement=q;
|
|
1
|
+
"use strict";var P=i=>{throw TypeError(i)};var M=(i,r,t)=>r.has(i)||P("Cannot "+t);var e=(i,r,t)=>(M(i,r,"read from private field"),t?t.call(i):r.get(i)),o=(i,r,t)=>r.has(i)?P("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(i):r.set(i,t),h=(i,r,t,d)=>(M(i,r,"write to private field"),d?d.call(i,t):r.set(i,t),t),b=(i,r,t)=>(M(i,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("../attribute/index.cjs"),B=require("../Store-CDb6RMce.cjs"),A=require("../events-KVanG9sR.cjs"),N=require("../style-At6aDoqG.cjs"),j=require("../browser-CpzFX2xg.cjs");var E,l,T,p,u,v,g,a,R,L,x,y,H,f;const c=class c extends HTMLElement{constructor(){super(...arguments);o(this,a);o(this,E);o(this,l);o(this,T);o(this,p);o(this,u);o(this,v);o(this,g);o(this,L);o(this,y);o(this,f);h(this,E,-1),h(this,l,new B.Store(!1)),h(this,p,new O.Attribute(this,"history",!1)),h(this,u,new O.Attribute(this,"restore",!1)),h(this,v,new O.Attribute(this,"single",!1)),h(this,g,!1),this.open=(t=!0)=>{if(e(this,l).current)return;e(this,l).current=!0,e(this,v).current&&(c.__opened.forEach(n=>n.close()),c.__opened=[]),c.__opened.push(this),h(this,E,c.__opened.length-1),e(this,p).current&&e(this,g)&&history.pushState("","",e(this,a,R)),clearTimeout(e(this,T)),this.classList.add("triggered"),this.style.display="block",A.dispatchEvent(this,"popoverTriggered",{custom:!0});const d=()=>{addEventListener("click",e(this,L)),addEventListener("keydown",e(this,y)),this.style.opacity="1",this.classList.add("opened"),A.dispatchEvent(this,"popoverOpened",{custom:!0})};t?setTimeout(d):d()},this.close=()=>{e(this,l).current&&(e(this,l).current=!1,c.__opened=c.__opened.filter(t=>t!==this),b(this,a,x).call(this),this.classList.remove("opened"),this.style.opacity="0",A.dispatchEvent(this,"popoverClosing",{custom:!0}),removeEventListener("click",e(this,L)),removeEventListener("keydown",e(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none",A.dispatchEvent(this,"popoverClosed",{custom:!0})},N.getElementTransitionDurationMS(this)+10))},h(this,L,t=>{b(this,a,H).call(this,()=>{var $;const n=t.composedPath()[0],_=n instanceof HTMLElement&&(this.contains(n)||(($=this.shadowRoot)==null?void 0:$.contains(n))),m=n instanceof HTMLElement&&n.hasAttribute("data-outside");(!_||m)&&this.close()})}),h(this,y,t=>{b(this,a,H).call(this,()=>{t.code==="Escape"&&this.close()})}),h(this,f,()=>{h(this,g,!1),e(this,l).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,l).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),h(this,g,!0)})}get history(){return e(this,p)}get restore(){return e(this,u)}get single(){return e(this,v)}get opened(){return e(this,l)}connectedCallback(){e(this,p).observe(),e(this,u).observe(),e(this,v).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),addEventListener("popstate",e(this,f)),setTimeout(()=>{e(this,u).current?e(this,f).call(this):(b(this,a,x).call(this),h(this,g,!0))},0)}disconnectedCallback(){e(this,p).unobserve(),e(this,u).unobserve(),e(this,v).unobserve(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),c.__opened=c.__opened.filter(t=>t!==this),clearTimeout(e(this,T)),removeEventListener("popstate",e(this,f))}};E=new WeakMap,l=new WeakMap,T=new WeakMap,p=new WeakMap,u=new WeakMap,v=new WeakMap,g=new WeakMap,a=new WeakSet,R=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},L=new WeakMap,x=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},y=new WeakMap,H=function(t){(c.__opened[e(this,E)-1]||c.__opened.length===1)&&t()},f=new WeakMap,c.__opened=[];let q=c;customElements.get("e-popover")||customElements.define("e-popover",q);var s,w,k,S,C;class I extends HTMLElement{constructor(){super();o(this,s);o(this,w,()=>{this.classList.add("triggered")});o(this,k,()=>{this.classList.add("opened")});o(this,S,()=>{this.classList.remove("opened")});o(this,C,()=>{this.classList.remove("triggered")});j.isBrowser&&(this.addEventListener("click",()=>{if(e(this,s)){const t=this.getAttribute("type")||"open";t==="open"||t==="toggle"&&!e(this,s).opened.current?e(this,s).open():(t==="close"||t==="toggle"&&e(this,s).opened.current)&&e(this,s).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get popoverElement(){return e(this,s)}connectedCallback(){var d;this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let n=null;if(t==="parent"){const _=this.closest("[popover-target]");if(_)n=_;else{const m=this.getRootNode();m instanceof ShadowRoot?n=m.host.closest("[popover-target]"):m instanceof HTMLElement&&(n=m.closest("[popover-target]"))}}else t==="sibling"?n=(d=this.parentElement)==null?void 0:d.querySelector("[popover-target]"):n=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);n instanceof HTMLElement?(h(this,s,n),e(this,s).addEventListener("popoverTriggered",e(this,w)),e(this,s).addEventListener("popoverOpened",e(this,k)),e(this,s).addEventListener("popoverClosing",e(this,S)),e(this,s).addEventListener("popoverClosed",e(this,C))):console.warn(this,`target ${t} not found`)}}disconnectedCallback(){e(this,s)&&(e(this,s).removeEventListener("popoverTriggered",e(this,w)),e(this,s).removeEventListener("popoverOpened",e(this,k)),e(this,s).removeEventListener("popoverClosing",e(this,S)),e(this,s).removeEventListener("popoverClosed",e(this,C)))}}s=new WeakMap,w=new WeakMap,k=new WeakMap,S=new WeakMap,C=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",I);exports.PopoverButtonElement=I;exports.PopoverElement=q;
|
package/lib/popover/index.js
CHANGED
|
@@ -8,25 +8,25 @@ import { S as N } from "../Store-OTdcl6SX.js";
|
|
|
8
8
|
import { d as A } from "../events-CsVF98U6.js";
|
|
9
9
|
import { g as B } from "../style-j2TwriJ_.js";
|
|
10
10
|
import { i as P } from "../browser-0zX67oeU.js";
|
|
11
|
-
var L, p, T,
|
|
11
|
+
var L, p, T, a, u, v, g, l, q, E, O, y, $, m;
|
|
12
12
|
const c = class c extends HTMLElement {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
o(this,
|
|
15
|
+
o(this, l);
|
|
16
16
|
o(this, L);
|
|
17
17
|
o(this, p);
|
|
18
18
|
o(this, T);
|
|
19
|
-
o(this,
|
|
19
|
+
o(this, a);
|
|
20
20
|
o(this, u);
|
|
21
21
|
o(this, v);
|
|
22
22
|
o(this, g);
|
|
23
23
|
o(this, E);
|
|
24
24
|
o(this, y);
|
|
25
25
|
o(this, m);
|
|
26
|
-
h(this, L, -1), h(this, p, new N(!1)), h(this,
|
|
26
|
+
h(this, L, -1), h(this, p, new N(!1)), h(this, a, new x(this, "history", !1)), h(this, u, new x(this, "restore", !1)), h(this, v, new x(this, "single", !1)), h(this, g, !1), this.open = (t = !0) => {
|
|
27
27
|
if (e(this, p).current)
|
|
28
28
|
return;
|
|
29
|
-
e(this, p).current = !0, e(this, v).current && (c.__opened.forEach((n) => n.close()), c.__opened = []), c.__opened.push(this), h(this, L, c.__opened.length - 1), e(this,
|
|
29
|
+
e(this, p).current = !0, e(this, v).current && (c.__opened.forEach((n) => n.close()), c.__opened = []), c.__opened.push(this), h(this, L, c.__opened.length - 1), e(this, a).current && e(this, g) && history.pushState("", "", e(this, l, q)), clearTimeout(e(this, T)), this.classList.add("triggered"), this.style.display = "block", A(this, "popoverTriggered", {
|
|
30
30
|
custom: !0
|
|
31
31
|
});
|
|
32
32
|
const d = () => {
|
|
@@ -36,7 +36,7 @@ const c = class c extends HTMLElement {
|
|
|
36
36
|
};
|
|
37
37
|
t ? setTimeout(d) : d();
|
|
38
38
|
}, this.close = () => {
|
|
39
|
-
e(this, p).current && (e(this, p).current = !1, c.__opened = c.__opened.filter((t) => t !== this), b(this,
|
|
39
|
+
e(this, p).current && (e(this, p).current = !1, c.__opened = c.__opened.filter((t) => t !== this), b(this, l, O).call(this), this.classList.remove("opened"), this.style.opacity = "0", A(this, "popoverClosing", {
|
|
40
40
|
custom: !0
|
|
41
41
|
}), removeEventListener("click", e(this, E)), removeEventListener("keydown", e(this, y)), setTimeout(() => {
|
|
42
42
|
this.classList.remove("triggered"), this.style.display = "none", A(this, "popoverClosed", {
|
|
@@ -44,21 +44,21 @@ const c = class c extends HTMLElement {
|
|
|
44
44
|
});
|
|
45
45
|
}, B(this) + 10));
|
|
46
46
|
}, h(this, E, (t) => {
|
|
47
|
-
b(this,
|
|
47
|
+
b(this, l, $).call(this, () => {
|
|
48
48
|
var R;
|
|
49
|
-
const n = t.composedPath()[0], _ = n instanceof HTMLElement && (this.contains(n) || ((R = this.shadowRoot) == null ? void 0 : R.contains(n))), f = n instanceof HTMLElement && n.hasAttribute("outside");
|
|
49
|
+
const n = t.composedPath()[0], _ = n instanceof HTMLElement && (this.contains(n) || ((R = this.shadowRoot) == null ? void 0 : R.contains(n))), f = n instanceof HTMLElement && n.hasAttribute("data-outside");
|
|
50
50
|
(!_ || f) && this.close();
|
|
51
51
|
});
|
|
52
52
|
}), h(this, y, (t) => {
|
|
53
|
-
b(this,
|
|
53
|
+
b(this, l, $).call(this, () => {
|
|
54
54
|
t.code === "Escape" && this.close();
|
|
55
55
|
});
|
|
56
56
|
}), h(this, m, () => {
|
|
57
|
-
h(this, g, !1), e(this, p).current && e(this,
|
|
57
|
+
h(this, g, !1), e(this, p).current && e(this, a).current && !location.search.includes(this.id) ? this.close() : !e(this, p).current && e(this, a).current && location.search.includes(this.id) && this.open(), h(this, g, !0);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
get history() {
|
|
61
|
-
return e(this,
|
|
61
|
+
return e(this, a);
|
|
62
62
|
}
|
|
63
63
|
get restore() {
|
|
64
64
|
return e(this, u);
|
|
@@ -70,18 +70,18 @@ const c = class c extends HTMLElement {
|
|
|
70
70
|
return e(this, p);
|
|
71
71
|
}
|
|
72
72
|
connectedCallback() {
|
|
73
|
-
e(this,
|
|
74
|
-
e(this, u).current ? e(this, m).call(this) : (b(this,
|
|
73
|
+
e(this, a).observe(), e(this, u).observe(), e(this, v).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), addEventListener("popstate", e(this, m)), setTimeout(() => {
|
|
74
|
+
e(this, u).current ? e(this, m).call(this) : (b(this, l, O).call(this), h(this, g, !0));
|
|
75
75
|
}, 0);
|
|
76
76
|
}
|
|
77
77
|
disconnectedCallback() {
|
|
78
|
-
e(this,
|
|
78
|
+
e(this, a).unobserve(), e(this, u).unobserve(), e(this, v).unobserve(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, m));
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
L = new WeakMap(), p = new WeakMap(), T = new WeakMap(),
|
|
81
|
+
L = new WeakMap(), p = new WeakMap(), T = new WeakMap(), a = new WeakMap(), u = new WeakMap(), v = new WeakMap(), g = new WeakMap(), l = new WeakSet(), q = function() {
|
|
82
82
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
|
|
83
83
|
}, E = new WeakMap(), O = function() {
|
|
84
|
-
if (e(this,
|
|
84
|
+
if (e(this, a).current) {
|
|
85
85
|
const t = new URL(location.href);
|
|
86
86
|
t.searchParams.delete(this.id), history.replaceState(null, "", t.href);
|
|
87
87
|
}
|