@sheetxl/utils-react 0.5.0 → 0.5.1
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 +120 -120
- package/node/esm/index.mjs +172 -172
- package/package.json +2 -2
- package/types/index.d.ts +2 -2
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
2
|
import { jsx as L, jsxs as be, Fragment as Me } from "react/jsx-runtime";
|
|
3
|
-
import me, { useLayoutEffect as Ve, useEffect as V, useState as
|
|
3
|
+
import me, { useLayoutEffect as Ve, useEffect as V, useState as G, useMemo as N, useCallback as R, useRef as A, memo as Se, forwardRef as Le, useImperativeHandle as tn, version as nn, createElement as on, useReducer as rn } from "react";
|
|
4
4
|
import { CommonUtils as te, InternalClipboard as Ke, ClipboardUtils as Ie, MimeType as Ne } from "@sheetxl/utils";
|
|
5
5
|
import { createRoot as sn } from "react-dom/client";
|
|
6
6
|
import { unstable_batchedUpdates as ln } from "react-dom";
|
|
7
7
|
/**
|
|
8
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.5.
|
|
8
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.5.1
|
|
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 Qn = { 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" }, eo = { 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 }, to = { 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;
|
|
@@ -27,7 +27,7 @@ function ve() {
|
|
|
27
27
|
var an = function() {
|
|
28
28
|
}, Et = typeof window < "u", cn = Et ? Ve : V, dt = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
29
29
|
const fe = Et && window.ResizeObserver !== void 0 ? function() {
|
|
30
|
-
var i =
|
|
30
|
+
var i = G(null), e = i[0], t = i[1], n = G(dt), o = n[0], r = n[1], s = N(function() {
|
|
31
31
|
return new window.ResizeObserver(function(l) {
|
|
32
32
|
if (l[0]) {
|
|
33
33
|
var a = l[0].contentRect, c = a.x, h = a.y, u = a.width, d = a.height, w = a.top, b = a.left, x = a.bottom, S = a.right;
|
|
@@ -53,7 +53,7 @@ const fe = Et && window.ResizeObserver !== void 0 ? function() {
|
|
|
53
53
|
}, un = (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
|
+
}, no = (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
|
}, Ue = (i, e, t, n, o = 0) => {
|
|
@@ -65,8 +65,8 @@ 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: w = 120, createScrollStartButton: b = hn, createScrollEndButton: x = un, ...S } = i, P = T(c, [c]), _ = A(null), [y, { width: f, height: k }] = fe(), [z, { width: O, height: F }] = fe(), g = l === re.Vertical, v = g ? "top" : "left", B = g ? "scrollTop" : "scrollLeft", p = g ? k : f, C = g ? F : O, [m, E] =
|
|
68
|
+
}, oo = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ue }, Symbol.toStringTag, { value: "Module" })), dn = "_sheetxl-scrollbar_eblx4_6", tt = Se(Le((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: w = 120, createScrollStartButton: b = hn, createScrollEndButton: x = un, ...S } = i, P = T(c, [c]), _ = A(null), [y, { width: f, height: k }] = fe(), [z, { width: O, height: F }] = fe(), g = l === re.Vertical, v = g ? "top" : "left", B = g ? "scrollTop" : "scrollLeft", p = g ? k : f, C = g ? F : O, [m, E] = G(null);
|
|
70
70
|
V(() => {
|
|
71
71
|
m !== null && _.current && _.current.scrollTo({ behavior: "smooth", [v]: m });
|
|
72
72
|
}, [m, g]);
|
|
@@ -74,7 +74,7 @@ const fe = Et && window.ResizeObserver !== void 0 ? function() {
|
|
|
74
74
|
if (!_.current) return 0;
|
|
75
75
|
const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = se ? 0 : Ue(K, pe[v], le, !0, Math.max(0, K - u));
|
|
76
76
|
return E(ce), Math.max(0, ce);
|
|
77
|
-
}, []),
|
|
77
|
+
}, []), q = R((K, se = !1) => {
|
|
78
78
|
if (!_.current) return 0;
|
|
79
79
|
const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = Math.ceil(C - p), Ce = se ? ce : Ue(K, pe[v], le, !1, Math.max(0, K + u));
|
|
80
80
|
return E(Ce), Math.min(ce, Ce);
|
|
@@ -91,10 +91,10 @@ const fe = Et && window.ResizeObserver !== void 0 ? function() {
|
|
|
91
91
|
X.current && (clearTimeout(X.current), X.current = null, $.current = null);
|
|
92
92
|
}, []), j = R((K, se, ie, pe = d) => {
|
|
93
93
|
$.current = K, X.current = setTimeout(() => {
|
|
94
|
-
const le = ie ? D($.current || K) :
|
|
94
|
+
const le = ie ? D($.current || K) : q($.current || K);
|
|
95
95
|
le !== $.current ? j(le, !1, ie, w) : I();
|
|
96
96
|
}, se ? 0 : pe);
|
|
97
|
-
}, [D,
|
|
97
|
+
}, [D, q, I]);
|
|
98
98
|
V(() => () => I(), [I]);
|
|
99
99
|
const ne = t, ge = N(() => {
|
|
100
100
|
if (!h) return null;
|
|
@@ -299,19 +299,19 @@ class fn {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
var
|
|
302
|
+
var Q = typeof window < "u" ? window : { screen: {}, navigator: {} }, we = (Q.matchMedia || function() {
|
|
303
303
|
return { matches: !1 };
|
|
304
|
-
}).bind(
|
|
304
|
+
}).bind(Q), Tt = !1, gn = { get passive() {
|
|
305
305
|
return Tt = !0;
|
|
306
306
|
} }, ft = function() {
|
|
307
307
|
};
|
|
308
|
-
|
|
309
|
-
var yn = Tt, vn = "PointerEvent" in
|
|
308
|
+
Q.addEventListener && Q.addEventListener("p", ft, gn), Q.removeEventListener && Q.removeEventListener("p", ft, !1);
|
|
309
|
+
var yn = Tt, vn = "PointerEvent" in Q, nt = "ontouchstart" in Q, Mt = nt || "TouchEvent" in Q && we("(any-pointer: coarse)").matches, gt = (Q.navigator.maxTouchPoints || 0) > 0 || Mt, Dt = Q.navigator.userAgent || "", xn = we("(pointer: coarse)").matches && /iPad|Macintosh/.test(Dt) && Math.min(Q.screen.width || 0, Q.screen.height || 0) >= 768, Pt = (we("(pointer: coarse)").matches || !we("(pointer: fine)").matches && nt) && !/Windows.*Firefox/.test(Dt), bn = we("(any-pointer: fine)").matches || we("(any-hover: hover)").matches || xn || !nt, Ze = !gt || !bn && Pt ? gt ? "touchOnly" : "mouseOnly" : "hybrid", wn = Ze === "mouseOnly" ? "mouse" : Ze === "touchOnly" || Pt ? "touch" : "mouse";
|
|
310
310
|
const Sn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Ze, primaryInput: wn, supportsPassiveEvents: yn, supportsPointerEvents: vn, supportsTouchEvents: Mt }, Symbol.toStringTag, { value: "Module" })), Ln = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), zt = {};
|
|
311
311
|
function Ge() {
|
|
312
312
|
return Sn;
|
|
313
313
|
}
|
|
314
|
-
const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i),
|
|
314
|
+
const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i), io = 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;
|
|
@@ -389,31 +389,32 @@ const vt = { Default: "default", Error: "error", Success: "success", Warning: "w
|
|
|
389
389
|
});
|
|
390
390
|
}), showError: (i) => {
|
|
391
391
|
console.error(i);
|
|
392
|
-
} }
|
|
393
|
-
const i = document.fullscreenElement;
|
|
394
|
-
return i ? i.querySelector(".fullscreen-portal-root") || i : document.body;
|
|
395
|
-
};
|
|
392
|
+
} };
|
|
396
393
|
let ke = 0;
|
|
397
|
-
function
|
|
394
|
+
function ro() {
|
|
395
|
+
const [i, e] = G(!!document.fullscreenElement), t = R(() => {
|
|
396
|
+
const n = document.fullscreenElement;
|
|
397
|
+
return n ? n.querySelector(".fullscreen-portal-root") || n : document.body;
|
|
398
|
+
}, []);
|
|
398
399
|
return V(() => {
|
|
399
|
-
function
|
|
400
|
-
const
|
|
401
|
-
if (
|
|
402
|
-
let
|
|
403
|
-
|
|
400
|
+
function n() {
|
|
401
|
+
const o = document.fullscreenElement;
|
|
402
|
+
if (e(!!o), !o) return;
|
|
403
|
+
let r = o.querySelector(".fullscreen-portal-root");
|
|
404
|
+
r || (r = document.createElement("div"), r.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", o.appendChild(r));
|
|
404
405
|
}
|
|
405
|
-
return ke++,
|
|
406
|
-
document.removeEventListener("fullscreenchange",
|
|
407
|
-
|
|
406
|
+
return ke++, n(), document.addEventListener("fullscreenchange", n), () => {
|
|
407
|
+
document.removeEventListener("fullscreenchange", n), ke--, ke <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((o) => {
|
|
408
|
+
o.parentNode && o.parentNode.removeChild(o);
|
|
408
409
|
}), ke = 0);
|
|
409
410
|
};
|
|
410
|
-
}, []), { getPortalContainer:
|
|
411
|
+
}, []), { getPortalContainer: t, isFullscreen: i };
|
|
411
412
|
}
|
|
412
|
-
const
|
|
413
|
-
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s =
|
|
413
|
+
const Mn = 100, Dn = 100, Pn = 1e6, zn = 100, kn = 50, An = Se(Le((i, e) => {
|
|
414
|
+
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s = Mn, endScrollIncrement: l = Dn, style: a = zt, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: d = Pn, scaleFactor: w = zn, precisionFactor: b = kn, ...x } = i;
|
|
414
415
|
u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
415
|
-
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] =
|
|
416
|
-
}, []), [v, B] =
|
|
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 ? w : 1, k = f / b, z = Math.ceil(_.totalSize / f), O = Math.ceil(_.offset / f), F = Math.ceil(n / f), g = R((D) => {
|
|
417
|
+
}, []), [v, B] = G(!1), p = A(null);
|
|
417
418
|
Ve(() => {
|
|
418
419
|
if (!v) {
|
|
419
420
|
p.current = { propTotalSize: o, propViewportSize: n, propOffset: t };
|
|
@@ -421,7 +422,7 @@ const Dn = 100, Pn = 100, zn = 1e6, kn = 100, An = 50, Bn = Se(Le((i, e) => {
|
|
|
421
422
|
y(D);
|
|
422
423
|
}
|
|
423
424
|
}, [o, n, t, v, r, s, l]);
|
|
424
|
-
const C = T((D,
|
|
425
|
+
const C = T((D, q, W) => {
|
|
425
426
|
const Y = p.current;
|
|
426
427
|
p.current = null, Y && Y.propTotalSize === o && Y.propViewportSize === n && Y.propOffset === t || (Math.abs(D - O) < k && (D = O), h?.(D * f, O, F));
|
|
427
428
|
}, [h, f, k, O, F]), m = R((D) => {
|
|
@@ -431,8 +432,8 @@ const Dn = 100, Pn = 100, zn = 1e6, kn = 100, An = 50, Bn = Se(Le((i, e) => {
|
|
|
431
432
|
}, [g, m]);
|
|
432
433
|
return L(tt, { ref: e, style: { ...a }, ...x, offset: O, totalSize: z, viewportSize: F, onMouseDown: E, onScrollOffset: C });
|
|
433
434
|
}));
|
|
434
|
-
|
|
435
|
-
const
|
|
435
|
+
An.displayName = "VirtualScrollbar";
|
|
436
|
+
const so = { 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" };
|
|
436
437
|
function We(i, e) {
|
|
437
438
|
if (typeof i == "function") return i(e);
|
|
438
439
|
i && (i.current = e);
|
|
@@ -453,7 +454,7 @@ var He = parseInt(nn.split(".")[0], 10) >= 19 ? function(i) {
|
|
|
453
454
|
for (const t of i) We(t, e);
|
|
454
455
|
};
|
|
455
456
|
};
|
|
456
|
-
const
|
|
457
|
+
const lo = Se(Le((i, e) => {
|
|
457
458
|
const { refFocusStart: t, ...n } = i, o = A(null), r = R(() => {
|
|
458
459
|
if (t) return void t?.current?.focus();
|
|
459
460
|
const s = o.current.parentElement.children;
|
|
@@ -469,13 +470,13 @@ const ao = Se(Le((i, e) => {
|
|
|
469
470
|
}), l[0].child.focus());
|
|
470
471
|
}, [t]);
|
|
471
472
|
return L("div", { tabIndex: 0, ref: He([o, e]), onFocus: r, ...n });
|
|
472
|
-
})),
|
|
473
|
+
})), ao = Se(Le((i, e) => {
|
|
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 }] = fe(), d = A(null), w = (P, _ = 0) => {
|
|
474
475
|
const y = P / 2, f = u - y + _;
|
|
475
476
|
return function(k, z, O = !1) {
|
|
476
477
|
if (z === 0) return k;
|
|
477
478
|
function F(m, E, D) {
|
|
478
|
-
let
|
|
479
|
+
let q = E.x - m.x, W = E.y - m.y, Y = Math.sqrt(q * q + W * W);
|
|
479
480
|
return g(m, E, Math.min(1, D / Y));
|
|
480
481
|
}
|
|
481
482
|
function g(m, E, D) {
|
|
@@ -497,10 +498,10 @@ const ao = Se(Le((i, e) => {
|
|
|
497
498
|
let m = B(p[0]), E = null;
|
|
498
499
|
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]);
|
|
499
500
|
for (let D = 1; D < p.length; D++) {
|
|
500
|
-
let
|
|
501
|
-
if (Y &&
|
|
502
|
-
let X, $, I = B(
|
|
503
|
-
O ? (X = g(j,
|
|
501
|
+
let q = C[C.length - 1], W = p[D], Y = W === E ? p[1] : p[D + 1];
|
|
502
|
+
if (Y && q && q.length > 2 && W[0] === "L" && Y.length > 2 && Y[0] === "L") {
|
|
503
|
+
let X, $, I = B(q), j = B(W), ne = B(Y);
|
|
504
|
+
O ? (X = g(j, q.origPoint || I, z), $ = g(j, Y.origPoint || ne, z)) : (X = F(j, I, z), $ = F(j, ne, z)), v(W, X), W.origPoint = j, C.push(W);
|
|
504
505
|
let ge = g(X, j, 0.5), ye = g(j, $, 0.5), K = ["C", ge.x, ge.y, ye.x, ye.y, $.x, $.y];
|
|
505
506
|
K.origPoint = j, C.push(K);
|
|
506
507
|
} else C.push(W);
|
|
@@ -520,41 +521,41 @@ const ao = Se(Le((i, e) => {
|
|
|
520
521
|
return w(r) + `L ${h} 0 L 0 0 L 0 ${P}`;
|
|
521
522
|
}, [b, r, s]), S = N(() => ({ style: { clipPath: `path('${x}')` } }), [x]);
|
|
522
523
|
return be("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...a, ref: He([d, c, e]), children: [me.isValidElement(o) ? me.cloneElement(o, S) : L(Me, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: h, height: u, viewBox: `0 0 ${h} ${u}`, children: L("path", { d: b, stroke: l, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s }) })] });
|
|
523
|
-
})),
|
|
524
|
-
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a =
|
|
524
|
+
})), Bn = {}, $n = (i) => {
|
|
525
|
+
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a = Bn, ...c } = i, h = n === "row", { style: u, className: d, ...w } = a;
|
|
525
526
|
return L("div", { style: { ...t, position: "relative" }, ...c, children: L("div", { className: ve("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, ...w }) }, l);
|
|
526
527
|
}, Ae = {}, _e = (i, e, t = !0) => i === null ? null : i.pixels !== null ? t ? i.pixels : e - i.pixels : (t ? i.percent : 100 - i.percent) / 100 * e, Be = (i, e = !0) => i?.percent ? `${e ? i.percent : 100 - i.percent}%` : i?.pixels ? `${i.pixels}px` : void 0, ue = (i, e) => {
|
|
527
528
|
if (i == null) return null;
|
|
528
529
|
const t = { percent: null, pixels: null };
|
|
529
530
|
let n = e;
|
|
530
531
|
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);
|
|
531
|
-
},
|
|
532
|
-
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: w, style: b, disabled: x = !1, onDragStart: S, onDragResize: P, onDragFinish: _, resizerProps: y = Ae, paneProps: f = Ae, paneBeforeProps: k = Ae, paneAfterProps: z = Ae, createResizer: O =
|
|
532
|
+
}, co = Se(Le((i, e) => {
|
|
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: w, style: b, disabled: x = !1, onDragStart: S, onDragResize: P, onDragFinish: _, resizerProps: y = Ae, paneProps: f = Ae, paneBeforeProps: k = Ae, paneAfterProps: z = Ae, createResizer: O = $n } = i;
|
|
533
534
|
if (d) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
534
535
|
const F = N(() => me.isValidElement(n) && me.isValidElement(t), [n, t]), g = N(() => {
|
|
535
536
|
let M = null;
|
|
536
537
|
r && (r === "before" ? M = 0 : r === "after" && (M = 1));
|
|
537
538
|
const H = M === null;
|
|
538
539
|
return { fixedPaneOffset: M, isPercent: H, minBefore: ue(a, H), maxBefore: ue(c, H), minAfter: ue(h, H), maxAfter: ue(u, H) };
|
|
539
|
-
}, [a, c, h, u]), v = T(l, [l]), [B, p] =
|
|
540
|
+
}, [a, c, h, u]), v = T(l, [l]), [B, p] = G(() => ue(s, r === null));
|
|
540
541
|
V(() => {
|
|
541
542
|
p(ue(s, r === null));
|
|
542
543
|
}, [s, r]);
|
|
543
|
-
const [C, { width: m, height: E }] = fe(), [D, { width:
|
|
544
|
+
const [C, { width: m, height: E }] = fe(), [D, { width: q, height: W }] = fe(), Y = o === "row" ? q : W, X = o === "row" ? m : E, $ = N(() => ((M, H, J, U) => {
|
|
544
545
|
const ae = [null, null], oe = [null, null];
|
|
545
|
-
if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), H === 0) return M?.pixels != null ? U.fixedPaneOffset !== 1 ? (ae[0] = M?.pixels, oe[1] = 100) : (ae[1] = M?.pixels -
|
|
546
|
-
let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H -
|
|
547
|
-
ze = (_e(U.maxAfter, H, !1) ??
|
|
546
|
+
if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), H === 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: Be(U.minBefore, !0), maxBefore: Be(U.maxBefore, !0), minAfter: Be(U.minAfter), maxAfter: Be(U.maxAfter) };
|
|
547
|
+
let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H - J, ct = _e(U.minBefore, ee, !0) ?? 0, Qt = _e(U.maxBefore, ee, !0) ?? ee, ze = 0, Fe = 0, ht = 0, ut = ee;
|
|
548
|
+
ze = (_e(U.maxAfter, H, !1) ?? J) - J, Fe = _e(U.minAfter, H, !1) ?? H, ht = Math.max(ct, ze), ut = Math.min(Qt, Fe), he = Math.max(ht, Math.min(he, ut)), Fe = Math.min(ee - he, _e(U.maxAfter, ee - he, !0) ?? ee), ze = Math.min(ee - he, _e(U.minAfter, ee - he, !0) ?? ee), ae[0] = he, ae[1] = ee - ae[0];
|
|
548
549
|
const en = Math.max(0, Math.min(100, he / ee * 100));
|
|
549
550
|
return oe[0] = en, oe[1] = 100 - oe[0], { percents: oe, pixels: ae, minBefore: `${ct}px`, minAfter: `${ze}px`, maxBefore: `${ae[0]}px`, maxAfter: `${ae[1]}px` };
|
|
550
|
-
})(B, X, Y, g), [g, B, X, Y, o]), [I, j] =
|
|
551
|
+
})(B, X, Y, g), [g, B, X, Y, o]), [I, j] = G(!1), ne = T(S, [S]), ge = T(P, [P]), ye = T(_, [_]), K = A(null), se = A(null), ie = A(null), { style: pe, className: le, ...ce } = f, Ce = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: Rt, style: Vt, ...Ft } = k, { className: It, style: Nt, ...Wt } = z, Yt = { flex: "1 1 100%", width: "100%", ...b, flexDirection: o, display: "flex" }, { className: ot, style: it, onPointerDown: rt, ...st } = y, Xt = T((M) => {
|
|
551
552
|
const H = ue(M, r === null);
|
|
552
553
|
p(H);
|
|
553
554
|
}, [r]), De = T((M) => {
|
|
554
555
|
if (x || !I) return;
|
|
555
556
|
const H = at.current?.getBoundingClientRect();
|
|
556
|
-
let
|
|
557
|
-
|
|
557
|
+
let J = 0;
|
|
558
|
+
J = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - H.x : (M.clientY ?? M.touches?.[0]?.clientY) - H.y, J = Math.max(0, Math.min(X, J)), g.fixedPaneOffset === 1 && (J = X - J), s && B.pixels === J || p({ pixels: J, percent: null }), ge?.(J), M.stopPropagation(), M.preventDefault();
|
|
558
559
|
}, [g, o, x, I, B, X]), lt = T((M) => {
|
|
559
560
|
if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup", lt), !!I && (j(!1), !!B)) {
|
|
560
561
|
if (ye(B.pixels), !ue(s, r === null) || B.pixels !== s) {
|
|
@@ -568,8 +569,8 @@ const ao = Se(Le((i, e) => {
|
|
|
568
569
|
}, [rt]), at = At(e, () => ({ setPosition: Xt, isSplitPane: () => !0 }), []), Ut = N(() => F ? O?.({ key: "resizer", ref: He([D, se]), className: ve("resizer", ot), onPointerDownCapture: jt, 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, ...it }, splitDirection: o, disabled: x, ...st }) : null, [F, ot, st, o, it, x]), Pe = o === "row" ? "Width" : "Height", Zt = { ...Ce, ...Vt, flex: g.fixedPaneOffset === 0 && $?.pixels[0] !== null ? `0 0 ${Math.round($?.pixels[0])}px` : `1 1 ${Math.round($?.percents[0] ?? 100)}%`, [`min${Pe}`]: $?.minBefore, [`max${Pe}`]: n ? $?.maxBefore : "100%" }, Gt = { ...Ce, ...Nt, flex: g.fixedPaneOffset === 1 && $?.pixels[1] !== null ? `0 0 ${Math.round($?.pixels[1])}px` : `1 1 ${Math.round($?.percents[1] ?? 100)}%`, [`min${Pe}`]: $?.minAfter, [`max${Pe}`]: t ? $?.maxAfter : "100%" }, qt = N(() => t ? L("div", { ref: K, className: ve("before", le, Rt), style: Zt, ...ce, ...Ft, children: t }, "before") : null, [t, f, k, g, $]), Jt = N(() => n ? L("div", { ref: ie, className: ve("after", le, It), style: Gt, ...ce, ...Wt, children: n }, "after") : null, [n, f, z, g, $]);
|
|
569
570
|
return be("div", { ref: He([C, at]), className: ve("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: I }, w), style: Yt, children: [qt, Ut, Jt] });
|
|
570
571
|
}));
|
|
571
|
-
function
|
|
572
|
-
const [e, t] =
|
|
572
|
+
function ho(i) {
|
|
573
|
+
const [e, t] = G(typeof window < "u" ? window.devicePixelRatio : 1), n = A(null);
|
|
573
574
|
return V(() => {
|
|
574
575
|
if (!(typeof window < "u" && "matchMedia" in window)) return;
|
|
575
576
|
const o = () => {
|
|
@@ -581,12 +582,12 @@ function uo(i) {
|
|
|
581
582
|
};
|
|
582
583
|
}, [i]), e;
|
|
583
584
|
}
|
|
584
|
-
function
|
|
585
|
+
function uo(i) {
|
|
585
586
|
if (typeof window > "u") return 1;
|
|
586
587
|
const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e;
|
|
587
588
|
return Math.min(Math.max(1, n ? Math.floor(o) : o), t);
|
|
588
589
|
}
|
|
589
|
-
function
|
|
590
|
+
function po(i, e, t) {
|
|
590
591
|
const n = T(e, [e]);
|
|
591
592
|
V(() => {
|
|
592
593
|
const o = (r) => {
|
|
@@ -597,7 +598,7 @@ function _o(i, e, t) {
|
|
|
597
598
|
};
|
|
598
599
|
}, [i]);
|
|
599
600
|
}
|
|
600
|
-
function
|
|
601
|
+
function On(i) {
|
|
601
602
|
if (!i) throw new Error("must have a PointerHandlerOptions");
|
|
602
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), w = A(null), b = A(null), x = A(null), S = R(() => {
|
|
603
604
|
x.current && (clearTimeout(x.current), x.current = null);
|
|
@@ -632,12 +633,12 @@ function Kn(i) {
|
|
|
632
633
|
v.isDefaultPrevented() || (b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, s(v, b.current) !== !1 && (d.current = v, w.current = v.nativeEvent, document.addEventListener(`${_}up`, f, { passive: !1 }), document.addEventListener(`${_}move`, O, { passive: !1 }), document.addEventListener("keydown", F, { 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)));
|
|
633
634
|
}, [h, o]);
|
|
634
635
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
636
|
+
function _o(i, e) {
|
|
637
|
+
return On({ onPointerDown: i, onPointerMoveOrWait: (t, n, o) => {
|
|
637
638
|
i?.(o);
|
|
638
639
|
}, ...e });
|
|
639
640
|
}
|
|
640
|
-
const
|
|
641
|
+
const Kn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
641
642
|
const n = A(i);
|
|
642
643
|
if (typeof e != "function") throw new Error("function expected as hook body parameter. got " + typeof e);
|
|
643
644
|
const o = e();
|
|
@@ -647,11 +648,11 @@ const Hn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
|
647
648
|
}, qe = (i) => {
|
|
648
649
|
console && console.warn && console.warn(i);
|
|
649
650
|
}, Ye = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
650
|
-
let
|
|
651
|
+
let Hn = 1, Je = !1, $t = !1;
|
|
651
652
|
const Oe = [], xe = [], Re = () => {
|
|
652
653
|
xe.forEach((i) => i());
|
|
653
|
-
},
|
|
654
|
-
const [e, t] =
|
|
654
|
+
}, Rn = ({ automaticContainerInternalUseOnly: i }) => {
|
|
655
|
+
const [e, t] = G([]), n = A([]);
|
|
655
656
|
return n.current = e, i || Je !== !1 || ($t = !0), V(() => {
|
|
656
657
|
let o = !0;
|
|
657
658
|
function r() {
|
|
@@ -660,15 +661,15 @@ const Oe = [], xe = [], Re = () => {
|
|
|
660
661
|
return xe.push(r), Re(), () => {
|
|
661
662
|
o = !1, n.current?.length > 0 && qe("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), xe.splice(xe.indexOf(r), 1), Re();
|
|
662
663
|
};
|
|
663
|
-
}, [i]), L(Me, { children: e.map(({ hook: o, key: r }) => on(
|
|
664
|
-
},
|
|
665
|
-
const e =
|
|
664
|
+
}, [i]), L(Me, { children: e.map(({ hook: o, key: r }) => on(Kn, { ...o, key: r })) });
|
|
665
|
+
}, Vn = (i) => {
|
|
666
|
+
const e = Hn++;
|
|
666
667
|
return Oe.push({ hook: i, key: e }), xe.length === 0 && $t === !1 && (Je = !0, ((t) => {
|
|
667
668
|
if (Ye.document && Ye.document.createElement) {
|
|
668
669
|
const n = Ye.document.createElement("div");
|
|
669
670
|
sn(n).render(L(t, { automaticContainerInternalUseOnly: !0 }));
|
|
670
671
|
} else qe("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
|
|
671
|
-
})(
|
|
672
|
+
})(Rn)), Re(), () => {
|
|
672
673
|
Oe.splice(Oe.findIndex((t) => t.key === e), 1), Re();
|
|
673
674
|
};
|
|
674
675
|
};
|
|
@@ -679,8 +680,8 @@ Qe || (Qe = (i, e, t = {}) => {
|
|
|
679
680
|
o = u, ln(() => l.forEach((d) => d(u)));
|
|
680
681
|
}, h = () => (s || (o = typeof i == "function" ? i() : i, s = !0), o);
|
|
681
682
|
return () => {
|
|
682
|
-
const [u, d] =
|
|
683
|
-
return V(() => (r || (r = !0, n =
|
|
683
|
+
const [u, d] = G(h);
|
|
684
|
+
return V(() => (r || (r = !0, n = Vn({ initValue: i, useHookBody: e, applyStateChange: c })), l.push(d), o !== u && d(o), () => {
|
|
684
685
|
l.splice(l.indexOf(d), 1), l.length === 0 && a && (n(), r = !1);
|
|
685
686
|
}), []), u;
|
|
686
687
|
};
|
|
@@ -689,11 +690,11 @@ const Ot = Qe;
|
|
|
689
690
|
let Kt = () => {
|
|
690
691
|
console.warn("You must call useEditMode before setting its state.");
|
|
691
692
|
};
|
|
692
|
-
const
|
|
693
|
-
const [i, e] =
|
|
693
|
+
const Fn = Ot(null, () => {
|
|
694
|
+
const [i, e] = G(null);
|
|
694
695
|
return Kt = e, i;
|
|
695
|
-
}),
|
|
696
|
-
const i =
|
|
696
|
+
}), mo = () => {
|
|
697
|
+
const i = Fn();
|
|
697
698
|
return N(() => ({ setMode: (e) => {
|
|
698
699
|
Kt((t) => (typeof e == "function" && (e = e(t)), e?.onModeChange?.(e ?? null), e));
|
|
699
700
|
}, getMode: () => i }), [i]);
|
|
@@ -965,13 +966,13 @@ class Ht {
|
|
|
965
966
|
}), e;
|
|
966
967
|
}
|
|
967
968
|
}
|
|
968
|
-
const
|
|
969
|
+
const In = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "Cmd" : "Ctrl", Nn = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "⌘" : "^", Te = (i, e = !1) => {
|
|
969
970
|
const t = {};
|
|
970
971
|
for (let o = 0; i.modifiers && o < i.modifiers.length; o++) t[i.modifiers[o]] = !0;
|
|
971
972
|
let n = "";
|
|
972
|
-
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ?
|
|
973
|
+
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ? Nn : In)), t?.[Z.Alt] && (n += e ? "⌥" : "Alt"), t?.[Z.Shift] && (n += (n.length > 0 ? "+" : "") + (e ? "⇧" : "Shift")), n += (n.length > 0 ? "+" : "") + kt(i.key), n;
|
|
973
974
|
};
|
|
974
|
-
function
|
|
975
|
+
function fo(i, e = null) {
|
|
975
976
|
const t = A(e);
|
|
976
977
|
t.current = e;
|
|
977
978
|
const [n, o] = rn((s) => s + 1, 0), r = N(() => Array.isArray(i) ? i : [i], [i]);
|
|
@@ -1003,10 +1004,10 @@ const $e = (i, e) => {
|
|
|
1003
1004
|
}
|
|
1004
1005
|
return t;
|
|
1005
1006
|
};
|
|
1006
|
-
function
|
|
1007
|
+
function go(i, e = null, t = null, n) {
|
|
1007
1008
|
const o = A(t);
|
|
1008
1009
|
o.current = t, e && !Array.isArray(e) && (e = [e]);
|
|
1009
|
-
const [r, s] =
|
|
1010
|
+
const [r, s] = G($e(i, e)), l = n ? [...n, i] : [i];
|
|
1010
1011
|
return V(() => {
|
|
1011
1012
|
const a = { onGroupChange: () => {
|
|
1012
1013
|
const d = $e(i, e);
|
|
@@ -1022,13 +1023,13 @@ function yo(i, e = null, t = null, n) {
|
|
|
1022
1023
|
};
|
|
1023
1024
|
}, l), r;
|
|
1024
1025
|
}
|
|
1025
|
-
const
|
|
1026
|
+
const yo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Wn = Ot({ setClipboard: (i) => {
|
|
1026
1027
|
throw new Error("This is only available via the useClipboard.");
|
|
1027
1028
|
}, getClipboard: () => Ke.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1028
|
-
const [i, e] =
|
|
1029
|
+
const [i, e] = G(Ke.Global);
|
|
1029
1030
|
return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy: A(null), refNativeLastKey: A(null) };
|
|
1030
|
-
}),
|
|
1031
|
-
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, notifier: r = Bt, commands: s } = i, l = T(o, [o]), a = T(n, [n]), { getClipboard: c, refNativeCopy: h } =
|
|
1031
|
+
}), vo = (i) => {
|
|
1032
|
+
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, notifier: r = Bt, commands: s } = i, l = T(o, [o]), a = T(n, [n]), { getClipboard: c, refNativeCopy: h } = Wn(), u = c();
|
|
1032
1033
|
N(() => {
|
|
1033
1034
|
const _ = e?.element, y = t?.element ?? e?.element;
|
|
1034
1035
|
if (!s) return;
|
|
@@ -1118,7 +1119,7 @@ const vo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Yn = Ot({ setClipboard:
|
|
|
1118
1119
|
s?.getCommand("cut")?.updateCallback(b).update({ disabled: !e || !t }), s?.getCommand("copy")?.updateCallback(w).update({ disabled: !e }), s?.getCommand("paste")?.updateCallback(P).update({ disabled: !t });
|
|
1119
1120
|
}, [e, t, s]), { paste: P, copy: w, clipboard: u };
|
|
1120
1121
|
};
|
|
1121
|
-
function
|
|
1122
|
+
function xo(i, e = !0) {
|
|
1122
1123
|
const t = A(i);
|
|
1123
1124
|
V(() => {
|
|
1124
1125
|
if (e) {
|
|
@@ -1128,16 +1129,16 @@ function bo(i, e = !0) {
|
|
|
1128
1129
|
t.current = i;
|
|
1129
1130
|
});
|
|
1130
1131
|
}
|
|
1131
|
-
let je = !1,
|
|
1132
|
-
var
|
|
1133
|
-
const bt = () => "sheetxl-ui-" +
|
|
1132
|
+
let je = !1, Yn = 0;
|
|
1133
|
+
var Xn = typeof document < "u" ? Ve : V;
|
|
1134
|
+
const bt = () => "sheetxl-ui-" + Yn++, wt = me.useId, bo = wt ?? function() {
|
|
1134
1135
|
const [i, e] = me.useState(() => je ? bt() : void 0);
|
|
1135
|
-
return
|
|
1136
|
+
return Xn(() => {
|
|
1136
1137
|
i == null && e(bt());
|
|
1137
1138
|
}, []), me.useEffect(() => {
|
|
1138
1139
|
je || (je = !0);
|
|
1139
1140
|
}, []), i;
|
|
1140
|
-
}, St = "Undo the last action.", Lt = "Repeat the last action or undo the redo.",
|
|
1141
|
+
}, St = "Undo the last action.", Lt = "Repeat the last action or undo the redo.", jn = (i) => `Redo ${i}`, wo = ({ manager: i, commands: e, disabled: t, notifier: n = Bt }) => {
|
|
1141
1142
|
const o = T((s) => {
|
|
1142
1143
|
try {
|
|
1143
1144
|
i?.undo(s);
|
|
@@ -1163,7 +1164,7 @@ const bt = () => "sheetxl-ui-" + Xn++, wt = me.useId, wo = wt ?? function() {
|
|
|
1163
1164
|
var h;
|
|
1164
1165
|
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: a ? (h = a, `Undo ${h}`) : St, state: c, context: { undoManager: i } });
|
|
1165
1166
|
const u = i?.getTopRedoDescription();
|
|
1166
|
-
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ?
|
|
1167
|
+
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ? jn(u) : Lt, state: c, context: { undoManager: i } });
|
|
1167
1168
|
};
|
|
1168
1169
|
if (s(), !i) return;
|
|
1169
1170
|
const l = i.addListener({ onStackChange() {
|
|
@@ -1174,47 +1175,46 @@ const bt = () => "sheetxl-ui-" + Xn++, wt = me.useId, wo = wt ?? function() {
|
|
|
1174
1175
|
};
|
|
1175
1176
|
export {
|
|
1176
1177
|
et as Command,
|
|
1177
|
-
|
|
1178
|
+
yo as CommandButtonType,
|
|
1178
1179
|
Ht as CommandGroup,
|
|
1179
1180
|
Bt as DefaultNotifier,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1181
|
+
lo as FocusKeyNavigation,
|
|
1182
|
+
Qn as HorizontalAlignment,
|
|
1183
|
+
eo as KeyCodes,
|
|
1183
1184
|
Z as KeyModifiers,
|
|
1184
|
-
|
|
1185
|
+
to as MouseButtonCodes,
|
|
1185
1186
|
vt as NotificationType,
|
|
1186
|
-
|
|
1187
|
-
|
|
1187
|
+
io as ReactUtils,
|
|
1188
|
+
ao as RoundedTab,
|
|
1188
1189
|
Tn as ScrollPane,
|
|
1189
|
-
|
|
1190
|
+
oo as ScrollUtils,
|
|
1190
1191
|
tt as Scrollbar,
|
|
1191
1192
|
re as ScrollbarOrientation,
|
|
1192
1193
|
Xe as SimpleCommand,
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1194
|
+
co as SplitPane,
|
|
1195
|
+
$n as SplitPaneResizer,
|
|
1196
|
+
so as ToolTipPlacement,
|
|
1197
|
+
An as VirtualScrollbar,
|
|
1197
1198
|
En as defaultCreateScrollCorner,
|
|
1198
|
-
|
|
1199
|
+
no as defaultCreateScrollEdgeButton,
|
|
1199
1200
|
un as defaultCreateScrollEndButton,
|
|
1200
1201
|
hn as defaultCreateScrollStartButton,
|
|
1201
1202
|
yt as defaultCreateScrollbar,
|
|
1202
|
-
|
|
1203
|
-
Mn as getPortalContainer,
|
|
1203
|
+
uo as getDevicePixelRatio,
|
|
1204
1204
|
Te as toShortcutString,
|
|
1205
1205
|
T as useCallbackRef,
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1206
|
+
fo as useCommand,
|
|
1207
|
+
go as useCommands,
|
|
1208
|
+
vo as useCopyPaste,
|
|
1209
|
+
ho as useDevicePixelRatio,
|
|
1210
|
+
mo as useEditMode,
|
|
1211
|
+
ro as useFullscreenPortal,
|
|
1212
|
+
Wn as useGlobalClipboard,
|
|
1213
|
+
bo as useId,
|
|
1214
1214
|
At as useImperativeElement,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1215
|
+
_o as useMouseDownAndHoldListener,
|
|
1216
|
+
po as useOnClickOrFocusAway,
|
|
1217
|
+
On as useSynchronizedPointerHandler,
|
|
1218
|
+
xo as useTraceUpdate,
|
|
1219
|
+
wo as useUndoManager
|
|
1220
1220
|
};
|