noteloom 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -1026
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.js +1 -1
- package/dist/collab.cjs +1 -1
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.js +157 -102
- package/dist/collab.js.map +1 -1
- package/dist/comments.cjs +1 -1
- package/dist/comments.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +1600 -1542
- package/dist/index.js.map +1 -1
- package/dist/shared/{CommentThreadCard-CAJ3oPdr.cjs → CommentThreadCard-DcCHq2Dy.cjs} +2 -2
- package/dist/shared/{CommentThreadCard-CAJ3oPdr.cjs.map → CommentThreadCard-DcCHq2Dy.cjs.map} +1 -1
- package/dist/shared/{CommentThreadCard-Cxf8GwHJ.js → CommentThreadCard-DwtE85Xx.js} +2 -2
- package/dist/shared/{CommentThreadCard-Cxf8GwHJ.js.map → CommentThreadCard-DwtE85Xx.js.map} +1 -1
- package/dist/shared/{CommentsPanel-CES4uzye.cjs → CommentsPanel-BRgACUu_.cjs} +2 -2
- package/dist/shared/{CommentsPanel-CES4uzye.cjs.map → CommentsPanel-BRgACUu_.cjs.map} +1 -1
- package/dist/shared/{CommentsPanel-BwVVyMOC.js → CommentsPanel-D4eP-K_f.js} +3 -3
- package/dist/shared/{CommentsPanel-BwVVyMOC.js.map → CommentsPanel-D4eP-K_f.js.map} +1 -1
- package/dist/shared/VersionHistory-BRBYQgj5.cjs +12 -0
- package/dist/shared/VersionHistory-BRBYQgj5.cjs.map +1 -0
- package/dist/shared/{VersionHistory-Bg6fufP5.js → VersionHistory-D9sIIAYN.js} +221 -206
- package/dist/shared/VersionHistory-D9sIIAYN.js.map +1 -0
- package/dist/shared/VoiceListeningIndicator-DgLMmGSP.js +342 -0
- package/dist/shared/VoiceListeningIndicator-DgLMmGSP.js.map +1 -0
- package/dist/shared/VoiceListeningIndicator-Dw0fggpE.cjs +2 -0
- package/dist/shared/VoiceListeningIndicator-Dw0fggpE.cjs.map +1 -0
- package/dist/shared/{icons-C1_s0jKK.js → icons-Bdptdx1e.js} +307 -277
- package/dist/shared/{icons-C1_s0jKK.js.map → icons-Bdptdx1e.js.map} +1 -1
- package/dist/shared/{icons-DtCsXuU6.cjs → icons-DabR_JDW.cjs} +3 -3
- package/dist/shared/{icons-DtCsXuU6.cjs.map → icons-DabR_JDW.cjs.map} +1 -1
- package/dist/shared/{index-D9WEXpYM.cjs → index-B7_F6NA9.cjs} +2 -2
- package/dist/shared/{index-D9WEXpYM.cjs.map → index-B7_F6NA9.cjs.map} +1 -1
- package/dist/shared/{index-B9jyyL8u.js → index-DOIEccLM.js} +52 -52
- package/dist/shared/{index-B9jyyL8u.js.map → index-DOIEccLM.js.map} +1 -1
- package/dist/shared/{leafBlockFactory-A9eUhSe-.js → leafBlockFactory-ChlzpKIn.js} +2 -2
- package/dist/shared/{leafBlockFactory-A9eUhSe-.js.map → leafBlockFactory-ChlzpKIn.js.map} +1 -1
- package/dist/shared/{leafBlockFactory-Dp382eP8.cjs → leafBlockFactory-D3SCDvzc.cjs} +2 -2
- package/dist/shared/{leafBlockFactory-Dp382eP8.cjs.map → leafBlockFactory-D3SCDvzc.cjs.map} +1 -1
- package/dist/shared/{serialize-T9Odwx24.js → serialize-C1rjLsIz.js} +2 -2
- package/dist/shared/{serialize-T9Odwx24.js.map → serialize-C1rjLsIz.js.map} +1 -1
- package/dist/shared/{serialize-DWEfk0vU.cjs → serialize-k0zXqwEM.cjs} +2 -2
- package/dist/shared/{serialize-DWEfk0vU.cjs.map → serialize-k0zXqwEM.cjs.map} +1 -1
- package/dist/shared/{starter-kit-CY5wzYDf.js → starter-kit-CJzWMyF8.js} +683 -673
- package/dist/shared/{starter-kit-CY5wzYDf.js.map → starter-kit-CJzWMyF8.js.map} +1 -1
- package/dist/shared/starter-kit-Ch2LEpzF.cjs +27 -0
- package/dist/shared/{starter-kit-lPN-NpJ5.cjs.map → starter-kit-Ch2LEpzF.cjs.map} +1 -1
- package/dist/shared/{usePopoverEdgeClamp-gmFm0CnI.js → usePopoverEdgeClamp-B9KNv9SE.js} +2 -2
- package/dist/shared/{usePopoverEdgeClamp-gmFm0CnI.js.map → usePopoverEdgeClamp-B9KNv9SE.js.map} +1 -1
- package/dist/shared/{usePopoverEdgeClamp-CDG26jBM.cjs → usePopoverEdgeClamp-gRlLQeVG.cjs} +2 -2
- package/dist/shared/{usePopoverEdgeClamp-CDG26jBM.cjs.map → usePopoverEdgeClamp-gRlLQeVG.cjs.map} +1 -1
- package/dist/starter-kit.cjs +1 -1
- package/dist/starter-kit.js +2 -2
- package/dist/versions.cjs +1 -1
- package/dist/versions.js +1 -1
- package/dist/voice.cjs +1 -1
- package/dist/voice.js +1 -1
- package/package.json +2 -2
- package/dist/shared/VersionHistory-Bg6fufP5.js.map +0 -1
- package/dist/shared/VersionHistory-DELa2Wbq.cjs +0 -12
- package/dist/shared/VersionHistory-DELa2Wbq.cjs.map +0 -1
- package/dist/shared/VoiceListeningIndicator-BOfVmLK0.js +0 -338
- package/dist/shared/VoiceListeningIndicator-BOfVmLK0.js.map +0 -1
- package/dist/shared/VoiceListeningIndicator-DNX8JlQM.cjs +0 -2
- package/dist/shared/VoiceListeningIndicator-DNX8JlQM.cjs.map +0 -1
- package/dist/shared/starter-kit-lPN-NpJ5.cjs +0 -27
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as _, jsx as p, Fragment as
|
|
1
|
+
import { jsxs as _, jsx as p, Fragment as Fr } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as b, useSyncExternalStore as Xn, useEffect as Yn, useState as T, useRef as I, useMemo as vt } from "react";
|
|
3
|
-
import { a as De, g as Rt,
|
|
4
|
-
import { d as so, i as io, c as ao } from "./leafBlockFactory-
|
|
3
|
+
import { a as De, g as Rt, G as Hr, j as U, P as Ur, H as Ln, X as Zr, I as jr, J as Kr, K as Vr, L as Gr, N as Bn, Q as Wr, U as qr, V as Jr, W as Qr, Y as to, Z as eo, _ as no, $ as ro, l as oo } from "./icons-Bdptdx1e.js";
|
|
4
|
+
import { d as so, i as io, c as ao } from "./leafBlockFactory-ChlzpKIn.js";
|
|
5
5
|
function co(t) {
|
|
6
6
|
const r = De(), e = b((s) => r.subscribe(t, s), [r, t]), o = b(() => r.getBlock(t), [r, t]);
|
|
7
7
|
return Xn(e, o);
|
|
@@ -24,7 +24,7 @@ function Mt(t, r, e) {
|
|
|
24
24
|
};
|
|
25
25
|
}, [r, e, t]);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const Fn = 8, Hn = 0.5, lo = 0.5, uo = 4, Ie = 0.15, fo = 8;
|
|
28
28
|
function Un(t, r) {
|
|
29
29
|
return Math.hypot(t[0] - r[0], t[1] - r[1]);
|
|
30
30
|
}
|
|
@@ -38,15 +38,15 @@ const Zn = 0.5;
|
|
|
38
38
|
function ho(t) {
|
|
39
39
|
return t.some(([, , r]) => r !== void 0 && r !== Zn);
|
|
40
40
|
}
|
|
41
|
-
function po(t, { size: r =
|
|
41
|
+
function po(t, { size: r = Fn, thinning: e = Hn } = {}) {
|
|
42
42
|
const o = r / 2, s = t.length;
|
|
43
43
|
if (!ho(t)) return new Array(s).fill(o);
|
|
44
44
|
const u = new Array(s);
|
|
45
45
|
let f = 0;
|
|
46
46
|
for (let m = 0; m < s; m += 1) {
|
|
47
47
|
if (m > 0) {
|
|
48
|
-
const
|
|
49
|
-
f = f * 0.8 +
|
|
48
|
+
const F = Un(t[m], t[m - 1]);
|
|
49
|
+
f = f * 0.8 + F * 0.2;
|
|
50
50
|
}
|
|
51
51
|
const E = Qt(f / fo, 0, 1), S = t[m][2] ?? Zn, H = 0.4 + 0.6 * Qt(S, 0, 1), z = Qt(
|
|
52
52
|
o * H * (1 - e * E),
|
|
@@ -101,7 +101,7 @@ function xo([t, r], e) {
|
|
|
101
101
|
}
|
|
102
102
|
function ee(t, r = {}) {
|
|
103
103
|
const {
|
|
104
|
-
size: e =
|
|
104
|
+
size: e = Fn,
|
|
105
105
|
thinning: o = Hn,
|
|
106
106
|
smoothing: s = lo
|
|
107
107
|
} = r;
|
|
@@ -198,8 +198,8 @@ function qn(t) {
|
|
|
198
198
|
function Jn(t, r = 5) {
|
|
199
199
|
const { x: e, y: o, width: s, height: i } = t, u = e + s / 2, f = o + i / 2, x = s / 2, m = i / 2, E = 0.4, S = [], H = Math.PI / r;
|
|
200
200
|
let z = -Math.PI / 2;
|
|
201
|
-
for (let
|
|
202
|
-
const A =
|
|
201
|
+
for (let F = 0; F < r * 2; F += 1) {
|
|
202
|
+
const A = F % 2 === 0, ae = A ? x : x * E, et = A ? m : m * E;
|
|
203
203
|
S.push([u + Math.cos(z) * ae, f + Math.sin(z) * et]), z += H;
|
|
204
204
|
}
|
|
205
205
|
return S;
|
|
@@ -213,11 +213,11 @@ function So(t, r, e) {
|
|
|
213
213
|
return o;
|
|
214
214
|
}
|
|
215
215
|
function Qn(t, r, e, o, s = 24) {
|
|
216
|
-
const i = e - t, u = o - r, f = Math.hypot(i, u), [x, m] = f === 0 ? [1, 0] : [i / f, u / f], E = e - x * s, S = o - m * s, H = -m, z = x,
|
|
216
|
+
const i = e - t, u = o - r, f = Math.hypot(i, u), [x, m] = f === 0 ? [1, 0] : [i / f, u / f], E = e - x * s, S = o - m * s, H = -m, z = x, F = s / 2;
|
|
217
217
|
return [
|
|
218
218
|
[e, o],
|
|
219
|
-
[E + H *
|
|
220
|
-
[E - H *
|
|
219
|
+
[E + H * F, S + z * F],
|
|
220
|
+
[E - H * F, S - z * F]
|
|
221
221
|
];
|
|
222
222
|
}
|
|
223
223
|
function ko({ compute: t, onCommit: r }) {
|
|
@@ -376,10 +376,10 @@ const Z = 1e3, $n = "#1a1a1a", er = 8, Nn = ["#1a1a1a", "#e03131", "#2f9e44", "#
|
|
|
376
376
|
function K(t) {
|
|
377
377
|
return Math.round(t / Ce) * Ce;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Bo(t) {
|
|
380
380
|
return Math.round(t / Mn) * Mn;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Fo() {
|
|
383
383
|
const t = I(/* @__PURE__ */ new WeakMap());
|
|
384
384
|
return (r) => {
|
|
385
385
|
const e = t.current;
|
|
@@ -414,7 +414,7 @@ const ve = /* @__PURE__ */ new Set(["rectangle", "ellipse", "arrow", "diamond",
|
|
|
414
414
|
triangle: qn,
|
|
415
415
|
star: Jn
|
|
416
416
|
}, Cn = [
|
|
417
|
-
{ type: "rectangle", label: "Rectangle", Icon:
|
|
417
|
+
{ type: "rectangle", label: "Rectangle", Icon: Bn },
|
|
418
418
|
{ type: "ellipse", label: "Ellipse", Icon: Wr },
|
|
419
419
|
{ type: "arrow", label: "Arrow", Icon: qr },
|
|
420
420
|
{ type: "diamond", label: "Diamond", Icon: Jr },
|
|
@@ -462,7 +462,7 @@ function jo(t, r, e) {
|
|
|
462
462
|
function Ot(t, r, e) {
|
|
463
463
|
return t.type === "arrow" ? { ...t, x1: t.x1 + r, y1: t.y1 + e, x2: t.x2 + r, y2: t.y2 + e } : { ...t, x: t.x + r, y: t.y + e };
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Bt(t) {
|
|
466
466
|
return t.type === "arrow" ? {
|
|
467
467
|
x: Math.min(t.x1, t.x2),
|
|
468
468
|
y: Math.min(t.y1, t.y2),
|
|
@@ -471,7 +471,7 @@ function Ft(t) {
|
|
|
471
471
|
} : { x: t.x, y: t.y, width: t.width, height: t.height };
|
|
472
472
|
}
|
|
473
473
|
function ie(t) {
|
|
474
|
-
const r =
|
|
474
|
+
const r = Bt(t);
|
|
475
475
|
return { cx: r.x + r.width / 2, cy: r.y + r.height / 2 };
|
|
476
476
|
}
|
|
477
477
|
function Xt(t, r, e) {
|
|
@@ -489,7 +489,7 @@ function or(t) {
|
|
|
489
489
|
return { x: r.minX, y: r.minY, width: r.maxX - r.minX, height: r.maxY - r.minY };
|
|
490
490
|
}
|
|
491
491
|
function Vo(t, r) {
|
|
492
|
-
return t === "stroke" ? or(r) :
|
|
492
|
+
return t === "stroke" ? or(r) : Bt(r);
|
|
493
493
|
}
|
|
494
494
|
function Dn(t, r) {
|
|
495
495
|
var u, f;
|
|
@@ -520,7 +520,7 @@ function Ae(t) {
|
|
|
520
520
|
}
|
|
521
521
|
const Wo = { nw: "se", ne: "sw", sw: "ne", se: "nw" }, qo = 32;
|
|
522
522
|
function sr(t) {
|
|
523
|
-
const r =
|
|
523
|
+
const r = Bt(t), e = r.x + r.width / 2, o = r.y - qo;
|
|
524
524
|
if (!t.rotation) return [e, o];
|
|
525
525
|
const { cx: s, cy: i } = ie(t);
|
|
526
526
|
return Kn(e, o, s, i, t.rotation);
|
|
@@ -635,7 +635,7 @@ function _n({ shape: t, opacity: r = 1 }) {
|
|
|
635
635
|
return /* @__PURE__ */ p("g", { transform: `rotate(${t.rotation} ${s} ${i})`, children: o });
|
|
636
636
|
}
|
|
637
637
|
function Qo({ id: t }) {
|
|
638
|
-
const r = De(), e = co(t), o = Hr("be-canvas", e), s =
|
|
638
|
+
const r = De(), e = co(t), o = Hr("be-canvas", e), s = Fo(), [i, u] = T("pen"), [f, x] = T("object"), [m, E] = T($n), [S, H] = T(er), [z, F] = T(null), [A, ae] = T(!0), [et, lr] = T(Re), [ur, fr] = T("rectangle"), [ce, Oe] = T(!1), [le, Xe] = T(!1), [ue, Ye] = T(!1), [fe, Le] = T(!1), [de, Be] = T(!1), [he, Fe] = T(!1), He = I(null), Ue = I(null), Ze = I(null), je = I(null), Ke = I(null), Ve = I(null), Ge = I(null), We = I(null), qe = I(null), Je = I(null), Qe = I(null), tn = I(null), dr = vt(() => [He, Ue], []), hr = vt(() => [Ze, je], []), pr = vt(() => [Ke, Ve], []), mr = vt(() => [Ge, We], []), yr = vt(() => [qe, Je], []), xr = vt(() => [Qe, tn], []), en = b(() => Oe(!1), []), pe = b(() => Xe(!1), []), gr = b(() => Ye(!1), []), nn = b(() => Le(!1), []), br = b(() => Be(!1), []), rn = b(() => Fe(!1), []);
|
|
639
639
|
Mt(dr, ce, en), Mt(hr, le, pe), Mt(pr, ue, gr), Mt(mr, fe, nn), Mt(yr, de, br), Mt(xr, he, rn);
|
|
640
640
|
const q = I(null), At = I([]), dt = I(!1), ht = I(null), [on, sn] = T(null), nt = I(/* @__PURE__ */ new Set()), lt = I(/* @__PURE__ */ new Set()), pt = I(/* @__PURE__ */ new Map()), mt = I(!1), yt = I(null), [wr, an] = T(() => /* @__PURE__ */ new Set()), [Sr, cn] = T(() => /* @__PURE__ */ new Set()), V = I(null), [ln, me] = T(null), [N, Q] = T(() => /* @__PURE__ */ new Set()), rt = I(null), [X, un] = T(null), ot = I(null), [Dt, fn] = T(null), ye = I([]), [P, xt] = T(null), G = I(null), [st, xe] = T(null), [M, ut] = T({ x: 0, y: 0, zoom: 1 }), Y = Z / M.zoom, ft = I(null), W = I(/* @__PURE__ */ new Map()), it = I(null), { dragValue: gt, startDrag: dn } = ko({
|
|
641
641
|
compute: (n, a) => ({
|
|
@@ -671,7 +671,7 @@ function Qo({ id: t }) {
|
|
|
671
671
|
yt.current == null && (yt.current = requestAnimationFrame(() => {
|
|
672
672
|
yt.current = null, an(new Set(nt.current)), cn(new Set(lt.current));
|
|
673
673
|
}));
|
|
674
|
-
}, []),
|
|
674
|
+
}, []), Ft = b(
|
|
675
675
|
(n, a) => {
|
|
676
676
|
var g, w;
|
|
677
677
|
const c = f === "precise" ? Ao : Co, l = Ho(n, a, c), h = ((g = e == null ? void 0 : e.props) == null ? void 0 : g.strokes) ?? [];
|
|
@@ -680,8 +680,8 @@ function Qo({ id: t }) {
|
|
|
680
680
|
const v = te(y.points);
|
|
681
681
|
if (!_t(v, l, y.size / 2)) continue;
|
|
682
682
|
let R = pt.current.get(y.id);
|
|
683
|
-
y.points.forEach(([
|
|
684
|
-
R != null && R.has(C) || Math.hypot(
|
|
683
|
+
y.points.forEach(([B, L], C) => {
|
|
684
|
+
R != null && R.has(C) || Math.hypot(B - n, L - a) > c || (R || (R = /* @__PURE__ */ new Set(), pt.current.set(y.id, R)), R.add(C));
|
|
685
685
|
}), R != null && R.size && nt.current.add(y.id);
|
|
686
686
|
continue;
|
|
687
687
|
}
|
|
@@ -692,7 +692,7 @@ function Qo({ id: t }) {
|
|
|
692
692
|
const d = ((w = e == null ? void 0 : e.props) == null ? void 0 : w.shapes) ?? [];
|
|
693
693
|
for (const y of d) {
|
|
694
694
|
if (lt.current.has(y.id)) continue;
|
|
695
|
-
const k =
|
|
695
|
+
const k = Bt(y), $ = {
|
|
696
696
|
minX: k.x,
|
|
697
697
|
minY: k.y,
|
|
698
698
|
maxX: k.x + k.width,
|
|
@@ -783,7 +783,7 @@ function Qo({ id: t }) {
|
|
|
783
783
|
for (const y of l)
|
|
784
784
|
_t(te(y.points), c) && d.push(y.id);
|
|
785
785
|
for (const y of h) {
|
|
786
|
-
const k =
|
|
786
|
+
const k = Bt(y), $ = {
|
|
787
787
|
minX: k.x,
|
|
788
788
|
minY: k.y,
|
|
789
789
|
maxX: k.x + k.width,
|
|
@@ -936,10 +936,10 @@ function Qo({ id: t }) {
|
|
|
936
936
|
if (vn[n.key] && !n.ctrlKey && !n.metaKey) {
|
|
937
937
|
if (N.size === 0) return;
|
|
938
938
|
n.preventDefault();
|
|
939
|
-
const y = n.shiftKey ? _o : Do, [k, $] = vn[n.key], v = k * y, R = $ * y,
|
|
939
|
+
const y = n.shiftKey ? _o : Do, [k, $] = vn[n.key], v = k * y, R = $ * y, B = ((d = e == null ? void 0 : e.props) == null ? void 0 : d.strokes) ?? [], L = ((g = e == null ? void 0 : e.props) == null ? void 0 : g.shapes) ?? [];
|
|
940
940
|
r.applyOperation(
|
|
941
941
|
U(t, {
|
|
942
|
-
strokes:
|
|
942
|
+
strokes: B.map(
|
|
943
943
|
(C) => N.has(C.id) ? Xt(C, v, R) : C
|
|
944
944
|
),
|
|
945
945
|
shapes: L.map(
|
|
@@ -1065,10 +1065,10 @@ function Qo({ id: t }) {
|
|
|
1065
1065
|
if (n.preventDefault(), (h = a.setPointerCapture) == null || h.call(a, n.pointerId), !it.current) {
|
|
1066
1066
|
for (const L of W.current.keys())
|
|
1067
1067
|
L !== n.pointerId && Sn(L);
|
|
1068
|
-
const
|
|
1068
|
+
const B = Rn(W.current);
|
|
1069
1069
|
it.current = {
|
|
1070
|
-
startCenterX:
|
|
1071
|
-
startCenterY:
|
|
1070
|
+
startCenterX: B.x,
|
|
1071
|
+
startCenterY: B.y,
|
|
1072
1072
|
startViewX: M.x,
|
|
1073
1073
|
startViewY: M.y
|
|
1074
1074
|
};
|
|
@@ -1078,8 +1078,8 @@ function Qo({ id: t }) {
|
|
|
1078
1078
|
if (P) {
|
|
1079
1079
|
if ((g = (d = n.target) == null ? void 0 : d.closest) != null && g.call(d, ".be-canvas-text-editor")) return;
|
|
1080
1080
|
if ((y = (w = document.activeElement) == null ? void 0 : w.blur) == null || y.call(w), i === "text") {
|
|
1081
|
-
let [
|
|
1082
|
-
A && ([
|
|
1081
|
+
let [B, L] = J(n, a, at);
|
|
1082
|
+
A && ([B, L] = [K(B), K(L)]), we(B, L), u("text");
|
|
1083
1083
|
return;
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
@@ -1096,12 +1096,12 @@ function Qo({ id: t }) {
|
|
|
1096
1096
|
n.preventDefault(), ($ = a.setPointerCapture) == null || $.call(a, n.pointerId);
|
|
1097
1097
|
const [c, l] = J(n, a, at);
|
|
1098
1098
|
if (i === "eraser")
|
|
1099
|
-
nt.current = /* @__PURE__ */ new Set(), lt.current = /* @__PURE__ */ new Set(), pt.current = /* @__PURE__ */ new Map(), mt.current = !0,
|
|
1099
|
+
nt.current = /* @__PURE__ */ new Set(), lt.current = /* @__PURE__ */ new Set(), pt.current = /* @__PURE__ */ new Map(), mt.current = !0, Ft(c, l);
|
|
1100
1100
|
else if (ve.has(i)) {
|
|
1101
|
-
const
|
|
1102
|
-
V.current = { type: i, x1:
|
|
1101
|
+
const B = A ? K(c) : c, L = A ? K(l) : l;
|
|
1102
|
+
V.current = { type: i, x1: B, y1: L, x2: B, y2: L }, me(Me(V.current, m, S, z));
|
|
1103
1103
|
} else if (i === "select") {
|
|
1104
|
-
const
|
|
1104
|
+
const B = ((v = e == null ? void 0 : e.props) == null ? void 0 : v.strokes) ?? [], L = ((R = e == null ? void 0 : e.props) == null ? void 0 : R.shapes) ?? [], C = N.size === 1 ? L.find((tt) => N.has(tt.id)) ?? null : null, jt = Jo(c, l, C);
|
|
1105
1105
|
if (jt) {
|
|
1106
1106
|
if (jt === "rotate") {
|
|
1107
1107
|
const { cx: tt, cy: Nt } = ie(C), Tt = Math.atan2(l - Nt, c - tt) * 180 / Math.PI;
|
|
@@ -1136,7 +1136,7 @@ function Qo({ id: t }) {
|
|
|
1136
1136
|
xe(Pe(C, G.current));
|
|
1137
1137
|
return;
|
|
1138
1138
|
}
|
|
1139
|
-
const $t = Go(c, l,
|
|
1139
|
+
const $t = Go(c, l, B, L);
|
|
1140
1140
|
if ($t) {
|
|
1141
1141
|
if (n.shiftKey) {
|
|
1142
1142
|
Q((Nt) => {
|
|
@@ -1154,7 +1154,7 @@ function Qo({ id: t }) {
|
|
|
1154
1154
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1155
1155
|
[
|
|
1156
1156
|
i,
|
|
1157
|
-
|
|
1157
|
+
Ft,
|
|
1158
1158
|
M.x,
|
|
1159
1159
|
M.y,
|
|
1160
1160
|
Y,
|
|
@@ -1210,7 +1210,7 @@ function Qo({ id: t }) {
|
|
|
1210
1210
|
const d = G.current;
|
|
1211
1211
|
if (d.mode === "rotate") {
|
|
1212
1212
|
const y = Math.atan2(h - d.cy, l - d.cx) * 180 / Math.PI, k = d.startRotation + (y - d.startAngle);
|
|
1213
|
-
d.rotation = A ?
|
|
1213
|
+
d.rotation = A ? Bo(k) : k;
|
|
1214
1214
|
} else
|
|
1215
1215
|
A && ([l, h] = [K(l), K(h)]), d.x = l, d.y = h;
|
|
1216
1216
|
const w = (((c = e == null ? void 0 : e.props) == null ? void 0 : c.shapes) ?? []).find((y) => y.id === d.shapeId);
|
|
@@ -1222,14 +1222,14 @@ function Qo({ id: t }) {
|
|
|
1222
1222
|
At.current.push([l, h, n.pressure || 0.5]), hn(S);
|
|
1223
1223
|
} else if (mt.current) {
|
|
1224
1224
|
const [l, h] = J(n, a, at);
|
|
1225
|
-
|
|
1225
|
+
Ft(l, h);
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
1228
|
},
|
|
1229
1229
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1230
1230
|
[
|
|
1231
1231
|
hn,
|
|
1232
|
-
|
|
1232
|
+
Ft,
|
|
1233
1233
|
M.x,
|
|
1234
1234
|
M.y,
|
|
1235
1235
|
Y,
|
|
@@ -1356,7 +1356,7 @@ function Qo({ id: t }) {
|
|
|
1356
1356
|
box: Vo(c, l),
|
|
1357
1357
|
rotation: c === "shape" ? l.rotation : 0
|
|
1358
1358
|
};
|
|
1359
|
-
}).filter(Boolean), ke = Zt.length === 1 && Zt[0].kind === "shape" ? Zt[0] : null, j = (ke == null ? void 0 : ke.item) ?? null,
|
|
1359
|
+
}).filter(Boolean), ke = Zt.length === 1 && Zt[0].kind === "shape" ? Zt[0] : null, j = (ke == null ? void 0 : ke.item) ?? null, Br = j && j.type === "arrow" ? [
|
|
1360
1360
|
["start", j.x1, j.y1],
|
|
1361
1361
|
["end", j.x2, j.y2]
|
|
1362
1362
|
] : j && !j.rotation ? Object.entries(Ae(j)).map(([n, [a, c]]) => [
|
|
@@ -1398,7 +1398,7 @@ function Qo({ id: t }) {
|
|
|
1398
1398
|
"aria-pressed": i === "eraser",
|
|
1399
1399
|
"aria-label": "Eraser",
|
|
1400
1400
|
title: "Eraser",
|
|
1401
|
-
onClick: () =>
|
|
1401
|
+
onClick: () => Fe((n) => !n),
|
|
1402
1402
|
children: (() => {
|
|
1403
1403
|
var a;
|
|
1404
1404
|
const n = ((a = An.find((c) => c.mode === f)) == null ? void 0 : a.Icon) ?? Ln;
|
|
@@ -1467,7 +1467,7 @@ function Qo({ id: t }) {
|
|
|
1467
1467
|
"aria-expanded": de,
|
|
1468
1468
|
"aria-label": `Font size: ${P ? P.fontSize : et}`,
|
|
1469
1469
|
title: "Font size",
|
|
1470
|
-
onClick: () =>
|
|
1470
|
+
onClick: () => Be((n) => !n),
|
|
1471
1471
|
children: /* @__PURE__ */ p("span", { className: "be-canvas-font-size-trigger", children: "A" })
|
|
1472
1472
|
}
|
|
1473
1473
|
),
|
|
@@ -1551,7 +1551,7 @@ function Qo({ id: t }) {
|
|
|
1551
1551
|
var a;
|
|
1552
1552
|
const n = ((a = Cn.find(
|
|
1553
1553
|
(c) => c.type === (ve.has(i) ? i : ur)
|
|
1554
|
-
)) == null ? void 0 : a.Icon) ??
|
|
1554
|
+
)) == null ? void 0 : a.Icon) ?? Bn;
|
|
1555
1555
|
return /* @__PURE__ */ p(n, { size: 14 });
|
|
1556
1556
|
})()
|
|
1557
1557
|
}
|
|
@@ -1682,7 +1682,7 @@ function Qo({ id: t }) {
|
|
|
1682
1682
|
"aria-label": "No fill",
|
|
1683
1683
|
title: "No fill",
|
|
1684
1684
|
onClick: () => {
|
|
1685
|
-
|
|
1685
|
+
F(null), pe();
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
),
|
|
@@ -1697,7 +1697,7 @@ function Qo({ id: t }) {
|
|
|
1697
1697
|
"aria-label": `Fill ${n}`,
|
|
1698
1698
|
title: `Fill ${n}`,
|
|
1699
1699
|
onClick: () => {
|
|
1700
|
-
|
|
1700
|
+
F(n), pe();
|
|
1701
1701
|
}
|
|
1702
1702
|
},
|
|
1703
1703
|
n
|
|
@@ -1713,7 +1713,7 @@ function Qo({ id: t }) {
|
|
|
1713
1713
|
{
|
|
1714
1714
|
type: "color",
|
|
1715
1715
|
value: z ?? $n,
|
|
1716
|
-
onChange: (n) =>
|
|
1716
|
+
onChange: (n) => F(n.target.value)
|
|
1717
1717
|
}
|
|
1718
1718
|
)
|
|
1719
1719
|
}
|
|
@@ -1861,7 +1861,7 @@ function Qo({ id: t }) {
|
|
|
1861
1861
|
onDoubleClick: Pr,
|
|
1862
1862
|
onKeyDown: $r,
|
|
1863
1863
|
children: [
|
|
1864
|
-
A && /* @__PURE__ */ _(
|
|
1864
|
+
A && /* @__PURE__ */ _(Fr, { children: [
|
|
1865
1865
|
/* @__PURE__ */ p("defs", { children: /* @__PURE__ */ p(
|
|
1866
1866
|
"pattern",
|
|
1867
1867
|
{
|
|
@@ -1933,7 +1933,7 @@ function Qo({ id: t }) {
|
|
|
1933
1933
|
},
|
|
1934
1934
|
n
|
|
1935
1935
|
)),
|
|
1936
|
-
|
|
1936
|
+
Br.map(([n, a, c]) => /* @__PURE__ */ p(
|
|
1937
1937
|
"rect",
|
|
1938
1938
|
{
|
|
1939
1939
|
className: "be-canvas-selection-handle",
|
|
@@ -2142,4 +2142,4 @@ export {
|
|
|
2142
2142
|
ps as r,
|
|
2143
2143
|
hs as u
|
|
2144
2144
|
};
|
|
2145
|
-
//# sourceMappingURL=index-
|
|
2145
|
+
//# sourceMappingURL=index-DOIEccLM.js.map
|