@1urso/generic-editor 0.1.60 → 0.1.62
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/generic-editor.js +248 -237
- package/dist/generic-editor.umd.cjs +16 -16
- package/package.json +1 -1
package/dist/generic-editor.js
CHANGED
|
@@ -12346,64 +12346,65 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12346
12346
|
}), nM = useRef({
|
|
12347
12347
|
x: 0,
|
|
12348
12348
|
y: 0
|
|
12349
|
-
}), rM = useRef([]), oM = (
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
};
|
|
12355
|
-
return;
|
|
12356
|
-
}
|
|
12357
|
-
Xj.current = !0;
|
|
12358
|
-
let O = G.current?.getBoundingClientRect();
|
|
12359
|
-
if (!O) return;
|
|
12360
|
-
let A = O.left, j = O.top;
|
|
12361
|
-
tM.current = {
|
|
12362
|
-
x: (E.clientX - A - n.pan.x) / n.zoom,
|
|
12363
|
-
y: (E.clientY - j - n.pan.y) / n.zoom
|
|
12364
|
-
}, rM.current = n.selectedElementIds, E.shiftKey || (_(null), rM.current = []), window.addEventListener("mousemove", sM), window.addEventListener("mouseup", cM);
|
|
12365
|
-
}, sM = useCallback((_) => {
|
|
12349
|
+
}), rM = useRef([]), oM = useRef([]), sM = useRef(n), cM = useRef(0);
|
|
12350
|
+
useEffect(() => {
|
|
12351
|
+
sM.current = n;
|
|
12352
|
+
}, [n]);
|
|
12353
|
+
let lM = useCallback((n) => {
|
|
12366
12354
|
if (!G.current) return;
|
|
12355
|
+
let _ = sM.current;
|
|
12367
12356
|
if (Zj.current) {
|
|
12368
|
-
let E =
|
|
12357
|
+
let E = n.clientX - nM.current.x, O = n.clientY - nM.current.y;
|
|
12369
12358
|
j({
|
|
12370
|
-
x:
|
|
12371
|
-
y:
|
|
12359
|
+
x: _.pan.x + E,
|
|
12360
|
+
y: _.pan.y + O
|
|
12372
12361
|
}), nM.current = {
|
|
12373
|
-
x:
|
|
12374
|
-
y:
|
|
12362
|
+
x: n.clientX,
|
|
12363
|
+
y: n.clientY
|
|
12375
12364
|
};
|
|
12376
12365
|
return;
|
|
12377
12366
|
}
|
|
12378
12367
|
if (!Xj.current) return;
|
|
12379
|
-
let O = G.current.getBoundingClientRect(), A = (
|
|
12380
|
-
|
|
12368
|
+
let O = G.current.getBoundingClientRect(), A = (n.clientX - O.left - _.pan.x) / _.zoom, M = (n.clientY - O.top - _.pan.y) / _.zoom, N = Math.min(tM.current.x, A), P = Math.min(tM.current.y, M), z = Math.abs(A - tM.current.x), B = Math.abs(M - tM.current.y);
|
|
12369
|
+
Yj({
|
|
12381
12370
|
x: N,
|
|
12382
12371
|
y: P,
|
|
12383
12372
|
width: z,
|
|
12384
12373
|
height: B
|
|
12385
|
-
})
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12374
|
+
});
|
|
12375
|
+
let H = Date.now();
|
|
12376
|
+
if (!(H - cM.current < 50) && (z > 0 || B > 0)) {
|
|
12377
|
+
let n = [];
|
|
12378
|
+
_.elements.forEach((_) => {
|
|
12379
|
+
let E = _.x ?? 0, O = _.y ?? 0, A = _.width ?? 100, j = _.height ?? 100, M = E + A, H = O + j, U = N + z, W = P + B;
|
|
12380
|
+
E < U && M > N && O < W && H > P && n.push(_.id);
|
|
12381
|
+
});
|
|
12382
|
+
let O = Array.from(new Set([...rM.current, ...n])), A = oM.current;
|
|
12383
|
+
A.length === O.length && A.every((n) => O.includes(n)) || (E(O), oM.current = O, cM.current = H);
|
|
12391
12384
|
}
|
|
12392
|
-
}, [
|
|
12393
|
-
n.
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12385
|
+
}, [E, j]), uM = useCallback((n) => {
|
|
12386
|
+
(Xj.current || Zj.current) && n.target.releasePointerCapture(n.pointerId), Xj.current = !1, Zj.current = !1, Yj(null);
|
|
12387
|
+
}, []), dM = (E) => {
|
|
12388
|
+
if (E.currentTarget.setPointerCapture(E.pointerId), E.button === 1 || E.button === 0 && eM.current) {
|
|
12389
|
+
E.preventDefault(), Zj.current = !0, nM.current = {
|
|
12390
|
+
x: E.clientX,
|
|
12391
|
+
y: E.clientY
|
|
12392
|
+
};
|
|
12393
|
+
return;
|
|
12394
|
+
}
|
|
12395
|
+
Xj.current = !0;
|
|
12396
|
+
let O = G.current?.getBoundingClientRect();
|
|
12397
|
+
if (!O) return;
|
|
12398
|
+
let A = O.left, j = O.top;
|
|
12399
|
+
tM.current = {
|
|
12400
|
+
x: (E.clientX - A - n.pan.x) / n.zoom,
|
|
12401
|
+
y: (E.clientY - j - n.pan.y) / n.zoom
|
|
12402
|
+
}, rM.current = n.selectedElementIds, oM.current = n.selectedElementIds, E.shiftKey || (_(null), rM.current = [], oM.current = []);
|
|
12403
|
+
};
|
|
12401
12404
|
useEffect(() => {
|
|
12402
|
-
lM.current = n;
|
|
12403
|
-
}, [n]), useEffect(() => {
|
|
12404
12405
|
let n = (n) => {
|
|
12405
12406
|
n.preventDefault();
|
|
12406
|
-
let _ =
|
|
12407
|
+
let _ = sM.current;
|
|
12407
12408
|
if (n.ctrlKey || n.metaKey) A(Math.min(Math.max(.1, _.zoom - n.deltaY * .001), 5));
|
|
12408
12409
|
else {
|
|
12409
12410
|
let E = n.shiftKey ? n.deltaY : n.deltaX, O = n.shiftKey ? n.deltaX : n.deltaY;
|
|
@@ -12449,7 +12450,7 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12449
12450
|
n.code === "Space" && (eM.current = !1, G.current && !Zj.current && (G.current.style.cursor = "default"));
|
|
12450
12451
|
};
|
|
12451
12452
|
return window.addEventListener("keydown", _), window.addEventListener("keyup", E), () => {
|
|
12452
|
-
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E)
|
|
12453
|
+
window.removeEventListener("keydown", _), window.removeEventListener("keyup", E);
|
|
12453
12454
|
};
|
|
12454
12455
|
}, [
|
|
12455
12456
|
M,
|
|
@@ -12459,25 +12460,23 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12459
12460
|
B,
|
|
12460
12461
|
U,
|
|
12461
12462
|
n.selectedElementIds,
|
|
12462
|
-
n.elements
|
|
12463
|
-
sM,
|
|
12464
|
-
cM
|
|
12463
|
+
n.elements
|
|
12465
12464
|
]);
|
|
12466
|
-
let
|
|
12467
|
-
n.stopPropagation(), n.preventDefault(),
|
|
12468
|
-
},
|
|
12469
|
-
if (!
|
|
12465
|
+
let fM = useRef(!1), { setCanvasHeight: pM } = useEditor(), mM = (n) => {
|
|
12466
|
+
n.stopPropagation(), n.preventDefault(), fM.current = !0, window.addEventListener("mousemove", hM), window.addEventListener("mouseup", gM);
|
|
12467
|
+
}, hM = useCallback((n) => {
|
|
12468
|
+
if (!fM.current || !G.current) return;
|
|
12470
12469
|
let _ = G.current.getBoundingClientRect(), E = n.clientY - _.top, O = Math.max(50, Math.min(E, 2e3));
|
|
12471
|
-
|
|
12472
|
-
}, [
|
|
12473
|
-
|
|
12474
|
-
}, [
|
|
12470
|
+
pM(Math.round(O));
|
|
12471
|
+
}, [pM]), gM = useCallback(() => {
|
|
12472
|
+
fM.current = !1, window.removeEventListener("mousemove", hM), window.removeEventListener("mouseup", gM);
|
|
12473
|
+
}, [hM]);
|
|
12475
12474
|
useEffect(() => () => {
|
|
12476
|
-
window.removeEventListener("mousemove",
|
|
12477
|
-
}, [
|
|
12478
|
-
let
|
|
12475
|
+
window.removeEventListener("mousemove", hM), window.removeEventListener("mouseup", gM);
|
|
12476
|
+
}, [hM, gM]);
|
|
12477
|
+
let _M = (n) => {
|
|
12479
12478
|
n.preventDefault(), n.dataTransfer.dropEffect = "copy";
|
|
12480
|
-
},
|
|
12479
|
+
}, vM = (n) => {
|
|
12481
12480
|
n.preventDefault();
|
|
12482
12481
|
let _ = n.dataTransfer.getData("application/x-editor-prop");
|
|
12483
12482
|
if (_) {
|
|
@@ -12492,12 +12491,18 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12492
12491
|
dataBinding: _
|
|
12493
12492
|
});
|
|
12494
12493
|
}
|
|
12495
|
-
},
|
|
12494
|
+
}, yM = n.canvasHeight || 150;
|
|
12496
12495
|
return /* @__PURE__ */ jsxs(p, {
|
|
12497
12496
|
ref: G,
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12497
|
+
onPointerDown: dM,
|
|
12498
|
+
onPointerMove: (n) => {
|
|
12499
|
+
(Xj.current || Zj.current) && lM(n.nativeEvent);
|
|
12500
|
+
},
|
|
12501
|
+
onPointerUp: (n) => {
|
|
12502
|
+
(Xj.current || Zj.current) && uM(n.nativeEvent);
|
|
12503
|
+
},
|
|
12504
|
+
onDragOver: _M,
|
|
12505
|
+
onDrop: vM,
|
|
12501
12506
|
style: {
|
|
12502
12507
|
width: "100%",
|
|
12503
12508
|
height: "100%",
|
|
@@ -12509,187 +12514,191 @@ const ElementContextMenu = ({ children: n, element: _ }) => {
|
|
|
12509
12514
|
backgroundSize: `${20 * n.zoom}px ${20 * n.zoom}px`,
|
|
12510
12515
|
backgroundPosition: `${n.pan.x}px ${n.pan.y}px`
|
|
12511
12516
|
},
|
|
12512
|
-
children: [
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
height: "100%",
|
|
12518
|
-
position: "absolute",
|
|
12519
|
-
top: 0,
|
|
12520
|
-
left: 0,
|
|
12521
|
-
pointerEvents: "none"
|
|
12522
|
-
},
|
|
12523
|
-
children: [
|
|
12524
|
-
/* @__PURE__ */ jsx("div", { style: {
|
|
12517
|
+
children: [
|
|
12518
|
+
/* @__PURE__ */ jsxs("div", {
|
|
12519
|
+
style: {
|
|
12520
|
+
transform: `translate(${n.pan.x}px, ${n.pan.y}px) scale(${n.zoom})`,
|
|
12521
|
+
transformOrigin: "0 0",
|
|
12525
12522
|
width: "100%",
|
|
12526
12523
|
height: "100%",
|
|
12527
12524
|
position: "absolute",
|
|
12528
|
-
left: 0,
|
|
12529
12525
|
top: 0,
|
|
12530
|
-
|
|
12531
|
-
} }),
|
|
12532
|
-
Z && /* @__PURE__ */ jsx("div", { style: {
|
|
12533
|
-
position: "absolute",
|
|
12534
|
-
left: Z.x,
|
|
12535
|
-
top: Z.y,
|
|
12536
|
-
width: Z.width,
|
|
12537
|
-
height: Z.height,
|
|
12538
|
-
backgroundColor: "rgba(0, 120, 255, 0.1)",
|
|
12539
|
-
border: "1px solid rgba(0, 120, 255, 0.5)",
|
|
12540
|
-
pointerEvents: "none",
|
|
12541
|
-
zIndex: 9999
|
|
12542
|
-
} }),
|
|
12543
|
-
n.snapLines.map((n, _) => /* @__PURE__ */ jsx("div", { style: {
|
|
12544
|
-
position: "absolute",
|
|
12545
|
-
left: n.orientation === "vertical" ? n.position : 0,
|
|
12546
|
-
top: n.orientation === "horizontal" ? n.position : 0,
|
|
12547
|
-
width: n.orientation === "vertical" ? "1px" : "100%",
|
|
12548
|
-
height: n.orientation === "horizontal" ? "1px" : "100%",
|
|
12549
|
-
backgroundColor: "red",
|
|
12550
|
-
zIndex: 9999,
|
|
12526
|
+
left: 0,
|
|
12551
12527
|
pointerEvents: "none"
|
|
12552
|
-
}
|
|
12553
|
-
|
|
12554
|
-
style: {
|
|
12528
|
+
},
|
|
12529
|
+
children: [
|
|
12530
|
+
n.snapLines.map((n, _) => /* @__PURE__ */ jsx("div", { style: {
|
|
12555
12531
|
position: "absolute",
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
width: "100%",
|
|
12559
|
-
height: "1px",
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
zIndex: 5,
|
|
12532
|
+
left: n.orientation === "vertical" ? n.position : 0,
|
|
12533
|
+
top: n.orientation === "horizontal" ? n.position : 0,
|
|
12534
|
+
width: n.orientation === "vertical" ? "1px" : "100%",
|
|
12535
|
+
height: n.orientation === "horizontal" ? "1px" : "100%",
|
|
12536
|
+
backgroundColor: "red",
|
|
12537
|
+
zIndex: 9999,
|
|
12563
12538
|
pointerEvents: "none"
|
|
12564
|
-
},
|
|
12565
|
-
|
|
12539
|
+
} }, _)),
|
|
12540
|
+
/* @__PURE__ */ jsx("div", {
|
|
12566
12541
|
style: {
|
|
12567
12542
|
position: "absolute",
|
|
12568
|
-
top:
|
|
12569
|
-
left:
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12543
|
+
top: 0,
|
|
12544
|
+
left: 0,
|
|
12545
|
+
width: "100%",
|
|
12546
|
+
height: "1px",
|
|
12547
|
+
borderTop: "1px dashed var(--accent-9)",
|
|
12548
|
+
opacity: .6,
|
|
12549
|
+
zIndex: 5,
|
|
12550
|
+
pointerEvents: "none"
|
|
12573
12551
|
},
|
|
12574
|
-
children:
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12552
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
12553
|
+
style: {
|
|
12554
|
+
position: "absolute",
|
|
12555
|
+
top: -16,
|
|
12556
|
+
left: 4,
|
|
12557
|
+
fontSize: "10px",
|
|
12558
|
+
color: "var(--accent-9)",
|
|
12559
|
+
fontWeight: 500
|
|
12560
|
+
},
|
|
12561
|
+
children: "Início (0px)"
|
|
12562
|
+
})
|
|
12563
|
+
}),
|
|
12564
|
+
n.elements.map((_) => /* @__PURE__ */ jsx("div", {
|
|
12565
|
+
style: { pointerEvents: "auto" },
|
|
12566
|
+
children: /* @__PURE__ */ jsx(DraggableElement, {
|
|
12567
|
+
element: _,
|
|
12568
|
+
isSelected: n.selectedElementIds.includes(_.id)
|
|
12569
|
+
})
|
|
12570
|
+
}, _.id)),
|
|
12571
|
+
Z && /* @__PURE__ */ jsx("div", { style: {
|
|
12579
12572
|
position: "absolute",
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
height:
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
group: "resize-handle"
|
|
12591
|
-
},
|
|
12592
|
-
onMouseDown: fM,
|
|
12593
|
-
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12594
|
-
width: "100%",
|
|
12595
|
-
height: "2px",
|
|
12596
|
-
backgroundColor: "var(--accent-9)",
|
|
12597
|
-
borderBottom: "none",
|
|
12598
|
-
opacity: .8,
|
|
12599
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.2)"
|
|
12600
|
-
} }), /* @__PURE__ */ jsxs("div", {
|
|
12573
|
+
left: Z.x,
|
|
12574
|
+
top: Z.y,
|
|
12575
|
+
width: Z.width,
|
|
12576
|
+
height: Z.height,
|
|
12577
|
+
backgroundColor: "rgba(0, 120, 255, 0.2)",
|
|
12578
|
+
border: "1px solid rgba(0, 120, 255, 0.8)",
|
|
12579
|
+
pointerEvents: "none",
|
|
12580
|
+
zIndex: 999999
|
|
12581
|
+
} }),
|
|
12582
|
+
n.isList && /* @__PURE__ */ jsxs("div", {
|
|
12601
12583
|
style: {
|
|
12602
12584
|
position: "absolute",
|
|
12603
|
-
|
|
12604
|
-
|
|
12585
|
+
top: yM,
|
|
12586
|
+
left: 0,
|
|
12587
|
+
right: 0,
|
|
12588
|
+
height: "10px",
|
|
12589
|
+
marginTop: "-5px",
|
|
12590
|
+
cursor: "ns-resize",
|
|
12591
|
+
zIndex: 100,
|
|
12592
|
+
display: "flex",
|
|
12593
|
+
alignItems: "center",
|
|
12594
|
+
justifyContent: "center",
|
|
12595
|
+
group: "resize-handle"
|
|
12596
|
+
},
|
|
12597
|
+
onMouseDown: mM,
|
|
12598
|
+
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
12599
|
+
width: "100%",
|
|
12600
|
+
height: "2px",
|
|
12605
12601
|
backgroundColor: "var(--accent-9)",
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12602
|
+
borderBottom: "none",
|
|
12603
|
+
opacity: .8,
|
|
12604
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.2)"
|
|
12605
|
+
} }), /* @__PURE__ */ jsxs("div", {
|
|
12606
|
+
style: {
|
|
12607
|
+
position: "absolute",
|
|
12608
|
+
right: 10,
|
|
12609
|
+
top: -20,
|
|
12610
|
+
backgroundColor: "var(--accent-9)",
|
|
12611
|
+
color: "white",
|
|
12612
|
+
fontSize: "11px",
|
|
12613
|
+
padding: "2px 6px",
|
|
12614
|
+
borderRadius: "4px",
|
|
12615
|
+
fontWeight: 500,
|
|
12616
|
+
pointerEvents: "none",
|
|
12617
|
+
boxShadow: "0 2px 5px rgba(0,0,0,0.1)"
|
|
12618
|
+
},
|
|
12619
|
+
children: [
|
|
12620
|
+
"Altura do Item: ",
|
|
12621
|
+
yM,
|
|
12622
|
+
"px"
|
|
12623
|
+
]
|
|
12624
|
+
})]
|
|
12625
|
+
}),
|
|
12626
|
+
n.elements.length === 0 && /* @__PURE__ */ jsx(p$1, {
|
|
12627
|
+
align: "center",
|
|
12628
|
+
justify: "center",
|
|
12629
|
+
style: {
|
|
12630
|
+
height: "100%",
|
|
12631
|
+
color: "var(--gray-8)",
|
|
12611
12632
|
pointerEvents: "none",
|
|
12612
|
-
|
|
12633
|
+
transform: `scale(${1 / n.zoom})`
|
|
12613
12634
|
},
|
|
12614
|
-
children:
|
|
12615
|
-
"Altura do Item: ",
|
|
12616
|
-
_M,
|
|
12617
|
-
"px"
|
|
12618
|
-
]
|
|
12619
|
-
})]
|
|
12620
|
-
}),
|
|
12621
|
-
n.elements.length === 0 && /* @__PURE__ */ jsx(p$1, {
|
|
12622
|
-
align: "center",
|
|
12623
|
-
justify: "center",
|
|
12624
|
-
style: {
|
|
12625
|
-
height: "100%",
|
|
12626
|
-
color: "var(--gray-8)",
|
|
12627
|
-
pointerEvents: "none",
|
|
12628
|
-
transform: `scale(${1 / n.zoom})`
|
|
12629
|
-
},
|
|
12630
|
-
children: /* @__PURE__ */ jsx(p$2, { children: "Adicione elementos e arraste livremente" })
|
|
12631
|
-
}),
|
|
12632
|
-
n.elements.map((_) => /* @__PURE__ */ jsx("div", {
|
|
12633
|
-
style: { pointerEvents: "auto" },
|
|
12634
|
-
children: /* @__PURE__ */ jsx(DraggableElement, {
|
|
12635
|
-
element: _,
|
|
12636
|
-
isSelected: n.selectedElementIds.includes(_.id)
|
|
12635
|
+
children: /* @__PURE__ */ jsx(p$2, { children: "Adicione elementos e arraste livremente" })
|
|
12637
12636
|
})
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12641
|
-
style: {
|
|
12637
|
+
]
|
|
12638
|
+
}),
|
|
12639
|
+
Z && /* @__PURE__ */ jsx("div", { style: {
|
|
12642
12640
|
position: "absolute",
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
|
|
12648
|
-
|
|
12649
|
-
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12641
|
+
top: 0,
|
|
12642
|
+
left: 0,
|
|
12643
|
+
width: "100%",
|
|
12644
|
+
height: "100%",
|
|
12645
|
+
zIndex: 999995,
|
|
12646
|
+
pointerEvents: "auto"
|
|
12647
|
+
} }),
|
|
12648
|
+
/* @__PURE__ */ jsxs("div", {
|
|
12649
|
+
style: {
|
|
12650
|
+
position: "absolute",
|
|
12651
|
+
bottom: 20,
|
|
12652
|
+
right: 20,
|
|
12653
|
+
display: "flex",
|
|
12654
|
+
gap: "8px",
|
|
12655
|
+
backgroundColor: "var(--color-panel-solid)",
|
|
12656
|
+
padding: "4px",
|
|
12657
|
+
borderRadius: "8px",
|
|
12658
|
+
boxShadow: "0 2px 10px rgba(0,0,0,0.1)",
|
|
12659
|
+
zIndex: 1e3
|
|
12660
|
+
},
|
|
12661
|
+
children: [
|
|
12662
|
+
/* @__PURE__ */ jsx("button", {
|
|
12663
|
+
onClick: () => A(Math.max(.1, n.zoom - .1)),
|
|
12664
|
+
style: {
|
|
12665
|
+
padding: "4px 8px",
|
|
12666
|
+
cursor: "pointer"
|
|
12667
|
+
},
|
|
12668
|
+
children: "-"
|
|
12669
|
+
}),
|
|
12670
|
+
/* @__PURE__ */ jsxs("span", {
|
|
12671
|
+
style: {
|
|
12672
|
+
padding: "4px 8px",
|
|
12673
|
+
minWidth: "50px",
|
|
12674
|
+
textAlign: "center"
|
|
12675
|
+
},
|
|
12676
|
+
children: [Math.round(n.zoom * 100), "%"]
|
|
12677
|
+
}),
|
|
12678
|
+
/* @__PURE__ */ jsx("button", {
|
|
12679
|
+
onClick: () => A(Math.min(5, n.zoom + .1)),
|
|
12680
|
+
style: {
|
|
12681
|
+
padding: "4px 8px",
|
|
12682
|
+
cursor: "pointer"
|
|
12683
|
+
},
|
|
12684
|
+
children: "+"
|
|
12685
|
+
}),
|
|
12686
|
+
/* @__PURE__ */ jsx("button", {
|
|
12687
|
+
onClick: () => {
|
|
12688
|
+
A(1), j({
|
|
12689
|
+
x: 0,
|
|
12690
|
+
y: 0
|
|
12691
|
+
});
|
|
12692
|
+
},
|
|
12693
|
+
style: {
|
|
12694
|
+
padding: "4px 8px",
|
|
12695
|
+
cursor: "pointer"
|
|
12696
|
+
},
|
|
12697
|
+
children: "Reset"
|
|
12698
|
+
})
|
|
12699
|
+
]
|
|
12700
|
+
})
|
|
12701
|
+
]
|
|
12693
12702
|
});
|
|
12694
12703
|
}, EditorSettings = () => {
|
|
12695
12704
|
let { state: n, updateListSettings: _, setCanvasHeight: E, setGridSize: O } = useEditor(), [A, j] = useState(!1), [M, N] = useState(""), [P, z] = useState("asc"), [B, H] = useState("bottom"), [U, G] = useState("down"), [Z, Yj] = useState("150"), [Xj, Zj] = useState(""), [Qj, eM] = useState("0"), [tM, nM] = useState("slideIn"), [rM, oM] = useState(.3), [sM, cM] = useState("ease-out");
|
|
@@ -18666,26 +18675,28 @@ var camelToKebab = (n) => n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toL
|
|
|
18666
18675
|
}
|
|
18667
18676
|
} catch {}
|
|
18668
18677
|
else {
|
|
18669
|
-
let _ = 0, N = /<([a-z]+)([^>]*?)>/i.exec(A);
|
|
18670
|
-
if (
|
|
18671
|
-
let
|
|
18672
|
-
_ =
|
|
18673
|
-
} else _ = measureTextHeight(A,
|
|
18674
|
-
let
|
|
18675
|
-
|
|
18676
|
-
|
|
18678
|
+
let _ = 0, N = parseInt(String(n.style && n.style.padding || 0)), P = Math.max(1, n.width - N * 2), z = /<([a-z]+)([^>]*?)>/i.exec(A);
|
|
18679
|
+
if (z) {
|
|
18680
|
+
let n = z[2], E = /height=["']?(\d+)["']?/i.exec(n), O = /height:\s*(\d+)px/i.exec(n);
|
|
18681
|
+
_ = E ? parseInt(E[1]) : O ? parseInt(O[1]) : measureTextHeight(A, P, M, j);
|
|
18682
|
+
} else _ = measureTextHeight(A, P, M, j);
|
|
18683
|
+
let B = _ + N * 2;
|
|
18684
|
+
(!z || z && !_) && (B += 4);
|
|
18685
|
+
let H = parseInt(String(n.style && n.style.minHeight || 0)), U = Math.max(B, H), W = n.height, G = U - W;
|
|
18686
|
+
if (G > 0) {
|
|
18687
|
+
let _ = n.y + W, A = {
|
|
18677
18688
|
x: n.x,
|
|
18678
18689
|
y: n.y,
|
|
18679
18690
|
width: n.width,
|
|
18680
|
-
height:
|
|
18691
|
+
height: W
|
|
18681
18692
|
};
|
|
18682
|
-
n.height =
|
|
18693
|
+
n.height = U, E.forEach((E) => {
|
|
18683
18694
|
if (E.id !== n.id) {
|
|
18684
18695
|
if (O(A, E)) {
|
|
18685
|
-
E.height +=
|
|
18696
|
+
E.height += G;
|
|
18686
18697
|
return;
|
|
18687
18698
|
}
|
|
18688
|
-
E.y >= _ && Math.max(0, Math.min(n.x + n.width, E.x + E.width) - Math.max(n.x, E.x)) > 0 && (E.y +=
|
|
18699
|
+
E.y >= _ && Math.max(0, Math.min(n.x + n.width, E.x + E.width) - Math.max(n.x, E.x)) > 0 && (E.y += G);
|
|
18689
18700
|
}
|
|
18690
18701
|
});
|
|
18691
18702
|
}
|