aptechka 0.3.1 → 0.4.0
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/{Damped-BvkThM-2.cjs → Damped-B0eRyTcV.cjs} +1 -1
- package/lib/{Damped-DEHDBwBz.js → Damped-Do9H-LKf.js} +1 -1
- package/lib/{Derived-Bc88XJ8J.js → Derived-Dbjm-dob.js} +1 -1
- package/lib/{Derived-SjPdLJiZ.cjs → Derived-vGokdC4b.cjs} +1 -1
- package/lib/{SourceManager-CI6NfLzW.cjs → SourceManager-CzcqsC3z.cjs} +1 -1
- package/lib/{SourceManager-BoP9RAJr.js → SourceManager-noBYGNeX.js} +1 -1
- package/lib/{Store-JOKrNVEr.js → Store-DdDuj5hz.js} +42 -41
- package/lib/Store-Dis8QUAR.cjs +1 -0
- package/lib/{Viewport-COsaberc.cjs → Viewport-CRLSlcoi.cjs} +1 -1
- package/lib/{Viewport-CXY5xcGJ.js → Viewport-VSV_isot.js} +1 -1
- package/lib/{WheelControls-BJdZsEkS.js → WheelControls-BqO_fTyY.js} +1 -1
- package/lib/{WheelControls-CctFwJwY.cjs → WheelControls-fiz52vcl.cjs} +1 -1
- package/lib/abstract-elements/index.cjs +1 -1
- package/lib/abstract-elements/index.js +2 -2
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +2 -2
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +2 -2
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +3 -3
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +2 -2
- package/lib/{createStylesheet-De-6zF24.cjs → createStylesheet-B4vLzvah.cjs} +1 -1
- package/lib/{createStylesheet-CYZlwj0H.js → createStylesheet-CR-XQRVT.js} +1 -1
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/dom-0S_WDL4g.js +42 -0
- package/lib/dom-JBOkFLTh.cjs +1 -0
- package/lib/element-constructor/ElementConstructor.d.ts +2 -0
- package/lib/element-constructor/index.cjs +1 -1
- package/lib/element-constructor/index.js +113 -114
- package/lib/element-resizer/index.cjs +1 -1
- package/lib/element-resizer/index.js +1 -1
- package/lib/en3/core/en3.d.ts +2 -1
- package/lib/en3/index.cjs +1 -1
- package/lib/en3/index.js +6 -6
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{index-8MIh-Dcx.js → index-D-FPaxdJ.js} +3 -3
- package/lib/{index-CHamNqUl.cjs → index-MKoD8NCT.cjs} +1 -1
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.js +1 -1
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.js +1 -1
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.js +1 -1
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +1 -1
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.js +3 -3
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/resized/index.cjs +1 -1
- package/lib/resized/index.js +1 -1
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +93 -98
- package/lib/scroll/ScrollElement.d.ts +0 -22
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +103 -127
- package/lib/scroll-entries/index.cjs +1 -1
- package/lib/scroll-entries/index.js +16 -17
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +2 -2
- package/lib/store/Store.d.ts +1 -0
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +119 -48
- package/lib/studio/index.cjs +1 -1
- package/lib/studio/index.js +17 -17
- package/lib/tags-D3-tO-m6.cjs +1 -0
- package/lib/tags-D9nd9mMM.js +846 -0
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.js +2 -2
- package/lib/utils/dom.d.ts +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +68 -67
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/package.json +1 -65
- package/lib/ComponentElement-CIl1lnep.cjs +0 -1
- package/lib/ComponentElement-CzGRgBvs.js +0 -76
- package/lib/Composed-ClTo1f0b.js +0 -79
- package/lib/Composed-Mdr4ZFbI.cjs +0 -1
- package/lib/ElementConstructor-C_HDpVEZ.cjs +0 -1
- package/lib/ElementConstructor-ChgHpqb6.js +0 -326
- package/lib/Store-D0_rDIsE.cjs +0 -1
- package/lib/animation/hooks/index.cjs +0 -1
- package/lib/animation/hooks/index.d.ts +0 -9
- package/lib/animation/hooks/index.js +0 -32
- package/lib/attribute/hooks/index.d.ts +0 -3
- package/lib/controls/hooks/index.d.ts +0 -1
- package/lib/createStore-BSUQyZjo.js +0 -15
- package/lib/createStore-D61G4jpF.cjs +0 -1
- package/lib/dom-BY7JhTx5.js +0 -24
- package/lib/dom-qY2LdCVL.cjs +0 -1
- package/lib/element-resizer/hooks/index.cjs +0 -1
- package/lib/element-resizer/hooks/index.d.ts +0 -5
- package/lib/element-resizer/hooks/index.js +0 -12
- package/lib/instantiate-CXUQ7AmI.js +0 -72
- package/lib/instantiate-D63dC3Vr.cjs +0 -1
- package/lib/intersector/hooks/index.cjs +0 -1
- package/lib/intersector/hooks/index.d.ts +0 -5
- package/lib/intersector/hooks/index.js +0 -12
- package/lib/jsx/ComponentElement.d.ts +0 -26
- package/lib/jsx/h.d.ts +0 -4
- package/lib/jsx/hooks/attachInternals.d.ts +0 -1
- package/lib/jsx/hooks/attachShadow.d.ts +0 -1
- package/lib/jsx/hooks/attachStylesheet.d.ts +0 -3
- package/lib/jsx/hooks/createContext.d.ts +0 -2
- package/lib/jsx/hooks/createStore.d.ts +0 -4
- package/lib/jsx/hooks/index.cjs +0 -1
- package/lib/jsx/hooks/index.d.ts +0 -8
- package/lib/jsx/hooks/index.js +0 -73
- package/lib/jsx/hooks/onConnect.d.ts +0 -3
- package/lib/jsx/hooks/onDisconnect.d.ts +0 -3
- package/lib/jsx/hooks/withCurrentComponent.d.ts +0 -3
- package/lib/jsx/index.cjs +0 -1
- package/lib/jsx/index.d.ts +0 -5
- package/lib/jsx/index.js +0 -27
- package/lib/jsx/instantiate.d.ts +0 -1
- package/lib/jsx/register.d.ts +0 -1
- package/lib/jsx/render.d.ts +0 -1
- package/lib/jsx/type.d.ts +0 -186
- package/lib/onConnect-CNMynOhK.js +0 -9
- package/lib/onConnect-DyAwFqQQ.cjs +0 -1
- package/lib/store/hooks/index.cjs +0 -1
- package/lib/store/hooks/index.d.ts +0 -7
- package/lib/store/hooks/index.js +0 -26
- package/lib/tags-DSmoyoPZ.js +0 -485
- package/lib/tags-Di21YbUL.cjs +0 -1
- package/lib/ticker/hooks/index.cjs +0 -1
- package/lib/ticker/hooks/index.d.ts +0 -6
- package/lib/ticker/hooks/index.js +0 -23
- package/lib/window-resizer/hooks/index.cjs +0 -1
- package/lib/window-resizer/hooks/index.d.ts +0 -3
- package/lib/window-resizer/hooks/index.js +0 -9
- package/lib/withCurrentComponent-BDsFmjJ9.cjs +0 -1
- package/lib/withCurrentComponent-DIBND_yO.js +0 -7
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var X=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var z=(n,t,s)=>{if(!t.has(n))throw TypeError("Cannot "+s)};var e=(n,t,s)=>(z(n,t,"read from private field"),s?s.call(n):t.get(n)),
|
|
1
|
+
"use strict";var X=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var z=(n,t,s)=>{if(!t.has(n))throw TypeError("Cannot "+s)};var e=(n,t,s)=>(z(n,t,"read from private field"),s?s.call(n):t.get(n)),r=(n,t,s)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,s)},o=(n,t,s,i)=>(z(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s);var F=(n,t,s)=>(z(n,t,"access private method"),s);var B=(n,t,s)=>new Promise((i,u)=>{var h=f=>{try{d(s.next(f))}catch(T){u(T)}},a=f=>{try{d(s.throw(f))}catch(T){u(T)}},d=f=>f.done?i(f.value):Promise.resolve(f.value).then(h,a);d((s=s.apply(n,t)).next())});var G=(n,t,s)=>(t=n[X("asyncIterator")])?t.call(n):(n=n[X("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=h=>new Promise((a,d,f)=>(h=u.call(n,h),f=h.done,Promise.resolve(h.value).then(T=>a({value:T,done:f}),d)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const tt=require("urlpattern-polyfill"),et=require("../notifier/index.cjs"),Z=require("../browser-CpzFX2xg.cjs"),st=require("../function-MthRj-GJ.cjs"),it=require("../object-BZELAoVj.cjs");var b,O,R,m,l,v,S,p,P,y,I,_;class nt{constructor(t,s){r(this,I);r(this,b,void 0);r(this,O,void 0);r(this,R,void 0);r(this,m,void 0);r(this,l,void 0);r(this,v,void 0);r(this,S,void 0);r(this,p,null);r(this,P,[]);r(this,y,[]);o(this,b,t),o(this,O,s),o(this,R,new URLPattern({pathname:e(this,b)})),o(this,m,null),o(this,l,null),o(this,v,!1),o(this,S,null),Z.isBrowser&&o(this,p,new MutationObserver(i=>{i[0].addedNodes.forEach(h=>{e(this,m)?e(this,y).push(h):e(this,P).push(h)})}))}get pattern(){return e(this,b)}get urlPattern(){return e(this,R)}get isActive(){return e(this,v)}get element(){return e(this,l)}get nest(){return e(this,S)}testPathname(t){return this.urlPattern.test({pathname:t})}render(t,s){return B(this,null,function*(){var i,u;if(e(this,p).observe(document.head,{childList:!0,subtree:!0}),e(this,m))e(this,P).forEach(h=>{document.head.appendChild(h)});else{const h=yield e(this,O).call(this);if(o(this,y,[...e(this,P)]),typeof h.default=="function"&&(o(this,m,h.default),it.isESClass(h.default))){const a="e-"+((i=e(this,m))==null?void 0:i.name.toLowerCase());customElements.get(a)||customElements.define(a,h.default)}}if(yield F(this,I,_).call(this),e(this,m)){const h=e(this,R).exec({pathname:s}),a=(h==null?void 0:h.pathname.groups)||{},d=Object.fromEntries(new URLSearchParams(location.search)),f={pathnameParams:a,searchParams:d};o(this,l,new(e(this,m))(f)),t.appendChild(e(this,l)),o(this,S,e(this,l).querySelector("[data-nest]")||((u=e(this,l).shadowRoot)==null?void 0:u.querySelector("[data-nest]"))||e(this,l).shadowRoot||e(this,l)),o(this,v,!0)}e(this,p).disconnect()})}close(){var t;e(this,p).disconnect(),(t=e(this,l))==null||t.remove(),o(this,v,!1),e(this,y).forEach(s=>document.head.removeChild(s)),o(this,y,[])}getAnchorElements(){var s;let t=[];return e(this,l)&&(t=[...e(this,l).querySelectorAll("a")]),(s=e(this,l))!=null&&s.shadowRoot&&(t=[...t,...e(this,l).shadowRoot.querySelectorAll("a")]),t}}b=new WeakMap,O=new WeakMap,R=new WeakMap,m=new WeakMap,l=new WeakMap,v=new WeakMap,S=new WeakMap,p=new WeakMap,P=new WeakMap,y=new WeakMap,I=new WeakSet,_=function(){return B(this,null,function*(){const t=e(this,P).filter(a=>a instanceof HTMLElement?a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK":!1);try{for(var s=G(t),i,u,h;i=!(u=yield s.next()).done;i=!1){const a=u.value;yield new Promise(d=>{a.onload=()=>{d()}})}}catch(u){h=[u]}finally{try{i&&(u=s.return)&&(yield u.call(s))}finally{if(h)throw h[0]}}})};var H,g,A,U,j;class rt{constructor(t,s){r(this,H,void 0);r(this,g,void 0);r(this,A,void 0);r(this,U,void 0);r(this,j,t=>{t.preventDefault(),e(this,H).navigate(e(this,A),e(this,U))});o(this,H,t),o(this,g,s),o(this,A,e(this,g).getAttribute("href")||"/"),o(this,U,e(this,g).getAttribute("data-history-action")||"push"),e(this,g).addEventListener("click",e(this,j)),location.pathname===e(this,A)&&e(this,g).classList.add("current")}destroy(){e(this,g).removeEventListener("click",e(this,j)),e(this,g).classList.remove("current")}}H=new WeakMap,g=new WeakMap,A=new WeakMap,U=new WeakMap,j=new WeakMap;globalThis.URLPattern=tt.URLPattern;var k,q,w,N,M,E,C,x,D,K,$,W;const Y=class Y{constructor(t){r(this,K);r(this,k,null);r(this,q,void 0);r(this,w,[]);r(this,N,null);r(this,M,[]);r(this,E,void 0);r(this,C,null);r(this,x,new et.Notifier);r(this,D,st.debounce(()=>{const t=s=>s.split("/").length;o(this,w,e(this,w).sort((s,i)=>t(s.pattern)-t(i.pattern))),this.navigate(location.pathname.replace(e(this,q),""))},0));r(this,W,t=>{t.state&&this.navigate(t.state,"none")});o(this,q,(t==null?void 0:t.base)||""),Y.active=this,Z.isBrowser&&(o(this,k,(t==null?void 0:t.rootElement)||document.body),addEventListener("popstate",e(this,W)))}get currentPathname(){return e(this,C)}get candidatePathname(){return e(this,E)}get routes(){return e(this,w)}navigationEvent(t){return e(this,x).subscribe(t)}defineRoute(t,s){const i=new nt(t,s);e(this,w).push(i),e(this,D).call(this)}navigate(t,s="push"){return B(this,null,function*(){var f,Q;if(e(this,E)===t||e(this,C)===t)return;Y.active=this,o(this,E,t);const i=e(this,w).filter(c=>c.isActive),u=e(this,w).filter(c=>!i.includes(c)&&c.testPathname(t)),h=i.filter(c=>!c.testPathname(t)),a=i.filter(c=>c.testPathname(t));let d=!0;if(this.preprocessor)try{yield new Promise((c,L)=>{var V;(V=this.preprocessor)==null||V.call(this,{pathname:t,resolve:c,reject:L})})}catch(c){c?console.error(c):console.log("Route change canceled"),d=!1}if(d&&e(this,E)===t){o(this,N,a[a.length-1]),h.forEach(L=>{L.close()}),o(this,C,t);try{for(var T=G(u),at,ct,lt;at=!(ct=yield T.next()).done;at=!1){const L=ct.value;yield L.render(((f=e(this,N))==null?void 0:f.nest)||e(this,k),t),o(this,N,L)}}catch(ct){lt=[ct]}finally{try{at&&(ct=T.return)&&(yield ct.call(T))}finally{if(lt)throw lt[0]}}const c=e(this,q)+t+location.search;s==="push"?history.pushState(c,"",c):s==="replace"&&history.replaceState(c,"",c),F(this,K,$).call(this),(Q=this.postprocessor)==null||Q.call(this,{pathname:t}),e(this,x).notify({pathname:t})}})}};k=new WeakMap,q=new WeakMap,w=new WeakMap,N=new WeakMap,M=new WeakMap,E=new WeakMap,C=new WeakMap,x=new WeakMap,D=new WeakMap,K=new WeakSet,$=function(){const t=e(this,w).filter(i=>i.isActive),s=Array.from(new Set([...e(this,k).querySelectorAll("a"),...t.map(i=>i.getAnchorElements()).flat()].filter(i=>{var u;return(u=i.getAttribute("href"))==null?void 0:u.startsWith("/")})));e(this,M).forEach(i=>{i.destroy()}),o(this,M,s.map(i=>new rt(this,i)))},W=new WeakMap;let J=Y;exports.Router=J;
|
package/lib/router/index.js
CHANGED
|
@@ -3,51 +3,49 @@ var $ = (n, t, s) => {
|
|
|
3
3
|
if (!t.has(n))
|
|
4
4
|
throw TypeError("Cannot " + s);
|
|
5
5
|
};
|
|
6
|
-
var e = (n, t, s) => ($(n, t, "read from private field"), s ? s.call(n) : t.get(n)),
|
|
6
|
+
var e = (n, t, s) => ($(n, t, "read from private field"), s ? s.call(n) : t.get(n)), r = (n, t, s) => {
|
|
7
7
|
if (t.has(n))
|
|
8
8
|
throw TypeError("Cannot add the same private member more than once");
|
|
9
9
|
t instanceof WeakSet ? t.add(n) : t.set(n, s);
|
|
10
|
-
},
|
|
10
|
+
}, o = (n, t, s, i) => ($(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s);
|
|
11
11
|
var z = (n, t, s) => ($(n, t, "access private method"), s);
|
|
12
|
-
var j = (n, t, s) => new Promise((i,
|
|
13
|
-
var h = (
|
|
12
|
+
var j = (n, t, s) => new Promise((i, u) => {
|
|
13
|
+
var h = (f) => {
|
|
14
14
|
try {
|
|
15
|
-
d(s.next(
|
|
15
|
+
d(s.next(f));
|
|
16
16
|
} catch (T) {
|
|
17
|
-
|
|
17
|
+
u(T);
|
|
18
18
|
}
|
|
19
|
-
}, a = (
|
|
19
|
+
}, a = (f) => {
|
|
20
20
|
try {
|
|
21
|
-
d(s.throw(
|
|
21
|
+
d(s.throw(f));
|
|
22
22
|
} catch (T) {
|
|
23
|
-
|
|
23
|
+
u(T);
|
|
24
24
|
}
|
|
25
|
-
}, d = (
|
|
25
|
+
}, d = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(h, a);
|
|
26
26
|
d((s = s.apply(n, t)).next());
|
|
27
27
|
});
|
|
28
|
-
var F = (n, t, s) => (t = n[Q("asyncIterator")]) ? t.call(n) : (n = n[Q("iterator")](), t = {}, s = (i,
|
|
29
|
-
import { URLPattern as
|
|
30
|
-
import { Notifier as
|
|
31
|
-
import { i as
|
|
32
|
-
import { d as
|
|
33
|
-
import "../
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var R, U, b, m, l, w, A, v, P, E, B, _;
|
|
37
|
-
class rt {
|
|
28
|
+
var F = (n, t, s) => (t = n[Q("asyncIterator")]) ? t.call(n) : (n = n[Q("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (h) => new Promise((a, d, f) => (h = u.call(n, h), f = h.done, Promise.resolve(h.value).then((T) => a({ value: T, done: f }), d)))), s("next"), s("return"), t);
|
|
29
|
+
import { URLPattern as tt } from "urlpattern-polyfill";
|
|
30
|
+
import { Notifier as et } from "../notifier/index.js";
|
|
31
|
+
import { i as X } from "../browser-0zX67oeU.js";
|
|
32
|
+
import { d as st } from "../function-C10DGppn.js";
|
|
33
|
+
import { i as it } from "../object-R34VLqhp.js";
|
|
34
|
+
var R, U, b, m, l, w, A, v, P, E, B, Z;
|
|
35
|
+
class nt {
|
|
38
36
|
constructor(t, s) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
r(this, B);
|
|
38
|
+
r(this, R, void 0);
|
|
39
|
+
r(this, U, void 0);
|
|
40
|
+
r(this, b, void 0);
|
|
41
|
+
r(this, m, void 0);
|
|
42
|
+
r(this, l, void 0);
|
|
43
|
+
r(this, w, void 0);
|
|
44
|
+
r(this, A, void 0);
|
|
45
|
+
r(this, v, null);
|
|
46
|
+
r(this, P, []);
|
|
47
|
+
r(this, E, []);
|
|
48
|
+
o(this, R, t), o(this, U, s), o(this, b, new URLPattern({ pathname: e(this, R) })), o(this, m, null), o(this, l, null), o(this, w, !1), o(this, A, null), X && o(this, v, new MutationObserver((i) => {
|
|
51
49
|
i[0].addedNodes.forEach((h) => {
|
|
52
50
|
e(this, m) ? e(this, E).push(h) : e(this, P).push(h);
|
|
53
51
|
});
|
|
@@ -73,7 +71,7 @@ class rt {
|
|
|
73
71
|
}
|
|
74
72
|
render(t, s) {
|
|
75
73
|
return j(this, null, function* () {
|
|
76
|
-
var i,
|
|
74
|
+
var i, u;
|
|
77
75
|
if (e(this, v).observe(document.head, {
|
|
78
76
|
childList: !0,
|
|
79
77
|
subtree: !0
|
|
@@ -83,31 +81,28 @@ class rt {
|
|
|
83
81
|
});
|
|
84
82
|
else {
|
|
85
83
|
const h = yield e(this, U).call(this);
|
|
86
|
-
if (
|
|
84
|
+
if (o(this, E, [...e(this, P)]), typeof h.default == "function" && (o(this, m, h.default), it(h.default))) {
|
|
87
85
|
const a = "e-" + ((i = e(this, m)) == null ? void 0 : i.name.toLowerCase());
|
|
88
86
|
customElements.get(a) || customElements.define(a, h.default);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
|
-
if (yield z(this, B,
|
|
89
|
+
if (yield z(this, B, Z).call(this), e(this, m)) {
|
|
92
90
|
const h = e(this, b).exec({ pathname: s }), a = (h == null ? void 0 : h.pathname.groups) || {}, d = Object.fromEntries(
|
|
93
91
|
new URLSearchParams(location.search)
|
|
94
|
-
),
|
|
92
|
+
), f = {
|
|
95
93
|
pathnameParams: a,
|
|
96
94
|
searchParams: d
|
|
97
95
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)) :
|
|
101
|
-
e(this, m),
|
|
102
|
-
u
|
|
103
|
-
)), t.appendChild(e(this, l)), r(this, A, e(this, l).querySelector("[data-nest]") || ((f = e(this, l).shadowRoot) == null ? void 0 : f.querySelector("[data-nest]")) || e(this, l).shadowRoot || e(this, l)), r(this, w, !0);
|
|
96
|
+
o(this, l, new (e(this, m))(
|
|
97
|
+
f
|
|
98
|
+
)), t.appendChild(e(this, l)), o(this, A, e(this, l).querySelector("[data-nest]") || ((u = e(this, l).shadowRoot) == null ? void 0 : u.querySelector("[data-nest]")) || e(this, l).shadowRoot || e(this, l)), o(this, w, !0);
|
|
104
99
|
}
|
|
105
100
|
e(this, v).disconnect();
|
|
106
101
|
});
|
|
107
102
|
}
|
|
108
103
|
close() {
|
|
109
104
|
var t;
|
|
110
|
-
e(this, v).disconnect(), (t = e(this, l)) == null || t.remove(),
|
|
105
|
+
e(this, v).disconnect(), (t = e(this, l)) == null || t.remove(), o(this, w, !1), e(this, E).forEach((s) => document.head.removeChild(s)), o(this, E, []);
|
|
111
106
|
}
|
|
112
107
|
getAnchorElements() {
|
|
113
108
|
var s;
|
|
@@ -118,23 +113,23 @@ class rt {
|
|
|
118
113
|
]), t;
|
|
119
114
|
}
|
|
120
115
|
}
|
|
121
|
-
R = new WeakMap(), U = new WeakMap(), b = new WeakMap(), m = new WeakMap(), l = new WeakMap(), w = new WeakMap(), A = new WeakMap(), v = new WeakMap(), P = new WeakMap(), E = new WeakMap(), B = new WeakSet(),
|
|
116
|
+
R = new WeakMap(), U = new WeakMap(), b = new WeakMap(), m = new WeakMap(), l = new WeakMap(), w = new WeakMap(), A = new WeakMap(), v = new WeakMap(), P = new WeakMap(), E = new WeakMap(), B = new WeakSet(), Z = function() {
|
|
122
117
|
return j(this, null, function* () {
|
|
123
118
|
const t = e(this, P).filter((a) => a instanceof HTMLElement ? a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK" : !1);
|
|
124
119
|
try {
|
|
125
|
-
for (var s = F(t), i,
|
|
126
|
-
const a =
|
|
120
|
+
for (var s = F(t), i, u, h; i = !(u = yield s.next()).done; i = !1) {
|
|
121
|
+
const a = u.value;
|
|
127
122
|
yield new Promise((d) => {
|
|
128
123
|
a.onload = () => {
|
|
129
124
|
d();
|
|
130
125
|
};
|
|
131
126
|
});
|
|
132
127
|
}
|
|
133
|
-
} catch (
|
|
134
|
-
h = [
|
|
128
|
+
} catch (u) {
|
|
129
|
+
h = [u];
|
|
135
130
|
} finally {
|
|
136
131
|
try {
|
|
137
|
-
i && (
|
|
132
|
+
i && (u = s.return) && (yield u.call(s));
|
|
138
133
|
} finally {
|
|
139
134
|
if (h)
|
|
140
135
|
throw h[0];
|
|
@@ -142,44 +137,44 @@ R = new WeakMap(), U = new WeakMap(), b = new WeakMap(), m = new WeakMap(), l =
|
|
|
142
137
|
}
|
|
143
138
|
});
|
|
144
139
|
};
|
|
145
|
-
var H,
|
|
146
|
-
class
|
|
140
|
+
var H, g, S, O, x;
|
|
141
|
+
class rt {
|
|
147
142
|
constructor(t, s) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
r(this, H, void 0);
|
|
144
|
+
r(this, g, void 0);
|
|
145
|
+
r(this, S, void 0);
|
|
146
|
+
r(this, O, void 0);
|
|
147
|
+
r(this, x, (t) => {
|
|
153
148
|
t.preventDefault(), e(this, H).navigate(e(this, S), e(this, O));
|
|
154
149
|
});
|
|
155
|
-
|
|
150
|
+
o(this, H, t), o(this, g, s), o(this, S, e(this, g).getAttribute("href") || "/"), o(this, O, e(this, g).getAttribute("data-history-action") || "push"), e(this, g).addEventListener("click", e(this, x)), location.pathname === e(this, S) && e(this, g).classList.add("current");
|
|
156
151
|
}
|
|
157
152
|
destroy() {
|
|
158
|
-
e(this,
|
|
153
|
+
e(this, g).removeEventListener("click", e(this, x)), e(this, g).classList.remove("current");
|
|
159
154
|
}
|
|
160
155
|
}
|
|
161
|
-
H = new WeakMap(),
|
|
162
|
-
globalThis.URLPattern =
|
|
163
|
-
var k, N,
|
|
156
|
+
H = new WeakMap(), g = new WeakMap(), S = new WeakMap(), O = new WeakMap(), x = new WeakMap();
|
|
157
|
+
globalThis.URLPattern = tt;
|
|
158
|
+
var k, N, p, C, I, L, q, M, D, K, _, W;
|
|
164
159
|
const Y = class Y {
|
|
165
160
|
constructor(t) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
161
|
+
r(this, K);
|
|
162
|
+
r(this, k, null);
|
|
163
|
+
r(this, N, void 0);
|
|
164
|
+
r(this, p, []);
|
|
165
|
+
r(this, C, null);
|
|
166
|
+
r(this, I, []);
|
|
167
|
+
r(this, L, void 0);
|
|
168
|
+
r(this, q, null);
|
|
169
|
+
r(this, M, new et());
|
|
170
|
+
r(this, D, st(() => {
|
|
176
171
|
const t = (s) => s.split("/").length;
|
|
177
|
-
|
|
172
|
+
o(this, p, e(this, p).sort((s, i) => t(s.pattern) - t(i.pattern))), this.navigate(location.pathname.replace(e(this, N), ""));
|
|
178
173
|
}, 0));
|
|
179
|
-
|
|
174
|
+
r(this, W, (t) => {
|
|
180
175
|
t.state && this.navigate(t.state, "none");
|
|
181
176
|
});
|
|
182
|
-
|
|
177
|
+
o(this, N, (t == null ? void 0 : t.base) || ""), Y.active = this, X && (o(this, k, (t == null ? void 0 : t.rootElement) || document.body), addEventListener("popstate", e(this, W)));
|
|
183
178
|
}
|
|
184
179
|
get currentPathname() {
|
|
185
180
|
return e(this, q);
|
|
@@ -188,22 +183,22 @@ const Y = class Y {
|
|
|
188
183
|
return e(this, L);
|
|
189
184
|
}
|
|
190
185
|
get routes() {
|
|
191
|
-
return e(this,
|
|
186
|
+
return e(this, p);
|
|
192
187
|
}
|
|
193
188
|
navigationEvent(t) {
|
|
194
189
|
return e(this, M).subscribe(t);
|
|
195
190
|
}
|
|
196
191
|
defineRoute(t, s) {
|
|
197
|
-
const i = new
|
|
198
|
-
e(this,
|
|
192
|
+
const i = new nt(t, s);
|
|
193
|
+
e(this, p).push(i), e(this, D).call(this);
|
|
199
194
|
}
|
|
200
195
|
navigate(t, s = "push") {
|
|
201
196
|
return j(this, null, function* () {
|
|
202
|
-
var
|
|
197
|
+
var f, G;
|
|
203
198
|
if (e(this, L) === t || e(this, q) === t)
|
|
204
199
|
return;
|
|
205
|
-
Y.active = this,
|
|
206
|
-
const i = e(this,
|
|
200
|
+
Y.active = this, o(this, L, t);
|
|
201
|
+
const i = e(this, p).filter((c) => c.isActive), u = e(this, p).filter(
|
|
207
202
|
(c) => !i.includes(c) && c.testPathname(t)
|
|
208
203
|
), h = i.filter((c) => !c.testPathname(t)), a = i.filter((c) => c.testPathname(t));
|
|
209
204
|
let d = !0;
|
|
@@ -217,47 +212,47 @@ const Y = class Y {
|
|
|
217
212
|
c ? console.error(c) : console.log("Route change canceled"), d = !1;
|
|
218
213
|
}
|
|
219
214
|
if (d && e(this, L) === t) {
|
|
220
|
-
|
|
215
|
+
o(this, C, a[a.length - 1]), h.forEach((y) => {
|
|
221
216
|
y.close();
|
|
222
|
-
}),
|
|
217
|
+
}), o(this, q, t);
|
|
223
218
|
try {
|
|
224
|
-
for (var T = F(
|
|
225
|
-
const y =
|
|
226
|
-
yield y.render(((
|
|
219
|
+
for (var T = F(u), mt, gt, pt; mt = !(gt = yield T.next()).done; mt = !1) {
|
|
220
|
+
const y = gt.value;
|
|
221
|
+
yield y.render(((f = e(this, C)) == null ? void 0 : f.nest) || e(this, k), t), o(this, C, y);
|
|
227
222
|
}
|
|
228
|
-
} catch (
|
|
229
|
-
|
|
223
|
+
} catch (gt) {
|
|
224
|
+
pt = [gt];
|
|
230
225
|
} finally {
|
|
231
226
|
try {
|
|
232
|
-
|
|
227
|
+
mt && (gt = T.return) && (yield gt.call(T));
|
|
233
228
|
} finally {
|
|
234
|
-
if (
|
|
235
|
-
throw
|
|
229
|
+
if (pt)
|
|
230
|
+
throw pt[0];
|
|
236
231
|
}
|
|
237
232
|
}
|
|
238
233
|
const c = e(this, N) + t + location.search;
|
|
239
|
-
s === "push" ? history.pushState(c, "", c) : s === "replace" && history.replaceState(c, "", c), z(this, K,
|
|
234
|
+
s === "push" ? history.pushState(c, "", c) : s === "replace" && history.replaceState(c, "", c), z(this, K, _).call(this), (G = this.postprocessor) == null || G.call(this, { pathname: t }), e(this, M).notify({ pathname: t });
|
|
240
235
|
}
|
|
241
236
|
});
|
|
242
237
|
}
|
|
243
238
|
};
|
|
244
|
-
k = new WeakMap(), N = new WeakMap(),
|
|
245
|
-
const t = e(this,
|
|
239
|
+
k = new WeakMap(), N = new WeakMap(), p = new WeakMap(), C = new WeakMap(), I = new WeakMap(), L = new WeakMap(), q = new WeakMap(), M = new WeakMap(), D = new WeakMap(), K = new WeakSet(), _ = function() {
|
|
240
|
+
const t = e(this, p).filter((i) => i.isActive), s = Array.from(
|
|
246
241
|
new Set(
|
|
247
242
|
[
|
|
248
243
|
...e(this, k).querySelectorAll("a"),
|
|
249
244
|
...t.map((i) => i.getAnchorElements()).flat()
|
|
250
245
|
].filter((i) => {
|
|
251
|
-
var
|
|
252
|
-
return (
|
|
246
|
+
var u;
|
|
247
|
+
return (u = i.getAttribute("href")) == null ? void 0 : u.startsWith("/");
|
|
253
248
|
})
|
|
254
249
|
)
|
|
255
250
|
);
|
|
256
251
|
e(this, I).forEach((i) => {
|
|
257
252
|
i.destroy();
|
|
258
|
-
}),
|
|
253
|
+
}), o(this, I, s.map((i) => new rt(this, i)));
|
|
259
254
|
}, W = new WeakMap();
|
|
260
|
-
let
|
|
255
|
+
let V = Y;
|
|
261
256
|
export {
|
|
262
|
-
|
|
257
|
+
V as Router
|
|
263
258
|
};
|
|
@@ -36,28 +36,6 @@ export declare class ScrollElement extends CustomElement {
|
|
|
36
36
|
get isRunning(): Store<boolean, keyof import('../store').StoreManagers, import('../store').StoreEntry<boolean>>;
|
|
37
37
|
onScroll(...parameters: Parameters<Damped['subscribe']>): () => void;
|
|
38
38
|
offScroll(...parameters: Parameters<Damped['unsubscribe']>): void;
|
|
39
|
-
get context(): {
|
|
40
|
-
currentScrollValue: number;
|
|
41
|
-
targetScrollValue: number;
|
|
42
|
-
contentElement: HTMLElement;
|
|
43
|
-
position: number;
|
|
44
|
-
contentPosition: number;
|
|
45
|
-
viewportSize: number;
|
|
46
|
-
scrollSize: number;
|
|
47
|
-
gap: number;
|
|
48
|
-
counter: Store<number, keyof import('../store').StoreManagers, import('../store').StoreEntry<number>>;
|
|
49
|
-
distance: number;
|
|
50
|
-
overscroll: number;
|
|
51
|
-
vertical: boolean;
|
|
52
|
-
currentProgress: number;
|
|
53
|
-
targetProgress: number;
|
|
54
|
-
speed: number;
|
|
55
|
-
direction: number;
|
|
56
|
-
isRunning: Store<boolean, keyof import('../store').StoreManagers, import('../store').StoreEntry<boolean>>;
|
|
57
|
-
range: (from: number, distance: number, margin?: number) => number;
|
|
58
|
-
curve: (from: number, distance: number, margin?: number) => number;
|
|
59
|
-
visible: (from: number, distance: number, margin?: number) => boolean;
|
|
60
|
-
};
|
|
61
39
|
range(from: number, distance: number, margin?: number): number;
|
|
62
40
|
curve(from: number, distance: number, margin?: number): number;
|
|
63
41
|
visible(from: number, distance: number, margin?: number): boolean;
|
package/lib/scroll/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ct=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)};var h=(i,e,s)=>(Ct(i,e,"read from private field"),s?s.call(i):e.get(i)),T=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},R=(i,e,s,r)=>(Ct(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $t=require("../Damped-BvkThM-2.cjs"),Tt=require("../Store-D0_rDIsE.cjs"),Dt=require("../Derived-SjPdLJiZ.cjs"),Pt=require("../browser-CpzFX2xg.cjs"),H=require("../layout-8ryRAMGJ.cjs"),zt=require("../math-GDWEqu7y.cjs");require("../ticker/index.cjs");const x=require("../attribute/index.cjs"),At=require("../WheelControls-CctFwJwY.cjs"),wt=require("../custom-element/index.cjs"),yt=require("../order/index.cjs"),dt=require("../window-resizer/index.cjs"),B=require("../scroll-entries/index.cjs"),V=require("../tags-Di21YbUL.cjs"),Lt=require("../createStylesheet-De-6zF24.cjs"),It=require("../css-unit-parser/index.cjs"),Ht=require("../dom-qY2LdCVL.cjs");var Bt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,Ut=(i,e,s,r)=>{for(var n=r>1?void 0:r?Ft(e,s):e,p=i.length-1,f;p>=0;p--)(f=i[p])&&(n=(r?f(e,s,n):f(n))||n);return r&&n&&Bt(e,s,n),n},kt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},t=(i,e,s)=>(kt(i,e,"read from private field"),s?s.call(i):e.get(i)),l=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},g=(i,e,s,r)=>(kt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),m=(i,e,s)=>(kt(i,e,"access private method"),s),a,C,D,q,I,j,y,G,tt,et,u,ft,c,st,it,S,d,z,k,F,w,K,O,N,gt,U,Q,mt,Wt,bt,Mt,rt,St,nt,_t,$,vt,Et,Rt,ht,lt,xt,_,b,L,W;class Gt{constructor(e,s){T(this,_,void 0);T(this,b,void 0);T(this,L,0);T(this,W,0);R(this,_,e),R(this,b,s),B.scrollEntries.register(h(this,_))}get size(){return h(this,L)}get position(){return h(this,W)}destroy(){B.scrollEntries.unregister(h(this,_)),h(this,_).style.transform=""}resize(){R(this,L,h(this,b).vertical?h(this,_).offsetHeight:h(this,_).offsetWidth),R(this,W,h(this,b).vertical?H.getCumulativeOffsetTop(h(this,_)):H.getCumulativeOffsetLeft(h(this,_))),R(this,W,h(this,W)-h(this,b).contentPosition)}transform(){let e=0;const s=h(this,b).viewportSize-h(this,L);h(this,b).infiniteAttribute.current&&h(this,b).overscroll&&h(this,W)+h(this,L)<h(this,b).currentScrollValue&&(e=h(this,b).distance*-1-h(this,b).gap),B.scrollEntries.update(h(this,_),h(this,b).axisAttibute.current,e);const r=h(this,b).currentScrollValue+e,n=h(this,W)-h(this,b).viewportSize-s,p=h(this,W)+h(this,L)+s,f=zt.clamp(r,n,p);h(this,b).vertical?h(this,_).style.transform=`translate3d(0px, ${f*-1}px, 0px)`:h(this,_).style.transform=`translate3d(${f*-1}px, 0px, 0px)`}}_=new WeakMap,b=new WeakMap,L=new WeakMap,W=new WeakMap;const Kt=Lt.createStylesheet({":host":{position:"relative",width:"100%",height:"100%",display:"block",outline:"none"},':host([hibernated="true"])':{display:"contents"},".static":{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},".content":{position:"relative",display:"flex",width:"100%",height:"100%",gap:"var(--gap, 0px)"},':host([hibernated="true"]) .content':{display:"contents"},"::slotted(*)":{flexShrink:"0"}});exports.ScrollElement=class extends wt.CustomElement{constructor(){super(),l(this,N),l(this,U),l(this,mt),l(this,bt),l(this,rt),l(this,nt),l(this,Et),l(this,lt),l(this,a,null),l(this,C,new x.Attribute(this,"axis","y")),l(this,D,new x.Attribute(this,"pages",0,{validate:e=>Math.max(0,e-1)})),l(this,q,new x.Attribute(this,"split",!1)),l(this,I,new x.Attribute(this,"sectional",!1)),l(this,j,new x.Attribute(this,"wheel-max-delta",!1)),l(this,y,new x.Attribute(this,"infinite",!1)),l(this,G,new x.Attribute(this,"damping",.03)),l(this,tt,new x.Attribute(this,"disabled",!1)),l(this,et,new x.Attribute(this,"hibernated",!1)),l(this,u,null),l(this,ft,null),l(this,c,[]),l(this,st,0),l(this,it,0),l(this,S,0),l(this,d,0),l(this,z,0),l(this,k,null),l(this,F,null),l(this,w,new Tt.Store(0)),l(this,K,0),l(this,O,0),l(this,$,()=>{const e=this.currentScrollValue/t(this,d)||0;if(g(this,st,this.vertical?H.getCumulativeOffsetTop(this):H.getCumulativeOffsetLeft(this)),g(this,it,this.vertical?H.getCumulativeOffsetTop(t(this,u)):H.getCumulativeOffsetLeft(t(this,u))),g(this,S,this.vertical?this.offsetHeight:this.offsetWidth),t(this,D).current){g(this,d,t(this,S)*t(this,D).current);const s=t(this,d)+t(this,S);this.vertical?(t(this,u).style.width=s+"px",t(this,u).style.height="100%"):(t(this,u).style.height=s+"px",t(this,u).style.width="100%")}else this.vertical?(t(this,u).style.width="100%",t(this,u).style.height="max-content",g(this,d,t(this,u).offsetHeight-t(this,S))):(t(this,u).style.width="max-content",t(this,u).style.height="100%",g(this,d,t(this,u).offsetWidth-t(this,S)));if(g(this,z,It.cssUnitParser.parse(getComputedStyle(t(this,u)).gap)),!t(this,y).current){const s=getComputedStyle(this);g(this,d,t(this,d)+(this.vertical?parseFloat(s.paddingBlockStart)+parseFloat(s.paddingBlockEnd):parseFloat(s.paddingInlineStart)+parseFloat(s.paddingInlineEnd))),t(this,a).max=t(this,d)}if(t(this,c).forEach(s=>{s.resize(),s.transform()}),t(this,y).current&&t(this,c).length){const s=t(this,c)[t(this,c).length-1],r=s.position+s.size-t(this,S),n=t(this,d)-r;g(this,O,s.position+s.size+n)}else g(this,O,t(this,d));if(t(this,I).current&&t(this,c).length){const s=t(this,c)[t(this,w).current];t(this,a).set(s.position,!0)}else t(this,a).set(e*t(this,d),!0)}),l(this,vt,()=>{const e=this.currentScrollValue;if(g(this,K,Math.max(0,e-t(this,d))),t(this,c).length){let s=0;for(let r=0;r<t(this,c).length;r++){const n=t(this,c)[r];n.transform(),this.targetScrollValue+this.viewportSize/2>=n.position&&(s=r)}t(this,w).current=s}else this.vertical?t(this,u).style.transform=`translate3d(0px, ${e*-1}px, 0px)`:t(this,u).style.transform=`translate3d(${e*-1}px, 0px, 0px)`;B.scrollEntries.update(this,t(this,C).current,e)}),l(this,ht,e=>{if(typeof e=="number")if(t(this,I).current){const s=Math.sign(e);t(this,c).length?this.shiftSections(s):t(this,a).shift(s*t(this,S))}else t(this,a).shift(e);else e==="min"?t(this,a).set(t(this,a).min):e==="max"&&t(this,a).set(t(this,a).length)}),Pt.isBrowser&&(g(this,a,new $t.Damped(0,{damping:.01,min:0,order:yt.TICK_ORDER.SCROLL})),this.openShadow(Kt),V.element(this,{tabIndex:0,children:[V.div({class:"static",children:[V.slot({name:"static"})]}),V.div({class:"content",children:[V.slot({ref:e=>g(this,ft,e)})],style:{flexDirection:new Dt.Derived(t(this,C),e=>e==="x"?"row":"column")},ref:e=>g(this,u,e)})]}),g(this,k,new At.WheelControls({element:this})),t(this,k).changeEvent.subscribe(t(this,ht)),g(this,F,new At.KeyboardControls({element:this})),t(this,F).changeEvent.subscribe(t(this,ht)),t(this,C).subscribe(({current:e})=>{t(this,u).style.flexDirection=e==="x"?"row":"column",t(this,k).axis=t(this,j).current?"max":e,this.isConnected&&t(this,$).call(this)}),t(this,j).subscribe(e=>{t(this,k).axis=e.current?"max":t(this,C).current}),t(this,D).subscribe(()=>{this.isConnected&&t(this,$).call(this)}),t(this,q).subscribe(({current:e})=>{this.isConnected&&(e?m(this,N,gt).call(this):m(this,U,Q).call(this))}),t(this,I).subscribe(e=>{t(this,w).current=0,t(this,k).debounce=e.current,t(this,a).reset(),this.isConnected&&(e.current&&!e.previous?m(this,N,gt).call(this):!e.current&&e.previous&&m(this,U,Q).call(this))}),t(this,y).subscribe(e=>{e.current?(this.isConnected&&(t(this,c).length||(t(this,q).current=!0)),t(this,c).length&&(t(this,a).max=1/0,t(this,a).min=-1/0)):(g(this,K,0),t(this,a).max=t(this,d),t(this,a).min=0)}),t(this,G).subscribe(e=>{t(this,a).damping=e.current}),t(this,tt).subscribe(e=>{e.current&&!e.previous?m(this,mt,Wt).call(this):!e.current&&e.previous&&m(this,bt,Mt).call(this)}),t(this,et).subscribe(e=>{e.current&&!e.previous?m(this,rt,St).call(this):!e.current&&e.previous&&m(this,nt,_t).call(this)}))}get dampingAttribute(){return t(this,G)}get axisAttibute(){return t(this,C)}get pagesAttibute(){return t(this,D)}get splitAttibute(){return t(this,q)}get sectionalAttibute(){return t(this,I)}get infiniteAttribute(){return t(this,y)}get dampingAttibute(){return t(this,G)}get disabledAttibute(){return t(this,tt)}get hibernatedAttibute(){return t(this,et)}get currentScrollValue(){return m(this,lt,xt).call(this,"current")}get targetScrollValue(){return m(this,lt,xt).call(this,"target")}get contentElement(){return t(this,u)}get position(){return t(this,st)}get contentPosition(){return t(this,it)}get viewportSize(){return t(this,S)}get scrollSize(){return t(this,d)}get gap(){return t(this,z)}get counter(){return t(this,w)}get distance(){return t(this,O)}get overscroll(){return t(this,K)}get vertical(){return t(this,C).current==="y"}get currentProgress(){return this.currentScrollValue/t(this,O)||0}get targetProgress(){return this.targetScrollValue/t(this,O)||0}get speed(){return t(this,a).speed}get direction(){return t(this,a).direction}get isRunning(){return t(this,a).isRunning}onScroll(...e){return t(this,a).subscribe(...e)}offScroll(...e){t(this,a).unsubscribe(...e)}get context(){return{currentScrollValue:this.currentScrollValue,targetScrollValue:this.targetScrollValue,contentElement:this.contentElement,position:this.position,contentPosition:this.contentPosition,viewportSize:this.viewportSize,scrollSize:this.scrollSize,gap:this.gap,counter:this.counter,distance:this.distance,overscroll:this.overscroll,vertical:this.vertical,currentProgress:this.currentProgress,targetProgress:this.targetProgress,speed:this.speed,direction:this.direction,isRunning:this.isRunning,range:this.range,curve:this.curve,visible:this.visible}}range(e,s,r=0){const n=e-r,p=n+s+r*2;return this.currentProgress<n?0:this.currentProgress>p?1:(this.currentProgress-n)/(p-n)}curve(e,s,r=0){return Math.sin(this.range(e,s,r)*Math.PI)}visible(e,s,r=0){const n=e-r,p=n+s+r*2;return this.currentProgress>=n&&this.currentProgress<=p}scrollToSection(e,s="smooth"){if(!t(this,c).length)return;const r=t(this,w).current;m(this,Et,Rt).call(this,e);const n=t(this,c)[r],p=t(this,c)[t(this,w).current];if(n&&p){let f=0;const Y=t(this,c).length-1;t(this,y).current?t(this,w).current===0&&r===Y?f=t(this,d)+t(this,S)-n.position+t(this,z):t(this,w).current===Y&&r===0?f=p.position-(t(this,d)+t(this,S)+t(this,z)):f=p.position-n.position:f=p.position-n.position,t(this,a).shift(f,s==="instant")}}shiftSections(e,s="smooth"){t(this,c).length&&this.scrollToSection(t(this,w).current+e,s)}setPosition(e,s="smooth"){t(this,a).set(e,s==="instant")}connectedCallback(){m(this,nt,_t).call(this)}disconnectedCallback(){m(this,rt,St).call(this)}};a=new WeakMap;C=new WeakMap;D=new WeakMap;q=new WeakMap;I=new WeakMap;j=new WeakMap;y=new WeakMap;G=new WeakMap;tt=new WeakMap;et=new WeakMap;u=new WeakMap;ft=new WeakMap;c=new WeakMap;st=new WeakMap;it=new WeakMap;S=new WeakMap;d=new WeakMap;z=new WeakMap;k=new WeakMap;F=new WeakMap;w=new WeakMap;K=new WeakMap;O=new WeakMap;N=new WeakSet;gt=function(){m(this,U,Q).call(this),t(this,ft).assignedElements().forEach(i=>{i instanceof HTMLElement&&t(this,c).push(new Gt(i,this))}),t(this,u).style.transform="",t(this,$).call(this)};U=new WeakSet;Q=function(){t(this,c).forEach(i=>{i.destroy()}),g(this,c,[])};mt=new WeakSet;Wt=function(){t(this,a).unsubscribe(t(this,vt)),t(this,a).stopAnimation(),t(this,k).disconnect(),t(this,F).disconnect()};bt=new WeakSet;Mt=function(){t(this,a).subscribe(t(this,vt)),t(this,k).connect(),t(this,F).connect()};rt=new WeakSet;St=function(){dt.windowResizer.unsubscribe(t(this,$)),t(this,a).reset(),m(this,mt,Wt).call(this),t(this,u).style.transform="",t(this,q).current&&m(this,U,Q).call(this),B.scrollEntries.unregister(this)};nt=new WeakSet;_t=function(){t(this,q).current&&m(this,N,gt).call(this),B.scrollEntries.register(this),dt.windowResizer.subscribe(t(this,$),yt.RESIZE_ORDER.SCROLL),m(this,bt,Mt).call(this)};$=new WeakMap;vt=new WeakMap;Et=new WeakSet;Rt=function(i){t(this,y).current?(t(this,w).current=i%t(this,c).length,t(this,w).current=t(this,w).current<0?t(this,c).length+t(this,w).current:t(this,w).current):t(this,w).current=zt.clamp(i,0,t(this,c).length-1)};ht=new WeakMap;lt=new WeakSet;xt=function(i="current"){if(t(this,y).current&&t(this,c).length){const e=t(this,a)[i]%(t(this,d)+t(this,S)+t(this,z));return e<0?t(this,d)+e+t(this,S)+t(this,z):e}else return t(this,a)[i]};exports.ScrollElement=Ut([wt.define("e-scroll")],exports.ScrollElement);var X;class Zt extends wt.CustomElement{constructor(){super(...arguments);T(this,X,null)}get scrollElement(){return h(this,X)}connectedCallback(){const s=Ht.findParentElement(this,exports.ScrollElement);s instanceof exports.ScrollElement?R(this,X,s):console.error(this,"e-scroll not found")}}X=new WeakMap;var Jt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Qt=(i,e,s,r)=>{for(var n=r>1?void 0:r?Nt(e,s):e,p=i.length-1,f;p>=0;p--)(f=i[p])&&(n=(r?f(e,s,n):f(n))||n);return r&&n&&Jt(e,s,n),n},Ot=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},o=(i,e,s)=>(Ot(i,e,"read from private field"),s?s.call(i):e.get(i)),E=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},M=(i,e,s,r)=>(Ot(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),ot,v,A,P,Z,J,at,ct,ut,pt;const Xt=Lt.createStylesheet({":host":{display:"inline-block",zIndex:"1",backgroundColor:"#efefef"},':host([axis="y"])':{position:"absolute",right:"0",top:"0",width:"1vmin",height:"100%"},':host([axis="x"])':{position:"absolute",left:"0",bottom:"0",width:"100%",height:"1vmin"},".default-thumb":{backgroundColor:"#181818",borderRadius:"1vmin",touchAction:"none"},"::slotted(*)":{touchAction:"none"}});exports.ScrollbarElement=class extends Zt{constructor(){super(),E(this,ot,null),E(this,v,null),E(this,A,!1),E(this,P,0),E(this,Z,0),E(this,J,0),E(this,at,()=>{M(this,A,this.offsetWidth>this.offsetHeight);const e=o(this,A)?this.offsetWidth:this.offsetHeight;M(this,P,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),M(this,P,Math.max(o(this,P),30)),o(this,A)?(o(this,v).style.width=o(this,P)+"px",o(this,v).style.height="100%"):(o(this,v).style.width="100%",o(this,v).style.height=o(this,P)+"px"),M(this,Z,e-o(this,P)),this.scrollElement.scrollSize||(this.style.display="none")}),E(this,ct,()=>{M(this,J,this.scrollElement.currentProgress*o(this,Z)),o(this,A)?o(this,v).style.transform=`translate3d(${o(this,J)}px, 0px, 0px)`:o(this,v).style.transform=`translate3d(0px, ${o(this,J)}px, 0px)`}),E(this,ut,()=>{this.setAttribute("axis",this.scrollElement.axisAttibute.current)}),E(this,pt,e=>{const s=f=>{const Y=o(this,A)?f.x:f.y,Vt=this.scrollElement.distance/o(this,Z),qt=(Y-p)*Vt;this.scrollElement.setPosition(n+qt)},r=()=>{removeEventListener("pointermove",s),removeEventListener("pointerup",r),removeEventListener("touchend",r)};addEventListener("pointermove",s),addEventListener("pointerup",r),addEventListener("touchend",r);const n=this.scrollElement.targetScrollValue,p=o(this,A)?e.x:e.y}),Pt.isBrowser&&(this.openShadow(Xt),V.element(this,{children:[V.slot({ref:e=>M(this,ot,e)})]}))}get thumbElement(){return o(this,v)}connectedCallback(){super.connectedCallback();const e=o(this,ot).assignedElements()[0];e instanceof HTMLElement?M(this,v,e):(M(this,v,document.createElement("div")),o(this,v).classList.add("default-thumb"),this.shadowRoot.appendChild(o(this,v))),o(this,v).addEventListener("pointerdown",o(this,pt)),dt.windowResizer.subscribe(o(this,at),yt.RESIZE_ORDER.SCROLL+1),this.scrollElement.onScroll(o(this,ct)),this.scrollElement.axisAttibute.subscribe(o(this,ut))}disconnectedCallback(){o(this,v).removeEventListener("pointerdown",o(this,pt)),dt.windowResizer.unsubscribe(o(this,at)),this.scrollElement.offScroll(o(this,ct)),this.scrollElement.axisAttibute.unsubscribe(o(this,ut))}};ot=new WeakMap;v=new WeakMap;A=new WeakMap;P=new WeakMap;Z=new WeakMap;J=new WeakMap;at=new WeakMap;ct=new WeakMap;ut=new WeakMap;pt=new WeakMap;exports.ScrollbarElement=Qt([wt.define("e-scrollbar")],exports.ScrollbarElement);
|
|
1
|
+
"use strict";var Ct=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)};var h=(i,e,s)=>(Ct(i,e,"read from private field"),s?s.call(i):e.get(i)),V=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},O=(i,e,s,r)=>(Ct(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Tt=require("../Damped-B0eRyTcV.cjs"),Vt=require("../Store-Dis8QUAR.cjs"),Dt=require("../Derived-vGokdC4b.cjs"),zt=require("../browser-CpzFX2xg.cjs"),H=require("../layout-8ryRAMGJ.cjs"),Lt=require("../math-GDWEqu7y.cjs");require("../ticker/index.cjs");const x=require("../attribute/index.cjs"),At=require("../WheelControls-fiz52vcl.cjs"),wt=require("../custom-element/index.cjs"),yt=require("../order/index.cjs"),ft=require("../window-resizer/index.cjs"),B=require("../scroll-entries/index.cjs"),q=require("../tags-D3-tO-m6.cjs"),Pt=require("../createStylesheet-B4vLzvah.cjs"),It=require("../css-unit-parser/index.cjs"),Ht=require("../dom-JBOkFLTh.cjs");var Bt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor,Ut=(i,e,s,r)=>{for(var n=r>1?void 0:r?Ft(e,s):e,p=i.length-1,d;p>=0;p--)(d=i[p])&&(n=(r?d(e,s,n):d(n))||n);return r&&n&&Bt(e,s,n),n},kt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},t=(i,e,s)=>(kt(i,e,"read from private field"),s?s.call(i):e.get(i)),l=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},g=(i,e,s,r)=>(kt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),m=(i,e,s)=>(kt(i,e,"access private method"),s),a,C,D,$,I,j,y,G,tt,et,u,dt,c,st,it,_,f,L,k,F,w,K,R,N,gt,U,Q,mt,Wt,bt,Mt,rt,_t,nt,St,T,vt,Et,Ot,ht,lt,xt,S,b,P,W;class Gt{constructor(e,s){V(this,S,void 0);V(this,b,void 0);V(this,P,0);V(this,W,0);O(this,S,e),O(this,b,s),B.scrollEntries.register(h(this,S))}get size(){return h(this,P)}get position(){return h(this,W)}destroy(){B.scrollEntries.unregister(h(this,S)),h(this,S).style.transform=""}resize(){O(this,P,h(this,b).vertical?h(this,S).offsetHeight:h(this,S).offsetWidth),O(this,W,h(this,b).vertical?H.getCumulativeOffsetTop(h(this,S)):H.getCumulativeOffsetLeft(h(this,S))),O(this,W,h(this,W)-h(this,b).contentPosition)}transform(){let e=0;const s=h(this,b).viewportSize-h(this,P);h(this,b).infiniteAttribute.current&&h(this,b).overscroll&&h(this,W)+h(this,P)<h(this,b).currentScrollValue&&(e=h(this,b).distance*-1-h(this,b).gap),B.scrollEntries.update(h(this,S),h(this,b).axisAttibute.current,e);const r=h(this,b).currentScrollValue+e,n=h(this,W)-h(this,b).viewportSize-s,p=h(this,W)+h(this,P)+s,d=Lt.clamp(r,n,p);h(this,b).vertical?h(this,S).style.transform=`translate3d(0px, ${d*-1}px, 0px)`:h(this,S).style.transform=`translate3d(${d*-1}px, 0px, 0px)`}}S=new WeakMap,b=new WeakMap,P=new WeakMap,W=new WeakMap;const Kt=Pt.createStylesheet({":host":{position:"relative",width:"100%",height:"100%",display:"block",outline:"none"},':host([hibernated="true"])':{display:"contents"},".static":{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},".content":{position:"relative",display:"flex",width:"100%",height:"100%",gap:"var(--gap, 0px)"},':host([hibernated="true"]) .content':{display:"contents"},"::slotted(*)":{flexShrink:"0"}});exports.ScrollElement=class extends wt.CustomElement{constructor(){super(),l(this,N),l(this,U),l(this,mt),l(this,bt),l(this,rt),l(this,nt),l(this,Et),l(this,lt),l(this,a,null),l(this,C,new x.Attribute(this,"axis","y")),l(this,D,new x.Attribute(this,"pages",0,{validate:e=>Math.max(0,e-1)})),l(this,$,new x.Attribute(this,"split",!1)),l(this,I,new x.Attribute(this,"sectional",!1)),l(this,j,new x.Attribute(this,"wheel-max-delta",!1)),l(this,y,new x.Attribute(this,"infinite",!1)),l(this,G,new x.Attribute(this,"damping",.03)),l(this,tt,new x.Attribute(this,"disabled",!1)),l(this,et,new x.Attribute(this,"hibernated",!1)),l(this,u,null),l(this,dt,null),l(this,c,[]),l(this,st,0),l(this,it,0),l(this,_,0),l(this,f,0),l(this,L,0),l(this,k,null),l(this,F,null),l(this,w,new Vt.Store(0)),l(this,K,0),l(this,R,0),l(this,T,()=>{const e=this.currentScrollValue/t(this,f)||0;if(g(this,st,this.vertical?H.getCumulativeOffsetTop(this):H.getCumulativeOffsetLeft(this)),g(this,it,this.vertical?H.getCumulativeOffsetTop(t(this,u)):H.getCumulativeOffsetLeft(t(this,u))),g(this,_,this.vertical?this.offsetHeight:this.offsetWidth),t(this,D).current){g(this,f,t(this,_)*t(this,D).current);const s=t(this,f)+t(this,_);this.vertical?(t(this,u).style.width=s+"px",t(this,u).style.height="100%"):(t(this,u).style.height=s+"px",t(this,u).style.width="100%")}else this.vertical?(t(this,u).style.width="100%",t(this,u).style.height="max-content",g(this,f,t(this,u).offsetHeight-t(this,_))):(t(this,u).style.width="max-content",t(this,u).style.height="100%",g(this,f,t(this,u).offsetWidth-t(this,_)));if(g(this,L,It.cssUnitParser.parse(getComputedStyle(t(this,u)).gap)),!t(this,y).current){const s=getComputedStyle(this);g(this,f,t(this,f)+(this.vertical?parseFloat(s.paddingBlockStart)+parseFloat(s.paddingBlockEnd):parseFloat(s.paddingInlineStart)+parseFloat(s.paddingInlineEnd))),t(this,a).max=t(this,f)}if(t(this,c).forEach(s=>{s.resize(),s.transform()}),t(this,y).current&&t(this,c).length){const s=t(this,c)[t(this,c).length-1],r=s.position+s.size-t(this,_),n=t(this,f)-r;g(this,R,s.position+s.size+n)}else g(this,R,t(this,f));if(t(this,I).current&&t(this,c).length){const s=t(this,c)[t(this,w).current];t(this,a).set(s.position,!0)}else t(this,a).set(e*t(this,f),!0)}),l(this,vt,()=>{const e=this.currentScrollValue;if(g(this,K,Math.max(0,e-t(this,f))),t(this,c).length){let s=0;for(let r=0;r<t(this,c).length;r++){const n=t(this,c)[r];n.transform(),this.targetScrollValue+this.viewportSize/2>=n.position&&(s=r)}t(this,w).current=s}else this.vertical?t(this,u).style.transform=`translate3d(0px, ${e*-1}px, 0px)`:t(this,u).style.transform=`translate3d(${e*-1}px, 0px, 0px)`;B.scrollEntries.update(this,t(this,C).current,e)}),l(this,ht,e=>{if(typeof e=="number")if(t(this,I).current){const s=Math.sign(e);t(this,c).length?this.shiftSections(s):t(this,a).shift(s*t(this,_))}else t(this,a).shift(e);else e==="min"?t(this,a).set(t(this,a).min):e==="max"&&t(this,a).set(t(this,a).length)}),zt.isBrowser&&(g(this,a,new Tt.Damped(0,{damping:.01,min:0,order:yt.TICK_ORDER.SCROLL})),this.openShadow(Kt),q.element(this,{tabIndex:0,children:[q.div({class:"static",children:[q.slot({name:"static"})]}),q.div({class:"content",children:[q.slot({ref:e=>g(this,dt,e)})],style:{flexDirection:new Dt.Derived(t(this,C),e=>e==="x"?"row":"column")},ref:e=>g(this,u,e)})]}),g(this,k,new At.WheelControls({element:this})),t(this,k).changeEvent.subscribe(t(this,ht)),g(this,F,new At.KeyboardControls({element:this})),t(this,F).changeEvent.subscribe(t(this,ht)),t(this,C).subscribe(({current:e})=>{t(this,u).style.flexDirection=e==="x"?"row":"column",t(this,k).axis=t(this,j).current?"max":e,this.isConnected&&t(this,T).call(this)}),t(this,j).subscribe(e=>{t(this,k).axis=e.current?"max":t(this,C).current}),t(this,D).subscribe(()=>{this.isConnected&&t(this,T).call(this)}),t(this,$).subscribe(({current:e})=>{this.isConnected&&(e?m(this,N,gt).call(this):m(this,U,Q).call(this))}),t(this,I).subscribe(e=>{t(this,w).current=0,t(this,k).debounce=e.current,t(this,a).reset(),this.isConnected&&(e.current&&!e.previous?m(this,N,gt).call(this):!e.current&&e.previous&&m(this,U,Q).call(this))}),t(this,y).subscribe(e=>{e.current?(this.isConnected&&(t(this,c).length||(t(this,$).current=!0)),t(this,c).length&&(t(this,a).max=1/0,t(this,a).min=-1/0)):(g(this,K,0),t(this,a).max=t(this,f),t(this,a).min=0)}),t(this,G).subscribe(e=>{t(this,a).damping=e.current}),t(this,tt).subscribe(e=>{e.current&&!e.previous?m(this,mt,Wt).call(this):!e.current&&e.previous&&m(this,bt,Mt).call(this)}),t(this,et).subscribe(e=>{e.current&&!e.previous?m(this,rt,_t).call(this):!e.current&&e.previous&&m(this,nt,St).call(this)}))}get dampingAttribute(){return t(this,G)}get axisAttibute(){return t(this,C)}get pagesAttibute(){return t(this,D)}get splitAttibute(){return t(this,$)}get sectionalAttibute(){return t(this,I)}get infiniteAttribute(){return t(this,y)}get dampingAttibute(){return t(this,G)}get disabledAttibute(){return t(this,tt)}get hibernatedAttibute(){return t(this,et)}get currentScrollValue(){return m(this,lt,xt).call(this,"current")}get targetScrollValue(){return m(this,lt,xt).call(this,"target")}get contentElement(){return t(this,u)}get position(){return t(this,st)}get contentPosition(){return t(this,it)}get viewportSize(){return t(this,_)}get scrollSize(){return t(this,f)}get gap(){return t(this,L)}get counter(){return t(this,w)}get distance(){return t(this,R)}get overscroll(){return t(this,K)}get vertical(){return t(this,C).current==="y"}get currentProgress(){return this.currentScrollValue/t(this,R)||0}get targetProgress(){return this.targetScrollValue/t(this,R)||0}get speed(){return t(this,a).speed}get direction(){return t(this,a).direction}get isRunning(){return t(this,a).isRunning}onScroll(...e){return t(this,a).subscribe(...e)}offScroll(...e){t(this,a).unsubscribe(...e)}range(e,s,r=0){const n=e-r,p=n+s+r*2;return this.currentProgress<n?0:this.currentProgress>p?1:(this.currentProgress-n)/(p-n)}curve(e,s,r=0){return Math.sin(this.range(e,s,r)*Math.PI)}visible(e,s,r=0){const n=e-r,p=n+s+r*2;return this.currentProgress>=n&&this.currentProgress<=p}scrollToSection(e,s="smooth"){if(!t(this,c).length)return;const r=t(this,w).current;m(this,Et,Ot).call(this,e);const n=t(this,c)[r],p=t(this,c)[t(this,w).current];if(n&&p){let d=0;const Y=t(this,c).length-1;t(this,y).current?t(this,w).current===0&&r===Y?d=t(this,f)+t(this,_)-n.position+t(this,L):t(this,w).current===Y&&r===0?d=p.position-(t(this,f)+t(this,_)+t(this,L)):d=p.position-n.position:d=p.position-n.position,t(this,a).shift(d,s==="instant")}}shiftSections(e,s="smooth"){t(this,c).length&&this.scrollToSection(t(this,w).current+e,s)}setPosition(e,s="smooth"){t(this,a).set(e,s==="instant")}connectedCallback(){m(this,nt,St).call(this)}disconnectedCallback(){m(this,rt,_t).call(this)}};a=new WeakMap;C=new WeakMap;D=new WeakMap;$=new WeakMap;I=new WeakMap;j=new WeakMap;y=new WeakMap;G=new WeakMap;tt=new WeakMap;et=new WeakMap;u=new WeakMap;dt=new WeakMap;c=new WeakMap;st=new WeakMap;it=new WeakMap;_=new WeakMap;f=new WeakMap;L=new WeakMap;k=new WeakMap;F=new WeakMap;w=new WeakMap;K=new WeakMap;R=new WeakMap;N=new WeakSet;gt=function(){m(this,U,Q).call(this),t(this,dt).assignedElements().forEach(i=>{i instanceof HTMLElement&&t(this,c).push(new Gt(i,this))}),t(this,u).style.transform="",t(this,T).call(this)};U=new WeakSet;Q=function(){t(this,c).forEach(i=>{i.destroy()}),g(this,c,[])};mt=new WeakSet;Wt=function(){t(this,a).unsubscribe(t(this,vt)),t(this,a).stopAnimation(),t(this,k).disconnect(),t(this,F).disconnect()};bt=new WeakSet;Mt=function(){t(this,a).subscribe(t(this,vt)),t(this,k).connect(),t(this,F).connect()};rt=new WeakSet;_t=function(){ft.windowResizer.unsubscribe(t(this,T)),t(this,a).reset(),m(this,mt,Wt).call(this),t(this,u).style.transform="",t(this,$).current&&m(this,U,Q).call(this),B.scrollEntries.unregister(this)};nt=new WeakSet;St=function(){t(this,$).current&&m(this,N,gt).call(this),B.scrollEntries.register(this),ft.windowResizer.subscribe(t(this,T),yt.RESIZE_ORDER.SCROLL),m(this,bt,Mt).call(this)};T=new WeakMap;vt=new WeakMap;Et=new WeakSet;Ot=function(i){t(this,y).current?(t(this,w).current=i%t(this,c).length,t(this,w).current=t(this,w).current<0?t(this,c).length+t(this,w).current:t(this,w).current):t(this,w).current=Lt.clamp(i,0,t(this,c).length-1)};ht=new WeakMap;lt=new WeakSet;xt=function(i="current"){if(t(this,y).current&&t(this,c).length){const e=t(this,a)[i]%(t(this,f)+t(this,_)+t(this,L));return e<0?t(this,f)+e+t(this,_)+t(this,L):e}else return t(this,a)[i]};exports.ScrollElement=Ut([wt.define("e-scroll")],exports.ScrollElement);var X;class Zt extends wt.CustomElement{constructor(){super(...arguments);V(this,X,null)}get scrollElement(){return h(this,X)}connectedCallback(){const s=Ht.findParentElement(this,exports.ScrollElement);s instanceof exports.ScrollElement?O(this,X,s):console.error(this,"e-scroll not found")}}X=new WeakMap;var Jt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Qt=(i,e,s,r)=>{for(var n=r>1?void 0:r?Nt(e,s):e,p=i.length-1,d;p>=0;p--)(d=i[p])&&(n=(r?d(e,s,n):d(n))||n);return r&&n&&Jt(e,s,n),n},Rt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},o=(i,e,s)=>(Rt(i,e,"read from private field"),s?s.call(i):e.get(i)),E=(i,e,s)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,s)},M=(i,e,s,r)=>(Rt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),ot,v,A,z,Z,J,at,ct,ut,pt;const Xt=Pt.createStylesheet({":host":{display:"inline-block",zIndex:"1",backgroundColor:"#efefef"},':host([axis="y"])':{position:"absolute",right:"0",top:"0",width:"1vmin",height:"100%"},':host([axis="x"])':{position:"absolute",left:"0",bottom:"0",width:"100%",height:"1vmin"},".default-thumb":{backgroundColor:"#181818",borderRadius:"1vmin",touchAction:"none"},"::slotted(*)":{touchAction:"none"}});exports.ScrollbarElement=class extends Zt{constructor(){super(),E(this,ot,null),E(this,v,null),E(this,A,!1),E(this,z,0),E(this,Z,0),E(this,J,0),E(this,at,()=>{M(this,A,this.offsetWidth>this.offsetHeight);const e=o(this,A)?this.offsetWidth:this.offsetHeight;M(this,z,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),M(this,z,Math.max(o(this,z),30)),o(this,A)?(o(this,v).style.width=o(this,z)+"px",o(this,v).style.height="100%"):(o(this,v).style.width="100%",o(this,v).style.height=o(this,z)+"px"),M(this,Z,e-o(this,z)),this.scrollElement.scrollSize||(this.style.display="none")}),E(this,ct,()=>{M(this,J,this.scrollElement.currentProgress*o(this,Z)),o(this,A)?o(this,v).style.transform=`translate3d(${o(this,J)}px, 0px, 0px)`:o(this,v).style.transform=`translate3d(0px, ${o(this,J)}px, 0px)`}),E(this,ut,()=>{this.setAttribute("axis",this.scrollElement.axisAttibute.current)}),E(this,pt,e=>{const s=d=>{const Y=o(this,A)?d.x:d.y,qt=this.scrollElement.distance/o(this,Z),$t=(Y-p)*qt;this.scrollElement.setPosition(n+$t)},r=()=>{removeEventListener("pointermove",s),removeEventListener("pointerup",r),removeEventListener("touchend",r)};addEventListener("pointermove",s),addEventListener("pointerup",r),addEventListener("touchend",r);const n=this.scrollElement.targetScrollValue,p=o(this,A)?e.x:e.y}),zt.isBrowser&&(this.openShadow(Xt),q.element(this,{children:[q.slot({ref:e=>M(this,ot,e)})]}))}get thumbElement(){return o(this,v)}connectedCallback(){super.connectedCallback();const e=o(this,ot).assignedElements()[0];e instanceof HTMLElement?M(this,v,e):(M(this,v,document.createElement("div")),o(this,v).classList.add("default-thumb"),this.shadowRoot.appendChild(o(this,v))),o(this,v).addEventListener("pointerdown",o(this,pt)),ft.windowResizer.subscribe(o(this,at),yt.RESIZE_ORDER.SCROLL+1),this.scrollElement.onScroll(o(this,ct)),this.scrollElement.axisAttibute.subscribe(o(this,ut))}disconnectedCallback(){o(this,v).removeEventListener("pointerdown",o(this,pt)),ft.windowResizer.unsubscribe(o(this,at)),this.scrollElement.offScroll(o(this,ct)),this.scrollElement.axisAttibute.unsubscribe(o(this,ut))}};ot=new WeakMap;v=new WeakMap;A=new WeakMap;z=new WeakMap;Z=new WeakMap;J=new WeakMap;at=new WeakMap;ct=new WeakMap;ut=new WeakMap;pt=new WeakMap;exports.ScrollbarElement=Qt([wt.define("e-scrollbar")],exports.ScrollbarElement);
|