@sheetxl/utils-react 0.3.17 → 0.3.19
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/browser/cjs/index.cjs +2 -2
- package/browser/esm/index.mjs +897 -868
- package/node/esm/index.mjs +741 -711
- package/package.json +2 -2
package/node/esm/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.3.
|
|
2
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.3.19
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { jsx as
|
|
7
|
+
import { jsx as t, jsxs as e, Fragment as n } from "react/jsx-runtime";
|
|
8
8
|
import o, { useCallback as i, useRef as r, memo as s, forwardRef as l, useState as a, useEffect as c, useMemo as h, useImperativeHandle as u, useLayoutEffect as d, createElement as _, useReducer as p } from "react";
|
|
9
9
|
import m from "clsx";
|
|
10
10
|
import { useMeasure as f } from "react-use";
|
|
@@ -13,27 +13,27 @@ import * as b from "detect-it";
|
|
|
13
13
|
import { mergeRefs as w } from "react-merge-refs";
|
|
14
14
|
import { createRoot as S } from "react-dom/client";
|
|
15
15
|
import { unstable_batchedUpdates as L } from "react-dom";
|
|
16
|
-
const C = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, E = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, T = { BackSpace: 8, Tab: 9, Clear: 12, Enter: 13, Shift: 16, Control: 17, Alt: 18, Pause: 19, CapsLock: 20, Escape: 27, Space: 32, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, Digit_8: 56, Y: 89, Z: 90, Meta: 91, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NumLock: 144, ScrollLock: 145, BackSlash: 220, Slash: 191, BracketRight: 221, BracketLeft: 219 }, M = { Left: 1, Middle: 2, Right: 3 }, D = { Horizontal: "horizontal", Vertical: "vertical" }, P = (
|
|
17
|
-
const n2 = i((...
|
|
16
|
+
const C = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, E = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, T = { BackSpace: 8, Tab: 9, Clear: 12, Enter: 13, Shift: 16, Control: 17, Alt: 18, Pause: 19, CapsLock: 20, Escape: 27, Space: 32, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, Digit_8: 56, Y: 89, Z: 90, Meta: 91, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NumLock: 144, ScrollLock: 145, BackSlash: 220, Slash: 191, BracketRight: 221, BracketLeft: 219 }, M = { Left: 1, Middle: 2, Right: 3 }, D = { Horizontal: "horizontal", Vertical: "vertical" }, P = (t2, e2) => {
|
|
17
|
+
const n2 = i((...e3) => t2?.(...e3), e2), o2 = r(null);
|
|
18
18
|
o2.current = n2;
|
|
19
|
-
const s2 = i((...
|
|
19
|
+
const s2 = i((...t3) => o2.current?.(...t3), []);
|
|
20
20
|
if (o2.current) return s2;
|
|
21
|
-
}, z = (
|
|
22
|
-
const { style: n2, orientation: o2 = D.Vertical, ...i2 } =
|
|
23
|
-
return
|
|
24
|
-
}, k = (
|
|
25
|
-
const { style: n2, orientation: o2 = D.Vertical, ...i2 } =
|
|
26
|
-
return
|
|
27
|
-
}, A = (
|
|
28
|
-
const { style: n2, orientation: o2 = D.Vertical, ...i2 } =
|
|
29
|
-
return
|
|
30
|
-
}, B = (
|
|
21
|
+
}, z = (e2) => {
|
|
22
|
+
const { style: n2, orientation: o2 = D.Vertical, ...i2 } = e2, r2 = o2 === D.Vertical;
|
|
23
|
+
return t("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: r2 ? "0px" : "3px", paddingTop: r2 ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...n2 }, ...i2, children: t("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} single-button start`, children: t("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: t("path", { d: r2 ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
|
|
24
|
+
}, k = (e2) => {
|
|
25
|
+
const { style: n2, orientation: o2 = D.Vertical, ...i2 } = e2, r2 = o2 === D.Vertical;
|
|
26
|
+
return t("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: r2 ? "0px" : "3px", paddingBottom: r2 ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...n2 }, ...i2, children: t("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} single-button end`, children: t("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: t("path", { d: r2 ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
|
|
27
|
+
}, A = (e2) => {
|
|
28
|
+
const { style: n2, orientation: o2 = D.Vertical, ...i2 } = e2, r2 = o2 === D.Vertical;
|
|
29
|
+
return t("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...n2 }, className: `scrollbar-button ${r2 ? "vertical" : "horizontal"} edge`, ...i2, children: t("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: r2 ? "rotate(90) " : "", children: t("path", { style: { transition: "opacity 240ms ease 0s", opacity: e2.disabled ? 0 : 1 }, d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" }) }) });
|
|
30
|
+
}, B = (t2, e2, n2, o2, i2 = 0) => {
|
|
31
31
|
for (let i3 = 0; i3 < n2.length; i3++) {
|
|
32
32
|
const r2 = n2[i3].getBoundingClientRect();
|
|
33
|
-
let s2 = r2.left -
|
|
33
|
+
let s2 = r2.left - e2, l2 = s2 + r2.width;
|
|
34
34
|
if (o2) {
|
|
35
|
-
if (s2 <
|
|
36
|
-
} else if (Math.ceil(l2) > Math.ceil(
|
|
35
|
+
if (s2 < t2 && l2 >= t2) return s2;
|
|
36
|
+
} else if (Math.ceil(l2) > Math.ceil(t2) + 2) return l2;
|
|
37
37
|
}
|
|
38
38
|
return i2;
|
|
39
39
|
}, $ = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: B }, Symbol.toStringTag, { value: "Module" })), K = "_sheetxl-scrollbar_eblx4_6", O = s(l((n2, o2) => {
|
|
@@ -41,498 +41,528 @@ const C = { General: "general", Left: "left", Right: "right", Center: "center",
|
|
|
41
41
|
c(() => {
|
|
42
42
|
null !== Y2 && T2.current && T2.current.scrollTo({ behavior: "smooth", [N2]: Y2 });
|
|
43
43
|
}, [Y2, W2]);
|
|
44
|
-
const j2 = i((
|
|
44
|
+
const j2 = i((t2, e2 = false) => {
|
|
45
45
|
if (!T2.current) return 0;
|
|
46
|
-
const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 =
|
|
46
|
+
const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = e2 ? 0 : B(t2, o3[N2], i2, true, Math.max(0, t2 - x2));
|
|
47
47
|
return X2(r2), Math.max(0, r2);
|
|
48
|
-
}, []), U2 = i((
|
|
48
|
+
}, []), U2 = i((t2, e2 = false) => {
|
|
49
49
|
if (!T2.current) return 0;
|
|
50
|
-
const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = Math.ceil(I2 - F2), s3 =
|
|
50
|
+
const n3 = T2.current.querySelector(".scrollbar-viewport"), o3 = n3.getBoundingClientRect(), i2 = n3.children, r2 = Math.ceil(I2 - F2), s3 = e2 ? r2 : B(t2, o3[N2], i2, false, Math.max(0, t2 + x2));
|
|
51
51
|
return X2(s3), Math.min(r2, s3);
|
|
52
|
-
}, [I2, F2]), Z2 = r(null), G2 = i((
|
|
52
|
+
}, [I2, F2]), Z2 = r(null), G2 = i((t2) => {
|
|
53
53
|
Z2.current = s2;
|
|
54
|
-
const
|
|
55
|
-
g2(
|
|
54
|
+
const e2 = t2.target[R2];
|
|
55
|
+
g2(e2, u2, l2), E2?.(t2);
|
|
56
56
|
}, [g2, u2, l2, s2]);
|
|
57
57
|
c(() => {
|
|
58
|
-
const
|
|
59
|
-
Z2.current = null, s2 !==
|
|
58
|
+
const t2 = Z2.current;
|
|
59
|
+
Z2.current = null, s2 !== t2 && (T2.current[R2] = s2);
|
|
60
60
|
}, [s2, R2]);
|
|
61
61
|
const q2 = r(null), J2 = r(null), Q2 = i(() => {
|
|
62
62
|
q2.current && (clearTimeout(q2.current), q2.current = null, J2.current = null);
|
|
63
|
-
}, []),
|
|
64
|
-
J2.current =
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
},
|
|
63
|
+
}, []), tt2 = i((t2, e2, n3, o3 = b2) => {
|
|
64
|
+
J2.current = t2, q2.current = setTimeout(() => {
|
|
65
|
+
const e3 = n3 ? j2(J2.current || t2) : U2(J2.current || t2);
|
|
66
|
+
e3 !== J2.current ? tt2(e3, false, n3, w2) : Q2();
|
|
67
|
+
}, e2 ? 0 : o3);
|
|
68
68
|
}, [j2, U2, Q2]);
|
|
69
69
|
c(() => () => Q2(), [Q2]);
|
|
70
|
-
const
|
|
70
|
+
const et2 = s2, nt2 = h(() => {
|
|
71
71
|
if (!v2) return null;
|
|
72
|
-
const
|
|
73
|
-
return S2?.(
|
|
74
|
-
}, [v2, p2,
|
|
72
|
+
const t2 = { orientation: p2, disabled: Math.floor(et2) <= 0 || 0 === Math.floor(I2 - F2), onMouseUp: Q2, onMouseLeave: Q2, onMouseDown: () => tt2(et2, true, true) };
|
|
73
|
+
return S2?.(t2);
|
|
74
|
+
}, [v2, p2, et2, Y2, I2, F2]), ot2 = h(() => {
|
|
75
75
|
if (!v2) return null;
|
|
76
|
-
const
|
|
77
|
-
return L2?.(
|
|
78
|
-
}, [v2, p2,
|
|
79
|
-
return
|
|
76
|
+
const t2 = { orientation: p2, disabled: Math.floor(I2 - F2) <= Math.ceil(et2), onMouseUp: Q2, onMouseLeave: Q2, onMouseDown: () => tt2(et2, true, false) };
|
|
77
|
+
return L2?.(t2);
|
|
78
|
+
}, [v2, p2, et2, Y2, I2, F2]);
|
|
79
|
+
return e("div", { ref: o2, style: { display: "flex", flex: "1", flexDirection: W2 ? "column" : "row", padding: "0", ...d2 }, className: m(K, _2), ...C2, children: [nt2, t("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: W2 ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: M2, children: t("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: W2 ? "scroll" : "hidden", overflowX: W2 ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: G2, ref: T2, children: t("div", { ref: O2, style: { position: "absolute", height: W2 ? l2 - u2 + ($2 ?? 0) : 1, width: W2 ? 1 : l2 - u2 + (A2 ?? 0) }, className: "scrollbar-viewport" }) }) }), ot2] });
|
|
80
80
|
}));
|
|
81
81
|
O.displayName = "Scrollbar";
|
|
82
82
|
let V = Date.now, H = 1e3, W = {}, N = 1;
|
|
83
|
-
const R = (
|
|
84
|
-
let
|
|
85
|
-
return
|
|
86
|
-
}, F = (
|
|
87
|
-
let r2 = V(), s2 = r2, l2 = 0, a2 = 0, c2 = N++;
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
for (let
|
|
91
|
-
W =
|
|
83
|
+
const R = (t2) => {
|
|
84
|
+
let e2 = null !== W[t2];
|
|
85
|
+
return e2 && (W[t2] = null), e2;
|
|
86
|
+
}, F = (t2, e2, n2, o2 = 0, i2) => {
|
|
87
|
+
let r2 = V(), s2 = r2, l2 = 0, a2 = 0, c2 = 0, h2 = N++;
|
|
88
|
+
if (h2 % 20 == 0) {
|
|
89
|
+
const t3 = {};
|
|
90
|
+
for (let e3 in W) t3[e3] = true;
|
|
91
|
+
W = t3;
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const u2 = function(d2) {
|
|
94
|
+
let _2 = true !== d2, p2 = V(), m2 = true;
|
|
95
|
+
try {
|
|
96
|
+
m2 = (!e2 || e2(h2)) ?? true;
|
|
97
|
+
} catch (t3) {
|
|
98
|
+
m2 = false;
|
|
99
|
+
}
|
|
100
|
+
if (!W[h2] || !m2) return W[h2] = null, void n2?.(60 - a2 / ((p2 - r2) / H), h2, false);
|
|
101
|
+
if (_2) {
|
|
102
|
+
c2 = Math.round((p2 - s2) / 16.666666666666668) - 1;
|
|
103
|
+
for (let t3 = 0; t3 < Math.min(c2, 4); t3++) u2(true), a2++;
|
|
104
|
+
}
|
|
105
|
+
o2 && (l2 = (p2 - r2) / o2, l2 > 1 && (l2 = 1));
|
|
106
|
+
let f2 = i2 ? i2(l2) : l2, g2 = false;
|
|
107
|
+
try {
|
|
108
|
+
g2 = t2(f2, p2, _2);
|
|
109
|
+
} catch (t3) {
|
|
110
|
+
g2 = false;
|
|
99
111
|
}
|
|
100
|
-
|
|
101
|
-
const p2 = i2 ? i2(l2) : l2;
|
|
102
|
-
false !== e2(p2, _2, d2) && 1 !== l2 || !d2 ? d2 && (s2 = _2, requestAnimationFrame(h2)) : (W[c2] = null, n2(60 - a2 / ((_2 - r2) / H), c2, 1 === l2 || void 0 === o2));
|
|
112
|
+
false !== g2 && 1 !== l2 || !_2 ? _2 && (s2 = p2, requestAnimationFrame(u2)) : (W[h2] = null, n2?.(60 - a2 / ((p2 - r2) / H), h2, 1 === l2 || null == o2));
|
|
103
113
|
};
|
|
104
|
-
return W[
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}, Y = function(
|
|
108
|
-
return Math.pow(
|
|
109
|
-
}, X = function(e2) {
|
|
110
|
-
return (e2 /= 0.5) < 1 ? 0.5 * Math.pow(e2, 3) : 0.5 * (Math.pow(e2 - 2, 3) + 2);
|
|
111
|
-
}, j = function(e2, t2) {
|
|
112
|
-
for (var n2 in this.__callback = e2, this.options = { scrollingX: true, scrollingY: true, animating: true, animationDuration: 250, bouncing: true, locking: true, paging: false, snapping: false, zooming: false, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: I, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08 }, t2) this.options[n2] = t2[n2];
|
|
114
|
+
return W[h2] = true, requestAnimationFrame(u2), h2;
|
|
115
|
+
}, I = function(t2) {
|
|
116
|
+
return Math.pow(t2 - 1, 3) + 1;
|
|
117
|
+
}, Y = function(t2) {
|
|
118
|
+
return (t2 /= 0.5) < 1 ? 0.5 * Math.pow(t2, 3) : 0.5 * (Math.pow(t2 - 2, 3) + 2);
|
|
113
119
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
120
|
+
class X {
|
|
121
|
+
constructor(t2, e2) {
|
|
122
|
+
this.__isSingleTouch = false, this.__isTracking = false, this.__didDecelerationComplete = false, this.__isGesturing = false, this.__isDragging = false, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = false, this.__lastScale = 1, this.__enableScrollX = true, this.__enableScrollY = true, this.__clientLeft = 0, this.__clientTop = 0, this.__clientWidth = 0, this.__clientHeight = 0, this.__contentWidth = 0, this.__contentHeight = 0, this.__snapWidth = 100, this.__snapHeight = 100, this.__zoomLevel = 1, this.__scrollLeft = 0, this.__scrollTop = 0, this.__maxScrollLeft = 0, this.__maxScrollTop = 0, this.__scheduledLeft = 0, this.__scheduledTop = 0, this.__scheduledZoom = 0, this.__lastTouchLeft = 0, this.__lastTouchTop = 0, this.__lastTouchMove = 0, this.__positions = [], this.__initialTouchLeft = 0, this.__initialTouchTop = 0, this.__zoomLevelStart = 1, this.__minDecelerationScrollLeft = null, this.__minDecelerationScrollTop = null, this.__maxDecelerationScrollLeft = null, this.__maxDecelerationScrollTop = null, this.__decelerationVelocityX = null, this.__decelerationVelocityY = 0, this.__callback = t2, this.options = { scrollingX: true, scrollingY: true, animating: true, animationDuration: 250, bouncing: true, locking: true, paging: false, snapping: false, zooming: false, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...e2 };
|
|
123
|
+
}
|
|
124
|
+
setDimensions(t2, e2, n2, o2) {
|
|
125
|
+
null !== t2 && (this.__clientWidth = t2), null !== e2 && (this.__clientHeight = e2), null !== n2 && (this.__contentWidth = n2), null !== o2 && (this.__contentHeight = o2), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true);
|
|
126
|
+
}
|
|
127
|
+
setPosition(t2, e2) {
|
|
128
|
+
this.__clientLeft = t2 || 0, this.__clientTop = e2 || 0;
|
|
129
|
+
}
|
|
130
|
+
setSnapSize(t2, e2) {
|
|
131
|
+
this.__snapWidth = t2, this.__snapHeight = e2;
|
|
132
|
+
}
|
|
133
|
+
getValues() {
|
|
134
|
+
return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
|
|
135
|
+
}
|
|
136
|
+
getPoint(t2, e2) {
|
|
137
|
+
const n2 = this.getValues();
|
|
138
|
+
return { left: t2 / n2.zoom, top: e2 / n2.zoom };
|
|
139
|
+
}
|
|
140
|
+
getScrollMax() {
|
|
141
|
+
return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
|
|
142
|
+
}
|
|
143
|
+
zoomTo(t2, e2 = false, n2, o2, i2) {
|
|
138
144
|
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
145
|
+
i2 && (this.__zoomComplete = i2), this.__isDecelerating && (R(this.__isDecelerating), this.__isDecelerating = 0);
|
|
146
|
+
const r2 = this.__zoomLevel;
|
|
147
|
+
void 0 === n2 && (n2 = this.__clientWidth / 2), void 0 === o2 && (o2 = this.__clientHeight / 2), t2 = Math.max(Math.min(t2, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(t2);
|
|
148
|
+
const s2 = t2 / r2;
|
|
149
|
+
let l2 = s2 * (this.__scrollLeft + n2) - n2, a2 = s2 * (this.__scrollTop + o2) - o2;
|
|
150
|
+
l2 > this.__maxScrollLeft ? l2 = this.__maxScrollLeft : l2 < 0 && (l2 = 0), a2 > this.__maxScrollTop ? a2 = this.__maxScrollTop : a2 < 0 && (a2 = 0), this.__publish(l2, a2, t2, e2);
|
|
151
|
+
}
|
|
152
|
+
zoomBy(t2, e2 = false, n2 = 0, o2 = 0, i2) {
|
|
153
|
+
this.zoomTo(this.__zoomLevel * t2, e2, n2, o2, i2);
|
|
154
|
+
}
|
|
155
|
+
scrollTo(t2, e2, n2 = false, o2 = 1) {
|
|
156
|
+
if (this.__isDecelerating && (R(this.__isDecelerating), this.__isDecelerating = 0), void 0 !== o2 && o2 !== this.__zoomLevel) {
|
|
157
|
+
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
158
|
+
t2 *= o2, e2 *= o2, this.__computeScrollMax(o2);
|
|
159
|
+
} else o2 = this.__zoomLevel;
|
|
160
|
+
this.options.scrollingX ? this.options.paging ? t2 = Math.round(t2 / this.__clientWidth) * this.__clientWidth : this.options.snapping && (t2 = Math.round(t2 / this.__snapWidth) * this.__snapWidth) : t2 = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? e2 = Math.round(e2 / this.__clientHeight) * this.__clientHeight : this.options.snapping && (e2 = Math.round(e2 / this.__snapHeight) * this.__snapHeight) : e2 = this.__scrollTop, t2 = Math.max(Math.min(this.__maxScrollLeft, t2), 0), e2 = Math.max(Math.min(this.__maxScrollTop, e2), 0), t2 === this.__scrollLeft && e2 === this.__scrollTop && (n2 = false), this.__publish(t2, e2, o2, n2);
|
|
161
|
+
}
|
|
162
|
+
scrollBy(t2 = 0, e2 = 0, n2 = false) {
|
|
163
|
+
const o2 = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, i2 = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
|
|
164
|
+
this.scrollTo(o2 + (t2 || 0), i2 + (e2 || 0), n2);
|
|
165
|
+
}
|
|
166
|
+
doMouseZoom(t2, e2, n2, o2) {
|
|
167
|
+
const i2 = t2 > 0 ? 0.97 : 1.03;
|
|
168
|
+
return this.zoomTo(this.__zoomLevel * i2, false, n2 - this.__clientLeft, o2 - this.__clientTop);
|
|
169
|
+
}
|
|
170
|
+
doTouchStart(t2, e2) {
|
|
171
|
+
if (void 0 === t2.length) throw new Error("Invalid touch list: " + t2);
|
|
172
|
+
if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
|
|
173
|
+
let n2, o2;
|
|
174
|
+
this.__interruptedAnimation = true, this.__isDecelerating && (R(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = true), this.__isAnimating && (R(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = true);
|
|
175
|
+
let i2 = 1 === t2.length;
|
|
176
|
+
i2 ? (n2 = t2[0].pageX, o2 = t2[0].pageY) : (n2 = Math.abs(t2[0].pageX + t2[1].pageX) / 2, o2 = Math.abs(t2[0].pageY + t2[1].pageY) / 2), this.__initialTouchLeft = n2, this.__initialTouchTop = o2, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n2, this.__lastTouchTop = o2, this.__lastTouchMove = e2, this.__lastScale = 1, this.__enableScrollX = !i2 && this.options.scrollingX, this.__enableScrollY = !i2 && this.options.scrollingY, this.__isTracking = true, this.__didDecelerationComplete = false, this.__isDragging = !i2, this.__isSingleTouch = i2, this.__positions = [];
|
|
177
|
+
}
|
|
178
|
+
doTouchMove(t2, e2, n2 = 1) {
|
|
179
|
+
if (void 0 === t2.length) throw new Error("Invalid touch list: " + t2);
|
|
180
|
+
if (e2 instanceof Date && (e2 = e2.valueOf()), "number" != typeof e2) throw new Error("Invalid timestamp value: " + e2);
|
|
181
|
+
if (!this.__isTracking) return;
|
|
182
|
+
let o2, i2;
|
|
183
|
+
2 === t2.length ? (o2 = Math.abs(t2[0].pageX + t2[1].pageX) / 2, i2 = Math.abs(t2[0].pageY + t2[1].pageY) / 2) : (o2 = t2[0].pageX, i2 = t2[0].pageY);
|
|
184
|
+
let r2 = this.__positions;
|
|
162
185
|
if (this.__isDragging) {
|
|
163
|
-
|
|
186
|
+
let t3 = o2 - this.__lastTouchLeft, s2 = i2 - this.__lastTouchTop, l2 = this.__scrollLeft, a2 = this.__scrollTop, c2 = this.__zoomLevel;
|
|
164
187
|
if (void 0 !== n2 && this.options.zooming) {
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
188
|
+
let t4 = c2;
|
|
189
|
+
if (c2 = c2 / this.__lastScale * n2, c2 = Math.max(Math.min(c2, this.options.maxZoom), this.options.minZoom), t4 !== c2) {
|
|
190
|
+
let e3 = o2 - this.__clientLeft, n3 = i2 - this.__clientTop;
|
|
191
|
+
l2 = (e3 + l2) * c2 / t4 - e3, a2 = (n3 + a2) * c2 / t4 - n3, this.__computeScrollMax(c2);
|
|
169
192
|
}
|
|
170
193
|
}
|
|
171
194
|
if (this.__enableScrollX) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
195
|
+
l2 -= t3 * this.options.speedMultiplier;
|
|
196
|
+
let e3 = this.__maxScrollLeft;
|
|
197
|
+
(l2 > e3 || l2 < 0) && (this.options.bouncing ? l2 += t3 / 2 * this.options.speedMultiplier : l2 = l2 > e3 ? e3 : 0);
|
|
175
198
|
}
|
|
176
199
|
if (this.__enableScrollY) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
(
|
|
200
|
+
a2 -= s2 * this.options.speedMultiplier;
|
|
201
|
+
const t4 = this.__maxScrollTop;
|
|
202
|
+
(a2 > t4 || a2 < 0) && (this.options.bouncing ? a2 += s2 / 2 * this.options.speedMultiplier : a2 = a2 > t4 ? t4 : 0);
|
|
180
203
|
}
|
|
181
|
-
r2.length > 60 && r2.splice(0, 30), r2.push(
|
|
204
|
+
r2.length > 60 && r2.splice(0, 30), r2.push(l2, a2, e2), this.__publish(l2, a2, c2);
|
|
182
205
|
} else {
|
|
183
|
-
|
|
184
|
-
this.__enableScrollX = this.options.scrollingX &&
|
|
206
|
+
let t3 = this.options.locking ? 3 : 0, n3 = 5, s2 = Math.abs(o2 - this.__initialTouchLeft), l2 = Math.abs(i2 - this.__initialTouchTop);
|
|
207
|
+
this.__enableScrollX = this.options.scrollingX && s2 >= t3, this.__enableScrollY = this.options.scrollingY && l2 >= t3, r2.push(this.__scrollLeft, this.__scrollTop, e2), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (s2 >= n3 || l2 >= n3), this.__isDragging && (this.__interruptedAnimation = false);
|
|
208
|
+
}
|
|
209
|
+
this.__lastTouchLeft = o2, this.__lastTouchTop = i2, this.__lastTouchMove = e2, this.__lastScale = n2;
|
|
210
|
+
}
|
|
211
|
+
doTouchEnd(t2) {
|
|
212
|
+
if (t2 instanceof Date && (t2 = t2.valueOf()), "number" != typeof t2) throw new Error("Invalid timestamp value: " + t2);
|
|
213
|
+
if (this.__isTracking) {
|
|
214
|
+
if (this.__isTracking = false, this.__isDragging) if (this.__isDragging = false, this.__isSingleTouch && this.options.animating && t2 - this.__lastTouchMove <= 100) {
|
|
215
|
+
let e2 = this.__positions, n2 = e2.length - 1, o2 = n2;
|
|
216
|
+
for (let t3 = n2; t3 > 0 && e2[t3] > this.__lastTouchMove - 100; t3 -= 3) o2 = t3;
|
|
217
|
+
if (o2 !== n2) {
|
|
218
|
+
const i2 = e2[n2] - e2[o2], r2 = this.__scrollLeft - e2[o2 - 2], s2 = this.__scrollTop - e2[o2 - 1];
|
|
219
|
+
this.__decelerationVelocityX = r2 / i2 * (1e3 / 60), this.__decelerationVelocityY = s2 / i2 * (1e3 / 60);
|
|
220
|
+
const l2 = this.options.paging || this.options.snapping ? 4 : 1;
|
|
221
|
+
(Math.abs(this.__decelerationVelocityX) > l2 || Math.abs(this.__decelerationVelocityY) > l2) && this.__startDeceleration(t2);
|
|
222
|
+
} else this.options.scrollingComplete?.();
|
|
223
|
+
} else t2 - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
|
|
224
|
+
this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, true, this.__zoomLevel)), this.__positions.length = 0;
|
|
185
225
|
}
|
|
186
|
-
this.__lastTouchLeft = o2, this.__lastTouchTop = i2, this.__lastTouchMove = t2, this.__lastScale = n2;
|
|
187
226
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
this.
|
|
227
|
+
__publish(t2, e2, n2, o2 = false) {
|
|
228
|
+
const i2 = this.__isAnimating;
|
|
229
|
+
if (i2 && (R(i2), this.__isAnimating = 0), o2 && this.options.animating) {
|
|
230
|
+
this.__scheduledLeft = t2, this.__scheduledTop = e2, this.__scheduledZoom = n2;
|
|
231
|
+
const o3 = this.__scrollLeft, r2 = this.__scrollTop, s2 = this.__zoomLevel, l2 = t2 - o3, a2 = e2 - r2, c2 = n2 - s2, h2 = function(t3, e3, n3) {
|
|
232
|
+
n3 && (this.__scrollLeft = o3 + l2 * t3, this.__scrollTop = r2 + a2 * t3, this.__zoomLevel = s2 + c2 * t3, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
233
|
+
}.bind(this), u2 = function(t3) {
|
|
234
|
+
return this.__isAnimating === t3;
|
|
235
|
+
}.bind(this), d2 = function(t3, e3, n3) {
|
|
236
|
+
e3 === this.__isAnimating && (this.__isAnimating = false), (this.__didDecelerationComplete || n3) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
237
|
+
}.bind(this);
|
|
238
|
+
this.__isAnimating = F(h2, u2, d2, this.options.animationDuration, i2 ? I : Y);
|
|
239
|
+
} else this.__scheduledLeft = this.__scrollLeft = t2, this.__scheduledTop = this.__scrollTop = e2, this.__scheduledZoom = this.__zoomLevel = n2, this.__callback && this.__callback(t2, e2, n2), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
201
240
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (i2 && (R(i2), this.__isAnimating = false), o2 && this.options.animating) {
|
|
205
|
-
this.__scheduledLeft = e2, this.__scheduledTop = t2, this.__scheduledZoom = n2;
|
|
206
|
-
var r2 = this.__scrollLeft, s2 = this.__scrollTop, l2 = this.__zoomLevel, a2 = e2 - r2, c2 = t2 - s2, h2 = n2 - l2, u2 = function(e3, t3, n3) {
|
|
207
|
-
n3 && (this.__scrollLeft = r2 + a2 * e3, this.__scrollTop = s2 + c2 * e3, this.__zoomLevel = l2 + h2 * e3, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
208
|
-
}.bind(this), d2 = function(e3) {
|
|
209
|
-
return this.__isAnimating === e3;
|
|
210
|
-
}.bind(this), _2 = function(e3, t3, n3) {
|
|
211
|
-
t3 === this.__isAnimating && (this.__isAnimating = false), (this.__didDecelerationComplete || n3) && this.options.scrollingComplete(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
212
|
-
}.bind(this);
|
|
213
|
-
this.__isAnimating = F(u2, d2, _2, this.options.animationDuration, i2 ? Y : X);
|
|
214
|
-
} else this.__scheduledLeft = this.__scrollLeft = e2, this.__scheduledTop = this.__scrollTop = t2, this.__scheduledZoom = this.__zoomLevel = n2, this.__callback && this.__callback(e2, t2, n2), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
215
|
-
}, __computeScrollMax: function(e2) {
|
|
216
|
-
void 0 === e2 && (e2 = this.__zoomLevel), this.__maxScrollLeft = Math.max(this.__contentWidth * e2 - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e2 - this.__clientHeight, 0);
|
|
217
|
-
}, __startDeceleration: function(e2) {
|
|
218
|
-
if (this.options.paging) {
|
|
219
|
-
var t2 = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), n2 = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), o2 = this.__clientWidth, i2 = this.__clientHeight;
|
|
220
|
-
this.__minDecelerationScrollLeft = Math.floor(t2 / o2) * o2, this.__minDecelerationScrollTop = Math.floor(n2 / i2) * i2, this.__maxDecelerationScrollLeft = Math.ceil(t2 / o2) * o2, this.__maxDecelerationScrollTop = Math.ceil(n2 / i2) * i2;
|
|
221
|
-
} else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
|
|
222
|
-
var r2 = function(e3, t3, n3) {
|
|
223
|
-
this.__stepThroughDeceleration(n3);
|
|
224
|
-
}.bind(this), s2 = this.options.snapping ? 4 : 0.1, l2 = function() {
|
|
225
|
-
var e3 = Math.abs(this.__decelerationVelocityX) >= s2 || Math.abs(this.__decelerationVelocityY) >= s2;
|
|
226
|
-
return e3 || (this.__didDecelerationComplete = true), e3;
|
|
227
|
-
}.bind(this), a2 = function(e3, t3, n3) {
|
|
228
|
-
this.__isDecelerating = false, this.__didDecelerationComplete && this.options.scrollingComplete(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
|
|
229
|
-
}.bind(this);
|
|
230
|
-
this.__isDecelerating = F(r2, l2, a2);
|
|
231
|
-
}, __stepThroughDeceleration: function(e2) {
|
|
232
|
-
var t2 = this.__scrollLeft + this.__decelerationVelocityX, n2 = this.__scrollTop + this.__decelerationVelocityY;
|
|
233
|
-
if (!this.options.bouncing) {
|
|
234
|
-
var o2 = Math.max(Math.min(this.__maxDecelerationScrollLeft, t2), this.__minDecelerationScrollLeft);
|
|
235
|
-
o2 !== t2 && (t2 = o2, this.__decelerationVelocityX = 0);
|
|
236
|
-
var i2 = Math.max(Math.min(this.__maxDecelerationScrollTop, n2), this.__minDecelerationScrollTop);
|
|
237
|
-
i2 !== n2 && (n2 = i2, this.__decelerationVelocityY = 0);
|
|
241
|
+
__computeScrollMax(t2 = this.__zoomLevel) {
|
|
242
|
+
this.__maxScrollLeft = Math.max(this.__contentWidth * t2 - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * t2 - this.__clientHeight, 0);
|
|
238
243
|
}
|
|
239
|
-
|
|
240
|
-
this.
|
|
244
|
+
__startDeceleration(t2) {
|
|
245
|
+
if (this.options.paging) {
|
|
246
|
+
const t3 = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), e3 = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), n3 = this.__clientWidth, o3 = this.__clientHeight;
|
|
247
|
+
this.__minDecelerationScrollLeft = Math.floor(t3 / n3) * n3, this.__minDecelerationScrollTop = Math.floor(e3 / o3) * o3, this.__maxDecelerationScrollLeft = Math.ceil(t3 / n3) * n3, this.__maxDecelerationScrollTop = Math.ceil(e3 / o3) * o3;
|
|
248
|
+
} else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
|
|
249
|
+
const e2 = function(t3, e3, n3) {
|
|
250
|
+
this.__stepThroughDeceleration(n3);
|
|
251
|
+
}.bind(this), n2 = this.options.snapping ? 4 : 0.1, o2 = function() {
|
|
252
|
+
const t3 = Math.abs(this.__decelerationVelocityX) >= n2 || Math.abs(this.__decelerationVelocityY) >= n2;
|
|
253
|
+
return t3 || (this.__didDecelerationComplete = true), t3;
|
|
254
|
+
}.bind(this), i2 = function(t3, e3, n3) {
|
|
255
|
+
this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
|
|
256
|
+
}.bind(this);
|
|
257
|
+
this.__isDecelerating = F(e2, o2, i2);
|
|
241
258
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
259
|
+
__stepThroughDeceleration(t2) {
|
|
260
|
+
let e2 = this.__scrollLeft + this.__decelerationVelocityX, n2 = this.__scrollTop + this.__decelerationVelocityY;
|
|
261
|
+
if (!this.options.bouncing) {
|
|
262
|
+
const t3 = Math.max(Math.min(this.__maxDecelerationScrollLeft, e2), this.__minDecelerationScrollLeft);
|
|
263
|
+
t3 !== e2 && (e2 = t3, this.__decelerationVelocityX = 0);
|
|
264
|
+
const o2 = Math.max(Math.min(this.__maxDecelerationScrollTop, n2), this.__minDecelerationScrollTop);
|
|
265
|
+
o2 !== n2 && (n2 = o2, this.__decelerationVelocityY = 0);
|
|
266
|
+
}
|
|
267
|
+
if (t2 ? this.__publish(e2, n2, this.__zoomLevel) : (this.__scrollLeft = e2, this.__scrollTop = n2), !this.options.paging) {
|
|
268
|
+
const t3 = 0.95;
|
|
269
|
+
this.__decelerationVelocityX *= t3, this.__decelerationVelocityY *= t3;
|
|
270
|
+
}
|
|
271
|
+
if (this.options.bouncing) {
|
|
272
|
+
let t3 = 0, o2 = 0, i2 = this.options.penetrationDeceleration, r2 = this.options.penetrationAcceleration;
|
|
273
|
+
e2 < this.__minDecelerationScrollLeft ? t3 = this.__minDecelerationScrollLeft - e2 : e2 > this.__maxDecelerationScrollLeft && (t3 = this.__maxDecelerationScrollLeft - e2), n2 < this.__minDecelerationScrollTop ? o2 = this.__minDecelerationScrollTop - n2 : n2 > this.__maxDecelerationScrollTop && (o2 = this.__maxDecelerationScrollTop - n2), 0 !== t3 && (t3 * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += t3 * i2 : this.__decelerationVelocityX = t3 * r2), 0 !== o2 && (o2 * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += o2 * i2 : this.__decelerationVelocityY = o2 * r2);
|
|
274
|
+
}
|
|
245
275
|
}
|
|
246
|
-
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
276
|
+
}
|
|
277
|
+
const j = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), U = {};
|
|
278
|
+
function Z() {
|
|
249
279
|
return b;
|
|
250
280
|
}
|
|
251
|
-
const
|
|
252
|
-
return
|
|
253
|
-
}, createSyntheticEvent: (
|
|
254
|
-
let
|
|
255
|
-
return { nativeEvent:
|
|
256
|
-
|
|
257
|
-
}, isDefaultPrevented: () =>
|
|
258
|
-
n2 = true,
|
|
281
|
+
const G = (t2) => "BracketLeft" === t2 ? "[" : "BracketRight" === t2 ? "]" : g.camelToPrettyCase(t2), q = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: U, boundPixel: function(t2, e2 = false, n2 = 0) {
|
|
282
|
+
return t2;
|
|
283
|
+
}, createSyntheticEvent: (t2) => {
|
|
284
|
+
let e2 = false, n2 = false;
|
|
285
|
+
return { nativeEvent: t2, currentTarget: t2.currentTarget, target: t2.target, bubbles: t2.bubbles, cancelable: t2.cancelable, defaultPrevented: t2.defaultPrevented, eventPhase: t2.eventPhase, isTrusted: t2.isTrusted, preventDefault: () => {
|
|
286
|
+
e2 = true, t2.preventDefault();
|
|
287
|
+
}, isDefaultPrevented: () => e2, stopPropagation: () => {
|
|
288
|
+
n2 = true, t2.stopPropagation();
|
|
259
289
|
}, isPropagationStopped: () => n2, persist: () => {
|
|
260
|
-
}, timeStamp:
|
|
261
|
-
}, detectIt:
|
|
262
|
-
function
|
|
290
|
+
}, timeStamp: t2.timeStamp, type: t2.type };
|
|
291
|
+
}, detectIt: Z, focusableNodeNames: j, toPrettyKeyCode: G }, Symbol.toStringTag, { value: "Module" })), J = [];
|
|
292
|
+
function Q(t2, e2, n2 = J) {
|
|
263
293
|
const o2 = r(null);
|
|
264
|
-
return u(
|
|
294
|
+
return u(t2, () => {
|
|
265
295
|
if (!o2.current) return;
|
|
266
|
-
const
|
|
296
|
+
const t3 = o2.current, n3 = e2?.();
|
|
267
297
|
if (!n3 || "object" != typeof n3) throw new Error("attributes must return a plain object of values");
|
|
268
298
|
const i2 = Object.keys(n3), r2 = i2.length;
|
|
269
|
-
for (let
|
|
270
|
-
const o3 = i2[
|
|
271
|
-
Object.defineProperty(
|
|
299
|
+
for (let e3 = 0; e3 < r2; e3++) {
|
|
300
|
+
const o3 = i2[e3], r3 = n3[o3];
|
|
301
|
+
Object.defineProperty(t3, o3, { value: r3, writable: true, configurable: true, enumerable: true });
|
|
272
302
|
}
|
|
273
|
-
return
|
|
303
|
+
return t3;
|
|
274
304
|
}, n2), o2;
|
|
275
305
|
}
|
|
276
|
-
const
|
|
277
|
-
const { children: l2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: d2 = true, showVerticalScrollbar: _2 = true, createScrollCorner: p2 =
|
|
306
|
+
const tt = (e2) => t(O, { ...e2 }), et = ({ width: e2, height: n2 }) => t("div", { className: "corner", style: { minWidth: `${e2}px`, width: `${e2}px`, minHeight: `${n2}px`, height: `${n2}px` } }), nt = s(l((o2, s2) => {
|
|
307
|
+
const { children: l2, viewport: a2, onScrollViewport: u2, showHorizontalScrollbar: d2 = true, showVerticalScrollbar: _2 = true, createScrollCorner: p2 = et, createHorizontalScrollbar: m2 = tt, createVerticalScrollbar: g2 = tt, style: y2, touchElement: v2, disableTouch: x2, ...b2 } = o2, w2 = P(u2, [u2]), S2 = Q(s2, () => ({ isScrollPane: () => true }), []), L2 = r(null);
|
|
278
308
|
c(() => {
|
|
279
|
-
L2.current && (L2.current.__scrollTop === a2?.top && L2.current.__scrollLeft
|
|
309
|
+
L2.current && (L2.current.__scrollTop === a2?.top && L2.current.__scrollLeft === a2?.left || L2.current.__isDecelerating || L2.current?.scrollTo(a2?.left, a2?.top, false));
|
|
280
310
|
}, [a2?.left, a2?.top, v2]);
|
|
281
|
-
const C2 = i((
|
|
282
|
-
w2?.({ left:
|
|
283
|
-
}, []), E2 = i((
|
|
284
|
-
L2.current?.doTouchStart(
|
|
285
|
-
}, []), T2 = i((
|
|
286
|
-
|
|
287
|
-
}, []), M2 = i((
|
|
288
|
-
L2.current?.doTouchEnd(
|
|
289
|
-
}, []), z2 = i(({ containerWidth:
|
|
290
|
-
L2.current.setDimensions(
|
|
311
|
+
const C2 = i((t2, e2) => {
|
|
312
|
+
w2?.({ left: t2, top: e2 });
|
|
313
|
+
}, []), E2 = i((t2) => {
|
|
314
|
+
L2.current?.doTouchStart(t2.touches, t2.timeStamp);
|
|
315
|
+
}, []), T2 = i((t2) => {
|
|
316
|
+
t2.preventDefault(), L2.current?.doTouchMove(t2.touches, t2.timeStamp);
|
|
317
|
+
}, []), M2 = i((t2) => {
|
|
318
|
+
L2.current?.doTouchEnd(t2.timeStamp);
|
|
319
|
+
}, []), z2 = i(({ containerWidth: t2, containerHeight: e2, totalWidth: n2, totalHeight: o3 }) => {
|
|
320
|
+
L2.current.setDimensions(t2, e2, n2, o3);
|
|
291
321
|
}, []);
|
|
292
322
|
c(() => {
|
|
293
|
-
const
|
|
294
|
-
if (!x2 &&
|
|
323
|
+
const t2 = v2 ?? S2.current;
|
|
324
|
+
if (!x2 && Z().supportsTouchEvents && t2 && a2) {
|
|
295
325
|
if (!L2.current) {
|
|
296
|
-
const
|
|
297
|
-
L2.current = new
|
|
326
|
+
const t3 = { scrollingX: true, scrollingY: true, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
|
|
327
|
+
L2.current = new X(C2, t3);
|
|
298
328
|
}
|
|
299
|
-
|
|
329
|
+
Z().supportsTouchEvents && (t2.addEventListener("touchstart", E2), t2.addEventListener("touchend", M2), t2.addEventListener("touchmove", T2)), z2({ containerWidth: a2?.width, containerHeight: a2?.height, totalWidth: a2?.totalWidth, totalHeight: a2?.totalHeight });
|
|
300
330
|
}
|
|
301
331
|
return () => {
|
|
302
|
-
|
|
332
|
+
t2?.removeEventListener("touchstart", E2), t2?.removeEventListener("touchend", M2), t2?.removeEventListener("touchmove", T2);
|
|
303
333
|
};
|
|
304
334
|
}, [a2?.width, a2?.height, a2?.totalWidth, a2?.totalHeight, x2, v2]);
|
|
305
335
|
const [k2, { width: A2 }] = f(), [B2, { height: $2 }] = f(), K2 = h(() => {
|
|
306
|
-
const
|
|
307
|
-
w2?.({ top:
|
|
336
|
+
const e2 = g2({ orientation: D.Vertical, offset: a2?.top, viewportSize: a2?.height, totalSize: a2?.totalHeight, onScrollOffset: (t2) => {
|
|
337
|
+
w2?.({ top: t2 });
|
|
308
338
|
} });
|
|
309
|
-
return
|
|
339
|
+
return t("div", { style: { display: "flex", flex: "0" }, ref: k2, children: e2 });
|
|
310
340
|
}, [g2, a2?.top, a2?.height, a2?.totalHeight]), O2 = h(() => {
|
|
311
|
-
const o3 = m2({ orientation: D.Horizontal, offset: a2?.left, viewportSize: a2?.width, totalSize: a2?.totalWidth, onScrollOffset: (
|
|
312
|
-
return
|
|
341
|
+
const o3 = m2({ orientation: D.Horizontal, offset: a2?.left, viewportSize: a2?.width, totalSize: a2?.totalWidth, onScrollOffset: (t2) => w2?.({ left: t2 }) });
|
|
342
|
+
return e("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [t("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${A2}px)` }, children: t("div", { ref: B2, className: "sizer", children: o3 }) }), _2 ? p2({ width: A2, height: $2 }) : t(n, {})] });
|
|
313
343
|
}, [m2, a2?.left, a2?.width, a2?.totalWidth, _2, p2, A2, $2]);
|
|
314
|
-
return
|
|
344
|
+
return t("div", { style: { position: "relative", display: "flex", minWidth: _2 ? `${A2}px` : void 0, minHeight: d2 ? `${$2}px` : void 0, ...y2 }, ...b2, ref: S2, children: e("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [e("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [t("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: l2 }), _2 ? K2 : t(n, {})] }), d2 ? O2 : t(n, {})] }) });
|
|
315
345
|
}));
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
if (
|
|
320
|
-
|
|
346
|
+
nt.displayName = "ScrollPane";
|
|
347
|
+
const ot = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, it = /* @__PURE__ */ new Set(), rt = { showMessage: (t2, e2) => {
|
|
348
|
+
if (e2?.onceKey) {
|
|
349
|
+
if (it.has(e2.onceKey)) return;
|
|
350
|
+
it.add(e2.onceKey);
|
|
321
351
|
}
|
|
322
352
|
let n2 = console.log;
|
|
323
|
-
|
|
324
|
-
}, showBusy: (
|
|
325
|
-
|
|
353
|
+
e2?.type !== ot.Warning && e2?.type !== ot.Error || (n2 = console.warn), n2(t2);
|
|
354
|
+
}, showBusy: (t2, e2) => new Promise((t3) => {
|
|
355
|
+
t3(() => {
|
|
326
356
|
});
|
|
327
|
-
}), showError: (
|
|
328
|
-
console.error(
|
|
329
|
-
} },
|
|
330
|
-
const
|
|
331
|
-
return
|
|
357
|
+
}), showError: (t2) => {
|
|
358
|
+
console.error(t2);
|
|
359
|
+
} }, st = () => {
|
|
360
|
+
const t2 = document.fullscreenElement;
|
|
361
|
+
return t2 ? t2.querySelector(".fullscreen-portal-root") || t2 : document.body;
|
|
332
362
|
};
|
|
333
|
-
let
|
|
334
|
-
function
|
|
363
|
+
let lt = 0;
|
|
364
|
+
function at() {
|
|
335
365
|
return c(() => {
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
if (!
|
|
339
|
-
let
|
|
340
|
-
|
|
366
|
+
function t2() {
|
|
367
|
+
const t3 = document.fullscreenElement;
|
|
368
|
+
if (!t3) return;
|
|
369
|
+
let e2 = t3.querySelector(".fullscreen-portal-root");
|
|
370
|
+
e2 || (e2 = document.createElement("div"), e2.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", t3.appendChild(e2));
|
|
341
371
|
}
|
|
342
|
-
return
|
|
343
|
-
document.removeEventListener("fullscreenchange",
|
|
344
|
-
|
|
345
|
-
}),
|
|
372
|
+
return lt++, t2(), document.addEventListener("fullscreenchange", t2), () => {
|
|
373
|
+
document.removeEventListener("fullscreenchange", t2), lt--, lt <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((t3) => {
|
|
374
|
+
t3.parentNode && t3.parentNode.removeChild(t3);
|
|
375
|
+
}), lt = 0);
|
|
346
376
|
};
|
|
347
|
-
}, []), { getPortalContainer:
|
|
377
|
+
}, []), { getPortalContainer: st };
|
|
348
378
|
}
|
|
349
|
-
const
|
|
350
|
-
const { offset: o2 = 0, viewportSize: s2 = 0, totalSize: l2 = 0, minSize: c2 = 0, endGap: h2 =
|
|
379
|
+
const ct = 100, ht = 100, ut = 1e6, dt = 100, _t = 50, pt = s(l((e2, n2) => {
|
|
380
|
+
const { offset: o2 = 0, viewportSize: s2 = 0, totalSize: l2 = 0, minSize: c2 = 0, endGap: h2 = ct, endScrollIncrement: u2 = ht, style: _2 = U, onMouseDown: p2, onScrollOffset: m2, onScroll: f2, scaleLimit: g2 = ut, scaleFactor: y2 = dt, precisionFactor: v2 = _t, ...x2 } = e2;
|
|
351
381
|
f2 && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
352
|
-
const b2 = P(p2, [p2]), w2 = () => ({ offset: o2, totalSize: 0 === g2 ? l2 : Math.min(l2 ?? 0, Math.max(c2 ?? 0, (o2 ?? 0) + (s2 ?? 0)) + (h2 ?? 0)) }), [S2, L2] = a(w2), C2 = 0 !== g2 && S2.totalSize > g2 ? y2 : 1, E2 = C2 / v2, T2 = Math.ceil(S2.totalSize / C2), M2 = Math.ceil(S2.offset / C2), D2 = Math.ceil(s2 / C2), z2 = i((
|
|
382
|
+
const b2 = P(p2, [p2]), w2 = () => ({ offset: o2, totalSize: 0 === g2 ? l2 : Math.min(l2 ?? 0, Math.max(c2 ?? 0, (o2 ?? 0) + (s2 ?? 0)) + (h2 ?? 0)) }), [S2, L2] = a(w2), C2 = 0 !== g2 && S2.totalSize > g2 ? y2 : 1, E2 = C2 / v2, T2 = Math.ceil(S2.totalSize / C2), M2 = Math.ceil(S2.offset / C2), D2 = Math.ceil(s2 / C2), z2 = i((t2) => {
|
|
353
383
|
}, []), [k2, A2] = a(false), B2 = r(null);
|
|
354
384
|
d(() => {
|
|
355
385
|
if (!k2) {
|
|
356
386
|
B2.current = { propTotalSize: l2, propViewportSize: s2, propOffset: o2 };
|
|
357
|
-
const
|
|
358
|
-
L2(
|
|
387
|
+
const t2 = w2();
|
|
388
|
+
L2(t2);
|
|
359
389
|
}
|
|
360
390
|
}, [l2, s2, o2, k2, c2, h2, u2]);
|
|
361
|
-
const $2 = P((
|
|
391
|
+
const $2 = P((t2, e3, n3) => {
|
|
362
392
|
const i2 = B2.current;
|
|
363
|
-
B2.current = null, i2 && i2.propTotalSize === l2 && i2.propViewportSize === s2 && i2.propOffset === o2 || (Math.abs(
|
|
364
|
-
}, [m2, C2, E2, M2, D2]), K2 = i((
|
|
393
|
+
B2.current = null, i2 && i2.propTotalSize === l2 && i2.propViewportSize === s2 && i2.propOffset === o2 || (Math.abs(t2 - M2) < E2 && (t2 = M2), m2?.(t2 * C2, M2, D2));
|
|
394
|
+
}, [m2, C2, E2, M2, D2]), K2 = i((t2) => {
|
|
365
395
|
document.removeEventListener("mousemove", z2), document.removeEventListener("mouseup", K2), A2(false);
|
|
366
|
-
}, []), V2 = i((
|
|
367
|
-
b2?.(
|
|
396
|
+
}, []), V2 = i((t2) => {
|
|
397
|
+
b2?.(t2), A2(true), document.addEventListener("mousemove", z2, { passive: true }), document.addEventListener("mouseup", K2, { passive: true });
|
|
368
398
|
}, [z2, K2]);
|
|
369
|
-
return
|
|
399
|
+
return t(O, { ref: n2, style: { ..._2 }, ...x2, offset: M2, totalSize: T2, viewportSize: D2, onMouseDown: V2, onScrollOffset: $2 });
|
|
370
400
|
}));
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
const { refFocusStart: o2, ...s2 } =
|
|
401
|
+
pt.displayName = "VirtualScrollbar";
|
|
402
|
+
const mt = { BottomEnd: "bottom-end", BottomStart: "bottom-start", Bottom: "bottom", LeftEnd: "left-end", LeftStart: "left-start", Left: "left", RightEnd: "right-end", RightStart: "right-start", Right: "right", TopEnd: "top-end", TopStart: "top-start", Top: "top" }, ft = s(l((e2, n2) => {
|
|
403
|
+
const { refFocusStart: o2, ...s2 } = e2, l2 = r(null), a2 = i(() => {
|
|
374
404
|
if (o2) return void o2?.current?.focus();
|
|
375
|
-
const
|
|
376
|
-
let
|
|
377
|
-
for (let n3 = 0; n3 <
|
|
378
|
-
const o3 =
|
|
405
|
+
const t2 = l2.current.parentElement.children;
|
|
406
|
+
let e3 = [];
|
|
407
|
+
for (let n3 = 0; n3 < t2.length && t2[n3] !== l2.current; n3++) {
|
|
408
|
+
const o3 = t2[n3].getAttribute("tabindex");
|
|
379
409
|
if (null == o3 || "-1" === o3) continue;
|
|
380
|
-
if ("true" ===
|
|
381
|
-
const i2 =
|
|
382
|
-
i2.focus &&
|
|
410
|
+
if ("true" === t2[n3].getAttribute("disabled")) continue;
|
|
411
|
+
const i2 = t2[n3];
|
|
412
|
+
i2.focus && e3.push({ tabindex: parseInt(o3), child: i2 });
|
|
383
413
|
}
|
|
384
|
-
0 !==
|
|
385
|
-
return
|
|
386
|
-
}),
|
|
414
|
+
0 !== e3.length && (e3.sort(function(t3, e4) {
|
|
415
|
+
return t3.tabindex - e4.tabindex;
|
|
416
|
+
}), e3[0].child.focus());
|
|
387
417
|
}, [o2]);
|
|
388
|
-
return
|
|
418
|
+
return t("div", { tabIndex: 0, ref: w([l2, n2]), onFocus: a2, ...s2 });
|
|
389
419
|
}));
|
|
390
|
-
const
|
|
391
|
-
const { className: l2, style: a2, children: c2, radius: u2 = 4, strokeWidth: d2 = 1, strokeColor: _2 = "grey", ...p2 } = i2, [m2, { width: g2, height: y2 }] = f(), v2 = r(null), x2 = (
|
|
392
|
-
const n2 =
|
|
393
|
-
return function(
|
|
394
|
-
if (0 ===
|
|
395
|
-
function o3(
|
|
396
|
-
let o4 =
|
|
397
|
-
return i3(
|
|
420
|
+
const gt = s(l((i2, s2) => {
|
|
421
|
+
const { className: l2, style: a2, children: c2, radius: u2 = 4, strokeWidth: d2 = 1, strokeColor: _2 = "grey", ...p2 } = i2, [m2, { width: g2, height: y2 }] = f(), v2 = r(null), x2 = (t2, e2 = 0) => {
|
|
422
|
+
const n2 = t2 / 2, o2 = y2 - n2 + e2;
|
|
423
|
+
return function(t3, e3, n3 = false) {
|
|
424
|
+
if (0 === e3) return t3;
|
|
425
|
+
function o3(t4, e4, n4) {
|
|
426
|
+
let o4 = e4.x - t4.x, r3 = e4.y - t4.y, s4 = Math.sqrt(o4 * o4 + r3 * r3);
|
|
427
|
+
return i3(t4, e4, Math.min(1, n4 / s4));
|
|
398
428
|
}
|
|
399
|
-
function i3(
|
|
400
|
-
return { x:
|
|
429
|
+
function i3(t4, e4, n4) {
|
|
430
|
+
return { x: t4.x + (e4.x - t4.x) * n4, y: t4.y + (e4.y - t4.y) * n4 };
|
|
401
431
|
}
|
|
402
|
-
function r2(
|
|
403
|
-
|
|
432
|
+
function r2(t4, e4) {
|
|
433
|
+
t4.length > 2 && (t4[t4.length - 2] = e4.x, t4[t4.length - 1] = e4.y);
|
|
404
434
|
}
|
|
405
|
-
function s3(
|
|
406
|
-
return { x: parseFloat(
|
|
435
|
+
function s3(t4) {
|
|
436
|
+
return { x: parseFloat(t4[t4.length - 2]), y: parseFloat(t4[t4.length - 1]) };
|
|
407
437
|
}
|
|
408
|
-
let l3 =
|
|
409
|
-
let n4 =
|
|
410
|
-
return n4 ? (
|
|
411
|
-
}, []).reduce(function(
|
|
412
|
-
return parseFloat(
|
|
438
|
+
let l3 = t3.split(/[,\s]/).reduce(function(t4, e4) {
|
|
439
|
+
let n4 = e4.match("([a-zA-Z])(.+)");
|
|
440
|
+
return n4 ? (t4.push(n4[1]), t4.push(n4[2])) : t4.push(e4), t4;
|
|
441
|
+
}, []).reduce(function(t4, e4) {
|
|
442
|
+
return parseFloat(e4) == e4 && t4.length ? t4[t4.length - 1].push(e4) : t4.push([e4]), t4;
|
|
413
443
|
}, []), a3 = [];
|
|
414
444
|
if (l3.length > 1) {
|
|
415
|
-
let
|
|
416
|
-
"Z" === l3[l3.length - 1][0] && l3[0].length > 2 && (c3 = ["L",
|
|
417
|
-
for (let
|
|
418
|
-
let h2 = a3[a3.length - 1], u3 = l3[
|
|
445
|
+
let t4 = s3(l3[0]), c3 = null;
|
|
446
|
+
"Z" === l3[l3.length - 1][0] && l3[0].length > 2 && (c3 = ["L", t4.x, t4.y], l3[l3.length - 1] = c3), a3.push(l3[0]);
|
|
447
|
+
for (let t5 = 1; t5 < l3.length; t5++) {
|
|
448
|
+
let h2 = a3[a3.length - 1], u3 = l3[t5], d3 = u3 === c3 ? l3[1] : l3[t5 + 1];
|
|
419
449
|
if (d3 && h2 && h2.length > 2 && "L" === u3[0] && d3.length > 2 && "L" === d3[0]) {
|
|
420
|
-
let
|
|
421
|
-
n3 ? (
|
|
422
|
-
let m3 = i3(
|
|
450
|
+
let t6, l4, c4 = s3(h2), _3 = s3(u3), p3 = s3(d3);
|
|
451
|
+
n3 ? (t6 = i3(_3, h2.origPoint || c4, e3), l4 = i3(_3, d3.origPoint || p3, e3)) : (t6 = o3(_3, c4, e3), l4 = o3(_3, p3, e3)), r2(u3, t6), u3.origPoint = _3, a3.push(u3);
|
|
452
|
+
let m3 = i3(t6, _3, 0.5), f2 = i3(_3, l4, 0.5), g3 = ["C", m3.x, m3.y, f2.x, f2.y, l4.x, l4.y];
|
|
423
453
|
g3.origPoint = _3, a3.push(g3);
|
|
424
454
|
} else a3.push(u3);
|
|
425
455
|
}
|
|
426
456
|
if (c3) {
|
|
427
|
-
let
|
|
428
|
-
a3.push(["Z"]), r2(a3[0],
|
|
457
|
+
let t5 = s3(a3[a3.length - 1]);
|
|
458
|
+
a3.push(["Z"]), r2(a3[0], t5);
|
|
429
459
|
}
|
|
430
460
|
} else a3 = l3;
|
|
431
|
-
return a3.reduce(function(
|
|
432
|
-
return
|
|
461
|
+
return a3.reduce(function(t4, e4) {
|
|
462
|
+
return t4 + e4.join(" ") + " ";
|
|
433
463
|
}, "");
|
|
434
464
|
}(`${`M 0 ${n2} L ${u2 - 0.5} ${n2} L ${u2 - 0.5} ${o2} L ${2 * u2} ${o2}`} ${`L ${g2 - 2 * u2} ${o2}`} ${`M ${g2 - 2 * u2} ${o2} L ${g2 - u2} ${o2} L ${g2 - u2} ${n2} L ${g2} ${n2}`}`, u2);
|
|
435
465
|
}, b2 = h(() => x2(d2), [g2, y2, u2, d2]), S2 = h(() => {
|
|
436
466
|
if (0 === u2) return;
|
|
437
|
-
const
|
|
438
|
-
return x2(u2) + `L ${g2} 0 L 0 0 L 0 ${
|
|
467
|
+
const t2 = u2 / 2;
|
|
468
|
+
return x2(u2) + `L ${g2} 0 L 0 0 L 0 ${t2}`;
|
|
439
469
|
}, [b2, u2, d2]), L2 = h(() => ({ style: { clipPath: `path('${S2}')` } }), [S2]);
|
|
440
|
-
return
|
|
441
|
-
})),
|
|
442
|
-
const { onPointerDown: n2, style: o2, splitDirection: i2, paddingBefore: r2 = 0, paddingAfter: s2 = 0, disabled: l2, key: a2, hitAreaProps: c2 =
|
|
443
|
-
return
|
|
444
|
-
},
|
|
445
|
-
if (null ==
|
|
470
|
+
return e("div", { className: l2, style: { display: "flex", flexDirection: "row", ...a2 }, ...p2, ref: w([v2, m2, s2]), children: [o.isValidElement(c2) ? o.cloneElement(c2, L2) : t(n, {}), t("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: g2, height: y2, viewBox: `0 0 ${g2} ${y2}`, children: t("path", { d: b2, stroke: _2, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: d2 }) })] });
|
|
471
|
+
})), yt = {}, vt = (e2) => {
|
|
472
|
+
const { onPointerDown: n2, style: o2, splitDirection: i2, paddingBefore: r2 = 0, paddingAfter: s2 = 0, disabled: l2, key: a2, hitAreaProps: c2 = yt, ...h2 } = e2, u2 = "row" === i2, { style: d2, className: _2, ...p2 } = c2;
|
|
473
|
+
return t("div", { style: { ...o2, position: "relative" }, ...h2, children: t("div", { className: m("hit-box", _2), style: { left: (u2 ? -r2 : 0) + "px", width: `calc(100% + ${u2 ? r2 + s2 : 0}px)`, top: (u2 ? 0 : -r2) + "px", height: `calc(100% + ${u2 ? 0 : r2 + s2}px)`, position: "absolute", ...d2 }, onPointerDown: l2 ? void 0 : n2, ...p2 }) }, a2);
|
|
474
|
+
}, xt = {}, bt = (t2, e2, n2 = true) => null === t2 ? null : null !== t2.pixels ? n2 ? t2.pixels : e2 - t2.pixels : (n2 ? t2.percent : 100 - t2.percent) / 100 * e2, wt = (t2, e2 = true) => t2?.percent ? `${e2 ? t2.percent : 100 - t2.percent}%` : t2?.pixels ? `${t2.pixels}px` : void 0, St = (t2, e2) => {
|
|
475
|
+
if (null == t2) return null;
|
|
446
476
|
const n2 = { percent: null, pixels: null };
|
|
447
|
-
let o2 =
|
|
448
|
-
return "string" == typeof
|
|
449
|
-
},
|
|
450
|
-
const { elementBefore: s2, elementAfter: l2, splitDirection: u2 = "row", fixedPane: d2 = null, position: _2, onPositionChange: p2, minBefore: g2, maxBefore: y2, minAfter: v2, maxAfter: x2, children: b2, className: S2, style: L2, disabled: C2 = false, onDragStart: E2, onDragResize: T2, onDragFinish: M2, resizerProps: D2 =
|
|
477
|
+
let o2 = e2;
|
|
478
|
+
return "string" == typeof t2 && ((t2 = t2.trim().toLowerCase()).endsWith("px") ? (t2 = t2.substring(0, t2.length - 2), o2 = false) : t2.endsWith("%") && (t2 = t2.substring(0, t2.length - 1), o2 = true), t2 = parseFloat(t2)), o2 ? n2.percent = t2 : n2.pixels = t2, Object.freeze(n2);
|
|
479
|
+
}, Lt = s(l((n2, i2) => {
|
|
480
|
+
const { elementBefore: s2, elementAfter: l2, splitDirection: u2 = "row", fixedPane: d2 = null, position: _2, onPositionChange: p2, minBefore: g2, maxBefore: y2, minAfter: v2, maxAfter: x2, children: b2, className: S2, style: L2, disabled: C2 = false, onDragStart: E2, onDragResize: T2, onDragFinish: M2, resizerProps: D2 = xt, paneProps: z2 = xt, paneBeforeProps: k2 = xt, paneAfterProps: A2 = xt, createResizer: B2 = vt } = n2;
|
|
451
481
|
if (b2) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
452
482
|
const $2 = h(() => o.isValidElement(l2) && o.isValidElement(s2), [l2, s2]), K2 = h(() => {
|
|
453
|
-
let
|
|
454
|
-
d2 && ("before" === d2 ?
|
|
455
|
-
const
|
|
456
|
-
return { fixedPaneOffset:
|
|
457
|
-
}, [g2, y2, v2, x2]), O2 = P(p2, [p2]), [V2, H2] = a(() =>
|
|
483
|
+
let t2 = null;
|
|
484
|
+
d2 && ("before" === d2 ? t2 = 0 : "after" === d2 && (t2 = 1));
|
|
485
|
+
const e2 = null === t2;
|
|
486
|
+
return { fixedPaneOffset: t2, isPercent: e2, minBefore: St(g2, e2), maxBefore: St(y2, e2), minAfter: St(v2, e2), maxAfter: St(x2, e2) };
|
|
487
|
+
}, [g2, y2, v2, x2]), O2 = P(p2, [p2]), [V2, H2] = a(() => St(_2, null === d2));
|
|
458
488
|
c(() => {
|
|
459
|
-
H2(
|
|
489
|
+
H2(St(_2, null === d2));
|
|
460
490
|
}, [_2, d2]);
|
|
461
|
-
const [W2, { width: N2, height: R2 }] = f(), [F2, { width: I2, height: Y2 }] = f(), X2 = "row" === u2 ? I2 : Y2, j2 = "row" === u2 ? N2 : R2, U2 = h(() => ((
|
|
491
|
+
const [W2, { width: N2, height: R2 }] = f(), [F2, { width: I2, height: Y2 }] = f(), X2 = "row" === u2 ? I2 : Y2, j2 = "row" === u2 ? N2 : R2, U2 = h(() => ((t2, e2, n3, o2) => {
|
|
462
492
|
const i3 = [null, null], r2 = [null, null];
|
|
463
|
-
if (
|
|
464
|
-
let s3 =
|
|
465
|
-
h2 = (
|
|
493
|
+
if (t2 || (t2 = { percent: null === o2.fixedPaneOffset ? 50 : null, pixels: null === o2.fixedPaneOffset ? null : 0 }), 0 === e2) return null != t2?.pixels ? 1 !== o2.fixedPaneOffset ? (i3[0] = t2?.pixels, r2[1] = 100) : (i3[1] = t2?.pixels - n3, r2[0] = 100) : null != t2?.percent && (1 !== o2.fixedPaneOffset ? (r2[0] = t2?.percent, r2[1] = 100 - t2?.percent) : (r2[1] = t2?.percent, r2[0] = 100 - t2?.percent)), { percents: r2, pixels: i3, minBefore: wt(o2.minBefore, true), maxBefore: wt(o2.maxBefore, true), minAfter: wt(o2.minAfter), maxAfter: wt(o2.maxAfter) };
|
|
494
|
+
let s3 = bt(t2, e2, 1 !== o2.fixedPaneOffset), l3 = e2 - n3, a2 = bt(o2.minBefore, l3, true) ?? 0, c2 = bt(o2.maxBefore, l3, true) ?? l3, h2 = 0, u3 = 0, d3 = 0, _3 = l3;
|
|
495
|
+
h2 = (bt(o2.maxAfter, e2, false) ?? n3) - n3, u3 = bt(o2.minAfter, e2, false) ?? e2, d3 = Math.max(a2, h2), _3 = Math.min(c2, u3), s3 = Math.max(d3, Math.min(s3, _3)), u3 = Math.min(l3 - s3, bt(o2.maxAfter, l3 - s3, true) ?? l3), h2 = Math.min(l3 - s3, bt(o2.minAfter, l3 - s3, true) ?? l3), i3[0] = s3, i3[1] = l3 - i3[0];
|
|
466
496
|
const p3 = Math.max(0, Math.min(100, s3 / l3 * 100));
|
|
467
497
|
return r2[0] = p3, r2[1] = 100 - r2[0], { percents: r2, pixels: i3, minBefore: `${a2}px`, minAfter: `${h2}px`, maxBefore: `${i3[0]}px`, maxAfter: `${i3[1]}px` };
|
|
468
|
-
})(V2, j2, X2, K2), [K2, V2, j2, X2, u2]), [Z2, G2] = a(false), q2 = P(E2, [E2]), J2 = P(T2, [T2]),
|
|
469
|
-
const
|
|
470
|
-
H2(
|
|
471
|
-
}, [d2]),
|
|
498
|
+
})(V2, j2, X2, K2), [K2, V2, j2, X2, u2]), [Z2, G2] = a(false), q2 = P(E2, [E2]), J2 = P(T2, [T2]), tt2 = P(M2, [M2]), et2 = r(null), nt2 = r(null), ot2 = r(null), { style: it2, className: rt2, ...st2 } = z2, lt2 = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...it2 }, { className: at2, style: ct2, ...ht2 } = k2, { className: ut2, style: dt2, ..._t2 } = A2, pt2 = { flex: "1 1 100%", width: "100%", ...L2, flexDirection: u2, display: "flex" }, { className: mt2, style: ft2, onPointerDown: gt2, ...yt2 } = D2, Lt2 = P((t2) => {
|
|
499
|
+
const e2 = St(t2, null === d2);
|
|
500
|
+
H2(e2);
|
|
501
|
+
}, [d2]), Ct2 = P((t2) => {
|
|
472
502
|
if (C2 || !Z2) return;
|
|
473
|
-
const
|
|
503
|
+
const e2 = Mt2.current?.getBoundingClientRect();
|
|
474
504
|
let n3 = 0;
|
|
475
|
-
n3 = "row" === u2 ? (
|
|
476
|
-
}, [K2, u2, C2, Z2, V2, j2]),
|
|
477
|
-
if (document.removeEventListener("pointermove",
|
|
505
|
+
n3 = "row" === u2 ? (t2.clientX ?? t2.touches?.[0]?.clientX) - e2.x : (t2.clientY ?? t2.touches?.[0]?.clientY) - e2.y, n3 = Math.max(0, Math.min(j2, n3)), 1 === K2.fixedPaneOffset && (n3 = j2 - n3), _2 && V2.pixels === n3 || H2({ pixels: n3, percent: null }), J2?.(n3), t2.stopPropagation(), t2.preventDefault();
|
|
506
|
+
}, [K2, u2, C2, Z2, V2, j2]), Et2 = P((t2) => {
|
|
507
|
+
if (document.removeEventListener("pointermove", Ct2), document.removeEventListener("touchmove", Ct2), document.removeEventListener("pointerup", Et2), !Z2) return;
|
|
478
508
|
if (G2(false), !V2) return;
|
|
479
|
-
|
|
480
|
-
if (!
|
|
481
|
-
const
|
|
482
|
-
null ===
|
|
509
|
+
tt2(V2.pixels);
|
|
510
|
+
if (!St(_2, null === d2) || V2.pixels !== _2) {
|
|
511
|
+
const t3 = { ...V2 };
|
|
512
|
+
null === t3.percent && (t3.percent = t3.pixels / j2 * 100), O2(t3);
|
|
483
513
|
}
|
|
484
|
-
|
|
485
|
-
}, [V2, Z2, _2, d2, j2]),
|
|
486
|
-
|
|
487
|
-
}, [
|
|
488
|
-
return
|
|
514
|
+
t2.stopPropagation(), t2.preventDefault();
|
|
515
|
+
}, [V2, Z2, _2, d2, j2]), Tt2 = P((t2) => {
|
|
516
|
+
gt2?.(t2), t2.defaultPrevented || C2 || Z2 || (G2(true), q2(), document.addEventListener("pointermove", Ct2, { passive: false }), document.addEventListener("touchmove", Ct2, { passive: false }), document.addEventListener("pointerup", Et2, { passive: false }));
|
|
517
|
+
}, [gt2]), Mt2 = Q(i2, () => ({ setPosition: Lt2, isSplitPane: () => true }), []), Dt2 = h(() => $2 ? B2?.({ key: "resizer", ref: w([F2, nt2]), className: m("resizer", mt2), onPointerDownCapture: Tt2, style: { cursor: C2 ? void 0 : "row" === u2 ? "ew-resize" : "ns-resize", minWidth: "row" === u2 ? "2px" : void 0, minHeight: "row" !== u2 ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...ft2 }, splitDirection: u2, disabled: C2, ...yt2 }) : null, [$2, mt2, yt2, u2, ft2, C2]), Pt2 = "row" === u2 ? "Width" : "Height", zt2 = { ...lt2, ...ct2, flex: 0 === K2.fixedPaneOffset && null !== U2?.pixels[0] ? `0 0 ${Math.round(U2?.pixels[0])}px` : `1 1 ${Math.round(U2?.percents[0] ?? 100)}%`, [`min${Pt2}`]: U2?.minBefore, [`max${Pt2}`]: l2 ? U2?.maxBefore : "100%" }, kt2 = { ...lt2, ...dt2, flex: 1 === K2.fixedPaneOffset && null !== U2?.pixels[1] ? `0 0 ${Math.round(U2?.pixels[1])}px` : `1 1 ${Math.round(U2?.percents[1] ?? 100)}%`, [`min${Pt2}`]: U2?.minAfter, [`max${Pt2}`]: s2 ? U2?.maxAfter : "100%" }, At2 = h(() => s2 ? t("div", { ref: et2, className: m("before", rt2, at2), style: zt2, ...st2, ...ht2, children: s2 }, "before") : null, [s2, z2, k2, K2, U2]), Bt2 = h(() => l2 ? t("div", { ref: ot2, className: m("after", rt2, ut2), style: kt2, ...st2, ..._t2, children: l2 }, "after") : null, [l2, z2, A2, K2, U2]);
|
|
518
|
+
return e("div", { ref: w([W2, Mt2]), className: m("splitPane", "row" === u2 ? "vertical" : "horizontal", { dragging: Z2 }, S2), style: pt2, children: [At2, Dt2, Bt2] });
|
|
489
519
|
}));
|
|
490
|
-
function
|
|
491
|
-
const [
|
|
520
|
+
function Ct(t2) {
|
|
521
|
+
const [e2, n2] = a("undefined" != typeof window ? window.devicePixelRatio : 1), o2 = r(null);
|
|
492
522
|
return c(() => {
|
|
493
523
|
if (!("undefined" != typeof window && "matchMedia" in window)) return;
|
|
494
|
-
const
|
|
495
|
-
const
|
|
496
|
-
|
|
524
|
+
const t3 = () => {
|
|
525
|
+
const e3 = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
|
|
526
|
+
e3.addEventListener("change", t3, { once: true, passive: true }), n2(window.devicePixelRatio), o2.current = { mediaMatcher: e3, listener: t3 };
|
|
497
527
|
};
|
|
498
|
-
return
|
|
528
|
+
return t3(), () => {
|
|
499
529
|
o2.current && o2.current.mediaMatcher.removeEventListener("change", o2.current.listener);
|
|
500
530
|
};
|
|
501
|
-
}, [
|
|
531
|
+
}, [t2]), e2;
|
|
502
532
|
}
|
|
503
|
-
function
|
|
533
|
+
function Et(t2) {
|
|
504
534
|
if ("undefined" == typeof window) return 1;
|
|
505
|
-
const { defaultDpr:
|
|
535
|
+
const { defaultDpr: e2 = 1, maxDpr: n2 = 3, round: o2 = true } = t2 || {}, i2 = "undefined" != typeof window && "number" == typeof window.devicePixelRatio ? window.devicePixelRatio : e2;
|
|
506
536
|
return Math.min(Math.max(1, o2 ? Math.floor(i2) : i2), n2);
|
|
507
537
|
}
|
|
508
|
-
function
|
|
509
|
-
const o2 = P(
|
|
538
|
+
function Tt(t2, e2, n2) {
|
|
539
|
+
const o2 = P(e2, [e2]);
|
|
510
540
|
c(() => {
|
|
511
|
-
const
|
|
512
|
-
|
|
541
|
+
const e3 = (e4) => {
|
|
542
|
+
t2.current && !t2.current.contains(e4.target) && o2(e4);
|
|
513
543
|
};
|
|
514
|
-
return n2 && false === n2.mouseEvents || (document.addEventListener("mousedown",
|
|
515
|
-
document.removeEventListener("mousedown",
|
|
544
|
+
return n2 && false === n2.mouseEvents || (document.addEventListener("mousedown", e3), document.addEventListener("touchstart", e3)), n2 && false === n2.focusEvents || document.addEventListener("focus", e3), () => {
|
|
545
|
+
document.removeEventListener("mousedown", e3), document.removeEventListener("touchstart", e3), document.removeEventListener("focus", e3);
|
|
516
546
|
};
|
|
517
|
-
}, [
|
|
547
|
+
}, [t2]);
|
|
518
548
|
}
|
|
519
|
-
function
|
|
520
|
-
if (!
|
|
521
|
-
const { onPointerDown:
|
|
549
|
+
function Mt(t2) {
|
|
550
|
+
if (!t2) throw new Error("must have a PointerHandlerOptions");
|
|
551
|
+
const { onPointerDown: e2, onPointerUp: n2, onPointerMoveOrWait: o2, processTouch: s2 = false, consumeTouch: l2 = true } = t2, a2 = P(e2, [e2]), h2 = P(n2, [n2]), u2 = P(o2, [o2]), d2 = r(false), _2 = t2?.timerInitial ?? 230, p2 = t2?.timerContinuous ?? _2 / 2, m2 = r(null), f2 = r(null), g2 = r(null), y2 = r(null), v2 = i(() => {
|
|
522
552
|
y2.current && (clearTimeout(y2.current), y2.current = null);
|
|
523
|
-
}, []), x2 = i((
|
|
553
|
+
}, []), x2 = i((t3) => {
|
|
524
554
|
y2.current = setTimeout(() => {
|
|
525
555
|
window.requestAnimationFrame(() => {
|
|
526
556
|
false !== d2.current && u2?.(f2.current, g2.current, m2.current);
|
|
527
557
|
}), x2(p2);
|
|
528
|
-
},
|
|
558
|
+
}, t3 ?? _2);
|
|
529
559
|
}, []);
|
|
530
560
|
c(() => () => v2(), []);
|
|
531
|
-
const b2 = s2 ? "pointer" : "mouse", w2 = i((
|
|
532
|
-
|
|
533
|
-
}, []), S2 = P((
|
|
561
|
+
const b2 = s2 ? "pointer" : "mouse", w2 = i((t3) => {
|
|
562
|
+
t3.stopPropagation(), t3.stopImmediatePropagation(), t3.preventDefault();
|
|
563
|
+
}, []), S2 = P((t3) => {
|
|
534
564
|
document.removeEventListener(`${b2}move`, E2), document.removeEventListener(`${b2}up`, S2), document.removeEventListener("keydown", T2), document.removeEventListener("keyup", M2), document.removeEventListener("touchstart", w2, { capture: true }), document.removeEventListener("touchmove", w2, { capture: true }), window.removeEventListener("blur", L2), v2(), window.requestAnimationFrame(() => {
|
|
535
|
-
false !== d2.current && (d2.current = false, h2?.(
|
|
565
|
+
false !== d2.current && (d2.current = false, h2?.(t3, g2.current, m2.current), g2.current = null);
|
|
536
566
|
});
|
|
537
567
|
}, []), L2 = i(() => {
|
|
538
568
|
false !== d2.current && (d2.current = false, S2(f2.current));
|
|
@@ -540,118 +570,118 @@ function De(e2) {
|
|
|
540
570
|
v2(), x2(p2), window.requestAnimationFrame(() => {
|
|
541
571
|
false !== d2.current && u2?.(f2.current, g2.current, m2.current);
|
|
542
572
|
});
|
|
543
|
-
}, [p2]), E2 = P((
|
|
544
|
-
f2.current =
|
|
545
|
-
}, []), T2 = P((
|
|
546
|
-
g2.current = { ctrlKey:
|
|
547
|
-
}, []), M2 = P((
|
|
548
|
-
g2.current = { ctrlKey:
|
|
573
|
+
}, [p2]), E2 = P((t3) => {
|
|
574
|
+
f2.current = t3, C2();
|
|
575
|
+
}, []), T2 = P((t3) => {
|
|
576
|
+
g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey }, C2();
|
|
577
|
+
}, []), M2 = P((t3) => {
|
|
578
|
+
g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey }, C2();
|
|
549
579
|
}, [p2]);
|
|
550
|
-
return P((
|
|
551
|
-
if (
|
|
552
|
-
g2.current = { ctrlKey:
|
|
553
|
-
false !== a2(
|
|
580
|
+
return P((t3) => {
|
|
581
|
+
if (t3.isDefaultPrevented()) return;
|
|
582
|
+
g2.current = { ctrlKey: t3.ctrlKey, shiftKey: t3.shiftKey, altKey: t3.altKey, metaKey: t3.metaKey };
|
|
583
|
+
false !== a2(t3, g2.current) && (m2.current = t3, f2.current = t3.nativeEvent, document.addEventListener(`${b2}up`, S2, { passive: false }), document.addEventListener(`${b2}move`, E2, { passive: false }), document.addEventListener("keydown", T2, { passive: false }), document.addEventListener("keyup", M2, { passive: false }), window.addEventListener("blur", L2, { passive: true }), s2 && l2 && (document.addEventListener("touchstart", w2, { passive: false, capture: true }), document.addEventListener("touchmove", w2, { passive: false, capture: true })), d2.current = true, x2(_2));
|
|
554
584
|
}, [_2, s2]);
|
|
555
585
|
}
|
|
556
|
-
function
|
|
557
|
-
return
|
|
558
|
-
|
|
559
|
-
}, ...
|
|
586
|
+
function Dt(t2, e2) {
|
|
587
|
+
return Mt({ onPointerDown: t2, onPointerMoveOrWait: (e3, n2, o2) => {
|
|
588
|
+
t2?.(o2);
|
|
589
|
+
}, ...e2 });
|
|
560
590
|
}
|
|
561
|
-
const
|
|
562
|
-
const o2 = r(
|
|
563
|
-
if ("function" != typeof
|
|
564
|
-
const i2 =
|
|
591
|
+
const Pt = ({ initValue: t2, useHookBody: e2, applyStateChange: n2 }) => {
|
|
592
|
+
const o2 = r(t2);
|
|
593
|
+
if ("function" != typeof e2) throw new Error("function expected as hook body parameter. got " + typeof e2);
|
|
594
|
+
const i2 = e2();
|
|
565
595
|
return d(() => {
|
|
566
596
|
o2.current !== i2 && (o2.current = i2, n2(i2));
|
|
567
597
|
}, [n2, i2]), null;
|
|
568
|
-
},
|
|
569
|
-
console && console.warn && console.warn(
|
|
570
|
-
},
|
|
571
|
-
let
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
},
|
|
598
|
+
}, zt = (t2) => {
|
|
599
|
+
console && console.warn && console.warn(t2);
|
|
600
|
+
}, kt = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0;
|
|
601
|
+
let At = 1, Bt = false, $t = false;
|
|
602
|
+
const Kt = [], Ot = [], Vt = () => {
|
|
603
|
+
Ot.forEach((t2) => t2());
|
|
604
|
+
}, Ht = ({ automaticContainerInternalUseOnly: e2 }) => {
|
|
575
605
|
const [o2, i2] = a([]), s2 = r([]);
|
|
576
|
-
return s2.current = o2,
|
|
577
|
-
let
|
|
606
|
+
return s2.current = o2, e2 || false !== Bt || ($t = true), c(() => {
|
|
607
|
+
let t2 = true;
|
|
578
608
|
function n2() {
|
|
579
|
-
if (
|
|
609
|
+
if (t2) return Ot[0] !== n2 ? (e2 || true !== Bt || zt("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void i2((t3) => [])) : void i2([...Kt]);
|
|
580
610
|
}
|
|
581
|
-
return
|
|
582
|
-
|
|
611
|
+
return Ot.push(n2), Vt(), () => {
|
|
612
|
+
t2 = false, s2.current?.length > 0 && zt("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), Ot.splice(Ot.indexOf(n2), 1), Vt();
|
|
583
613
|
};
|
|
584
|
-
}, [
|
|
585
|
-
},
|
|
586
|
-
const n2 =
|
|
587
|
-
return
|
|
588
|
-
if (
|
|
589
|
-
const n3 =
|
|
590
|
-
S(n3).render(
|
|
591
|
-
} else
|
|
592
|
-
})(
|
|
593
|
-
|
|
614
|
+
}, [e2]), t(n, { children: o2.map(({ hook: t2, key: e3 }) => _(Pt, { ...t2, key: e3 })) });
|
|
615
|
+
}, Wt = (e2) => {
|
|
616
|
+
const n2 = At++;
|
|
617
|
+
return Kt.push({ hook: e2, key: n2 }), 0 === Ot.length && false === $t && (Bt = true, ((e3) => {
|
|
618
|
+
if (kt.document && kt.document.createElement) {
|
|
619
|
+
const n3 = kt.document.createElement("div");
|
|
620
|
+
S(n3).render(t(e3, { automaticContainerInternalUseOnly: true }));
|
|
621
|
+
} else zt("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
|
|
622
|
+
})(Ht)), Vt(), () => {
|
|
623
|
+
Kt.splice(Kt.findIndex((t2) => t2.key === n2), 1), Vt();
|
|
594
624
|
};
|
|
595
|
-
},
|
|
625
|
+
}, Nt = (t2, e2, n2 = {}) => {
|
|
596
626
|
let o2, i2, r2 = false, s2 = false, l2 = [], { unmountIfNoConsumers: h2 = false } = n2;
|
|
597
|
-
const u2 = (
|
|
598
|
-
i2 =
|
|
599
|
-
}, d2 = () => (s2 || (i2 = "function" == typeof
|
|
627
|
+
const u2 = (t3) => {
|
|
628
|
+
i2 = t3, L(() => l2.forEach((e3) => e3(t3)));
|
|
629
|
+
}, d2 = () => (s2 || (i2 = "function" == typeof t2 ? t2() : t2, s2 = true), i2);
|
|
600
630
|
return () => {
|
|
601
631
|
const [n3, s3] = a(d2);
|
|
602
|
-
return c(() => (r2 || (r2 = true, o2 =
|
|
632
|
+
return c(() => (r2 || (r2 = true, o2 = Wt({ initValue: t2, useHookBody: e2, applyStateChange: u2 })), l2.push(s3), i2 !== n3 && s3(i2), () => {
|
|
603
633
|
l2.splice(l2.indexOf(s3), 1), 0 === l2.length && h2 && (o2(), r2 = false);
|
|
604
634
|
}), []), n3;
|
|
605
635
|
};
|
|
606
636
|
};
|
|
607
|
-
let
|
|
637
|
+
let Rt = () => {
|
|
608
638
|
console.warn("You must call useEditMode before setting its state.");
|
|
609
639
|
};
|
|
610
|
-
const
|
|
611
|
-
const [
|
|
612
|
-
return
|
|
613
|
-
}),
|
|
614
|
-
const
|
|
615
|
-
return h(() => ({ setMode: (
|
|
616
|
-
|
|
617
|
-
}, getMode: () =>
|
|
640
|
+
const Ft = Nt(null, () => {
|
|
641
|
+
const [t2, e2] = a(null);
|
|
642
|
+
return Rt = e2, t2;
|
|
643
|
+
}), It = () => {
|
|
644
|
+
const t2 = Ft();
|
|
645
|
+
return h(() => ({ setMode: (t3) => {
|
|
646
|
+
Rt((e2) => ("function" == typeof t3 && (t3 = t3(e2)), t3?.onModeChange?.(t3 ?? null), t3));
|
|
647
|
+
}, getMode: () => t2 }), [t2]);
|
|
618
648
|
};
|
|
619
|
-
class
|
|
620
|
-
constructor(
|
|
621
|
-
this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key =
|
|
649
|
+
class Yt {
|
|
650
|
+
constructor(t2, e2, n2, o2) {
|
|
651
|
+
this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = t2, this._target = e2, this._applyProps(n2 || {}), this._callback = o2, void 0 === o2 && (this._callback = () => {
|
|
622
652
|
console.log(`implement: ${this.label()} : ${this.description()}`);
|
|
623
653
|
});
|
|
624
654
|
}
|
|
625
655
|
key() {
|
|
626
656
|
return this._key;
|
|
627
657
|
}
|
|
628
|
-
_resolve(
|
|
629
|
-
if ("function" == typeof
|
|
630
|
-
const n2 =
|
|
631
|
-
return
|
|
658
|
+
_resolve(t2, e2) {
|
|
659
|
+
if ("function" == typeof t2) {
|
|
660
|
+
const n2 = e2 ?? this._context;
|
|
661
|
+
return t2("function" == typeof n2 ? n2() : n2);
|
|
632
662
|
}
|
|
633
|
-
return
|
|
663
|
+
return t2;
|
|
634
664
|
}
|
|
635
665
|
target() {
|
|
636
666
|
return "function" == typeof this._target ? this._target() : this._target;
|
|
637
667
|
}
|
|
638
|
-
label(
|
|
639
|
-
const n2 = this._scopedLabels?.[
|
|
668
|
+
label(t2, e2) {
|
|
669
|
+
const n2 = this._scopedLabels?.[t2] || this._label;
|
|
640
670
|
let o2 = null;
|
|
641
671
|
if ("function" == typeof n2) {
|
|
642
|
-
const
|
|
643
|
-
o2 = n2("function" == typeof
|
|
672
|
+
const t3 = e2 ?? this._context;
|
|
673
|
+
o2 = n2("function" == typeof t3 ? t3() : t3);
|
|
644
674
|
} else o2 = n2;
|
|
645
675
|
return o2;
|
|
646
676
|
}
|
|
647
|
-
description(
|
|
648
|
-
return this._resolve(this._description,
|
|
677
|
+
description(t2) {
|
|
678
|
+
return this._resolve(this._description, t2);
|
|
649
679
|
}
|
|
650
|
-
tags(
|
|
651
|
-
return this._resolve(this._tags,
|
|
680
|
+
tags(t2) {
|
|
681
|
+
return this._resolve(this._tags, t2);
|
|
652
682
|
}
|
|
653
|
-
icon(
|
|
654
|
-
return this._resolve(this._icon,
|
|
683
|
+
icon(t2) {
|
|
684
|
+
return this._resolve(this._icon, t2);
|
|
655
685
|
}
|
|
656
686
|
shortcut() {
|
|
657
687
|
return this._resolve(this._shortcut);
|
|
@@ -665,120 +695,120 @@ class Xe {
|
|
|
665
695
|
context() {
|
|
666
696
|
return "function" == typeof this._context ? this._context() : this._context;
|
|
667
697
|
}
|
|
668
|
-
async execute(
|
|
698
|
+
async execute(t2, e2) {
|
|
669
699
|
if (!this.disabled() && this._callback) {
|
|
670
700
|
try {
|
|
671
701
|
let n2 = true;
|
|
672
|
-
|
|
702
|
+
e2?.beforeExecute && (n2 = e2?.beforeExecute(this, t2));
|
|
673
703
|
if (false === await Promise.resolve(n2)) return false;
|
|
674
|
-
const o2 = this._callback.bind(this)(
|
|
704
|
+
const o2 = this._callback.bind(this)(t2, this);
|
|
675
705
|
if (false === await Promise.resolve(o2)) return false;
|
|
676
|
-
|
|
706
|
+
e2?.onExecute?.(this, t2), this._notifyExecute(t2);
|
|
677
707
|
} catch (n2) {
|
|
678
|
-
return console.warn(n2),
|
|
708
|
+
return console.warn(n2), e2?.onError(this, n2, t2), this._notifyError(t2, n2), false;
|
|
679
709
|
}
|
|
680
710
|
return true;
|
|
681
711
|
}
|
|
682
712
|
}
|
|
683
|
-
addPropertyListener(
|
|
684
|
-
if (!
|
|
713
|
+
addPropertyListener(t2, e2 = false) {
|
|
714
|
+
if (!t2) throw new Error("listener must be specified");
|
|
685
715
|
const n2 = this._listenersProperties;
|
|
686
|
-
return n2.add(
|
|
687
|
-
n2.delete(
|
|
716
|
+
return n2.add(t2), e2 && t2({}, this), () => {
|
|
717
|
+
n2.delete(t2);
|
|
688
718
|
};
|
|
689
719
|
}
|
|
690
|
-
addExecuteListener(
|
|
691
|
-
if (!
|
|
692
|
-
const
|
|
693
|
-
return
|
|
694
|
-
|
|
720
|
+
addExecuteListener(t2) {
|
|
721
|
+
if (!t2) throw new Error("listener must be specified");
|
|
722
|
+
const e2 = this._listenersExecute;
|
|
723
|
+
return e2.add(t2), function() {
|
|
724
|
+
e2.delete(t2);
|
|
695
725
|
};
|
|
696
726
|
}
|
|
697
|
-
_notifyExecute(
|
|
698
|
-
const
|
|
727
|
+
_notifyExecute(t2) {
|
|
728
|
+
const e2 = this;
|
|
699
729
|
this._listenersExecute.forEach((n2) => {
|
|
700
|
-
n2.onExecute(
|
|
730
|
+
n2.onExecute(e2, t2);
|
|
701
731
|
});
|
|
702
732
|
}
|
|
703
|
-
_notifyError(
|
|
733
|
+
_notifyError(t2, e2) {
|
|
704
734
|
const n2 = this;
|
|
705
735
|
this._listenersExecute.forEach((o2) => {
|
|
706
|
-
o2.onError?.(n2,
|
|
736
|
+
o2.onError?.(n2, t2, e2);
|
|
707
737
|
});
|
|
708
738
|
}
|
|
709
|
-
updateCallback(
|
|
710
|
-
return this._callback =
|
|
739
|
+
updateCallback(t2) {
|
|
740
|
+
return this._callback = t2 || null, this;
|
|
711
741
|
}
|
|
712
|
-
update(
|
|
713
|
-
if (!
|
|
714
|
-
const
|
|
715
|
-
return Object.keys(
|
|
742
|
+
update(t2) {
|
|
743
|
+
if (!t2) return;
|
|
744
|
+
const e2 = this._applyProps(t2);
|
|
745
|
+
return Object.keys(e2).length > 0 && this._notifyPropertyChange(e2), this;
|
|
716
746
|
}
|
|
717
|
-
_notifyPropertyChange(
|
|
718
|
-
const
|
|
747
|
+
_notifyPropertyChange(t2) {
|
|
748
|
+
const e2 = this;
|
|
719
749
|
this._listenersProperties.forEach((n2) => {
|
|
720
|
-
n2(
|
|
750
|
+
n2(t2, e2);
|
|
721
751
|
});
|
|
722
752
|
}
|
|
723
|
-
_applyProps(
|
|
724
|
-
let
|
|
725
|
-
return Object.keys(
|
|
726
|
-
let i2 =
|
|
727
|
-
n2["_" + o2] !== i2 && (n2["_" + o2] =
|
|
728
|
-
}),
|
|
753
|
+
_applyProps(t2) {
|
|
754
|
+
let e2 = {}, n2 = this;
|
|
755
|
+
return Object.keys(t2).forEach((o2) => {
|
|
756
|
+
let i2 = t2[o2];
|
|
757
|
+
n2["_" + o2] !== i2 && (n2["_" + o2] = e2[o2] = i2);
|
|
758
|
+
}), e2;
|
|
729
759
|
}
|
|
730
760
|
}
|
|
731
|
-
class
|
|
761
|
+
class Xt extends Yt {
|
|
732
762
|
}
|
|
733
|
-
class
|
|
734
|
-
constructor(
|
|
735
|
-
this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = g.uuidV4(), this._target =
|
|
763
|
+
class jt {
|
|
764
|
+
constructor(t2, e2) {
|
|
765
|
+
this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = g.uuidV4(), this._target = t2, this._groupKey = e2 ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(e2, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
|
|
736
766
|
const n2 = this;
|
|
737
|
-
this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (
|
|
738
|
-
const o2 = n2._root._listenersByKey, i2 =
|
|
739
|
-
r2 && n2._notifyCommands(r2, "onCommandChange",
|
|
767
|
+
this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (t3, e3) => {
|
|
768
|
+
const o2 = n2._root._listenersByKey, i2 = e3.key(), r2 = o2.get(i2);
|
|
769
|
+
r2 && n2._notifyCommands(r2, "onCommandChange", e3);
|
|
740
770
|
};
|
|
741
771
|
}
|
|
742
|
-
_getCommand(
|
|
743
|
-
const
|
|
744
|
-
return
|
|
772
|
+
_getCommand(t2) {
|
|
773
|
+
const e2 = this._commandsByKey.get(t2);
|
|
774
|
+
return e2 || (this._parent?._getCommand(t2) ?? null);
|
|
745
775
|
}
|
|
746
|
-
getCommand(
|
|
776
|
+
getCommand(t2, e2 = false) {
|
|
747
777
|
const n2 = this._root._focused;
|
|
748
778
|
let o2 = n2, i2 = n2 === this;
|
|
749
779
|
for (; !i2 && o2; ) o2 === this && (i2 = true), o2 = o2._parent;
|
|
750
|
-
return (i2 ? n2 : this)._getCommand(
|
|
780
|
+
return (i2 ? n2 : this)._getCommand(t2);
|
|
751
781
|
}
|
|
752
|
-
createChildGroup(
|
|
782
|
+
createChildGroup(t2, e2, n2) {
|
|
753
783
|
let o2;
|
|
754
784
|
if (!n2) {
|
|
755
|
-
let
|
|
756
|
-
for (;
|
|
757
|
-
let n3 =
|
|
758
|
-
n3 && (o2 = n3),
|
|
785
|
+
let t3 = this;
|
|
786
|
+
for (; t3 && !o2; ) {
|
|
787
|
+
let n3 = t3._nodes.get(e2);
|
|
788
|
+
n3 && (o2 = n3), t3 = t3._parent;
|
|
759
789
|
}
|
|
760
790
|
}
|
|
761
|
-
o2 || (o2 = new
|
|
762
|
-
const i2 = (
|
|
763
|
-
!
|
|
791
|
+
o2 || (o2 = new jt(t2, e2), o2._parent = this, o2._root = this._root, o2._unListenersByCommand = null, o2._listenersByKey = null, o2._commandsPropertyListener = null);
|
|
792
|
+
const i2 = (t3, o3) => {
|
|
793
|
+
!t3.has(e2) || n2 ? t3.set(e2, o3) : void 0 === n2 && console.warn("commandGroup already registered", e2);
|
|
764
794
|
};
|
|
765
795
|
i2(this._root._nodes, o2);
|
|
766
796
|
let r2 = this._parent;
|
|
767
797
|
for (; r2; ) i2(this._nodes, o2), r2 = r2._parent;
|
|
768
|
-
return this._children.set(
|
|
798
|
+
return this._children.set(e2, o2), this._notify("onGroupChange"), o2;
|
|
769
799
|
}
|
|
770
800
|
getKey() {
|
|
771
801
|
return this._groupKey;
|
|
772
802
|
}
|
|
773
|
-
getGroup(
|
|
774
|
-
return this._nodes.get(
|
|
803
|
+
getGroup(t2) {
|
|
804
|
+
return this._nodes.get(t2);
|
|
775
805
|
}
|
|
776
|
-
_addCommands(
|
|
806
|
+
_addCommands(t2, e2 = void 0) {
|
|
777
807
|
const n2 = this._commandsByKey, o2 = this._commandsByShortcut, i2 = this._root._commandsPropertyListener, r2 = this._root._unListenersByCommand;
|
|
778
|
-
for (let s2 = 0; s2 <
|
|
779
|
-
const l2 =
|
|
780
|
-
if (n2.has(a2) && !
|
|
781
|
-
void 0 ===
|
|
808
|
+
for (let s2 = 0; s2 < t2.length; s2++) {
|
|
809
|
+
const l2 = t2[s2], a2 = l2.key();
|
|
810
|
+
if (n2.has(a2) && !e2) {
|
|
811
|
+
void 0 === e2 && console.warn("command already registered", a2);
|
|
782
812
|
continue;
|
|
783
813
|
}
|
|
784
814
|
n2.set(a2, l2);
|
|
@@ -789,55 +819,55 @@ class Ue {
|
|
|
789
819
|
const u2 = l2.shortcut();
|
|
790
820
|
if (!u2) continue;
|
|
791
821
|
const d2 = Array.isArray(u2) ? u2 : [u2];
|
|
792
|
-
for (let
|
|
793
|
-
const n3 =
|
|
794
|
-
i3 && !
|
|
822
|
+
for (let t3 = 0; t3 < d2.length; t3++) {
|
|
823
|
+
const n3 = Gt(d2[t3]), i3 = o2.get(n3);
|
|
824
|
+
i3 && !e2 && void 0 === e2 && console.warn(`Shortcut already registered: ${n3}, ${a2}, ${i3}.`), o2.set(n3, a2);
|
|
795
825
|
}
|
|
796
826
|
}
|
|
797
827
|
}
|
|
798
828
|
removeFromParent() {
|
|
799
829
|
if (!this._parent) return;
|
|
800
|
-
let
|
|
830
|
+
let t2 = this._parent, e2 = [];
|
|
801
831
|
const n2 = this._groupKey;
|
|
802
|
-
for (;
|
|
803
|
-
|
|
804
|
-
const o2 = (
|
|
805
|
-
|
|
806
|
-
for (let n3 = 0; n3 <
|
|
807
|
-
o2(
|
|
832
|
+
for (; t2; ) e2.push(t2._nodes), t2._nodes.delete(n2), t2 = t2._parent;
|
|
833
|
+
t2 = this._parent;
|
|
834
|
+
const o2 = (t3) => {
|
|
835
|
+
t3._children.forEach((t4) => {
|
|
836
|
+
for (let n3 = 0; n3 < e2.length; n3++) t4._nodes.delete(e2[n3]);
|
|
837
|
+
o2(t4);
|
|
808
838
|
});
|
|
809
839
|
};
|
|
810
840
|
o2(this), this._parent = null, this._notify("onGroupChange");
|
|
811
841
|
}
|
|
812
|
-
addCommands(
|
|
813
|
-
this._addCommands(
|
|
842
|
+
addCommands(t2, e2) {
|
|
843
|
+
this._addCommands(t2, e2), this._notify("onGroupChange");
|
|
814
844
|
}
|
|
815
845
|
getActive() {
|
|
816
846
|
return this._root._focused ?? this._root;
|
|
817
847
|
}
|
|
818
|
-
activate(
|
|
819
|
-
let
|
|
820
|
-
if (
|
|
848
|
+
activate(t2) {
|
|
849
|
+
let e2 = this;
|
|
850
|
+
if (t2 && (e2 = this._nodes.get(t2), !e2)) return void console.warn("group not found", t2);
|
|
821
851
|
let n2 = this._root._focused ?? this._root;
|
|
822
852
|
for (; n2; ) n2 = n2._parent;
|
|
823
|
-
this._root._focused !==
|
|
853
|
+
this._root._focused !== e2 && (this._root._focused = e2, this._notify("onGroupChange"), this._notify("onActiveChange"));
|
|
824
854
|
}
|
|
825
|
-
findCommandByEvent(
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
let n2 =
|
|
855
|
+
findCommandByEvent(t2) {
|
|
856
|
+
const e2 = [];
|
|
857
|
+
t2.altKey && e2.push(E.Alt), t2.shiftKey && e2.push(E.Shift), t2.ctrlKey && e2.push(E.Ctrl), t2.metaKey && e2.push(E.Meta);
|
|
858
|
+
let n2 = Gt({ key: t2.code, modifiers: e2 });
|
|
829
859
|
const o2 = this._commandsByShortcut;
|
|
830
860
|
let i2 = o2.get(n2);
|
|
831
|
-
i2 || (n2 =
|
|
861
|
+
i2 || (n2 = Gt({ key: t2.key, modifiers: e2 }), i2 = o2.get(n2)), !i2 && t2.code.startsWith("Digit") && (n2 = Gt({ key: t2.code.substring(5, t2.code.length), modifiers: e2 }), i2 = this._commandsByShortcut.get(n2)), !i2 && t2.code.startsWith("Key") && (i2 = Gt({ key: t2.code.substring(3, t2.code.length), modifiers: e2 }), i2 = o2.get(n2));
|
|
832
862
|
let r2 = null;
|
|
833
|
-
return i2 && (r2 = this._commandsByKey.get(i2), r2 && r2.disabled() && (r2 = null), !r2 || r2.target() && r2.target().contains(
|
|
863
|
+
return i2 && (r2 = this._commandsByKey.get(i2), r2 && r2.disabled() && (r2 = null), !r2 || r2.target() && r2.target().contains(t2.target) || (r2 = null)), r2 || (this._parent?.findCommandByEvent(t2) ?? null);
|
|
834
864
|
}
|
|
835
|
-
dispatchToFocusedCommand(
|
|
836
|
-
const
|
|
837
|
-
if (!
|
|
838
|
-
if (
|
|
839
|
-
const n2 =
|
|
840
|
-
return !!n2 && (n2.execute(),
|
|
865
|
+
dispatchToFocusedCommand(t2) {
|
|
866
|
+
const e2 = this.getActive();
|
|
867
|
+
if (!e2) return false;
|
|
868
|
+
if (t2.isDefaultPrevented()) return false;
|
|
869
|
+
const n2 = e2.findCommandByEvent?.(t2);
|
|
870
|
+
return !!n2 && (n2.execute(), t2.preventDefault(), true);
|
|
841
871
|
}
|
|
842
872
|
getRoot() {
|
|
843
873
|
return this._parent ? this._parent.getRoot() : this;
|
|
@@ -845,299 +875,299 @@ class Ue {
|
|
|
845
875
|
getParent() {
|
|
846
876
|
return this._parent;
|
|
847
877
|
}
|
|
848
|
-
addListener(
|
|
849
|
-
const n2 = this._listeners, o2 =
|
|
850
|
-
if (o2 && !
|
|
878
|
+
addListener(t2, e2) {
|
|
879
|
+
const n2 = this._listeners, o2 = e2?.keys, i2 = this._root._listenersByKey;
|
|
880
|
+
if (o2 && !t2.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
|
|
851
881
|
let r2 = null;
|
|
852
|
-
if (o2) for (let
|
|
853
|
-
const n3 = o2[
|
|
882
|
+
if (o2) for (let e3 = 0; e3 < o2.length; e3++) {
|
|
883
|
+
const n3 = o2[e3];
|
|
854
884
|
if (!n3) continue;
|
|
855
885
|
let s2 = i2.get(n3);
|
|
856
|
-
s2 || (s2 = /* @__PURE__ */ new Set(), i2.set(n3, s2)), r2 || (r2 = []), r2.push(s2), s2.add(
|
|
886
|
+
s2 || (s2 = /* @__PURE__ */ new Set(), i2.set(n3, s2)), r2 || (r2 = []), r2.push(s2), s2.add(t2);
|
|
857
887
|
}
|
|
858
|
-
return n2.add(
|
|
859
|
-
if (r2) for (let
|
|
860
|
-
r2[
|
|
888
|
+
return n2.add(t2), () => {
|
|
889
|
+
if (r2) for (let e3 = 0; e3 < r2.length; e3++) {
|
|
890
|
+
r2[e3].delete(t2);
|
|
861
891
|
}
|
|
862
|
-
n2.delete(
|
|
892
|
+
n2.delete(t2);
|
|
863
893
|
};
|
|
864
894
|
}
|
|
865
|
-
_notifyCommands(
|
|
895
|
+
_notifyCommands(t2, e2, n2) {
|
|
866
896
|
const o2 = this;
|
|
867
897
|
setTimeout(() => {
|
|
868
|
-
|
|
869
|
-
|
|
898
|
+
t2.forEach((t3) => {
|
|
899
|
+
t3[e2]?.(o2, n2);
|
|
870
900
|
});
|
|
871
901
|
}, 0);
|
|
872
902
|
}
|
|
873
|
-
_notify(
|
|
903
|
+
_notify(t2, e2) {
|
|
874
904
|
const n2 = this;
|
|
875
905
|
setTimeout(() => {
|
|
876
906
|
n2._listeners.forEach((o2) => {
|
|
877
|
-
o2[
|
|
878
|
-
}), n2._parent && n2._parent._notify(
|
|
907
|
+
o2[t2]?.(n2, e2);
|
|
908
|
+
}), n2._parent && n2._parent._notify(t2, e2);
|
|
879
909
|
}, 0);
|
|
880
910
|
}
|
|
881
911
|
getAllCommands() {
|
|
882
|
-
const
|
|
912
|
+
const t2 = [], e2 = this._groupKey;
|
|
883
913
|
return this._commandsByKey.forEach((n2) => {
|
|
884
|
-
|
|
885
|
-
}), this._children.forEach((
|
|
886
|
-
|
|
887
|
-
}),
|
|
914
|
+
t2.push({ command: n2, groupKey: e2 });
|
|
915
|
+
}), this._children.forEach((e3) => {
|
|
916
|
+
t2.push(...e3.getAllCommands());
|
|
917
|
+
}), t2;
|
|
888
918
|
}
|
|
889
919
|
}
|
|
890
|
-
const
|
|
920
|
+
const Ut = g.getOS() === g.OSType.MacOS || g.getOS() === g.OSType.IOS ? "Cmd" : "Ctrl", Zt = g.getOS() === g.OSType.MacOS || g.getOS() === g.OSType.IOS ? "⌘" : "^", Gt = (t2, e2 = false) => {
|
|
891
921
|
const n2 = {};
|
|
892
|
-
for (let
|
|
922
|
+
for (let e3 = 0; t2.modifiers && e3 < t2.modifiers.length; e3++) n2[t2.modifiers[e3]] = true;
|
|
893
923
|
let o2 = "";
|
|
894
|
-
return (n2?.[E.Ctrl] || n2?.[E.Meta]) && (o2 += (o2.length > 0 ? "+" : "") + (
|
|
924
|
+
return (n2?.[E.Ctrl] || n2?.[E.Meta]) && (o2 += (o2.length > 0 ? "+" : "") + (e2 ? Zt : Ut)), n2?.[E.Alt] && (o2 += e2 ? "⌥" : "Alt"), n2?.[E.Shift] && (o2 += (o2.length > 0 ? "+" : "") + (e2 ? "⇧" : "Shift")), o2 += (o2.length > 0 ? "+" : "") + G(t2.key), o2;
|
|
895
925
|
};
|
|
896
|
-
function
|
|
897
|
-
const n2 = r(
|
|
898
|
-
n2.current =
|
|
899
|
-
const [o2, i2] = p((
|
|
926
|
+
function qt(t2, e2 = null) {
|
|
927
|
+
const n2 = r(e2);
|
|
928
|
+
n2.current = e2;
|
|
929
|
+
const [o2, i2] = p((t3) => t3 + 1, 0), s2 = h(() => Array.isArray(t2) ? t2 : [t2], [t2]);
|
|
900
930
|
return c(() => {
|
|
901
931
|
if (!s2 || 0 === s2.length) return;
|
|
902
|
-
const
|
|
903
|
-
n2.current?.onChange?.(
|
|
932
|
+
const t3 = (t4, e3) => {
|
|
933
|
+
n2.current?.onChange?.(e3), i2();
|
|
904
934
|
};
|
|
905
935
|
let o3 = null;
|
|
906
|
-
|
|
907
|
-
n2.current?.onExecute?.(
|
|
908
|
-
}, onError(
|
|
909
|
-
n2.current?.onError?.(
|
|
936
|
+
e2 && (o3 = { onExecute(t4, e3) {
|
|
937
|
+
n2.current?.onExecute?.(t4, e3);
|
|
938
|
+
}, onError(t4, e3, o4) {
|
|
939
|
+
n2.current?.onError?.(t4, e3, o4);
|
|
910
940
|
} });
|
|
911
941
|
const r2 = /* @__PURE__ */ new Set();
|
|
912
|
-
for (let n3 = 0; n3 < s2.length; n3++) r2.add(s2[n3]?.addPropertyListener(g.debounce(
|
|
942
|
+
for (let n3 = 0; n3 < s2.length; n3++) r2.add(s2[n3]?.addPropertyListener(g.debounce(t3, 0), true)), e2 && r2.add(s2[n3]?.addExecuteListener(o3));
|
|
913
943
|
return () => {
|
|
914
|
-
r2.forEach((
|
|
915
|
-
|
|
944
|
+
r2.forEach((t4) => {
|
|
945
|
+
t4?.();
|
|
916
946
|
});
|
|
917
947
|
};
|
|
918
|
-
}, [
|
|
948
|
+
}, [t2]), o2;
|
|
919
949
|
}
|
|
920
|
-
const
|
|
950
|
+
const Jt = (t2, e2) => {
|
|
921
951
|
const n2 = [];
|
|
922
|
-
if (
|
|
923
|
-
const i2 =
|
|
952
|
+
if (e2) for (let o2 = 0; o2 < e2.length; o2++) {
|
|
953
|
+
const i2 = e2[o2], r2 = i2 ? t2?.getCommand(i2) : null;
|
|
924
954
|
n2.push(r2);
|
|
925
955
|
}
|
|
926
956
|
return n2;
|
|
927
957
|
};
|
|
928
|
-
function
|
|
958
|
+
function Qt(t2, e2 = null, n2 = null, o2) {
|
|
929
959
|
const i2 = r(n2);
|
|
930
|
-
i2.current = n2,
|
|
931
|
-
const [s2, l2] = a(
|
|
960
|
+
i2.current = n2, e2 && !Array.isArray(e2) && (e2 = [e2]);
|
|
961
|
+
const [s2, l2] = a(Jt(t2, e2)), h2 = o2 ? [...o2, t2] : [t2];
|
|
932
962
|
return c(() => {
|
|
933
963
|
const n3 = { onGroupChange: () => {
|
|
934
|
-
const n4 =
|
|
964
|
+
const n4 = Jt(t2, e2);
|
|
935
965
|
l2(n4), i2.current?.onChange?.(this);
|
|
936
966
|
} };
|
|
937
967
|
let o3;
|
|
938
|
-
|
|
939
|
-
i2.current?.onChange?.(
|
|
968
|
+
e2 && e2.length > 0 && (o3 = { keys: e2 }, n3.onCommandChange = (n4, o4) => {
|
|
969
|
+
i2.current?.onChange?.(t2), l2(Jt(t2, e2));
|
|
940
970
|
});
|
|
941
|
-
const r2 =
|
|
942
|
-
return l2(s3), i2.current?.onChange && i2.current?.onChange(
|
|
971
|
+
const r2 = t2?.addListener(n3, o3), s3 = Jt(t2, e2);
|
|
972
|
+
return l2(s3), i2.current?.onChange && i2.current?.onChange(t2), () => {
|
|
943
973
|
r2?.();
|
|
944
974
|
};
|
|
945
975
|
}, h2), s2;
|
|
946
976
|
}
|
|
947
|
-
const
|
|
977
|
+
const te = { Toolbar: "toolbar", Menuitem: "menuitem" }, ee = Nt({ setClipboard: (t2) => {
|
|
948
978
|
throw new Error("This is only available via the useClipboard.");
|
|
949
979
|
}, getClipboard: () => x.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
950
|
-
const [
|
|
951
|
-
return { setClipboard: (
|
|
952
|
-
}),
|
|
953
|
-
const { source:
|
|
980
|
+
const [t2, e2] = a(x.Global);
|
|
981
|
+
return { setClipboard: (t3) => e2(t3), getClipboard: () => t2, refNativeCopy: r(null), refNativeLastKey: r(null) };
|
|
982
|
+
}), ne = (t2) => {
|
|
983
|
+
const { source: e2, target: n2, onPaste: o2, onClipboardUpdate: r2, notifier: s2 = rt, commands: l2 } = t2, a2 = P(r2, [r2]), u2 = P(o2, [o2]), { getClipboard: d2, refNativeCopy: _2 } = ee(), p2 = d2();
|
|
954
984
|
h(() => {
|
|
955
|
-
const
|
|
985
|
+
const t3 = e2?.element, o3 = n2?.element ?? e2?.element;
|
|
956
986
|
if (!l2) return;
|
|
957
|
-
const i2 = [new
|
|
987
|
+
const i2 = [new Xt("cut", t3, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [E.Ctrl] } }), new Xt("copy", t3, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [E.Ctrl] } }), new Xt("paste", o3, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [E.Ctrl] }, { key: "F8", modifiers: [E.Ctrl] }] })];
|
|
958
988
|
l2?.addCommands(i2, true);
|
|
959
989
|
}, [l2]);
|
|
960
|
-
const m2 = P(async (
|
|
961
|
-
if (!
|
|
990
|
+
const m2 = P(async (t3) => {
|
|
991
|
+
if (!e2?.element) return;
|
|
962
992
|
let n3 = null;
|
|
963
993
|
try {
|
|
964
|
-
n3 =
|
|
965
|
-
} catch (
|
|
966
|
-
throw
|
|
994
|
+
n3 = e2.doCopy?.(t3), "string" == typeof n3 ? await p2.writeText(n3) : await p2.writeReference(n3);
|
|
995
|
+
} catch (t4) {
|
|
996
|
+
throw t4;
|
|
967
997
|
}
|
|
968
|
-
}, [
|
|
969
|
-
const n3 =
|
|
998
|
+
}, [e2, s2]), f2 = P(async (t3) => {
|
|
999
|
+
const n3 = e2?.element?.();
|
|
970
1000
|
if (n3) {
|
|
971
|
-
_2.current = { sourceElement: n3, args:
|
|
1001
|
+
_2.current = { sourceElement: n3, args: t3 };
|
|
972
1002
|
try {
|
|
973
|
-
await m2(
|
|
974
|
-
} catch (
|
|
975
|
-
s2?.showError?.(
|
|
1003
|
+
await m2(t3);
|
|
1004
|
+
} catch (t4) {
|
|
1005
|
+
s2?.showError?.(t4);
|
|
976
1006
|
}
|
|
977
1007
|
}
|
|
978
|
-
}, [
|
|
1008
|
+
}, [e2?.element, s2]), b2 = i(() => {
|
|
979
1009
|
f2({ isCut: true });
|
|
980
|
-
}, []), w2 = P(async (
|
|
1010
|
+
}, []), w2 = P(async (t3, e3, n3) => {
|
|
981
1011
|
try {
|
|
982
|
-
if (false === await
|
|
983
|
-
u2?.(
|
|
984
|
-
} catch (
|
|
985
|
-
s2?.showError?.(
|
|
1012
|
+
if (false === await t3.doPaste(e3, n3)) return;
|
|
1013
|
+
u2?.(e3, n3);
|
|
1014
|
+
} catch (t4) {
|
|
1015
|
+
s2?.showError?.(t4);
|
|
986
1016
|
}
|
|
987
|
-
}, [u2]), S2 = P(async (
|
|
1017
|
+
}, [u2]), S2 = P(async (t3, e3, o3) => {
|
|
988
1018
|
const i2 = n2?.element?.();
|
|
989
|
-
if (i2 && await g.whenFocus(i2), !
|
|
1019
|
+
if (i2 && await g.whenFocus(i2), !t3 && !e3) return;
|
|
990
1020
|
const r3 = await s2?.showBusy?.("Pasting...");
|
|
991
|
-
if (
|
|
992
|
-
return await w2(n2,
|
|
993
|
-
} catch (
|
|
994
|
-
r3?.(), s2?.showError?.(
|
|
1021
|
+
if (e3) try {
|
|
1022
|
+
return await w2(n2, e3, o3), void r3?.();
|
|
1023
|
+
} catch (t4) {
|
|
1024
|
+
r3?.(), s2?.showError?.(t4);
|
|
995
1025
|
}
|
|
996
1026
|
let l3, a3 = n2.importFromExternal;
|
|
997
|
-
a3 || (a3 = (
|
|
1027
|
+
a3 || (a3 = (e4, n3) => ({ getItemType: () => "text", toText: () => t3.text, isClipboardItem: true }));
|
|
998
1028
|
try {
|
|
999
|
-
l3 = await a3(
|
|
1000
|
-
} catch (
|
|
1001
|
-
r3?.(), s2?.showError?.(
|
|
1029
|
+
l3 = await a3(t3, { isCut: false });
|
|
1030
|
+
} catch (t4) {
|
|
1031
|
+
r3?.(), s2?.showError?.(t4);
|
|
1002
1032
|
}
|
|
1003
1033
|
if (l3) try {
|
|
1004
|
-
const
|
|
1005
|
-
await w2(n2,
|
|
1006
|
-
} catch (
|
|
1007
|
-
r3?.(), s2?.showError?.(
|
|
1034
|
+
const t4 = await Promise.resolve(l3);
|
|
1035
|
+
await w2(n2, t4, o3), r3?.();
|
|
1036
|
+
} catch (t4) {
|
|
1037
|
+
r3?.(), s2?.showError?.(t4);
|
|
1008
1038
|
}
|
|
1009
1039
|
else r3?.();
|
|
1010
|
-
}, [w2, n2, s2]), L2 = P(async (
|
|
1040
|
+
}, [w2, n2, s2]), L2 = P(async (t3) => {
|
|
1011
1041
|
if (n2?.element) try {
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
1042
|
+
const e3 = await p2.readReference();
|
|
1043
|
+
if (e3) return void await S2(null, e3, t3);
|
|
1014
1044
|
const n3 = [];
|
|
1015
1045
|
n3[0] = await y.readStringFromClipboard(p2, v.plain), n3[1] = await y.readHTMLFromClipboard(p2, v.html), n3[2] = await y.readBlobFromClipboard(p2, v.png);
|
|
1016
1046
|
const o3 = { text: n3[0] ?? null, html: n3[1] ?? null, image: n3[2] ?? null };
|
|
1017
|
-
await S2(o3, null,
|
|
1018
|
-
} catch (
|
|
1019
|
-
if ("Document is not focused." ===
|
|
1020
|
-
s2?.showError?.(
|
|
1047
|
+
await S2(o3, null, t3);
|
|
1048
|
+
} catch (t4) {
|
|
1049
|
+
if ("Document is not focused." === t4?.message) return;
|
|
1050
|
+
s2?.showError?.(t4);
|
|
1021
1051
|
}
|
|
1022
1052
|
}, [S2, n2?.element, s2]);
|
|
1023
|
-
return P(async (
|
|
1024
|
-
}, [
|
|
1053
|
+
return P(async (t3) => {
|
|
1054
|
+
}, [e2?.element]), P(async (t3) => {
|
|
1025
1055
|
}, [n2?.element, S2, s2]), c(() => {
|
|
1026
1056
|
if (!p2) return;
|
|
1027
|
-
const
|
|
1028
|
-
const
|
|
1029
|
-
a2?.(
|
|
1030
|
-
},
|
|
1057
|
+
const t3 = async (t4) => {
|
|
1058
|
+
const e4 = await p2.readReference();
|
|
1059
|
+
a2?.(e4);
|
|
1060
|
+
}, e3 = (t4) => {
|
|
1031
1061
|
s2?.showMessage?.(x.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
|
|
1032
|
-
}, n3 = (
|
|
1062
|
+
}, n3 = (t4) => {
|
|
1033
1063
|
s2?.showMessage?.(x.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
|
|
1034
1064
|
};
|
|
1035
|
-
return p2.addEventListener("clipboardchange",
|
|
1036
|
-
p2.removeEventListener("clipboardchange",
|
|
1065
|
+
return p2.addEventListener("clipboardchange", t3), p2.addEventListener("clipboarderrorread", e3), p2.addEventListener("clipboarderrorwrite", n3), () => {
|
|
1066
|
+
p2.removeEventListener("clipboardchange", t3), p2.removeEventListener("clipboarderrorread", e3), p2.removeEventListener("clipboarderrorwrite", n3);
|
|
1037
1067
|
};
|
|
1038
1068
|
}, [p2, s2]), c(() => {
|
|
1039
|
-
}, [m2, S2,
|
|
1040
|
-
l2?.getCommand("cut")?.updateCallback(b2).update({ disabled: !
|
|
1041
|
-
}, [
|
|
1069
|
+
}, [m2, S2, e2, n2]), c(() => {
|
|
1070
|
+
l2?.getCommand("cut")?.updateCallback(b2).update({ disabled: !e2 || !n2 }), l2?.getCommand("copy")?.updateCallback(f2).update({ disabled: !e2 }), l2?.getCommand("paste")?.updateCallback(L2).update({ disabled: !n2 });
|
|
1071
|
+
}, [e2, n2, l2]), { paste: L2, copy: f2, clipboard: p2 };
|
|
1042
1072
|
};
|
|
1043
|
-
function
|
|
1044
|
-
const n2 = r(
|
|
1073
|
+
function oe(t2, e2 = true) {
|
|
1074
|
+
const n2 = r(t2);
|
|
1045
1075
|
c(() => {
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1048
|
-
Object.keys(
|
|
1076
|
+
if (e2) {
|
|
1077
|
+
const e3 = Object.entries(t2).reduce((t3, [e4, o2]) => (n2.current[e4] !== o2 && (t3[e4] = [n2.current[e4], o2]), t3), {});
|
|
1078
|
+
Object.keys(e3).length > 0 && console.log("Changed props:", e3);
|
|
1049
1079
|
}
|
|
1050
|
-
n2.current =
|
|
1080
|
+
n2.current = t2;
|
|
1051
1081
|
});
|
|
1052
1082
|
}
|
|
1053
|
-
let
|
|
1054
|
-
var
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1057
|
-
const [
|
|
1058
|
-
return
|
|
1059
|
-
null ==
|
|
1083
|
+
let ie = false, re = 0;
|
|
1084
|
+
var se = "undefined" != typeof document ? d : c;
|
|
1085
|
+
const le = () => "sheetxl-ui-" + re++;
|
|
1086
|
+
const ae = o["useId".toString()], ce = null != ae ? ae : function() {
|
|
1087
|
+
const [t2, e2] = o.useState(() => ie ? le() : void 0);
|
|
1088
|
+
return se(() => {
|
|
1089
|
+
null == t2 && e2(le());
|
|
1060
1090
|
}, []), o.useEffect(() => {
|
|
1061
|
-
|
|
1062
|
-
}, []),
|
|
1063
|
-
},
|
|
1064
|
-
const i2 = P((
|
|
1091
|
+
ie || (ie = true);
|
|
1092
|
+
}, []), t2;
|
|
1093
|
+
}, he = "Undo the last action.", ue = "Repeat the last action or undo the redo.", de = (t2) => `Redo ${t2}`, _e = ({ manager: t2, commands: e2, disabled: n2, notifier: o2 = rt }) => {
|
|
1094
|
+
const i2 = P((e3) => {
|
|
1065
1095
|
try {
|
|
1066
|
-
|
|
1067
|
-
} catch (
|
|
1068
|
-
o2.showError?.(
|
|
1096
|
+
t2?.undo(e3);
|
|
1097
|
+
} catch (t3) {
|
|
1098
|
+
o2.showError?.(t3);
|
|
1069
1099
|
}
|
|
1070
|
-
}, [
|
|
1100
|
+
}, [t2]), r2 = P((e3) => {
|
|
1071
1101
|
try {
|
|
1072
|
-
|
|
1073
|
-
} catch (
|
|
1074
|
-
o2.showError?.(
|
|
1102
|
+
t2?.redo(e3);
|
|
1103
|
+
} catch (t3) {
|
|
1104
|
+
o2.showError?.(t3);
|
|
1075
1105
|
}
|
|
1076
|
-
}, [
|
|
1106
|
+
}, [t2]);
|
|
1077
1107
|
return h(() => {
|
|
1078
|
-
if (!
|
|
1079
|
-
const
|
|
1080
|
-
} }, n3 = [new
|
|
1081
|
-
|
|
1082
|
-
}, [
|
|
1083
|
-
if (!
|
|
1108
|
+
if (!e2) return;
|
|
1109
|
+
const t3 = { contains: (t4) => true, focus() {
|
|
1110
|
+
} }, n3 = [new Yt("undo", t3, { label: "Undo", description: he, shortcut: { key: "z", modifiers: [E.Ctrl] }, disabled: true }, i2), new Yt("redo", t3, { label: "Redo", description: ue, shortcut: [{ key: "y", modifiers: [E.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [E.Alt] }], disabled: true }, r2)];
|
|
1111
|
+
e2?.addCommands(n3, true);
|
|
1112
|
+
}, [e2]), c(() => {
|
|
1113
|
+
if (!e2) return;
|
|
1084
1114
|
const o3 = () => {
|
|
1085
|
-
const o4 =
|
|
1115
|
+
const o4 = t2?.getTopUndoDescription(), i4 = {};
|
|
1086
1116
|
var r3;
|
|
1087
|
-
|
|
1088
|
-
const s2 =
|
|
1089
|
-
|
|
1117
|
+
e2.getCommand("undo").update({ disabled: n2 || !t2 || !t2.hasUndo(), description: o4 ? (r3 = o4, `Undo ${r3}`) : he, state: i4, context: { undoManager: t2 } });
|
|
1118
|
+
const s2 = t2?.getTopRedoDescription();
|
|
1119
|
+
e2.getCommand("redo").update({ disabled: n2 || !t2 || !t2.hasRedo(), description: s2 ? de(s2) : ue, state: i4, context: { undoManager: t2 } });
|
|
1090
1120
|
};
|
|
1091
|
-
if (o3(), !
|
|
1092
|
-
const i3 =
|
|
1121
|
+
if (o3(), !t2) return;
|
|
1122
|
+
const i3 = t2.addListener({ onStackChange() {
|
|
1093
1123
|
o3();
|
|
1094
1124
|
} });
|
|
1095
1125
|
return () => i3?.();
|
|
1096
|
-
}, [
|
|
1126
|
+
}, [t2, e2, n2]), { undo: i2, redo: r2 };
|
|
1097
1127
|
};
|
|
1098
1128
|
export {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1129
|
+
Yt as Command,
|
|
1130
|
+
te as CommandButtonType,
|
|
1131
|
+
jt as CommandGroup,
|
|
1132
|
+
rt as DefaultNotifier,
|
|
1133
|
+
ft as FocusKeyNavigation,
|
|
1104
1134
|
C as HorizontalAlignment,
|
|
1105
1135
|
T as KeyCodes,
|
|
1106
1136
|
E as KeyModifiers,
|
|
1107
1137
|
M as MouseButtonCodes,
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1138
|
+
ot as NotificationType,
|
|
1139
|
+
q as ReactUtils,
|
|
1140
|
+
gt as RoundedTab,
|
|
1141
|
+
nt as ScrollPane,
|
|
1112
1142
|
$ as ScrollUtils,
|
|
1113
1143
|
O as Scrollbar,
|
|
1114
1144
|
D as ScrollbarOrientation,
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1145
|
+
Xt as SimpleCommand,
|
|
1146
|
+
Lt as SplitPane,
|
|
1147
|
+
vt as SplitPaneResizer,
|
|
1148
|
+
mt as ToolTipPlacement,
|
|
1149
|
+
pt as VirtualScrollbar,
|
|
1150
|
+
et as defaultCreateScrollCorner,
|
|
1121
1151
|
A as defaultCreateScrollEdgeButton,
|
|
1122
1152
|
k as defaultCreateScrollEndButton,
|
|
1123
1153
|
z as defaultCreateScrollStartButton,
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1154
|
+
tt as defaultCreateScrollbar,
|
|
1155
|
+
Et as getDevicePixelRatio,
|
|
1156
|
+
st as getPortalContainer,
|
|
1157
|
+
Gt as toShortcutString,
|
|
1128
1158
|
P as useCallbackRef,
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1159
|
+
qt as useCommand,
|
|
1160
|
+
Qt as useCommands,
|
|
1161
|
+
ne as useCopyPaste,
|
|
1162
|
+
Ct as useDevicePixelRatio,
|
|
1163
|
+
It as useEditMode,
|
|
1164
|
+
at as useFullscreenPortal,
|
|
1165
|
+
ee as useGlobalClipboard,
|
|
1166
|
+
ce as useId,
|
|
1167
|
+
Q as useImperativeElement,
|
|
1168
|
+
Dt as useMouseDownAndHoldListener,
|
|
1169
|
+
Tt as useOnClickOrFocusAway,
|
|
1170
|
+
Mt as useSynchronizedPointerHandler,
|
|
1171
|
+
oe as useTraceUpdate,
|
|
1172
|
+
_e as useUndoManager
|
|
1143
1173
|
};
|