@sheetxl/utils-react 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/index.mjs +383 -352
- package/node/esm/index.mjs +771 -740
- package/package.json +2 -2
- package/types/index.d.ts +134 -89
package/browser/esm/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { jsx as L, jsxs as be, Fragment as
|
|
3
|
-
import
|
|
4
|
-
import { CommonUtils as te, InternalClipboard as
|
|
5
|
-
import { createRoot as
|
|
6
|
-
import { unstable_batchedUpdates as
|
|
2
|
+
import { jsx as L, jsxs as be, Fragment as De } from "react/jsx-runtime";
|
|
3
|
+
import ce, { useLayoutEffect as Ie, useEffect as V, useState as G, useMemo as W, useCallback as H, useRef as A, memo as Le, forwardRef as Ce, useImperativeHandle as nn, version as on, createContext as rn, useContext as sn, createElement as ln, useReducer as an } from "react";
|
|
4
|
+
import { CommonUtils as te, DelegatingNotifier as cn, Notifier as fe, InternalClipboard as Re, ClipboardUtils as We, MimeType as Fe } from "@sheetxl/utils";
|
|
5
|
+
import { createRoot as hn } from "react-dom/client";
|
|
6
|
+
import { unstable_batchedUpdates as un } from "react-dom";
|
|
7
7
|
/**
|
|
8
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.
|
|
8
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.4
|
|
9
9
|
*
|
|
10
10
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
11
11
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const io = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, Z = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, ro = { 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 }, so = { Left: 1, Middle: 2, Right: 3 }, re = { Horizontal: "horizontal", Vertical: "vertical" };
|
|
14
14
|
function Ct(i) {
|
|
15
15
|
var e, t, n = "";
|
|
16
16
|
if (typeof i == "string" || typeof i == "number") n += i;
|
|
@@ -20,43 +20,43 @@ function Ct(i) {
|
|
|
20
20
|
} else for (t in i) i[t] && (n && (n += " "), n += t);
|
|
21
21
|
return n;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function xe() {
|
|
24
24
|
for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e = Ct(i)) && (n && (n += " "), n += e);
|
|
25
25
|
return n;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
28
|
-
}, Et = typeof window < "u",
|
|
29
|
-
const
|
|
30
|
-
var i = G(null), e = i[0], t = i[1], n = G(
|
|
27
|
+
var dn = function() {
|
|
28
|
+
}, Et = typeof window < "u", pn = Et ? Ie : V, pt = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
29
|
+
const ge = Et && window.ResizeObserver !== void 0 ? function() {
|
|
30
|
+
var i = G(null), e = i[0], t = i[1], n = G(pt), o = n[0], r = n[1], s = W(function() {
|
|
31
31
|
return new window.ResizeObserver(function(l) {
|
|
32
32
|
if (l[0]) {
|
|
33
|
-
var a = l[0].contentRect, c = a.x, h = a.y, u = a.width, d = a.height,
|
|
34
|
-
r({ x: c, y: h, width: u, height: d, top:
|
|
33
|
+
var a = l[0].contentRect, c = a.x, h = a.y, u = a.width, d = a.height, b = a.top, w = a.left, x = a.bottom, S = a.right;
|
|
34
|
+
r({ x: c, y: h, width: u, height: d, top: b, left: w, bottom: x, right: S });
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
}, []);
|
|
38
|
-
return
|
|
38
|
+
return pn(function() {
|
|
39
39
|
if (e) return s.observe(e), function() {
|
|
40
40
|
s.disconnect();
|
|
41
41
|
};
|
|
42
42
|
}, [e]), [t, o];
|
|
43
43
|
} : function() {
|
|
44
|
-
return [
|
|
44
|
+
return [dn, pt];
|
|
45
45
|
}, T = (i, e) => {
|
|
46
|
-
const t =
|
|
46
|
+
const t = H((...r) => i?.(...r), e), n = A(null);
|
|
47
47
|
n.current = t;
|
|
48
|
-
const o =
|
|
48
|
+
const o = H((...r) => n.current?.(...r), []);
|
|
49
49
|
if (n.current) return o;
|
|
50
|
-
},
|
|
50
|
+
}, _n = (i) => {
|
|
51
51
|
const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
|
|
52
52
|
return L("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: o ? "0px" : "3px", paddingTop: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button start`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "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" }) }) }) });
|
|
53
|
-
},
|
|
53
|
+
}, mn = (i) => {
|
|
54
54
|
const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
|
|
55
55
|
return L("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: o ? "0px" : "3px", paddingBottom: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button end`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "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" }) }) }) });
|
|
56
|
-
},
|
|
56
|
+
}, lo = (i) => {
|
|
57
57
|
const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
|
|
58
58
|
return L("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...e }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} edge`, ...n, children: L("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: o ? "rotate(90) " : "", children: L("path", { style: { transition: "opacity 240ms ease 0s", opacity: i.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" }) }) });
|
|
59
|
-
},
|
|
59
|
+
}, Ze = (i, e, t, n, o = 0) => {
|
|
60
60
|
for (let r = 0; r < t.length; r++) {
|
|
61
61
|
const s = t[r].getBoundingClientRect();
|
|
62
62
|
let l = s.left - e, a = l + s.width;
|
|
@@ -65,88 +65,88 @@ const fe = Et && window.ResizeObserver !== void 0 ? function() {
|
|
|
65
65
|
} else if (Math.ceil(a) > Math.ceil(i) + 2) return a;
|
|
66
66
|
}
|
|
67
67
|
return o;
|
|
68
|
-
},
|
|
69
|
-
const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className: s, orientation: l = re.Vertical, onScrollOffset: a, onScroll: c, showCustomScrollButtons: h = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: d = 260, scrollButtonAdditionalRepeatDelay:
|
|
68
|
+
}, ao = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ze }, Symbol.toStringTag, { value: "Module" })), fn = "_sheetxl-scrollbar_eblx4_6", nt = Le(Ce((i, e) => {
|
|
69
|
+
const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className: s, orientation: l = re.Vertical, onScrollOffset: a, onScroll: c, showCustomScrollButtons: h = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: d = 260, scrollButtonAdditionalRepeatDelay: b = 120, createScrollStartButton: w = _n, createScrollEndButton: x = mn, ...S } = i, P = T(c, [c]), _ = A(null), [y, { width: f, height: k }] = ge(), [z, { width: $, height: I }] = ge(), g = l === re.Vertical, v = g ? "top" : "left", B = g ? "scrollTop" : "scrollLeft", p = g ? k : f, C = g ? I : $, [m, E] = G(null);
|
|
70
70
|
V(() => {
|
|
71
71
|
m !== null && _.current && _.current.scrollTo({ behavior: "smooth", [v]: m });
|
|
72
72
|
}, [m, g]);
|
|
73
|
-
const D =
|
|
73
|
+
const D = H((K, se = !1) => {
|
|
74
74
|
if (!_.current) return 0;
|
|
75
|
-
const ie = _.current.querySelector(".scrollbar-viewport"),
|
|
76
|
-
return E(
|
|
77
|
-
}, []), q =
|
|
75
|
+
const ie = _.current.querySelector(".scrollbar-viewport"), _e = ie.getBoundingClientRect(), le = ie.children, he = se ? 0 : Ze(K, _e[v], le, !0, Math.max(0, K - u));
|
|
76
|
+
return E(he), Math.max(0, he);
|
|
77
|
+
}, []), q = H((K, se = !1) => {
|
|
78
78
|
if (!_.current) return 0;
|
|
79
|
-
const ie = _.current.querySelector(".scrollbar-viewport"),
|
|
80
|
-
return E(
|
|
81
|
-
}, [C, p]),
|
|
82
|
-
|
|
79
|
+
const ie = _.current.querySelector(".scrollbar-viewport"), _e = ie.getBoundingClientRect(), le = ie.children, he = Math.ceil(C - p), Ee = se ? he : Ze(K, _e[v], le, !1, Math.max(0, K + u));
|
|
80
|
+
return E(Ee), Math.min(he, Ee);
|
|
81
|
+
}, [C, p]), F = A(null), Y = H((K) => {
|
|
82
|
+
F.current = t;
|
|
83
83
|
const se = K.target[B];
|
|
84
84
|
a(se, o, n), P?.(K);
|
|
85
85
|
}, [a, o, n, t]);
|
|
86
86
|
V(() => {
|
|
87
|
-
const K =
|
|
88
|
-
|
|
87
|
+
const K = F.current;
|
|
88
|
+
F.current = null, t !== K && (_.current[B] = t);
|
|
89
89
|
}, [t, B]);
|
|
90
|
-
const X = A(null),
|
|
91
|
-
X.current && (clearTimeout(X.current), X.current = null,
|
|
92
|
-
}, []), j =
|
|
93
|
-
|
|
94
|
-
const le = ie ? D(
|
|
95
|
-
le !==
|
|
96
|
-
}, se ? 0 :
|
|
97
|
-
}, [D, q,
|
|
98
|
-
V(() => () =>
|
|
99
|
-
const ne = t,
|
|
90
|
+
const X = A(null), O = A(null), N = H(() => {
|
|
91
|
+
X.current && (clearTimeout(X.current), X.current = null, O.current = null);
|
|
92
|
+
}, []), j = H((K, se, ie, _e = d) => {
|
|
93
|
+
O.current = K, X.current = setTimeout(() => {
|
|
94
|
+
const le = ie ? D(O.current || K) : q(O.current || K);
|
|
95
|
+
le !== O.current ? j(le, !1, ie, b) : N();
|
|
96
|
+
}, se ? 0 : _e);
|
|
97
|
+
}, [D, q, N]);
|
|
98
|
+
V(() => () => N(), [N]);
|
|
99
|
+
const ne = t, ye = W(() => {
|
|
100
100
|
if (!h) return null;
|
|
101
|
-
const K = { orientation: l, disabled: Math.floor(ne) <= 0 || Math.floor(C - p) === 0, onMouseUp:
|
|
102
|
-
return
|
|
103
|
-
}, [h, l, ne, m, C, p]),
|
|
101
|
+
const K = { orientation: l, disabled: Math.floor(ne) <= 0 || Math.floor(C - p) === 0, onMouseUp: N, onMouseLeave: N, onMouseDown: () => j(ne, !0, !0) };
|
|
102
|
+
return w?.(K);
|
|
103
|
+
}, [h, l, ne, m, C, p]), ve = W(() => {
|
|
104
104
|
if (!h) return null;
|
|
105
|
-
const K = { orientation: l, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp:
|
|
105
|
+
const K = { orientation: l, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp: N, onMouseLeave: N, onMouseDown: () => j(ne, !0, !1) };
|
|
106
106
|
return x?.(K);
|
|
107
107
|
}, [h, l, ne, m, C, p]);
|
|
108
|
-
return be("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className:
|
|
108
|
+
return be("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className: xe(fn, s), ...S, children: [ye, L("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: g ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: y, children: L("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: g ? "scroll" : "hidden", overflowX: g ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: Y, ref: _, children: L("div", { ref: z, style: { position: "absolute", height: g ? n - o + (k ?? 0) : 1, width: g ? 1 : n - o + (f ?? 0) }, className: "scrollbar-viewport" }) }) }), ve] });
|
|
109
109
|
}));
|
|
110
|
-
|
|
111
|
-
let
|
|
112
|
-
const
|
|
113
|
-
let e =
|
|
114
|
-
return e && (
|
|
115
|
-
},
|
|
116
|
-
let r =
|
|
110
|
+
nt.displayName = "Scrollbar";
|
|
111
|
+
let _t = Date.now, mt = 1e3, pe = {}, gn = 1;
|
|
112
|
+
const Te = (i) => {
|
|
113
|
+
let e = pe[i] !== null;
|
|
114
|
+
return e && (pe[i] = null), e;
|
|
115
|
+
}, ft = (i, e, t, n = 0, o) => {
|
|
116
|
+
let r = _t(), s = r, l = 0, a = 0, c = 0, h = gn++;
|
|
117
117
|
if (h % 20 == 0) {
|
|
118
118
|
const d = {};
|
|
119
|
-
for (let
|
|
120
|
-
|
|
119
|
+
for (let b in pe) d[b] = !0;
|
|
120
|
+
pe = d;
|
|
121
121
|
}
|
|
122
122
|
const u = function(d) {
|
|
123
|
-
let
|
|
123
|
+
let b = d !== !0, w = _t(), x = !0;
|
|
124
124
|
try {
|
|
125
125
|
x = (!e || e(h)) ?? !0;
|
|
126
126
|
} catch {
|
|
127
127
|
x = !1;
|
|
128
128
|
}
|
|
129
|
-
if (!
|
|
130
|
-
if (
|
|
131
|
-
c = Math.round((
|
|
129
|
+
if (!pe[h] || !x) return pe[h] = null, void t?.(60 - a / ((w - r) / mt), h, !1);
|
|
130
|
+
if (b) {
|
|
131
|
+
c = Math.round((w - s) / 16.666666666666668) - 1;
|
|
132
132
|
for (let _ = 0; _ < Math.min(c, 4); _++) u(!0), a++;
|
|
133
133
|
}
|
|
134
|
-
n && (l = (
|
|
134
|
+
n && (l = (w - r) / n, l > 1 && (l = 1));
|
|
135
135
|
let S = o ? o(l) : l, P = !1;
|
|
136
136
|
try {
|
|
137
|
-
P = i(S,
|
|
137
|
+
P = i(S, w, b);
|
|
138
138
|
} catch {
|
|
139
139
|
P = !1;
|
|
140
140
|
}
|
|
141
|
-
P !== !1 && l !== 1 || !
|
|
141
|
+
P !== !1 && l !== 1 || !b ? b && (s = w, requestAnimationFrame(u)) : (pe[h] = null, t?.(60 - a / ((w - r) / mt), h, l === 1 || n == null));
|
|
142
142
|
};
|
|
143
|
-
return
|
|
144
|
-
},
|
|
143
|
+
return pe[h] = !0, requestAnimationFrame(u), h;
|
|
144
|
+
}, yn = function(i) {
|
|
145
145
|
return Math.pow(i - 1, 3) + 1;
|
|
146
|
-
},
|
|
146
|
+
}, vn = function(i) {
|
|
147
147
|
return (i /= 0.5) < 1 ? 0.5 * Math.pow(i, 3) : 0.5 * (Math.pow(i - 2, 3) + 2);
|
|
148
148
|
};
|
|
149
|
-
class
|
|
149
|
+
class xn {
|
|
150
150
|
constructor(e, t) {
|
|
151
151
|
this.__isSingleTouch = !1, this.__isTracking = !1, this.__didDecelerationComplete = !1, this.__isGesturing = !1, this.__isDragging = !1, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = !1, this.__lastScale = 1, this.__enableScrollX = !0, this.__enableScrollY = !0, 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 = e, this.options = { scrollingX: !0, scrollingY: !0, animating: !0, animationDuration: 250, bouncing: !0, locking: !0, paging: !1, snapping: !1, zooming: !1, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...t };
|
|
152
152
|
}
|
|
@@ -171,7 +171,7 @@ class fn {
|
|
|
171
171
|
}
|
|
172
172
|
zoomTo(e, t = !1, n, o, r) {
|
|
173
173
|
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
174
|
-
r && (this.__zoomComplete = r), this.__isDecelerating && (
|
|
174
|
+
r && (this.__zoomComplete = r), this.__isDecelerating && (Te(this.__isDecelerating), this.__isDecelerating = 0);
|
|
175
175
|
const s = this.__zoomLevel;
|
|
176
176
|
n === void 0 && (n = this.__clientWidth / 2), o === void 0 && (o = this.__clientHeight / 2), e = Math.max(Math.min(e, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(e);
|
|
177
177
|
const l = e / s;
|
|
@@ -182,7 +182,7 @@ class fn {
|
|
|
182
182
|
this.zoomTo(this.__zoomLevel * e, t, n, o, r);
|
|
183
183
|
}
|
|
184
184
|
scrollTo(e, t, n = !1, o = 1) {
|
|
185
|
-
if (this.__isDecelerating && (
|
|
185
|
+
if (this.__isDecelerating && (Te(this.__isDecelerating), this.__isDecelerating = 0), o !== void 0 && o !== this.__zoomLevel) {
|
|
186
186
|
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
187
187
|
e *= o, t *= o, this.__computeScrollMax(o);
|
|
188
188
|
} else o = this.__zoomLevel;
|
|
@@ -200,7 +200,7 @@ class fn {
|
|
|
200
200
|
if (e.length === void 0) throw new Error("Invalid touch list: " + e);
|
|
201
201
|
if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
|
|
202
202
|
let n, o;
|
|
203
|
-
this.__interruptedAnimation = !0, this.__isDecelerating && (
|
|
203
|
+
this.__interruptedAnimation = !0, this.__isDecelerating && (Te(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = !0), this.__isAnimating && (Te(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = !0);
|
|
204
204
|
let r = e.length === 1;
|
|
205
205
|
r ? (n = e[0].pageX, o = e[0].pageY) : (n = Math.abs(e[0].pageX + e[1].pageX) / 2, o = Math.abs(e[0].pageY + e[1].pageY) / 2), this.__initialTouchLeft = n, this.__initialTouchTop = o, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n, this.__lastTouchTop = o, this.__lastTouchMove = t, this.__lastScale = 1, this.__enableScrollX = !r && this.options.scrollingX, this.__enableScrollY = !r && this.options.scrollingY, this.__isTracking = !0, this.__didDecelerationComplete = !1, this.__isDragging = !r, this.__isSingleTouch = r, this.__positions = [];
|
|
206
206
|
}
|
|
@@ -216,8 +216,8 @@ class fn {
|
|
|
216
216
|
if (n !== void 0 && this.options.zooming) {
|
|
217
217
|
let d = u;
|
|
218
218
|
if (u = u / this.__lastScale * n, u = Math.max(Math.min(u, this.options.maxZoom), this.options.minZoom), d !== u) {
|
|
219
|
-
let
|
|
220
|
-
c = (
|
|
219
|
+
let b = o - this.__clientLeft, w = r - this.__clientTop;
|
|
220
|
+
c = (b + c) * u / d - b, h = (w + h) * u / d - w, this.__computeScrollMax(u);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
if (this.__enableScrollX) {
|
|
@@ -255,16 +255,16 @@ class fn {
|
|
|
255
255
|
}
|
|
256
256
|
__publish(e, t, n, o = !1) {
|
|
257
257
|
const r = this.__isAnimating;
|
|
258
|
-
if (r && (
|
|
258
|
+
if (r && (Te(r), this.__isAnimating = 0), o && this.options.animating) {
|
|
259
259
|
this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
|
|
260
260
|
const s = this.__scrollLeft, l = this.__scrollTop, a = this.__zoomLevel, c = e - s, h = t - l, u = n - a, d = function(x, S, P) {
|
|
261
261
|
P && (this.__scrollLeft = s + c * x, this.__scrollTop = l + h * x, this.__zoomLevel = a + u * x, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
262
|
-
}.bind(this),
|
|
262
|
+
}.bind(this), b = function(x) {
|
|
263
263
|
return this.__isAnimating === x;
|
|
264
|
-
}.bind(this),
|
|
264
|
+
}.bind(this), w = function(x, S, P) {
|
|
265
265
|
S === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || P) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
266
266
|
}.bind(this);
|
|
267
|
-
this.__isAnimating =
|
|
267
|
+
this.__isAnimating = ft(d, b, w, this.options.animationDuration, r ? yn : vn);
|
|
268
268
|
} else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
269
269
|
}
|
|
270
270
|
__computeScrollMax(e = this.__zoomLevel) {
|
|
@@ -283,7 +283,7 @@ class fn {
|
|
|
283
283
|
}.bind(this), r = function(s, l, a) {
|
|
284
284
|
this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
|
|
285
285
|
}.bind(this);
|
|
286
|
-
this.__isDecelerating =
|
|
286
|
+
this.__isDecelerating = ft(t, o, r);
|
|
287
287
|
}
|
|
288
288
|
__stepThroughDeceleration(e) {
|
|
289
289
|
let t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
|
|
@@ -299,19 +299,19 @@ class fn {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
var Q = typeof window < "u" ? window : { screen: {}, navigator: {} },
|
|
302
|
+
var Q = typeof window < "u" ? window : { screen: {}, navigator: {} }, Se = (Q.matchMedia || function() {
|
|
303
303
|
return { matches: !1 };
|
|
304
|
-
}).bind(Q), Tt = !1,
|
|
304
|
+
}).bind(Q), Tt = !1, wn = { get passive() {
|
|
305
305
|
return Tt = !0;
|
|
306
|
-
} },
|
|
306
|
+
} }, gt = function() {
|
|
307
307
|
};
|
|
308
|
-
Q.addEventListener && Q.addEventListener("p",
|
|
309
|
-
var
|
|
310
|
-
const
|
|
311
|
-
function
|
|
312
|
-
return
|
|
308
|
+
Q.addEventListener && Q.addEventListener("p", gt, wn), Q.removeEventListener && Q.removeEventListener("p", gt, !1);
|
|
309
|
+
var bn = Tt, Sn = "PointerEvent" in Q, ot = "ontouchstart" in Q, Mt = ot || "TouchEvent" in Q && Se("(any-pointer: coarse)").matches, yt = (Q.navigator.maxTouchPoints || 0) > 0 || Mt, Dt = Q.navigator.userAgent || "", Ln = Se("(pointer: coarse)").matches && /iPad|Macintosh/.test(Dt) && Math.min(Q.screen.width || 0, Q.screen.height || 0) >= 768, Pt = (Se("(pointer: coarse)").matches || !Se("(pointer: fine)").matches && ot) && !/Windows.*Firefox/.test(Dt), Cn = Se("(any-pointer: fine)").matches || Se("(any-hover: hover)").matches || Ln || !ot, Ge = !yt || !Cn && Pt ? yt ? "touchOnly" : "mouseOnly" : "hybrid", En = Ge === "mouseOnly" ? "mouse" : Ge === "touchOnly" || Pt ? "touch" : "mouse";
|
|
310
|
+
const Tn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Ge, primaryInput: En, supportsPassiveEvents: bn, supportsPointerEvents: Sn, supportsTouchEvents: Mt }, Symbol.toStringTag, { value: "Module" })), Mn = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), zt = {};
|
|
311
|
+
function qe() {
|
|
312
|
+
return Tn;
|
|
313
313
|
}
|
|
314
|
-
const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i),
|
|
314
|
+
const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i), co = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: zt, boundPixel: function(i, e = !1, t = 0) {
|
|
315
315
|
return i;
|
|
316
316
|
}, createSyntheticEvent: (i) => {
|
|
317
317
|
let e = !1, t = !1;
|
|
@@ -321,10 +321,10 @@ const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.ca
|
|
|
321
321
|
t = !0, i.stopPropagation();
|
|
322
322
|
}, isPropagationStopped: () => t, persist: () => {
|
|
323
323
|
}, timeStamp: i.timeStamp, type: i.type };
|
|
324
|
-
}, detectIt:
|
|
325
|
-
function At(i, e, t =
|
|
324
|
+
}, detectIt: qe, focusableNodeNames: Mn, toPrettyKeyCode: kt }, Symbol.toStringTag, { value: "Module" })), Dn = [];
|
|
325
|
+
function At(i, e, t = Dn) {
|
|
326
326
|
const n = A(null);
|
|
327
|
-
return
|
|
327
|
+
return nn(i, () => {
|
|
328
328
|
if (!n.current) return;
|
|
329
329
|
const o = n.current, r = e?.();
|
|
330
330
|
if (!r || typeof r != "object") throw new Error("attributes must return a plain object of values");
|
|
@@ -336,63 +336,50 @@ function At(i, e, t = Cn) {
|
|
|
336
336
|
return o;
|
|
337
337
|
}, t), n;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: l =
|
|
339
|
+
const vt = (i) => L(nt, { ...i }), Pn = ({ width: i, height: e }) => L("div", { className: "corner", style: { minWidth: `${i}px`, width: `${i}px`, minHeight: `${e}px`, height: `${e}px` } }), zn = Le(Ce((i, e) => {
|
|
340
|
+
const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: l = Pn, createHorizontalScrollbar: a = vt, createVerticalScrollbar: c = vt, style: h, touchElement: u, disableTouch: d, ...b } = i, w = T(o, [o]), x = At(e, () => ({ isScrollPane: () => !0 }), []), S = A(null);
|
|
341
341
|
V(() => {
|
|
342
342
|
S.current && (S.current.__scrollTop === n?.top && S.current.__scrollLeft === n?.left || S.current.__isDecelerating || S.current?.scrollTo(n?.left, n?.top, !1));
|
|
343
343
|
}, [n?.left, n?.top, u]);
|
|
344
|
-
const P =
|
|
345
|
-
|
|
346
|
-
}, []), _ =
|
|
344
|
+
const P = H((p, C) => {
|
|
345
|
+
w?.({ left: p, top: C });
|
|
346
|
+
}, []), _ = H((p) => {
|
|
347
347
|
S.current?.doTouchStart(p.touches, p.timeStamp);
|
|
348
|
-
}, []), y =
|
|
348
|
+
}, []), y = H((p) => {
|
|
349
349
|
p.preventDefault(), S.current?.doTouchMove(p.touches, p.timeStamp);
|
|
350
|
-
}, []), f =
|
|
350
|
+
}, []), f = H((p) => {
|
|
351
351
|
S.current?.doTouchEnd(p.timeStamp);
|
|
352
|
-
}, []), k =
|
|
352
|
+
}, []), k = H(({ containerWidth: p, containerHeight: C, totalWidth: m, totalHeight: E }) => {
|
|
353
353
|
S.current.setDimensions(p, C, m, E);
|
|
354
354
|
}, []);
|
|
355
355
|
V(() => {
|
|
356
356
|
const p = u ?? x.current;
|
|
357
|
-
if (!d &&
|
|
357
|
+
if (!d && qe().supportsTouchEvents && p && n) {
|
|
358
358
|
if (!S.current) {
|
|
359
359
|
const C = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
|
|
360
|
-
S.current = new
|
|
360
|
+
S.current = new xn(P, C);
|
|
361
361
|
}
|
|
362
|
-
|
|
362
|
+
qe().supportsTouchEvents && (p.addEventListener("touchstart", _), p.addEventListener("touchend", f), p.addEventListener("touchmove", y)), k({ containerWidth: n?.width, containerHeight: n?.height, totalWidth: n?.totalWidth, totalHeight: n?.totalHeight });
|
|
363
363
|
}
|
|
364
364
|
return () => {
|
|
365
365
|
p?.removeEventListener("touchstart", _), p?.removeEventListener("touchend", f), p?.removeEventListener("touchmove", y);
|
|
366
366
|
};
|
|
367
367
|
}, [n?.width, n?.height, n?.totalWidth, n?.totalHeight, d, u]);
|
|
368
|
-
const [z, { width:
|
|
368
|
+
const [z, { width: $ }] = ge(), [I, { height: g }] = ge(), v = W(() => {
|
|
369
369
|
const p = c({ orientation: re.Vertical, offset: n?.top, viewportSize: n?.height, totalSize: n?.totalHeight, onScrollOffset: (C) => {
|
|
370
|
-
|
|
370
|
+
w?.({ top: C });
|
|
371
371
|
} });
|
|
372
372
|
return L("div", { style: { display: "flex", flex: "0" }, ref: z, children: p });
|
|
373
|
-
}, [c, n?.top, n?.height, n?.totalHeight]), B =
|
|
374
|
-
const p = a({ orientation: re.Horizontal, offset: n?.left, viewportSize: n?.width, totalSize: n?.totalWidth, onScrollOffset: (C) =>
|
|
375
|
-
return be("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${
|
|
376
|
-
}, [a, n?.left, n?.width, n?.totalWidth, s, l,
|
|
377
|
-
return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${
|
|
373
|
+
}, [c, n?.top, n?.height, n?.totalHeight]), B = W(() => {
|
|
374
|
+
const p = a({ orientation: re.Horizontal, offset: n?.left, viewportSize: n?.width, totalSize: n?.totalWidth, onScrollOffset: (C) => w?.({ left: C }) });
|
|
375
|
+
return be("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${$}px)` }, children: L("div", { ref: I, className: "sizer", children: p }) }), s ? l({ width: $, height: g }) : L(De, {})] });
|
|
376
|
+
}, [a, n?.left, n?.width, n?.totalWidth, s, l, $, g]);
|
|
377
|
+
return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${$}px` : void 0, minHeight: r ? `${g}px` : void 0, ...h }, ...b, ref: x, children: be("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [be("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: t }), s ? v : L(De, {})] }), r ? B : L(De, {})] }) });
|
|
378
378
|
}));
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
xt.add(e.onceKey);
|
|
384
|
-
}
|
|
385
|
-
let t = console.log;
|
|
386
|
-
e?.type !== vt.Warning && e?.type !== vt.Error || (t = console.warn), t(i);
|
|
387
|
-
}, showBusy: (i, e) => new Promise((t) => {
|
|
388
|
-
t(() => {
|
|
389
|
-
});
|
|
390
|
-
}), showError: (i) => {
|
|
391
|
-
console.error(i);
|
|
392
|
-
} };
|
|
393
|
-
let ke = 0;
|
|
394
|
-
function ro() {
|
|
395
|
-
const [i, e] = G(!!document.fullscreenElement), t = R(() => {
|
|
379
|
+
zn.displayName = "ScrollPane";
|
|
380
|
+
let Ae = 0;
|
|
381
|
+
function ho() {
|
|
382
|
+
const [i, e] = G(!!document.fullscreenElement), t = H(() => {
|
|
396
383
|
const n = document.fullscreenElement;
|
|
397
384
|
return n ? n.querySelector(".fullscreen-portal-root") || n : document.body;
|
|
398
385
|
}, []);
|
|
@@ -403,47 +390,47 @@ function ro() {
|
|
|
403
390
|
let r = o.querySelector(".fullscreen-portal-root");
|
|
404
391
|
r || (r = document.createElement("div"), r.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", o.appendChild(r));
|
|
405
392
|
}
|
|
406
|
-
return
|
|
407
|
-
document.removeEventListener("fullscreenchange", n),
|
|
393
|
+
return Ae++, n(), document.addEventListener("fullscreenchange", n), () => {
|
|
394
|
+
document.removeEventListener("fullscreenchange", n), Ae--, Ae <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((o) => {
|
|
408
395
|
o.parentNode && o.parentNode.removeChild(o);
|
|
409
|
-
}),
|
|
396
|
+
}), Ae = 0);
|
|
410
397
|
};
|
|
411
398
|
}, []), { getPortalContainer: t, isFullscreen: i };
|
|
412
399
|
}
|
|
413
|
-
const
|
|
414
|
-
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s =
|
|
400
|
+
const kn = 100, An = 100, Bn = 1e6, On = 100, $n = 50, Kn = Le(Ce((i, e) => {
|
|
401
|
+
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s = kn, endScrollIncrement: l = An, style: a = zt, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: d = Bn, scaleFactor: b = On, precisionFactor: w = $n, ...x } = i;
|
|
415
402
|
u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
416
|
-
const S = T(c, [c]), P = () => ({ offset: t, totalSize: d === 0 ? o : Math.min(o ?? 0, Math.max(r ?? 0, (t ?? 0) + (n ?? 0)) + (s ?? 0)) }), [_, y] = G(P), f = d !== 0 && _.totalSize > d ?
|
|
403
|
+
const S = T(c, [c]), P = () => ({ offset: t, totalSize: d === 0 ? o : Math.min(o ?? 0, Math.max(r ?? 0, (t ?? 0) + (n ?? 0)) + (s ?? 0)) }), [_, y] = G(P), f = d !== 0 && _.totalSize > d ? b : 1, k = f / w, z = Math.ceil(_.totalSize / f), $ = Math.ceil(_.offset / f), I = Math.ceil(n / f), g = H((D) => {
|
|
417
404
|
}, []), [v, B] = G(!1), p = A(null);
|
|
418
|
-
|
|
405
|
+
Ie(() => {
|
|
419
406
|
if (!v) {
|
|
420
407
|
p.current = { propTotalSize: o, propViewportSize: n, propOffset: t };
|
|
421
408
|
const D = P();
|
|
422
409
|
y(D);
|
|
423
410
|
}
|
|
424
411
|
}, [o, n, t, v, r, s, l]);
|
|
425
|
-
const C = T((D, q,
|
|
412
|
+
const C = T((D, q, F) => {
|
|
426
413
|
const Y = p.current;
|
|
427
|
-
p.current = null, Y && Y.propTotalSize === o && Y.propViewportSize === n && Y.propOffset === t || (Math.abs(D -
|
|
428
|
-
}, [h, f, k,
|
|
414
|
+
p.current = null, Y && Y.propTotalSize === o && Y.propViewportSize === n && Y.propOffset === t || (Math.abs(D - $) < k && (D = $), h?.(D * f, $, I));
|
|
415
|
+
}, [h, f, k, $, I]), m = H((D) => {
|
|
429
416
|
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), B(!1);
|
|
430
|
-
}, []), E =
|
|
417
|
+
}, []), E = H((D) => {
|
|
431
418
|
S?.(D), B(!0), document.addEventListener("mousemove", g, { passive: !0 }), document.addEventListener("mouseup", m, { passive: !0 });
|
|
432
419
|
}, [g, m]);
|
|
433
|
-
return L(
|
|
420
|
+
return L(nt, { ref: e, style: { ...a }, ...x, offset: $, totalSize: z, viewportSize: I, onMouseDown: E, onScrollOffset: C });
|
|
434
421
|
}));
|
|
435
|
-
|
|
436
|
-
const
|
|
437
|
-
function
|
|
422
|
+
Kn.displayName = "VirtualScrollbar";
|
|
423
|
+
const uo = { 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" };
|
|
424
|
+
function Ye(i, e) {
|
|
438
425
|
if (typeof i == "function") return i(e);
|
|
439
426
|
i && (i.current = e);
|
|
440
427
|
}
|
|
441
|
-
var He = parseInt(
|
|
428
|
+
var He = parseInt(on.split(".")[0], 10) >= 19 ? function(i) {
|
|
442
429
|
return (e) => {
|
|
443
430
|
const t = [];
|
|
444
431
|
for (const n of i) {
|
|
445
|
-
const o =
|
|
446
|
-
t.push(r ? o : () =>
|
|
432
|
+
const o = Ye(n, e), r = typeof o == "function";
|
|
433
|
+
t.push(r ? o : () => Ye(n, null));
|
|
447
434
|
}
|
|
448
435
|
return () => {
|
|
449
436
|
for (const n of t) n();
|
|
@@ -451,11 +438,11 @@ var He = parseInt(nn.split(".")[0], 10) >= 19 ? function(i) {
|
|
|
451
438
|
};
|
|
452
439
|
} : function(i) {
|
|
453
440
|
return (e) => {
|
|
454
|
-
for (const t of i)
|
|
441
|
+
for (const t of i) Ye(t, e);
|
|
455
442
|
};
|
|
456
443
|
};
|
|
457
|
-
const
|
|
458
|
-
const { refFocusStart: t, ...n } = i, o = A(null), r =
|
|
444
|
+
const po = Le(Ce((i, e) => {
|
|
445
|
+
const { refFocusStart: t, ...n } = i, o = A(null), r = H(() => {
|
|
459
446
|
if (t) return void t?.current?.focus();
|
|
460
447
|
const s = o.current.parentElement.children;
|
|
461
448
|
let l = [];
|
|
@@ -470,13 +457,13 @@ const lo = Se(Le((i, e) => {
|
|
|
470
457
|
}), l[0].child.focus());
|
|
471
458
|
}, [t]);
|
|
472
459
|
return L("div", { tabIndex: 0, ref: He([o, e]), onFocus: r, ...n });
|
|
473
|
-
})),
|
|
474
|
-
const { className: t, style: n, children: o, radius: r = 4, strokeWidth: s = 1, strokeColor: l = "grey", ...a } = i, [c, { width: h, height: u }] =
|
|
460
|
+
})), _o = Le(Ce((i, e) => {
|
|
461
|
+
const { className: t, style: n, children: o, radius: r = 4, strokeWidth: s = 1, strokeColor: l = "grey", ...a } = i, [c, { width: h, height: u }] = ge(), d = A(null), b = (P, _ = 0) => {
|
|
475
462
|
const y = P / 2, f = u - y + _;
|
|
476
|
-
return (function(k, z,
|
|
463
|
+
return (function(k, z, $ = !1) {
|
|
477
464
|
if (z === 0) return k;
|
|
478
|
-
function
|
|
479
|
-
let q = E.x - m.x,
|
|
465
|
+
function I(m, E, D) {
|
|
466
|
+
let q = E.x - m.x, F = E.y - m.y, Y = Math.sqrt(q * q + F * F);
|
|
480
467
|
return g(m, E, Math.min(1, D / Y));
|
|
481
468
|
}
|
|
482
469
|
function g(m, E, D) {
|
|
@@ -498,13 +485,13 @@ const lo = Se(Le((i, e) => {
|
|
|
498
485
|
let m = B(p[0]), E = null;
|
|
499
486
|
p[p.length - 1][0] === "Z" && p[0].length > 2 && (E = ["L", m.x, m.y], p[p.length - 1] = E), C.push(p[0]);
|
|
500
487
|
for (let D = 1; D < p.length; D++) {
|
|
501
|
-
let q = C[C.length - 1],
|
|
502
|
-
if (Y && q && q.length > 2 &&
|
|
503
|
-
let X,
|
|
504
|
-
|
|
505
|
-
let
|
|
488
|
+
let q = C[C.length - 1], F = p[D], Y = F === E ? p[1] : p[D + 1];
|
|
489
|
+
if (Y && q && q.length > 2 && F[0] === "L" && Y.length > 2 && Y[0] === "L") {
|
|
490
|
+
let X, O, N = B(q), j = B(F), ne = B(Y);
|
|
491
|
+
$ ? (X = g(j, q.origPoint || N, z), O = g(j, Y.origPoint || ne, z)) : (X = I(j, N, z), O = I(j, ne, z)), v(F, X), F.origPoint = j, C.push(F);
|
|
492
|
+
let ye = g(X, j, 0.5), ve = g(j, O, 0.5), K = ["C", ye.x, ye.y, ve.x, ve.y, O.x, O.y];
|
|
506
493
|
K.origPoint = j, C.push(K);
|
|
507
|
-
} else C.push(
|
|
494
|
+
} else C.push(F);
|
|
508
495
|
}
|
|
509
496
|
if (E) {
|
|
510
497
|
let D = B(C[C.length - 1]);
|
|
@@ -515,61 +502,103 @@ const lo = Se(Le((i, e) => {
|
|
|
515
502
|
return m + E.join(" ") + " ";
|
|
516
503
|
}, "");
|
|
517
504
|
})(`${`M 0 ${y} L ${r - 0.5} ${y} L ${r - 0.5} ${f} L ${2 * r} ${f}`} ${`L ${h - 2 * r} ${f}`} ${`M ${h - 2 * r} ${f} L ${h - r} ${f} L ${h - r} ${y} L ${h} ${y}`}`, r);
|
|
518
|
-
},
|
|
505
|
+
}, w = W(() => b(s), [h, u, r, s]), x = W(() => {
|
|
519
506
|
if (r === 0) return;
|
|
520
507
|
const P = r / 2;
|
|
521
|
-
return
|
|
522
|
-
}, [
|
|
523
|
-
return be("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...a, ref: He([d, c, e]), children: [
|
|
524
|
-
})),
|
|
525
|
-
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a =
|
|
526
|
-
return L("div", { style: { ...t, position: "relative" }, ...c, children: L("div", { className:
|
|
527
|
-
},
|
|
508
|
+
return b(r) + `L ${h} 0 L 0 0 L 0 ${P}`;
|
|
509
|
+
}, [w, r, s]), S = W(() => ({ style: { clipPath: `path('${x}')` } }), [x]);
|
|
510
|
+
return be("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...a, ref: He([d, c, e]), children: [ce.isValidElement(o) ? ce.cloneElement(o, S) : L(De, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: h, height: u, viewBox: `0 0 ${h} ${u}`, children: L("path", { d: w, stroke: l, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s }) })] });
|
|
511
|
+
})), Rn = {}, Hn = (i) => {
|
|
512
|
+
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a = Rn, ...c } = i, h = n === "row", { style: u, className: d, ...b } = a;
|
|
513
|
+
return L("div", { style: { ...t, position: "relative" }, ...c, children: L("div", { className: xe("hit-box", d), style: { left: (h ? -o : 0) + "px", width: `calc(100% + ${h ? o + r : 0}px)`, top: (h ? 0 : -o) + "px", height: `calc(100% + ${h ? 0 : o + r}px)`, position: "absolute", ...u }, onPointerDown: s ? void 0 : e, ...b }) }, l);
|
|
514
|
+
}, Be = {}, me = (i, e, t = !0) => i === null ? null : i.pixels !== null ? t ? i.pixels : e - i.pixels : (t ? i.percent : 100 - i.percent) / 100 * e, Oe = (i, e = !0) => i?.percent ? `${e ? i.percent : 100 - i.percent}%` : i?.pixels ? `${i.pixels}px` : void 0, de = (i, e) => {
|
|
528
515
|
if (i == null) return null;
|
|
529
516
|
const t = { percent: null, pixels: null };
|
|
530
517
|
let n = e;
|
|
531
518
|
return typeof i == "string" && ((i = i.trim().toLowerCase()).endsWith("px") ? (i = i.substring(0, i.length - 2), n = !1) : i.endsWith("%") && (i = i.substring(0, i.length - 1), n = !0), i = parseFloat(i)), n ? t.percent = i : t.pixels = i, Object.freeze(t);
|
|
532
|
-
},
|
|
533
|
-
const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position: s, onPositionChange: l, minBefore: a, maxBefore: c, minAfter: h, maxAfter: u, children: d, className:
|
|
519
|
+
}, mo = Le(Ce((i, e) => {
|
|
520
|
+
const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position: s, onPositionChange: l, minBefore: a, maxBefore: c, minAfter: h, maxAfter: u, children: d, className: b, style: w, disabled: x = !1, onDragStart: S, onDragResize: P, onDragFinish: _, resizerProps: y = Be, paneProps: f = Be, paneBeforeProps: k = Be, paneAfterProps: z = Be, createResizer: $ = Hn } = i;
|
|
534
521
|
if (d) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
535
|
-
const
|
|
522
|
+
const I = W(() => ce.isValidElement(n) && ce.isValidElement(t), [n, t]), g = W(() => {
|
|
536
523
|
let M = null;
|
|
537
524
|
r && (r === "before" ? M = 0 : r === "after" && (M = 1));
|
|
538
|
-
const
|
|
539
|
-
return { fixedPaneOffset: M, isPercent:
|
|
540
|
-
}, [a, c, h, u]), v = T(l, [l]), [B, p] = G(() =>
|
|
525
|
+
const R = M === null;
|
|
526
|
+
return { fixedPaneOffset: M, isPercent: R, minBefore: de(a, R), maxBefore: de(c, R), minAfter: de(h, R), maxAfter: de(u, R) };
|
|
527
|
+
}, [a, c, h, u]), v = T(l, [l]), [B, p] = G(() => de(s, r === null));
|
|
541
528
|
V(() => {
|
|
542
|
-
p(
|
|
529
|
+
p(de(s, r === null));
|
|
543
530
|
}, [s, r]);
|
|
544
|
-
const [C, { width: m, height: E }] =
|
|
531
|
+
const [C, { width: m, height: E }] = ge(), [D, { width: q, height: F }] = ge(), Y = o === "row" ? q : F, X = o === "row" ? m : E, O = W(() => ((M, R, J, U) => {
|
|
545
532
|
const ae = [null, null], oe = [null, null];
|
|
546
|
-
if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }),
|
|
547
|
-
let
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
return oe[0] =
|
|
551
|
-
})(B, X, Y, g), [g, B, X, Y, o]), [
|
|
552
|
-
const
|
|
553
|
-
p(
|
|
554
|
-
}, [r]),
|
|
555
|
-
if (x || !
|
|
556
|
-
const
|
|
533
|
+
if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), R === 0) return M?.pixels != null ? U.fixedPaneOffset !== 1 ? (ae[0] = M?.pixels, oe[1] = 100) : (ae[1] = M?.pixels - J, oe[0] = 100) : M?.percent != null && (U.fixedPaneOffset !== 1 ? (oe[0] = M?.percent, oe[1] = 100 - M?.percent) : (oe[1] = M?.percent, oe[0] = 100 - M?.percent)), { percents: oe, pixels: ae, minBefore: Oe(U.minBefore, !0), maxBefore: Oe(U.maxBefore, !0), minAfter: Oe(U.minAfter), maxAfter: Oe(U.maxAfter) };
|
|
534
|
+
let ue = me(M, R, U.fixedPaneOffset !== 1), ee = R - J, ht = me(U.minBefore, ee, !0) ?? 0, en = me(U.maxBefore, ee, !0) ?? ee, ke = 0, Ne = 0, ut = 0, dt = ee;
|
|
535
|
+
ke = (me(U.maxAfter, R, !1) ?? J) - J, Ne = me(U.minAfter, R, !1) ?? R, ut = Math.max(ht, ke), dt = Math.min(en, Ne), ue = Math.max(ut, Math.min(ue, dt)), Ne = Math.min(ee - ue, me(U.maxAfter, ee - ue, !0) ?? ee), ke = Math.min(ee - ue, me(U.minAfter, ee - ue, !0) ?? ee), ae[0] = ue, ae[1] = ee - ae[0];
|
|
536
|
+
const tn = Math.max(0, Math.min(100, ue / ee * 100));
|
|
537
|
+
return oe[0] = tn, oe[1] = 100 - oe[0], { percents: oe, pixels: ae, minBefore: `${ht}px`, minAfter: `${ke}px`, maxBefore: `${ae[0]}px`, maxAfter: `${ae[1]}px` };
|
|
538
|
+
})(B, X, Y, g), [g, B, X, Y, o]), [N, j] = G(!1), ne = T(S, [S]), ye = T(P, [P]), ve = T(_, [_]), K = A(null), se = A(null), ie = A(null), { style: _e, className: le, ...he } = f, Ee = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ..._e }, { className: Vt, style: It, ...Nt } = k, { className: Wt, style: Ft, ...Yt } = z, Xt = { flex: "1 1 100%", width: "100%", ...w, flexDirection: o, display: "flex" }, { className: it, style: rt, onPointerDown: st, ...lt } = y, jt = T((M) => {
|
|
539
|
+
const R = de(M, r === null);
|
|
540
|
+
p(R);
|
|
541
|
+
}, [r]), Pe = T((M) => {
|
|
542
|
+
if (x || !N) return;
|
|
543
|
+
const R = ct.current?.getBoundingClientRect();
|
|
557
544
|
let J = 0;
|
|
558
|
-
J = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) -
|
|
559
|
-
}, [g, o, x,
|
|
560
|
-
if (document.removeEventListener("pointermove",
|
|
561
|
-
if (
|
|
562
|
-
const
|
|
563
|
-
|
|
545
|
+
J = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - R.x : (M.clientY ?? M.touches?.[0]?.clientY) - R.y, J = Math.max(0, Math.min(X, J)), g.fixedPaneOffset === 1 && (J = X - J), s && B.pixels === J || p({ pixels: J, percent: null }), ye?.(J), M.stopPropagation(), M.preventDefault();
|
|
546
|
+
}, [g, o, x, N, B, X]), at = T((M) => {
|
|
547
|
+
if (document.removeEventListener("pointermove", Pe), document.removeEventListener("touchmove", Pe), document.removeEventListener("pointerup", at), !!N && (j(!1), !!B)) {
|
|
548
|
+
if (ve(B.pixels), !de(s, r === null) || B.pixels !== s) {
|
|
549
|
+
const R = { ...B };
|
|
550
|
+
R.percent === null && (R.percent = R.pixels / X * 100), v(R);
|
|
564
551
|
}
|
|
565
552
|
M.stopPropagation(), M.preventDefault();
|
|
566
553
|
}
|
|
567
|
-
}, [B,
|
|
568
|
-
|
|
569
|
-
}, [
|
|
570
|
-
return be("div", { ref: He([C,
|
|
571
|
-
}));
|
|
572
|
-
|
|
554
|
+
}, [B, N, s, r, X]), Ut = T((M) => {
|
|
555
|
+
st?.(M), M.defaultPrevented || x || N || (j(!0), ne(), document.addEventListener("pointermove", Pe, { passive: !1 }), document.addEventListener("touchmove", Pe, { passive: !1 }), document.addEventListener("pointerup", at, { passive: !1 }));
|
|
556
|
+
}, [st]), ct = At(e, () => ({ setPosition: jt, isSplitPane: () => !0 }), []), Zt = W(() => I ? $?.({ key: "resizer", ref: He([D, se]), className: xe("resizer", it), onPointerDownCapture: Ut, style: { cursor: x ? void 0 : o === "row" ? "ew-resize" : "ns-resize", minWidth: o === "row" ? "2px" : void 0, minHeight: o !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...rt }, splitDirection: o, disabled: x, ...lt }) : null, [I, it, lt, o, rt, x]), ze = o === "row" ? "Width" : "Height", Gt = { ...Ee, ...It, flex: g.fixedPaneOffset === 0 && O?.pixels[0] !== null ? `0 0 ${Math.round(O?.pixels[0])}px` : `1 1 ${Math.round(O?.percents[0] ?? 100)}%`, [`min${ze}`]: O?.minBefore, [`max${ze}`]: n ? O?.maxBefore : "100%" }, qt = { ...Ee, ...Ft, flex: g.fixedPaneOffset === 1 && O?.pixels[1] !== null ? `0 0 ${Math.round(O?.pixels[1])}px` : `1 1 ${Math.round(O?.percents[1] ?? 100)}%`, [`min${ze}`]: O?.minAfter, [`max${ze}`]: t ? O?.maxAfter : "100%" }, Jt = W(() => t ? L("div", { ref: K, className: xe("before", le, Vt), style: Gt, ...he, ...Nt, children: t }, "before") : null, [t, f, k, g, O]), Qt = W(() => n ? L("div", { ref: ie, className: xe("after", le, Wt), style: qt, ...he, ...Yt, children: n }, "after") : null, [n, f, z, g, O]);
|
|
557
|
+
return be("div", { ref: He([C, ct]), className: xe("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: N }, b), style: Xt, children: [Jt, Zt, Qt] });
|
|
558
|
+
})), xt = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
|
|
559
|
+
class Vn extends cn {
|
|
560
|
+
setDelegate(e) {
|
|
561
|
+
super.setDelegate(e);
|
|
562
|
+
}
|
|
563
|
+
getDelegate() {
|
|
564
|
+
return this._delegate;
|
|
565
|
+
}
|
|
566
|
+
showMessage(e, t) {
|
|
567
|
+
const n = this.getDelegate();
|
|
568
|
+
if (n?.showMessage) return n.showMessage(e, t);
|
|
569
|
+
t?.type !== xt.Warning ? t?.type !== xt.Error ? fe.log(e) : fe.error(e) : fe.warn(e);
|
|
570
|
+
}
|
|
571
|
+
showBusy(e, t) {
|
|
572
|
+
const n = this.getDelegate();
|
|
573
|
+
return n?.showBusy ? n.showBusy(e, t) : new Promise((o) => {
|
|
574
|
+
o(() => {
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
showWindow(e, t, n) {
|
|
579
|
+
const o = this.getDelegate();
|
|
580
|
+
if (o?.showWindow) return o.showWindow(e, t, n);
|
|
581
|
+
}
|
|
582
|
+
showError(e) {
|
|
583
|
+
const t = this.getDelegate();
|
|
584
|
+
t?.showError ? t.showError(e) : fe.error(e);
|
|
585
|
+
}
|
|
586
|
+
showOptions(e) {
|
|
587
|
+
const t = this.getDelegate();
|
|
588
|
+
return t?.showOptions ? t.showOptions(e) : Promise.resolve("");
|
|
589
|
+
}
|
|
590
|
+
showInputOptions(e) {
|
|
591
|
+
const t = this.getDelegate();
|
|
592
|
+
return t?.showInputOptions ? t.showInputOptions(e) : Promise.resolve({ input: "", option: "" });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
const Bt = rn(new Vn()), fo = ({ children: i, notifier: e }) => (ce.useEffect(() => {
|
|
596
|
+
const t = fe.getDelegate();
|
|
597
|
+
return fe.setDelegate(e), () => {
|
|
598
|
+
fe.setDelegate(t);
|
|
599
|
+
};
|
|
600
|
+
}, [e]), ce.createElement(Bt.Provider, { value: e }, i)), Ot = () => sn(Bt);
|
|
601
|
+
function go(i) {
|
|
573
602
|
const [e, t] = G(typeof window < "u" ? window.devicePixelRatio : 1), n = A(null);
|
|
574
603
|
return V(() => {
|
|
575
604
|
if (!(typeof window < "u" && "matchMedia" in window)) return;
|
|
@@ -582,12 +611,12 @@ function ho(i) {
|
|
|
582
611
|
};
|
|
583
612
|
}, [i]), e;
|
|
584
613
|
}
|
|
585
|
-
function
|
|
614
|
+
function yo(i) {
|
|
586
615
|
if (typeof window > "u") return 1;
|
|
587
616
|
const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e;
|
|
588
617
|
return Math.min(Math.max(1, n ? Math.floor(o) : o), t);
|
|
589
618
|
}
|
|
590
|
-
function
|
|
619
|
+
function vo(i, e, t) {
|
|
591
620
|
const n = T(e, [e]);
|
|
592
621
|
V(() => {
|
|
593
622
|
const o = (r) => {
|
|
@@ -598,108 +627,108 @@ function po(i, e, t) {
|
|
|
598
627
|
};
|
|
599
628
|
}, [i]);
|
|
600
629
|
}
|
|
601
|
-
function
|
|
630
|
+
function In(i) {
|
|
602
631
|
if (!i) throw new Error("must have a PointerHandlerOptions");
|
|
603
|
-
const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i, s = T(e, [e]), l = T(t, [t]), a = T(n, [n]), c = A(!1), h = i?.timerInitial ?? 230, u = i?.timerContinuous ?? h / 2, d = A(null),
|
|
632
|
+
const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i, s = T(e, [e]), l = T(t, [t]), a = T(n, [n]), c = A(!1), h = i?.timerInitial ?? 230, u = i?.timerContinuous ?? h / 2, d = A(null), b = A(null), w = A(null), x = A(null), S = H(() => {
|
|
604
633
|
x.current && (clearTimeout(x.current), x.current = null);
|
|
605
|
-
}, []), P =
|
|
634
|
+
}, []), P = H((v) => {
|
|
606
635
|
x.current = setTimeout(() => {
|
|
607
636
|
window.requestAnimationFrame(() => {
|
|
608
|
-
c.current !== !1 && a?.(
|
|
637
|
+
c.current !== !1 && a?.(b.current, w.current, d.current);
|
|
609
638
|
}), P(u);
|
|
610
639
|
}, v ?? h);
|
|
611
640
|
}, []);
|
|
612
641
|
V(() => () => S(), []);
|
|
613
|
-
const _ = o ? "pointer" : "mouse", y =
|
|
642
|
+
const _ = o ? "pointer" : "mouse", y = H((v) => {
|
|
614
643
|
v.stopPropagation(), v.stopImmediatePropagation(), v.preventDefault();
|
|
615
644
|
}, []), f = T((v) => {
|
|
616
|
-
document.removeEventListener(`${_}move`,
|
|
617
|
-
c.current !== !1 && (c.current = !1, l?.(v,
|
|
645
|
+
document.removeEventListener(`${_}move`, $), document.removeEventListener(`${_}up`, f), document.removeEventListener("keydown", I), document.removeEventListener("keyup", g), document.removeEventListener("touchstart", y, { capture: !0 }), document.removeEventListener("touchmove", y, { capture: !0 }), window.removeEventListener("blur", k), S(), window.requestAnimationFrame(() => {
|
|
646
|
+
c.current !== !1 && (c.current = !1, l?.(v, w.current, d.current), w.current = null);
|
|
618
647
|
});
|
|
619
|
-
}, []), k =
|
|
620
|
-
c.current !== !1 && (c.current = !1, f(
|
|
648
|
+
}, []), k = H(() => {
|
|
649
|
+
c.current !== !1 && (c.current = !1, f(b.current));
|
|
621
650
|
}, []), z = T(() => {
|
|
622
651
|
S(), P(u), window.requestAnimationFrame(() => {
|
|
623
|
-
c.current !== !1 && a?.(
|
|
652
|
+
c.current !== !1 && a?.(b.current, w.current, d.current);
|
|
624
653
|
});
|
|
625
|
-
}, [u]),
|
|
626
|
-
|
|
627
|
-
}, []),
|
|
628
|
-
|
|
654
|
+
}, [u]), $ = T((v) => {
|
|
655
|
+
b.current = v, z();
|
|
656
|
+
}, []), I = T((v) => {
|
|
657
|
+
w.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z();
|
|
629
658
|
}, []), g = T((v) => {
|
|
630
|
-
|
|
659
|
+
w.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z();
|
|
631
660
|
}, [u]);
|
|
632
661
|
return T((v) => {
|
|
633
|
-
v.isDefaultPrevented() || (
|
|
662
|
+
v.isDefaultPrevented() || (w.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, s(v, w.current) !== !1 && (d.current = v, b.current = v.nativeEvent, document.addEventListener(`${_}up`, f, { passive: !1 }), document.addEventListener(`${_}move`, $, { passive: !1 }), document.addEventListener("keydown", I, { passive: !1 }), document.addEventListener("keyup", g, { passive: !1 }), window.addEventListener("blur", k, { passive: !0 }), o && r && (document.addEventListener("touchstart", y, { passive: !1, capture: !0 }), document.addEventListener("touchmove", y, { passive: !1, capture: !0 })), c.current = !0, P(h)));
|
|
634
663
|
}, [h, o]);
|
|
635
664
|
}
|
|
636
|
-
function
|
|
637
|
-
return
|
|
665
|
+
function xo(i, e) {
|
|
666
|
+
return In({ onPointerDown: i, onPointerMoveOrWait: (t, n, o) => {
|
|
638
667
|
i?.(o);
|
|
639
668
|
}, ...e });
|
|
640
669
|
}
|
|
641
|
-
const
|
|
670
|
+
const Nn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
642
671
|
const n = A(i);
|
|
643
672
|
if (typeof e != "function") throw new Error("function expected as hook body parameter. got " + typeof e);
|
|
644
673
|
const o = e();
|
|
645
|
-
return
|
|
674
|
+
return Ie(() => {
|
|
646
675
|
n.current !== o && (n.current = o, t(o));
|
|
647
676
|
}, [t, o]), null;
|
|
648
|
-
},
|
|
677
|
+
}, Je = (i) => {
|
|
649
678
|
console && console.warn && console.warn(i);
|
|
650
|
-
},
|
|
651
|
-
let
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
},
|
|
679
|
+
}, Xe = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
680
|
+
let Wn = 1, Qe = !1, $t = !1;
|
|
681
|
+
const Ke = [], we = [], Ve = () => {
|
|
682
|
+
we.forEach((i) => i());
|
|
683
|
+
}, Fn = ({ automaticContainerInternalUseOnly: i }) => {
|
|
655
684
|
const [e, t] = G([]), n = A([]);
|
|
656
|
-
return n.current = e, i ||
|
|
685
|
+
return n.current = e, i || Qe !== !1 || ($t = !0), V(() => {
|
|
657
686
|
let o = !0;
|
|
658
687
|
function r() {
|
|
659
|
-
if (o) return
|
|
688
|
+
if (o) return we[0] !== r ? (i || Qe !== !0 || Je("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void t((s) => [])) : void t([...Ke]);
|
|
660
689
|
}
|
|
661
|
-
return
|
|
662
|
-
o = !1, n.current?.length > 0 &&
|
|
690
|
+
return we.push(r), Ve(), () => {
|
|
691
|
+
o = !1, n.current?.length > 0 && Je("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), we.splice(we.indexOf(r), 1), Ve();
|
|
663
692
|
};
|
|
664
|
-
}, [i]), L(
|
|
665
|
-
},
|
|
666
|
-
const e =
|
|
667
|
-
return
|
|
668
|
-
if (
|
|
669
|
-
const n =
|
|
670
|
-
|
|
671
|
-
} else
|
|
672
|
-
})(
|
|
673
|
-
|
|
693
|
+
}, [i]), L(De, { children: e.map(({ hook: o, key: r }) => ln(Nn, { ...o, key: r })) });
|
|
694
|
+
}, Yn = (i) => {
|
|
695
|
+
const e = Wn++;
|
|
696
|
+
return Ke.push({ hook: i, key: e }), we.length === 0 && $t === !1 && (Qe = !0, ((t) => {
|
|
697
|
+
if (Xe.document && Xe.document.createElement) {
|
|
698
|
+
const n = Xe.document.createElement("div");
|
|
699
|
+
hn(n).render(L(t, { automaticContainerInternalUseOnly: !0 }));
|
|
700
|
+
} else Je("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
|
|
701
|
+
})(Fn)), Ve(), () => {
|
|
702
|
+
Ke.splice(Ke.findIndex((t) => t.key === e), 1), Ve();
|
|
674
703
|
};
|
|
675
704
|
};
|
|
676
|
-
let
|
|
677
|
-
|
|
705
|
+
let et = null;
|
|
706
|
+
et || (et = (i, e, t = {}) => {
|
|
678
707
|
let n, o, r = !1, s = !1, l = [], { unmountIfNoConsumers: a = !1 } = t;
|
|
679
708
|
const c = (u) => {
|
|
680
|
-
o = u,
|
|
709
|
+
o = u, un(() => l.forEach((d) => d(u)));
|
|
681
710
|
}, h = () => (s || (o = typeof i == "function" ? i() : i, s = !0), o);
|
|
682
711
|
return () => {
|
|
683
712
|
const [u, d] = G(h);
|
|
684
|
-
return V(() => (r || (r = !0, n =
|
|
713
|
+
return V(() => (r || (r = !0, n = Yn({ initValue: i, useHookBody: e, applyStateChange: c })), l.push(d), o !== u && d(o), () => {
|
|
685
714
|
l.splice(l.indexOf(d), 1), l.length === 0 && a && (n(), r = !1);
|
|
686
715
|
}), []), u;
|
|
687
716
|
};
|
|
688
717
|
});
|
|
689
|
-
const
|
|
690
|
-
let
|
|
718
|
+
const Kt = et;
|
|
719
|
+
let Rt = () => {
|
|
691
720
|
console.warn("You must call useEditMode before setting its state.");
|
|
692
721
|
};
|
|
693
|
-
const
|
|
722
|
+
const Xn = Kt(null, () => {
|
|
694
723
|
const [i, e] = G(null);
|
|
695
|
-
return
|
|
696
|
-
}),
|
|
697
|
-
const i =
|
|
698
|
-
return
|
|
699
|
-
|
|
724
|
+
return Rt = e, i;
|
|
725
|
+
}), wo = () => {
|
|
726
|
+
const i = Xn();
|
|
727
|
+
return W(() => ({ setMode: (e) => {
|
|
728
|
+
Rt((t) => (typeof e == "function" && (e = e(t)), e?.onModeChange?.(e ?? null), e));
|
|
700
729
|
}, getMode: () => i }), [i]);
|
|
701
730
|
};
|
|
702
|
-
class
|
|
731
|
+
class tt {
|
|
703
732
|
constructor(e, t, n, o) {
|
|
704
733
|
this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = e, this._target = t, this._applyProps(n || {}), this._callback = o, o === void 0 && (this._callback = () => {
|
|
705
734
|
console.log(`implement: ${this.label()} : ${this.description()}`);
|
|
@@ -810,7 +839,7 @@ class et {
|
|
|
810
839
|
}), t;
|
|
811
840
|
}
|
|
812
841
|
}
|
|
813
|
-
class
|
|
842
|
+
class je extends tt {
|
|
814
843
|
}
|
|
815
844
|
class Ht {
|
|
816
845
|
constructor(e, t) {
|
|
@@ -869,9 +898,9 @@ class Ht {
|
|
|
869
898
|
s.set(a, u);
|
|
870
899
|
const d = a.shortcut();
|
|
871
900
|
if (!d) continue;
|
|
872
|
-
const
|
|
873
|
-
for (let
|
|
874
|
-
const x =
|
|
901
|
+
const b = Array.isArray(d) ? d : [d];
|
|
902
|
+
for (let w = 0; w < b.length; w++) {
|
|
903
|
+
const x = Me(b[w]), S = o.get(x);
|
|
875
904
|
S && !t && t === void 0 && console.warn(`Shortcut already registered: ${x}, ${c}, ${S}.`), o.set(x, c);
|
|
876
905
|
}
|
|
877
906
|
}
|
|
@@ -906,10 +935,10 @@ class Ht {
|
|
|
906
935
|
findCommandByEvent(e) {
|
|
907
936
|
const t = [];
|
|
908
937
|
e.altKey && t.push(Z.Alt), e.shiftKey && t.push(Z.Shift), e.ctrlKey && t.push(Z.Ctrl), e.metaKey && t.push(Z.Meta);
|
|
909
|
-
let n =
|
|
938
|
+
let n = Me({ key: e.code, modifiers: t });
|
|
910
939
|
const o = this._commandsByShortcut;
|
|
911
940
|
let r = o.get(n);
|
|
912
|
-
r || (n =
|
|
941
|
+
r || (n = Me({ key: e.key, modifiers: t }), r = o.get(n)), !r && e.code.startsWith("Digit") && (n = Me({ key: e.code.substring(5, e.code.length), modifiers: t }), r = this._commandsByShortcut.get(n)), !r && e.code.startsWith("Key") && (r = Me({ key: e.code.substring(3, e.code.length), modifiers: t }), r = o.get(n));
|
|
913
942
|
let s = null;
|
|
914
943
|
return r && (s = this._commandsByKey.get(r), s && s.disabled() && (s = null), !s || s.target() && s.target().contains(e.target) || (s = null)), s || (this._parent?.findCommandByEvent(e) ?? null);
|
|
915
944
|
}
|
|
@@ -966,16 +995,16 @@ class Ht {
|
|
|
966
995
|
}), e;
|
|
967
996
|
}
|
|
968
997
|
}
|
|
969
|
-
const
|
|
998
|
+
const jn = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "Cmd" : "Ctrl", Un = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "⌘" : "^", Me = (i, e = !1) => {
|
|
970
999
|
const t = {};
|
|
971
1000
|
for (let o = 0; i.modifiers && o < i.modifiers.length; o++) t[i.modifiers[o]] = !0;
|
|
972
1001
|
let n = "";
|
|
973
|
-
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ?
|
|
1002
|
+
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ? Un : jn)), t?.[Z.Alt] && (n += e ? "⌥" : "Alt"), t?.[Z.Shift] && (n += (n.length > 0 ? "+" : "") + (e ? "⇧" : "Shift")), n += (n.length > 0 ? "+" : "") + kt(i.key), n;
|
|
974
1003
|
};
|
|
975
|
-
function
|
|
1004
|
+
function bo(i, e = null) {
|
|
976
1005
|
const t = A(e);
|
|
977
1006
|
t.current = e;
|
|
978
|
-
const [n, o] =
|
|
1007
|
+
const [n, o] = an((s) => s + 1, 0), r = W(() => Array.isArray(i) ? i : [i], [i]);
|
|
979
1008
|
return V(() => {
|
|
980
1009
|
if (!r || r.length === 0) return;
|
|
981
1010
|
const s = (c, h) => {
|
|
@@ -1004,7 +1033,7 @@ const $e = (i, e) => {
|
|
|
1004
1033
|
}
|
|
1005
1034
|
return t;
|
|
1006
1035
|
};
|
|
1007
|
-
function
|
|
1036
|
+
function So(i, e = null, t = null, n) {
|
|
1008
1037
|
const o = A(t);
|
|
1009
1038
|
o.current = t, e && !Array.isArray(e) && (e = [e]);
|
|
1010
1039
|
const [r, s] = G($e(i, e)), l = n ? [...n, i] : [i];
|
|
@@ -1014,7 +1043,7 @@ function go(i, e = null, t = null, n) {
|
|
|
1014
1043
|
s(d), o.current?.onChange?.(this);
|
|
1015
1044
|
} };
|
|
1016
1045
|
let c;
|
|
1017
|
-
e && e.length > 0 && (c = { keys: e }, a.onCommandChange = (d,
|
|
1046
|
+
e && e.length > 0 && (c = { keys: e }, a.onCommandChange = (d, b) => {
|
|
1018
1047
|
o.current?.onChange?.(i), s($e(i, e));
|
|
1019
1048
|
});
|
|
1020
1049
|
const h = i?.addListener(a, c), u = $e(i, e);
|
|
@@ -1023,19 +1052,19 @@ function go(i, e = null, t = null, n) {
|
|
|
1023
1052
|
};
|
|
1024
1053
|
}, l), r;
|
|
1025
1054
|
}
|
|
1026
|
-
const
|
|
1055
|
+
const Lo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Zn = Kt({ setClipboard: (i) => {
|
|
1027
1056
|
throw new Error("This is only available via the useClipboard.");
|
|
1028
|
-
}, getClipboard: () =>
|
|
1029
|
-
const [i, e] = G(
|
|
1057
|
+
}, getClipboard: () => Re.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1058
|
+
const [i, e] = G(Re.Global);
|
|
1030
1059
|
return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy: A(null), refNativeLastKey: A(null) };
|
|
1031
|
-
}),
|
|
1032
|
-
const { source: e, target: t, onPaste: n, onClipboardUpdate: o,
|
|
1033
|
-
|
|
1060
|
+
}), Co = (i) => {
|
|
1061
|
+
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, commands: r } = i, s = Ot(), l = T(o, [o]), a = T(n, [n]), { getClipboard: c, refNativeCopy: h } = Zn(), u = c();
|
|
1062
|
+
W(() => {
|
|
1034
1063
|
const _ = e?.element, y = t?.element ?? e?.element;
|
|
1035
|
-
if (!
|
|
1036
|
-
const f = [new
|
|
1037
|
-
|
|
1038
|
-
}, [
|
|
1064
|
+
if (!r) return;
|
|
1065
|
+
const f = [new je("cut", _, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [Z.Ctrl] } }), new je("copy", _, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [Z.Ctrl] } }), new je("paste", y, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [Z.Ctrl] }, { key: "F8", modifiers: [Z.Ctrl] }] })];
|
|
1066
|
+
r?.addCommands(f, !0);
|
|
1067
|
+
}, [r]);
|
|
1039
1068
|
const d = T(async (_) => {
|
|
1040
1069
|
if (!e?.element) return;
|
|
1041
1070
|
let y = null;
|
|
@@ -1044,82 +1073,82 @@ const yo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Wn = Ot({ setClipboard:
|
|
|
1044
1073
|
} catch (f) {
|
|
1045
1074
|
throw f;
|
|
1046
1075
|
}
|
|
1047
|
-
}, [e,
|
|
1076
|
+
}, [e, s]), b = T(async (_) => {
|
|
1048
1077
|
const y = e?.element?.();
|
|
1049
1078
|
if (y) {
|
|
1050
1079
|
h.current = { sourceElement: y, args: _ };
|
|
1051
1080
|
try {
|
|
1052
1081
|
await d(_);
|
|
1053
1082
|
} catch (f) {
|
|
1054
|
-
|
|
1083
|
+
s.showError?.(f);
|
|
1055
1084
|
}
|
|
1056
1085
|
}
|
|
1057
|
-
}, [e?.element,
|
|
1058
|
-
|
|
1086
|
+
}, [e?.element, s]), w = H(() => {
|
|
1087
|
+
b({ isCut: !0 });
|
|
1059
1088
|
}, []), x = T(async (_, y, f) => {
|
|
1060
1089
|
try {
|
|
1061
1090
|
if (await _.doPaste(y, f) === !1) return;
|
|
1062
1091
|
a?.(y, f);
|
|
1063
1092
|
} catch (k) {
|
|
1064
|
-
|
|
1093
|
+
s.showError?.(k);
|
|
1065
1094
|
}
|
|
1066
1095
|
}, [a]), S = T(async (_, y, f) => {
|
|
1067
1096
|
const k = t?.element?.();
|
|
1068
1097
|
if (k && await te.whenFocus(k), !_ && !y) return;
|
|
1069
|
-
const z = await
|
|
1098
|
+
const z = await s.showBusy?.("Pasting...");
|
|
1070
1099
|
if (y) try {
|
|
1071
1100
|
return await x(t, y, f), void z?.();
|
|
1072
1101
|
} catch (g) {
|
|
1073
|
-
z?.(),
|
|
1102
|
+
z?.(), s.showError?.(g);
|
|
1074
1103
|
}
|
|
1075
|
-
let
|
|
1076
|
-
|
|
1104
|
+
let $, I = t.importFromExternal;
|
|
1105
|
+
I || (I = (g, v) => ({ getItemType: () => "text", toText: () => _.text, isClipboardItem: !0 }));
|
|
1077
1106
|
try {
|
|
1078
|
-
|
|
1107
|
+
$ = await I(_, { isCut: !1 });
|
|
1079
1108
|
} catch (g) {
|
|
1080
|
-
z?.(),
|
|
1109
|
+
z?.(), s.showError?.(g);
|
|
1081
1110
|
}
|
|
1082
|
-
if (
|
|
1083
|
-
const g = await Promise.resolve(
|
|
1111
|
+
if ($) try {
|
|
1112
|
+
const g = await Promise.resolve($);
|
|
1084
1113
|
await x(t, g, f), z?.();
|
|
1085
1114
|
} catch (g) {
|
|
1086
|
-
z?.(),
|
|
1115
|
+
z?.(), s.showError?.(g);
|
|
1087
1116
|
}
|
|
1088
1117
|
else z?.();
|
|
1089
|
-
}, [x, t,
|
|
1118
|
+
}, [x, t, s]), P = T(async (_) => {
|
|
1090
1119
|
if (t?.element) try {
|
|
1091
1120
|
const y = await u.readReference();
|
|
1092
1121
|
if (y) return void await S(null, y, _);
|
|
1093
1122
|
const f = [];
|
|
1094
|
-
f[0] = await
|
|
1123
|
+
f[0] = await We.readStringFromClipboard(u, Fe.plain), f[1] = await We.readHTMLFromClipboard(u, Fe.html), f[2] = await We.readBlobFromClipboard(u, Fe.png);
|
|
1095
1124
|
const k = { text: f[0] ?? null, html: f[1] ?? null, image: f[2] ?? null };
|
|
1096
1125
|
await S(k, null, _);
|
|
1097
1126
|
} catch (y) {
|
|
1098
1127
|
if (y?.message === "Document is not focused.") return;
|
|
1099
|
-
|
|
1128
|
+
s.showError?.(y);
|
|
1100
1129
|
}
|
|
1101
|
-
}, [S, t?.element,
|
|
1130
|
+
}, [S, t?.element, s]);
|
|
1102
1131
|
return T(async (_) => {
|
|
1103
1132
|
}, [e?.element]), T(async (_) => {
|
|
1104
|
-
}, [t?.element, S,
|
|
1133
|
+
}, [t?.element, S, s]), V(() => {
|
|
1105
1134
|
if (!u) return;
|
|
1106
1135
|
const _ = async (k) => {
|
|
1107
1136
|
const z = await u.readReference();
|
|
1108
1137
|
l?.(z);
|
|
1109
1138
|
}, y = (k) => {
|
|
1110
|
-
|
|
1139
|
+
s.showMessage?.(Re.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
|
|
1111
1140
|
}, f = (k) => {
|
|
1112
|
-
|
|
1141
|
+
s.showMessage?.(Re.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
|
|
1113
1142
|
};
|
|
1114
1143
|
return u.addEventListener("clipboardchange", _), u.addEventListener("clipboarderrorread", y), u.addEventListener("clipboarderrorwrite", f), () => {
|
|
1115
1144
|
u.removeEventListener("clipboardchange", _), u.removeEventListener("clipboarderrorread", y), u.removeEventListener("clipboarderrorwrite", f);
|
|
1116
1145
|
};
|
|
1117
|
-
}, [u,
|
|
1146
|
+
}, [u, s]), V(() => {
|
|
1118
1147
|
}, [d, S, e, t]), V(() => {
|
|
1119
|
-
|
|
1120
|
-
}, [e, t,
|
|
1148
|
+
r?.getCommand("cut")?.updateCallback(w).update({ disabled: !e || !t }), r?.getCommand("copy")?.updateCallback(b).update({ disabled: !e }), r?.getCommand("paste")?.updateCallback(P).update({ disabled: !t });
|
|
1149
|
+
}, [e, t, r]), { paste: P, copy: b, clipboard: u };
|
|
1121
1150
|
};
|
|
1122
|
-
function
|
|
1151
|
+
function Eo(i, e = !0) {
|
|
1123
1152
|
const t = A(i);
|
|
1124
1153
|
V(() => {
|
|
1125
1154
|
if (e) {
|
|
@@ -1129,33 +1158,33 @@ function xo(i, e = !0) {
|
|
|
1129
1158
|
t.current = i;
|
|
1130
1159
|
});
|
|
1131
1160
|
}
|
|
1132
|
-
let
|
|
1133
|
-
var
|
|
1134
|
-
const
|
|
1135
|
-
const [i, e] =
|
|
1136
|
-
return
|
|
1137
|
-
i == null && e(
|
|
1138
|
-
}, []),
|
|
1139
|
-
|
|
1161
|
+
let Ue = !1, Gn = 0;
|
|
1162
|
+
var qn = typeof document < "u" ? Ie : V;
|
|
1163
|
+
const wt = () => "sheetxl-ui-" + Gn++, bt = ce.useId, To = bt ?? function() {
|
|
1164
|
+
const [i, e] = ce.useState(() => Ue ? wt() : void 0);
|
|
1165
|
+
return qn(() => {
|
|
1166
|
+
i == null && e(wt());
|
|
1167
|
+
}, []), ce.useEffect(() => {
|
|
1168
|
+
Ue || (Ue = !0);
|
|
1140
1169
|
}, []), i;
|
|
1141
|
-
}, St = "Undo the last action.", Lt = "Repeat the last action or undo the redo.",
|
|
1142
|
-
const o = T((s) => {
|
|
1170
|
+
}, St = "Undo the last action.", Lt = "Repeat the last action or undo the redo.", Jn = (i) => `Redo ${i}`, Mo = ({ manager: i, commands: e, disabled: t }) => {
|
|
1171
|
+
const n = Ot(), o = T((s) => {
|
|
1143
1172
|
try {
|
|
1144
1173
|
i?.undo(s);
|
|
1145
1174
|
} catch (l) {
|
|
1146
|
-
n.
|
|
1175
|
+
n.error(l);
|
|
1147
1176
|
}
|
|
1148
1177
|
}, [i]), r = T((s) => {
|
|
1149
1178
|
try {
|
|
1150
1179
|
i?.redo(s);
|
|
1151
1180
|
} catch (l) {
|
|
1152
|
-
n.
|
|
1181
|
+
n.error(l);
|
|
1153
1182
|
}
|
|
1154
1183
|
}, [i]);
|
|
1155
|
-
return
|
|
1184
|
+
return W(() => {
|
|
1156
1185
|
if (!e) return;
|
|
1157
1186
|
const s = { contains: (a) => !0, focus() {
|
|
1158
|
-
} }, l = [new
|
|
1187
|
+
} }, l = [new tt("undo", s, { label: "Undo", description: St, shortcut: { key: "z", modifiers: [Z.Ctrl] }, disabled: !0 }, o), new tt("redo", s, { label: "Redo", description: Lt, shortcut: [{ key: "y", modifiers: [Z.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [Z.Alt] }], disabled: !0 }, r)];
|
|
1159
1188
|
e?.addCommands(l, !0);
|
|
1160
1189
|
}, [e]), V(() => {
|
|
1161
1190
|
if (!e) return;
|
|
@@ -1164,7 +1193,7 @@ const bt = () => "sheetxl-ui-" + Yn++, wt = me.useId, bo = wt ?? function() {
|
|
|
1164
1193
|
var h;
|
|
1165
1194
|
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: a ? (h = a, `Undo ${h}`) : St, state: c, context: { undoManager: i } });
|
|
1166
1195
|
const u = i?.getTopRedoDescription();
|
|
1167
|
-
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ?
|
|
1196
|
+
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ? Jn(u) : Lt, state: c, context: { undoManager: i } });
|
|
1168
1197
|
};
|
|
1169
1198
|
if (s(), !i) return;
|
|
1170
1199
|
const l = i.addListener({ onStackChange() {
|
|
@@ -1174,47 +1203,49 @@ const bt = () => "sheetxl-ui-" + Yn++, wt = me.useId, bo = wt ?? function() {
|
|
|
1174
1203
|
}, [i, e, t]), { undo: o, redo: r };
|
|
1175
1204
|
};
|
|
1176
1205
|
export {
|
|
1177
|
-
|
|
1178
|
-
|
|
1206
|
+
tt as Command,
|
|
1207
|
+
Lo as CommandButtonType,
|
|
1179
1208
|
Ht as CommandGroup,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1209
|
+
Vn as DelegatingReactNotifier,
|
|
1210
|
+
po as FocusKeyNavigation,
|
|
1211
|
+
io as HorizontalAlignment,
|
|
1212
|
+
ro as KeyCodes,
|
|
1184
1213
|
Z as KeyModifiers,
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1214
|
+
so as MouseButtonCodes,
|
|
1215
|
+
fo as NotifierProvider,
|
|
1216
|
+
xt as NotifierType,
|
|
1217
|
+
co as ReactUtils,
|
|
1218
|
+
_o as RoundedTab,
|
|
1219
|
+
zn as ScrollPane,
|
|
1220
|
+
ao as ScrollUtils,
|
|
1221
|
+
nt as Scrollbar,
|
|
1192
1222
|
re as ScrollbarOrientation,
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1223
|
+
je as SimpleCommand,
|
|
1224
|
+
mo as SplitPane,
|
|
1225
|
+
Hn as SplitPaneResizer,
|
|
1226
|
+
uo as ToolTipPlacement,
|
|
1227
|
+
Kn as VirtualScrollbar,
|
|
1228
|
+
Pn as defaultCreateScrollCorner,
|
|
1229
|
+
lo as defaultCreateScrollEdgeButton,
|
|
1230
|
+
mn as defaultCreateScrollEndButton,
|
|
1231
|
+
_n as defaultCreateScrollStartButton,
|
|
1232
|
+
vt as defaultCreateScrollbar,
|
|
1233
|
+
yo as getDevicePixelRatio,
|
|
1234
|
+
Me as toShortcutString,
|
|
1205
1235
|
T as useCallbackRef,
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1236
|
+
bo as useCommand,
|
|
1237
|
+
So as useCommands,
|
|
1238
|
+
Co as useCopyPaste,
|
|
1239
|
+
go as useDevicePixelRatio,
|
|
1240
|
+
wo as useEditMode,
|
|
1241
|
+
ho as useFullscreenPortal,
|
|
1242
|
+
Zn as useGlobalClipboard,
|
|
1243
|
+
To as useId,
|
|
1214
1244
|
At as useImperativeElement,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1245
|
+
xo as useMouseDownAndHoldListener,
|
|
1246
|
+
Ot as useNotifier,
|
|
1247
|
+
vo as useOnClickOrFocusAway,
|
|
1248
|
+
In as useSynchronizedPointerHandler,
|
|
1249
|
+
Eo as useTraceUpdate,
|
|
1250
|
+
Mo as useUndoManager
|
|
1220
1251
|
};
|