react-sync-board 1.1.0 → 1.1.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/dist/react-sync-board.js
CHANGED
|
@@ -28,14 +28,14 @@ function Yr() {
|
|
|
28
28
|
return we;
|
|
29
29
|
Tt = 1;
|
|
30
30
|
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
31
|
-
function a(u, l,
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
for (
|
|
35
|
-
n.call(l,
|
|
31
|
+
function a(u, l, d) {
|
|
32
|
+
var f, c = {}, b = null, _ = null;
|
|
33
|
+
d !== void 0 && (b = "" + d), l.key !== void 0 && (b = "" + l.key), l.ref !== void 0 && (_ = l.ref);
|
|
34
|
+
for (f in l)
|
|
35
|
+
n.call(l, f) && !s.hasOwnProperty(f) && (c[f] = l[f]);
|
|
36
36
|
if (u && u.defaultProps)
|
|
37
|
-
for (
|
|
38
|
-
c[
|
|
37
|
+
for (f in l = u.defaultProps, l)
|
|
38
|
+
c[f] === void 0 && (c[f] = l[f]);
|
|
39
39
|
return { $$typeof: t, type: u, key: b, ref: _, props: c, _owner: o.current };
|
|
40
40
|
}
|
|
41
41
|
return we.Fragment = r, we.jsx = a, we.jsxs = a, we;
|
|
@@ -53,7 +53,7 @@ var Ce = {};
|
|
|
53
53
|
var kt;
|
|
54
54
|
function Br() {
|
|
55
55
|
return kt || (kt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
|
-
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"),
|
|
56
|
+
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), c = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), w = Symbol.iterator, m = "@@iterator";
|
|
57
57
|
function E(i) {
|
|
58
58
|
if (i === null || typeof i != "object")
|
|
59
59
|
return null;
|
|
@@ -81,7 +81,7 @@ function Br() {
|
|
|
81
81
|
var p = !1, h = !1, v = !1, C = !1, D = !1, k;
|
|
82
82
|
k = Symbol.for("react.module.reference");
|
|
83
83
|
function P(i) {
|
|
84
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || D || i === o || i ===
|
|
84
|
+
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || D || i === o || i === d || i === f || C || i === _ || p || h || v || typeof i == "object" && i !== null && (i.$$typeof === b || i.$$typeof === c || i.$$typeof === a || i.$$typeof === u || i.$$typeof === l || // This needs to include all possible module reference object
|
|
85
85
|
// types supported by any Flight configuration anywhere since
|
|
86
86
|
// we don't know which Flight build this will end up being used
|
|
87
87
|
// with.
|
|
@@ -113,9 +113,9 @@ function Br() {
|
|
|
113
113
|
return "Profiler";
|
|
114
114
|
case o:
|
|
115
115
|
return "StrictMode";
|
|
116
|
-
case f:
|
|
117
|
-
return "Suspense";
|
|
118
116
|
case d:
|
|
117
|
+
return "Suspense";
|
|
118
|
+
case f:
|
|
119
119
|
return "SuspenseList";
|
|
120
120
|
}
|
|
121
121
|
if (typeof i == "object")
|
|
@@ -309,9 +309,9 @@ function Br() {
|
|
|
309
309
|
if (typeof i == "string")
|
|
310
310
|
return he(i);
|
|
311
311
|
switch (i) {
|
|
312
|
-
case f:
|
|
313
|
-
return he("Suspense");
|
|
314
312
|
case d:
|
|
313
|
+
return he("Suspense");
|
|
314
|
+
case f:
|
|
315
315
|
return he("SuspenseList");
|
|
316
316
|
}
|
|
317
317
|
if (typeof i == "object")
|
|
@@ -782,7 +782,7 @@ const Xr = ({
|
|
|
782
782
|
LoadingComponent: n = Wr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
785
|
-
const [s, a] = g.useState(!1), [u, l] = g.useState(!1), [
|
|
785
|
+
const [s, a] = g.useState(!1), [u, l] = g.useState(!1), [d, f] = g.useState(null), c = g.useRef(null), b = g.useRef(!1), _ = be(ot), w = g.useRef(!1);
|
|
786
786
|
return g.useEffect(() => (b.current = !0, () => {
|
|
787
787
|
b.current = !1;
|
|
788
788
|
}), []), g.useEffect(() => {
|
|
@@ -801,25 +801,25 @@ const Xr = ({
|
|
|
801
801
|
console.log(`Is now master on channel ${r}…`), b.current && l(!0);
|
|
802
802
|
},
|
|
803
803
|
onJoined: (m) => {
|
|
804
|
-
console.log(`Connected on channel ${r}…`), c.current = m, b.current && (
|
|
804
|
+
console.log(`Connected on channel ${r}…`), c.current = m, b.current && (f(m), a(!0));
|
|
805
805
|
}
|
|
806
806
|
})), () => {
|
|
807
807
|
var m;
|
|
808
808
|
(m = c.current) == null || m.leave();
|
|
809
|
-
}) : null, [r, t, e]), !s || !
|
|
809
|
+
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */ T(n, {}) : /* @__PURE__ */ T(
|
|
810
810
|
ot.Provider,
|
|
811
811
|
{
|
|
812
|
-
value: { ..._, [r]: { wire:
|
|
812
|
+
value: { ..._, [r]: { wire: d, joined: s, isMaster: u, room: t } },
|
|
813
813
|
children: o
|
|
814
814
|
}
|
|
815
815
|
);
|
|
816
816
|
}, Be = (e = "default") => (be(ot) || {})[e], Pt = (e) => {
|
|
817
817
|
let t;
|
|
818
|
-
const r = /* @__PURE__ */ new Set(), n = (l,
|
|
819
|
-
const
|
|
820
|
-
if (!Object.is(
|
|
818
|
+
const r = /* @__PURE__ */ new Set(), n = (l, d) => {
|
|
819
|
+
const f = typeof l == "function" ? l(t) : l;
|
|
820
|
+
if (!Object.is(f, t)) {
|
|
821
821
|
const c = t;
|
|
822
|
-
t =
|
|
822
|
+
t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((b) => b(t, c));
|
|
823
823
|
}
|
|
824
824
|
}, o = () => t, u = { setState: n, getState: o, subscribe: (l) => (r.add(l), () => r.delete(l)), destroy: () => {
|
|
825
825
|
({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && console.warn(
|
|
@@ -882,11 +882,11 @@ function Kr() {
|
|
|
882
882
|
return !0;
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function d(c, b) {
|
|
886
886
|
return b();
|
|
887
887
|
}
|
|
888
|
-
var
|
|
889
|
-
return Ze.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore :
|
|
888
|
+
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : u;
|
|
889
|
+
return Ze.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, Ze;
|
|
890
890
|
}
|
|
891
891
|
var Qe = {};
|
|
892
892
|
/**
|
|
@@ -923,9 +923,9 @@ function Hr() {
|
|
|
923
923
|
function o(y, p) {
|
|
924
924
|
return y === p && (y !== 0 || 1 / y === 1 / p) || y !== y && p !== p;
|
|
925
925
|
}
|
|
926
|
-
var s = typeof Object.is == "function" ? Object.is : o, a = e.useState, u = e.useEffect, l = e.useLayoutEffect,
|
|
926
|
+
var s = typeof Object.is == "function" ? Object.is : o, a = e.useState, u = e.useEffect, l = e.useLayoutEffect, d = e.useDebugValue, f = !1, c = !1;
|
|
927
927
|
function b(y, p, h) {
|
|
928
|
-
|
|
928
|
+
f || e.startTransition !== void 0 && (f = !0, r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
929
929
|
var v = p();
|
|
930
930
|
if (!c) {
|
|
931
931
|
var C = p();
|
|
@@ -951,7 +951,7 @@ function Hr() {
|
|
|
951
951
|
});
|
|
952
952
|
};
|
|
953
953
|
return y(M);
|
|
954
|
-
}, [y]),
|
|
954
|
+
}, [y]), d(v), v;
|
|
955
955
|
}
|
|
956
956
|
function _(y) {
|
|
957
957
|
var p = y.getSnapshot, h = y.value;
|
|
@@ -990,11 +990,11 @@ function qr() {
|
|
|
990
990
|
return Je;
|
|
991
991
|
$t = 1;
|
|
992
992
|
var e = g, t = tr();
|
|
993
|
-
function r(
|
|
994
|
-
return
|
|
993
|
+
function r(d, f) {
|
|
994
|
+
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
996
996
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
997
|
-
return Je.useSyncExternalStoreWithSelector = function(
|
|
997
|
+
return Je.useSyncExternalStoreWithSelector = function(d, f, c, b, _) {
|
|
998
998
|
var w = s(null);
|
|
999
999
|
if (w.current === null) {
|
|
1000
1000
|
var m = { hasValue: !1, value: null };
|
|
@@ -1018,12 +1018,12 @@ function qr() {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
var x = !1, y, p, h = c === void 0 ? null : c;
|
|
1020
1020
|
return [function() {
|
|
1021
|
-
return R(
|
|
1021
|
+
return R(f());
|
|
1022
1022
|
}, h === null ? void 0 : function() {
|
|
1023
1023
|
return R(h());
|
|
1024
1024
|
}];
|
|
1025
|
-
}, [
|
|
1026
|
-
var E = o(
|
|
1025
|
+
}, [f, c, b, _]);
|
|
1026
|
+
var E = o(d, w[0], w[1]);
|
|
1027
1027
|
return a(function() {
|
|
1028
1028
|
m.hasValue = !0, m.value = E;
|
|
1029
1029
|
}, [E]), l(E), E;
|
|
@@ -1044,11 +1044,11 @@ function Gr() {
|
|
|
1044
1044
|
return At || (At = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1045
1045
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1046
1046
|
var e = g, t = tr();
|
|
1047
|
-
function r(
|
|
1048
|
-
return
|
|
1047
|
+
function r(f, c) {
|
|
1048
|
+
return f === c && (f !== 0 || 1 / f === 1 / c) || f !== f && c !== c;
|
|
1049
1049
|
}
|
|
1050
1050
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
1051
|
-
function f
|
|
1051
|
+
function d(f, c, b, _, w) {
|
|
1052
1052
|
var m = s(null), E;
|
|
1053
1053
|
m.current === null ? (E = {
|
|
1054
1054
|
hasValue: !1,
|
|
@@ -1077,12 +1077,12 @@ function Gr() {
|
|
|
1077
1077
|
return D(k());
|
|
1078
1078
|
};
|
|
1079
1079
|
return [P, M];
|
|
1080
|
-
}, [c, b, _, w]), x = R[0], y = R[1], p = o(
|
|
1080
|
+
}, [c, b, _, w]), x = R[0], y = R[1], p = o(f, x, y);
|
|
1081
1081
|
return a(function() {
|
|
1082
1082
|
E.hasValue = !0, E.value = p;
|
|
1083
1083
|
}, [p]), l(p), p;
|
|
1084
1084
|
}
|
|
1085
|
-
et.useSyncExternalStoreWithSelector =
|
|
1085
|
+
et.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
1086
1086
|
}()), et;
|
|
1087
1087
|
}
|
|
1088
1088
|
(function(e) {
|
|
@@ -1122,14 +1122,14 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1122
1122
|
const s = it(t, o);
|
|
1123
1123
|
if (!s)
|
|
1124
1124
|
return null;
|
|
1125
|
-
const { left: a, right: u, top: l, bottom:
|
|
1126
|
-
let
|
|
1127
|
-
return n ?
|
|
1125
|
+
const { left: a, right: u, top: l, bottom: d } = s.getBoundingClientRect();
|
|
1126
|
+
let f;
|
|
1127
|
+
return n ? f = n : f = {
|
|
1128
1128
|
left: a,
|
|
1129
1129
|
top: l,
|
|
1130
1130
|
right: u,
|
|
1131
|
-
bottom:
|
|
1132
|
-
},
|
|
1131
|
+
bottom: d
|
|
1132
|
+
}, f.left = Math.min(a, f.left), f.top = Math.min(l, f.top), f.right = Math.max(u, f.right), f.bottom = Math.max(d, f.bottom), f;
|
|
1133
1133
|
}, null);
|
|
1134
1134
|
return r && (r.width = r.right - r.left, r.height = r.bottom - r.top, r);
|
|
1135
1135
|
}, tn = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset: a = { x: 0, y: 0 } }) => {
|
|
@@ -1137,24 +1137,24 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1137
1137
|
e + r / 2 - a.x,
|
|
1138
1138
|
t + n / 2 - a.y
|
|
1139
1139
|
];
|
|
1140
|
-
let
|
|
1140
|
+
let d, f, c, b, _, w, m, E, R, x;
|
|
1141
1141
|
const y = s / 1.1547;
|
|
1142
1142
|
switch (o) {
|
|
1143
1143
|
case "grid":
|
|
1144
|
-
|
|
1144
|
+
d = Math.round(u / s) * s, f = Math.round(l / s) * s;
|
|
1145
1145
|
break;
|
|
1146
1146
|
case "hexH":
|
|
1147
|
-
c = 2 * y, b = 3 * s, _ = Math.round(u / c) * c, m = Math.round(l / b) * b, w = _ > u ? _ - y : _ + y, E = m > l ? m - 1.5 * s : m + 1.5 * s, R = Math.hypot(_ - u, m - l), x = Math.hypot(w - u, E - l), R < x ? (
|
|
1147
|
+
c = 2 * y, b = 3 * s, _ = Math.round(u / c) * c, m = Math.round(l / b) * b, w = _ > u ? _ - y : _ + y, E = m > l ? m - 1.5 * s : m + 1.5 * s, R = Math.hypot(_ - u, m - l), x = Math.hypot(w - u, E - l), R < x ? (d = _, f = m) : (d = w, f = E);
|
|
1148
1148
|
break;
|
|
1149
1149
|
case "hexV":
|
|
1150
|
-
c = 3 * s, b = 2 * y, _ = Math.round(u / c) * c, m = Math.round(l / b) * b, w = _ > u ? _ - 1.5 * s : _ + 1.5 * s, E = m > l ? m - y : m + y, R = Math.hypot(_ - u, m - l), x = Math.hypot(w - u, E - l), R < x ? (
|
|
1150
|
+
c = 3 * s, b = 2 * y, _ = Math.round(u / c) * c, m = Math.round(l / b) * b, w = _ > u ? _ - 1.5 * s : _ + 1.5 * s, E = m > l ? m - y : m + y, R = Math.hypot(_ - u, m - l), x = Math.hypot(w - u, E - l), R < x ? (d = _, f = m) : (d = w, f = E);
|
|
1151
1151
|
break;
|
|
1152
1152
|
default:
|
|
1153
|
-
|
|
1153
|
+
d = e + r / 2, f = t + n / 2;
|
|
1154
1154
|
}
|
|
1155
1155
|
return {
|
|
1156
|
-
x:
|
|
1157
|
-
y:
|
|
1156
|
+
x: d + a.x - r / 2,
|
|
1157
|
+
y: f + a.y - n / 2
|
|
1158
1158
|
};
|
|
1159
1159
|
}, zt = [
|
|
1160
1160
|
"#037758",
|
|
@@ -1213,9 +1213,9 @@ const _e = (e, t) => e.classList && e.classList.contains(t), Te = (e, t) => _e(e
|
|
|
1213
1213
|
})
|
|
1214
1214
|
), s({ ready: !0 });
|
|
1215
1215
|
})();
|
|
1216
|
-
const
|
|
1216
|
+
const f = o(s, a, u), c = { ...f }, b = Object.fromEntries(
|
|
1217
1217
|
// Send the update message on all method calls
|
|
1218
|
-
Object.entries(
|
|
1218
|
+
Object.entries(f).map(([_, w]) => typeof w == "function" && !_.startsWith("get") && !r.includes(_) ? [_, (...E) => {
|
|
1219
1219
|
const R = w(...E);
|
|
1220
1220
|
return e.publish(`${t}_call`, [_, E]), R;
|
|
1221
1221
|
}] : [_, w])
|
|
@@ -1479,15 +1479,15 @@ function ft(e, t, r, n = 0) {
|
|
|
1479
1479
|
const l = () => {
|
|
1480
1480
|
if (!a.current)
|
|
1481
1481
|
return;
|
|
1482
|
-
const
|
|
1483
|
-
a.current = void 0, e.apply(
|
|
1484
|
-
},
|
|
1485
|
-
o.current && clearTimeout(o.current), a.current = { args:
|
|
1482
|
+
const f = a.current;
|
|
1483
|
+
a.current = void 0, e.apply(f.this, f.args), u();
|
|
1484
|
+
}, d = function(...f) {
|
|
1485
|
+
o.current && clearTimeout(o.current), a.current = { args: f, this: this }, o.current = setTimeout(l, r), n > 0 && !s.current && (s.current = setTimeout(l, n));
|
|
1486
1486
|
};
|
|
1487
|
-
return Object.defineProperties(
|
|
1487
|
+
return Object.defineProperties(d, {
|
|
1488
1488
|
length: { value: e.length },
|
|
1489
1489
|
name: { value: `${e.name || "anonymous"}__debounced__${r}` }
|
|
1490
|
-
}),
|
|
1490
|
+
}), d;
|
|
1491
1491
|
},
|
|
1492
1492
|
// eslint-disable-next-line react-hooks/exhaustive-deps,@typescript-eslint/no-unsafe-assignment
|
|
1493
1493
|
[r, n, ...t]
|
|
@@ -1501,23 +1501,23 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1501
1501
|
boardWrapperRect: u,
|
|
1502
1502
|
boardSize: l
|
|
1503
1503
|
}) => {
|
|
1504
|
-
const
|
|
1504
|
+
const d = {
|
|
1505
1505
|
left: -n * r + ze * r,
|
|
1506
1506
|
right: u.width - o * r - ze * r,
|
|
1507
1507
|
top: -a * r + ze * r,
|
|
1508
1508
|
bottom: u.height - s * r - ze * r,
|
|
1509
1509
|
maxRight: u.width - l * r,
|
|
1510
1510
|
maxLeft: u.height - l * r
|
|
1511
|
-
},
|
|
1512
|
-
Math.max(e,
|
|
1513
|
-
|
|
1511
|
+
}, f = Math.min(
|
|
1512
|
+
Math.max(e, d.left, d.maxRight),
|
|
1513
|
+
d.right,
|
|
1514
1514
|
0
|
|
1515
1515
|
), c = Math.min(
|
|
1516
|
-
Math.max(t,
|
|
1517
|
-
|
|
1516
|
+
Math.max(t, d.top, d.maxLeft),
|
|
1517
|
+
d.bottom,
|
|
1518
1518
|
0
|
|
1519
1519
|
);
|
|
1520
|
-
return [
|
|
1520
|
+
return [f, c];
|
|
1521
1521
|
}, dt = () => {
|
|
1522
1522
|
const [
|
|
1523
1523
|
e,
|
|
@@ -1557,7 +1557,7 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1557
1557
|
});
|
|
1558
1558
|
},
|
|
1559
1559
|
[e, n, t]
|
|
1560
|
-
),
|
|
1560
|
+
), d = g.useCallback(
|
|
1561
1561
|
(m, E) => {
|
|
1562
1562
|
const { itemExtent: R, boardWrapperRect: x, boardSize: y } = n();
|
|
1563
1563
|
let p = E;
|
|
@@ -1583,7 +1583,7 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1583
1583
|
});
|
|
1584
1584
|
},
|
|
1585
1585
|
[e, n, t]
|
|
1586
|
-
),
|
|
1586
|
+
), f = g.useCallback(
|
|
1587
1587
|
({ left: m, top: E, width: R, height: x }) => {
|
|
1588
1588
|
const { boardWrapperRect: y } = n(), p = y.width / R, h = y.height / x, C = Math.min(p, h) * mn, D = y.width / 2 - (m + R / 2) * C, k = y.height / 2 - (E + x / 2) * C;
|
|
1589
1589
|
t({
|
|
@@ -1642,9 +1642,9 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1642
1642
|
}, [c, r]), {
|
|
1643
1643
|
setDim: l,
|
|
1644
1644
|
getDim: u,
|
|
1645
|
-
zoomTo:
|
|
1646
|
-
zoomToCenter:
|
|
1647
|
-
zoomToExtent:
|
|
1645
|
+
zoomTo: d,
|
|
1646
|
+
zoomToCenter: d,
|
|
1647
|
+
zoomToExtent: f,
|
|
1648
1648
|
getCenter: b,
|
|
1649
1649
|
updateItemExtent: w
|
|
1650
1650
|
};
|
|
@@ -1676,8 +1676,8 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1676
1676
|
]), {
|
|
1677
1677
|
getItems: u,
|
|
1678
1678
|
getItemIds: l,
|
|
1679
|
-
setItemIds:
|
|
1680
|
-
updateItems:
|
|
1679
|
+
setItemIds: d,
|
|
1680
|
+
updateItems: f,
|
|
1681
1681
|
moveItems: c,
|
|
1682
1682
|
removeItemsById: b,
|
|
1683
1683
|
getItemList: _,
|
|
@@ -1712,9 +1712,9 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1712
1712
|
const U = l().filter((J) => O.includes(J)), Y = u(), W = Object.fromEntries(
|
|
1713
1713
|
U.map((J) => [J, A({ ...Y[J] })])
|
|
1714
1714
|
);
|
|
1715
|
-
|
|
1715
|
+
f(W), r();
|
|
1716
1716
|
},
|
|
1717
|
-
[l, u, r,
|
|
1717
|
+
[l, u, r, f]
|
|
1718
1718
|
), R = g.useCallback(
|
|
1719
1719
|
(O) => {
|
|
1720
1720
|
m(O), n(), r();
|
|
@@ -1735,9 +1735,9 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1735
1735
|
const $ = l(), A = $.filter((Y) => !O.includes(Y)), U = $.filter(
|
|
1736
1736
|
(Y) => O.includes(Y)
|
|
1737
1737
|
);
|
|
1738
|
-
|
|
1738
|
+
d([...A, ...U]);
|
|
1739
1739
|
},
|
|
1740
|
-
[l,
|
|
1740
|
+
[l, d]
|
|
1741
1741
|
), h = g.useCallback(
|
|
1742
1742
|
(O, { type: $, size: A } = {}) => {
|
|
1743
1743
|
const { boardWrapper: U } = a(), Y = {}, W = u();
|
|
@@ -1760,9 +1760,9 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1760
1760
|
ne
|
|
1761
1761
|
);
|
|
1762
1762
|
Y[J] = { ...te, ...V };
|
|
1763
|
-
}),
|
|
1763
|
+
}), f(Y);
|
|
1764
1764
|
},
|
|
1765
|
-
[a, u,
|
|
1765
|
+
[a, u, f]
|
|
1766
1766
|
), v = g.useCallback(
|
|
1767
1767
|
(O, $) => {
|
|
1768
1768
|
p(O), E(O, (A) => {
|
|
@@ -1779,17 +1779,17 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1779
1779
|
]
|
|
1780
1780
|
), C = g.useCallback(
|
|
1781
1781
|
(O) => {
|
|
1782
|
-
|
|
1782
|
+
d(O);
|
|
1783
1783
|
},
|
|
1784
|
-
[
|
|
1784
|
+
[d]
|
|
1785
1785
|
), D = g.useCallback(
|
|
1786
1786
|
(O) => {
|
|
1787
1787
|
const $ = l(), A = $.filter(
|
|
1788
1788
|
(Y) => O.includes(Y)
|
|
1789
1789
|
), U = $.map((Y) => O.includes(Y) ? A.pop() : Y);
|
|
1790
|
-
|
|
1790
|
+
d(U), o();
|
|
1791
1791
|
},
|
|
1792
|
-
[l, o,
|
|
1792
|
+
[l, o, d]
|
|
1793
1793
|
), k = g.useCallback(
|
|
1794
1794
|
(O, $) => {
|
|
1795
1795
|
const A = u(), U = O.map((V) => A[V]), Y = $.map((V) => A[V]), W = $.reduce((V, ee) => (V[ee] = U.shift(), V), {}), J = Y.reduce((V, ee) => {
|
|
@@ -1800,11 +1800,11 @@ const ze = 100, Se = 1e3, mn = 0.8, Nt = ({
|
|
|
1800
1800
|
};
|
|
1801
1801
|
return V[ee.id] = he, V;
|
|
1802
1802
|
}, {});
|
|
1803
|
-
|
|
1803
|
+
f(J);
|
|
1804
1804
|
const te = O.reduce((V, ee) => (V[ee] = $.shift(), V), {}), ne = l().map((V) => O.includes(V) ? te[V] : V);
|
|
1805
|
-
|
|
1805
|
+
d(ne);
|
|
1806
1806
|
},
|
|
1807
|
-
[u,
|
|
1807
|
+
[u, f, l, d]
|
|
1808
1808
|
), P = g.useCallback(
|
|
1809
1809
|
(O, $) => {
|
|
1810
1810
|
const A = t(), U = O.map((Y, W) => !Y.x || !Y.y ? { ...Y, x: A.x + 2 * W, y: A.y + 2 * W } : Y);
|
|
@@ -1958,7 +1958,7 @@ const yn = (e, t) => {
|
|
|
1958
1958
|
g.useEffect(() => (u.current = !0, () => {
|
|
1959
1959
|
u.current = !1;
|
|
1960
1960
|
}), []);
|
|
1961
|
-
const
|
|
1961
|
+
const d = g.useCallback(
|
|
1962
1962
|
(c) => {
|
|
1963
1963
|
const b = t();
|
|
1964
1964
|
if (c)
|
|
@@ -1967,8 +1967,8 @@ const yn = (e, t) => {
|
|
|
1967
1967
|
return [_, _.map((w) => b[w])];
|
|
1968
1968
|
},
|
|
1969
1969
|
[t, o]
|
|
1970
|
-
),
|
|
1971
|
-
const [c, b] =
|
|
1970
|
+
), f = Jt(() => {
|
|
1971
|
+
const [c, b] = d();
|
|
1972
1972
|
if (c.length > 0) {
|
|
1973
1973
|
if (!u.current)
|
|
1974
1974
|
return;
|
|
@@ -1985,10 +1985,10 @@ const yn = (e, t) => {
|
|
|
1985
1985
|
l(() => {
|
|
1986
1986
|
a([]);
|
|
1987
1987
|
});
|
|
1988
|
-
}, [
|
|
1988
|
+
}, [d, r]);
|
|
1989
1989
|
return vn(
|
|
1990
|
-
() =>
|
|
1991
|
-
[e, n,
|
|
1990
|
+
() => f(),
|
|
1991
|
+
[e, n, f],
|
|
1992
1992
|
100
|
|
1993
1993
|
), {
|
|
1994
1994
|
availableActions: s
|
|
@@ -2071,8 +2071,8 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2071
2071
|
}), cr = ({ storeName: e, children: t }) => {
|
|
2072
2072
|
const { wire: r, isMaster: n } = Be("room"), [o, s] = g.useState(null), [a, u] = g.useState(!1), l = g.useRef(!1);
|
|
2073
2073
|
return g.useEffect(() => {
|
|
2074
|
-
let
|
|
2075
|
-
const
|
|
2074
|
+
let d = !0;
|
|
2075
|
+
const f = [];
|
|
2076
2076
|
if (!o && !l.current)
|
|
2077
2077
|
return l.current = !0, (() => {
|
|
2078
2078
|
const b = Ne(
|
|
@@ -2093,10 +2093,10 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2093
2093
|
})
|
|
2094
2094
|
)
|
|
2095
2095
|
), _ = b.subscribe((w) => {
|
|
2096
|
-
w.ready && (_(),
|
|
2096
|
+
w.ready && (_(), d && s(b));
|
|
2097
2097
|
});
|
|
2098
2098
|
})(), () => {
|
|
2099
|
-
|
|
2099
|
+
d = !1, l.current = !1, f.forEach((b) => b());
|
|
2100
2100
|
};
|
|
2101
2101
|
}, [o, e, r, r.userId]), g.useEffect(() => {
|
|
2102
2102
|
if (o)
|
|
@@ -2108,11 +2108,11 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2108
2108
|
};
|
|
2109
2109
|
}, [n, o, r]), g.useEffect(() => {
|
|
2110
2110
|
if (o) {
|
|
2111
|
-
const
|
|
2112
|
-
o.getState().removeUser(
|
|
2111
|
+
const d = r.subscribe("userLeave", (f) => {
|
|
2112
|
+
o.getState().removeUser(f);
|
|
2113
2113
|
});
|
|
2114
2114
|
return () => {
|
|
2115
|
-
|
|
2115
|
+
d();
|
|
2116
2116
|
};
|
|
2117
2117
|
}
|
|
2118
2118
|
}, [n, o, r]), g.useEffect(() => {
|
|
@@ -2241,7 +2241,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2241
2241
|
LoadingComponent: s,
|
|
2242
2242
|
...a
|
|
2243
2243
|
}) => {
|
|
2244
|
-
const [u] = g.useState(t || me()), [l] = g.useState(r || me()), [
|
|
2244
|
+
const [u] = g.useState(t || me()), [l] = g.useState(r || me()), [d] = g.useState(() => ({
|
|
2245
2245
|
itemIds: n.map(({ id: c }) => c),
|
|
2246
2246
|
items: Object.fromEntries(n.map((c) => [c.id, c]))
|
|
2247
2247
|
}));
|
|
@@ -2254,7 +2254,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2254
2254
|
Yt,
|
|
2255
2255
|
{
|
|
2256
2256
|
storeName: `${l}_item`,
|
|
2257
|
-
defaultValue:
|
|
2257
|
+
defaultValue: d,
|
|
2258
2258
|
children: /* @__PURE__ */ T(Wt, { ...a, session: l })
|
|
2259
2259
|
}
|
|
2260
2260
|
) })
|
|
@@ -2275,7 +2275,7 @@ const ar = g.createContext(), at = (e) => {
|
|
|
2275
2275
|
Yt,
|
|
2276
2276
|
{
|
|
2277
2277
|
storeName: `${l}_item`,
|
|
2278
|
-
defaultValue:
|
|
2278
|
+
defaultValue: d,
|
|
2279
2279
|
children: /* @__PURE__ */ T(Wt, { ...a, session: l })
|
|
2280
2280
|
}
|
|
2281
2281
|
) })
|
|
@@ -2344,9 +2344,9 @@ const ie = new Pn(), We = ({
|
|
|
2344
2344
|
onLongTap: a = de,
|
|
2345
2345
|
onDoubleTap: u = de,
|
|
2346
2346
|
onZoom: l,
|
|
2347
|
-
mainAction:
|
|
2347
|
+
mainAction: d = "drag"
|
|
2348
2348
|
}) => {
|
|
2349
|
-
const
|
|
2349
|
+
const f = g.useRef(null), c = g.useRef({
|
|
2350
2350
|
moving: !1,
|
|
2351
2351
|
pointers: {},
|
|
2352
2352
|
mainPointer: void 0
|
|
@@ -2484,10 +2484,10 @@ const ie = new Pn(), We = ({
|
|
|
2484
2484
|
} else
|
|
2485
2485
|
M = y, N = p;
|
|
2486
2486
|
let K = h || v || C || D !== 1;
|
|
2487
|
-
|
|
2487
|
+
d !== "drag" && (K = !K);
|
|
2488
2488
|
const O = k !== "touch" ? !K : !P, $ = k !== "touch" ? K : P;
|
|
2489
2489
|
if (O) {
|
|
2490
|
-
c.current.gestureStart || (
|
|
2490
|
+
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout), ie.add(r, {
|
|
2491
2491
|
deltaX: 0,
|
|
2492
2492
|
deltaY: 0,
|
|
2493
2493
|
startX: c.current.startX,
|
|
@@ -2522,7 +2522,7 @@ const ie = new Pn(), We = ({
|
|
|
2522
2522
|
});
|
|
2523
2523
|
}
|
|
2524
2524
|
if ($) {
|
|
2525
|
-
c.current.gestureStart || (
|
|
2525
|
+
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout));
|
|
2526
2526
|
const A = M - c.current.prevX, U = N - c.current.prevY, { target: Y } = c.current;
|
|
2527
2527
|
if (ie.add(o, {
|
|
2528
2528
|
deltaX: A,
|
|
@@ -2574,7 +2574,7 @@ const ie = new Pn(), We = ({
|
|
|
2574
2574
|
ctrlKey: h,
|
|
2575
2575
|
metaKey: v,
|
|
2576
2576
|
event: R
|
|
2577
|
-
}),
|
|
2577
|
+
}), f.current.style.cursor = "auto";
|
|
2578
2578
|
else {
|
|
2579
2579
|
const k = Date.now();
|
|
2580
2580
|
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart - k < 300 && ie.add(s, {
|
|
@@ -2612,7 +2612,7 @@ const ie = new Pn(), We = ({
|
|
|
2612
2612
|
});
|
|
2613
2613
|
},
|
|
2614
2614
|
style: { touchAction: "none" },
|
|
2615
|
-
ref:
|
|
2615
|
+
ref: f,
|
|
2616
2616
|
children: e
|
|
2617
2617
|
}
|
|
2618
2618
|
);
|
|
@@ -2644,23 +2644,23 @@ let Mn = { data: "" }, jn = (e) => typeof window == "object" ? ((e ? e.querySele
|
|
|
2644
2644
|
return e;
|
|
2645
2645
|
}, An = (e, t, r, n, o) => {
|
|
2646
2646
|
let s = lr(e), a = ce[s] || (ce[s] = ((l) => {
|
|
2647
|
-
let
|
|
2648
|
-
for (;
|
|
2649
|
-
|
|
2650
|
-
return "go" +
|
|
2647
|
+
let d = 0, f = 11;
|
|
2648
|
+
for (; d < l.length; )
|
|
2649
|
+
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
2650
|
+
return "go" + f;
|
|
2651
2651
|
})(s));
|
|
2652
2652
|
if (!ce[a]) {
|
|
2653
|
-
let l = s !== e ? e : ((
|
|
2654
|
-
let
|
|
2655
|
-
for (;
|
|
2656
|
-
|
|
2653
|
+
let l = s !== e ? e : ((d) => {
|
|
2654
|
+
let f, c, b = [{}];
|
|
2655
|
+
for (; f = Dn.exec(d.replace($n, "")); )
|
|
2656
|
+
f[4] ? b.shift() : f[3] ? (c = f[3].replace(Kt, " ").trim(), b.unshift(b[0][c] = b[0][c] || {})) : b[0][f[1]] = f[2].replace(Kt, " ").trim();
|
|
2657
2657
|
return b[0];
|
|
2658
2658
|
})(e);
|
|
2659
2659
|
ce[a] = fe(o ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
|
|
2660
2660
|
}
|
|
2661
2661
|
let u = r && ce.g ? ce.g : null;
|
|
2662
|
-
return r && (ce.g = ce[a]), ((l,
|
|
2663
|
-
c ?
|
|
2662
|
+
return r && (ce.g = ce[a]), ((l, d, f, c) => {
|
|
2663
|
+
c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2664
2664
|
})(ce[a], t, n, u), a;
|
|
2665
2665
|
}, zn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2666
2666
|
let a = t[s];
|
|
@@ -2838,15 +2838,15 @@ const Zn = (e) => {
|
|
|
2838
2838
|
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...a } = {},
|
|
2839
2839
|
animate: u = "hvr-pop",
|
|
2840
2840
|
isSelected: l,
|
|
2841
|
-
itemMap:
|
|
2842
|
-
showResizeHandle:
|
|
2841
|
+
itemMap: d,
|
|
2842
|
+
showResizeHandle: f = !0
|
|
2843
2843
|
}) => {
|
|
2844
2844
|
var v;
|
|
2845
2845
|
const c = g.useRef(null), {
|
|
2846
2846
|
component: b = () => null,
|
|
2847
2847
|
resizeDirections: _ = eo,
|
|
2848
2848
|
resize: w = Qn
|
|
2849
|
-
} =
|
|
2849
|
+
} = d[t], m = g.useCallback(
|
|
2850
2850
|
(C) => e(n, C),
|
|
2851
2851
|
[e, n]
|
|
2852
2852
|
);
|
|
@@ -2894,7 +2894,7 @@ const Zn = (e) => {
|
|
|
2894
2894
|
{
|
|
2895
2895
|
itemId: n,
|
|
2896
2896
|
state: a,
|
|
2897
|
-
ErrorComponent: ((v =
|
|
2897
|
+
ErrorComponent: ((v = d == null ? void 0 : d.error) == null ? void 0 : v.component) || Gn,
|
|
2898
2898
|
children: /* @__PURE__ */ T(b, { ...a, id: n, setState: m })
|
|
2899
2899
|
}
|
|
2900
2900
|
),
|
|
@@ -2903,7 +2903,7 @@ const Zn = (e) => {
|
|
|
2903
2903
|
/* @__PURE__ */ T("div", { className: `corner ${xe} ${Vn}` }),
|
|
2904
2904
|
/* @__PURE__ */ T("div", { className: `corner ${xe} ${Wn}` }),
|
|
2905
2905
|
/* @__PURE__ */ T("div", { className: `${xe} ${Fn}` }),
|
|
2906
|
-
|
|
2906
|
+
f && /* @__PURE__ */ ue(Qt, { children: [
|
|
2907
2907
|
_.b && /* @__PURE__ */ T(
|
|
2908
2908
|
rt,
|
|
2909
2909
|
{
|
|
@@ -2952,56 +2952,56 @@ const Zn = (e) => {
|
|
|
2952
2952
|
y: a = 0,
|
|
2953
2953
|
layer: u = 0,
|
|
2954
2954
|
moving: l,
|
|
2955
|
-
...
|
|
2956
|
-
} = o(e, { getCurrentUser: t }),
|
|
2955
|
+
...d
|
|
2956
|
+
} = o(e, { getCurrentUser: t }), f = (u + 4) * 10 + 100 + (l ? 5 : 0);
|
|
2957
2957
|
return /* @__PURE__ */ T(
|
|
2958
2958
|
"div",
|
|
2959
2959
|
{
|
|
2960
2960
|
className: r,
|
|
2961
2961
|
style: {
|
|
2962
2962
|
transform: `translate(${s}px, ${a}px)`,
|
|
2963
|
-
zIndex:
|
|
2963
|
+
zIndex: f
|
|
2964
2964
|
},
|
|
2965
2965
|
children: /* @__PURE__ */ T(
|
|
2966
2966
|
ro,
|
|
2967
2967
|
{
|
|
2968
2968
|
...n,
|
|
2969
2969
|
showResizeHandle: n.isSelected && n.showResizeHandle,
|
|
2970
|
-
state:
|
|
2970
|
+
state: d
|
|
2971
2971
|
}
|
|
2972
2972
|
)
|
|
2973
2973
|
}
|
|
2974
2974
|
);
|
|
2975
2975
|
}, so = Zt(oo), io = () => {
|
|
2976
|
-
const { updateItem: e } = pt(), [t, r] = se((
|
|
2977
|
-
|
|
2978
|
-
|
|
2976
|
+
const { updateItem: e } = pt(), [t, r] = se((d) => [
|
|
2977
|
+
d.itemIds,
|
|
2978
|
+
d.items
|
|
2979
2979
|
]), [n, o, s, a] = Z(
|
|
2980
|
-
(
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2980
|
+
(d) => [
|
|
2981
|
+
d.config.boardSize,
|
|
2982
|
+
d.config.showResizeHandle,
|
|
2983
|
+
d.config.itemTemplates,
|
|
2984
|
+
d.selection
|
|
2985
2985
|
]
|
|
2986
|
-
), [u] = ge((
|
|
2986
|
+
), [u] = ge((d) => [d.getUser]), l = H({
|
|
2987
2987
|
position: "absolute",
|
|
2988
2988
|
top: `${n / 2}px`,
|
|
2989
2989
|
left: `${n / 2}px`,
|
|
2990
2990
|
display: "inline-block"
|
|
2991
2991
|
});
|
|
2992
|
-
return t.map((
|
|
2992
|
+
return t.map((d) => /* @__PURE__ */ T(
|
|
2993
2993
|
so,
|
|
2994
2994
|
{
|
|
2995
|
-
state: r[
|
|
2995
|
+
state: r[d],
|
|
2996
2996
|
setState: e,
|
|
2997
|
-
isSelected: a.includes(
|
|
2997
|
+
isSelected: a.includes(d),
|
|
2998
2998
|
itemMap: s,
|
|
2999
2999
|
boardSize: n,
|
|
3000
3000
|
getCurrentUser: u,
|
|
3001
3001
|
showResizeHandle: o,
|
|
3002
3002
|
className: l
|
|
3003
3003
|
},
|
|
3004
|
-
|
|
3004
|
+
d
|
|
3005
3005
|
));
|
|
3006
3006
|
}, ao = H({
|
|
3007
3007
|
zIndex: 210,
|
|
@@ -3034,23 +3034,23 @@ const Zn = (e) => {
|
|
|
3034
3034
|
h.getConfiguration,
|
|
3035
3035
|
h.getBoardState,
|
|
3036
3036
|
h.updateBoardState
|
|
3037
|
-
]), { findElementUnderPointer:
|
|
3037
|
+
]), { findElementUnderPointer: d } = pt(), [f] = se((h) => [h.getItems]), [c, b] = g.useState({}), [, _] = g.useTransition(), w = g.useRef(null), m = g.useRef({
|
|
3038
3038
|
moving: !1
|
|
3039
3039
|
});
|
|
3040
3040
|
return g.useEffect(() => (n(), () => {
|
|
3041
3041
|
n();
|
|
3042
3042
|
}), [n]), g.useEffect(() => {
|
|
3043
3043
|
if (m.current.moving) {
|
|
3044
|
-
const h =
|
|
3044
|
+
const h = f(), { boardWrapper: v } = a(), C = co(h, v);
|
|
3045
3045
|
_(() => {
|
|
3046
3046
|
o(C);
|
|
3047
3047
|
});
|
|
3048
3048
|
}
|
|
3049
|
-
}, [a,
|
|
3049
|
+
}, [a, f, c, o]), /* @__PURE__ */ T(
|
|
3050
3050
|
We,
|
|
3051
3051
|
{
|
|
3052
3052
|
onDragStart: async (h) => {
|
|
3053
|
-
await
|
|
3053
|
+
await d(h) || (m.current.moving = !0, _(() => {
|
|
3054
3054
|
l({ selecting: !0 });
|
|
3055
3055
|
}), w.current.style.cursor = "crosshair");
|
|
3056
3056
|
},
|
|
@@ -3066,7 +3066,7 @@ const Zn = (e) => {
|
|
|
3066
3066
|
}), m.current.moving = !1, b({ moving: !1 }), w.current.style.cursor = "auto");
|
|
3067
3067
|
},
|
|
3068
3068
|
onTap: (h) => {
|
|
3069
|
-
const { target: v, ctrlKey: C, metaKey: D } = h, k =
|
|
3069
|
+
const { target: v, ctrlKey: C, metaKey: D } = h, k = d(h);
|
|
3070
3070
|
if (!k && Te(v, "board"))
|
|
3071
3071
|
n();
|
|
3072
3072
|
else {
|
|
@@ -3146,7 +3146,7 @@ const go = ({ children: e }) => {
|
|
|
3146
3146
|
E.getSelection,
|
|
3147
3147
|
E.getBoardState,
|
|
3148
3148
|
E.updateBoardState
|
|
3149
|
-
]), [
|
|
3149
|
+
]), [d] = se((E) => [E.getBoardConfig]), f = g.useRef({}), c = g.useRef({
|
|
3150
3150
|
items: []
|
|
3151
3151
|
}), b = (E) => {
|
|
3152
3152
|
const { ctrlKey: R, metaKey: x, event: y } = E, p = n(E);
|
|
@@ -3155,16 +3155,16 @@ const go = ({ children: e }) => {
|
|
|
3155
3155
|
const h = a();
|
|
3156
3156
|
c.current.items = h;
|
|
3157
3157
|
const v = ke(p);
|
|
3158
|
-
h.includes(v) || (R || x ? (c.current.items = [...h, v], o([v])) : (c.current.items = [v], s([v]))), Object.assign(
|
|
3158
|
+
h.includes(v) || (R || x ? (c.current.items = [...h, v], o([v])) : (c.current.items = [v], s([v]))), Object.assign(f.current, {
|
|
3159
3159
|
moving: !0,
|
|
3160
3160
|
remainX: 0,
|
|
3161
3161
|
remainY: 0
|
|
3162
3162
|
});
|
|
3163
3163
|
}
|
|
3164
3164
|
}, _ = ({ deltaX: E, deltaY: R, event: x }) => {
|
|
3165
|
-
if (
|
|
3165
|
+
if (f.current.moving) {
|
|
3166
3166
|
x.stopPropagation();
|
|
3167
|
-
const { scale: y } = u(), p =
|
|
3167
|
+
const { scale: y } = u(), p = f.current.remainX + E / y, h = f.current.remainY + R / y;
|
|
3168
3168
|
t(
|
|
3169
3169
|
c.current.items,
|
|
3170
3170
|
{
|
|
@@ -3175,9 +3175,9 @@ const go = ({ children: e }) => {
|
|
|
3175
3175
|
), l({ movingItems: !0 });
|
|
3176
3176
|
}
|
|
3177
3177
|
}, w = () => {
|
|
3178
|
-
if (
|
|
3179
|
-
const { gridSize: E = 1 } =
|
|
3180
|
-
|
|
3178
|
+
if (f.current.moving) {
|
|
3179
|
+
const { gridSize: E = 1 } = d(), R = E || 1;
|
|
3180
|
+
f.current = { moving: !1 }, r(c.current.items, {
|
|
3181
3181
|
type: "grid",
|
|
3182
3182
|
size: R
|
|
3183
3183
|
}), l({ movingItems: !1 });
|
|
@@ -3188,7 +3188,7 @@ const go = ({ children: e }) => {
|
|
|
3188
3188
|
return;
|
|
3189
3189
|
const R = a();
|
|
3190
3190
|
if (R.length) {
|
|
3191
|
-
const { gridSize: x = 1 } =
|
|
3191
|
+
const { gridSize: x = 1 } = d();
|
|
3192
3192
|
let y = 0, p = 0;
|
|
3193
3193
|
switch (E.key) {
|
|
3194
3194
|
case "ArrowLeft":
|
|
@@ -3235,8 +3235,8 @@ const go = ({ children: e }) => {
|
|
|
3235
3235
|
return pe(document, "keydown", (o) => {
|
|
3236
3236
|
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && vo.includes(o.code)) {
|
|
3237
3237
|
const s = o.code, { translateX: a, translateY: u, scale: l } = r();
|
|
3238
|
-
o.altKey || o.metaKey || o.ctrlKey ? t((
|
|
3239
|
-
...
|
|
3238
|
+
o.altKey || o.metaKey || o.ctrlKey ? t((d) => ({
|
|
3239
|
+
...d,
|
|
3240
3240
|
[s]: { translateX: a, translateY: u, scale: l }
|
|
3241
3241
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3242
3242
|
}
|
|
@@ -3258,17 +3258,17 @@ const go = ({ children: e }) => {
|
|
|
3258
3258
|
p.getConfiguration,
|
|
3259
3259
|
p.updateBoardState,
|
|
3260
3260
|
p.getSelection
|
|
3261
|
-
]), { setDim: l, zoomToCenter:
|
|
3261
|
+
]), { setDim: l, zoomToCenter: d, zoomToExtent: f } = dt(), [c, b] = g.useState(!1), _ = g.useRef({}), w = ho(r);
|
|
3262
3262
|
yo();
|
|
3263
3263
|
const m = g.useCallback(() => {
|
|
3264
3264
|
const { itemExtent: p } = s();
|
|
3265
|
-
|
|
3266
|
-
}, [s,
|
|
3265
|
+
f(p);
|
|
3266
|
+
}, [s, f]);
|
|
3267
3267
|
g.useEffect(() => {
|
|
3268
3268
|
!c && o.left && (m(), b(!0));
|
|
3269
3269
|
}, [m, c, o]);
|
|
3270
3270
|
const E = ({ clientX: p, clientY: h, scale: v }) => {
|
|
3271
|
-
|
|
3271
|
+
d(1 - v / 500, { x: p, y: h }), clearTimeout(_.current.zoom), _.current.zoom = setTimeout(() => {
|
|
3272
3272
|
a({ zooming: !1 });
|
|
3273
3273
|
}, 200), a({ zooming: !0 });
|
|
3274
3274
|
}, R = ({ deltaX: p, deltaY: h }) => {
|
|
@@ -3311,11 +3311,11 @@ const go = ({ children: e }) => {
|
|
|
3311
3311
|
...k,
|
|
3312
3312
|
translateY: k.translateY + v,
|
|
3313
3313
|
translateX: k.translateX + h
|
|
3314
|
-
})),
|
|
3314
|
+
})), d(C), p.preventDefault();
|
|
3315
3315
|
}
|
|
3316
|
-
p.key === " " && !p.repeat && w().hover &&
|
|
3316
|
+
p.key === " " && !p.repeat && w().hover && d(3, w());
|
|
3317
3317
|
}, y = (p) => {
|
|
3318
|
-
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && w().hover &&
|
|
3318
|
+
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && w().hover && d(1 / 3, w());
|
|
3319
3319
|
};
|
|
3320
3320
|
return pe(document, "keydown", x), pe(document, "keyup", y), /* @__PURE__ */ T(
|
|
3321
3321
|
We,
|
|
@@ -3365,7 +3365,7 @@ const go = ({ children: e }) => {
|
|
|
3365
3365
|
translateY: c.boardState.translateY,
|
|
3366
3366
|
scale: c.boardState.scale
|
|
3367
3367
|
}
|
|
3368
|
-
]), [l] = se((c) => [c.items]),
|
|
3368
|
+
]), [l] = se((c) => [c.items]), d = g.useCallback(() => {
|
|
3369
3369
|
const c = t(), { boardWrapperRect: b, boardWrapper: _ } = o();
|
|
3370
3370
|
if (c.length === 0) {
|
|
3371
3371
|
n(null);
|
|
@@ -3383,17 +3383,17 @@ const go = ({ children: e }) => {
|
|
|
3383
3383
|
width: R
|
|
3384
3384
|
};
|
|
3385
3385
|
n(y);
|
|
3386
|
-
}, [o, t, n]),
|
|
3386
|
+
}, [o, t, n]), f = ft(d, [d], 300);
|
|
3387
3387
|
return g.useEffect(() => {
|
|
3388
|
-
|
|
3388
|
+
d(), f();
|
|
3389
3389
|
}, [
|
|
3390
3390
|
e,
|
|
3391
3391
|
l,
|
|
3392
3392
|
s,
|
|
3393
3393
|
a,
|
|
3394
3394
|
u,
|
|
3395
|
-
|
|
3396
|
-
|
|
3395
|
+
d,
|
|
3396
|
+
f
|
|
3397
3397
|
]), !r || e.length < 2 ? null : /* @__PURE__ */ T(
|
|
3398
3398
|
"div",
|
|
3399
3399
|
{
|
|
@@ -3440,8 +3440,8 @@ function xo(e, t, r = !0) {
|
|
|
3440
3440
|
if (!n || !a)
|
|
3441
3441
|
return;
|
|
3442
3442
|
let u = !0;
|
|
3443
|
-
const l = (...
|
|
3444
|
-
u && o.current(...
|
|
3443
|
+
const l = (...d) => {
|
|
3444
|
+
u && o.current(...d);
|
|
3445
3445
|
};
|
|
3446
3446
|
return n.subscribe(a, l), () => {
|
|
3447
3447
|
u = !1, n.unsubscribe(a, l);
|
|
@@ -3481,12 +3481,12 @@ function Io(e) {
|
|
|
3481
3481
|
}
|
|
3482
3482
|
const s = Do.exec(t);
|
|
3483
3483
|
if (s) {
|
|
3484
|
-
const [a, u, l,
|
|
3484
|
+
const [a, u, l, d] = Array.from(s).slice(1).map(parseFloat);
|
|
3485
3485
|
if (Ht(0, 100, u) !== u)
|
|
3486
3486
|
throw new Re(e);
|
|
3487
3487
|
if (Ht(0, 100, l) !== l)
|
|
3488
3488
|
throw new Re(e);
|
|
3489
|
-
return [...Ao(a, u, l), Number.isNaN(
|
|
3489
|
+
return [...Ao(a, u, l), Number.isNaN(d) ? 1 : d];
|
|
3490
3490
|
}
|
|
3491
3491
|
throw new Re(e);
|
|
3492
3492
|
}
|
|
@@ -3514,9 +3514,9 @@ const Pe = (e, t) => Array.from(Array(t)).map(() => e).join(""), Po = new RegExp
|
|
|
3514
3514
|
if (t === 0)
|
|
3515
3515
|
return [n, n, n].map(Gt);
|
|
3516
3516
|
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100), a = s * (1 - Math.abs(o % 2 - 1));
|
|
3517
|
-
let u = 0, l = 0,
|
|
3518
|
-
o >= 0 && o < 1 ? (u = s, l = a) : o >= 1 && o < 2 ? (u = a, l = s) : o >= 2 && o < 3 ? (l = s,
|
|
3519
|
-
const
|
|
3517
|
+
let u = 0, l = 0, d = 0;
|
|
3518
|
+
o >= 0 && o < 1 ? (u = s, l = a) : o >= 1 && o < 2 ? (u = a, l = s) : o >= 2 && o < 3 ? (l = s, d = a) : o >= 3 && o < 4 ? (l = a, d = s) : o >= 4 && o < 5 ? (u = a, d = s) : o >= 5 && o < 6 && (u = s, d = a);
|
|
3519
|
+
const f = n - s / 2, c = u + f, b = l + f, _ = d + f;
|
|
3520
3520
|
return [c, b, _].map(Gt);
|
|
3521
3521
|
};
|
|
3522
3522
|
function zo(e) {
|
|
@@ -3635,12 +3635,12 @@ const Yo = H({
|
|
|
3635
3635
|
l.getConfiguration,
|
|
3636
3636
|
l.getBoardState
|
|
3637
3637
|
]);
|
|
3638
|
-
return /* @__PURE__ */ ue("div", { onPointerMove: ({ clientX: l, clientY:
|
|
3639
|
-
const { scale:
|
|
3638
|
+
return /* @__PURE__ */ ue("div", { onPointerMove: ({ clientX: l, clientY: d }) => {
|
|
3639
|
+
const { scale: f, translateX: c, translateY: b } = s(), {
|
|
3640
3640
|
boardWrapperRect: { left: _, top: w }
|
|
3641
3641
|
} = o(), m = {
|
|
3642
|
-
x: (l - _ - c) /
|
|
3643
|
-
y: (
|
|
3642
|
+
x: (l - _ - c) / f,
|
|
3643
|
+
y: (d - w - b) / f
|
|
3644
3644
|
};
|
|
3645
3645
|
r(t.id, m);
|
|
3646
3646
|
}, onPointerLeave: () => {
|
|
@@ -3663,7 +3663,7 @@ const Yo = H({
|
|
|
3663
3663
|
showResizeHandle: a = !1,
|
|
3664
3664
|
Wrapper: u = Ko
|
|
3665
3665
|
}) => {
|
|
3666
|
-
const l = g.useRef(null), [
|
|
3666
|
+
const l = g.useRef(null), [d, f] = Z((w) => [
|
|
3667
3667
|
w.config.uid,
|
|
3668
3668
|
w.updateConfiguration
|
|
3669
3669
|
]), { updateItemExtent: c } = dt(), b = {
|
|
@@ -3681,23 +3681,25 @@ const Yo = H({
|
|
|
3681
3681
|
document.body.removeEventListener("wheel", w);
|
|
3682
3682
|
};
|
|
3683
3683
|
}, []), g.useEffect(() => {
|
|
3684
|
-
|
|
3684
|
+
f({
|
|
3685
3685
|
boardWrapper: l.current
|
|
3686
3686
|
});
|
|
3687
|
-
}, [
|
|
3688
|
-
|
|
3687
|
+
}, [f]), g.useEffect(() => {
|
|
3688
|
+
d || f({
|
|
3689
3689
|
uid: me()
|
|
3690
3690
|
});
|
|
3691
|
-
}, [
|
|
3692
|
-
|
|
3691
|
+
}, [d, f]), g.useEffect(() => {
|
|
3692
|
+
f({
|
|
3693
3693
|
itemTemplates: n,
|
|
3694
3694
|
boardSize: o,
|
|
3695
3695
|
showResizeHandle: a
|
|
3696
3696
|
});
|
|
3697
|
-
}, [n, o, a,
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3697
|
+
}, [n, o, a, f]), g.useEffect(() => {
|
|
3698
|
+
f({
|
|
3699
|
+
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3700
|
+
}), c(), setTimeout(c, 2e3);
|
|
3701
|
+
}, [f, c]), xo(l, () => {
|
|
3702
|
+
l.current && f({
|
|
3701
3703
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3702
3704
|
});
|
|
3703
3705
|
});
|
|
@@ -3706,7 +3708,7 @@ const Yo = H({
|
|
|
3706
3708
|
"div",
|
|
3707
3709
|
{
|
|
3708
3710
|
ref: l,
|
|
3709
|
-
id:
|
|
3711
|
+
id: d,
|
|
3710
3712
|
className: `sync-board ${_}`,
|
|
3711
3713
|
children: [
|
|
3712
3714
|
/* @__PURE__ */ T(So, { moveFirst: e, children: /* @__PURE__ */ T(uo, { moveFirst: e, children: /* @__PURE__ */ T(go, { moveFirst: e, children: /* @__PURE__ */ T(Fo, { children: /* @__PURE__ */ T(u, { children: /* @__PURE__ */ ue(
|