aptechka 0.4.0 → 0.4.2
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/abstract-elements/index.cjs +1 -1
- package/lib/abstract-elements/index.js +20 -17
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.d.ts +2 -0
- package/lib/attribute/index.js +34 -28
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.js +2 -1
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +53 -51
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +133 -133
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../custom-element/index.cjs");require("../Store-Dis8QUAR.cjs");const r=require("../browser-CpzFX2xg.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../custom-element/index.cjs");require("../Store-Dis8QUAR.cjs");const r=require("../browser-CpzFX2xg.cjs"),e=require("../tags-D3-tO-m6.cjs"),s=require("../createStylesheet-B4vLzvah.cjs"),n=s.createStylesheet({button:{all:"inherit"}});class o extends t.CustomElement{constructor(){super(),this.openShadow(n),r.isBrowser&&e.element(this,{children:[e.button({onClick:()=>{this.click()},children:[e.slot()]})]})}}exports.AbstractButtonElement=o;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { CustomElement as
|
|
1
|
+
import { CustomElement as t } from "../custom-element/index.js";
|
|
2
2
|
import "../Store-DdDuj5hz.js";
|
|
3
|
-
import { i as
|
|
4
|
-
import { e as r } from "../tags-D9nd9mMM.js";
|
|
5
|
-
|
|
3
|
+
import { i as e } from "../browser-0zX67oeU.js";
|
|
4
|
+
import { e as o, p as s, ay as r } from "../tags-D9nd9mMM.js";
|
|
5
|
+
import { c as i } from "../createStylesheet-CR-XQRVT.js";
|
|
6
|
+
const n = i({
|
|
7
|
+
button: {
|
|
8
|
+
all: "inherit"
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
class u extends t {
|
|
6
12
|
constructor() {
|
|
7
|
-
super(),
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onClick: () => {
|
|
17
|
-
this.click();
|
|
18
|
-
}
|
|
13
|
+
super(), this.openShadow(n), e && o(this, {
|
|
14
|
+
children: [
|
|
15
|
+
s({
|
|
16
|
+
onClick: () => {
|
|
17
|
+
this.click();
|
|
18
|
+
},
|
|
19
|
+
children: [r()]
|
|
20
|
+
})
|
|
21
|
+
]
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
export {
|
|
23
|
-
|
|
26
|
+
u as AbstractButtonElement
|
|
24
27
|
};
|
package/lib/attribute/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var v=(t,s,e)=>{if(!s.has(t))throw TypeError("Cannot "+e)};var r=(t,s,e)=>(v(t,s,"read from private field"),e?e.call(t):s.get(t)),n=(t,s,e)=>{if(s.has(t))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(t):s.set(t,e)},a=(t,s,e,b)=>(v(t,s,"write to private field"),b?b.call(t,e):s.set(t,e),e);var f=(t,s,e)=>(v(t,s,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../Store-Dis8QUAR.cjs"),A=require("../attributes-Bf2svn4j.cjs"),S=require("../browser-CpzFX2xg.cjs"),q=require("../dom-JBOkFLTh.cjs");var i,u,c,o,d;class p extends y.Store{constructor(e,b,g,h){super(g,h);n(this,o);n(this,i,null);n(this,u,void 0);n(this,c,null);a(this,u,b),S.isBrowser&&(a(this,i,q.getElement(e)),a(this,c,new MutationObserver(l=>{l.forEach(m=>{m.type==="attributes"&&m.attributeName===r(this,u)&&f(this,o,d).call(this)})})),h!=null&&h.sync&&this.subscribe(l=>{r(this,i).setAttribute(r(this,u),l.current.toString())}))}subscribe(e){const b=super.subscribe(e);return this.observe(),b}unsubscribe(e){super.unsubscribe(e),this.unobserve()}observe(){!this.subscribers.size&&(r(this,c).observe(r(this,i),{attributes:!0}),f(this,o,d).call(this))}unobserve(){this.subscribers.size||r(this,c).disconnect()}close(){super.close(),this.unobserve()}}i=new WeakMap,u=new WeakMap,c=new WeakMap,o=new WeakSet,d=function(){const e=r(this,i).getAttribute(r(this,u));e!=null&&(this.current=A.parseAttributeValue(e))};exports.Attribute=p;
|
package/lib/attribute/index.d.ts
CHANGED
|
@@ -9,5 +9,7 @@ export declare class Attribute<T extends string | number | boolean> extends Stor
|
|
|
9
9
|
constructor(elementOrSelector: ElementOrSelector, name: string, defaultValue: T, options?: AttributeOptions<T>);
|
|
10
10
|
subscribe(callback: StoreCallback<StoreEntry<T>>): () => void;
|
|
11
11
|
unsubscribe(callback: StoreCallback<StoreEntry<T>>): void;
|
|
12
|
+
observe(): void;
|
|
13
|
+
unobserve(): void;
|
|
12
14
|
close(): void;
|
|
13
15
|
}
|
package/lib/attribute/index.js
CHANGED
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
var
|
|
2
|
-
if (!
|
|
3
|
-
throw TypeError("Cannot " +
|
|
1
|
+
var v = (e, t, s) => {
|
|
2
|
+
if (!t.has(e))
|
|
3
|
+
throw TypeError("Cannot " + s);
|
|
4
4
|
};
|
|
5
|
-
var r = (
|
|
6
|
-
if (
|
|
5
|
+
var r = (e, t, s) => (v(e, t, "read from private field"), s ? s.call(e) : t.get(e)), h = (e, t, s) => {
|
|
6
|
+
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
var
|
|
8
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
9
|
+
}, a = (e, t, s, b) => (v(e, t, "write to private field"), b ? b.call(e, s) : t.set(e, s), s);
|
|
10
|
+
var f = (e, t, s) => (v(e, t, "access private method"), s);
|
|
11
11
|
import { S as g } from "../Store-DdDuj5hz.js";
|
|
12
12
|
import { p as A } from "../attributes-69we3byR.js";
|
|
13
13
|
import { i as y } from "../browser-0zX67oeU.js";
|
|
14
14
|
import { g as S } from "../dom-0S_WDL4g.js";
|
|
15
|
-
var i, u,
|
|
15
|
+
var i, u, c, o, l;
|
|
16
16
|
class B extends g {
|
|
17
|
-
constructor(
|
|
18
|
-
super(
|
|
19
|
-
h(this,
|
|
17
|
+
constructor(s, b, d, n) {
|
|
18
|
+
super(d, n);
|
|
19
|
+
h(this, o);
|
|
20
20
|
h(this, i, null);
|
|
21
21
|
h(this, u, void 0);
|
|
22
|
-
h(this,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
h(this, c, null);
|
|
23
|
+
a(this, u, b), y && (a(this, i, S(s)), a(this, c, new MutationObserver((m) => {
|
|
24
|
+
m.forEach((p) => {
|
|
25
|
+
p.type === "attributes" && p.attributeName === r(this, u) && f(this, o, l).call(this);
|
|
26
26
|
});
|
|
27
|
-
})),
|
|
28
|
-
r(this, i).setAttribute(r(this, u),
|
|
27
|
+
})), n != null && n.sync && this.subscribe((m) => {
|
|
28
|
+
r(this, i).setAttribute(r(this, u), m.current.toString());
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
|
-
subscribe(
|
|
32
|
-
const
|
|
33
|
-
return
|
|
31
|
+
subscribe(s) {
|
|
32
|
+
const b = super.subscribe(s);
|
|
33
|
+
return this.observe(), b;
|
|
34
|
+
}
|
|
35
|
+
unsubscribe(s) {
|
|
36
|
+
super.unsubscribe(s), this.unobserve();
|
|
37
|
+
}
|
|
38
|
+
observe() {
|
|
39
|
+
!this.subscribers.size && (r(this, c).observe(r(this, i), {
|
|
34
40
|
attributes: !0
|
|
35
|
-
}),
|
|
41
|
+
}), f(this, o, l).call(this));
|
|
36
42
|
}
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
unobserve() {
|
|
44
|
+
this.subscribers.size || r(this, c).disconnect();
|
|
39
45
|
}
|
|
40
46
|
close() {
|
|
41
|
-
super.close(),
|
|
47
|
+
super.close(), this.unobserve();
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
|
-
i = new WeakMap(), u = new WeakMap(),
|
|
45
|
-
const
|
|
46
|
-
|
|
50
|
+
i = new WeakMap(), u = new WeakMap(), c = new WeakMap(), o = new WeakSet(), l = function() {
|
|
51
|
+
const s = r(this, i).getAttribute(r(this, u));
|
|
52
|
+
s != null && (this.current = A(s));
|
|
47
53
|
};
|
|
48
54
|
export {
|
|
49
55
|
B as Attribute
|
package/lib/modal/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../custom-element/index.cjs");require("../Store-Dis8QUAR.cjs");const b=require("../browser-CpzFX2xg.cjs"),s=require("../tags-D3-tO-m6.cjs"),m=require("../createStylesheet-B4vLzvah.cjs"),g=require("../popover/index.cjs"),d=require("../theme/index.cjs");var w=Object.defineProperty,_=Object.getOwnPropertyDescriptor,y=(t,e,o,r)=>{for(var n=r>1?void 0:r?_(e,o):e,c=t.length-1,h;c>=0;c--)(h=t[c])&&(n=(r?h(e,o,n):h(n))||n);return r&&n&&w(e,o,n),n},p=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)},l=(t,e,o)=>(p(t,e,"read from private field"),o?o.call(t):e.get(t)),u=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},f=(t,e,o,r)=>(p(t,e,"write to private field"),r?r.call(t,o):e.set(t,o),o),i,a;const C=m.createStylesheet({":host":{position:"fixed",top:"0",left:"0",zIndex:"1",width:"100%",height:"100%",transitionProperty:"opacity",transitionDuration:d.aptechkaTheme.durationShort.var},":host::before":{content:'""',position:"fixed",top:"0",left:"0",zIndex:"-1",width:"100%",height:"100%",backgroundColor:"var(--backdrop, rgba(0, 0, 0, 0.8))"},".inner":{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden auto"},".overflow .inner":{alignItems:"flex-start"},".content":{position:"relative"},".close-button":{position:"absolute",top:"var(---close-button-top, 0.5em)",right:"var(---close-button-right, 0.5em)",background:"none",border:"none",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit"},".close-button-default":{width:"var(---close-button-size, 1.5em)",height:"var(---close-button-size, 1.5em)",display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"transform",transitionDuration:d.aptechkaTheme.durationShort.var,willChange:"transform"},".close-button:hover .close-button-default":{transform:"scale(0.9)"},".close-button:active .close-button-default":{transform:"scale(0.7)"},".close-button-default::before, .close-button-default::after":{content:'""',position:"absolute",width:"var(---close-button-thickness, 0.1em)",height:"100%",backgroundColor:`var(--close-button-color, ${d.aptechkaTheme.colorDark.var})`},".close-button-default::before":{transform:"rotate(-45deg)"},".close-button-default::after":{transform:"rotate(45deg)"}});exports.ModalElement=class extends g.PopoverElement{constructor(){super(),u(this,i,null),u(this,a,null),b.isBrowser&&(this.openShadow(C),s.element(this,{children:s.div({class:"inner",outside:!0,children:s.div({class:"content",children:[s.element("e-popover-button",{type:"close",target:this.id,class:"close-button",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../custom-element/index.cjs");require("../Store-Dis8QUAR.cjs");const b=require("../browser-CpzFX2xg.cjs"),s=require("../tags-D3-tO-m6.cjs"),m=require("../createStylesheet-B4vLzvah.cjs"),g=require("../popover/index.cjs"),d=require("../theme/index.cjs");var w=Object.defineProperty,_=Object.getOwnPropertyDescriptor,y=(t,e,o,r)=>{for(var n=r>1?void 0:r?_(e,o):e,c=t.length-1,h;c>=0;c--)(h=t[c])&&(n=(r?h(e,o,n):h(n))||n);return r&&n&&w(e,o,n),n},p=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)},l=(t,e,o)=>(p(t,e,"read from private field"),o?o.call(t):e.get(t)),u=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},f=(t,e,o,r)=>(p(t,e,"write to private field"),r?r.call(t,o):e.set(t,o),o),i,a;const C=m.createStylesheet({":host":{position:"fixed",top:"0",left:"0",zIndex:"1",width:"100%",height:"100%",transitionProperty:"opacity",transitionDuration:d.aptechkaTheme.durationShort.var},":host::before":{content:'""',position:"fixed",top:"0",left:"0",zIndex:"-1",width:"100%",height:"100%",backgroundColor:"var(--backdrop, rgba(0, 0, 0, 0.8))"},".inner":{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden auto"},".overflow .inner":{alignItems:"flex-start"},".content":{position:"relative"},".close-button":{position:"absolute",zIndex:"1",top:"var(---close-button-top, 0.5em)",right:"var(---close-button-right, 0.5em)",background:"none",border:"none",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit"},".close-button-default":{width:"var(---close-button-size, 1.5em)",height:"var(---close-button-size, 1.5em)",display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"transform",transitionDuration:d.aptechkaTheme.durationShort.var,willChange:"transform"},".close-button:hover .close-button-default":{transform:"scale(0.9)"},".close-button:active .close-button-default":{transform:"scale(0.7)"},".close-button-default::before, .close-button-default::after":{content:'""',position:"absolute",width:"var(---close-button-thickness, 0.1em)",height:"100%",backgroundColor:`var(--close-button-color, ${d.aptechkaTheme.colorDark.var})`},".close-button-default::before":{transform:"rotate(-45deg)"},".close-button-default::after":{transform:"rotate(45deg)"}});exports.ModalElement=class extends g.PopoverElement{constructor(){super(),u(this,i,null),u(this,a,null),b.isBrowser&&(this.openShadow(C),s.element(this,{children:s.div({class:"inner",outside:!0,children:s.div({class:"content",children:[s.element("e-popover-button",{type:"close",target:this.id,class:"close-button",lightChildren:[s.slot({name:"close-button",children:s.span({class:"close-button-default"})})]}),s.slot()]}),ref:e=>f(this,a,e)})}),f(this,i,new ResizeObserver(()=>{l(this,a).scrollHeight>l(this,a).clientHeight?this.classList.add("overflow"):this.classList.remove("overflow")})))}connectedCallback(){super.connectedCallback(),l(this,i).observe(this)}disconnectedCallback(){super.disconnectedCallback(),l(this,i).disconnect()}};i=new WeakMap;a=new WeakMap;exports.ModalElement=y([v.define("e-modal")],exports.ModalElement);
|
package/lib/modal/index.js
CHANGED
|
@@ -54,6 +54,7 @@ const P = y({
|
|
|
54
54
|
},
|
|
55
55
|
".close-button": {
|
|
56
56
|
position: "absolute",
|
|
57
|
+
zIndex: "1",
|
|
57
58
|
top: "var(---close-button-top, 0.5em)",
|
|
58
59
|
right: "var(---close-button-right, 0.5em)",
|
|
59
60
|
background: "none",
|
|
@@ -105,7 +106,7 @@ let m = class extends C {
|
|
|
105
106
|
type: "close",
|
|
106
107
|
target: this.id,
|
|
107
108
|
class: "close-button",
|
|
108
|
-
|
|
109
|
+
lightChildren: [
|
|
109
110
|
u({
|
|
110
111
|
name: "close-button",
|
|
111
112
|
children: _({ class: "close-button-default" })
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../attribute/index.cjs"),M=require("../custom-element/index.cjs"),A=require("../Store-Dis8QUAR.cjs"),q=require("../style-At6aDoqG.cjs"),x=require("../abstract-elements/index.cjs");var B=Object.defineProperty,D=Object.getOwnPropertyDescriptor,b=(t,e,s,i)=>{for(var n=i>1?void 0:i?D(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&B(e,s,n),n},W=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(W(t,e,"read from private field"),s?s.call(t):e.get(t)),o=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},k=(t,e,s,i)=>(W(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),$=(t,e,s)=>(W(t,e,"access private method"),s),P,a,E,h,u,_,S,C,v,m,w,y,g,L,f;exports.PopoverElement=class extends M.CustomElement{constructor(){super(...arguments),o(this,S),o(this,v),o(this,g),o(this,P,-1),o(this,a,new A.Store(!1)),o(this,E,void 0),o(this,h,new T.Attribute(this,"history",!1)),o(this,u,new T.Attribute(this,"single",!1)),o(this,_,!1),this.open=()=>{r(this,a).current||(r(this,a).current=!0,r(this,u).current&&(exports.PopoverElement.__opened.forEach(e=>e.close()),exports.PopoverElement.__opened=[]),exports.PopoverElement.__opened.push(this),k(this,P,exports.PopoverElement.__opened.length-1),r(this,h).current&&r(this,_)&&history.pushState("","",r(this,S,C)),clearTimeout(r(this,E)),this.classList.add("triggered"),this.style.display="block",setTimeout(()=>{addEventListener("click",r(this,w)),addEventListener("keydown",r(this,y)),this.style.opacity="1",this.classList.add("opened")}))},this.close=()=>{if(r(this,a).current){if(r(this,a).current=!1,exports.PopoverElement.__opened=exports.PopoverElement.__opened.filter(e=>e!==this),r(this,h).current){const e=new URL(location.href);e.searchParams.delete(r(this,v,m)),history.replaceState(null,"",e.href)}this.classList.remove("opened"),this.style.opacity="0",removeEventListener("click",r(this,w)),removeEventListener("keydown",r(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none"},q.getElementTransitionDurationMS(this))}},o(this,w,e=>{$(this,g,L).call(this,()=>{const s=e.composedPath();(!s.find(i=>i===this)&&!s.find(i=>i instanceof HTMLElement&&i.closest("e-popover-button"))||s[0]instanceof HTMLElement&&s[0].hasAttribute("outside"))&&this.close()})}),o(this,y,e=>{$(this,g,L).call(this,()=>{e.code==="Escape"&&this.close()})}),o(this,f,()=>{k(this,_,!1),r(this,a).current&&r(this,h).current&&!location.search.includes(r(this,v,m))?this.close():!r(this,a).current&&r(this,h).current&&location.search.includes(r(this,v,m))&&this.open(),k(this,_,!0)})}get history(){return r(this,h)}get single(){return r(this,u)}get opened(){return r(this,a)}connectedCallback(){r(this,h).observe(),r(this,u).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",r(this,f)),setTimeout(()=>{r(this,f).call(this)},0)}disconnectedCallback(){r(this,h).unobserve(),r(this,u).unobserve(),clearTimeout(r(this,E)),removeEventListener("popstate",r(this,f))}};P=new WeakMap;a=new WeakMap;E=new WeakMap;h=new WeakMap;u=new WeakMap;_=new WeakMap;S=new WeakSet;C=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${r(this,v,m)}`};v=new WeakSet;m=function(){return`modal-${this.id}`};w=new WeakMap;y=new WeakMap;g=new WeakSet;L=function(t){(exports.PopoverElement.__opened[r(this,P)-1]||exports.PopoverElement.__opened.length===1)&&t()};f=new WeakMap;exports.PopoverElement.__opened=[];exports.PopoverElement=b([M.define("e-popover")],exports.PopoverElement);var I=Object.defineProperty,N=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var n=i>1?void 0:i?N(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&I(e,s,n),n},O=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},d=(t,e,s)=>(O(t,e,"read from private field"),s?s.call(t):e.get(t)),H=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},R=(t,e,s,i)=>(O(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),l;exports.PopoverButtonElement=class extends x.AbstractButtonElement{constructor(){super(...arguments),H(this,l,void 0)}get popoverElement(){return d(this,l)}click(){if(d(this,l)){const e=this.getAttribute("type")||"open";e==="open"||e==="toggle"&&!d(this,l).opened.current?d(this,l).open():(e==="close"||e==="toggle"&&d(this,l).opened.current)&&d(this,l).close()}}connectedCallback(){const e=this.getAttribute("target");if(e){const s=document.querySelector(`#${e}`)||this.getRootNode().querySelector(`#${e}`);s?R(this,l,s):console.warn(this,`target ${e} not found`)}}};l=new WeakMap;exports.PopoverButtonElement=G([M.define("e-popover-button")],exports.PopoverButtonElement);
|
package/lib/popover/index.js
CHANGED
|
@@ -1,130 +1,132 @@
|
|
|
1
1
|
import { Attribute as T } from "../attribute/index.js";
|
|
2
|
-
import { CustomElement as
|
|
2
|
+
import { CustomElement as x, define as O } from "../custom-element/index.js";
|
|
3
3
|
import { S as I } from "../Store-DdDuj5hz.js";
|
|
4
4
|
import { g as N } from "../style-j2TwriJ_.js";
|
|
5
5
|
import { AbstractButtonElement as q } from "../abstract-elements/index.js";
|
|
6
6
|
var B = Object.defineProperty, G = Object.getOwnPropertyDescriptor, H = (e, t, s, r) => {
|
|
7
|
-
for (var n = r > 1 ? void 0 : r ? G(t, s) : t, p = e.length - 1,
|
|
8
|
-
(
|
|
7
|
+
for (var n = r > 1 ? void 0 : r ? G(t, s) : t, p = e.length - 1, d; p >= 0; p--)
|
|
8
|
+
(d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
|
|
9
9
|
return r && n && B(t, s, n), n;
|
|
10
|
-
},
|
|
10
|
+
}, $ = (e, t, s) => {
|
|
11
11
|
if (!t.has(e))
|
|
12
12
|
throw TypeError("Cannot " + s);
|
|
13
|
-
}, i = (e, t, s) => (
|
|
13
|
+
}, i = (e, t, s) => ($(e, t, "read from private field"), s ? s.call(e) : t.get(e)), o = (e, t, s) => {
|
|
14
14
|
if (t.has(e))
|
|
15
15
|
throw TypeError("Cannot add the same private member more than once");
|
|
16
16
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
17
|
-
}, S = (e, t, s, r) => (
|
|
18
|
-
let a = class extends
|
|
17
|
+
}, S = (e, t, s, r) => ($(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), C = (e, t, s) => ($(e, t, "access private method"), s), L, h, g, c, _, v, W, A, f, m, y, E, k, M, w;
|
|
18
|
+
let a = class extends x {
|
|
19
19
|
constructor() {
|
|
20
|
-
super(...arguments), o(this, W), o(this,
|
|
21
|
-
i(this, h).current || (i(this, h).current = !0, i(this,
|
|
20
|
+
super(...arguments), o(this, W), o(this, f), o(this, k), o(this, L, -1), o(this, h, new I(!1)), o(this, g, void 0), o(this, c, new T(this, "history", !1)), o(this, _, new T(this, "single", !1)), o(this, v, !1), this.open = () => {
|
|
21
|
+
i(this, h).current || (i(this, h).current = !0, i(this, _).current && (a.__opened.forEach((e) => e.close()), a.__opened = []), a.__opened.push(this), S(this, L, a.__opened.length - 1), i(this, c).current && i(this, v) && history.pushState("", "", i(this, W, A)), clearTimeout(i(this, g)), this.classList.add("triggered"), this.style.display = "block", setTimeout(() => {
|
|
22
22
|
addEventListener("click", i(this, y)), addEventListener("keydown", i(this, E)), this.style.opacity = "1", this.classList.add("opened");
|
|
23
23
|
}));
|
|
24
24
|
}, this.close = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.classList.remove("
|
|
31
|
-
|
|
25
|
+
if (i(this, h).current) {
|
|
26
|
+
if (i(this, h).current = !1, a.__opened = a.__opened.filter((e) => e !== this), i(this, c).current) {
|
|
27
|
+
const e = new URL(location.href);
|
|
28
|
+
e.searchParams.delete(i(this, f, m)), history.replaceState(null, "", e.href);
|
|
29
|
+
}
|
|
30
|
+
this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", i(this, y)), removeEventListener("keydown", i(this, E)), setTimeout(() => {
|
|
31
|
+
this.classList.remove("triggered"), this.style.display = "none";
|
|
32
|
+
}, N(this));
|
|
33
|
+
}
|
|
32
34
|
}, o(this, y, (e) => {
|
|
33
|
-
C(this, k,
|
|
35
|
+
C(this, k, M).call(this, () => {
|
|
34
36
|
const t = e.composedPath();
|
|
35
37
|
(!t.find((s) => s === this) && !t.find(
|
|
36
38
|
(s) => s instanceof HTMLElement && s.closest("e-popover-button")
|
|
37
39
|
) || t[0] instanceof HTMLElement && t[0].hasAttribute("outside")) && this.close();
|
|
38
40
|
});
|
|
39
41
|
}), o(this, E, (e) => {
|
|
40
|
-
C(this, k,
|
|
42
|
+
C(this, k, M).call(this, () => {
|
|
41
43
|
e.code === "Escape" && this.close();
|
|
42
44
|
});
|
|
43
|
-
}), o(this,
|
|
44
|
-
S(this,
|
|
45
|
+
}), o(this, w, () => {
|
|
46
|
+
S(this, v, !1), i(this, h).current && i(this, c).current && !location.search.includes(i(this, f, m)) ? this.close() : !i(this, h).current && i(this, c).current && location.search.includes(i(this, f, m)) && this.open(), S(this, v, !0);
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
get history() {
|
|
48
|
-
return i(this,
|
|
50
|
+
return i(this, c);
|
|
49
51
|
}
|
|
50
52
|
get single() {
|
|
51
|
-
return i(this,
|
|
53
|
+
return i(this, _);
|
|
52
54
|
}
|
|
53
55
|
get opened() {
|
|
54
56
|
return i(this, h);
|
|
55
57
|
}
|
|
56
58
|
connectedCallback() {
|
|
57
|
-
this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this,
|
|
58
|
-
i(this,
|
|
59
|
+
i(this, c).observe(), i(this, _).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, w)), setTimeout(() => {
|
|
60
|
+
i(this, w).call(this);
|
|
59
61
|
}, 0);
|
|
60
62
|
}
|
|
61
63
|
disconnectedCallback() {
|
|
62
|
-
clearTimeout(i(this, g)), removeEventListener("popstate", i(this,
|
|
64
|
+
i(this, c).unobserve(), i(this, _).unobserve(), clearTimeout(i(this, g)), removeEventListener("popstate", i(this, w));
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
67
|
L = /* @__PURE__ */ new WeakMap();
|
|
66
68
|
h = /* @__PURE__ */ new WeakMap();
|
|
67
69
|
g = /* @__PURE__ */ new WeakMap();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
c = /* @__PURE__ */ new WeakMap();
|
|
71
|
+
_ = /* @__PURE__ */ new WeakMap();
|
|
72
|
+
v = /* @__PURE__ */ new WeakMap();
|
|
71
73
|
W = /* @__PURE__ */ new WeakSet();
|
|
72
74
|
A = function() {
|
|
73
|
-
return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this,
|
|
75
|
+
return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this, f, m)}`;
|
|
74
76
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
f = /* @__PURE__ */ new WeakSet();
|
|
78
|
+
m = function() {
|
|
77
79
|
return `modal-${this.id}`;
|
|
78
80
|
};
|
|
79
81
|
y = /* @__PURE__ */ new WeakMap();
|
|
80
82
|
E = /* @__PURE__ */ new WeakMap();
|
|
81
83
|
k = /* @__PURE__ */ new WeakSet();
|
|
82
|
-
|
|
84
|
+
M = function(e) {
|
|
83
85
|
(a.__opened[i(this, L) - 1] || a.__opened.length === 1) && e();
|
|
84
86
|
};
|
|
85
|
-
|
|
87
|
+
w = /* @__PURE__ */ new WeakMap();
|
|
86
88
|
a.__opened = [];
|
|
87
89
|
a = H([
|
|
88
|
-
|
|
90
|
+
O("e-popover")
|
|
89
91
|
], a);
|
|
90
|
-
var R = Object.defineProperty,
|
|
91
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
92
|
-
(
|
|
92
|
+
var R = Object.defineProperty, U = Object.getOwnPropertyDescriptor, z = (e, t, s, r) => {
|
|
93
|
+
for (var n = r > 1 ? void 0 : r ? U(t, s) : t, p = e.length - 1, d; p >= 0; p--)
|
|
94
|
+
(d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
|
|
93
95
|
return r && n && R(t, s, n), n;
|
|
94
|
-
},
|
|
96
|
+
}, D = (e, t, s) => {
|
|
95
97
|
if (!t.has(e))
|
|
96
98
|
throw TypeError("Cannot " + s);
|
|
97
|
-
},
|
|
99
|
+
}, u = (e, t, s) => (D(e, t, "read from private field"), s ? s.call(e) : t.get(e)), F = (e, t, s) => {
|
|
98
100
|
if (t.has(e))
|
|
99
101
|
throw TypeError("Cannot add the same private member more than once");
|
|
100
102
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
101
|
-
},
|
|
102
|
-
let
|
|
103
|
+
}, J = (e, t, s, r) => (D(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), l;
|
|
104
|
+
let P = class extends q {
|
|
103
105
|
constructor() {
|
|
104
|
-
super(...arguments),
|
|
106
|
+
super(...arguments), F(this, l, void 0);
|
|
105
107
|
}
|
|
106
108
|
get popoverElement() {
|
|
107
|
-
return
|
|
109
|
+
return u(this, l);
|
|
108
110
|
}
|
|
109
111
|
click() {
|
|
110
|
-
if (
|
|
112
|
+
if (u(this, l)) {
|
|
111
113
|
const e = this.getAttribute("type") || "open";
|
|
112
|
-
e === "open" || e === "toggle" && !
|
|
114
|
+
e === "open" || e === "toggle" && !u(this, l).opened.current ? u(this, l).open() : (e === "close" || e === "toggle" && u(this, l).opened.current) && u(this, l).close();
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
connectedCallback() {
|
|
116
118
|
const e = this.getAttribute("target");
|
|
117
119
|
if (e) {
|
|
118
120
|
const t = document.querySelector(`#${e}`) || this.getRootNode().querySelector(`#${e}`);
|
|
119
|
-
t ?
|
|
121
|
+
t ? J(this, l, t) : console.warn(this, `target ${e} not found`);
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
],
|
|
125
|
+
l = /* @__PURE__ */ new WeakMap();
|
|
126
|
+
P = z([
|
|
127
|
+
O("e-popover-button")
|
|
128
|
+
], P);
|
|
127
129
|
export {
|
|
128
|
-
|
|
130
|
+
P as PopoverButtonElement,
|
|
129
131
|
a as PopoverElement
|
|
130
132
|
};
|
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)),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);
|
|
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)),H=(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)},$=(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"),G=require("../layout-8ryRAMGJ.cjs"),Lt=require("../math-GDWEqu7y.cjs");require("../ticker/index.cjs");const k=require("../attribute/index.cjs"),At=require("../WheelControls-fiz52vcl.cjs"),vt=require("../custom-element/index.cjs"),yt=require("../order/index.cjs"),ft=require("../window-resizer/index.cjs"),K=require("../scroll-entries/index.cjs"),D=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)},b=(i,e,s,r)=>(kt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),g=(i,e,s)=>(kt(i,e,"access private method"),s),a,y,z,W,L,B,E,T,F,U,u,dt,c,st,it,_,f,R,M,Z,v,N,V,Y,bt,J,j,gt,Wt,mt,Mt,rt,_t,nt,St,I,wt,Et,Ot,ht,lt,xt,S,m,q,C;class Gt{constructor(e,s){H(this,S,void 0);H(this,m,void 0);H(this,q,0);H(this,C,0);$(this,S,e),$(this,m,s),K.scrollEntries.register(h(this,S))}get size(){return h(this,q)}get position(){return h(this,C)}destroy(){K.scrollEntries.unregister(h(this,S)),h(this,S).style.transform=""}resize(){$(this,q,h(this,m).vertical?h(this,S).offsetHeight:h(this,S).offsetWidth),$(this,C,h(this,m).vertical?G.getCumulativeOffsetTop(h(this,S)):G.getCumulativeOffsetLeft(h(this,S))),$(this,C,h(this,C)-h(this,m).contentPosition)}transform(){let e=0;const s=h(this,m).viewportSize-h(this,q);h(this,m).infiniteAttribute.current&&h(this,m).overscroll&&h(this,C)+h(this,q)<h(this,m).currentScrollValue&&(e=h(this,m).distance*-1-h(this,m).gap),K.scrollEntries.update(h(this,S),h(this,m).axisAttibute.current,e);const r=h(this,m).currentScrollValue+e,n=h(this,C)-h(this,m).viewportSize-s,p=h(this,C)+h(this,q)+s,d=Lt.clamp(r,n,p);h(this,m).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,m=new WeakMap,q=new WeakMap,C=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 vt.CustomElement{constructor(){super(),l(this,Y),l(this,J),l(this,gt),l(this,mt),l(this,rt),l(this,nt),l(this,Et),l(this,lt),l(this,a,null),l(this,y,new k.Attribute(this,"axis","y")),l(this,z,new k.Attribute(this,"pages",0,{validate:e=>Math.max(0,e-1)})),l(this,W,new k.Attribute(this,"split",!1)),l(this,L,new k.Attribute(this,"sectional",!1)),l(this,B,new k.Attribute(this,"wheel-max-delta",!1)),l(this,E,new k.Attribute(this,"infinite",!1)),l(this,T,new k.Attribute(this,"damping",.03)),l(this,F,new k.Attribute(this,"disabled",!1)),l(this,U,new k.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,R,0),l(this,M,null),l(this,Z,null),l(this,v,new Vt.Store(0)),l(this,N,0),l(this,V,0),l(this,I,()=>{const e=this.currentScrollValue/t(this,f)||0;if(b(this,st,this.vertical?G.getCumulativeOffsetTop(this):G.getCumulativeOffsetLeft(this)),b(this,it,this.vertical?G.getCumulativeOffsetTop(t(this,u)):G.getCumulativeOffsetLeft(t(this,u))),b(this,_,this.vertical?this.offsetHeight:this.offsetWidth),t(this,z).current){b(this,f,t(this,_)*t(this,z).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",b(this,f,t(this,u).offsetHeight-t(this,_))):(t(this,u).style.width="max-content",t(this,u).style.height="100%",b(this,f,t(this,u).offsetWidth-t(this,_)));if(b(this,R,It.cssUnitParser.parse(getComputedStyle(t(this,u)).gap)),!t(this,E).current){const s=getComputedStyle(this);b(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,E).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;b(this,V,s.position+s.size+n)}else b(this,V,t(this,f));if(t(this,L).current&&t(this,c).length){const s=t(this,c)[t(this,v).current];t(this,a).set(s.position,!0)}else t(this,a).set(e*t(this,f),!0)}),l(this,wt,()=>{const e=this.currentScrollValue;if(b(this,N,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,v).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)`;K.scrollEntries.update(this,t(this,y).current,e)}),l(this,ht,e=>{if(typeof e=="number")if(t(this,L).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&&(b(this,a,new Tt.Damped(0,{damping:.01,min:0,order:yt.TICK_ORDER.SCROLL})),this.openShadow(Kt),D.element(this,{tabIndex:0,children:[D.div({class:"static",children:[D.slot({name:"static"})]}),D.div({class:"content",children:[D.slot({ref:e=>b(this,dt,e)})],style:{flexDirection:new Dt.Derived(t(this,y),e=>e==="x"?"row":"column")},ref:e=>b(this,u,e)})]}),b(this,M,new At.WheelControls({element:this})),t(this,M).changeEvent.subscribe(t(this,ht)),b(this,Z,new At.KeyboardControls({element:this})),t(this,Z).changeEvent.subscribe(t(this,ht)),t(this,y).subscribe(({current:e})=>{t(this,u).style.flexDirection=e==="x"?"row":"column",t(this,M).axis=t(this,B).current?"max":e,this.isConnected&&t(this,I).call(this)}),t(this,B).subscribe(e=>{t(this,M).axis=e.current?"max":t(this,y).current}),t(this,z).subscribe(()=>{this.isConnected&&t(this,I).call(this)}),t(this,W).subscribe(({current:e})=>{this.isConnected&&(e?g(this,Y,bt).call(this):g(this,J,j).call(this))}),t(this,L).subscribe(e=>{t(this,v).current=0,t(this,M).debounce=e.current,t(this,a).reset(),this.isConnected&&(e.current&&!e.previous?g(this,Y,bt).call(this):!e.current&&e.previous&&g(this,J,j).call(this))}),t(this,E).subscribe(e=>{e.current?(this.isConnected&&(t(this,c).length||(t(this,W).current=!0)),t(this,c).length&&(t(this,a).max=1/0,t(this,a).min=-1/0)):(b(this,N,0),t(this,a).max=t(this,f),t(this,a).min=0)}),t(this,T).subscribe(e=>{t(this,a).damping=e.current}),t(this,F).subscribe(e=>{e.current&&!e.previous?g(this,gt,Wt).call(this):!e.current&&e.previous&&g(this,mt,Mt).call(this)}),t(this,U).subscribe(e=>{e.current&&!e.previous?g(this,rt,_t).call(this):!e.current&&e.previous&&g(this,nt,St).call(this)}))}get dampingAttribute(){return t(this,T)}get axisAttibute(){return t(this,y)}get pagesAttibute(){return t(this,z)}get splitAttibute(){return t(this,W)}get sectionalAttibute(){return t(this,L)}get infiniteAttribute(){return t(this,E)}get dampingAttibute(){return t(this,T)}get disabledAttibute(){return t(this,F)}get hibernatedAttibute(){return t(this,U)}get currentScrollValue(){return g(this,lt,xt).call(this,"current")}get targetScrollValue(){return g(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,R)}get counter(){return t(this,v)}get distance(){return t(this,V)}get overscroll(){return t(this,N)}get vertical(){return t(this,y).current==="y"}get currentProgress(){return this.currentScrollValue/t(this,V)||0}get targetProgress(){return this.targetScrollValue/t(this,V)||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,v).current;g(this,Et,Ot).call(this,e);const n=t(this,c)[r],p=t(this,c)[t(this,v).current];if(n&&p){let d=0;const et=t(this,c).length-1;t(this,E).current?t(this,v).current===0&&r===et?d=t(this,f)+t(this,_)-n.position+t(this,R):t(this,v).current===et&&r===0?d=p.position-(t(this,f)+t(this,_)+t(this,R)):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,v).current+e,s)}setPosition(e,s="smooth"){t(this,a).set(e,s==="instant")}connectedCallback(){t(this,y).observe(),t(this,z).observe(),t(this,W).observe(),t(this,L).observe(),t(this,B).observe(),t(this,E).observe(),t(this,T).observe(),t(this,F).observe(),t(this,U).observe(),g(this,nt,St).call(this)}disconnectedCallback(){t(this,y).unobserve(),t(this,z).unobserve(),t(this,W).unobserve(),t(this,L).unobserve(),t(this,B).unobserve(),t(this,E).unobserve(),t(this,T).unobserve(),t(this,F).unobserve(),t(this,U).unobserve(),g(this,rt,_t).call(this)}};a=new WeakMap;y=new WeakMap;z=new WeakMap;W=new WeakMap;L=new WeakMap;B=new WeakMap;E=new WeakMap;T=new WeakMap;F=new WeakMap;U=new WeakMap;u=new WeakMap;dt=new WeakMap;c=new WeakMap;st=new WeakMap;it=new WeakMap;_=new WeakMap;f=new WeakMap;R=new WeakMap;M=new WeakMap;Z=new WeakMap;v=new WeakMap;N=new WeakMap;V=new WeakMap;Y=new WeakSet;bt=function(){g(this,J,j).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,I).call(this)};J=new WeakSet;j=function(){t(this,c).forEach(i=>{i.destroy()}),b(this,c,[])};gt=new WeakSet;Wt=function(){t(this,a).unsubscribe(t(this,wt)),t(this,a).stopAnimation(),t(this,M).disconnect(),t(this,Z).disconnect()};mt=new WeakSet;Mt=function(){t(this,a).subscribe(t(this,wt)),t(this,M).connect(),t(this,Z).connect()};rt=new WeakSet;_t=function(){ft.windowResizer.unsubscribe(t(this,I)),t(this,a).reset(),g(this,gt,Wt).call(this),t(this,u).style.transform="",t(this,W).current&&g(this,J,j).call(this),K.scrollEntries.unregister(this)};nt=new WeakSet;St=function(){t(this,W).current&&g(this,Y,bt).call(this),K.scrollEntries.register(this),ft.windowResizer.subscribe(t(this,I),yt.RESIZE_ORDER.SCROLL),g(this,mt,Mt).call(this)};I=new WeakMap;wt=new WeakMap;Et=new WeakSet;Ot=function(i){t(this,E).current?(t(this,v).current=i%t(this,c).length,t(this,v).current=t(this,v).current<0?t(this,c).length+t(this,v).current:t(this,v).current):t(this,v).current=Lt.clamp(i,0,t(this,c).length-1)};ht=new WeakMap;lt=new WeakSet;xt=function(i="current"){if(t(this,E).current&&t(this,c).length){const e=t(this,a)[i]%(t(this,f)+t(this,_)+t(this,R));return e<0?t(this,f)+e+t(this,_)+t(this,R):e}else return t(this,a)[i]};exports.ScrollElement=Ut([vt.define("e-scroll")],exports.ScrollElement);var tt;class Zt extends vt.CustomElement{constructor(){super(...arguments);H(this,tt,null)}get scrollElement(){return h(this,tt)}connectedCallback(){const s=Ht.findParentElement(this,exports.ScrollElement);s instanceof exports.ScrollElement?$(this,tt,s):console.error(this,"e-scroll not found")}}tt=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)),x=(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)},A=(i,e,s,r)=>(Rt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),ot,w,P,O,Q,X,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(),x(this,ot,null),x(this,w,null),x(this,P,!1),x(this,O,0),x(this,Q,0),x(this,X,0),x(this,at,()=>{A(this,P,this.offsetWidth>this.offsetHeight);const e=o(this,P)?this.offsetWidth:this.offsetHeight;A(this,O,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),A(this,O,Math.max(o(this,O),30)),o(this,P)?(o(this,w).style.width=o(this,O)+"px",o(this,w).style.height="100%"):(o(this,w).style.width="100%",o(this,w).style.height=o(this,O)+"px"),A(this,Q,e-o(this,O)),this.scrollElement.scrollSize||(this.style.display="none")}),x(this,ct,()=>{A(this,X,this.scrollElement.currentProgress*o(this,Q)),o(this,P)?o(this,w).style.transform=`translate3d(${o(this,X)}px, 0px, 0px)`:o(this,w).style.transform=`translate3d(0px, ${o(this,X)}px, 0px)`}),x(this,ut,()=>{this.setAttribute("axis",this.scrollElement.axisAttibute.current)}),x(this,pt,e=>{const s=d=>{const et=o(this,P)?d.x:d.y,qt=this.scrollElement.distance/o(this,Q),$t=(et-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,P)?e.x:e.y}),zt.isBrowser&&(this.openShadow(Xt),D.element(this,{children:[D.slot({ref:e=>A(this,ot,e)})]}))}get thumbElement(){return o(this,w)}connectedCallback(){super.connectedCallback();const e=o(this,ot).assignedElements()[0];e instanceof HTMLElement?A(this,w,e):(A(this,w,document.createElement("div")),o(this,w).classList.add("default-thumb"),this.shadowRoot.appendChild(o(this,w))),o(this,w).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,w).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;w=new WeakMap;P=new WeakMap;O=new WeakMap;Q=new WeakMap;X=new WeakMap;at=new WeakMap;ct=new WeakMap;ut=new WeakMap;pt=new WeakMap;exports.ScrollbarElement=Qt([vt.define("e-scrollbar")],exports.ScrollbarElement);
|
package/lib/scroll/index.js
CHANGED
|
@@ -2,31 +2,31 @@ var Mt = (e, s, i) => {
|
|
|
2
2
|
if (!s.has(e))
|
|
3
3
|
throw TypeError("Cannot " + i);
|
|
4
4
|
};
|
|
5
|
-
var n = (e, s, i) => (Mt(e, s, "read from private field"), i ? i.call(e) : s.get(e)),
|
|
5
|
+
var n = (e, s, i) => (Mt(e, s, "read from private field"), i ? i.call(e) : s.get(e)), H = (e, s, i) => {
|
|
6
6
|
if (s.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
s instanceof WeakSet ? s.add(e) : s.set(e, i);
|
|
9
|
-
},
|
|
9
|
+
}, D = (e, s, i, r) => (Mt(e, s, "write to private field"), r ? r.call(e, i) : s.set(e, i), i);
|
|
10
10
|
import { D as Ft } from "../Damped-Do9H-LKf.js";
|
|
11
11
|
import { S as Bt } from "../Store-DdDuj5hz.js";
|
|
12
12
|
import { D as Kt } from "../Derived-Dbjm-dob.js";
|
|
13
13
|
import { i as Lt } from "../browser-0zX67oeU.js";
|
|
14
|
-
import { a as
|
|
14
|
+
import { a as bt, g as vt } from "../layout-HoBT_Da2.js";
|
|
15
15
|
import { c as Pt } from "../math-BOBiC4TN.js";
|
|
16
16
|
import "../ticker/index.js";
|
|
17
|
-
import { Attribute as
|
|
17
|
+
import { Attribute as W } from "../attribute/index.js";
|
|
18
18
|
import { W as Gt, K as Ut } from "../WheelControls-BqO_fTyY.js";
|
|
19
19
|
import { CustomElement as zt, define as $t } from "../custom-element/index.js";
|
|
20
20
|
import { TICK_ORDER as Zt, RESIZE_ORDER as Ot } from "../order/index.js";
|
|
21
21
|
import { windowResizer as ct } from "../window-resizer/index.js";
|
|
22
|
-
import { scrollEntries as
|
|
23
|
-
import { e as Vt, D as Ct, ay as
|
|
22
|
+
import { scrollEntries as G } from "../scroll-entries/index.js";
|
|
23
|
+
import { e as Vt, D as Ct, ay as wt } from "../tags-D9nd9mMM.js";
|
|
24
24
|
import { c as Dt } from "../createStylesheet-CR-XQRVT.js";
|
|
25
25
|
import { cssUnitParser as qt } from "../css-unit-parser/index.js";
|
|
26
26
|
import { f as Jt } from "../dom-0S_WDL4g.js";
|
|
27
27
|
var Nt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, Xt = (e, s, i, r) => {
|
|
28
|
-
for (var a = r > 1 ? void 0 : r ? Qt(s, i) : s, f = e.length - 1,
|
|
29
|
-
(
|
|
28
|
+
for (var a = r > 1 ? void 0 : r ? Qt(s, i) : s, f = e.length - 1, v; f >= 0; f--)
|
|
29
|
+
(v = e[f]) && (a = (r ? v(s, i, a) : v(a)) || a);
|
|
30
30
|
return r && a && Nt(s, i, a), a;
|
|
31
31
|
}, Et = (e, s, i) => {
|
|
32
32
|
if (!s.has(e))
|
|
@@ -35,40 +35,40 @@ var Nt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, Xt = (e, s
|
|
|
35
35
|
if (s.has(e))
|
|
36
36
|
throw TypeError("Cannot add the same private member more than once");
|
|
37
37
|
s instanceof WeakSet ? s.add(e) : s.set(e, i);
|
|
38
|
-
}, d = (e, s, i, r) => (Et(e, s, "write to private field"), r ? r.call(e, i) : s.set(e, i), i), m = (e, s, i) => (Et(e, s, "access private method"), i), l,
|
|
38
|
+
}, d = (e, s, i, r) => (Et(e, s, "write to private field"), r ? r.call(e, i) : s.set(e, i), i), m = (e, s, i) => (Et(e, s, "access private method"), i), l, E, L, y, P, F, x, R, B, K, u, ut, c, j, tt, _, p, O, M, U, b, q, T, Q, pt, Z, X, ft, Wt, dt, yt, et, _t, st, St, I, gt, xt, Rt, it, rt, kt, S, g, V, C;
|
|
39
39
|
class Yt {
|
|
40
40
|
constructor(s, i) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
H(this, S, void 0);
|
|
42
|
+
H(this, g, void 0);
|
|
43
|
+
H(this, V, 0);
|
|
44
|
+
H(this, C, 0);
|
|
45
|
+
D(this, S, s), D(this, g, i), G.register(n(this, S));
|
|
46
46
|
}
|
|
47
47
|
get size() {
|
|
48
|
-
return n(this,
|
|
48
|
+
return n(this, V);
|
|
49
49
|
}
|
|
50
50
|
get position() {
|
|
51
|
-
return n(this,
|
|
51
|
+
return n(this, C);
|
|
52
52
|
}
|
|
53
53
|
destroy() {
|
|
54
|
-
|
|
54
|
+
G.unregister(n(this, S)), n(this, S).style.transform = "";
|
|
55
55
|
}
|
|
56
56
|
resize() {
|
|
57
|
-
|
|
57
|
+
D(this, V, n(this, g).vertical ? n(this, S).offsetHeight : n(this, S).offsetWidth), D(this, C, n(this, g).vertical ? bt(n(this, S)) : vt(n(this, S))), D(this, C, n(this, C) - n(this, g).contentPosition);
|
|
58
58
|
}
|
|
59
59
|
transform() {
|
|
60
60
|
let s = 0;
|
|
61
|
-
const i = n(this, g).viewportSize - n(this,
|
|
62
|
-
n(this, g).infiniteAttribute.current && n(this, g).overscroll && n(this,
|
|
61
|
+
const i = n(this, g).viewportSize - n(this, V);
|
|
62
|
+
n(this, g).infiniteAttribute.current && n(this, g).overscroll && n(this, C) + n(this, V) < n(this, g).currentScrollValue && (s = n(this, g).distance * -1 - n(this, g).gap), G.update(
|
|
63
63
|
n(this, S),
|
|
64
64
|
n(this, g).axisAttibute.current,
|
|
65
65
|
s
|
|
66
66
|
);
|
|
67
|
-
const r = n(this, g).currentScrollValue + s, a = n(this,
|
|
68
|
-
n(this, g).vertical ? n(this, S).style.transform = `translate3d(0px, ${
|
|
67
|
+
const r = n(this, g).currentScrollValue + s, a = n(this, C) - n(this, g).viewportSize - i, f = n(this, C) + n(this, V) + i, v = Pt(r, a, f);
|
|
68
|
+
n(this, g).vertical ? n(this, S).style.transform = `translate3d(0px, ${v * -1}px, 0px)` : n(this, S).style.transform = `translate3d(${v * -1}px, 0px, 0px)`;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
S = new WeakMap(), g = new WeakMap(),
|
|
71
|
+
S = new WeakMap(), g = new WeakMap(), V = new WeakMap(), C = new WeakMap();
|
|
72
72
|
const jt = Dt({
|
|
73
73
|
":host": {
|
|
74
74
|
position: "relative",
|
|
@@ -103,52 +103,52 @@ const jt = Dt({
|
|
|
103
103
|
});
|
|
104
104
|
let mt = class extends zt {
|
|
105
105
|
constructor() {
|
|
106
|
-
super(), h(this,
|
|
106
|
+
super(), h(this, Q), h(this, Z), h(this, ft), h(this, dt), h(this, et), h(this, st), h(this, xt), h(this, rt), h(this, l, null), h(this, E, new W(this, "axis", "y")), h(this, L, new W(this, "pages", 0, {
|
|
107
107
|
validate: (e) => Math.max(0, e - 1)
|
|
108
|
-
})), h(this,
|
|
108
|
+
})), h(this, y, new W(this, "split", !1)), h(this, P, new W(this, "sectional", !1)), h(this, F, new W(
|
|
109
109
|
this,
|
|
110
110
|
"wheel-max-delta",
|
|
111
111
|
!1
|
|
112
|
-
)), h(this,
|
|
112
|
+
)), h(this, x, new W(this, "infinite", !1)), h(this, R, new W(this, "damping", 0.03)), h(this, B, new W(this, "disabled", !1)), h(this, K, new W(this, "hibernated", !1)), h(this, u, null), h(this, ut, null), h(this, c, []), h(this, j, 0), h(this, tt, 0), h(this, _, 0), h(this, p, 0), h(this, O, 0), h(this, M, null), h(this, U, null), h(this, b, new Bt(0)), h(this, q, 0), h(this, T, 0), h(this, I, () => {
|
|
113
113
|
const e = this.currentScrollValue / t(this, p) || 0;
|
|
114
|
-
if (d(this, j, this.vertical ?
|
|
115
|
-
d(this, p, t(this, _) * t(this,
|
|
114
|
+
if (d(this, j, this.vertical ? bt(this) : vt(this)), d(this, tt, this.vertical ? bt(t(this, u)) : vt(t(this, u))), d(this, _, this.vertical ? this.offsetHeight : this.offsetWidth), t(this, L).current) {
|
|
115
|
+
d(this, p, t(this, _) * t(this, L).current);
|
|
116
116
|
const s = t(this, p) + t(this, _);
|
|
117
117
|
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%");
|
|
118
118
|
} else
|
|
119
119
|
this.vertical ? (t(this, u).style.width = "100%", t(this, u).style.height = "max-content", d(this, p, t(this, u).offsetHeight - t(this, _))) : (t(this, u).style.width = "max-content", t(this, u).style.height = "100%", d(this, p, t(this, u).offsetWidth - t(this, _)));
|
|
120
|
-
if (d(this,
|
|
120
|
+
if (d(this, O, qt.parse(getComputedStyle(t(this, u)).gap)), !t(this, x).current) {
|
|
121
121
|
const s = getComputedStyle(this);
|
|
122
122
|
d(this, p, t(this, p) + (this.vertical ? parseFloat(s.paddingBlockStart) + parseFloat(s.paddingBlockEnd) : parseFloat(s.paddingInlineStart) + parseFloat(s.paddingInlineEnd))), t(this, l).max = t(this, p);
|
|
123
123
|
}
|
|
124
124
|
if (t(this, c).forEach((s) => {
|
|
125
125
|
s.resize(), s.transform();
|
|
126
|
-
}), t(this,
|
|
126
|
+
}), t(this, x).current && t(this, c).length) {
|
|
127
127
|
const s = t(this, c)[t(this, c).length - 1], i = s.position + s.size - t(this, _), r = t(this, p) - i;
|
|
128
|
-
d(this,
|
|
128
|
+
d(this, T, s.position + s.size + r);
|
|
129
129
|
} else
|
|
130
|
-
d(this,
|
|
131
|
-
if (t(this,
|
|
132
|
-
const s = t(this, c)[t(this,
|
|
130
|
+
d(this, T, t(this, p));
|
|
131
|
+
if (t(this, P).current && t(this, c).length) {
|
|
132
|
+
const s = t(this, c)[t(this, b).current];
|
|
133
133
|
t(this, l).set(s.position, !0);
|
|
134
134
|
} else
|
|
135
135
|
t(this, l).set(e * t(this, p), !0);
|
|
136
136
|
}), h(this, gt, () => {
|
|
137
137
|
const e = this.currentScrollValue;
|
|
138
|
-
if (d(this,
|
|
138
|
+
if (d(this, q, Math.max(0, e - t(this, p))), t(this, c).length) {
|
|
139
139
|
let s = 0;
|
|
140
140
|
for (let i = 0; i < t(this, c).length; i++) {
|
|
141
141
|
const r = t(this, c)[i];
|
|
142
142
|
r.transform(), // this.targetScrollValue + this.viewportSize / 2 >=
|
|
143
143
|
this.targetScrollValue + this.viewportSize / 2 >= r.position && (s = i);
|
|
144
144
|
}
|
|
145
|
-
t(this,
|
|
145
|
+
t(this, b).current = s;
|
|
146
146
|
} else
|
|
147
147
|
this.vertical ? t(this, u).style.transform = `translate3d(0px, ${e * -1}px, 0px)` : t(this, u).style.transform = `translate3d(${e * -1}px, 0px, 0px)`;
|
|
148
|
-
|
|
148
|
+
G.update(this, t(this, E).current, e);
|
|
149
149
|
}), h(this, it, (e) => {
|
|
150
150
|
if (typeof e == "number")
|
|
151
|
-
if (t(this,
|
|
151
|
+
if (t(this, P).current) {
|
|
152
152
|
const s = Math.sign(e);
|
|
153
153
|
t(this, c).length ? this.shiftSections(s) : t(this, l).shift(s * t(this, _));
|
|
154
154
|
} else
|
|
@@ -164,66 +164,66 @@ let mt = class extends zt {
|
|
|
164
164
|
children: [
|
|
165
165
|
Ct({
|
|
166
166
|
class: "static",
|
|
167
|
-
children: [
|
|
167
|
+
children: [wt({ name: "static" })]
|
|
168
168
|
}),
|
|
169
169
|
Ct({
|
|
170
170
|
class: "content",
|
|
171
|
-
children: [
|
|
171
|
+
children: [wt({ ref: (e) => d(this, ut, e) })],
|
|
172
172
|
style: {
|
|
173
173
|
flexDirection: new Kt(
|
|
174
|
-
t(this,
|
|
174
|
+
t(this, E),
|
|
175
175
|
(e) => e === "x" ? "row" : "column"
|
|
176
176
|
)
|
|
177
177
|
},
|
|
178
178
|
ref: (e) => d(this, u, e)
|
|
179
179
|
})
|
|
180
180
|
]
|
|
181
|
-
}), d(this,
|
|
182
|
-
t(this, u).style.flexDirection = e === "x" ? "row" : "column", t(this,
|
|
183
|
-
}), t(this,
|
|
184
|
-
t(this,
|
|
185
|
-
}), t(this,
|
|
186
|
-
this.isConnected && t(this,
|
|
187
|
-
}), t(this,
|
|
188
|
-
this.isConnected && (e ? m(this,
|
|
189
|
-
}), t(this,
|
|
190
|
-
t(this,
|
|
191
|
-
}), t(this,
|
|
192
|
-
e.current ? (this.isConnected && (t(this, c).length || (t(this,
|
|
193
|
-
}), t(this,
|
|
181
|
+
}), d(this, M, new Gt({ element: this })), t(this, M).changeEvent.subscribe(t(this, it)), d(this, U, new Ut({ element: this })), t(this, U).changeEvent.subscribe(t(this, it)), t(this, E).subscribe(({ current: e }) => {
|
|
182
|
+
t(this, u).style.flexDirection = e === "x" ? "row" : "column", t(this, M).axis = t(this, F).current ? "max" : e, this.isConnected && t(this, I).call(this);
|
|
183
|
+
}), t(this, F).subscribe((e) => {
|
|
184
|
+
t(this, M).axis = e.current ? "max" : t(this, E).current;
|
|
185
|
+
}), t(this, L).subscribe(() => {
|
|
186
|
+
this.isConnected && t(this, I).call(this);
|
|
187
|
+
}), t(this, y).subscribe(({ current: e }) => {
|
|
188
|
+
this.isConnected && (e ? m(this, Q, pt).call(this) : m(this, Z, X).call(this));
|
|
189
|
+
}), t(this, P).subscribe((e) => {
|
|
190
|
+
t(this, b).current = 0, t(this, M).debounce = e.current, t(this, l).reset(), this.isConnected && (e.current && !e.previous ? m(this, Q, pt).call(this) : !e.current && e.previous && m(this, Z, X).call(this));
|
|
191
|
+
}), t(this, x).subscribe((e) => {
|
|
192
|
+
e.current ? (this.isConnected && (t(this, c).length || (t(this, y).current = !0)), t(this, c).length && (t(this, l).max = 1 / 0, t(this, l).min = -1 / 0)) : (d(this, q, 0), t(this, l).max = t(this, p), t(this, l).min = 0);
|
|
193
|
+
}), t(this, R).subscribe((e) => {
|
|
194
194
|
t(this, l).damping = e.current;
|
|
195
|
-
}), t(this,
|
|
195
|
+
}), t(this, B).subscribe((e) => {
|
|
196
196
|
e.current && !e.previous ? m(this, ft, Wt).call(this) : !e.current && e.previous && m(this, dt, yt).call(this);
|
|
197
|
-
}), t(this,
|
|
197
|
+
}), t(this, K).subscribe((e) => {
|
|
198
198
|
e.current && !e.previous ? m(this, et, _t).call(this) : !e.current && e.previous && m(this, st, St).call(this);
|
|
199
199
|
}));
|
|
200
200
|
}
|
|
201
201
|
get dampingAttribute() {
|
|
202
|
-
return t(this,
|
|
202
|
+
return t(this, R);
|
|
203
203
|
}
|
|
204
204
|
get axisAttibute() {
|
|
205
|
-
return t(this,
|
|
205
|
+
return t(this, E);
|
|
206
206
|
}
|
|
207
207
|
get pagesAttibute() {
|
|
208
|
-
return t(this,
|
|
208
|
+
return t(this, L);
|
|
209
209
|
}
|
|
210
210
|
get splitAttibute() {
|
|
211
|
-
return t(this,
|
|
211
|
+
return t(this, y);
|
|
212
212
|
}
|
|
213
213
|
get sectionalAttibute() {
|
|
214
|
-
return t(this,
|
|
214
|
+
return t(this, P);
|
|
215
215
|
}
|
|
216
216
|
get infiniteAttribute() {
|
|
217
|
-
return t(this,
|
|
217
|
+
return t(this, x);
|
|
218
218
|
}
|
|
219
219
|
get dampingAttibute() {
|
|
220
|
-
return t(this,
|
|
220
|
+
return t(this, R);
|
|
221
221
|
}
|
|
222
222
|
get disabledAttibute() {
|
|
223
|
-
return t(this,
|
|
223
|
+
return t(this, B);
|
|
224
224
|
}
|
|
225
225
|
get hibernatedAttibute() {
|
|
226
|
-
return t(this,
|
|
226
|
+
return t(this, K);
|
|
227
227
|
}
|
|
228
228
|
get currentScrollValue() {
|
|
229
229
|
return m(this, rt, kt).call(this, "current");
|
|
@@ -247,25 +247,25 @@ let mt = class extends zt {
|
|
|
247
247
|
return t(this, p);
|
|
248
248
|
}
|
|
249
249
|
get gap() {
|
|
250
|
-
return t(this,
|
|
250
|
+
return t(this, O);
|
|
251
251
|
}
|
|
252
252
|
get counter() {
|
|
253
|
-
return t(this,
|
|
253
|
+
return t(this, b);
|
|
254
254
|
}
|
|
255
255
|
get distance() {
|
|
256
|
-
return t(this,
|
|
256
|
+
return t(this, T);
|
|
257
257
|
}
|
|
258
258
|
get overscroll() {
|
|
259
|
-
return t(this,
|
|
259
|
+
return t(this, q);
|
|
260
260
|
}
|
|
261
261
|
get vertical() {
|
|
262
|
-
return t(this,
|
|
262
|
+
return t(this, E).current === "y";
|
|
263
263
|
}
|
|
264
264
|
get currentProgress() {
|
|
265
|
-
return this.currentScrollValue / t(this,
|
|
265
|
+
return this.currentScrollValue / t(this, T) || 0;
|
|
266
266
|
}
|
|
267
267
|
get targetProgress() {
|
|
268
|
-
return this.targetScrollValue / t(this,
|
|
268
|
+
return this.targetScrollValue / t(this, T) || 0;
|
|
269
269
|
}
|
|
270
270
|
get speed() {
|
|
271
271
|
return t(this, l).speed;
|
|
@@ -298,38 +298,38 @@ let mt = class extends zt {
|
|
|
298
298
|
scrollToSection(e, s = "smooth") {
|
|
299
299
|
if (!t(this, c).length)
|
|
300
300
|
return;
|
|
301
|
-
const i = t(this,
|
|
301
|
+
const i = t(this, b).current;
|
|
302
302
|
m(this, xt, Rt).call(this, e);
|
|
303
|
-
const r = t(this, c)[i], a = t(this, c)[t(this,
|
|
303
|
+
const r = t(this, c)[i], a = t(this, c)[t(this, b).current];
|
|
304
304
|
if (r && a) {
|
|
305
305
|
let f = 0;
|
|
306
|
-
const
|
|
307
|
-
t(this,
|
|
306
|
+
const v = t(this, c).length - 1;
|
|
307
|
+
t(this, x).current ? t(this, b).current === 0 && i === v ? f = t(this, p) + t(this, _) - r.position + t(this, O) : t(this, b).current === v && i === 0 ? f = a.position - (t(this, p) + t(this, _) + t(this, O)) : f = a.position - r.position : f = a.position - r.position, t(this, l).shift(f, s === "instant");
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
shiftSections(e, s = "smooth") {
|
|
311
|
-
t(this, c).length && this.scrollToSection(t(this,
|
|
311
|
+
t(this, c).length && this.scrollToSection(t(this, b).current + e, s);
|
|
312
312
|
}
|
|
313
313
|
setPosition(e, s = "smooth") {
|
|
314
314
|
t(this, l).set(e, s === "instant");
|
|
315
315
|
}
|
|
316
316
|
connectedCallback() {
|
|
317
|
-
m(this, st, St).call(this);
|
|
317
|
+
t(this, E).observe(), t(this, L).observe(), t(this, y).observe(), t(this, P).observe(), t(this, F).observe(), t(this, x).observe(), t(this, R).observe(), t(this, B).observe(), t(this, K).observe(), m(this, st, St).call(this);
|
|
318
318
|
}
|
|
319
319
|
disconnectedCallback() {
|
|
320
|
-
m(this, et, _t).call(this);
|
|
320
|
+
t(this, E).unobserve(), t(this, L).unobserve(), t(this, y).unobserve(), t(this, P).unobserve(), t(this, F).unobserve(), t(this, x).unobserve(), t(this, R).unobserve(), t(this, B).unobserve(), t(this, K).unobserve(), m(this, et, _t).call(this);
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
l = /* @__PURE__ */ new WeakMap();
|
|
324
|
-
C = /* @__PURE__ */ new WeakMap();
|
|
325
|
-
T = /* @__PURE__ */ new WeakMap();
|
|
326
|
-
V = /* @__PURE__ */ new WeakMap();
|
|
327
|
-
I = /* @__PURE__ */ new WeakMap();
|
|
328
|
-
Q = /* @__PURE__ */ new WeakMap();
|
|
329
324
|
E = /* @__PURE__ */ new WeakMap();
|
|
325
|
+
L = /* @__PURE__ */ new WeakMap();
|
|
326
|
+
y = /* @__PURE__ */ new WeakMap();
|
|
327
|
+
P = /* @__PURE__ */ new WeakMap();
|
|
328
|
+
F = /* @__PURE__ */ new WeakMap();
|
|
329
|
+
x = /* @__PURE__ */ new WeakMap();
|
|
330
|
+
R = /* @__PURE__ */ new WeakMap();
|
|
331
|
+
B = /* @__PURE__ */ new WeakMap();
|
|
330
332
|
K = /* @__PURE__ */ new WeakMap();
|
|
331
|
-
X = /* @__PURE__ */ new WeakMap();
|
|
332
|
-
Y = /* @__PURE__ */ new WeakMap();
|
|
333
333
|
u = /* @__PURE__ */ new WeakMap();
|
|
334
334
|
ut = /* @__PURE__ */ new WeakMap();
|
|
335
335
|
c = /* @__PURE__ */ new WeakMap();
|
|
@@ -337,85 +337,85 @@ j = /* @__PURE__ */ new WeakMap();
|
|
|
337
337
|
tt = /* @__PURE__ */ new WeakMap();
|
|
338
338
|
_ = /* @__PURE__ */ new WeakMap();
|
|
339
339
|
p = /* @__PURE__ */ new WeakMap();
|
|
340
|
-
P = /* @__PURE__ */ new WeakMap();
|
|
341
|
-
W = /* @__PURE__ */ new WeakMap();
|
|
342
|
-
F = /* @__PURE__ */ new WeakMap();
|
|
343
|
-
w = /* @__PURE__ */ new WeakMap();
|
|
344
|
-
G = /* @__PURE__ */ new WeakMap();
|
|
345
340
|
O = /* @__PURE__ */ new WeakMap();
|
|
346
|
-
|
|
341
|
+
M = /* @__PURE__ */ new WeakMap();
|
|
342
|
+
U = /* @__PURE__ */ new WeakMap();
|
|
343
|
+
b = /* @__PURE__ */ new WeakMap();
|
|
344
|
+
q = /* @__PURE__ */ new WeakMap();
|
|
345
|
+
T = /* @__PURE__ */ new WeakMap();
|
|
346
|
+
Q = /* @__PURE__ */ new WeakSet();
|
|
347
347
|
pt = function() {
|
|
348
|
-
m(this,
|
|
348
|
+
m(this, Z, X).call(this), t(this, ut).assignedElements().forEach((e) => {
|
|
349
349
|
e instanceof HTMLElement && t(this, c).push(new Yt(e, this));
|
|
350
|
-
}), t(this, u).style.transform = "", t(this,
|
|
350
|
+
}), t(this, u).style.transform = "", t(this, I).call(this);
|
|
351
351
|
};
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
Z = /* @__PURE__ */ new WeakSet();
|
|
353
|
+
X = function() {
|
|
354
354
|
t(this, c).forEach((e) => {
|
|
355
355
|
e.destroy();
|
|
356
356
|
}), d(this, c, []);
|
|
357
357
|
};
|
|
358
358
|
ft = /* @__PURE__ */ new WeakSet();
|
|
359
359
|
Wt = function() {
|
|
360
|
-
t(this, l).unsubscribe(t(this, gt)), t(this, l).stopAnimation(), t(this,
|
|
360
|
+
t(this, l).unsubscribe(t(this, gt)), t(this, l).stopAnimation(), t(this, M).disconnect(), t(this, U).disconnect();
|
|
361
361
|
};
|
|
362
362
|
dt = /* @__PURE__ */ new WeakSet();
|
|
363
363
|
yt = function() {
|
|
364
|
-
t(this, l).subscribe(t(this, gt)), t(this,
|
|
364
|
+
t(this, l).subscribe(t(this, gt)), t(this, M).connect(), t(this, U).connect();
|
|
365
365
|
};
|
|
366
366
|
et = /* @__PURE__ */ new WeakSet();
|
|
367
367
|
_t = function() {
|
|
368
|
-
ct.unsubscribe(t(this,
|
|
368
|
+
ct.unsubscribe(t(this, I)), t(this, l).reset(), m(this, ft, Wt).call(this), t(this, u).style.transform = "", t(this, y).current && m(this, Z, X).call(this), G.unregister(this);
|
|
369
369
|
};
|
|
370
370
|
st = /* @__PURE__ */ new WeakSet();
|
|
371
371
|
St = function() {
|
|
372
|
-
t(this,
|
|
372
|
+
t(this, y).current && m(this, Q, pt).call(this), G.register(this), ct.subscribe(t(this, I), Ot.SCROLL), m(this, dt, yt).call(this);
|
|
373
373
|
};
|
|
374
|
-
|
|
374
|
+
I = /* @__PURE__ */ new WeakMap();
|
|
375
375
|
gt = /* @__PURE__ */ new WeakMap();
|
|
376
376
|
xt = /* @__PURE__ */ new WeakSet();
|
|
377
377
|
Rt = function(e) {
|
|
378
|
-
t(this,
|
|
378
|
+
t(this, x).current ? (t(this, b).current = e % t(this, c).length, t(this, b).current = t(this, b).current < 0 ? t(this, c).length + t(this, b).current : t(this, b).current) : t(this, b).current = Pt(e, 0, t(this, c).length - 1);
|
|
379
379
|
};
|
|
380
380
|
it = /* @__PURE__ */ new WeakMap();
|
|
381
381
|
rt = /* @__PURE__ */ new WeakSet();
|
|
382
382
|
kt = function(e = "current") {
|
|
383
|
-
if (t(this,
|
|
384
|
-
const s = t(this, l)[e] % (t(this, p) + t(this, _) + t(this,
|
|
385
|
-
return s < 0 ? t(this, p) + s + t(this, _) + t(this,
|
|
383
|
+
if (t(this, x).current && t(this, c).length) {
|
|
384
|
+
const s = t(this, l)[e] % (t(this, p) + t(this, _) + t(this, O));
|
|
385
|
+
return s < 0 ? t(this, p) + s + t(this, _) + t(this, O) : s;
|
|
386
386
|
} else
|
|
387
387
|
return t(this, l)[e];
|
|
388
388
|
};
|
|
389
389
|
mt = Xt([
|
|
390
390
|
$t("e-scroll")
|
|
391
391
|
], mt);
|
|
392
|
-
var
|
|
392
|
+
var Y;
|
|
393
393
|
class te extends zt {
|
|
394
394
|
constructor() {
|
|
395
395
|
super(...arguments);
|
|
396
|
-
|
|
396
|
+
H(this, Y, null);
|
|
397
397
|
}
|
|
398
398
|
get scrollElement() {
|
|
399
|
-
return n(this,
|
|
399
|
+
return n(this, Y);
|
|
400
400
|
}
|
|
401
401
|
connectedCallback() {
|
|
402
402
|
const i = Jt(this, mt);
|
|
403
|
-
i instanceof mt ?
|
|
403
|
+
i instanceof mt ? D(this, Y, i) : console.error(this, "e-scroll not found");
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
Y = new WeakMap();
|
|
407
407
|
var ee = Object.defineProperty, se = Object.getOwnPropertyDescriptor, ie = (e, s, i, r) => {
|
|
408
|
-
for (var a = r > 1 ? void 0 : r ? se(s, i) : s, f = e.length - 1,
|
|
409
|
-
(
|
|
408
|
+
for (var a = r > 1 ? void 0 : r ? se(s, i) : s, f = e.length - 1, v; f >= 0; f--)
|
|
409
|
+
(v = e[f]) && (a = (r ? v(s, i, a) : v(a)) || a);
|
|
410
410
|
return r && a && ee(s, i, a), a;
|
|
411
411
|
}, Tt = (e, s, i) => {
|
|
412
412
|
if (!s.has(e))
|
|
413
413
|
throw TypeError("Cannot " + i);
|
|
414
|
-
}, o = (e, s, i) => (Tt(e, s, "read from private field"), i ? i.call(e) : s.get(e)),
|
|
414
|
+
}, o = (e, s, i) => (Tt(e, s, "read from private field"), i ? i.call(e) : s.get(e)), k = (e, s, i) => {
|
|
415
415
|
if (s.has(e))
|
|
416
416
|
throw TypeError("Cannot add the same private member more than once");
|
|
417
417
|
s instanceof WeakSet ? s.add(e) : s.set(e, i);
|
|
418
|
-
},
|
|
418
|
+
}, A = (e, s, i, r) => (Tt(e, s, "write to private field"), r ? r.call(e, i) : s.set(e, i), i), nt, w, z, $, J, N, ht, ot, lt, at;
|
|
419
419
|
const re = Dt({
|
|
420
420
|
":host": {
|
|
421
421
|
display: "inline-block",
|
|
@@ -447,45 +447,45 @@ const re = Dt({
|
|
|
447
447
|
});
|
|
448
448
|
let At = class extends te {
|
|
449
449
|
constructor() {
|
|
450
|
-
super(),
|
|
451
|
-
|
|
452
|
-
const e = o(this,
|
|
453
|
-
|
|
454
|
-
}),
|
|
455
|
-
|
|
456
|
-
}),
|
|
450
|
+
super(), k(this, nt, null), k(this, w, null), k(this, z, !1), k(this, $, 0), k(this, J, 0), k(this, N, 0), k(this, ht, () => {
|
|
451
|
+
A(this, z, this.offsetWidth > this.offsetHeight);
|
|
452
|
+
const e = o(this, z) ? this.offsetWidth : this.offsetHeight;
|
|
453
|
+
A(this, $, e / ((this.scrollElement.scrollSize + this.scrollElement.viewportSize) / e)), A(this, $, Math.max(o(this, $), 30)), o(this, z) ? (o(this, w).style.width = o(this, $) + "px", o(this, w).style.height = "100%") : (o(this, w).style.width = "100%", o(this, w).style.height = o(this, $) + "px"), A(this, J, e - o(this, $)), this.scrollElement.scrollSize || (this.style.display = "none");
|
|
454
|
+
}), k(this, ot, () => {
|
|
455
|
+
A(this, N, this.scrollElement.currentProgress * o(this, J)), o(this, z) ? o(this, w).style.transform = `translate3d(${o(this, N)}px, 0px, 0px)` : o(this, w).style.transform = `translate3d(0px, ${o(this, N)}px, 0px)`;
|
|
456
|
+
}), k(this, lt, () => {
|
|
457
457
|
this.setAttribute("axis", this.scrollElement.axisAttibute.current);
|
|
458
|
-
}),
|
|
458
|
+
}), k(this, at, (e) => {
|
|
459
459
|
const s = (f) => {
|
|
460
|
-
const
|
|
460
|
+
const v = o(this, z) ? f.x : f.y, It = this.scrollElement.distance / o(this, J), Ht = (v - a) * It;
|
|
461
461
|
this.scrollElement.setPosition(r + Ht);
|
|
462
462
|
}, i = () => {
|
|
463
463
|
removeEventListener("pointermove", s), removeEventListener("pointerup", i), removeEventListener("touchend", i);
|
|
464
464
|
};
|
|
465
465
|
addEventListener("pointermove", s), addEventListener("pointerup", i), addEventListener("touchend", i);
|
|
466
|
-
const r = this.scrollElement.targetScrollValue, a = o(this,
|
|
466
|
+
const r = this.scrollElement.targetScrollValue, a = o(this, z) ? e.x : e.y;
|
|
467
467
|
}), Lt && (this.openShadow(re), Vt(this, {
|
|
468
|
-
children: [
|
|
468
|
+
children: [wt({ ref: (e) => A(this, nt, e) })]
|
|
469
469
|
}));
|
|
470
470
|
}
|
|
471
471
|
get thumbElement() {
|
|
472
|
-
return o(this,
|
|
472
|
+
return o(this, w);
|
|
473
473
|
}
|
|
474
474
|
connectedCallback() {
|
|
475
475
|
super.connectedCallback();
|
|
476
476
|
const e = o(this, nt).assignedElements()[0];
|
|
477
|
-
e instanceof HTMLElement ?
|
|
477
|
+
e instanceof HTMLElement ? A(this, w, e) : (A(this, w, document.createElement("div")), o(this, w).classList.add("default-thumb"), this.shadowRoot.appendChild(o(this, w))), o(this, w).addEventListener("pointerdown", o(this, at)), ct.subscribe(o(this, ht), Ot.SCROLL + 1), this.scrollElement.onScroll(o(this, ot)), this.scrollElement.axisAttibute.subscribe(o(this, lt));
|
|
478
478
|
}
|
|
479
479
|
disconnectedCallback() {
|
|
480
|
-
o(this,
|
|
480
|
+
o(this, w).removeEventListener("pointerdown", o(this, at)), ct.unsubscribe(o(this, ht)), this.scrollElement.offScroll(o(this, ot)), this.scrollElement.axisAttibute.unsubscribe(o(this, lt));
|
|
481
481
|
}
|
|
482
482
|
};
|
|
483
483
|
nt = /* @__PURE__ */ new WeakMap();
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
484
|
+
w = /* @__PURE__ */ new WeakMap();
|
|
485
|
+
z = /* @__PURE__ */ new WeakMap();
|
|
486
|
+
$ = /* @__PURE__ */ new WeakMap();
|
|
487
|
+
J = /* @__PURE__ */ new WeakMap();
|
|
488
|
+
N = /* @__PURE__ */ new WeakMap();
|
|
489
489
|
ht = /* @__PURE__ */ new WeakMap();
|
|
490
490
|
ot = /* @__PURE__ */ new WeakMap();
|
|
491
491
|
lt = /* @__PURE__ */ new WeakMap();
|