@hybridcore/ui 1.6.21 → 1.6.23

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.
@@ -1,171 +0,0 @@
1
- import { R as b } from "./RoundedRectangle-BKLX1LKM.js";
2
- import { C as w, G as v } from "./Tooltip-vyZRZWih.js";
3
- import { B as x } from "./Button-BLY4PVJC.js";
4
- import { m as f, q as D, f as g } from "./Entity-BJCuhdq_.js";
5
- class _ extends w {
6
- constructor() {
7
- super(...arguments), Object.defineProperty(this, "thumb", {
8
- enumerable: !0,
9
- configurable: !0,
10
- writable: !0,
11
- value: this._makeThumb()
12
- }), Object.defineProperty(this, "startGrip", {
13
- enumerable: !0,
14
- configurable: !0,
15
- writable: !0,
16
- value: this._makeButton()
17
- }), Object.defineProperty(this, "endGrip", {
18
- enumerable: !0,
19
- configurable: !0,
20
- writable: !0,
21
- value: this._makeButton()
22
- }), Object.defineProperty(this, "_thumbBusy", {
23
- enumerable: !0,
24
- configurable: !0,
25
- writable: !0,
26
- value: !1
27
- }), Object.defineProperty(this, "_startDown", {
28
- enumerable: !0,
29
- configurable: !0,
30
- writable: !0,
31
- value: !1
32
- }), Object.defineProperty(this, "_endDown", {
33
- enumerable: !0,
34
- configurable: !0,
35
- writable: !0,
36
- value: !1
37
- }), Object.defineProperty(this, "_thumbDown", {
38
- enumerable: !0,
39
- configurable: !0,
40
- writable: !0,
41
- value: !1
42
- }), Object.defineProperty(this, "_gripDown", {
43
- enumerable: !0,
44
- configurable: !0,
45
- writable: !0,
46
- value: void 0
47
- });
48
- }
49
- _addOrientationClass() {
50
- this._settings.themeTags = f(this._settings.themeTags, ["scrollbar", this._settings.orientation]), this._settings.background || (this._settings.background = b.new(this._root, {
51
- themeTags: f(this._settings.themeTags, ["main", "background"])
52
- }));
53
- }
54
- _makeButton() {
55
- return this.children.push(x.new(this._root, {
56
- themeTags: ["resize", "button", this.get("orientation")],
57
- icon: v.new(this._root, {
58
- themeTags: ["icon"]
59
- })
60
- }));
61
- }
62
- _makeThumb() {
63
- return this.children.push(b.new(this._root, {
64
- themeTags: ["thumb", this.get("orientation")]
65
- }));
66
- }
67
- _handleAnimation(t) {
68
- t && this._disposers.push(t.events.on("stopped", () => {
69
- this.setPrivateRaw("isBusy", !1), this._thumbBusy = !1;
70
- }));
71
- }
72
- _afterNew() {
73
- this._addOrientationClass(), super._afterNew();
74
- const t = this.startGrip, s = this.endGrip, i = this.thumb, n = this.get("background");
75
- n && this._disposers.push(n.events.on("click", (e) => {
76
- this.setPrivateRaw("isBusy", !0);
77
- const a = this._display.toLocal(e.point), r = this.width(), o = this.height(), u = this.get("orientation");
78
- let h;
79
- u == "vertical" ? h = (a.y - i.height() / 2) / o : h = (a.x - i.width() / 2) / r;
80
- let d, l;
81
- u == "vertical" ? (d = h * o, l = "y") : (d = h * r, l = "x");
82
- const p = this.get("animationDuration", 0);
83
- p > 0 ? (this._thumbBusy = !0, this._handleAnimation(this.thumb.animate({ key: l, to: d, duration: p, easing: this.get("animationEasing") }))) : (this.thumb.set(l, d), this._root.events.once("frameended", () => {
84
- this.setPrivateRaw("isBusy", !1);
85
- }));
86
- })), this._disposers.push(i.events.on("dblclick", (e) => {
87
- if (!D(e.originalEvent, this))
88
- return;
89
- const a = this.get("animationDuration", 0), r = this.get("animationEasing");
90
- this.animate({ key: "start", to: 0, duration: a, easing: r }), this.animate({ key: "end", to: 1, duration: a, easing: r });
91
- })), this._disposers.push(t.events.on("pointerdown", () => {
92
- this.setPrivateRaw("isBusy", !0), this._startDown = !0, this._gripDown = "start";
93
- })), this._disposers.push(s.events.on("pointerdown", () => {
94
- this.setPrivateRaw("isBusy", !0), this._endDown = !0, this._gripDown = "end";
95
- })), this._disposers.push(i.events.on("pointerdown", () => {
96
- this.setPrivateRaw("isBusy", !0), this._thumbDown = !0, this._gripDown = void 0;
97
- })), this._disposers.push(t.events.on("globalpointerup", () => {
98
- this._startDown && (this.setPrivateRaw("isBusy", !1), this._released()), this._startDown = !1;
99
- })), this._disposers.push(s.events.on("globalpointerup", () => {
100
- this._endDown && (this.setPrivateRaw("isBusy", !1), this._released()), this._endDown = !1;
101
- })), this._disposers.push(i.events.on("globalpointerup", () => {
102
- this._thumbDown && (this.setPrivateRaw("isBusy", !1), this._released()), this._thumbDown = !1;
103
- })), this._disposers.push(t.on("x", () => {
104
- this._updateThumb();
105
- })), this._disposers.push(s.on("x", () => {
106
- this._updateThumb();
107
- })), this._disposers.push(t.on("y", () => {
108
- this._updateThumb();
109
- })), this._disposers.push(s.on("y", () => {
110
- this._updateThumb();
111
- })), this._disposers.push(i.events.on("positionchanged", () => {
112
- this._updateGripsByThumb();
113
- })), this.get("orientation") == "vertical" ? (t.set("x", 0), s.set("x", 0), this._disposers.push(i.adapters.add("y", (e) => Math.max(Math.min(Number(e), this.height() - i.height()), 0))), this._disposers.push(i.adapters.add("x", (e) => this.width() / 2)), this._disposers.push(t.adapters.add("x", (e) => this.width() / 2)), this._disposers.push(s.adapters.add("x", (e) => this.width() / 2)), this._disposers.push(t.adapters.add("y", (e) => Math.max(Math.min(Number(e), this.height()), 0))), this._disposers.push(s.adapters.add("y", (e) => Math.max(Math.min(Number(e), this.height()), 0)))) : (t.set("y", 0), s.set("y", 0), this._disposers.push(i.adapters.add("x", (e) => Math.max(Math.min(Number(e), this.width() - i.width()), 0))), this._disposers.push(i.adapters.add("y", (e) => this.height() / 2)), this._disposers.push(t.adapters.add("y", (e) => this.height() / 2)), this._disposers.push(s.adapters.add("y", (e) => this.height() / 2)), this._disposers.push(t.adapters.add("x", (e) => Math.max(Math.min(Number(e), this.width()), 0))), this._disposers.push(s.adapters.add("x", (e) => Math.max(Math.min(Number(e), this.width()), 0))));
114
- }
115
- _updateChildren() {
116
- super._updateChildren(), (this.isDirty("end") || this.isDirty("start") || this._sizeDirty) && this.updateGrips();
117
- }
118
- _changed() {
119
- if (super._changed(), this.isDirty("start") || this.isDirty("end")) {
120
- const t = "rangechanged";
121
- this.events.isEnabled(t) && this.events.dispatch(t, { type: t, target: this, start: this.get("start", 0), end: this.get("end", 1), grip: this._gripDown });
122
- }
123
- }
124
- _released() {
125
- const t = "released";
126
- this.events.isEnabled(t) && this.events.dispatch(t, { type: t, target: this });
127
- }
128
- /**
129
- * @ignore
130
- */
131
- updateGrips() {
132
- const t = this.startGrip, s = this.endGrip, i = this.get("orientation"), n = this.height(), e = this.width();
133
- i == "vertical" ? (t.set("y", n * this.get("start", 0)), s.set("y", n * this.get("end", 1))) : (t.set("x", e * this.get("start", 0)), s.set("x", e * this.get("end", 1)));
134
- const a = this.getPrivate("positionTextFunction"), r = Math.round(this.get("start", 0) * 100), o = Math.round(this.get("end", 0) * 100);
135
- let u, h;
136
- a ? (u = a.call(this, this.get("start", 0)), h = a.call(this, this.get("end", 0))) : (u = r + "%", h = o + "%"), t.set("ariaLabel", this._t("From %1", void 0, u)), t.set("ariaValueNow", "" + r), t.set("ariaValueText", r + "%"), t.set("ariaValueMin", "0"), t.set("ariaValueMax", "100"), s.set("ariaLabel", this._t("To %1", void 0, h)), s.set("ariaValueNow", "" + o), s.set("ariaValueText", o + "%"), s.set("ariaValueMin", "0"), s.set("ariaValueMax", "100");
137
- }
138
- _updateThumb() {
139
- const t = this.thumb, s = this.startGrip, i = this.endGrip, n = this.height(), e = this.width();
140
- let a = s.x(), r = i.x(), o = s.y(), u = i.y(), h = 0, d = 1;
141
- this.get("orientation") == "vertical" ? g(o) && g(u) && (!this._thumbBusy && !t.isDragging() && (t.set("height", u - o), t.set("y", o)), h = o / n, d = u / n) : g(a) && g(r) && (!this._thumbBusy && !t.isDragging() && (t.set("width", r - a), t.set("x", a)), h = a / e, d = r / e), this.getPrivate("isBusy") && (this.get("start") != h || this.get("end") != d) && (this.set("start", h), this.set("end", d));
142
- const l = this.getPrivate("positionTextFunction"), p = Math.round(this.get("start", 0) * 100), y = Math.round(this.get("end", 0) * 100);
143
- let c, m;
144
- l ? (c = l.call(this, this.get("start", 0)), m = l.call(this, this.get("end", 0))) : (c = p + "%", m = y + "%"), t.set("ariaLabel", this._t("From %1 to %2", void 0, c, m)), t.set("ariaValueNow", "" + p), t.set("ariaValueText", p + "%");
145
- }
146
- _updateGripsByThumb() {
147
- const t = this.thumb, s = this.startGrip, i = this.endGrip;
148
- if (this.get("orientation") == "vertical") {
149
- const n = t.height();
150
- s.set("y", t.y()), i.set("y", t.y() + n);
151
- } else {
152
- const n = t.width();
153
- s.set("x", t.x()), i.set("x", t.x() + n);
154
- }
155
- }
156
- }
157
- Object.defineProperty(_, "className", {
158
- enumerable: !0,
159
- configurable: !0,
160
- writable: !0,
161
- value: "Scrollbar"
162
- });
163
- Object.defineProperty(_, "classNames", {
164
- enumerable: !0,
165
- configurable: !0,
166
- writable: !0,
167
- value: w.classNames.concat([_.className])
168
- });
169
- export {
170
- _ as S
171
- };