@thanh01.pmt/presentation-kit 0.2.3 → 0.2.5
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/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/{click-css-BGZI3XKk.d.cts → click-css-BP9oqy_1.d.cts} +1 -1
- package/dist/{click-css-eWONB-hS.d.ts → click-css-BbhqdtGr.d.ts} +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/{presets-JpoJbNKE.d.cts → presets-BIw_4ZXR.d.cts} +1 -1
- package/dist/{presets-B1N2_jKl.d.ts → presets-B_TY4i2a.d.ts} +1 -1
- package/dist/react/index.cjs +260 -277
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +6 -4
- package/dist/react/index.d.ts +6 -4
- package/dist/react/index.js +260 -277
- package/dist/react/index.js.map +1 -1
- package/dist/{types-DnR81ReX.d.cts → types-C1121XLt.d.cts} +2 -0
- package/dist/{types-DnR81ReX.d.ts → types-C1121XLt.d.ts} +2 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -585,11 +585,13 @@ function SlideDesignOverlay({
|
|
|
585
585
|
onLayoutChange,
|
|
586
586
|
onSave,
|
|
587
587
|
onClose,
|
|
588
|
-
isActive
|
|
588
|
+
isActive,
|
|
589
|
+
theme = "dark"
|
|
589
590
|
}) {
|
|
590
591
|
if (!isActive) return null;
|
|
591
592
|
const [boxes, setBoxes] = useState(layout?.boxes ?? []);
|
|
592
593
|
const [selectedId, setSelectedId] = useState(null);
|
|
594
|
+
const [editingId, setEditingId] = useState(null);
|
|
593
595
|
const containerRef = useRef(null);
|
|
594
596
|
useEffect(() => {
|
|
595
597
|
setBoxes(layout?.boxes ?? []);
|
|
@@ -622,40 +624,37 @@ function SlideDesignOverlay({
|
|
|
622
624
|
let [newX, newY, newW, newH] = [origX, origY, origW, origH];
|
|
623
625
|
switch (dragging.type) {
|
|
624
626
|
case "move":
|
|
625
|
-
newX = Math.max(0, Math.min(1280 - origW, origX + dx));
|
|
626
|
-
newY = Math.max(0, Math.min(720 - origH, origY + dy));
|
|
627
|
+
newX = Math.round(Math.max(0, Math.min(1280 - origW, origX + dx)));
|
|
628
|
+
newY = Math.round(Math.max(0, Math.min(720 - origH, origY + dy)));
|
|
627
629
|
break;
|
|
628
630
|
case "se":
|
|
629
|
-
newW = Math.max(
|
|
630
|
-
newH = Math.max(
|
|
631
|
+
newW = Math.round(Math.max(100, Math.min(1280 - origX, origW + dx)));
|
|
632
|
+
newH = Math.round(Math.max(40, Math.min(720 - origY, origH + dy)));
|
|
631
633
|
break;
|
|
632
634
|
case "e":
|
|
633
|
-
newW = Math.max(
|
|
635
|
+
newW = Math.round(Math.max(100, Math.min(1280 - origX, origW + dx)));
|
|
634
636
|
break;
|
|
635
637
|
case "s":
|
|
636
|
-
newH = Math.max(
|
|
638
|
+
newH = Math.round(Math.max(40, Math.min(720 - origY, origH + dy)));
|
|
637
639
|
break;
|
|
638
640
|
case "sw":
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
newH = Math.max(
|
|
641
|
+
newW = Math.round(Math.max(100, origW - dx));
|
|
642
|
+
newX = Math.round(Math.min(origX + origW - 100, origX + dx));
|
|
643
|
+
newH = Math.round(Math.max(40, origH + dy));
|
|
642
644
|
break;
|
|
643
645
|
case "ne":
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
646
|
+
newW = Math.round(Math.max(100, origW + dx));
|
|
647
|
+
newH = Math.round(Math.max(40, origH - dy));
|
|
648
|
+
newY = Math.round(Math.min(origY + origH - 40, origY + dy));
|
|
647
649
|
break;
|
|
648
650
|
case "nw":
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
651
|
+
newW = Math.round(Math.max(100, origW - dx));
|
|
652
|
+
newX = Math.round(Math.min(origX + origW - 100, origX + dx));
|
|
653
|
+
newH = Math.round(Math.max(40, origH - dy));
|
|
654
|
+
newY = Math.round(Math.min(origY + origH - 40, origY + dy));
|
|
653
655
|
break;
|
|
654
656
|
}
|
|
655
|
-
return {
|
|
656
|
-
...b,
|
|
657
|
-
pos: [Math.round(newX), Math.round(newY), Math.round(newW), Math.round(newH)]
|
|
658
|
-
};
|
|
657
|
+
return { ...b, pos: [newX, newY, newW, newH] };
|
|
659
658
|
});
|
|
660
659
|
onLayoutChange({ boxes: updated });
|
|
661
660
|
return updated;
|
|
@@ -675,23 +674,27 @@ function SlideDesignOverlay({
|
|
|
675
674
|
}
|
|
676
675
|
}, [dragging, handleMouseMove, handleMouseUp]);
|
|
677
676
|
const addNewBox = (targetTag) => {
|
|
677
|
+
const isH1 = targetTag === "h1";
|
|
678
|
+
const newId = `box-${Date.now().toString(36)}`;
|
|
678
679
|
const newBox = {
|
|
679
|
-
id:
|
|
680
|
+
id: newId,
|
|
680
681
|
target: targetTag,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
682
|
+
content: isH1 ? "Ti\xEAu \u0111\u1EC1 b\xE0i gi\u1EA3ng" : "Nh\u1EADp n\u1ED9i dung \u0111o\u1EA1n v\u0103n t\u1EA1i \u0111\xE2y...",
|
|
683
|
+
pos: [100, isH1 ? 160 : 300, isH1 ? 700 : 600, isH1 ? 90 : 120],
|
|
684
|
+
fontSize: isH1 ? "2.5rem" : "1.2rem",
|
|
685
|
+
color: isLight ? "#0f172a" : "#f8fafc",
|
|
684
686
|
textAlign: "left"
|
|
685
687
|
};
|
|
686
688
|
const updated = [...boxes, newBox];
|
|
687
689
|
setBoxes(updated);
|
|
688
|
-
setSelectedId(
|
|
690
|
+
setSelectedId(newId);
|
|
691
|
+
setEditingId(newId);
|
|
689
692
|
onLayoutChange({ boxes: updated });
|
|
690
693
|
};
|
|
691
|
-
const updateSelectedBox = (
|
|
694
|
+
const updateSelectedBox = (partial) => {
|
|
692
695
|
if (!selectedId) return;
|
|
693
696
|
setBoxes((prev) => {
|
|
694
|
-
const updated = prev.map((b) => b.id === selectedId ? { ...b, ...
|
|
697
|
+
const updated = prev.map((b) => b.id === selectedId ? { ...b, ...partial } : b);
|
|
695
698
|
onLayoutChange({ boxes: updated });
|
|
696
699
|
return updated;
|
|
697
700
|
});
|
|
@@ -705,6 +708,32 @@ function SlideDesignOverlay({
|
|
|
705
708
|
});
|
|
706
709
|
setSelectedId(null);
|
|
707
710
|
};
|
|
711
|
+
const isLight = theme === "light";
|
|
712
|
+
const isNavy = theme === "navy";
|
|
713
|
+
const toolbarBg = isLight ? "rgba(255, 255, 255, 0.96)" : isNavy ? "rgba(11, 19, 43, 0.95)" : "rgba(24, 25, 32, 0.95)";
|
|
714
|
+
const toolbarBorder = isLight ? "1px solid rgba(0, 0, 0, 0.12)" : isNavy ? "1px solid rgba(56, 189, 248, 0.35)" : "1px solid rgba(255, 255, 255, 0.15)";
|
|
715
|
+
const toolbarColor = isLight ? "#0f172a" : "#f8fafc";
|
|
716
|
+
const toolbarShadow = isLight ? "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)" : "0 12px 30px rgba(0, 0, 0, 0.6)";
|
|
717
|
+
const brandColor = isLight ? "#0284c7" : "#38bdf8";
|
|
718
|
+
const subtextColor = isLight ? "#64748b" : "#94a3b8";
|
|
719
|
+
const btnStyle = {
|
|
720
|
+
height: "28px",
|
|
721
|
+
padding: "0 12px",
|
|
722
|
+
borderRadius: "14px",
|
|
723
|
+
fontSize: "11px",
|
|
724
|
+
fontWeight: 500,
|
|
725
|
+
fontFamily: "inherit",
|
|
726
|
+
border: isLight ? "1px solid rgba(0, 0, 0, 0.1)" : "1px solid rgba(255, 255, 255, 0.15)",
|
|
727
|
+
backgroundColor: isLight ? "rgba(0, 0, 0, 0.04)" : "rgba(255, 255, 255, 0.08)",
|
|
728
|
+
color: isLight ? "#0f172a" : "#f1f5f9",
|
|
729
|
+
cursor: "pointer",
|
|
730
|
+
display: "inline-flex",
|
|
731
|
+
alignItems: "center",
|
|
732
|
+
justifyContent: "center",
|
|
733
|
+
whiteSpace: "nowrap",
|
|
734
|
+
flexShrink: 0,
|
|
735
|
+
transition: "all 0.15s ease"
|
|
736
|
+
};
|
|
708
737
|
return /* @__PURE__ */ jsxs(
|
|
709
738
|
"div",
|
|
710
739
|
{
|
|
@@ -713,7 +742,6 @@ function SlideDesignOverlay({
|
|
|
713
742
|
inset: 0,
|
|
714
743
|
zIndex: 50,
|
|
715
744
|
pointerEvents: "none"
|
|
716
|
-
// Allow passing through to children that have pointerEvents: 'auto'
|
|
717
745
|
},
|
|
718
746
|
children: [
|
|
719
747
|
/* @__PURE__ */ jsxs(
|
|
@@ -730,36 +758,21 @@ function SlideDesignOverlay({
|
|
|
730
758
|
alignItems: "center",
|
|
731
759
|
gap: "8px",
|
|
732
760
|
padding: "6px 14px",
|
|
733
|
-
backgroundColor:
|
|
734
|
-
|
|
761
|
+
backgroundColor: toolbarBg,
|
|
762
|
+
backdropFilter: "blur(12px)",
|
|
763
|
+
WebkitBackdropFilter: "blur(12px)",
|
|
764
|
+
border: toolbarBorder,
|
|
735
765
|
borderRadius: "24px",
|
|
736
|
-
boxShadow:
|
|
737
|
-
color:
|
|
766
|
+
boxShadow: toolbarShadow,
|
|
767
|
+
color: toolbarColor,
|
|
738
768
|
fontSize: "12px",
|
|
739
|
-
fontFamily: "Inter, sans-serif"
|
|
769
|
+
fontFamily: "Inter, sans-serif",
|
|
770
|
+
whiteSpace: "nowrap"
|
|
740
771
|
},
|
|
741
772
|
children: [
|
|
742
|
-
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: "
|
|
743
|
-
/* @__PURE__ */ jsx(
|
|
744
|
-
|
|
745
|
-
{
|
|
746
|
-
type: "button",
|
|
747
|
-
onClick: () => addNewBox("h1"),
|
|
748
|
-
style: toolbarButtonStyle,
|
|
749
|
-
title: "Th\xEAm khung v\u1ECB tr\xED Ti\xEAu \u0111\u1EC1",
|
|
750
|
-
children: "+ Ti\xEAu \u0111\u1EC1 (H1)"
|
|
751
|
-
}
|
|
752
|
-
),
|
|
753
|
-
/* @__PURE__ */ jsx(
|
|
754
|
-
"button",
|
|
755
|
-
{
|
|
756
|
-
type: "button",
|
|
757
|
-
onClick: () => addNewBox("p"),
|
|
758
|
-
style: toolbarButtonStyle,
|
|
759
|
-
title: "Th\xEAm khung v\u1ECB tr\xED \u0110o\u1EA1n v\u0103n",
|
|
760
|
-
children: "+ \u0110o\u1EA1n v\u0103n (P)"
|
|
761
|
-
}
|
|
762
|
-
),
|
|
773
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: brandColor, whiteSpace: "nowrap" }, children: "Design Canvas:" }),
|
|
774
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => addNewBox("h1"), style: btnStyle, title: "Th\xEAm khung v\u1ECB tr\xED Ti\xEAu \u0111\u1EC1", children: "+ Ti\xEAu \u0111\u1EC1 (H1)" }),
|
|
775
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => addNewBox("p"), style: btnStyle, title: "Th\xEAm khung v\u1ECB tr\xED \u0110o\u1EA1n v\u0103n", children: "+ \u0110o\u1EA1n v\u0103n (P)" }),
|
|
763
776
|
/* @__PURE__ */ jsxs(
|
|
764
777
|
"select",
|
|
765
778
|
{
|
|
@@ -773,263 +786,248 @@ function SlideDesignOverlay({
|
|
|
773
786
|
},
|
|
774
787
|
defaultValue: "",
|
|
775
788
|
style: {
|
|
776
|
-
...
|
|
789
|
+
...btnStyle,
|
|
777
790
|
cursor: "pointer",
|
|
778
791
|
outline: "none",
|
|
779
|
-
color: "#f8fafc",
|
|
780
|
-
|
|
792
|
+
color: isLight ? "#0f172a" : "#f8fafc",
|
|
793
|
+
backgroundColor: isLight ? "#ffffff" : "#1e1f29",
|
|
794
|
+
border: isLight ? "1px solid rgba(0, 0, 0, 0.15)" : "1px solid rgba(56, 189, 248, 0.3)",
|
|
795
|
+
maxWidth: "180px"
|
|
781
796
|
},
|
|
782
797
|
title: "\xC1p d\u1EE5ng m\u1EABu b\u1ED1 c\u1EE5c c\xF3 s\u1EB5n",
|
|
783
798
|
children: [
|
|
784
|
-
/* @__PURE__ */ jsx("option", { value: "", disabled: true, style: { backgroundColor: "#
|
|
785
|
-
SLIDE_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ jsx("option", { value: p.id, style: { backgroundColor: "#1e1f29", color: "#f8fafc" }, children: p.name }, p.id))
|
|
799
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, style: { backgroundColor: isLight ? "#ffffff" : "#1e1f29", color: subtextColor }, children: "M\u1EABu b\u1ED1 c\u1EE5c (Presets)..." }),
|
|
800
|
+
SLIDE_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ jsx("option", { value: p.id, style: { backgroundColor: isLight ? "#ffffff" : "#1e1f29", color: isLight ? "#0f172a" : "#f8fafc" }, children: p.name }, p.id))
|
|
786
801
|
]
|
|
787
802
|
}
|
|
788
803
|
),
|
|
789
|
-
/* @__PURE__ */ jsx("div", { style: { width: "1px", height: "16px", backgroundColor: "rgba(255,255,255,0.2)" } }),
|
|
790
|
-
onSave && /* @__PURE__ */ jsx(
|
|
791
|
-
|
|
792
|
-
{
|
|
793
|
-
type: "button",
|
|
794
|
-
onClick: () => onSave({ boxes }),
|
|
795
|
-
style: {
|
|
796
|
-
...toolbarButtonStyle,
|
|
797
|
-
backgroundColor: "#0284c7",
|
|
798
|
-
color: "#ffffff",
|
|
799
|
-
fontWeight: 600
|
|
800
|
-
},
|
|
801
|
-
children: "L\u01B0u b\u1ED1 c\u1EE5c"
|
|
802
|
-
}
|
|
803
|
-
),
|
|
804
|
-
onClose && /* @__PURE__ */ jsx(
|
|
805
|
-
"button",
|
|
806
|
-
{
|
|
807
|
-
type: "button",
|
|
808
|
-
onClick: onClose,
|
|
809
|
-
style: {
|
|
810
|
-
...toolbarButtonStyle,
|
|
811
|
-
backgroundColor: "transparent",
|
|
812
|
-
color: "#94a3b8"
|
|
813
|
-
},
|
|
814
|
-
children: "\u0110\xF3ng"
|
|
815
|
-
}
|
|
816
|
-
)
|
|
804
|
+
/* @__PURE__ */ jsx("div", { style: { width: "1px", height: "16px", backgroundColor: isLight ? "rgba(0,0,0,0.15)" : "rgba(255,255,255,0.2)" } }),
|
|
805
|
+
onSave && /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onSave({ boxes }), style: { ...btnStyle, backgroundColor: "#0284c7", color: "#ffffff", fontWeight: 600, border: "none" }, children: "L\u01B0u b\u1ED1 c\u1EE5c" }),
|
|
806
|
+
onClose && /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, style: { ...btnStyle, backgroundColor: "transparent", border: "none", color: subtextColor }, children: "\u0110\xF3ng" })
|
|
817
807
|
]
|
|
818
808
|
}
|
|
819
809
|
),
|
|
820
|
-
/* @__PURE__ */ jsx(
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
{
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
810
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, style: { position: "absolute", inset: 0, pointerEvents: "auto" }, onClick: () => setSelectedId(null), children: boxes.map((box) => {
|
|
811
|
+
const [x, y, w, h] = box.pos;
|
|
812
|
+
const isSelected = box.id === selectedId;
|
|
813
|
+
const leftPercent = x / 1280 * 100;
|
|
814
|
+
const topPercent = y / 720 * 100;
|
|
815
|
+
const widthPercent = w / 1280 * 100;
|
|
816
|
+
const heightPercent = h / 720 * 100;
|
|
817
|
+
return /* @__PURE__ */ jsxs(
|
|
818
|
+
"div",
|
|
819
|
+
{
|
|
820
|
+
onClick: (e) => {
|
|
821
|
+
e.stopPropagation();
|
|
822
|
+
setSelectedId(box.id);
|
|
823
|
+
},
|
|
824
|
+
onMouseDown: (e) => handleMouseDown(e, box, "move"),
|
|
825
|
+
style: {
|
|
826
|
+
position: "absolute",
|
|
827
|
+
left: `${leftPercent}%`,
|
|
828
|
+
top: `${topPercent}%`,
|
|
829
|
+
width: `${widthPercent}%`,
|
|
830
|
+
height: `${heightPercent}%`,
|
|
831
|
+
border: isSelected ? isLight ? "2px solid #0284c7" : "2px solid #38bdf8" : isLight ? "1.5px dashed rgba(2, 132, 199, 0.5)" : "1.5px dashed rgba(56, 189, 248, 0.5)",
|
|
832
|
+
backgroundColor: isSelected ? isLight ? "rgba(2, 132, 199, 0.08)" : "rgba(56, 189, 248, 0.08)" : isLight ? "rgba(2, 132, 199, 0.02)" : "rgba(56, 189, 248, 0.03)",
|
|
833
|
+
cursor: editingId === box.id ? "default" : "move",
|
|
834
|
+
userSelect: editingId === box.id ? "text" : "none",
|
|
835
|
+
boxSizing: "border-box",
|
|
836
|
+
zIndex: isSelected ? 40 : 20,
|
|
837
|
+
display: "flex",
|
|
838
|
+
alignItems: "center",
|
|
839
|
+
overflow: "visible"
|
|
840
|
+
},
|
|
841
|
+
children: [
|
|
842
|
+
/* @__PURE__ */ jsx(
|
|
843
|
+
"div",
|
|
844
|
+
{
|
|
845
|
+
style: {
|
|
846
|
+
width: "100%",
|
|
847
|
+
height: "100%",
|
|
848
|
+
padding: "4px 8px",
|
|
849
|
+
boxSizing: "border-box",
|
|
850
|
+
display: "flex",
|
|
851
|
+
alignItems: "center",
|
|
852
|
+
overflow: "hidden"
|
|
853
|
+
},
|
|
854
|
+
children: editingId === box.id ? /* @__PURE__ */ jsx(
|
|
855
|
+
"textarea",
|
|
856
|
+
{
|
|
857
|
+
autoFocus: true,
|
|
858
|
+
value: box.content ?? "",
|
|
859
|
+
placeholder: box.target === "h1" ? "Nh\u1EADp ti\xEAu \u0111\u1EC1..." : "Nh\u1EADp n\u1ED9i dung...",
|
|
860
|
+
onChange: (e) => updateSelectedBox({ content: e.target.value }),
|
|
861
|
+
onBlur: () => setEditingId(null),
|
|
862
|
+
onKeyDown: (e) => {
|
|
863
|
+
if (e.key === "Escape") setEditingId(null);
|
|
864
|
+
},
|
|
865
|
+
onClick: (e) => e.stopPropagation(),
|
|
866
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
867
|
+
style: {
|
|
868
|
+
width: "100%",
|
|
869
|
+
height: "100%",
|
|
870
|
+
background: "transparent",
|
|
871
|
+
border: "none",
|
|
872
|
+
outline: "none",
|
|
873
|
+
resize: "none",
|
|
874
|
+
fontSize: box.fontSize ?? (box.target === "h1" ? "2.2rem" : "1.1rem"),
|
|
875
|
+
color: box.color ?? (isLight ? "#0f172a" : "#f8fafc"),
|
|
876
|
+
textAlign: box.textAlign ?? "left",
|
|
877
|
+
fontFamily: "Inter, sans-serif",
|
|
878
|
+
fontWeight: box.target === "h1" ? 700 : 400,
|
|
879
|
+
lineHeight: 1.25,
|
|
880
|
+
padding: 0,
|
|
881
|
+
margin: 0
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
) : /* @__PURE__ */ jsx(
|
|
860
885
|
"div",
|
|
861
886
|
{
|
|
887
|
+
onDoubleClick: (e) => {
|
|
888
|
+
e.stopPropagation();
|
|
889
|
+
setSelectedId(box.id);
|
|
890
|
+
setEditingId(box.id);
|
|
891
|
+
},
|
|
862
892
|
style: {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
893
|
+
width: "100%",
|
|
894
|
+
height: "100%",
|
|
895
|
+
fontSize: box.fontSize ?? (box.target === "h1" ? "2.2rem" : "1.1rem"),
|
|
896
|
+
color: box.color ?? (isLight ? "#0f172a" : "#f8fafc"),
|
|
897
|
+
textAlign: box.textAlign ?? "left",
|
|
898
|
+
fontFamily: "Inter, sans-serif",
|
|
899
|
+
fontWeight: box.target === "h1" ? 700 : 400,
|
|
900
|
+
lineHeight: 1.25,
|
|
901
|
+
wordBreak: "break-word",
|
|
902
|
+
userSelect: "none",
|
|
903
|
+
cursor: "pointer",
|
|
904
|
+
display: "flex",
|
|
905
|
+
alignItems: "center"
|
|
873
906
|
},
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
" (",
|
|
877
|
-
Math.round(x),
|
|
878
|
-
", ",
|
|
879
|
-
Math.round(y),
|
|
880
|
-
")"
|
|
881
|
-
]
|
|
907
|
+
title: "Click \u0111\xFAp \u0111\u1EC3 s\u1EEDa ch\u1EEF",
|
|
908
|
+
children: box.content ? /* @__PURE__ */ jsx("span", { children: box.content }) : /* @__PURE__ */ jsx("span", { style: { opacity: 0.45, fontStyle: "italic", fontSize: "12px" }, children: box.target === "h1" ? "Ti\xEAu \u0111\u1EC1 (Click \u0111\xFAp \u0111\u1EC3 s\u1EEDa)..." : "N\u1ED9i dung (Click \u0111\xFAp \u0111\u1EC3 s\u1EEDa)..." })
|
|
882
909
|
}
|
|
883
|
-
)
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
)
|
|
927
|
-
] })
|
|
928
|
-
]
|
|
929
|
-
},
|
|
930
|
-
box.id
|
|
931
|
-
);
|
|
932
|
-
})
|
|
933
|
-
}
|
|
934
|
-
),
|
|
910
|
+
)
|
|
911
|
+
}
|
|
912
|
+
),
|
|
913
|
+
/* @__PURE__ */ jsxs(
|
|
914
|
+
"div",
|
|
915
|
+
{
|
|
916
|
+
style: {
|
|
917
|
+
position: "absolute",
|
|
918
|
+
top: "-20px",
|
|
919
|
+
left: "0",
|
|
920
|
+
fontSize: "10px",
|
|
921
|
+
fontWeight: 600,
|
|
922
|
+
color: isLight ? isSelected ? "#0284c7" : "#475569" : isSelected ? "#38bdf8" : "rgba(56, 189, 248, 0.8)",
|
|
923
|
+
backgroundColor: isLight ? "rgba(255,255,255,0.95)" : "rgba(15,23,42,0.9)",
|
|
924
|
+
border: isLight ? "1px solid rgba(0,0,0,0.1)" : "1px solid rgba(56,189,248,0.3)",
|
|
925
|
+
padding: "1px 6px",
|
|
926
|
+
borderRadius: "4px",
|
|
927
|
+
whiteSpace: "nowrap",
|
|
928
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
|
|
929
|
+
},
|
|
930
|
+
children: [
|
|
931
|
+
box.target || box.id,
|
|
932
|
+
" (",
|
|
933
|
+
Math.round(x),
|
|
934
|
+
", ",
|
|
935
|
+
Math.round(y),
|
|
936
|
+
")"
|
|
937
|
+
]
|
|
938
|
+
}
|
|
939
|
+
),
|
|
940
|
+
isSelected && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
941
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("se", isLight), onMouseDown: (e) => handleMouseDown(e, box, "se") }),
|
|
942
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("e", isLight), onMouseDown: (e) => handleMouseDown(e, box, "e") }),
|
|
943
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("s", isLight), onMouseDown: (e) => handleMouseDown(e, box, "s") }),
|
|
944
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("sw", isLight), onMouseDown: (e) => handleMouseDown(e, box, "sw") }),
|
|
945
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("ne", isLight), onMouseDown: (e) => handleMouseDown(e, box, "ne") }),
|
|
946
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("nw", isLight), onMouseDown: (e) => handleMouseDown(e, box, "nw") })
|
|
947
|
+
] })
|
|
948
|
+
]
|
|
949
|
+
},
|
|
950
|
+
box.id
|
|
951
|
+
);
|
|
952
|
+
}) }),
|
|
935
953
|
selectedBox && /* @__PURE__ */ jsxs(
|
|
936
954
|
"div",
|
|
937
955
|
{
|
|
938
956
|
style: {
|
|
939
957
|
position: "absolute",
|
|
940
|
-
bottom: "
|
|
958
|
+
bottom: "20px",
|
|
941
959
|
left: "50%",
|
|
942
960
|
transform: "translateX(-50%)",
|
|
943
961
|
zIndex: 60,
|
|
944
962
|
pointerEvents: "auto",
|
|
945
963
|
display: "flex",
|
|
946
964
|
alignItems: "center",
|
|
947
|
-
gap: "
|
|
965
|
+
gap: "10px",
|
|
948
966
|
padding: "8px 16px",
|
|
949
|
-
backgroundColor:
|
|
950
|
-
|
|
967
|
+
backgroundColor: toolbarBg,
|
|
968
|
+
backdropFilter: "blur(12px)",
|
|
969
|
+
WebkitBackdropFilter: "blur(12px)",
|
|
970
|
+
border: toolbarBorder,
|
|
951
971
|
borderRadius: "12px",
|
|
952
|
-
boxShadow:
|
|
953
|
-
color:
|
|
972
|
+
boxShadow: toolbarShadow,
|
|
973
|
+
color: toolbarColor,
|
|
954
974
|
fontSize: "12px",
|
|
955
|
-
fontFamily: "Inter, sans-serif"
|
|
975
|
+
fontFamily: "Inter, sans-serif",
|
|
976
|
+
whiteSpace: "nowrap"
|
|
956
977
|
},
|
|
957
978
|
children: [
|
|
958
|
-
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600, color: "
|
|
979
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600, color: brandColor, whiteSpace: "nowrap" }, children: [
|
|
959
980
|
"Khung: ",
|
|
960
981
|
selectedBox.target
|
|
961
982
|
] }),
|
|
962
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
963
|
-
/* @__PURE__ */ jsx("span", { style: { color:
|
|
983
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
984
|
+
/* @__PURE__ */ jsx("span", { style: { color: subtextColor, fontSize: "11px" }, children: "Ch\u1EEF:" }),
|
|
964
985
|
/* @__PURE__ */ jsx(
|
|
965
986
|
"input",
|
|
966
987
|
{
|
|
967
988
|
type: "text",
|
|
968
|
-
value: selectedBox.
|
|
969
|
-
|
|
989
|
+
value: selectedBox.content ?? "",
|
|
990
|
+
placeholder: "Nh\u1EADp n\u1ED9i dung...",
|
|
991
|
+
onChange: (e) => updateSelectedBox({ content: e.target.value }),
|
|
970
992
|
style: {
|
|
971
|
-
width: "
|
|
972
|
-
padding: "2px
|
|
993
|
+
width: "130px",
|
|
994
|
+
padding: "2px 8px",
|
|
973
995
|
borderRadius: "4px",
|
|
974
|
-
border: "1px solid #334155",
|
|
975
|
-
backgroundColor: "#0f172a",
|
|
976
|
-
color: "#f8fafc",
|
|
996
|
+
border: isLight ? "1px solid #cbd5e1" : "1px solid #334155",
|
|
997
|
+
backgroundColor: isLight ? "#f8fafc" : "#0f172a",
|
|
998
|
+
color: isLight ? "#0f172a" : "#f8fafc",
|
|
977
999
|
fontSize: "11px"
|
|
978
1000
|
}
|
|
979
1001
|
}
|
|
980
1002
|
)
|
|
981
1003
|
] }),
|
|
982
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
983
|
-
/* @__PURE__ */ jsx("span", { style: { color: "#94a3b8", fontSize: "11px" }, children: "Color:" }),
|
|
984
|
-
/* @__PURE__ */ jsx(
|
|
985
|
-
"input",
|
|
986
|
-
{
|
|
987
|
-
type: "color",
|
|
988
|
-
value: selectedBox.color ?? "#38bdf8",
|
|
989
|
-
onChange: (e) => updateSelectedBox({ color: e.target.value }),
|
|
990
|
-
style: {
|
|
991
|
-
width: "24px",
|
|
992
|
-
height: "24px",
|
|
993
|
-
padding: "0",
|
|
994
|
-
border: "none",
|
|
995
|
-
borderRadius: "4px",
|
|
996
|
-
cursor: "pointer",
|
|
997
|
-
backgroundColor: "transparent"
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
)
|
|
1001
|
-
] }),
|
|
1002
|
-
/* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "2px" }, children: ["left", "center", "right"].map((align) => /* @__PURE__ */ jsx(
|
|
1003
|
-
"button",
|
|
1004
|
-
{
|
|
1005
|
-
type: "button",
|
|
1006
|
-
onClick: () => updateSelectedBox({ textAlign: align }),
|
|
1007
|
-
style: {
|
|
1008
|
-
...toolbarButtonStyle,
|
|
1009
|
-
backgroundColor: selectedBox.textAlign === align ? "#0284c7" : "rgba(255,255,255,0.05)",
|
|
1010
|
-
textTransform: "capitalize",
|
|
1011
|
-
fontSize: "11px",
|
|
1012
|
-
padding: "2px 8px"
|
|
1013
|
-
},
|
|
1014
|
-
children: align
|
|
1015
|
-
},
|
|
1016
|
-
align
|
|
1017
|
-
)) }),
|
|
1018
1004
|
/* @__PURE__ */ jsx(
|
|
1019
1005
|
"button",
|
|
1020
1006
|
{
|
|
1021
1007
|
type: "button",
|
|
1022
|
-
onClick:
|
|
1008
|
+
onClick: () => setEditingId(selectedBox.id),
|
|
1023
1009
|
style: {
|
|
1024
|
-
...
|
|
1025
|
-
backgroundColor: "rgba(
|
|
1026
|
-
color: "#
|
|
1027
|
-
|
|
1010
|
+
...btnStyle,
|
|
1011
|
+
backgroundColor: editingId === selectedBox.id ? "#0284c7" : isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)",
|
|
1012
|
+
color: editingId === selectedBox.id ? "#ffffff" : isLight ? "#0f172a" : "#e2e8f0",
|
|
1013
|
+
height: "24px",
|
|
1014
|
+
padding: "0 8px"
|
|
1028
1015
|
},
|
|
1029
|
-
title: "
|
|
1030
|
-
children: "
|
|
1016
|
+
title: "S\u1EEDa ch\u1EEF tr\u1EF1c ti\u1EBFp trong khung",
|
|
1017
|
+
children: "S\u1EEDa ch\u1EEF"
|
|
1031
1018
|
}
|
|
1032
|
-
)
|
|
1019
|
+
),
|
|
1020
|
+
/* @__PURE__ */ jsx("div", { style: { width: "1px", height: "14px", backgroundColor: isLight ? "rgba(0,0,0,0.12)" : "rgba(255,255,255,0.15)" } }),
|
|
1021
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
1022
|
+
/* @__PURE__ */ jsx("span", { style: { color: subtextColor, fontSize: "11px" }, children: "Size:" }),
|
|
1023
|
+
/* @__PURE__ */ jsx("input", { type: "text", value: selectedBox.fontSize ?? "1.5rem", onChange: (e) => updateSelectedBox({ fontSize: e.target.value }), style: { width: "55px", padding: "2px 6px", borderRadius: "4px", border: isLight ? "1px solid #cbd5e1" : "1px solid #334155", backgroundColor: isLight ? "#f8fafc" : "#0f172a", color: isLight ? "#0f172a" : "#f8fafc", fontSize: "11px" } })
|
|
1024
|
+
] }),
|
|
1025
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
1026
|
+
/* @__PURE__ */ jsx("span", { style: { color: subtextColor, fontSize: "11px" }, children: "Color:" }),
|
|
1027
|
+
/* @__PURE__ */ jsx("input", { type: "color", value: selectedBox.color ?? (isLight ? "#0f172a" : "#38bdf8"), onChange: (e) => updateSelectedBox({ color: e.target.value }), style: { width: "22px", height: "22px", padding: "0", border: "none", borderRadius: "4px", cursor: "pointer", backgroundColor: "transparent" } })
|
|
1028
|
+
] }),
|
|
1029
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "2px", whiteSpace: "nowrap" }, children: ["left", "center", "right"].map((align) => /* @__PURE__ */ jsx("button", { type: "button", onClick: () => updateSelectedBox({ textAlign: align }), style: { ...btnStyle, backgroundColor: selectedBox.textAlign === align ? "#0284c7" : isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)", color: selectedBox.textAlign === align ? "#ffffff" : isLight ? "#0f172a" : "#e2e8f0", textTransform: "capitalize", fontSize: "11px", padding: "2px 6px", height: "22px" }, children: align }, align)) }),
|
|
1030
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: removeSelectedBox, style: { ...btnStyle, backgroundColor: isLight ? "rgba(239, 68, 68, 0.1)" : "rgba(239, 68, 68, 0.2)", color: isLight ? "#dc2626" : "#f87171", border: isLight ? "1px solid rgba(239, 68, 68, 0.3)" : "1px solid rgba(239, 68, 68, 0.4)", fontWeight: 500, height: "22px", padding: "0 8px" }, title: "X\xF3a \u0111\u1ECBnh v\u1ECB t\u1EF1 do c\u1EE7a khung n\xE0y", children: "X\xF3a v\u1ECB tr\xED" })
|
|
1033
1031
|
]
|
|
1034
1032
|
}
|
|
1035
1033
|
)
|
|
@@ -1037,29 +1035,14 @@ function SlideDesignOverlay({
|
|
|
1037
1035
|
}
|
|
1038
1036
|
);
|
|
1039
1037
|
}
|
|
1040
|
-
|
|
1041
|
-
height: "26px",
|
|
1042
|
-
padding: "0 10px",
|
|
1043
|
-
borderRadius: "14px",
|
|
1044
|
-
fontSize: "11px",
|
|
1045
|
-
fontFamily: "inherit",
|
|
1046
|
-
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
1047
|
-
backgroundColor: "rgba(255, 255, 255, 0.08)",
|
|
1048
|
-
color: "#e2e8f0",
|
|
1049
|
-
cursor: "pointer",
|
|
1050
|
-
display: "flex",
|
|
1051
|
-
alignItems: "center",
|
|
1052
|
-
justifyContent: "center",
|
|
1053
|
-
transition: "all 0.15s ease"
|
|
1054
|
-
};
|
|
1055
|
-
function handleStyle(pos) {
|
|
1038
|
+
function handleStyle(pos, isLight = false) {
|
|
1056
1039
|
const size = 10;
|
|
1057
1040
|
const base = {
|
|
1058
1041
|
position: "absolute",
|
|
1059
1042
|
width: `${size}px`,
|
|
1060
1043
|
height: `${size}px`,
|
|
1061
|
-
backgroundColor: "#ffffff",
|
|
1062
|
-
border: "2px solid #0284c7",
|
|
1044
|
+
backgroundColor: isLight ? "#ffffff" : "#0f172a",
|
|
1045
|
+
border: isLight ? "2px solid #0284c7" : "2px solid #38bdf8",
|
|
1063
1046
|
borderRadius: "2px",
|
|
1064
1047
|
boxSizing: "border-box",
|
|
1065
1048
|
zIndex: 50
|