@sheetxl/utils-react 0.4.20 → 0.4.21
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 +170 -167
- package/node/esm/index.mjs +64 -61
- package/package.json +2 -2
- package/types/index.d.ts +1 -1
package/browser/esm/index.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
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 Q, useMemo as N, useCallback as R, useRef as A, memo as Se, forwardRef as Le, useImperativeHandle as
|
|
4
|
-
import { CommonUtils as te,
|
|
5
|
-
import { createRoot as
|
|
6
|
-
import { unstable_batchedUpdates as
|
|
3
|
+
import me, { useLayoutEffect as Ve, useEffect as V, useState as Q, 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
|
+
import { CommonUtils as te, InternalClipboard as Ke, ClipboardUtils as Ie, MimeType as Ne } from "@sheetxl/utils";
|
|
5
|
+
import { createRoot as sn } from "react-dom/client";
|
|
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.4.
|
|
8
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.4.21
|
|
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
|
|
14
|
-
function
|
|
13
|
+
const eo = { 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" }, to = { 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 }, no = { Left: 1, Middle: 2, Right: 3 }, re = { Horizontal: "horizontal", Vertical: "vertical" };
|
|
14
|
+
function Ct(i) {
|
|
15
15
|
var e, t, n = "";
|
|
16
16
|
if (typeof i == "string" || typeof i == "number") n += i;
|
|
17
17
|
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
18
18
|
var o = i.length;
|
|
19
|
-
for (e = 0; e < o; e++) i[e] && (t =
|
|
19
|
+
for (e = 0; e < o; e++) i[e] && (t = Ct(i[e])) && (n && (n += " "), n += t);
|
|
20
20
|
} else for (t in i) i[t] && (n && (n += " "), n += t);
|
|
21
21
|
return n;
|
|
22
22
|
}
|
|
23
23
|
function ve() {
|
|
24
|
-
for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e =
|
|
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
|
-
},
|
|
29
|
-
const fe =
|
|
30
|
-
var i = Q(null), e = i[0], t = i[1], n = Q(
|
|
27
|
+
var an = function() {
|
|
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
|
+
const fe = Et && window.ResizeObserver !== void 0 ? function() {
|
|
30
|
+
var i = Q(null), e = i[0], t = i[1], n = Q(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;
|
|
@@ -35,25 +35,25 @@ const fe = Ct && window.ResizeObserver !== void 0 ? function() {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
}, []);
|
|
38
|
-
return
|
|
38
|
+
return cn(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 [an, dt];
|
|
45
45
|
}, T = (i, e) => {
|
|
46
46
|
const t = R((...r) => i?.(...r), e), n = A(null);
|
|
47
47
|
n.current = t;
|
|
48
48
|
const o = R((...r) => n.current?.(...r), []);
|
|
49
49
|
if (n.current) return o;
|
|
50
|
-
},
|
|
50
|
+
}, hn = (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
|
+
}, 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
|
+
}, oo = (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 = Ct && 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 =
|
|
68
|
+
}, io = 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] = Q(null);
|
|
70
70
|
V(() => {
|
|
71
71
|
m !== null && _.current && _.current.scrollTo({ behavior: "smooth", [v]: m });
|
|
72
72
|
}, [m, g]);
|
|
@@ -105,28 +105,28 @@ const fe = Ct && window.ResizeObserver !== void 0 ? function() {
|
|
|
105
105
|
const K = { orientation: l, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp: I, onMouseLeave: I, 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: ve(
|
|
108
|
+
return be("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className: ve(dn, s), ...S, children: [ge, 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" }) }) }), ye] });
|
|
109
109
|
}));
|
|
110
|
-
|
|
111
|
-
let
|
|
110
|
+
tt.displayName = "Scrollbar";
|
|
111
|
+
let pt = Date.now, _t = 1e3, de = {}, pn = 1;
|
|
112
112
|
const Ee = (i) => {
|
|
113
113
|
let e = de[i] !== null;
|
|
114
114
|
return e && (de[i] = null), e;
|
|
115
|
-
},
|
|
116
|
-
let r =
|
|
115
|
+
}, mt = (i, e, t, n = 0, o) => {
|
|
116
|
+
let r = pt(), s = r, l = 0, a = 0, c = 0, h = pn++;
|
|
117
117
|
if (h % 20 == 0) {
|
|
118
118
|
const d = {};
|
|
119
119
|
for (let w in de) d[w] = !0;
|
|
120
120
|
de = d;
|
|
121
121
|
}
|
|
122
122
|
const u = function(d) {
|
|
123
|
-
let w = d !== !0, b =
|
|
123
|
+
let w = d !== !0, b = pt(), x = !0;
|
|
124
124
|
try {
|
|
125
125
|
x = (!e || e(h)) ?? !0;
|
|
126
126
|
} catch {
|
|
127
127
|
x = !1;
|
|
128
128
|
}
|
|
129
|
-
if (!de[h] || !x) return de[h] = null, void t?.(60 - a / ((b - r) /
|
|
129
|
+
if (!de[h] || !x) return de[h] = null, void t?.(60 - a / ((b - r) / _t), h, !1);
|
|
130
130
|
if (w) {
|
|
131
131
|
c = Math.round((b - s) / 16.666666666666668) - 1;
|
|
132
132
|
for (let _ = 0; _ < Math.min(c, 4); _++) u(!0), a++;
|
|
@@ -138,15 +138,15 @@ const Ee = (i) => {
|
|
|
138
138
|
} catch {
|
|
139
139
|
P = !1;
|
|
140
140
|
}
|
|
141
|
-
P !== !1 && l !== 1 || !w ? w && (s = b, requestAnimationFrame(u)) : (de[h] = null, t?.(60 - a / ((b - r) /
|
|
141
|
+
P !== !1 && l !== 1 || !w ? w && (s = b, requestAnimationFrame(u)) : (de[h] = null, t?.(60 - a / ((b - r) / _t), h, l === 1 || n == null));
|
|
142
142
|
};
|
|
143
143
|
return de[h] = !0, requestAnimationFrame(u), h;
|
|
144
|
-
}, pn = function(i) {
|
|
145
|
-
return Math.pow(i - 1, 3) + 1;
|
|
146
144
|
}, _n = function(i) {
|
|
145
|
+
return Math.pow(i - 1, 3) + 1;
|
|
146
|
+
}, mn = 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 fn {
|
|
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
|
}
|
|
@@ -264,7 +264,7 @@ class mn {
|
|
|
264
264
|
}.bind(this), b = 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 = mt(d, w, b, this.options.animationDuration, r ? _n : mn);
|
|
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 mn {
|
|
|
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 = mt(t, o, r);
|
|
287
287
|
}
|
|
288
288
|
__stepThroughDeceleration(e) {
|
|
289
289
|
let t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
|
|
@@ -301,17 +301,17 @@ class mn {
|
|
|
301
301
|
}
|
|
302
302
|
var J = typeof window < "u" ? window : { screen: {}, navigator: {} }, we = (J.matchMedia || function() {
|
|
303
303
|
return { matches: !1 };
|
|
304
|
-
}).bind(J),
|
|
305
|
-
return
|
|
306
|
-
} },
|
|
304
|
+
}).bind(J), Tt = !1, gn = { get passive() {
|
|
305
|
+
return Tt = !0;
|
|
306
|
+
} }, ft = function() {
|
|
307
307
|
};
|
|
308
|
-
J.addEventListener && J.addEventListener("p",
|
|
309
|
-
var
|
|
310
|
-
const
|
|
308
|
+
J.addEventListener && J.addEventListener("p", ft, gn), J.removeEventListener && J.removeEventListener("p", ft, !1);
|
|
309
|
+
var yn = Tt, vn = "PointerEvent" in J, nt = "ontouchstart" in J, Mt = nt || "TouchEvent" in J && we("(any-pointer: coarse)").matches, gt = (J.navigator.maxTouchPoints || 0) > 0 || Mt, Dt = J.navigator.userAgent || "", xn = we("(pointer: coarse)").matches && /iPad|Macintosh/.test(Dt) && Math.min(J.screen.width || 0, J.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
|
+
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
|
-
return
|
|
312
|
+
return Sn;
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i), ro = 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 zt = (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: Ge, focusableNodeNames:
|
|
325
|
-
function
|
|
324
|
+
}, detectIt: Ge, focusableNodeNames: Ln, toPrettyKeyCode: kt }, Symbol.toStringTag, { value: "Module" })), Cn = [];
|
|
325
|
+
function At(i, e, t = Cn) {
|
|
326
326
|
const n = A(null);
|
|
327
|
-
return
|
|
327
|
+
return tn(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,8 +336,8 @@ function kt(i, e, t = Ln) {
|
|
|
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 yt = (i) => L(tt, { ...i }), En = ({ width: i, height: e }) => L("div", { className: "corner", style: { minWidth: `${i}px`, width: `${i}px`, minHeight: `${e}px`, height: `${e}px` } }), Tn = Se(Le((i, e) => {
|
|
340
|
+
const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: l = En, createHorizontalScrollbar: a = yt, createVerticalScrollbar: c = yt, style: h, touchElement: u, disableTouch: d, ...w } = i, b = 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]);
|
|
@@ -357,7 +357,7 @@ const gt = (i) => L(et, { ...i }), Cn = ({ width: i, height: e }) => L("div", {
|
|
|
357
357
|
if (!d && Ge().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 fn(P, C);
|
|
361
361
|
}
|
|
362
362
|
Ge().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
|
}
|
|
@@ -376,25 +376,25 @@ const gt = (i) => L(et, { ...i }), Cn = ({ width: i, height: e }) => L("div", {
|
|
|
376
376
|
}, [a, n?.left, n?.width, n?.totalWidth, s, l, O, g]);
|
|
377
377
|
return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${O}px` : void 0, minHeight: r ? `${g}px` : void 0, ...h }, ...w, 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(Me, {})] }), r ? B : L(Me, {})] }) });
|
|
378
378
|
}));
|
|
379
|
-
|
|
380
|
-
const
|
|
379
|
+
Tn.displayName = "ScrollPane";
|
|
380
|
+
const vt = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, xt = /* @__PURE__ */ new Set(), Bt = { showMessage: (i, e) => {
|
|
381
381
|
if (e?.onceKey) {
|
|
382
|
-
if (
|
|
383
|
-
|
|
382
|
+
if (xt.has(e.onceKey)) return;
|
|
383
|
+
xt.add(e.onceKey);
|
|
384
384
|
}
|
|
385
385
|
let t = console.log;
|
|
386
|
-
e?.type !==
|
|
386
|
+
e?.type !== vt.Warning && e?.type !== vt.Error || (t = console.warn), t(i);
|
|
387
387
|
}, showBusy: (i, e) => new Promise((t) => {
|
|
388
388
|
t(() => {
|
|
389
389
|
});
|
|
390
390
|
}), showError: (i) => {
|
|
391
391
|
console.error(i);
|
|
392
|
-
} },
|
|
392
|
+
} }, Mn = () => {
|
|
393
393
|
const i = document.fullscreenElement;
|
|
394
394
|
return i ? i.querySelector(".fullscreen-portal-root") || i : document.body;
|
|
395
395
|
};
|
|
396
396
|
let ke = 0;
|
|
397
|
-
function
|
|
397
|
+
function so() {
|
|
398
398
|
return V(() => {
|
|
399
399
|
function i() {
|
|
400
400
|
const e = document.fullscreenElement;
|
|
@@ -407,10 +407,10 @@ function ro() {
|
|
|
407
407
|
e.parentNode && e.parentNode.removeChild(e);
|
|
408
408
|
}), ke = 0);
|
|
409
409
|
};
|
|
410
|
-
}, []), { getPortalContainer:
|
|
410
|
+
}, []), { getPortalContainer: Mn };
|
|
411
411
|
}
|
|
412
|
-
const
|
|
413
|
-
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s =
|
|
412
|
+
const Dn = 100, Pn = 100, zn = 1e6, kn = 100, An = 50, Bn = Se(Le((i, e) => {
|
|
413
|
+
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s = Dn, endScrollIncrement: l = Pn, style: a = zt, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: d = zn, scaleFactor: w = kn, precisionFactor: b = An, ...x } = i;
|
|
414
414
|
u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
415
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] = Q(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) => {
|
|
416
416
|
}, []), [v, B] = Q(!1), p = A(null);
|
|
@@ -429,15 +429,15 @@ const Mn = 100, Dn = 100, Pn = 1e6, zn = 100, kn = 50, An = Se(Le((i, e) => {
|
|
|
429
429
|
}, []), E = R((D) => {
|
|
430
430
|
S?.(D), B(!0), document.addEventListener("mousemove", g, { passive: !0 }), document.addEventListener("mouseup", m, { passive: !0 });
|
|
431
431
|
}, [g, m]);
|
|
432
|
-
return L(
|
|
432
|
+
return L(tt, { ref: e, style: { ...a }, ...x, offset: O, totalSize: z, viewportSize: F, onMouseDown: E, onScrollOffset: C });
|
|
433
433
|
}));
|
|
434
|
-
|
|
435
|
-
const
|
|
434
|
+
Bn.displayName = "VirtualScrollbar";
|
|
435
|
+
const lo = { 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
436
|
function We(i, e) {
|
|
437
437
|
if (typeof i == "function") return i(e);
|
|
438
438
|
i && (i.current = e);
|
|
439
439
|
}
|
|
440
|
-
var He = parseInt(
|
|
440
|
+
var He = parseInt(nn.split(".")[0], 10) >= 19 ? function(i) {
|
|
441
441
|
return (e) => {
|
|
442
442
|
const t = [];
|
|
443
443
|
for (const n of i) {
|
|
@@ -453,7 +453,7 @@ var He = parseInt(tn.split(".")[0], 10) >= 19 ? function(i) {
|
|
|
453
453
|
for (const t of i) We(t, e);
|
|
454
454
|
};
|
|
455
455
|
};
|
|
456
|
-
const
|
|
456
|
+
const ao = Se(Le((i, e) => {
|
|
457
457
|
const { refFocusStart: t, ...n } = i, o = A(null), r = R(() => {
|
|
458
458
|
if (t) return void t?.current?.focus();
|
|
459
459
|
const s = o.current.parentElement.children;
|
|
@@ -469,7 +469,7 @@ const lo = Se(Le((i, e) => {
|
|
|
469
469
|
}), l[0].child.focus());
|
|
470
470
|
}, [t]);
|
|
471
471
|
return L("div", { tabIndex: 0, ref: He([o, e]), onFocus: r, ...n });
|
|
472
|
-
})),
|
|
472
|
+
})), co = Se(Le((i, e) => {
|
|
473
473
|
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
474
|
const y = P / 2, f = u - y + _;
|
|
475
475
|
return function(k, z, O = !1) {
|
|
@@ -520,16 +520,16 @@ const lo = Se(Le((i, e) => {
|
|
|
520
520
|
return w(r) + `L ${h} 0 L 0 0 L 0 ${P}`;
|
|
521
521
|
}, [b, r, s]), S = N(() => ({ style: { clipPath: `path('${x}')` } }), [x]);
|
|
522
522
|
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 =
|
|
523
|
+
})), $n = {}, On = (i) => {
|
|
524
|
+
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a = $n, ...c } = i, h = n === "row", { style: u, className: d, ...w } = a;
|
|
525
525
|
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
526
|
}, 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
527
|
if (i == null) return null;
|
|
528
528
|
const t = { percent: null, pixels: null };
|
|
529
529
|
let n = e;
|
|
530
530
|
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 =
|
|
531
|
+
}, ho = Se(Le((i, e) => {
|
|
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 = On } = i;
|
|
533
533
|
if (d) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
534
534
|
const F = N(() => me.isValidElement(n) && me.isValidElement(t), [n, t]), g = N(() => {
|
|
535
535
|
let M = null;
|
|
@@ -543,32 +543,32 @@ const lo = Se(Le((i, e) => {
|
|
|
543
543
|
const [C, { width: m, height: E }] = fe(), [D, { width: G, height: W }] = fe(), Y = o === "row" ? G : W, X = o === "row" ? m : E, $ = N(() => ((M, H, q, U) => {
|
|
544
544
|
const ae = [null, null], oe = [null, null];
|
|
545
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 - q, 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) };
|
|
546
|
-
let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H - q,
|
|
547
|
-
ze = (_e(U.maxAfter, H, !1) ?? q) - q, Fe = _e(U.minAfter, H, !1) ?? H,
|
|
548
|
-
const
|
|
549
|
-
return oe[0] =
|
|
550
|
-
})(B, X, Y, g), [g, B, X, Y, o]), [I, j] = Q(!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:
|
|
546
|
+
let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H - q, ct = _e(U.minBefore, ee, !0) ?? 0, Qt = _e(U.maxBefore, ee, !0) ?? ee, ze = 0, Fe = 0, ht = 0, ut = ee;
|
|
547
|
+
ze = (_e(U.maxAfter, H, !1) ?? q) - q, 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
|
+
const en = Math.max(0, Math.min(100, he / ee * 100));
|
|
549
|
+
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] = Q(!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
551
|
const H = ue(M, r === null);
|
|
552
552
|
p(H);
|
|
553
553
|
}, [r]), De = T((M) => {
|
|
554
554
|
if (x || !I) return;
|
|
555
|
-
const H =
|
|
555
|
+
const H = at.current?.getBoundingClientRect();
|
|
556
556
|
let q = 0;
|
|
557
557
|
q = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - H.x : (M.clientY ?? M.touches?.[0]?.clientY) - H.y, q = Math.max(0, Math.min(X, q)), g.fixedPaneOffset === 1 && (q = X - q), s && B.pixels === q || p({ pixels: q, percent: null }), ge?.(q), M.stopPropagation(), M.preventDefault();
|
|
558
|
-
}, [g, o, x, I, B, X]),
|
|
559
|
-
if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup",
|
|
558
|
+
}, [g, o, x, I, B, X]), lt = T((M) => {
|
|
559
|
+
if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup", lt), !!I && (j(!1), !!B)) {
|
|
560
560
|
if (ye(B.pixels), !ue(s, r === null) || B.pixels !== s) {
|
|
561
561
|
const H = { ...B };
|
|
562
562
|
H.percent === null && (H.percent = H.pixels / X * 100), v(H);
|
|
563
563
|
}
|
|
564
564
|
M.stopPropagation(), M.preventDefault();
|
|
565
565
|
}
|
|
566
|
-
}, [B, I, s, r, X]),
|
|
567
|
-
|
|
568
|
-
}, [
|
|
569
|
-
return be("div", { ref: He([C,
|
|
566
|
+
}, [B, I, s, r, X]), jt = T((M) => {
|
|
567
|
+
rt?.(M), M.defaultPrevented || x || I || (j(!0), ne(), document.addEventListener("pointermove", De, { passive: !1 }), document.addEventListener("touchmove", De, { passive: !1 }), document.addEventListener("pointerup", lt, { passive: !1 }));
|
|
568
|
+
}, [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
|
+
return be("div", { ref: He([C, at]), className: ve("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: I }, w), style: Yt, children: [qt, Ut, Jt] });
|
|
570
570
|
}));
|
|
571
|
-
function
|
|
571
|
+
function uo(i) {
|
|
572
572
|
const [e, t] = Q(typeof window < "u" ? window.devicePixelRatio : 1), n = A(null);
|
|
573
573
|
return V(() => {
|
|
574
574
|
if (!(typeof window < "u" && "matchMedia" in window)) return;
|
|
@@ -581,12 +581,12 @@ function ho(i) {
|
|
|
581
581
|
};
|
|
582
582
|
}, [i]), e;
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function po(i) {
|
|
585
585
|
if (typeof window > "u") return 1;
|
|
586
586
|
const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e;
|
|
587
587
|
return Math.min(Math.max(1, n ? Math.floor(o) : o), t);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function _o(i, e, t) {
|
|
590
590
|
const n = T(e, [e]);
|
|
591
591
|
V(() => {
|
|
592
592
|
const o = (r) => {
|
|
@@ -597,7 +597,7 @@ function po(i, e, t) {
|
|
|
597
597
|
};
|
|
598
598
|
}, [i]);
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Kn(i) {
|
|
601
601
|
if (!i) throw new Error("must have a PointerHandlerOptions");
|
|
602
602
|
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
603
|
x.current && (clearTimeout(x.current), x.current = null);
|
|
@@ -632,12 +632,12 @@ function On(i) {
|
|
|
632
632
|
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
633
|
}, [h, o]);
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
635
|
+
function mo(i, e) {
|
|
636
|
+
return Kn({ onPointerDown: i, onPointerMoveOrWait: (t, n, o) => {
|
|
637
637
|
i?.(o);
|
|
638
638
|
}, ...e });
|
|
639
639
|
}
|
|
640
|
-
const
|
|
640
|
+
const Hn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
641
641
|
const n = A(i);
|
|
642
642
|
if (typeof e != "function") throw new Error("function expected as hook body parameter. got " + typeof e);
|
|
643
643
|
const o = e();
|
|
@@ -647,12 +647,12 @@ const Kn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
|
647
647
|
}, qe = (i) => {
|
|
648
648
|
console && console.warn && console.warn(i);
|
|
649
649
|
}, Ye = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
650
|
-
let
|
|
650
|
+
let Rn = 1, Je = !1, $t = !1;
|
|
651
651
|
const Oe = [], xe = [], Re = () => {
|
|
652
652
|
xe.forEach((i) => i());
|
|
653
|
-
},
|
|
653
|
+
}, Vn = ({ automaticContainerInternalUseOnly: i }) => {
|
|
654
654
|
const [e, t] = Q([]), n = A([]);
|
|
655
|
-
return n.current = e, i || Je !== !1 || (
|
|
655
|
+
return n.current = e, i || Je !== !1 || ($t = !0), V(() => {
|
|
656
656
|
let o = !0;
|
|
657
657
|
function r() {
|
|
658
658
|
if (o) return xe[0] !== r ? (i || Je !== !0 || qe("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([...Oe]);
|
|
@@ -660,42 +660,45 @@ const Oe = [], xe = [], Re = () => {
|
|
|
660
660
|
return xe.push(r), Re(), () => {
|
|
661
661
|
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
662
|
};
|
|
663
|
-
}, [i]), L(Me, { children: e.map(({ hook: o, key: r }) =>
|
|
664
|
-
},
|
|
665
|
-
const e =
|
|
666
|
-
return Oe.push({ hook: i, key: e }), xe.length === 0 &&
|
|
663
|
+
}, [i]), L(Me, { children: e.map(({ hook: o, key: r }) => on(Hn, { ...o, key: r })) });
|
|
664
|
+
}, Fn = (i) => {
|
|
665
|
+
const e = Rn++;
|
|
666
|
+
return Oe.push({ hook: i, key: e }), xe.length === 0 && $t === !1 && (Je = !0, ((t) => {
|
|
667
667
|
if (Ye.document && Ye.document.createElement) {
|
|
668
668
|
const n = Ye.document.createElement("div");
|
|
669
|
-
|
|
669
|
+
sn(n).render(L(t, { automaticContainerInternalUseOnly: !0 }));
|
|
670
670
|
} 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
|
-
})(
|
|
671
|
+
})(Vn)), Re(), () => {
|
|
672
672
|
Oe.splice(Oe.findIndex((t) => t.key === e), 1), Re();
|
|
673
673
|
};
|
|
674
|
-
}
|
|
674
|
+
};
|
|
675
|
+
let Qe = null;
|
|
676
|
+
Qe || (Qe = (i, e, t = {}) => {
|
|
675
677
|
let n, o, r = !1, s = !1, l = [], { unmountIfNoConsumers: a = !1 } = t;
|
|
676
678
|
const c = (u) => {
|
|
677
|
-
o = u,
|
|
679
|
+
o = u, ln(() => l.forEach((d) => d(u)));
|
|
678
680
|
}, h = () => (s || (o = typeof i == "function" ? i() : i, s = !0), o);
|
|
679
681
|
return () => {
|
|
680
682
|
const [u, d] = Q(h);
|
|
681
|
-
return V(() => (r || (r = !0, n =
|
|
683
|
+
return V(() => (r || (r = !0, n = Fn({ initValue: i, useHookBody: e, applyStateChange: c })), l.push(d), o !== u && d(o), () => {
|
|
682
684
|
l.splice(l.indexOf(d), 1), l.length === 0 && a && (n(), r = !1);
|
|
683
685
|
}), []), u;
|
|
684
686
|
};
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
+
});
|
|
688
|
+
const Ot = Qe;
|
|
689
|
+
let Kt = () => {
|
|
687
690
|
console.warn("You must call useEditMode before setting its state.");
|
|
688
691
|
};
|
|
689
|
-
const
|
|
692
|
+
const In = Ot(null, () => {
|
|
690
693
|
const [i, e] = Q(null);
|
|
691
|
-
return
|
|
692
|
-
}),
|
|
693
|
-
const i =
|
|
694
|
+
return Kt = e, i;
|
|
695
|
+
}), fo = () => {
|
|
696
|
+
const i = In();
|
|
694
697
|
return N(() => ({ setMode: (e) => {
|
|
695
|
-
|
|
698
|
+
Kt((t) => (typeof e == "function" && (e = e(t)), e?.onModeChange?.(e ?? null), e));
|
|
696
699
|
}, getMode: () => i }), [i]);
|
|
697
700
|
};
|
|
698
|
-
class
|
|
701
|
+
class et {
|
|
699
702
|
constructor(e, t, n, o) {
|
|
700
703
|
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 = () => {
|
|
701
704
|
console.log(`implement: ${this.label()} : ${this.description()}`);
|
|
@@ -806,9 +809,9 @@ class Qe {
|
|
|
806
809
|
}), t;
|
|
807
810
|
}
|
|
808
811
|
}
|
|
809
|
-
class Xe extends
|
|
812
|
+
class Xe extends et {
|
|
810
813
|
}
|
|
811
|
-
class
|
|
814
|
+
class Ht {
|
|
812
815
|
constructor(e, t) {
|
|
813
816
|
this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = te.uuidV4(), this._target = e, this._groupKey = t ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(t, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
|
|
814
817
|
const n = this;
|
|
@@ -835,7 +838,7 @@ class Kt {
|
|
|
835
838
|
a && (o = a), l = l._parent;
|
|
836
839
|
}
|
|
837
840
|
}
|
|
838
|
-
o || (o = new
|
|
841
|
+
o || (o = new Ht(e, t), o._parent = this, o._root = this._root, o._unListenersByCommand = null, o._listenersByKey = null, o._commandsPropertyListener = null);
|
|
839
842
|
const r = (l, a) => {
|
|
840
843
|
!l.has(t) || n ? l.set(t, a) : n === void 0 && console.warn("commandGroup already registered", t);
|
|
841
844
|
};
|
|
@@ -962,16 +965,16 @@ class Kt {
|
|
|
962
965
|
}), e;
|
|
963
966
|
}
|
|
964
967
|
}
|
|
965
|
-
const
|
|
968
|
+
const Nn = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "Cmd" : "Ctrl", Wn = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "⌘" : "^", Te = (i, e = !1) => {
|
|
966
969
|
const t = {};
|
|
967
970
|
for (let o = 0; i.modifiers && o < i.modifiers.length; o++) t[i.modifiers[o]] = !0;
|
|
968
971
|
let n = "";
|
|
969
|
-
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ?
|
|
972
|
+
return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ? Wn : Nn)), t?.[Z.Alt] && (n += e ? "⌥" : "Alt"), t?.[Z.Shift] && (n += (n.length > 0 ? "+" : "") + (e ? "⇧" : "Shift")), n += (n.length > 0 ? "+" : "") + kt(i.key), n;
|
|
970
973
|
};
|
|
971
|
-
function
|
|
974
|
+
function go(i, e = null) {
|
|
972
975
|
const t = A(e);
|
|
973
976
|
t.current = e;
|
|
974
|
-
const [n, o] =
|
|
977
|
+
const [n, o] = rn((s) => s + 1, 0), r = N(() => Array.isArray(i) ? i : [i], [i]);
|
|
975
978
|
return V(() => {
|
|
976
979
|
if (!r || r.length === 0) return;
|
|
977
980
|
const s = (c, h) => {
|
|
@@ -1000,7 +1003,7 @@ const $e = (i, e) => {
|
|
|
1000
1003
|
}
|
|
1001
1004
|
return t;
|
|
1002
1005
|
};
|
|
1003
|
-
function
|
|
1006
|
+
function yo(i, e = null, t = null, n) {
|
|
1004
1007
|
const o = A(t);
|
|
1005
1008
|
o.current = t, e && !Array.isArray(e) && (e = [e]);
|
|
1006
1009
|
const [r, s] = Q($e(i, e)), l = n ? [...n, i] : [i];
|
|
@@ -1019,13 +1022,13 @@ function go(i, e = null, t = null, n) {
|
|
|
1019
1022
|
};
|
|
1020
1023
|
}, l), r;
|
|
1021
1024
|
}
|
|
1022
|
-
const
|
|
1025
|
+
const vo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Yn = Ot({ setClipboard: (i) => {
|
|
1023
1026
|
throw new Error("This is only available via the useClipboard.");
|
|
1024
1027
|
}, getClipboard: () => Ke.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1025
1028
|
const [i, e] = Q(Ke.Global);
|
|
1026
1029
|
return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy: A(null), refNativeLastKey: A(null) };
|
|
1027
|
-
}),
|
|
1028
|
-
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, notifier: r =
|
|
1030
|
+
}), xo = (i) => {
|
|
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 } = Yn(), u = c();
|
|
1029
1032
|
N(() => {
|
|
1030
1033
|
const _ = e?.element, y = t?.element ?? e?.element;
|
|
1031
1034
|
if (!s) return;
|
|
@@ -1115,7 +1118,7 @@ const yo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Wn = $t({ setClipboard:
|
|
|
1115
1118
|
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 });
|
|
1116
1119
|
}, [e, t, s]), { paste: P, copy: w, clipboard: u };
|
|
1117
1120
|
};
|
|
1118
|
-
function
|
|
1121
|
+
function bo(i, e = !0) {
|
|
1119
1122
|
const t = A(i);
|
|
1120
1123
|
V(() => {
|
|
1121
1124
|
if (e) {
|
|
@@ -1125,16 +1128,16 @@ function xo(i, e = !0) {
|
|
|
1125
1128
|
t.current = i;
|
|
1126
1129
|
});
|
|
1127
1130
|
}
|
|
1128
|
-
let je = !1,
|
|
1129
|
-
var
|
|
1130
|
-
const
|
|
1131
|
-
const [i, e] = me.useState(() => je ?
|
|
1132
|
-
return
|
|
1133
|
-
i == null && e(
|
|
1131
|
+
let je = !1, Xn = 0;
|
|
1132
|
+
var jn = typeof document < "u" ? Ve : V;
|
|
1133
|
+
const bt = () => "sheetxl-ui-" + Xn++, wt = me.useId, wo = wt ?? function() {
|
|
1134
|
+
const [i, e] = me.useState(() => je ? bt() : void 0);
|
|
1135
|
+
return jn(() => {
|
|
1136
|
+
i == null && e(bt());
|
|
1134
1137
|
}, []), me.useEffect(() => {
|
|
1135
1138
|
je || (je = !0);
|
|
1136
1139
|
}, []), i;
|
|
1137
|
-
},
|
|
1140
|
+
}, St = "Undo the last action.", Lt = "Repeat the last action or undo the redo.", Un = (i) => `Redo ${i}`, So = ({ manager: i, commands: e, disabled: t, notifier: n = Bt }) => {
|
|
1138
1141
|
const o = T((s) => {
|
|
1139
1142
|
try {
|
|
1140
1143
|
i?.undo(s);
|
|
@@ -1151,16 +1154,16 @@ const xt = () => "sheetxl-ui-" + Yn++, bt = me.useId, bo = bt ?? function() {
|
|
|
1151
1154
|
return N(() => {
|
|
1152
1155
|
if (!e) return;
|
|
1153
1156
|
const s = { contains: (a) => !0, focus() {
|
|
1154
|
-
} }, l = [new
|
|
1157
|
+
} }, l = [new et("undo", s, { label: "Undo", description: St, shortcut: { key: "z", modifiers: [Z.Ctrl] }, disabled: !0 }, o), new et("redo", s, { label: "Redo", description: Lt, shortcut: [{ key: "y", modifiers: [Z.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [Z.Alt] }], disabled: !0 }, r)];
|
|
1155
1158
|
e?.addCommands(l, !0);
|
|
1156
1159
|
}, [e]), V(() => {
|
|
1157
1160
|
if (!e) return;
|
|
1158
1161
|
const s = () => {
|
|
1159
1162
|
const a = i?.getTopUndoDescription(), c = {};
|
|
1160
1163
|
var h;
|
|
1161
|
-
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: a ? (h = a, `Undo ${h}`) :
|
|
1164
|
+
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: a ? (h = a, `Undo ${h}`) : St, state: c, context: { undoManager: i } });
|
|
1162
1165
|
const u = i?.getTopRedoDescription();
|
|
1163
|
-
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ?
|
|
1166
|
+
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ? Un(u) : Lt, state: c, context: { undoManager: i } });
|
|
1164
1167
|
};
|
|
1165
1168
|
if (s(), !i) return;
|
|
1166
1169
|
const l = i.addListener({ onStackChange() {
|
|
@@ -1170,48 +1173,48 @@ const xt = () => "sheetxl-ui-" + Yn++, bt = me.useId, bo = bt ?? function() {
|
|
|
1170
1173
|
}, [i, e, t]), { undo: o, redo: r };
|
|
1171
1174
|
};
|
|
1172
1175
|
export {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1176
|
+
et as Command,
|
|
1177
|
+
vo as CommandButtonType,
|
|
1178
|
+
Ht as CommandGroup,
|
|
1179
|
+
Bt as DefaultNotifier,
|
|
1180
|
+
ao as FocusKeyNavigation,
|
|
1181
|
+
eo as HorizontalAlignment,
|
|
1182
|
+
to as KeyCodes,
|
|
1180
1183
|
Z as KeyModifiers,
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1184
|
+
no as MouseButtonCodes,
|
|
1185
|
+
vt as NotificationType,
|
|
1186
|
+
ro as ReactUtils,
|
|
1187
|
+
co as RoundedTab,
|
|
1188
|
+
Tn as ScrollPane,
|
|
1189
|
+
io as ScrollUtils,
|
|
1190
|
+
tt as Scrollbar,
|
|
1188
1191
|
re as ScrollbarOrientation,
|
|
1189
1192
|
Xe as SimpleCommand,
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1193
|
+
ho as SplitPane,
|
|
1194
|
+
On as SplitPaneResizer,
|
|
1195
|
+
lo as ToolTipPlacement,
|
|
1196
|
+
Bn as VirtualScrollbar,
|
|
1197
|
+
En as defaultCreateScrollCorner,
|
|
1198
|
+
oo as defaultCreateScrollEdgeButton,
|
|
1199
|
+
un as defaultCreateScrollEndButton,
|
|
1200
|
+
hn as defaultCreateScrollStartButton,
|
|
1201
|
+
yt as defaultCreateScrollbar,
|
|
1202
|
+
po as getDevicePixelRatio,
|
|
1203
|
+
Mn as getPortalContainer,
|
|
1201
1204
|
Te as toShortcutString,
|
|
1202
1205
|
T as useCallbackRef,
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1206
|
+
go as useCommand,
|
|
1207
|
+
yo as useCommands,
|
|
1208
|
+
xo as useCopyPaste,
|
|
1209
|
+
uo as useDevicePixelRatio,
|
|
1210
|
+
fo as useEditMode,
|
|
1211
|
+
so as useFullscreenPortal,
|
|
1212
|
+
Yn as useGlobalClipboard,
|
|
1213
|
+
wo as useId,
|
|
1214
|
+
At as useImperativeElement,
|
|
1215
|
+
mo as useMouseDownAndHoldListener,
|
|
1216
|
+
_o as useOnClickOrFocusAway,
|
|
1217
|
+
Kn as useSynchronizedPointerHandler,
|
|
1218
|
+
bo as useTraceUpdate,
|
|
1219
|
+
So as useUndoManager
|
|
1217
1220
|
};
|