aptechka 0.75.0 → 0.76.1
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/SourceElement-DE6khDs3.cjs +5 -0
- package/lib/{SourceElement-Cvtgjo07.js → SourceElement-DJxX7uN5.js} +91 -92
- package/lib/element-linked-store/index.cjs +1 -1
- package/lib/element-linked-store/index.js +38 -29
- package/lib/en3/{en3.d.ts → En3.d.ts} +1 -5
- package/lib/en3/En3View.d.ts +2 -1
- package/lib/en3/index.cjs +2 -2
- package/lib/en3/index.d.ts +1 -1
- package/lib/en3/index.js +144 -253
- package/lib/en3/utils/getCurrentViewport.d.ts +2 -1
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +1 -1
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{layout-DpZo-I0y.js → layout-BSMtwCga.js} +2 -2
- package/lib/layout-box/index.js +1 -1
- package/lib/morph/index.js +1 -1
- package/lib/scroll/{ScrollbarElement.d.ts → ScrollScrollbarElement.d.ts} +2 -2
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.d.ts +1 -1
- package/lib/scroll/index.js +4 -4
- package/lib/{scroll-DPkCFTxg.js → scroll-DNGJVxa2.js} +1 -1
- package/lib/scroll-kit/ScrollRegionElement.d.ts +38 -0
- package/lib/{custom-scrollbar/index.d.ts → scroll-kit/ScrollbarElement.d.ts} +2 -2
- package/lib/scroll-kit/SmoothScrollElement.d.ts +16 -0
- package/lib/scroll-kit/index.cjs +1 -0
- package/lib/scroll-kit/index.d.ts +3 -0
- package/lib/scroll-kit/index.js +382 -0
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +1 -1
- package/package.json +9 -9
- package/lib/SourceElement-0vRhCW3O.cjs +0 -5
- package/lib/custom-scrollbar/index.cjs +0 -1
- package/lib/custom-scrollbar/index.js +0 -100
- package/lib/en3/En3Raycaster.d.ts +0 -20
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var Y=c=>{throw TypeError(c)};var Z=(c,n,e)=>n.has(c)||Y("Cannot "+e);var t=(c,n,e)=>(Z(c,n,"read from private field"),e?e.call(c):n.get(c)),i=(c,n,e)=>n.has(c)?Y("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,e),s=(c,n,e,a)=>(Z(c,n,"write to private field"),a?a.call(c,e):n.set(c,e),e),F=(c,n,e)=>(Z(c,n,"access private method"),e);const it=require("./element-linked-store/index.cjs"),rt=require("./index-DekP7OZe.cjs"),w=require("./events-KVanG9sR.cjs"),nt=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");const J=require("./loading/index.cjs"),at=require("./order/index.cjs"),tt=require("./window-resizer/index.cjs"),ht=require("./Store-Cd1GlEmZ.cjs");var V,b,C,S,d,p,M;class et{constructor(n){i(this,V);i(this,b);i(this,C);i(this,S);i(this,d);i(this,p);i(this,M);s(this,V,n);let e=n.split(".");const a=/\b\d{1,2}x\b/g,h=e.find(y=>y.match(a)&&parseInt(y));s(this,C,h?parseInt(h):1),h&&(e=e.slice(0,-1)),s(this,b,e.length>1?e.slice(0,-1).join("."):e.join("."));const l=/\d+max/g,m=/\d+min/g,N=/\d+mar/g,U=/\d+mir/g,W=e.find(y=>y.match(l)),u=e.find(y=>y.match(m)),x=e.find(y=>y.match(N)),X=e.find(y=>y.match(U));x?(s(this,d,parseInt(x)),s(this,p,"max"),s(this,S,`(max-aspect-ratio: ${t(this,d)})`)):X?(s(this,d,parseInt(X)),s(this,p,"max"),s(this,S,`(min-aspect-ratio: ${t(this,d)})`)):W?(s(this,d,parseInt(W)),s(this,p,"max"),s(this,S,`(max-width: ${t(this,d)}px)`)):u?(s(this,d,parseInt(u)),s(this,S,`(min-width: ${t(this,d)}px)`),s(this,p,"min")):(s(this,d,0),s(this,S,`(min-width: ${t(this,d)}px)`),s(this,p,"min")),s(this,b,t(this,b).replace(`.${t(this,d)}${t(this,p)}`,"")),s(this,M,e[e.length-1]===t(this,b)?"":"."+e[e.length-1]),s(this,M,t(this,M).replace(`.${t(this,d)}${t(this,p)}`,""))}get url(){return t(this,V)}get name(){return t(this,b)}get density(){return t(this,C)}get query(){return t(this,S)}get extension(){return t(this,M)}get queryType(){return t(this,p)}get queryValue(){return t(this,d)}}V=new WeakMap,b=new WeakMap,C=new WeakMap,S=new WeakMap,d=new WeakMap,p=new WeakMap,M=new WeakMap;var q;class Q{constructor(n,e){i(this,q);s(this,q,new Map);const a=(e==null?void 0:e.mediaBuckets)!==!1,h=typeof n=="string"?a?n.trim().split(",").map(u=>u.trim()).filter(u=>!!u):[n]:n,l=[];h.forEach(u=>{const x=new et(u);l.push([x.query,x])});const m=l.filter(u=>u[1].queryType.includes("max")).sort((u,x)=>x[1].queryValue-u[1].queryValue),N=l.filter(u=>u[1].queryType.includes("min")&&u[1].queryValue!==0).sort((u,x)=>u[1].queryValue-x[1].queryValue),U=l.filter(u=>u[0]==="(min-width: 0px)");(U?[...U,...m,...N]:[...m,...N]).forEach(u=>{t(this,q).has(u[0])||t(this,q).set(u[0],[]),t(this,q).get(u[0]).push(u[1])})}get mediaBuckets(){return t(this,q)}}q=new WeakMap;var I,$;class st extends ht.Store{constructor(e){super(void 0);i(this,I);i(this,$,()=>{let e;t(this,I).mediaBuckets.forEach((l,m)=>{matchMedia(m).matches&&(e=l)});let a,h=0;e==null||e.forEach(l=>{l.density>h&&l.density<=Math.max(devicePixelRatio,1)&&(h=l.density,a=l)}),e!=null&&e.length&&!a&&(a=e[0]),this.current=a});s(this,I,new Q(e.srcset,e.sourceSetOptions))}updateSource(e){s(this,I,new Q(e.srcset,e.sourceSetOptions)),t(this,$).call(this)}close(){super.close(),this.disconnect()}connect(){tt.windowResizer.subscribe(t(this,$),at.RESIZE_ORDER.SOURCE_MANAGER),t(this,$).call(this)}disconnect(){tt.windowResizer.unsubscribe(t(this,$))}}I=new WeakMap,$=new WeakMap;function ot(c){if(isNaN(c))return"0:00";const n=Math.floor(Math.max(0,c)),e=Math.floor(n/3600),a=Math.floor(n%3600/60),l=(n%60).toString().padStart(2,"0");if(e>0){const m=a.toString().padStart(2,"0");return`${e}:${m}:${l}`}else return`${a}:${l}`}let ct=0;var f,r,R,E,L,g,B,A,o,k,O,v,P,T,j,G,_,K,D,H,z;class ut extends HTMLElement{constructor(e){super();i(this,T);i(this,f,null);i(this,r,null);i(this,R,this);i(this,E,!1);i(this,L,!1);i(this,g,!1);i(this,B,"");i(this,A,"");i(this,o,new it.ElementLinkedStore(this,{loading:!1,loaded:!1,error:!1,clear:!1,playing:!1,metadata:!1}));i(this,k,null);i(this,O);i(this,v,null);i(this,P);i(this,G,e=>{const a=e[0];t(this,g)&&(!t(this,L)||this.hasAttribute("reload-source"))&&a.isIntersecting&&this.triggerLazyLoad(),a.isIntersecting?w.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(F(this,T,j).call(this,void 0),s(this,L,!1)),w.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,_,()=>{t(this,o).set("loaded",!0),t(this,o).set("error",!1),t(this,o).set("loading",!1),!t(this,g)&&!t(this,E)&&J.loading.complete(t(this,A)),w.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,O,setTimeout(()=>{t(this,o).set("clear",!0)},parseFloat(e)*1e3)):t(this,o).set("clear",!0),s(this,E,!0)});i(this,K,e=>{t(this,o).set("loaded",!1),t(this,o).set("error",!0),t(this,o).set("loading",!1),!t(this,g)&&!t(this,E)&&J.loading.error(t(this,A)),w.dispatchEvent(this,"sourceError",{custom:!0}),s(this,E,!0)});i(this,D,()=>{t(this,o).set("playing",!0),w.dispatchEvent(this,"sourcePlay",{custom:!0})});i(this,H,()=>{t(this,o).set("playing",!1),w.dispatchEvent(this,"sourcePause",{custom:!0})});i(this,z,()=>{const e=t(this,r);(e.tagName==="VIDEO"||e.tagName==="AUDIO")&&e.readyState>=1&&(t(this,o).set("metadata",!0),w.dispatchEvent(this,"sourceMetadataLoaded",{custom:!0}),this.querySelectorAll("[data-source-duration]").forEach(a=>{a.textContent=ot(e.duration)}))});s(this,P,e==null?void 0:e.sourceSetOptions),rt.isBrowser&&window.IntersectionObserver&&s(this,k,new IntersectionObserver(t(this,G))),t(this,o).subscribe(a=>{var l;const h=(l=this.getAttribute("data-global-play-class"))==null?void 0:l.split(",");h!=null&&h.length&&(a.current.playing?h.forEach(m=>{document.documentElement.classList.add(m.trim())}):h.forEach(m=>{document.documentElement.classList.remove(m.trim())}))})}get consumerElement(){return t(this,r)}get consumerHolderElement(){return t(this,R)}get sourceManager(){return t(this,f)}get status(){return t(this,o)}get isLazy(){return t(this,g)}get currentURL(){return t(this,v)}get isFirstLoadHappened(){return t(this,E)}triggerLazyLoad(){!t(this,L)&&t(this,f).current&&t(this,f).current!==t(this,f).previous&&(s(this,L,!0),F(this,T,j).call(this,t(this,f).current))}connectedCallback(){s(this,B,`source-consumer-${++ct}`);const e=this.getAttribute("srcset")||"",a=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;a&&t(this,o).addElement(a),s(this,R,this.querySelector("[data-consumer-holder]")||this),this.querySelectorAll(".source-consumer").forEach(h=>h==null?void 0:h.remove()),s(this,r,this.createConsumer()),t(this,r).style.cssText=`
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
`,t(this,r).classList.add("source-consumer"),t(this,r).addEventListener("play",t(this,D)),t(this,r).addEventListener("pause",t(this,H)),t(this,r).addEventListener("loadedmetadata",t(this,z)),t(this,z).call(this),Array.from(this.attributes).forEach(h=>{if(h.name!=="srcset"){const l=h.nodeValue||"",m=nt.kebabToCamel(h.name);m in t(this,r)&&(t(this,r)[m]=l||!0)}}),t(this,R).appendChild(t(this,r)),s(this,f,new st({srcset:e,sourceSetOptions:t(this,P)})),s(this,g,this.hasAttribute("lazy")),t(this,f).subscribe(h=>{(!t(this,g)||t(this,g)&&t(this,L))&&F(this,T,j).call(this,h.current)}),t(this,f).connect(),t(this,k).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,O)),t(this,k).disconnect(),(e=t(this,f))==null||e.close(),t(this,r)&&(this.consumeSource(null),t(this,r).removeEventListener("play",t(this,D)),t(this,r).removeEventListener("pause",t(this,H)),t(this,r).removeEventListener("loadedmetadata",t(this,z)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,r).onerror=null,t(this,r).remove()),s(this,E,!1),s(this,L,!1),t(this,o).reset()}}f=new WeakMap,r=new WeakMap,R=new WeakMap,E=new WeakMap,L=new WeakMap,g=new WeakMap,B=new WeakMap,A=new WeakMap,o=new WeakMap,k=new WeakMap,O=new WeakMap,v=new WeakMap,P=new WeakMap,T=new WeakSet,j=function(e){if(clearTimeout(t(this,O)),t(this,r).onloadeddata=null,t(this,r).onload=null,t(this,r).onerror=null,t(this,o).set("loaded",!1),t(this,o).set("error",!1),t(this,o).set("loading",!1),t(this,o).set("clear",!1),t(this,o).set("playing",!1),t(this,o).set("metadata",!1),e){s(this,A,`${t(this,B)}-${e.url}`);const a=this.hasAttribute("keep-source-parameters");t(this,o).set("loading",!0),s(this,v,a?e.url:e.name+e.extension),this.consumeSource(t(this,v)),!t(this,g)&&!t(this,E)&&J.loading.add(t(this,A)),t(this,r).onloadeddata=()=>{t(this,_).call(this)},t(this,r).onload=()=>{t(this,_).call(this)},t(this,r).onerror=()=>{t(this,K).call(this,t(this,v))}}else s(this,v,null),this.consumeSource(null)},G=new WeakMap,_=new WeakMap,K=new WeakMap,D=new WeakMap,H=new WeakMap,z=new WeakMap;exports.Source=et;exports.SourceElement=ut;exports.SourceManager=st;exports.SourceSet=Q;
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var X = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var X = (c) => {
|
|
2
|
+
throw TypeError(c);
|
|
3
3
|
};
|
|
4
|
-
var Z = (
|
|
5
|
-
var t = (
|
|
4
|
+
var Z = (c, a, e) => a.has(c) || X("Cannot " + e);
|
|
5
|
+
var t = (c, a, e) => (Z(c, a, "read from private field"), e ? e.call(c) : a.get(c)), i = (c, a, e) => a.has(c) ? X("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(c) : a.set(c, e), s = (c, a, e, n) => (Z(c, a, "write to private field"), n ? n.call(c, e) : a.set(c, e), e), j = (c, a, e) => (Z(c, a, "access private method"), e);
|
|
6
6
|
import { ElementLinkedStore as et } from "./element-linked-store/index.js";
|
|
7
7
|
import { i as st } from "./index-Bv9zgfdb.js";
|
|
8
|
-
import { d as
|
|
8
|
+
import { d as w } from "./events-CsVF98U6.js";
|
|
9
9
|
import { k as it } from "./string-BlMQbe8b.js";
|
|
10
10
|
import "construct-style-sheets-polyfill";
|
|
11
11
|
import { loading as J } from "./loading/index.js";
|
|
12
12
|
import { RESIZE_ORDER as rt } from "./order/index.js";
|
|
13
13
|
import { windowResizer as Y } from "./window-resizer/index.js";
|
|
14
14
|
import { S as at } from "./Store-0BVty6AZ.js";
|
|
15
|
-
var
|
|
15
|
+
var C, S, z, L, d, p, q;
|
|
16
16
|
class nt {
|
|
17
17
|
constructor(a) {
|
|
18
|
-
i(this,
|
|
18
|
+
i(this, C);
|
|
19
19
|
i(this, S);
|
|
20
|
-
i(this,
|
|
20
|
+
i(this, z);
|
|
21
21
|
i(this, L);
|
|
22
22
|
i(this, d);
|
|
23
23
|
i(this, p);
|
|
24
|
-
i(this,
|
|
25
|
-
s(this,
|
|
24
|
+
i(this, q);
|
|
25
|
+
s(this, C, a);
|
|
26
26
|
let e = a.split(".");
|
|
27
|
-
const n = /\b\d{1,2}x\b/g,
|
|
28
|
-
s(this,
|
|
29
|
-
const
|
|
30
|
-
x ? (s(this, d, parseInt(x)), s(this, p, "max"), s(this, L, `(max-aspect-ratio: ${t(this, d)})`)) : Q ? (s(this, d, parseInt(Q)), s(this, p, "max"), s(this, L, `(min-aspect-ratio: ${t(this, d)})`)) : W ? (s(this, d, parseInt(W)), s(this, p, "max"), s(this, L, `(max-width: ${t(this, d)}px)`)) :
|
|
27
|
+
const n = /\b\d{1,2}x\b/g, h = e.find((y) => y.match(n) && parseInt(y));
|
|
28
|
+
s(this, z, h ? parseInt(h) : 1), h && (e = e.slice(0, -1)), s(this, S, e.length > 1 ? e.slice(0, -1).join(".") : e.join("."));
|
|
29
|
+
const u = /\d+max/g, m = /\d+min/g, U = /\d+mar/g, F = /\d+mir/g, W = e.find((y) => y.match(u)), l = e.find((y) => y.match(m)), x = e.find((y) => y.match(U)), Q = e.find((y) => y.match(F));
|
|
30
|
+
x ? (s(this, d, parseInt(x)), s(this, p, "max"), s(this, L, `(max-aspect-ratio: ${t(this, d)})`)) : Q ? (s(this, d, parseInt(Q)), s(this, p, "max"), s(this, L, `(min-aspect-ratio: ${t(this, d)})`)) : W ? (s(this, d, parseInt(W)), s(this, p, "max"), s(this, L, `(max-width: ${t(this, d)}px)`)) : l ? (s(this, d, parseInt(l)), s(this, L, `(min-width: ${t(this, d)}px)`), s(this, p, "min")) : (s(this, d, 0), s(this, L, `(min-width: ${t(this, d)}px)`), s(this, p, "min")), s(this, S, t(this, S).replace(
|
|
31
31
|
`.${t(this, d)}${t(this, p)}`,
|
|
32
32
|
""
|
|
33
|
-
)), s(this,
|
|
33
|
+
)), s(this, q, e[e.length - 1] === t(this, S) ? "" : "." + e[e.length - 1]), s(this, q, t(this, q).replace(
|
|
34
34
|
`.${t(this, d)}${t(this, p)}`,
|
|
35
35
|
""
|
|
36
36
|
));
|
|
37
37
|
}
|
|
38
38
|
get url() {
|
|
39
|
-
return t(this,
|
|
39
|
+
return t(this, C);
|
|
40
40
|
}
|
|
41
41
|
get name() {
|
|
42
42
|
return t(this, S);
|
|
43
43
|
}
|
|
44
44
|
get density() {
|
|
45
|
-
return t(this,
|
|
45
|
+
return t(this, z);
|
|
46
46
|
}
|
|
47
47
|
get query() {
|
|
48
48
|
return t(this, L);
|
|
49
49
|
}
|
|
50
50
|
get extension() {
|
|
51
|
-
return t(this,
|
|
51
|
+
return t(this, q);
|
|
52
52
|
}
|
|
53
53
|
get queryType() {
|
|
54
54
|
return t(this, p);
|
|
@@ -57,20 +57,20 @@ class nt {
|
|
|
57
57
|
return t(this, d);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
C = new WeakMap(), S = new WeakMap(), z = new WeakMap(), L = new WeakMap(), d = new WeakMap(), p = new WeakMap(), q = new WeakMap();
|
|
61
61
|
var M;
|
|
62
62
|
class tt {
|
|
63
63
|
constructor(a, e) {
|
|
64
64
|
i(this, M);
|
|
65
65
|
s(this, M, /* @__PURE__ */ new Map());
|
|
66
|
-
const n = (e == null ? void 0 : e.mediaBuckets) !== !1,
|
|
67
|
-
|
|
68
|
-
const x = new nt(
|
|
69
|
-
|
|
66
|
+
const n = (e == null ? void 0 : e.mediaBuckets) !== !1, h = typeof a == "string" ? n ? a.trim().split(",").map((l) => l.trim()).filter((l) => !!l) : [a] : a, u = [];
|
|
67
|
+
h.forEach((l) => {
|
|
68
|
+
const x = new nt(l);
|
|
69
|
+
u.push([x.query, x]);
|
|
70
70
|
});
|
|
71
|
-
const m =
|
|
72
|
-
(F ? [...F, ...m, ...
|
|
73
|
-
t(this, M).has(
|
|
71
|
+
const m = u.filter((l) => l[1].queryType.includes("max")).sort((l, x) => x[1].queryValue - l[1].queryValue), U = u.filter((l) => l[1].queryType.includes("min") && l[1].queryValue !== 0).sort((l, x) => l[1].queryValue - x[1].queryValue), F = u.filter((l) => l[0] === "(min-width: 0px)");
|
|
72
|
+
(F ? [...F, ...m, ...U] : [...m, ...U]).forEach((l) => {
|
|
73
|
+
t(this, M).has(l[0]) || t(this, M).set(l[0], []), t(this, M).get(l[0]).push(l[1]);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
get mediaBuckets() {
|
|
@@ -78,60 +78,60 @@ class tt {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
M = new WeakMap();
|
|
81
|
-
var
|
|
81
|
+
var I, $;
|
|
82
82
|
class ht extends at {
|
|
83
83
|
constructor(e) {
|
|
84
84
|
super(void 0);
|
|
85
|
-
i(this,
|
|
86
|
-
i(this,
|
|
85
|
+
i(this, I);
|
|
86
|
+
i(this, $, () => {
|
|
87
87
|
let e;
|
|
88
|
-
t(this,
|
|
89
|
-
matchMedia(m).matches && (e =
|
|
88
|
+
t(this, I).mediaBuckets.forEach((u, m) => {
|
|
89
|
+
matchMedia(m).matches && (e = u);
|
|
90
90
|
});
|
|
91
|
-
let n,
|
|
92
|
-
e == null || e.forEach((
|
|
93
|
-
|
|
91
|
+
let n, h = 0;
|
|
92
|
+
e == null || e.forEach((u) => {
|
|
93
|
+
u.density > h && u.density <= Math.max(devicePixelRatio, 1) && (h = u.density, n = u);
|
|
94
94
|
}), e != null && e.length && !n && (n = e[0]), this.current = n;
|
|
95
95
|
});
|
|
96
|
-
s(this,
|
|
96
|
+
s(this, I, new tt(e.srcset, e.sourceSetOptions));
|
|
97
97
|
}
|
|
98
98
|
updateSource(e) {
|
|
99
|
-
s(this,
|
|
99
|
+
s(this, I, new tt(e.srcset, e.sourceSetOptions)), t(this, $).call(this);
|
|
100
100
|
}
|
|
101
101
|
close() {
|
|
102
102
|
super.close(), this.disconnect();
|
|
103
103
|
}
|
|
104
104
|
connect() {
|
|
105
|
-
Y.subscribe(t(this,
|
|
105
|
+
Y.subscribe(t(this, $), rt.SOURCE_MANAGER), t(this, $).call(this);
|
|
106
106
|
}
|
|
107
107
|
disconnect() {
|
|
108
|
-
Y.unsubscribe(t(this,
|
|
108
|
+
Y.unsubscribe(t(this, $));
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
function ot(
|
|
113
|
-
if (isNaN(
|
|
114
|
-
const a = Math.floor(Math.max(0,
|
|
111
|
+
I = new WeakMap(), $ = new WeakMap();
|
|
112
|
+
function ot(c) {
|
|
113
|
+
if (isNaN(c)) return "0:00";
|
|
114
|
+
const a = Math.floor(Math.max(0, c)), e = Math.floor(a / 3600), n = Math.floor(a % 3600 / 60), u = (a % 60).toString().padStart(2, "0");
|
|
115
115
|
if (e > 0) {
|
|
116
116
|
const m = n.toString().padStart(2, "0");
|
|
117
|
-
return `${e}:${m}:${
|
|
117
|
+
return `${e}:${m}:${u}`;
|
|
118
118
|
} else
|
|
119
|
-
return `${n}:${
|
|
119
|
+
return `${n}:${u}`;
|
|
120
120
|
}
|
|
121
|
-
let
|
|
122
|
-
var f, r,
|
|
121
|
+
let ct = 0;
|
|
122
|
+
var f, r, k, E, b, g, B, A, o, O, R, v, P, T, _, G, D, K, H, N, V;
|
|
123
123
|
class Lt extends HTMLElement {
|
|
124
124
|
constructor(e) {
|
|
125
125
|
super();
|
|
126
|
-
i(this,
|
|
126
|
+
i(this, T);
|
|
127
127
|
i(this, f, null);
|
|
128
128
|
i(this, r, null);
|
|
129
|
-
i(this,
|
|
129
|
+
i(this, k, this);
|
|
130
130
|
i(this, E, !1);
|
|
131
131
|
i(this, b, !1);
|
|
132
132
|
i(this, g, !1);
|
|
133
|
-
i(this,
|
|
134
|
-
i(this,
|
|
133
|
+
i(this, B, "");
|
|
134
|
+
i(this, A, "");
|
|
135
135
|
i(this, o, new et(this, {
|
|
136
136
|
loading: !1,
|
|
137
137
|
loaded: !1,
|
|
@@ -140,46 +140,46 @@ class Lt extends HTMLElement {
|
|
|
140
140
|
playing: !1,
|
|
141
141
|
metadata: !1
|
|
142
142
|
}));
|
|
143
|
-
i(this,
|
|
144
|
-
i(this,
|
|
143
|
+
i(this, O, null);
|
|
144
|
+
i(this, R);
|
|
145
145
|
i(this, v, null);
|
|
146
|
-
i(this,
|
|
146
|
+
i(this, P);
|
|
147
147
|
i(this, G, (e) => {
|
|
148
148
|
const n = e[0];
|
|
149
|
-
t(this, g) && (!t(this, b) || this.hasAttribute("reload-source")) && n.isIntersecting && this.triggerLazyLoad(), n.isIntersecting ?
|
|
149
|
+
t(this, g) && (!t(this, b) || this.hasAttribute("reload-source")) && n.isIntersecting && this.triggerLazyLoad(), n.isIntersecting ? w(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (j(this, T, _).call(this, void 0), s(this, b, !1)), w(this, "sourceRelease", { custom: !0 }));
|
|
150
150
|
});
|
|
151
|
-
i(this,
|
|
152
|
-
t(this, o).set("loaded", !0), t(this, o).set("error", !1), t(this, o).set("loading", !1), !t(this, g) && !t(this, E) && J.complete(t(this,
|
|
151
|
+
i(this, D, () => {
|
|
152
|
+
t(this, o).set("loaded", !0), t(this, o).set("error", !1), t(this, o).set("loading", !1), !t(this, g) && !t(this, E) && J.complete(t(this, A)), w(this, "sourceLoaded", { custom: !0 });
|
|
153
153
|
const e = getComputedStyle(this).getPropertyValue("--clear-duration");
|
|
154
|
-
e ? s(this,
|
|
154
|
+
e ? s(this, R, setTimeout(() => {
|
|
155
155
|
t(this, o).set("clear", !0);
|
|
156
156
|
}, parseFloat(e) * 1e3)) : t(this, o).set("clear", !0), s(this, E, !0);
|
|
157
157
|
});
|
|
158
158
|
i(this, K, (e) => {
|
|
159
|
-
t(this, o).set("loaded", !1), t(this, o).set("error", !0), t(this, o).set("loading", !1), !t(this, g) && !t(this, E) && J.error(t(this,
|
|
159
|
+
t(this, o).set("loaded", !1), t(this, o).set("error", !0), t(this, o).set("loading", !1), !t(this, g) && !t(this, E) && J.error(t(this, A)), w(this, "sourceError", { custom: !0 }), s(this, E, !0);
|
|
160
160
|
});
|
|
161
|
-
i(this,
|
|
162
|
-
t(this, o).set("playing", !0),
|
|
161
|
+
i(this, H, () => {
|
|
162
|
+
t(this, o).set("playing", !0), w(this, "sourcePlay", { custom: !0 });
|
|
163
163
|
});
|
|
164
|
-
i(this,
|
|
165
|
-
t(this, o).set("playing", !1),
|
|
164
|
+
i(this, N, () => {
|
|
165
|
+
t(this, o).set("playing", !1), w(this, "sourcePause", { custom: !0 });
|
|
166
166
|
});
|
|
167
|
-
i(this,
|
|
167
|
+
i(this, V, () => {
|
|
168
168
|
const e = t(this, r);
|
|
169
|
-
(e.tagName === "VIDEO" || e.tagName === "AUDIO") && e.readyState >= 1 && (t(this, o).set("metadata", !0),
|
|
169
|
+
(e.tagName === "VIDEO" || e.tagName === "AUDIO") && e.readyState >= 1 && (t(this, o).set("metadata", !0), w(this, "sourceMetadataLoaded", { custom: !0 }), this.querySelectorAll("[data-source-duration]").forEach((n) => {
|
|
170
170
|
n.textContent = ot(e.duration);
|
|
171
171
|
}));
|
|
172
172
|
});
|
|
173
|
-
s(this,
|
|
173
|
+
s(this, P, e == null ? void 0 : e.sourceSetOptions), st && window.IntersectionObserver && s(this, O, new IntersectionObserver(
|
|
174
174
|
t(this, G)
|
|
175
175
|
)), t(this, o).subscribe((n) => {
|
|
176
|
-
var
|
|
177
|
-
const
|
|
176
|
+
var u;
|
|
177
|
+
const h = (u = this.getAttribute("data-global-play-class")) == null ? void 0 : u.split(
|
|
178
178
|
","
|
|
179
179
|
);
|
|
180
|
-
|
|
180
|
+
h != null && h.length && (n.current.playing ? h.forEach((m) => {
|
|
181
181
|
document.documentElement.classList.add(m.trim());
|
|
182
|
-
}) :
|
|
182
|
+
}) : h.forEach((m) => {
|
|
183
183
|
document.documentElement.classList.remove(m.trim());
|
|
184
184
|
}));
|
|
185
185
|
});
|
|
@@ -188,7 +188,7 @@ class Lt extends HTMLElement {
|
|
|
188
188
|
return t(this, r);
|
|
189
189
|
}
|
|
190
190
|
get consumerHolderElement() {
|
|
191
|
-
return t(this,
|
|
191
|
+
return t(this, k);
|
|
192
192
|
}
|
|
193
193
|
get sourceManager() {
|
|
194
194
|
return t(this, f);
|
|
@@ -206,53 +206,52 @@ class Lt extends HTMLElement {
|
|
|
206
206
|
return t(this, E);
|
|
207
207
|
}
|
|
208
208
|
triggerLazyLoad() {
|
|
209
|
-
!t(this, b) && t(this, f).current && t(this, f).current !== t(this, f).previous && (s(this, b, !0), j(this,
|
|
209
|
+
!t(this, b) && t(this, f).current && t(this, f).current !== t(this, f).previous && (s(this, b, !0), j(this, T, _).call(this, t(this, f).current));
|
|
210
210
|
}
|
|
211
211
|
connectedCallback() {
|
|
212
|
-
|
|
213
|
-
s(this, P, `source-consumer-${++lt}`);
|
|
212
|
+
s(this, B, `source-consumer-${++ct}`);
|
|
214
213
|
const e = this.getAttribute("srcset") || "", n = this.hasAttribute("notify") ? this.closest(this.getAttribute("notify")) : null;
|
|
215
|
-
n && t(this, o).addElement(n), s(this,
|
|
214
|
+
n && t(this, o).addElement(n), s(this, k, this.querySelector("[data-consumer-holder]") || this), this.querySelectorAll(".source-consumer").forEach((h) => h == null ? void 0 : h.remove()), s(this, r, this.createConsumer()), t(this, r).style.cssText = `
|
|
216
215
|
display: block;
|
|
217
216
|
width: 100%;
|
|
218
217
|
height: 100%;
|
|
219
|
-
`, t(this, r).classList.add("source-consumer"), t(this, r).addEventListener("play", t(this,
|
|
218
|
+
`, t(this, r).classList.add("source-consumer"), t(this, r).addEventListener("play", t(this, H)), t(this, r).addEventListener("pause", t(this, N)), t(this, r).addEventListener(
|
|
220
219
|
"loadedmetadata",
|
|
221
|
-
t(this,
|
|
222
|
-
), t(this,
|
|
220
|
+
t(this, V)
|
|
221
|
+
), t(this, V).call(this), Array.from(this.attributes).forEach((h) => {
|
|
223
222
|
if (h.name !== "srcset") {
|
|
224
|
-
const
|
|
225
|
-
|
|
223
|
+
const u = h.nodeValue || "", m = it(h.name);
|
|
224
|
+
m in t(this, r) && (t(this, r)[m] = u || !0);
|
|
226
225
|
}
|
|
227
|
-
}), t(this,
|
|
226
|
+
}), t(this, k).appendChild(t(this, r)), s(this, f, new ht({
|
|
228
227
|
srcset: e,
|
|
229
|
-
sourceSetOptions: t(this,
|
|
228
|
+
sourceSetOptions: t(this, P)
|
|
230
229
|
})), s(this, g, this.hasAttribute("lazy")), t(this, f).subscribe((h) => {
|
|
231
|
-
(!t(this, g) || t(this, g) && t(this, b)) && j(this,
|
|
232
|
-
}), t(this, f).connect(), t(this,
|
|
230
|
+
(!t(this, g) || t(this, g) && t(this, b)) && j(this, T, _).call(this, h.current);
|
|
231
|
+
}), t(this, f).connect(), t(this, O).observe(this);
|
|
233
232
|
}
|
|
234
233
|
disconnectedCallback() {
|
|
235
234
|
var e;
|
|
236
|
-
clearTimeout(t(this,
|
|
235
|
+
clearTimeout(t(this, R)), t(this, O).disconnect(), (e = t(this, f)) == null || e.close(), t(this, r) && (this.consumeSource(null), t(this, r).removeEventListener("play", t(this, H)), t(this, r).removeEventListener("pause", t(this, N)), t(this, r).removeEventListener(
|
|
237
236
|
"loadedmetadata",
|
|
238
|
-
t(this,
|
|
237
|
+
t(this, V)
|
|
239
238
|
), t(this, r).onloadeddata = null, t(this, r).onload = null, t(this, r).onerror = null, t(this, r).onerror = null, t(this, r).remove()), s(this, E, !1), s(this, b, !1), t(this, o).reset();
|
|
240
239
|
}
|
|
241
240
|
}
|
|
242
|
-
f = new WeakMap(), r = new WeakMap(),
|
|
243
|
-
if (clearTimeout(t(this,
|
|
244
|
-
s(this,
|
|
241
|
+
f = new WeakMap(), r = new WeakMap(), k = new WeakMap(), E = new WeakMap(), b = new WeakMap(), g = new WeakMap(), B = new WeakMap(), A = new WeakMap(), o = new WeakMap(), O = new WeakMap(), R = new WeakMap(), v = new WeakMap(), P = new WeakMap(), T = new WeakSet(), _ = function(e) {
|
|
242
|
+
if (clearTimeout(t(this, R)), t(this, r).onloadeddata = null, t(this, r).onload = null, t(this, r).onerror = null, t(this, o).set("loaded", !1), t(this, o).set("error", !1), t(this, o).set("loading", !1), t(this, o).set("clear", !1), t(this, o).set("playing", !1), t(this, o).set("metadata", !1), e) {
|
|
243
|
+
s(this, A, `${t(this, B)}-${e.url}`);
|
|
245
244
|
const n = this.hasAttribute("keep-source-parameters");
|
|
246
|
-
t(this, o).set("loading", !0), s(this, v, n ? e.url : e.name + e.extension), this.consumeSource(t(this, v)), !t(this, g) && !t(this, E) && J.add(t(this,
|
|
247
|
-
t(this,
|
|
245
|
+
t(this, o).set("loading", !0), s(this, v, n ? e.url : e.name + e.extension), this.consumeSource(t(this, v)), !t(this, g) && !t(this, E) && J.add(t(this, A)), t(this, r).onloadeddata = () => {
|
|
246
|
+
t(this, D).call(this);
|
|
248
247
|
}, t(this, r).onload = () => {
|
|
249
|
-
t(this,
|
|
248
|
+
t(this, D).call(this);
|
|
250
249
|
}, t(this, r).onerror = () => {
|
|
251
250
|
t(this, K).call(this, t(this, v));
|
|
252
251
|
};
|
|
253
252
|
} else
|
|
254
253
|
s(this, v, null), this.consumeSource(null);
|
|
255
|
-
}, G = new WeakMap(),
|
|
254
|
+
}, G = new WeakMap(), D = new WeakMap(), K = new WeakMap(), H = new WeakMap(), N = new WeakMap(), V = new WeakMap();
|
|
256
255
|
export {
|
|
257
256
|
nt as S,
|
|
258
257
|
Lt as a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.defineProperty,P=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var p=s=>{throw TypeError(s)};var y=(s,r,t)=>r in s?m(s,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[r]=t,S=(s,r)=>{for(var t in r||(r={}))q.call(r,t)&&y(s,t,r[t]);if(E)for(var t of E(r))b.call(r,t)&&y(s,t,r[t]);return s},L=(s,r)=>P(s,g(r));var a=(s,r,t)=>r.has(s)||p("Cannot "+t);var n=(s,r,t)=>(a(s,r,"read from private field"),t?t.call(s):r.get(s)),f=(s,r,t)=>r.has(s)?p("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(s):r.set(s,t),l=(s,r,t,i)=>(a(s,r,"write to private field"),i?i.call(s,t):r.set(s,t),t),u=(s,r,t)=>(a(s,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../Store-Cd1GlEmZ.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");var h,c,d;class A extends k.Store{constructor(t,i){super(i);f(this,c);f(this,h);l(this,h,Array.isArray(t)?t:[t]);for(const e in this.initial)this.set(e,this.initial[e])}addElement(t){n(this,h).push(t);for(const i in this.current)u(this,c,d).call(this,[t],i,this.current[i])}removeElement(t){const i=n(this,h).find(e=>e===t);if(i){l(this,h,n(this,h).filter(e=>e!==t));for(const e in this.current)u(this,c,d).call(this,[i],e,!1)}}isTrue(t){return this.current[t]===!0}isFalse(t){return this.current[t]===!1}reset(){super.reset();for(const t in this.initial)this.set(t,this.initial[t])}set(t,i){const e=t;this.current=L(S({},this.current),{[t]:i}),e.startsWith("--")?i?n(this,h).forEach(o=>o.style.setProperty(e,i.toString())):n(this,h).forEach(o=>o.style.removeProperty(e)):i?n(this,h).forEach(o=>o.classList.add(e)):n(this,h).forEach(o=>o.classList.remove(e))}}h=new WeakMap,c=new WeakSet,d=function(t,i,e){i.startsWith("--")?e?t.forEach(o=>o.style.setProperty(i,e.toString())):t.forEach(o=>o.style.removeProperty(i)):e?t.forEach(o=>o.classList.add(i)):t.forEach(o=>o.classList.remove(i))};exports.ElementLinkedStore=A;
|
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var S = Object.defineProperty, P = Object.defineProperties;
|
|
2
|
+
var g = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var u = Object.getOwnPropertySymbols;
|
|
4
|
+
var x = Object.prototype.hasOwnProperty, A = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var y = (s) => {
|
|
6
6
|
throw TypeError(s);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var E = (s, r, t) => r in s ? S(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, m = (s, r) => {
|
|
9
9
|
for (var t in r || (r = {}))
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var t of
|
|
13
|
-
|
|
10
|
+
x.call(r, t) && E(s, t, r[t]);
|
|
11
|
+
if (u)
|
|
12
|
+
for (var t of u(r))
|
|
13
|
+
A.call(r, t) && E(s, t, r[t]);
|
|
14
14
|
return s;
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
import { S as
|
|
19
|
-
import { c as E } from "../string-BlMQbe8b.js";
|
|
15
|
+
}, L = (s, r) => P(s, g(r));
|
|
16
|
+
var f = (s, r, t) => r.has(s) || y("Cannot " + t);
|
|
17
|
+
var c = (s, r, t) => (f(s, r, "read from private field"), t ? t.call(s) : r.get(s)), a = (s, r, t) => r.has(s) ? y("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(s) : r.set(s, t), l = (s, r, t, i) => (f(s, r, "write to private field"), i ? i.call(s, t) : r.set(s, t), t), d = (s, r, t) => (f(s, r, "access private method"), t);
|
|
18
|
+
import { S as W } from "../Store-0BVty6AZ.js";
|
|
20
19
|
import "construct-style-sheets-polyfill";
|
|
21
20
|
import "../index-Bv9zgfdb.js";
|
|
22
|
-
var
|
|
23
|
-
class
|
|
21
|
+
var h, n, p;
|
|
22
|
+
class j extends W {
|
|
24
23
|
constructor(t, i) {
|
|
25
24
|
super(i);
|
|
26
|
-
|
|
27
|
-
a(this,
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
a(this, n);
|
|
26
|
+
a(this, h);
|
|
27
|
+
l(this, h, Array.isArray(t) ? t : [t]);
|
|
28
|
+
for (const e in this.initial)
|
|
29
|
+
this.set(e, this.initial[e]);
|
|
30
30
|
}
|
|
31
31
|
addElement(t) {
|
|
32
|
-
|
|
32
|
+
c(this, h).push(t);
|
|
33
|
+
for (const i in this.current)
|
|
34
|
+
d(this, n, p).call(this, [t], i, this.current[i]);
|
|
33
35
|
}
|
|
34
36
|
removeElement(t) {
|
|
35
|
-
|
|
37
|
+
const i = c(this, h).find((e) => e === t);
|
|
38
|
+
if (i) {
|
|
39
|
+
l(this, h, c(this, h).filter((e) => e !== t));
|
|
40
|
+
for (const e in this.current)
|
|
41
|
+
d(this, n, p).call(this, [i], e, !1);
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
isTrue(t) {
|
|
38
45
|
return this.current[t] === !0;
|
|
@@ -46,13 +53,15 @@ class K extends x {
|
|
|
46
53
|
this.set(t, this.initial[t]);
|
|
47
54
|
}
|
|
48
55
|
set(t, i) {
|
|
49
|
-
const
|
|
50
|
-
this.current =
|
|
51
|
-
(
|
|
52
|
-
) :
|
|
56
|
+
const e = t;
|
|
57
|
+
this.current = L(m({}, this.current), { [t]: i }), e.startsWith("--") ? i ? c(this, h).forEach(
|
|
58
|
+
(o) => o.style.setProperty(e, i.toString())
|
|
59
|
+
) : c(this, h).forEach((o) => o.style.removeProperty(e)) : i ? c(this, h).forEach((o) => o.classList.add(e)) : c(this, h).forEach((o) => o.classList.remove(e));
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
|
-
|
|
62
|
+
h = new WeakMap(), n = new WeakSet(), p = function(t, i, e) {
|
|
63
|
+
i.startsWith("--") ? e ? t.forEach((o) => o.style.setProperty(i, e.toString())) : t.forEach((o) => o.style.removeProperty(i)) : e ? t.forEach((o) => o.classList.add(i)) : t.forEach((o) => o.classList.remove(i));
|
|
64
|
+
};
|
|
56
65
|
export {
|
|
57
|
-
|
|
66
|
+
j as ElementLinkedStore
|
|
58
67
|
};
|
|
@@ -2,7 +2,6 @@ import { WebGLRenderer, WebGLRendererParameters } from 'three';
|
|
|
2
2
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
3
3
|
import { ElementOrSelector } from '../utils';
|
|
4
4
|
import { En3View, En3ViewOptions } from './En3View';
|
|
5
|
-
import { En3Raycaster } from './En3Raycaster';
|
|
6
5
|
export interface En3Options {
|
|
7
6
|
webGLRendererParameters?: WebGLRendererParameters;
|
|
8
7
|
maxPixelRatio?: number;
|
|
@@ -12,12 +11,11 @@ export interface En3Options {
|
|
|
12
11
|
position?: 'fixed' | 'absolute' | 'relative';
|
|
13
12
|
composer?: typeof EffectComposer;
|
|
14
13
|
}
|
|
15
|
-
declare class En3 {
|
|
14
|
+
export declare class En3 {
|
|
16
15
|
#private;
|
|
17
16
|
get CDNVersion(): string;
|
|
18
17
|
get containerElement(): HTMLElement;
|
|
19
18
|
get webglRenderer(): WebGLRenderer;
|
|
20
|
-
get raycaster(): En3Raycaster;
|
|
21
19
|
get views(): Map<string, En3View>;
|
|
22
20
|
get view(): En3View;
|
|
23
21
|
get camera(): import('three').PerspectiveCamera | import('three').OrthographicCamera;
|
|
@@ -33,5 +31,3 @@ declare class En3 {
|
|
|
33
31
|
destroyView(viewName: string): void;
|
|
34
32
|
render(view: En3View): void;
|
|
35
33
|
}
|
|
36
|
-
export declare const en3: En3;
|
|
37
|
-
export {};
|
package/lib/en3/En3View.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LayoutBox, LayoutBoxOptions } from '../layout-box';
|
|
2
2
|
import { ElementOrSelector } from '../utils';
|
|
3
3
|
import { Object3D, OrthographicCamera, PerspectiveCamera, Scene } from 'three';
|
|
4
|
+
import { En3 } from './En3';
|
|
4
5
|
export interface En3ViewOptions {
|
|
5
6
|
cameraType?: 'perspective' | 'orthographic';
|
|
6
7
|
cameraDistance?: number;
|
|
@@ -20,7 +21,7 @@ export type En3ViewBeforeRenderCallback = () => void;
|
|
|
20
21
|
export declare class En3View {
|
|
21
22
|
#private;
|
|
22
23
|
beforeRenderCallback: En3ViewBeforeRenderCallback | undefined;
|
|
23
|
-
constructor(name: string, options?: En3ViewOptions);
|
|
24
|
+
constructor(en3: En3, name: string, options?: En3ViewOptions);
|
|
24
25
|
get name(): string;
|
|
25
26
|
get camera(): PerspectiveCamera | OrthographicCamera;
|
|
26
27
|
get scene(): Scene;
|
package/lib/en3/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var j=Object.defineProperty,p=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var $=i=>{throw TypeError(i)};var N=(i,e,r)=>e in i?j(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))te.call(e,r)&&N(i,r,e[r]);if(H)for(var r of H(e))re.call(e,r)&&N(i,r,e[r]);return i},B=(i,e)=>p(i,ee(e));var W=(i,e,r)=>e.has(i)||$("Cannot "+r);var t=(i,e,r)=>(W(i,e,"read from private field"),r?r.call(i):e.get(i)),n=(i,e,r)=>e.has(i)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),h=(i,e,r,s)=>(W(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),G=require("../order/index.cjs"),K=require("../window-resizer/index.cjs"),U=require("../ticker/index.cjs"),J=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const Z=require("../layout-box/index.cjs");function Q(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const a=r[s];a&&typeof a=="object"&&"minFilter"in a&&a.dispose()}};i.traverse(r=>{if(r instanceof d.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var T,S,c,b,g,o,v,x,w;class F{constructor(e,r,s){n(this,T);n(this,S);n(this,c);n(this,b);n(this,g);n(this,o);n(this,v);n(this,x);n(this,w);h(this,T,e),h(this,S,r),h(this,c,(s==null?void 0:s.cameraType)==="orthographic"?new d.OrthographicCamera:new d.PerspectiveCamera),h(this,b,new d.Scene),h(this,g,[]),h(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,c).near=(s==null?void 0:s.cameraNear)||1,t(this,c).far=(s==null?void 0:s.cameraFar)||11e3,h(this,v,(s==null?void 0:s.cameraFov)||"auto"),t(this,c).position.z=t(this,o),t(this,c).name=`Cameras.${t(this,S)}`,h(this,x,J.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,h(this,w,new Z.LayoutBox(t(this,x))),t(this,w).onResize(()=>{this.resize()})}get name(){return t(this,S)}get camera(){return t(this,c)}get scene(){return t(this,b)}get box(){return t(this,w)}get cameraDistance(){return t(this,o)}set cameraDistance(e){h(this,o,e),this.resize()}get sizeElement(){return t(this,x)}get isClipped(){return t(this,x)!==t(this,T).containerElement}resize(){const{width:e,height:r}=t(this,w);t(this,c).userData.controlled||(t(this,c).position.z=t(this,o)),t(this,c)instanceof d.PerspectiveCamera?(t(this,c).aspect=e/r,t(this,c).fov=t(this,v)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,c).userData.controlled?t(this,c).fov:t(this,v)):t(this,c)instanceof d.OrthographicCamera&&(t(this,c).left=e/-2,t(this,c).right=e/2,t(this,c).top=r/2,t(this,c).bottom=r/-2),t(this,c).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,b).clear(),Q(t(this,b)),t(this,T).destroyView(this.name),t(this,w).destroy()}attachToHTMLElement(e,r,s){const a=new Z.LayoutBox(e,B(I({},s),{containerElement:t(this,x),cartesian:!0,scrollStep:!this.isClipped}));return a.bindObject(r),r.userData.box=a,t(this,g).push(r),r}detachFromHTMLElement(e){h(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],a=e[2];return s&&this.attachToHTMLElement(s,r,a),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}T=new WeakMap,S=new WeakMap,c=new WeakMap,b=new WeakMap,g=new WeakMap,o=new WeakMap,v=new WeakMap,x=new WeakMap,w=new WeakMap;var k,u,l,m,R,z,V,D,C,f,P,A;class se{constructor(){n(this,k,`https://unpkg.com/three@0.${d.REVISION}.x`);n(this,u,null);n(this,l,null);n(this,m,new Map);n(this,R,0);n(this,z,0);n(this,V,0);n(this,D,2);n(this,C,!1);n(this,f,null);n(this,P,e=>{e instanceof CustomEvent||(h(this,R,t(this,u).clientWidth),h(this,z,t(this,u).clientHeight),h(this,V,Math.min(t(this,D),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,V)),t(this,l).setSize(t(this,R),t(this,z)),t(this,f)&&(t(this,f).setPixelRatio(t(this,V)),t(this,f).setSize(t(this,R),t(this,z))))});n(this,A,()=>{t(this,l).setRenderTarget(null),t(this,m).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,k)}get containerElement(){return t(this,u)}get webglRenderer(){return t(this,l)}get views(){return t(this,m)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return t(this,R)}get height(){return t(this,z)}get pixelRatio(){return t(this,V)}get composer(){return t(this,f)}setup(e){if(t(this,C))return;h(this,u,J.getElement(e==null?void 0:e.containerElement)||document.body),h(this,D,(e==null?void 0:e.maxPixelRatio)||2),h(this,l,new d.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,l).domElement.style.cssText=`
|
|
2
2
|
position: ${(e==null?void 0:e.position)||"fixed"};
|
|
3
3
|
left: 0;
|
|
4
4
|
top: 0;
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: 100%;
|
|
7
7
|
z-index: ${(e==null?void 0:e.zIndex)||0};
|
|
8
|
-
`,(t(this,
|
|
8
|
+
`,(t(this,u).shadowRoot||t(this,u)).append(t(this,l).domElement),t(this,m).set("default",new F(this,"default",I({sizeElement:t(this,u)},e==null?void 0:e.view))),e!=null&&e.composer&&(h(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),h(this,C,!0),K.windowResizer.subscribe(t(this,P),G.RESIZE_ORDER.CANVAS),U.ticker.subscribe(t(this,A),{order:G.TICK_ORDER.CANVAS,culling:t(this,u)})}destroy(){var e;t(this,C)&&(K.windowResizer.unsubscribe(t(this,P)),U.ticker.unsubscribe(t(this,A)),t(this,m).forEach(r=>{r.destroy()}),t(this,m).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),h(this,l,null),(e=t(this,f))==null||e.dispose(),h(this,f,null),h(this,C,!1))}createView(e,r){const s=t(this,m).size,a=new F(this,e,r);return t(this,m).set(e,a),s===1&&t(this,l).setScissorTest(!0),a}getView(e){return t(this,m).get(e)}destroyView(e){const r=t(this,m).get(e);r&&(t(this,m).delete(e),r.destroy(),t(this,m).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,m).size>1||this.view.isClipped){const s=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,a=this.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(s,a,e.box.width,e.box.height),t(this,l).setViewport(s,a,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}k=new WeakMap,u=new WeakMap,l=new WeakMap,m=new WeakMap,R=new WeakMap,z=new WeakMap,V=new WeakMap,D=new WeakMap,C=new WeakMap,f=new WeakMap,P=new WeakMap,A=new WeakMap;function ie(i,e,r){const s=e.x,a=e.y,y=r||i.image.width/i.image.height;let M=0,E=0,q=i.offset.x,L=i.offset.y,O=i.rotation,X=i.center.x,Y=i.center.y;s/a>y?(M=1,E=a/s*y):(E=1,M=s/a/y),i.matrix.setUvTransform(q,L,M,E,O,X,Y)}const _=new d.Vector3,ae=new d.Vector3;function he(i,e,r="default"){const s=i.getView(r),{width:a,height:y}=i,M=a/y;e instanceof d.Vector3?_.copy(e):_.set(...e);const E=s.camera.getWorldPosition(ae).distanceTo(_);if(s.camera instanceof d.OrthographicCamera)return{width:a/s.camera.zoom,height:y/s.camera.zoom,factor:1,distance:E,aspect:M};{const q=s.camera.fov*Math.PI/180,L=2*Math.tan(q/2)*E,O=L*(a/y);return{width:O,height:L,factor:a/O,distance:E,aspect:M}}}function ne(i,e){i.traverse(r=>{r instanceof d.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ce(i,e){i.traverse(r=>{r instanceof d.Mesh&&e(r)})}exports.En3=se;exports.En3View=F;exports.coverTexture=ie;exports.dispose=Q;exports.getCurrentViewport=he;exports.traverseMaterials=ne;exports.traverseMeshes=ce;
|
package/lib/en3/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { En3, type En3Options } from './En3';
|
|
2
2
|
export { En3View, type En3ViewOptions, type En3AttachedObject3D, type En3AttachOptions, type En3ViewBeforeRenderCallback, } from './En3View';
|
|
3
3
|
export { coverTexture } from './utils/coverTexture';
|
|
4
4
|
export { dispose } from './utils/dispose';
|