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