@thanh01.pmt/presentation-kit 0.2.2 → 0.2.4
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.cjs +66 -64
- package/dist/ai/index.cjs.map +1 -1
- package/dist/ai/index.d.cts +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +60 -58
- package/dist/ai/index.js.map +1 -1
- package/dist/{chunk-HBMXEPZJ.js → chunk-3IKL6SBP.js} +110 -109
- package/dist/chunk-3IKL6SBP.js.map +1 -0
- package/dist/{chunk-OEAOYF7C.cjs → chunk-O5MCKVEA.cjs} +110 -109
- package/dist/chunk-O5MCKVEA.cjs.map +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.js +2 -2
- package/dist/react/index.cjs +165 -300
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -1
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.js +163 -298
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HBMXEPZJ.js.map +0 -1
- package/dist/chunk-OEAOYF7C.cjs.map +0 -1
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderSlide, renderMermaidDiagrams } from '../chunk-JOW4QWKF.js';
|
|
2
2
|
export { defineTheme, extractMaxClicks, generateClickCss, postprocessClicks, preprocessClicks, renderSlide, renderSlideAsync, resolveTheme } from '../chunk-JOW4QWKF.js';
|
|
3
|
-
import { SLIDE_LAYOUT_PRESETS, updateSlideLayoutInMarkdown } from '../chunk-
|
|
3
|
+
import { SLIDE_LAYOUT_PRESETS, updateSlideLayoutInMarkdown } from '../chunk-3IKL6SBP.js';
|
|
4
4
|
import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -585,7 +585,8 @@ 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 ?? []);
|
|
@@ -622,40 +623,37 @@ function SlideDesignOverlay({
|
|
|
622
623
|
let [newX, newY, newW, newH] = [origX, origY, origW, origH];
|
|
623
624
|
switch (dragging.type) {
|
|
624
625
|
case "move":
|
|
625
|
-
newX = Math.max(0, Math.min(1280 - origW, origX + dx));
|
|
626
|
-
newY = Math.max(0, Math.min(720 - origH, origY + dy));
|
|
626
|
+
newX = Math.round(Math.max(0, Math.min(1280 - origW, origX + dx)));
|
|
627
|
+
newY = Math.round(Math.max(0, Math.min(720 - origH, origY + dy)));
|
|
627
628
|
break;
|
|
628
629
|
case "se":
|
|
629
|
-
newW = Math.max(
|
|
630
|
-
newH = Math.max(
|
|
630
|
+
newW = Math.round(Math.max(100, Math.min(1280 - origX, origW + dx)));
|
|
631
|
+
newH = Math.round(Math.max(40, Math.min(720 - origY, origH + dy)));
|
|
631
632
|
break;
|
|
632
633
|
case "e":
|
|
633
|
-
newW = Math.max(
|
|
634
|
+
newW = Math.round(Math.max(100, Math.min(1280 - origX, origW + dx)));
|
|
634
635
|
break;
|
|
635
636
|
case "s":
|
|
636
|
-
newH = Math.max(
|
|
637
|
+
newH = Math.round(Math.max(40, Math.min(720 - origY, origH + dy)));
|
|
637
638
|
break;
|
|
638
639
|
case "sw":
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
newH = Math.max(
|
|
640
|
+
newW = Math.round(Math.max(100, origW - dx));
|
|
641
|
+
newX = Math.round(Math.min(origX + origW - 100, origX + dx));
|
|
642
|
+
newH = Math.round(Math.max(40, origH + dy));
|
|
642
643
|
break;
|
|
643
644
|
case "ne":
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
645
|
+
newW = Math.round(Math.max(100, origW + dx));
|
|
646
|
+
newH = Math.round(Math.max(40, origH - dy));
|
|
647
|
+
newY = Math.round(Math.min(origY + origH - 40, origY + dy));
|
|
647
648
|
break;
|
|
648
649
|
case "nw":
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
650
|
+
newW = Math.round(Math.max(100, origW - dx));
|
|
651
|
+
newX = Math.round(Math.min(origX + origW - 100, origX + dx));
|
|
652
|
+
newH = Math.round(Math.max(40, origH - dy));
|
|
653
|
+
newY = Math.round(Math.min(origY + origH - 40, origY + dy));
|
|
653
654
|
break;
|
|
654
655
|
}
|
|
655
|
-
return {
|
|
656
|
-
...b,
|
|
657
|
-
pos: [Math.round(newX), Math.round(newY), Math.round(newW), Math.round(newH)]
|
|
658
|
-
};
|
|
656
|
+
return { ...b, pos: [newX, newY, newW, newH] };
|
|
659
657
|
});
|
|
660
658
|
onLayoutChange({ boxes: updated });
|
|
661
659
|
return updated;
|
|
@@ -675,23 +673,22 @@ function SlideDesignOverlay({
|
|
|
675
673
|
}
|
|
676
674
|
}, [dragging, handleMouseMove, handleMouseUp]);
|
|
677
675
|
const addNewBox = (targetTag) => {
|
|
676
|
+
const newId = `box-${Date.now().toString(36)}`;
|
|
678
677
|
const newBox = {
|
|
679
|
-
id:
|
|
678
|
+
id: newId,
|
|
680
679
|
target: targetTag,
|
|
681
|
-
pos: [100,
|
|
682
|
-
fontSize: targetTag === "h1" ? "2.5rem" : "1.2rem"
|
|
683
|
-
color: targetTag === "h1" ? "#38bdf8" : "#e2e8f0",
|
|
684
|
-
textAlign: "left"
|
|
680
|
+
pos: [100, 200, 500, 100],
|
|
681
|
+
fontSize: targetTag === "h1" ? "2.5rem" : "1.2rem"
|
|
685
682
|
};
|
|
686
683
|
const updated = [...boxes, newBox];
|
|
687
684
|
setBoxes(updated);
|
|
688
|
-
setSelectedId(
|
|
685
|
+
setSelectedId(newId);
|
|
689
686
|
onLayoutChange({ boxes: updated });
|
|
690
687
|
};
|
|
691
|
-
const updateSelectedBox = (
|
|
688
|
+
const updateSelectedBox = (partial) => {
|
|
692
689
|
if (!selectedId) return;
|
|
693
690
|
setBoxes((prev) => {
|
|
694
|
-
const updated = prev.map((b) => b.id === selectedId ? { ...b, ...
|
|
691
|
+
const updated = prev.map((b) => b.id === selectedId ? { ...b, ...partial } : b);
|
|
695
692
|
onLayoutChange({ boxes: updated });
|
|
696
693
|
return updated;
|
|
697
694
|
});
|
|
@@ -705,6 +702,32 @@ function SlideDesignOverlay({
|
|
|
705
702
|
});
|
|
706
703
|
setSelectedId(null);
|
|
707
704
|
};
|
|
705
|
+
const isLight = theme === "light";
|
|
706
|
+
const isNavy = theme === "navy";
|
|
707
|
+
const toolbarBg = isLight ? "rgba(255, 255, 255, 0.96)" : isNavy ? "rgba(11, 19, 43, 0.95)" : "rgba(24, 25, 32, 0.95)";
|
|
708
|
+
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)";
|
|
709
|
+
const toolbarColor = isLight ? "#0f172a" : "#f8fafc";
|
|
710
|
+
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)";
|
|
711
|
+
const brandColor = isLight ? "#0284c7" : "#38bdf8";
|
|
712
|
+
const subtextColor = isLight ? "#64748b" : "#94a3b8";
|
|
713
|
+
const btnStyle = {
|
|
714
|
+
height: "28px",
|
|
715
|
+
padding: "0 12px",
|
|
716
|
+
borderRadius: "14px",
|
|
717
|
+
fontSize: "11px",
|
|
718
|
+
fontWeight: 500,
|
|
719
|
+
fontFamily: "inherit",
|
|
720
|
+
border: isLight ? "1px solid rgba(0, 0, 0, 0.1)" : "1px solid rgba(255, 255, 255, 0.15)",
|
|
721
|
+
backgroundColor: isLight ? "rgba(0, 0, 0, 0.04)" : "rgba(255, 255, 255, 0.08)",
|
|
722
|
+
color: isLight ? "#0f172a" : "#f1f5f9",
|
|
723
|
+
cursor: "pointer",
|
|
724
|
+
display: "inline-flex",
|
|
725
|
+
alignItems: "center",
|
|
726
|
+
justifyContent: "center",
|
|
727
|
+
whiteSpace: "nowrap",
|
|
728
|
+
flexShrink: 0,
|
|
729
|
+
transition: "all 0.15s ease"
|
|
730
|
+
};
|
|
708
731
|
return /* @__PURE__ */ jsxs(
|
|
709
732
|
"div",
|
|
710
733
|
{
|
|
@@ -713,7 +736,6 @@ function SlideDesignOverlay({
|
|
|
713
736
|
inset: 0,
|
|
714
737
|
zIndex: 50,
|
|
715
738
|
pointerEvents: "none"
|
|
716
|
-
// Allow passing through to children that have pointerEvents: 'auto'
|
|
717
739
|
},
|
|
718
740
|
children: [
|
|
719
741
|
/* @__PURE__ */ jsxs(
|
|
@@ -730,36 +752,21 @@ function SlideDesignOverlay({
|
|
|
730
752
|
alignItems: "center",
|
|
731
753
|
gap: "8px",
|
|
732
754
|
padding: "6px 14px",
|
|
733
|
-
backgroundColor:
|
|
734
|
-
|
|
755
|
+
backgroundColor: toolbarBg,
|
|
756
|
+
backdropFilter: "blur(12px)",
|
|
757
|
+
WebkitBackdropFilter: "blur(12px)",
|
|
758
|
+
border: toolbarBorder,
|
|
735
759
|
borderRadius: "24px",
|
|
736
|
-
boxShadow:
|
|
737
|
-
color:
|
|
760
|
+
boxShadow: toolbarShadow,
|
|
761
|
+
color: toolbarColor,
|
|
738
762
|
fontSize: "12px",
|
|
739
|
-
fontFamily: "Inter, sans-serif"
|
|
763
|
+
fontFamily: "Inter, sans-serif",
|
|
764
|
+
whiteSpace: "nowrap"
|
|
740
765
|
},
|
|
741
766
|
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
|
-
),
|
|
767
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: brandColor, whiteSpace: "nowrap" }, children: "Design Canvas:" }),
|
|
768
|
+
/* @__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)" }),
|
|
769
|
+
/* @__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
770
|
/* @__PURE__ */ jsxs(
|
|
764
771
|
"select",
|
|
765
772
|
{
|
|
@@ -773,171 +780,102 @@ function SlideDesignOverlay({
|
|
|
773
780
|
},
|
|
774
781
|
defaultValue: "",
|
|
775
782
|
style: {
|
|
776
|
-
...
|
|
783
|
+
...btnStyle,
|
|
777
784
|
cursor: "pointer",
|
|
778
785
|
outline: "none",
|
|
779
|
-
color: "#f8fafc",
|
|
780
|
-
|
|
786
|
+
color: isLight ? "#0f172a" : "#f8fafc",
|
|
787
|
+
backgroundColor: isLight ? "#ffffff" : "#1e1f29",
|
|
788
|
+
border: isLight ? "1px solid rgba(0, 0, 0, 0.15)" : "1px solid rgba(56, 189, 248, 0.3)",
|
|
789
|
+
maxWidth: "180px"
|
|
781
790
|
},
|
|
782
791
|
title: "\xC1p d\u1EE5ng m\u1EABu b\u1ED1 c\u1EE5c c\xF3 s\u1EB5n",
|
|
783
792
|
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))
|
|
793
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, style: { backgroundColor: isLight ? "#ffffff" : "#1e1f29", color: subtextColor }, children: "M\u1EABu b\u1ED1 c\u1EE5c (Presets)..." }),
|
|
794
|
+
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
795
|
]
|
|
787
796
|
}
|
|
788
797
|
),
|
|
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
|
-
)
|
|
798
|
+
/* @__PURE__ */ jsx("div", { style: { width: "1px", height: "16px", backgroundColor: isLight ? "rgba(0,0,0,0.15)" : "rgba(255,255,255,0.2)" } }),
|
|
799
|
+
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" }),
|
|
800
|
+
onClose && /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, style: { ...btnStyle, backgroundColor: "transparent", border: "none", color: subtextColor }, children: "\u0110\xF3ng" })
|
|
817
801
|
]
|
|
818
802
|
}
|
|
819
803
|
),
|
|
820
|
-
/* @__PURE__ */ jsx(
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
804
|
+
/* @__PURE__ */ jsx("div", { ref: containerRef, style: { position: "absolute", inset: 0, pointerEvents: "auto" }, onClick: () => setSelectedId(null), children: boxes.map((box) => {
|
|
805
|
+
const [x, y, w, h] = box.pos;
|
|
806
|
+
const isSelected = box.id === selectedId;
|
|
807
|
+
const leftPercent = x / 1280 * 100;
|
|
808
|
+
const topPercent = y / 720 * 100;
|
|
809
|
+
const widthPercent = w / 1280 * 100;
|
|
810
|
+
const heightPercent = h / 720 * 100;
|
|
811
|
+
return /* @__PURE__ */ jsxs(
|
|
812
|
+
"div",
|
|
813
|
+
{
|
|
814
|
+
onClick: (e) => {
|
|
815
|
+
e.stopPropagation();
|
|
816
|
+
setSelectedId(box.id);
|
|
817
|
+
},
|
|
818
|
+
onMouseDown: (e) => handleMouseDown(e, box, "move"),
|
|
819
|
+
style: {
|
|
820
|
+
position: "absolute",
|
|
821
|
+
left: `${leftPercent}%`,
|
|
822
|
+
top: `${topPercent}%`,
|
|
823
|
+
width: `${widthPercent}%`,
|
|
824
|
+
height: `${heightPercent}%`,
|
|
825
|
+
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)",
|
|
826
|
+
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)",
|
|
827
|
+
cursor: "move",
|
|
828
|
+
userSelect: "none",
|
|
829
|
+
boxSizing: "border-box",
|
|
830
|
+
zIndex: isSelected ? 40 : 20
|
|
831
|
+
},
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ jsxs(
|
|
834
|
+
"div",
|
|
835
|
+
{
|
|
836
|
+
style: {
|
|
837
|
+
position: "absolute",
|
|
838
|
+
top: "-20px",
|
|
839
|
+
left: "0",
|
|
840
|
+
fontSize: "10px",
|
|
841
|
+
fontWeight: 600,
|
|
842
|
+
color: isLight ? isSelected ? "#0284c7" : "#475569" : isSelected ? "#38bdf8" : "rgba(56, 189, 248, 0.8)",
|
|
843
|
+
backgroundColor: isLight ? "rgba(255,255,255,0.95)" : "rgba(15,23,42,0.9)",
|
|
844
|
+
border: isLight ? "1px solid rgba(0,0,0,0.1)" : "1px solid rgba(56,189,248,0.3)",
|
|
845
|
+
padding: "1px 6px",
|
|
846
|
+
borderRadius: "4px",
|
|
847
|
+
whiteSpace: "nowrap",
|
|
848
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)"
|
|
849
|
+
},
|
|
850
|
+
children: [
|
|
851
|
+
box.target || box.id,
|
|
852
|
+
" (",
|
|
853
|
+
Math.round(x),
|
|
854
|
+
", ",
|
|
855
|
+
Math.round(y),
|
|
856
|
+
")"
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
),
|
|
860
|
+
isSelected && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
861
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("se", isLight), onMouseDown: (e) => handleMouseDown(e, box, "se") }),
|
|
862
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("e", isLight), onMouseDown: (e) => handleMouseDown(e, box, "e") }),
|
|
863
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("s", isLight), onMouseDown: (e) => handleMouseDown(e, box, "s") }),
|
|
864
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("sw", isLight), onMouseDown: (e) => handleMouseDown(e, box, "sw") }),
|
|
865
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("ne", isLight), onMouseDown: (e) => handleMouseDown(e, box, "ne") }),
|
|
866
|
+
/* @__PURE__ */ jsx("div", { style: handleStyle("nw", isLight), onMouseDown: (e) => handleMouseDown(e, box, "nw") })
|
|
867
|
+
] })
|
|
868
|
+
]
|
|
828
869
|
},
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
const isSelected = box.id === selectedId;
|
|
833
|
-
const leftPercent = x / 1280 * 100;
|
|
834
|
-
const topPercent = y / 720 * 100;
|
|
835
|
-
const widthPercent = w / 1280 * 100;
|
|
836
|
-
const heightPercent = h / 720 * 100;
|
|
837
|
-
return /* @__PURE__ */ jsxs(
|
|
838
|
-
"div",
|
|
839
|
-
{
|
|
840
|
-
onClick: (e) => {
|
|
841
|
-
e.stopPropagation();
|
|
842
|
-
setSelectedId(box.id);
|
|
843
|
-
},
|
|
844
|
-
onMouseDown: (e) => handleMouseDown(e, box, "move"),
|
|
845
|
-
style: {
|
|
846
|
-
position: "absolute",
|
|
847
|
-
left: `${leftPercent}%`,
|
|
848
|
-
top: `${topPercent}%`,
|
|
849
|
-
width: `${widthPercent}%`,
|
|
850
|
-
height: `${heightPercent}%`,
|
|
851
|
-
border: isSelected ? "2px solid #38bdf8" : "1px dashed rgba(56, 189, 248, 0.5)",
|
|
852
|
-
backgroundColor: isSelected ? "rgba(56, 189, 248, 0.08)" : "rgba(56, 189, 248, 0.03)",
|
|
853
|
-
cursor: "move",
|
|
854
|
-
userSelect: "none",
|
|
855
|
-
boxSizing: "border-box",
|
|
856
|
-
zIndex: isSelected ? 40 : 20
|
|
857
|
-
},
|
|
858
|
-
children: [
|
|
859
|
-
/* @__PURE__ */ jsxs(
|
|
860
|
-
"div",
|
|
861
|
-
{
|
|
862
|
-
style: {
|
|
863
|
-
position: "absolute",
|
|
864
|
-
top: "-18px",
|
|
865
|
-
left: "0",
|
|
866
|
-
fontSize: "10px",
|
|
867
|
-
fontWeight: 600,
|
|
868
|
-
color: isSelected ? "#38bdf8" : "rgba(56, 189, 248, 0.7)",
|
|
869
|
-
backgroundColor: "rgba(0,0,0,0.8)",
|
|
870
|
-
padding: "1px 6px",
|
|
871
|
-
borderRadius: "3px",
|
|
872
|
-
whiteSpace: "nowrap"
|
|
873
|
-
},
|
|
874
|
-
children: [
|
|
875
|
-
box.target || box.id,
|
|
876
|
-
" (",
|
|
877
|
-
Math.round(x),
|
|
878
|
-
", ",
|
|
879
|
-
Math.round(y),
|
|
880
|
-
")"
|
|
881
|
-
]
|
|
882
|
-
}
|
|
883
|
-
),
|
|
884
|
-
isSelected && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
885
|
-
/* @__PURE__ */ jsx(
|
|
886
|
-
"div",
|
|
887
|
-
{
|
|
888
|
-
style: handleStyle("se"),
|
|
889
|
-
onMouseDown: (e) => handleMouseDown(e, box, "se")
|
|
890
|
-
}
|
|
891
|
-
),
|
|
892
|
-
/* @__PURE__ */ jsx(
|
|
893
|
-
"div",
|
|
894
|
-
{
|
|
895
|
-
style: handleStyle("e"),
|
|
896
|
-
onMouseDown: (e) => handleMouseDown(e, box, "e")
|
|
897
|
-
}
|
|
898
|
-
),
|
|
899
|
-
/* @__PURE__ */ jsx(
|
|
900
|
-
"div",
|
|
901
|
-
{
|
|
902
|
-
style: handleStyle("s"),
|
|
903
|
-
onMouseDown: (e) => handleMouseDown(e, box, "s")
|
|
904
|
-
}
|
|
905
|
-
),
|
|
906
|
-
/* @__PURE__ */ jsx(
|
|
907
|
-
"div",
|
|
908
|
-
{
|
|
909
|
-
style: handleStyle("sw"),
|
|
910
|
-
onMouseDown: (e) => handleMouseDown(e, box, "sw")
|
|
911
|
-
}
|
|
912
|
-
),
|
|
913
|
-
/* @__PURE__ */ jsx(
|
|
914
|
-
"div",
|
|
915
|
-
{
|
|
916
|
-
style: handleStyle("ne"),
|
|
917
|
-
onMouseDown: (e) => handleMouseDown(e, box, "ne")
|
|
918
|
-
}
|
|
919
|
-
),
|
|
920
|
-
/* @__PURE__ */ jsx(
|
|
921
|
-
"div",
|
|
922
|
-
{
|
|
923
|
-
style: handleStyle("nw"),
|
|
924
|
-
onMouseDown: (e) => handleMouseDown(e, box, "nw")
|
|
925
|
-
}
|
|
926
|
-
)
|
|
927
|
-
] })
|
|
928
|
-
]
|
|
929
|
-
},
|
|
930
|
-
box.id
|
|
931
|
-
);
|
|
932
|
-
})
|
|
933
|
-
}
|
|
934
|
-
),
|
|
870
|
+
box.id
|
|
871
|
+
);
|
|
872
|
+
}) }),
|
|
935
873
|
selectedBox && /* @__PURE__ */ jsxs(
|
|
936
874
|
"div",
|
|
937
875
|
{
|
|
938
876
|
style: {
|
|
939
877
|
position: "absolute",
|
|
940
|
-
bottom: "
|
|
878
|
+
bottom: "20px",
|
|
941
879
|
left: "50%",
|
|
942
880
|
transform: "translateX(-50%)",
|
|
943
881
|
zIndex: 60,
|
|
@@ -946,90 +884,32 @@ function SlideDesignOverlay({
|
|
|
946
884
|
alignItems: "center",
|
|
947
885
|
gap: "12px",
|
|
948
886
|
padding: "8px 16px",
|
|
949
|
-
backgroundColor:
|
|
950
|
-
|
|
887
|
+
backgroundColor: toolbarBg,
|
|
888
|
+
backdropFilter: "blur(12px)",
|
|
889
|
+
WebkitBackdropFilter: "blur(12px)",
|
|
890
|
+
border: toolbarBorder,
|
|
951
891
|
borderRadius: "12px",
|
|
952
|
-
boxShadow:
|
|
953
|
-
color:
|
|
892
|
+
boxShadow: toolbarShadow,
|
|
893
|
+
color: toolbarColor,
|
|
954
894
|
fontSize: "12px",
|
|
955
|
-
fontFamily: "Inter, sans-serif"
|
|
895
|
+
fontFamily: "Inter, sans-serif",
|
|
896
|
+
whiteSpace: "nowrap"
|
|
956
897
|
},
|
|
957
898
|
children: [
|
|
958
|
-
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600, color: "
|
|
899
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600, color: brandColor, whiteSpace: "nowrap" }, children: [
|
|
959
900
|
"Khung: ",
|
|
960
901
|
selectedBox.target
|
|
961
902
|
] }),
|
|
962
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
963
|
-
/* @__PURE__ */ jsx("span", { style: { color:
|
|
964
|
-
/* @__PURE__ */ jsx(
|
|
965
|
-
"input",
|
|
966
|
-
{
|
|
967
|
-
type: "text",
|
|
968
|
-
value: selectedBox.fontSize ?? "1.5rem",
|
|
969
|
-
onChange: (e) => updateSelectedBox({ fontSize: e.target.value }),
|
|
970
|
-
style: {
|
|
971
|
-
width: "60px",
|
|
972
|
-
padding: "2px 6px",
|
|
973
|
-
borderRadius: "4px",
|
|
974
|
-
border: "1px solid #334155",
|
|
975
|
-
backgroundColor: "#0f172a",
|
|
976
|
-
color: "#f8fafc",
|
|
977
|
-
fontSize: "11px"
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
)
|
|
903
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
904
|
+
/* @__PURE__ */ jsx("span", { style: { color: subtextColor, fontSize: "11px" }, children: "Size:" }),
|
|
905
|
+
/* @__PURE__ */ jsx("input", { type: "text", value: selectedBox.fontSize ?? "1.5rem", onChange: (e) => updateSelectedBox({ fontSize: e.target.value }), style: { width: "60px", padding: "2px 6px", borderRadius: "4px", border: isLight ? "1px solid #cbd5e1" : "1px solid #334155", backgroundColor: isLight ? "#f8fafc" : "#0f172a", color: isLight ? "#0f172a" : "#f8fafc", fontSize: "11px" } })
|
|
981
906
|
] }),
|
|
982
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
983
|
-
/* @__PURE__ */ jsx("span", { style: { 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
|
-
)
|
|
907
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
908
|
+
/* @__PURE__ */ jsx("span", { style: { color: subtextColor, fontSize: "11px" }, children: "Color:" }),
|
|
909
|
+
/* @__PURE__ */ jsx("input", { type: "color", value: selectedBox.color ?? (isLight ? "#0f172a" : "#38bdf8"), onChange: (e) => updateSelectedBox({ color: e.target.value }), style: { width: "24px", height: "24px", padding: "0", border: "none", borderRadius: "4px", cursor: "pointer", backgroundColor: "transparent" } })
|
|
1001
910
|
] }),
|
|
1002
|
-
/* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "2px" }, children: ["left", "center", "right"].map((align) => /* @__PURE__ */ jsx(
|
|
1003
|
-
|
|
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
|
-
/* @__PURE__ */ jsx(
|
|
1019
|
-
"button",
|
|
1020
|
-
{
|
|
1021
|
-
type: "button",
|
|
1022
|
-
onClick: removeSelectedBox,
|
|
1023
|
-
style: {
|
|
1024
|
-
...toolbarButtonStyle,
|
|
1025
|
-
backgroundColor: "rgba(239, 68, 68, 0.2)",
|
|
1026
|
-
color: "#f87171",
|
|
1027
|
-
borderColor: "rgba(239, 68, 68, 0.4)"
|
|
1028
|
-
},
|
|
1029
|
-
title: "X\xF3a \u0111\u1ECBnh v\u1ECB t\u1EF1 do (tr\u1EDF v\u1EC1 lu\u1ED3ng b\xECnh th\u01B0\u1EDDng)",
|
|
1030
|
-
children: "Tr\u1EDF v\u1EC1 lu\u1ED3ng m\u1EB7c \u0111\u1ECBnh"
|
|
1031
|
-
}
|
|
1032
|
-
)
|
|
911
|
+
/* @__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 8px", height: "24px" }, children: align }, align)) }),
|
|
912
|
+
/* @__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: "24px" }, title: "X\xF3a \u0111\u1ECBnh v\u1ECB t\u1EF1 do c\u1EE7a khung n\xE0y", children: "X\xF3a v\u1ECB tr\xED" })
|
|
1033
913
|
]
|
|
1034
914
|
}
|
|
1035
915
|
)
|
|
@@ -1037,29 +917,14 @@ function SlideDesignOverlay({
|
|
|
1037
917
|
}
|
|
1038
918
|
);
|
|
1039
919
|
}
|
|
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) {
|
|
920
|
+
function handleStyle(pos, isLight = false) {
|
|
1056
921
|
const size = 10;
|
|
1057
922
|
const base = {
|
|
1058
923
|
position: "absolute",
|
|
1059
924
|
width: `${size}px`,
|
|
1060
925
|
height: `${size}px`,
|
|
1061
|
-
backgroundColor: "#ffffff",
|
|
1062
|
-
border: "2px solid #0284c7",
|
|
926
|
+
backgroundColor: isLight ? "#ffffff" : "#0f172a",
|
|
927
|
+
border: isLight ? "2px solid #0284c7" : "2px solid #38bdf8",
|
|
1063
928
|
borderRadius: "2px",
|
|
1064
929
|
boxSizing: "border-box",
|
|
1065
930
|
zIndex: 50
|