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