aptechka 0.4.4 → 0.4.6
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/checkbox/index.cjs +1 -0
- package/lib/checkbox/index.d.ts +16 -0
- package/lib/checkbox/index.js +120 -0
- package/lib/{index-DGji4duy.js → index-BigQay-N.js} +112 -109
- package/lib/index-DTrWxWOM.cjs +9 -0
- package/lib/popover/PopoverButtonElement.d.ts +3 -3
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +60 -47
- package/lib/router/index.js +1 -3
- package/lib/scroll/ScrollBulletButtonsElement.d.ts +12 -0
- package/lib/scroll/ScrollButtonElement.d.ts +6 -0
- package/lib/scroll/ScrollElement.d.ts +15 -1
- package/lib/scroll/ScrollSetButtonElement.d.ts +10 -0
- package/lib/scroll/ScrollStepButtonElement.d.ts +10 -0
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.d.ts +3 -0
- package/lib/scroll/index.js +388 -252
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/source/SourceClass.d.ts +1 -1
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.d.ts +5 -0
- package/lib/theme/index.js +5 -4
- package/lib/{studio/tweaker → tweaker}/TweakerBooleanManagerElement.d.ts +1 -1
- package/lib/{studio/tweaker → tweaker}/TweakerColorManagerElement.d.ts +1 -1
- package/lib/{studio/tweaker → tweaker}/TweakerElement.d.ts +1 -1
- package/lib/{studio/tweaker → tweaker}/TweakerFieldElement.d.ts +4 -4
- package/lib/{studio/tweaker → tweaker}/TweakerFolderElement.d.ts +4 -4
- package/lib/{studio/tweaker → tweaker}/TweakerLinkManagerElement.d.ts +1 -1
- package/lib/{studio/tweaker → tweaker}/TweakerNumberManagerElement.d.ts +1 -1
- package/lib/{studio/tweaker → tweaker}/TweakerRangeManagerElement.d.ts +1 -1
- package/lib/{studio/tweaker → tweaker}/TweakerSelectManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerStoreManagerElement.d.ts +11 -0
- package/lib/{studio/tweaker → tweaker}/TweakerStringManagerElement.d.ts +1 -1
- package/lib/tweaker/index.cjs +10 -0
- package/lib/tweaker/index.d.ts +1 -0
- package/lib/{studio → tweaker}/index.js +276 -311
- package/lib/{studio/tweaker → tweaker}/tweakerManagerConstructors.d.ts +1 -1
- package/lib/{studio/studioStorage.d.ts → tweaker/tweakerStorage.d.ts} +3 -3
- package/package.json +17 -14
- package/lib/abstract-elements/AbstractButtonElement.d.ts +0 -6
- package/lib/abstract-elements/index.cjs +0 -1
- package/lib/abstract-elements/index.d.ts +0 -1
- package/lib/abstract-elements/index.js +0 -27
- package/lib/index-CUE4tEUr.cjs +0 -9
- package/lib/studio/StudioElement.d.ts +0 -13
- package/lib/studio/index.cjs +0 -10
- package/lib/studio/index.d.ts +0 -1
- package/lib/studio/tweaker/TweakerStoreManagerElement.d.ts +0 -11
package/lib/popover/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Attribute as
|
|
2
|
-
import { CustomElement as
|
|
1
|
+
import { Attribute as C } from "../attribute/index.js";
|
|
2
|
+
import { CustomElement as O, define as A } from "../custom-element/index.js";
|
|
3
3
|
import { S as I } from "../Store-BQXXikps.js";
|
|
4
4
|
import { g as N } from "../style-j2TwriJ_.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { i as q } from "../browser-0zX67oeU.js";
|
|
6
|
+
import { e as B, p as G, ay as H } from "../tags-CAxO5Rs3.js";
|
|
7
|
+
import { c as R } from "../createStylesheet-DrkbCUJk.js";
|
|
8
|
+
var U = Object.defineProperty, b = Object.getOwnPropertyDescriptor, z = (e, t, s, r) => {
|
|
9
|
+
for (var n = r > 1 ? void 0 : r ? b(t, s) : t, p = e.length - 1, d; p >= 0; p--)
|
|
8
10
|
(d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
|
|
9
|
-
return r && n &&
|
|
11
|
+
return r && n && U(t, s, n), n;
|
|
10
12
|
}, $ = (e, t, s) => {
|
|
11
13
|
if (!t.has(e))
|
|
12
14
|
throw TypeError("Cannot " + s);
|
|
@@ -14,117 +16,128 @@ var B = Object.defineProperty, G = Object.getOwnPropertyDescriptor, H = (e, t, s
|
|
|
14
16
|
if (t.has(e))
|
|
15
17
|
throw TypeError("Cannot add the same private member more than once");
|
|
16
18
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
17
|
-
},
|
|
18
|
-
let a = class extends
|
|
19
|
+
}, L = (e, t, s, r) => ($(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), T = (e, t, s) => ($(e, t, "access private method"), s), S, h, y, c, f, v, W, D, _, m, g, E, k, M, w;
|
|
20
|
+
let a = class extends O {
|
|
19
21
|
constructor() {
|
|
20
|
-
super(...arguments), o(this, W), o(this,
|
|
21
|
-
i(this, h).current || (i(this, h).current = !0, i(this,
|
|
22
|
-
addEventListener("click", i(this,
|
|
22
|
+
super(...arguments), o(this, W), o(this, _), o(this, k), o(this, S, -1), o(this, h, new I(!1)), o(this, y, void 0), o(this, c, new C(this, "history", !1)), o(this, f, new C(this, "single", !1)), o(this, v, !1), this.open = () => {
|
|
23
|
+
i(this, h).current || (i(this, h).current = !0, i(this, f).current && (a.__opened.forEach((e) => e.close()), a.__opened = []), a.__opened.push(this), L(this, S, a.__opened.length - 1), i(this, c).current && i(this, v) && history.pushState("", "", i(this, W, D)), clearTimeout(i(this, y)), this.classList.add("triggered"), this.style.display = "block", setTimeout(() => {
|
|
24
|
+
addEventListener("click", i(this, g)), addEventListener("keydown", i(this, E)), this.style.opacity = "1", this.classList.add("opened");
|
|
23
25
|
}));
|
|
24
26
|
}, this.close = () => {
|
|
25
27
|
if (i(this, h).current) {
|
|
26
28
|
if (i(this, h).current = !1, a.__opened = a.__opened.filter((e) => e !== this), i(this, c).current) {
|
|
27
29
|
const e = new URL(location.href);
|
|
28
|
-
e.searchParams.delete(i(this,
|
|
30
|
+
e.searchParams.delete(i(this, _, m)), history.replaceState(null, "", e.href);
|
|
29
31
|
}
|
|
30
|
-
this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", i(this,
|
|
32
|
+
this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", i(this, g)), removeEventListener("keydown", i(this, E)), setTimeout(() => {
|
|
31
33
|
this.classList.remove("triggered"), this.style.display = "none";
|
|
32
34
|
}, N(this));
|
|
33
35
|
}
|
|
34
|
-
}, o(this,
|
|
35
|
-
|
|
36
|
+
}, o(this, g, (e) => {
|
|
37
|
+
T(this, k, M).call(this, () => {
|
|
36
38
|
const t = e.composedPath();
|
|
37
39
|
(!t.find((s) => s === this) && !t.find(
|
|
38
40
|
(s) => s instanceof HTMLElement && s.closest("e-popover-button")
|
|
39
41
|
) || t[0] instanceof HTMLElement && t[0].hasAttribute("outside")) && this.close();
|
|
40
42
|
});
|
|
41
43
|
}), o(this, E, (e) => {
|
|
42
|
-
|
|
44
|
+
T(this, k, M).call(this, () => {
|
|
43
45
|
e.code === "Escape" && this.close();
|
|
44
46
|
});
|
|
45
47
|
}), o(this, w, () => {
|
|
46
|
-
|
|
48
|
+
L(this, v, !1), i(this, h).current && i(this, c).current && !location.search.includes(i(this, _, m)) ? this.close() : !i(this, h).current && i(this, c).current && location.search.includes(i(this, _, m)) && this.open(), L(this, v, !0);
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
get history() {
|
|
50
52
|
return i(this, c);
|
|
51
53
|
}
|
|
52
54
|
get single() {
|
|
53
|
-
return i(this,
|
|
55
|
+
return i(this, f);
|
|
54
56
|
}
|
|
55
57
|
get opened() {
|
|
56
58
|
return i(this, h);
|
|
57
59
|
}
|
|
58
60
|
connectedCallback() {
|
|
59
|
-
i(this, c).observe(), i(this,
|
|
61
|
+
i(this, c).observe(), i(this, f).observe(), this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, w)), setTimeout(() => {
|
|
60
62
|
i(this, w).call(this);
|
|
61
63
|
}, 0);
|
|
62
64
|
}
|
|
63
65
|
disconnectedCallback() {
|
|
64
|
-
i(this, c).unobserve(), i(this,
|
|
66
|
+
i(this, c).unobserve(), i(this, f).unobserve(), clearTimeout(i(this, y)), removeEventListener("popstate", i(this, w));
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
|
-
|
|
69
|
+
S = /* @__PURE__ */ new WeakMap();
|
|
68
70
|
h = /* @__PURE__ */ new WeakMap();
|
|
69
|
-
|
|
71
|
+
y = /* @__PURE__ */ new WeakMap();
|
|
70
72
|
c = /* @__PURE__ */ new WeakMap();
|
|
71
|
-
|
|
73
|
+
f = /* @__PURE__ */ new WeakMap();
|
|
72
74
|
v = /* @__PURE__ */ new WeakMap();
|
|
73
75
|
W = /* @__PURE__ */ new WeakSet();
|
|
74
|
-
|
|
75
|
-
return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this,
|
|
76
|
+
D = function() {
|
|
77
|
+
return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this, _, m)}`;
|
|
76
78
|
};
|
|
77
|
-
|
|
79
|
+
_ = /* @__PURE__ */ new WeakSet();
|
|
78
80
|
m = function() {
|
|
79
81
|
return `modal-${this.id}`;
|
|
80
82
|
};
|
|
81
|
-
|
|
83
|
+
g = /* @__PURE__ */ new WeakMap();
|
|
82
84
|
E = /* @__PURE__ */ new WeakMap();
|
|
83
85
|
k = /* @__PURE__ */ new WeakSet();
|
|
84
86
|
M = function(e) {
|
|
85
|
-
(a.__opened[i(this,
|
|
87
|
+
(a.__opened[i(this, S) - 1] || a.__opened.length === 1) && e();
|
|
86
88
|
};
|
|
87
89
|
w = /* @__PURE__ */ new WeakMap();
|
|
88
90
|
a.__opened = [];
|
|
89
|
-
a =
|
|
90
|
-
|
|
91
|
+
a = z([
|
|
92
|
+
A("e-popover")
|
|
91
93
|
], a);
|
|
92
|
-
var
|
|
93
|
-
for (var n = r > 1 ? void 0 : r ?
|
|
94
|
+
var F = Object.defineProperty, J = Object.getOwnPropertyDescriptor, K = (e, t, s, r) => {
|
|
95
|
+
for (var n = r > 1 ? void 0 : r ? J(t, s) : t, p = e.length - 1, d; p >= 0; p--)
|
|
94
96
|
(d = e[p]) && (n = (r ? d(t, s, n) : d(n)) || n);
|
|
95
|
-
return r && n &&
|
|
96
|
-
},
|
|
97
|
+
return r && n && F(t, s, n), n;
|
|
98
|
+
}, x = (e, t, s) => {
|
|
97
99
|
if (!t.has(e))
|
|
98
100
|
throw TypeError("Cannot " + s);
|
|
99
|
-
}, u = (e, t, s) => (
|
|
101
|
+
}, u = (e, t, s) => (x(e, t, "read from private field"), s ? s.call(e) : t.get(e)), Q = (e, t, s) => {
|
|
100
102
|
if (t.has(e))
|
|
101
103
|
throw TypeError("Cannot add the same private member more than once");
|
|
102
104
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
+
}, V = (e, t, s, r) => (x(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), l;
|
|
106
|
+
const X = R({
|
|
107
|
+
button: {
|
|
108
|
+
all: "inherit"
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
let P = class extends O {
|
|
105
112
|
constructor() {
|
|
106
|
-
super(
|
|
113
|
+
super(), Q(this, l, void 0), this.openShadow(X), q && B(this, {
|
|
114
|
+
children: [
|
|
115
|
+
G({
|
|
116
|
+
onClick: () => {
|
|
117
|
+
if (u(this, l)) {
|
|
118
|
+
const e = this.getAttribute("type") || "open";
|
|
119
|
+
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();
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
children: [H()]
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
});
|
|
107
126
|
}
|
|
108
127
|
get popoverElement() {
|
|
109
128
|
return u(this, l);
|
|
110
129
|
}
|
|
111
|
-
click() {
|
|
112
|
-
if (u(this, l)) {
|
|
113
|
-
const e = this.getAttribute("type") || "open";
|
|
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();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
130
|
connectedCallback() {
|
|
118
131
|
const e = this.getAttribute("target");
|
|
119
132
|
if (e) {
|
|
120
133
|
const t = document.querySelector(`#${e}`) || this.getRootNode().querySelector(`#${e}`);
|
|
121
|
-
t ?
|
|
134
|
+
t ? V(this, l, t) : console.warn(this, `target ${e} not found`);
|
|
122
135
|
}
|
|
123
136
|
}
|
|
124
137
|
};
|
|
125
138
|
l = /* @__PURE__ */ new WeakMap();
|
|
126
|
-
P =
|
|
127
|
-
|
|
139
|
+
P = K([
|
|
140
|
+
A("e-popover-button")
|
|
128
141
|
], P);
|
|
129
142
|
export {
|
|
130
143
|
P as PopoverButtonElement,
|
package/lib/router/index.js
CHANGED
|
@@ -93,9 +93,7 @@ class nt {
|
|
|
93
93
|
pathnameParams: a,
|
|
94
94
|
searchParams: d
|
|
95
95
|
};
|
|
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);
|
|
96
|
+
o(this, l, new (e(this, m))(f)), 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);
|
|
99
97
|
}
|
|
100
98
|
e(this, v).disconnect();
|
|
101
99
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScrollUserElement } from './ScrollUserElement';
|
|
2
|
+
|
|
3
|
+
export declare class ScrollBulletButtonsElement extends ScrollUserElement {
|
|
4
|
+
#private;
|
|
5
|
+
protected connectedCallback(): void;
|
|
6
|
+
protected disconnectedCallback(): void;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'e-scroll-bullet-buttons': ScrollBulletButtonsElement;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -5,6 +5,15 @@ import { CustomElement } from '../custom-element';
|
|
|
5
5
|
import { Damped } from '../animation';
|
|
6
6
|
|
|
7
7
|
export type ScrollBehaviour = 'smooth' | 'instant';
|
|
8
|
+
declare class Section {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(element: HTMLElement, scrollElement: ScrollElement);
|
|
11
|
+
get size(): number;
|
|
12
|
+
get position(): number;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
resize(): void;
|
|
15
|
+
transform(): void;
|
|
16
|
+
}
|
|
8
17
|
export declare class ScrollElement extends CustomElement {
|
|
9
18
|
#private;
|
|
10
19
|
constructor();
|
|
@@ -20,6 +29,7 @@ export declare class ScrollElement extends CustomElement {
|
|
|
20
29
|
get currentScrollValue(): number;
|
|
21
30
|
get targetScrollValue(): number;
|
|
22
31
|
get contentElement(): HTMLElement;
|
|
32
|
+
get sections(): Section[];
|
|
23
33
|
get position(): number;
|
|
24
34
|
get contentPosition(): number;
|
|
25
35
|
get viewportSize(): number;
|
|
@@ -42,7 +52,7 @@ export declare class ScrollElement extends CustomElement {
|
|
|
42
52
|
curve(from: number, distance: number, margin?: number): number;
|
|
43
53
|
visible(from: number, distance: number, margin?: number): boolean;
|
|
44
54
|
scrollToSection(sectionIndex: number, behaviour?: ScrollBehaviour): void;
|
|
45
|
-
shiftSections(
|
|
55
|
+
shiftSections(step: number, behaviour?: ScrollBehaviour): void;
|
|
46
56
|
setPosition(value: number, behaviour?: 'smooth' | 'instant'): void;
|
|
47
57
|
protected connectedCallback(): void;
|
|
48
58
|
protected disconnectedCallback(): void;
|
|
@@ -51,4 +61,8 @@ declare global {
|
|
|
51
61
|
interface HTMLElementTagNameMap {
|
|
52
62
|
'e-scroll': ScrollElement;
|
|
53
63
|
}
|
|
64
|
+
interface HTMLElementEventMap {
|
|
65
|
+
sectionsChange: CustomEvent;
|
|
66
|
+
}
|
|
54
67
|
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ScrollButtonElement } from './ScrollButtonElement';
|
|
2
|
+
|
|
3
|
+
export declare class ScrollSetButtonElement extends ScrollButtonElement {
|
|
4
|
+
protected handleClick(): void;
|
|
5
|
+
}
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
'e-scroll-set-button': ScrollSetButtonElement;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ScrollButtonElement } from './ScrollButtonElement';
|
|
2
|
+
|
|
3
|
+
export declare class ScrollStepButtonElement extends ScrollButtonElement {
|
|
4
|
+
protected handleClick(): void;
|
|
5
|
+
}
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
'e-scroll-step-button': ScrollStepButtonElement;
|
|
9
|
+
}
|
|
10
|
+
}
|
package/lib/scroll/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Mt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)};var h=(i,e,s)=>(Mt(i,e,"read from private field"),s?s.call(i):e.get(i)),B=(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)},T=(i,e,s,r)=>(Mt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Dt=require("../Damped-9h4qaGcS.cjs"),Vt=require("../Store-C-1ruEIm.cjs"),It=require("../Derived-B-g8dYgh.cjs"),Lt=require("../browser-CpzFX2xg.cjs"),K=require("../layout-8ryRAMGJ.cjs"),Ot=require("../math-GDWEqu7y.cjs");require("../ticker/index.cjs");const Pt=require("../WheelControls-0zNcnAB3.cjs"),wt=require("../custom-element/index.cjs"),Et=require("../order/index.cjs"),dt=require("../window-resizer/index.cjs"),Z=require("../scroll-entries/index.cjs"),V=require("../tags-Dz_Yisj_.cjs"),Rt=require("../createStylesheet-u1ZQ2BI5.cjs"),Ht=require("../css-unit-parser/index.cjs"),k=require("../css-property/index.cjs"),Bt=require("../dom-JBOkFLTh.cjs"),zt=require("../theme/index.cjs");var Ft=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,Gt=(i,e,s,r)=>{for(var n=r>1?void 0:r?Ut(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&&Ft(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)),o=(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,y,z,C,L,F,x,$,U,G,u,ft,c,st,it,S,d,q,W,I,w,N,D,Y,gt,J,j,mt,Ct,vt,Wt,rt,St,nt,_t,H,bt,yt,qt,ht,ot,xt,_,v,A,M;class Kt{constructor(e,s){B(this,_,void 0);B(this,v,void 0);B(this,A,0);B(this,M,0);T(this,_,e),T(this,v,s),Z.scrollEntries.register(h(this,_))}get size(){return h(this,A)}get position(){return h(this,M)}destroy(){Z.scrollEntries.unregister(h(this,_)),h(this,_).style.transform=""}resize(){T(this,A,h(this,v).vertical?h(this,_).offsetHeight:h(this,_).offsetWidth),T(this,M,h(this,v).vertical?K.getCumulativeOffsetTop(h(this,_)):K.getCumulativeOffsetLeft(h(this,_))),T(this,M,h(this,M)-h(this,v).contentPosition)}transform(){let e=0;const s=h(this,v).viewportSize-h(this,A);h(this,v).infiniteProperty.current&&h(this,v).overscroll&&h(this,M)+h(this,A)<h(this,v).currentScrollValue&&(e=h(this,v).distance*-1-h(this,v).gap),Z.scrollEntries.update(h(this,_),h(this,v).axisAttibute.current,e);const r=h(this,v).currentScrollValue+e,n=h(this,M)-h(this,v).viewportSize-s,p=h(this,M)+h(this,A)+s,f=Ot.clamp(r,n,p);h(this,v).vertical?h(this,_).style.transform=`translate3d(0px, ${f*-1}px, 0px)`:h(this,_).style.transform=`translate3d(${f*-1}px, 0px, 0px)`}}_=new WeakMap,v=new WeakMap,A=new WeakMap,M=new WeakMap;const Zt=Rt.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(),o(this,Y),o(this,J),o(this,mt),o(this,vt),o(this,rt),o(this,nt),o(this,yt),o(this,ot),o(this,a,null),o(this,y,new k.CSSProperty(this,"--axis","y")),o(this,z,new k.CSSProperty(this,"--pages",0,{validate:e=>Math.max(0,e-1)})),o(this,C,new k.CSSProperty(this,"--split",!1)),o(this,L,new k.CSSProperty(this,"--sectional",!1)),o(this,F,new k.CSSProperty(this,"--wheel-max-delta",!1)),o(this,x,new k.CSSProperty(this,"--infinite",!1)),o(this,$,new k.CSSProperty(this,"--damping",.03)),o(this,U,new k.CSSProperty(this,"--disabled",!1)),o(this,G,new k.CSSProperty(this,"--hibernated",!1)),o(this,u,null),o(this,ft,null),o(this,c,[]),o(this,st,0),o(this,it,0),o(this,S,0),o(this,d,0),o(this,q,0),o(this,W,null),o(this,I,null),o(this,w,new Vt.Store(0)),o(this,N,0),o(this,D,0),o(this,H,()=>{const e=this.currentScrollValue/t(this,d)||0;if(g(this,st,this.vertical?K.getCumulativeOffsetTop(this):K.getCumulativeOffsetLeft(this)),g(this,it,this.vertical?K.getCumulativeOffsetTop(t(this,u)):K.getCumulativeOffsetLeft(t(this,u))),g(this,S,this.vertical?this.offsetHeight:this.offsetWidth),t(this,z).current){g(this,d,t(this,S)*t(this,z).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,q,Ht.cssUnitParser.parse(getComputedStyle(t(this,u)).gap)),!t(this,x).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,x).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,D,s.position+s.size+n)}else g(this,D,t(this,d));if(t(this,L).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)}),o(this,bt,()=>{const e=this.currentScrollValue;if(g(this,N,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)`;Z.scrollEntries.update(this,t(this,y).current,e)}),o(this,ht,e=>{if(t(this,L).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)}),Lt.isBrowser&&(g(this,a,new Dt.Damped(0,{damping:.01,min:0,order:Et.TICK_ORDER.SCROLL})),this.openShadow(Zt),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 It.Derived(t(this,y),e=>e==="x"?"row":"column")},ref:e=>g(this,u,e)})]}),g(this,W,new Pt.WheelControls({element:this})),t(this,W).changeEvent.subscribe(t(this,ht)),g(this,I,new Pt.KeyboardControls({element:this})),t(this,I).changeEvent.subscribe(t(this,ht)),t(this,y).subscribe(({current:e})=>{t(this,u).style.flexDirection=e==="x"?"row":"column",t(this,W).axis=t(this,F).current?"max":e,t(this,I).dimension=e==="x"?"width":"height",this.isConnected&&t(this,H).call(this)}),t(this,F).subscribe(e=>{t(this,W).axis=e.current?"max":t(this,y).current}),t(this,z).subscribe(()=>{this.isConnected&&t(this,H).call(this)}),t(this,C).subscribe(({current:e})=>{this.isConnected&&(e?m(this,Y,gt).call(this):m(this,J,j).call(this))}),t(this,L).subscribe(e=>{t(this,w).current=0,t(this,W).debounce=e.current,t(this,a).reset(),this.isConnected&&(e.current&&!e.previous?m(this,Y,gt).call(this):!e.current&&e.previous&&m(this,J,j).call(this))}),t(this,x).subscribe(e=>{e.current?(this.isConnected&&(t(this,c).length||(t(this,C).current=!0)),t(this,c).length&&(t(this,a).max=1/0,t(this,a).min=-1/0)):(g(this,N,0),t(this,a).max=t(this,d),t(this,a).min=0)}),t(this,$).subscribe(e=>{t(this,a).damping=e.current}),t(this,U).subscribe(e=>{e.current&&!e.previous?m(this,mt,Ct).call(this):!e.current&&e.previous&&m(this,vt,Wt).call(this)}),t(this,G).subscribe(e=>{e.current&&!e.previous?m(this,rt,St).call(this):!e.current&&e.previous&&m(this,nt,_t).call(this)}))}get dampingProperty(){return t(this,$)}get axisAttibute(){return t(this,y)}get pagesAttibute(){return t(this,z)}get splitAttibute(){return t(this,C)}get sectionalAttibute(){return t(this,L)}get infiniteProperty(){return t(this,x)}get dampingAttibute(){return t(this,$)}get disabledAttibute(){return t(this,U)}get hibernatedAttibute(){return t(this,G)}get currentScrollValue(){return m(this,ot,xt).call(this,"current")}get targetScrollValue(){return m(this,ot,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,q)}get counter(){return t(this,w)}get distance(){return t(this,D)}get overscroll(){return t(this,N)}get vertical(){return t(this,y).current==="y"}get currentProgress(){return this.currentScrollValue/t(this,D)||0}get targetProgress(){return this.targetScrollValue/t(this,D)||0}get speed(){return t(this,a).speed}get direction(){return t(this,a).direction}get isRunning(){return t(this,a).isRunning}get scrollWidth(){return t(this,y).current==="y"?0:t(this,a).length}get scrollHeight(){return t(this,y).current==="x"?0:t(this,a).length}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,yt,qt).call(this,e);const n=t(this,c)[r],p=t(this,c)[t(this,w).current];if(n&&p){let f=0;const et=t(this,c).length-1;t(this,x).current?t(this,w).current===0&&r===et?f=t(this,d)+t(this,S)-n.position+t(this,q):t(this,w).current===et&&r===0?f=p.position-(t(this,d)+t(this,S)+t(this,q)):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(){t(this,y).observe(),t(this,z).observe(),t(this,C).observe(),t(this,L).observe(),t(this,F).observe(),t(this,x).observe(),t(this,$).observe(),t(this,U).observe(),t(this,G).observe(),m(this,nt,_t).call(this)}disconnectedCallback(){t(this,y).unobserve(),t(this,z).unobserve(),t(this,C).unobserve(),t(this,L).unobserve(),t(this,F).unobserve(),t(this,x).unobserve(),t(this,$).unobserve(),t(this,U).unobserve(),t(this,G).unobserve(),m(this,rt,St).call(this)}};a=new WeakMap;y=new WeakMap;z=new WeakMap;C=new WeakMap;L=new WeakMap;F=new WeakMap;x=new WeakMap;$=new WeakMap;U=new WeakMap;G=new WeakMap;u=new WeakMap;ft=new WeakMap;c=new WeakMap;st=new WeakMap;it=new WeakMap;S=new WeakMap;d=new WeakMap;q=new WeakMap;W=new WeakMap;I=new WeakMap;w=new WeakMap;N=new WeakMap;D=new WeakMap;Y=new WeakSet;gt=function(){m(this,J,j).call(this),t(this,ft).assignedElements().forEach(i=>{i instanceof HTMLElement&&t(this,c).push(new Kt(i,this))}),t(this,u).style.transform="",t(this,H).call(this)};J=new WeakSet;j=function(){t(this,c).forEach(i=>{i.destroy()}),g(this,c,[])};mt=new WeakSet;Ct=function(){t(this,a).unsubscribe(t(this,bt)),t(this,a).stopAnimation(),t(this,W).disconnect(),t(this,I).disconnect()};vt=new WeakSet;Wt=function(){t(this,a).subscribe(t(this,bt)),t(this,W).connect(),t(this,I).connect()};rt=new WeakSet;St=function(){dt.windowResizer.unsubscribe(t(this,H)),t(this,a).reset(),m(this,mt,Ct).call(this),t(this,u).style.transform="",t(this,C).current&&m(this,J,j).call(this),Z.scrollEntries.unregister(this)};nt=new WeakSet;_t=function(){t(this,C).current&&m(this,Y,gt).call(this),Z.scrollEntries.register(this),dt.windowResizer.subscribe(t(this,H),Et.RESIZE_ORDER.SCROLL),m(this,vt,Wt).call(this)};H=new WeakMap;bt=new WeakMap;yt=new WeakSet;qt=function(i){t(this,x).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=Ot.clamp(i,0,t(this,c).length-1)};ht=new WeakMap;ot=new WeakSet;xt=function(i="current"){if(t(this,x).current&&t(this,c).length){const e=t(this,a)[i]%(t(this,d)+t(this,S)+t(this,q));return e<0?t(this,d)+e+t(this,S)+t(this,q):e}else return t(this,a)[i]};exports.ScrollElement=Gt([wt.define("e-scroll")],exports.ScrollElement);var tt;class Jt extends wt.CustomElement{constructor(){super(...arguments);B(this,tt,null)}get scrollElement(){return h(this,tt)}connectedCallback(){const s=Bt.findParentElement(this,exports.ScrollElement);s instanceof exports.ScrollElement?T(this,tt,s):console.error(this,"e-scroll not found")}}tt=new WeakMap;var Nt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,Xt=(i,e,s,r)=>{for(var n=r>1?void 0:r?Qt(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&&Nt(e,s,n),n},At=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},l=(i,e,s)=>(At(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)},P=(i,e,s,r)=>(At(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),lt,b,O,R,Q,X,at,ct,ut,pt;const Yt=Rt.createStylesheet({":host":{display:"inline-block",zIndex:"1",backgroundColor:zt.aptechkaTheme.colorLight.var},':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:zt.aptechkaTheme.colorDark.var,borderRadius:"1vmin",touchAction:"none"},"::slotted(*)":{touchAction:"none"}});exports.ScrollbarElement=class extends Jt{constructor(){super(),E(this,lt,null),E(this,b,null),E(this,O,!1),E(this,R,0),E(this,Q,0),E(this,X,0),E(this,at,()=>{P(this,O,this.offsetWidth>this.offsetHeight);const e=l(this,O)?this.offsetWidth:this.offsetHeight;P(this,R,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),P(this,R,Math.max(l(this,R),30)),l(this,O)?(l(this,b).style.width=l(this,R)+"px",l(this,b).style.height="100%"):(l(this,b).style.width="100%",l(this,b).style.height=l(this,R)+"px"),P(this,Q,e-l(this,R)),this.scrollElement.scrollSize||(this.style.display="none")}),E(this,ct,()=>{P(this,X,this.scrollElement.currentProgress*l(this,Q)),l(this,O)?l(this,b).style.transform=`translate3d(${l(this,X)}px, 0px, 0px)`:l(this,b).style.transform=`translate3d(0px, ${l(this,X)}px, 0px)`}),E(this,ut,()=>{this.setAttribute("axis",this.scrollElement.axisAttibute.current)}),E(this,pt,e=>{const s=f=>{const et=l(this,O)?f.x:f.y,Tt=this.scrollElement.distance/l(this,Q),$t=(et-p)*Tt;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=l(this,O)?e.x:e.y}),Lt.isBrowser&&(this.openShadow(Yt),V.element(this,{slot:"static",children:[V.slot({ref:e=>P(this,lt,e)})]}))}get thumbElement(){return l(this,b)}connectedCallback(){super.connectedCallback();const e=l(this,lt).assignedElements()[0];e instanceof HTMLElement?P(this,b,e):(P(this,b,document.createElement("div")),l(this,b).classList.add("default-thumb"),this.shadowRoot.appendChild(l(this,b))),l(this,b).addEventListener("pointerdown",l(this,pt)),dt.windowResizer.subscribe(l(this,at),Et.RESIZE_ORDER.SCROLL+1),this.scrollElement.onScroll(l(this,ct)),this.scrollElement.axisAttibute.subscribe(l(this,ut))}disconnectedCallback(){l(this,b).removeEventListener("pointerdown",l(this,pt)),dt.windowResizer.unsubscribe(l(this,at)),this.scrollElement.offScroll(l(this,ct)),this.scrollElement.axisAttibute.unsubscribe(l(this,ut))}};lt=new WeakMap;b=new WeakMap;O=new WeakMap;R=new WeakMap;Q=new WeakMap;X=new WeakMap;at=new WeakMap;ct=new WeakMap;ut=new WeakMap;pt=new WeakMap;exports.ScrollbarElement=Xt([wt.define("e-scrollbar")],exports.ScrollbarElement);
|
|
1
|
+
"use strict";var Vt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)};var h=(i,e,s)=>(Vt(i,e,"read from private field"),s?s.call(i):e.get(i)),_=(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)},x=(i,e,s,r)=>(Vt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yt=require("../Damped-9h4qaGcS.cjs"),jt=require("../Store-C-1ruEIm.cjs"),te=require("../Derived-B-g8dYgh.cjs"),zt=require("../browser-CpzFX2xg.cjs"),X=require("../layout-8ryRAMGJ.cjs"),Ut=require("../math-GDWEqu7y.cjs");require("../ticker/index.cjs");const It=require("../WheelControls-0zNcnAB3.cjs"),K=require("../custom-element/index.cjs"),Bt=require("../order/index.cjs"),yt=require("../window-resizer/index.cjs"),Y=require("../scroll-entries/index.cjs"),P=require("../tags-Dz_Yisj_.cjs"),At=require("../createStylesheet-u1ZQ2BI5.cjs"),ee=require("../css-unit-parser/index.cjs"),k=require("../css-property/index.cjs"),se=require("../dom-JBOkFLTh.cjs"),Ht=require("../theme/index.cjs"),ie=require("../function-MthRj-GJ.cjs");var re=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,he=(i,e,s,r)=>{for(var n=r>1?void 0:r?ne(e,s):e,o=i.length-1,a;o>=0;o--)(a=i[o])&&(n=(r?a(e,s,n):a(n))||n);return r&&n&&re(e,s,n),n},Dt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},t=(i,e,s)=>(Dt(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)},v=(i,e,s,r)=>(Dt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),m=(i,e,s)=>(Dt(i,e,"access private method"),s),u,E,z,M,B,J,C,I,N,Q,d,xt,p,dt,ft,S,f,T,L,G,b,st,H,lt,Ct,j,ot,Pt,Tt,Wt,qt,vt,Mt,mt,Lt,U,kt,Ot,Kt,gt,bt,$t,w,g,q,O;class le{constructor(e,s){_(this,w,void 0);_(this,g,void 0);_(this,q,0);_(this,O,0);x(this,w,e),x(this,g,s),Y.scrollEntries.register(h(this,w))}get size(){return h(this,q)}get position(){return h(this,O)}destroy(){Y.scrollEntries.unregister(h(this,w)),h(this,w).style.transform=""}resize(){x(this,q,h(this,g).vertical?h(this,w).offsetHeight:h(this,w).offsetWidth),x(this,O,h(this,g).vertical?X.getCumulativeOffsetTop(h(this,w)):X.getCumulativeOffsetLeft(h(this,w))),x(this,O,h(this,O)-h(this,g).contentPosition)}transform(){let e=0;const s=h(this,g).viewportSize-h(this,q);h(this,g).infiniteProperty.current&&h(this,g).overscroll&&h(this,O)+h(this,q)<h(this,g).currentScrollValue&&(e=h(this,g).distance*-1-h(this,g).gap),Y.scrollEntries.update(h(this,w),h(this,g).axisAttibute.current,e);const r=h(this,g).currentScrollValue+e,n=h(this,O)-h(this,g).viewportSize-s,o=h(this,O)+h(this,q)+s,a=Ut.clamp(r,n,o);h(this,g).vertical?h(this,w).style.transform=`translate3d(0px, ${a*-1}px, 0px)`:h(this,w).style.transform=`translate3d(${a*-1}px, 0px, 0px)`}}w=new WeakMap,g=new WeakMap,q=new WeakMap,O=new WeakMap;const oe=At.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 K.CustomElement{constructor(){super(),l(this,lt),l(this,j),l(this,Pt),l(this,Wt),l(this,vt),l(this,mt),l(this,Ot),l(this,bt),l(this,u,null),l(this,E,new k.CSSProperty(this,"--axis","y")),l(this,z,new k.CSSProperty(this,"--pages",0,{validate:e=>Math.max(0,e-1)})),l(this,M,new k.CSSProperty(this,"--split",!1)),l(this,B,new k.CSSProperty(this,"--sectional",!1)),l(this,J,new k.CSSProperty(this,"--wheel-max-delta",!1)),l(this,C,new k.CSSProperty(this,"--infinite",!1)),l(this,I,new k.CSSProperty(this,"--damping",.03)),l(this,N,new k.CSSProperty(this,"--disabled",!1)),l(this,Q,new k.CSSProperty(this,"--hibernated",!1)),l(this,d,null),l(this,xt,null),l(this,p,[]),l(this,dt,0),l(this,ft,0),l(this,S,0),l(this,f,0),l(this,T,0),l(this,L,null),l(this,G,null),l(this,b,new jt.Store(0)),l(this,st,0),l(this,H,0),l(this,U,()=>{const e=this.currentScrollValue/t(this,f)||0;if(v(this,dt,this.vertical?X.getCumulativeOffsetTop(this):X.getCumulativeOffsetLeft(this)),v(this,ft,this.vertical?X.getCumulativeOffsetTop(t(this,d)):X.getCumulativeOffsetLeft(t(this,d))),v(this,S,this.vertical?this.offsetHeight:this.offsetWidth),t(this,z).current){v(this,f,t(this,S)*t(this,z).current);const s=t(this,f)+t(this,S);this.vertical?(t(this,d).style.width=s+"px",t(this,d).style.height="100%"):(t(this,d).style.height=s+"px",t(this,d).style.width="100%")}else this.vertical?(t(this,d).style.width="100%",t(this,d).style.height="max-content",v(this,f,t(this,d).offsetHeight-t(this,S))):(t(this,d).style.width="max-content",t(this,d).style.height="100%",v(this,f,t(this,d).offsetWidth-t(this,S)));if(v(this,T,ee.cssUnitParser.parse(getComputedStyle(t(this,d)).gap)),!t(this,C).current){const s=getComputedStyle(this);v(this,f,t(this,f)+(this.vertical?parseFloat(s.paddingBlockStart)+parseFloat(s.paddingBlockEnd):parseFloat(s.paddingInlineStart)+parseFloat(s.paddingInlineEnd))),t(this,u).max=t(this,f)}if(t(this,p).forEach(s=>{s.resize(),s.transform()}),t(this,C).current&&t(this,p).length){const s=t(this,p)[t(this,p).length-1],r=s.position+s.size-t(this,S),n=t(this,f)-r;v(this,H,s.position+s.size+n)}else v(this,H,t(this,f));if(t(this,B).current&&t(this,p).length){const s=t(this,p)[t(this,b).current];t(this,u).set(s.position,!0)}else t(this,u).set(e*t(this,f),!0)}),l(this,kt,()=>{const e=this.currentScrollValue;if(v(this,st,Math.max(0,e-t(this,f))),t(this,p).length){let s=0;for(let r=0;r<t(this,p).length;r++){const n=t(this,p)[r];n.transform(),this.targetScrollValue+this.viewportSize/2>=n.position&&(s=r)}t(this,b).current=s}else this.vertical?t(this,d).style.transform=`translate3d(0px, ${e*-1}px, 0px)`:t(this,d).style.transform=`translate3d(${e*-1}px, 0px, 0px)`;Y.scrollEntries.update(this,t(this,E).current,e)}),l(this,gt,e=>{if(t(this,B).current){const s=Math.sign(e);t(this,p).length?this.shiftSections(s):t(this,u).shift(s*t(this,S))}else t(this,u).shift(e)}),zt.isBrowser&&(v(this,u,new Yt.Damped(0,{damping:.01,min:0,order:Bt.TICK_ORDER.SCROLL})),this.openShadow(oe),P.element(this,{tabIndex:0,children:[P.div({class:"static",children:[P.slot({name:"static"})]}),P.div({class:"content",children:[P.slot({ref:e=>v(this,xt,e)})],style:{flexDirection:new te.Derived(t(this,E),e=>e==="x"?"row":"column")},ref:e=>v(this,d,e)})]}),v(this,L,new It.WheelControls({element:this})),t(this,L).changeEvent.subscribe(t(this,gt)),v(this,G,new It.KeyboardControls({element:this})),t(this,G).changeEvent.subscribe(t(this,gt)),t(this,E).subscribe(({current:e})=>{t(this,d).style.flexDirection=e==="x"?"row":"column",t(this,L).axis=t(this,J).current?"max":e,t(this,G).dimension=e==="x"?"width":"height",this.isConnected&&t(this,U).call(this)}),t(this,J).subscribe(e=>{t(this,L).axis=e.current?"max":t(this,E).current}),t(this,z).subscribe(()=>{this.isConnected&&t(this,U).call(this)}),t(this,M).subscribe(({current:e})=>{this.isConnected&&(e?m(this,lt,Ct).call(this):m(this,j,ot).call(this))}),t(this,B).subscribe(e=>{t(this,b).current=0,t(this,L).debounce=e.current,t(this,u).reset(),this.isConnected&&(e.current&&!e.previous?m(this,lt,Ct).call(this):!e.current&&e.previous&&m(this,j,ot).call(this))}),t(this,C).subscribe(e=>{e.current?(this.isConnected&&(t(this,p).length||(t(this,M).current=!0)),t(this,p).length&&(t(this,u).max=1/0,t(this,u).min=-1/0)):(v(this,st,0),t(this,u).max=t(this,f),t(this,u).min=0)}),t(this,I).subscribe(e=>{t(this,u).damping=e.current}),t(this,N).subscribe(e=>{e.current&&!e.previous?m(this,Pt,Tt).call(this):!e.current&&e.previous&&m(this,Wt,qt).call(this)}),t(this,Q).subscribe(e=>{e.current&&!e.previous?m(this,vt,Mt).call(this):!e.current&&e.previous&&m(this,mt,Lt).call(this)}))}get dampingProperty(){return t(this,I)}get axisAttibute(){return t(this,E)}get pagesAttibute(){return t(this,z)}get splitAttibute(){return t(this,M)}get sectionalAttibute(){return t(this,B)}get infiniteProperty(){return t(this,C)}get dampingAttibute(){return t(this,I)}get disabledAttibute(){return t(this,N)}get hibernatedAttibute(){return t(this,Q)}get currentScrollValue(){return m(this,bt,$t).call(this,"current")}get targetScrollValue(){return m(this,bt,$t).call(this,"target")}get contentElement(){return t(this,d)}get sections(){return t(this,p)}get position(){return t(this,dt)}get contentPosition(){return t(this,ft)}get viewportSize(){return t(this,S)}get scrollSize(){return t(this,f)}get gap(){return t(this,T)}get counter(){return t(this,b)}get distance(){return t(this,H)}get overscroll(){return t(this,st)}get vertical(){return t(this,E).current==="y"}get currentProgress(){return this.currentScrollValue/t(this,H)||0}get targetProgress(){return this.targetScrollValue/t(this,H)||0}get speed(){return t(this,u).speed}get direction(){return t(this,u).direction}get isRunning(){return t(this,u).isRunning}get scrollWidth(){return t(this,E).current==="y"?0:t(this,u).length}get scrollHeight(){return t(this,E).current==="x"?0:t(this,u).length}onScroll(...e){return t(this,u).subscribe(...e)}offScroll(...e){t(this,u).unsubscribe(...e)}range(e,s,r=0){const n=e-r,o=n+s+r*2;return this.currentProgress<n?0:this.currentProgress>o?1:(this.currentProgress-n)/(o-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,o=n+s+r*2;return this.currentProgress>=n&&this.currentProgress<=o}scrollToSection(e,s="smooth"){if(!t(this,p).length)return;const r=t(this,b).current;m(this,Ot,Kt).call(this,e);const n=t(this,p)[r],o=t(this,p)[t(this,b).current];if(n&&o){let a=0;const pt=t(this,p).length-1;t(this,C).current?t(this,b).current===0&&r===pt?a=t(this,f)+t(this,S)-n.position+t(this,T):t(this,b).current===pt&&r===0?a=o.position-(t(this,f)+t(this,S)+t(this,T)):a=o.position-n.position:a=o.position-n.position,t(this,u).shift(a,s==="instant")}}shiftSections(e,s="smooth"){t(this,p).length&&this.scrollToSection(t(this,b).current+e,s)}setPosition(e,s="smooth"){t(this,u).set(e,s==="instant")}connectedCallback(){t(this,E).observe(),t(this,z).observe(),t(this,M).observe(),t(this,B).observe(),t(this,J).observe(),t(this,C).observe(),t(this,I).observe(),t(this,N).observe(),t(this,Q).observe(),m(this,mt,Lt).call(this)}disconnectedCallback(){t(this,E).unobserve(),t(this,z).unobserve(),t(this,M).unobserve(),t(this,B).unobserve(),t(this,J).unobserve(),t(this,C).unobserve(),t(this,I).unobserve(),t(this,N).unobserve(),t(this,Q).unobserve(),m(this,vt,Mt).call(this)}};u=new WeakMap;E=new WeakMap;z=new WeakMap;M=new WeakMap;B=new WeakMap;J=new WeakMap;C=new WeakMap;I=new WeakMap;N=new WeakMap;Q=new WeakMap;d=new WeakMap;xt=new WeakMap;p=new WeakMap;dt=new WeakMap;ft=new WeakMap;S=new WeakMap;f=new WeakMap;T=new WeakMap;L=new WeakMap;G=new WeakMap;b=new WeakMap;st=new WeakMap;H=new WeakMap;lt=new WeakSet;Ct=function(){m(this,j,ot).call(this),t(this,xt).assignedElements().forEach(i=>{i instanceof HTMLElement&&t(this,p).push(new le(i,this))}),t(this,d).style.transform="",this.dispatchEvent(new CustomEvent("sectionsChange",{composed:!0})),t(this,U).call(this)};j=new WeakSet;ot=function(){t(this,p).forEach(i=>{i.destroy()}),v(this,p,[]),this.dispatchEvent(new CustomEvent("sectionsChange",{composed:!0}))};Pt=new WeakSet;Tt=function(){t(this,u).unsubscribe(t(this,kt)),t(this,u).stopAnimation(),t(this,L).disconnect(),t(this,G).disconnect()};Wt=new WeakSet;qt=function(){t(this,u).subscribe(t(this,kt)),t(this,L).connect(),t(this,G).connect()};vt=new WeakSet;Mt=function(){yt.windowResizer.unsubscribe(t(this,U)),t(this,u).reset(),m(this,Pt,Tt).call(this),t(this,d).style.transform="",t(this,M).current&&m(this,j,ot).call(this),Y.scrollEntries.unregister(this)};mt=new WeakSet;Lt=function(){t(this,M).current&&m(this,lt,Ct).call(this),Y.scrollEntries.register(this),yt.windowResizer.subscribe(t(this,U),Bt.RESIZE_ORDER.SCROLL),m(this,Wt,qt).call(this)};U=new WeakMap;kt=new WeakMap;Ot=new WeakSet;Kt=function(i){t(this,C).current?(t(this,b).current=i%t(this,p).length,t(this,b).current=t(this,b).current<0?t(this,p).length+t(this,b).current:t(this,b).current):t(this,b).current=Ut.clamp(i,0,t(this,p).length-1)};gt=new WeakMap;bt=new WeakSet;$t=function(i="current"){if(t(this,C).current&&t(this,p).length){const e=t(this,u)[i]%(t(this,f)+t(this,S)+t(this,T));return e<0?t(this,f)+e+t(this,S)+t(this,T):e}else return t(this,u)[i]};exports.ScrollElement=he([K.define("e-scroll")],exports.ScrollElement);var ct;class Rt extends K.CustomElement{constructor(){super(...arguments);_(this,ct,null)}get scrollElement(){return h(this,ct)}connectedCallback(){const s=se.findParentElement(this,exports.ScrollElement);s instanceof exports.ScrollElement?x(this,ct,s):console.error(this,"e-scroll not found")}}ct=new WeakMap;var ce=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,ue=(i,e,s,r)=>{for(var n=r>1?void 0:r?ae(e,s):e,o=i.length-1,a;o>=0;o--)(a=i[o])&&(n=(r?a(e,s,n):a(n))||n);return r&&n&&ce(e,s,n),n},Zt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},c=(i,e,s)=>(Zt(i,e,"read from private field"),s?s.call(i):e.get(i)),W=(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)},V=(i,e,s,r)=>(Zt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),it,y,A,D,rt,nt,St,wt,_t,Et;const pe=At.createStylesheet({":host":{display:"inline-block",zIndex:"1",backgroundColor:Ht.aptechkaTheme.colorLight.var},':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:Ht.aptechkaTheme.colorDark.var,borderRadius:"1vmin",touchAction:"none"},"::slotted(*)":{touchAction:"none"}});exports.ScrollbarElement=class extends Rt{constructor(){super(),W(this,it,null),W(this,y,null),W(this,A,!1),W(this,D,0),W(this,rt,0),W(this,nt,0),W(this,St,()=>{V(this,A,this.offsetWidth>this.offsetHeight);const e=c(this,A)?this.offsetWidth:this.offsetHeight;V(this,D,e/((this.scrollElement.scrollSize+this.scrollElement.viewportSize)/e)),V(this,D,Math.max(c(this,D),30)),c(this,A)?(c(this,y).style.width=c(this,D)+"px",c(this,y).style.height="100%"):(c(this,y).style.width="100%",c(this,y).style.height=c(this,D)+"px"),V(this,rt,e-c(this,D)),this.scrollElement.scrollSize||(this.style.display="none")}),W(this,wt,()=>{V(this,nt,this.scrollElement.currentProgress*c(this,rt)),c(this,A)?c(this,y).style.transform=`translate3d(${c(this,nt)}px, 0px, 0px)`:c(this,y).style.transform=`translate3d(0px, ${c(this,nt)}px, 0px)`}),W(this,_t,()=>{this.setAttribute("axis",this.scrollElement.axisAttibute.current)}),W(this,Et,e=>{const s=a=>{const pt=c(this,A)?a.x:a.y,Qt=this.scrollElement.distance/c(this,rt),Xt=(pt-o)*Qt;this.scrollElement.setPosition(n+Xt)},r=()=>{removeEventListener("pointermove",s),removeEventListener("pointerup",r),removeEventListener("touchend",r)};addEventListener("pointermove",s),addEventListener("pointerup",r),addEventListener("touchend",r);const n=this.scrollElement.targetScrollValue,o=c(this,A)?e.x:e.y}),zt.isBrowser&&(this.openShadow(pe),P.element(this,{slot:"static",children:[P.slot({ref:e=>V(this,it,e),children:P.div({class:"default-thumb"})})]}))}get thumbElement(){return c(this,y)}connectedCallback(){super.connectedCallback();const e=c(this,it).assignedElements()[0]||c(this,it).firstElementChild;V(this,y,e),c(this,y).addEventListener("pointerdown",c(this,Et)),yt.windowResizer.subscribe(c(this,St),Bt.RESIZE_ORDER.SCROLL+1),this.scrollElement.onScroll(c(this,wt)),this.scrollElement.axisAttibute.subscribe(c(this,_t))}disconnectedCallback(){c(this,y).removeEventListener("pointerdown",c(this,Et)),yt.windowResizer.unsubscribe(c(this,St)),this.scrollElement.offScroll(c(this,wt)),this.scrollElement.axisAttibute.unsubscribe(c(this,_t))}};it=new WeakMap;y=new WeakMap;A=new WeakMap;D=new WeakMap;rt=new WeakMap;nt=new WeakMap;St=new WeakMap;wt=new WeakMap;_t=new WeakMap;Et=new WeakMap;exports.ScrollbarElement=ue([K.define("e-scrollbar")],exports.ScrollbarElement);const de=At.createStylesheet({button:{all:"inherit"}});class Jt extends Rt{constructor(){super(),this.openShadow(de),zt.isBrowser&&P.element(this,{children:[P.button({onClick:()=>{this.handleClick()},children:[P.slot()]})]})}}var fe=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,me=(i,e,s,r)=>{for(var n=r>1?void 0:r?ve(e,s):e,o=i.length-1,a;o>=0;o--)(a=i[o])&&(n=(r?a(e,s,n):a(n))||n);return r&&n&&fe(e,s,n),n};exports.ScrollSetButtonElement=class extends Jt{handleClick(){const e=this.getAttribute("index"),s=this.getAttribute("behaviour");this.scrollElement.scrollToSection(parseInt(e||"0"),s)}};exports.ScrollSetButtonElement=me([K.define("e-scroll-set-button")],exports.ScrollSetButtonElement);var ge=Object.defineProperty,be=Object.getOwnPropertyDescriptor,Se=(i,e,s,r)=>{for(var n=r>1?void 0:r?be(e,s):e,o=i.length-1,a;o>=0;o--)(a=i[o])&&(n=(r?a(e,s,n):a(n))||n);return r&&n&&ge(e,s,n),n};exports.ScrollStepButtonElement=class extends Jt{handleClick(){const e=this.getAttribute("step"),s=this.getAttribute("behaviour");this.scrollElement.shiftSections(parseInt(e||"1"),s)}};exports.ScrollStepButtonElement=Se([K.define("e-scroll-step-button")],exports.ScrollStepButtonElement);var we=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,Ee=(i,e,s,r)=>{for(var n=r>1?void 0:r?_e(e,s):e,o=i.length-1,a;o>=0;o--)(a=i[o])&&(n=(r?a(e,s,n):a(n))||n);return r&&n&&we(e,s,n),n},Nt=(i,e,s)=>{if(!e.has(i))throw TypeError("Cannot "+s)},Z=(i,e,s)=>(Nt(i,e,"read from private field"),s?s.call(i):e.get(i)),Ft=(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)},Gt=(i,e,s,r)=>(Nt(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),F,ht,$,R,tt,at,ut,et;class ye{constructor(e,s,r){_(this,$,void 0);_(this,R,void 0);_(this,tt,void 0);_(this,at,void 0);_(this,ut,()=>{h(this,R).scrollToSection(h(this,tt),h(this,at))});_(this,et,()=>{h(this,$).classList.toggle("current",h(this,R).counter.current===h(this,tt))});x(this,$,document.createElement("button")),x(this,R,e),x(this,at,r),x(this,tt,s),h(this,$).addEventListener("click",h(this,ut)),h(this,R).counter.subscribe(h(this,et)),h(this,et).call(this)}get element(){return h(this,$)}destroy(){h(this,$).removeEventListener("click",h(this,ut)),h(this,R).counter.unsubscribe(h(this,et)),h(this,$).remove()}}$=new WeakMap,R=new WeakMap,tt=new WeakMap,at=new WeakMap,ut=new WeakMap,et=new WeakMap;exports.ScrollBulletButtonsElement=class extends Rt{constructor(){super(...arguments),Ft(this,F,[]),Ft(this,ht,ie.debounce(()=>{Z(this,F).forEach(e=>e.destroy()),Gt(this,F,[]);for(let e=0;e<this.scrollElement.sections.length;e++){const s=new ye(this.scrollElement,e,this.getAttribute("behaviour")||"smooth");this.appendChild(s.element),Z(this,F).push(s)}},0))}connectedCallback(){super.connectedCallback(),this.scrollElement.addEventListener("sectionsChange",Z(this,ht)),Z(this,ht).call(this)}disconnectedCallback(){this.scrollElement.removeEventListener("sectionsChange",Z(this,ht)),Z(this,F).forEach(e=>e.destroy()),Gt(this,F,[])}};F=new WeakMap;ht=new WeakMap;exports.ScrollBulletButtonsElement=Ee([K.define("e-scroll-bullet-buttons")],exports.ScrollBulletButtonsElement);
|
package/lib/scroll/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { ScrollElement } from './ScrollElement';
|
|
2
2
|
export { ScrollbarElement } from './ScrollbarElement';
|
|
3
|
+
export { ScrollSetButtonElement } from './ScrollSetButtonElement';
|
|
4
|
+
export { ScrollStepButtonElement } from './ScrollStepButtonElement';
|
|
5
|
+
export { ScrollBulletButtonsElement } from './ScrollBulletButtonsElement';
|