@thanh01.pmt/presentation-kit 0.2.4 → 0.2.6
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 +7 -7
- package/dist/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.js +1 -1
- package/dist/{chunk-3IKL6SBP.js → chunk-KJA2ZSIC.js} +50 -3
- package/dist/chunk-KJA2ZSIC.js.map +1 -0
- package/dist/{chunk-O5MCKVEA.cjs → chunk-RHZBBRQL.cjs} +50 -2
- package/dist/chunk-RHZBBRQL.cjs.map +1 -0
- 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.cjs +12 -8
- package/dist/index.d.cts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +2 -2
- 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 +132 -14
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +129 -11
- 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/chunk-3IKL6SBP.js.map +0 -1
- package/dist/chunk-O5MCKVEA.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 chunkRHZBBRQL_cjs = require('../chunk-RHZBBRQL.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
@@ -592,6 +592,7 @@ function SlideDesignOverlay({
|
|
|
592
592
|
if (!isActive) return null;
|
|
593
593
|
const [boxes, setBoxes] = react.useState(layout?.boxes ?? []);
|
|
594
594
|
const [selectedId, setSelectedId] = react.useState(null);
|
|
595
|
+
const [editingId, setEditingId] = react.useState(null);
|
|
595
596
|
const containerRef = react.useRef(null);
|
|
596
597
|
react.useEffect(() => {
|
|
597
598
|
setBoxes(layout?.boxes ?? []);
|
|
@@ -674,16 +675,21 @@ function SlideDesignOverlay({
|
|
|
674
675
|
}
|
|
675
676
|
}, [dragging, handleMouseMove, handleMouseUp]);
|
|
676
677
|
const addNewBox = (targetTag) => {
|
|
678
|
+
const isH1 = targetTag === "h1";
|
|
677
679
|
const newId = `box-${Date.now().toString(36)}`;
|
|
678
680
|
const newBox = {
|
|
679
681
|
id: newId,
|
|
680
682
|
target: targetTag,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
+
content: isH1 ? "Ti\xEAu \u0111\u1EC1 b\xE0i gi\u1EA3ng" : "Nh\u1EADp n\u1ED9i dung \u0111o\u1EA1n v\u0103n t\u1EA1i \u0111\xE2y...",
|
|
684
|
+
pos: [100, isH1 ? 160 : 300, isH1 ? 700 : 600, isH1 ? 90 : 120],
|
|
685
|
+
fontSize: isH1 ? "2.5rem" : "1.2rem",
|
|
686
|
+
color: isLight ? "#0f172a" : "#f8fafc",
|
|
687
|
+
textAlign: "left"
|
|
683
688
|
};
|
|
684
689
|
const updated = [...boxes, newBox];
|
|
685
690
|
setBoxes(updated);
|
|
686
691
|
setSelectedId(newId);
|
|
692
|
+
setEditingId(newId);
|
|
687
693
|
onLayoutChange({ boxes: updated });
|
|
688
694
|
};
|
|
689
695
|
const updateSelectedBox = (partial) => {
|
|
@@ -772,7 +778,7 @@ function SlideDesignOverlay({
|
|
|
772
778
|
"select",
|
|
773
779
|
{
|
|
774
780
|
onChange: (e) => {
|
|
775
|
-
const preset =
|
|
781
|
+
const preset = chunkRHZBBRQL_cjs.SLIDE_LAYOUT_PRESETS.find((p) => p.id === e.target.value);
|
|
776
782
|
if (preset) {
|
|
777
783
|
const clonedBoxes = JSON.parse(JSON.stringify(preset.layout.boxes));
|
|
778
784
|
setBoxes(clonedBoxes);
|
|
@@ -792,7 +798,7 @@ function SlideDesignOverlay({
|
|
|
792
798
|
title: "\xC1p d\u1EE5ng m\u1EABu b\u1ED1 c\u1EE5c c\xF3 s\u1EB5n",
|
|
793
799
|
children: [
|
|
794
800
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, style: { backgroundColor: isLight ? "#ffffff" : "#1e1f29", color: subtextColor }, children: "M\u1EABu b\u1ED1 c\u1EE5c (Presets)..." }),
|
|
795
|
-
|
|
801
|
+
chunkRHZBBRQL_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))
|
|
796
802
|
]
|
|
797
803
|
}
|
|
798
804
|
),
|
|
@@ -825,12 +831,86 @@ function SlideDesignOverlay({
|
|
|
825
831
|
height: `${heightPercent}%`,
|
|
826
832
|
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
833
|
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",
|
|
834
|
+
cursor: editingId === box.id ? "default" : "move",
|
|
835
|
+
userSelect: editingId === box.id ? "text" : "none",
|
|
830
836
|
boxSizing: "border-box",
|
|
831
|
-
zIndex: isSelected ? 40 : 20
|
|
837
|
+
zIndex: isSelected ? 40 : 20,
|
|
838
|
+
display: "flex",
|
|
839
|
+
alignItems: "center",
|
|
840
|
+
overflow: "visible"
|
|
832
841
|
},
|
|
833
842
|
children: [
|
|
843
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
844
|
+
"div",
|
|
845
|
+
{
|
|
846
|
+
style: {
|
|
847
|
+
width: "100%",
|
|
848
|
+
height: "100%",
|
|
849
|
+
padding: "4px 8px",
|
|
850
|
+
boxSizing: "border-box",
|
|
851
|
+
display: "flex",
|
|
852
|
+
alignItems: "center",
|
|
853
|
+
overflow: "hidden"
|
|
854
|
+
},
|
|
855
|
+
children: editingId === box.id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
856
|
+
"textarea",
|
|
857
|
+
{
|
|
858
|
+
autoFocus: true,
|
|
859
|
+
value: box.content ?? "",
|
|
860
|
+
placeholder: box.target === "h1" ? "Nh\u1EADp ti\xEAu \u0111\u1EC1..." : "Nh\u1EADp n\u1ED9i dung...",
|
|
861
|
+
onChange: (e) => updateSelectedBox({ content: e.target.value }),
|
|
862
|
+
onBlur: () => setEditingId(null),
|
|
863
|
+
onKeyDown: (e) => {
|
|
864
|
+
if (e.key === "Escape") setEditingId(null);
|
|
865
|
+
},
|
|
866
|
+
onClick: (e) => e.stopPropagation(),
|
|
867
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
868
|
+
style: {
|
|
869
|
+
width: "100%",
|
|
870
|
+
height: "100%",
|
|
871
|
+
background: "transparent",
|
|
872
|
+
border: "none",
|
|
873
|
+
outline: "none",
|
|
874
|
+
resize: "none",
|
|
875
|
+
fontSize: box.fontSize ?? (box.target === "h1" ? "2.2rem" : "1.1rem"),
|
|
876
|
+
color: box.color ?? (isLight ? "#0f172a" : "#f8fafc"),
|
|
877
|
+
textAlign: box.textAlign ?? "left",
|
|
878
|
+
fontFamily: "Inter, sans-serif",
|
|
879
|
+
fontWeight: box.target === "h1" ? 700 : 400,
|
|
880
|
+
lineHeight: 1.25,
|
|
881
|
+
padding: 0,
|
|
882
|
+
margin: 0
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
886
|
+
"div",
|
|
887
|
+
{
|
|
888
|
+
onDoubleClick: (e) => {
|
|
889
|
+
e.stopPropagation();
|
|
890
|
+
setSelectedId(box.id);
|
|
891
|
+
setEditingId(box.id);
|
|
892
|
+
},
|
|
893
|
+
style: {
|
|
894
|
+
width: "100%",
|
|
895
|
+
height: "100%",
|
|
896
|
+
fontSize: box.fontSize ?? (box.target === "h1" ? "2.2rem" : "1.1rem"),
|
|
897
|
+
color: box.color ?? (isLight ? "#0f172a" : "#f8fafc"),
|
|
898
|
+
textAlign: box.textAlign ?? "left",
|
|
899
|
+
fontFamily: "Inter, sans-serif",
|
|
900
|
+
fontWeight: box.target === "h1" ? 700 : 400,
|
|
901
|
+
lineHeight: 1.25,
|
|
902
|
+
wordBreak: "break-word",
|
|
903
|
+
userSelect: "none",
|
|
904
|
+
cursor: "pointer",
|
|
905
|
+
display: "flex",
|
|
906
|
+
alignItems: "center"
|
|
907
|
+
},
|
|
908
|
+
title: "Click \u0111\xFAp \u0111\u1EC3 s\u1EEDa ch\u1EEF",
|
|
909
|
+
children: box.content ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: box.content }) : /* @__PURE__ */ jsxRuntime.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)..." })
|
|
910
|
+
}
|
|
911
|
+
)
|
|
912
|
+
}
|
|
913
|
+
),
|
|
834
914
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
835
915
|
"div",
|
|
836
916
|
{
|
|
@@ -883,7 +963,7 @@ function SlideDesignOverlay({
|
|
|
883
963
|
pointerEvents: "auto",
|
|
884
964
|
display: "flex",
|
|
885
965
|
alignItems: "center",
|
|
886
|
-
gap: "
|
|
966
|
+
gap: "10px",
|
|
887
967
|
padding: "8px 16px",
|
|
888
968
|
backgroundColor: toolbarBg,
|
|
889
969
|
backdropFilter: "blur(12px)",
|
|
@@ -901,16 +981,54 @@ function SlideDesignOverlay({
|
|
|
901
981
|
"Khung: ",
|
|
902
982
|
selectedBox.target
|
|
903
983
|
] }),
|
|
984
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
985
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: subtextColor, fontSize: "11px" }, children: "Ch\u1EEF:" }),
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
987
|
+
"input",
|
|
988
|
+
{
|
|
989
|
+
type: "text",
|
|
990
|
+
value: selectedBox.content ?? "",
|
|
991
|
+
placeholder: "Nh\u1EADp n\u1ED9i dung...",
|
|
992
|
+
onChange: (e) => updateSelectedBox({ content: e.target.value }),
|
|
993
|
+
style: {
|
|
994
|
+
width: "130px",
|
|
995
|
+
padding: "2px 8px",
|
|
996
|
+
borderRadius: "4px",
|
|
997
|
+
border: isLight ? "1px solid #cbd5e1" : "1px solid #334155",
|
|
998
|
+
backgroundColor: isLight ? "#f8fafc" : "#0f172a",
|
|
999
|
+
color: isLight ? "#0f172a" : "#f8fafc",
|
|
1000
|
+
fontSize: "11px"
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
] }),
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1006
|
+
"button",
|
|
1007
|
+
{
|
|
1008
|
+
type: "button",
|
|
1009
|
+
onClick: () => setEditingId(selectedBox.id),
|
|
1010
|
+
style: {
|
|
1011
|
+
...btnStyle,
|
|
1012
|
+
backgroundColor: editingId === selectedBox.id ? "#0284c7" : isLight ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)",
|
|
1013
|
+
color: editingId === selectedBox.id ? "#ffffff" : isLight ? "#0f172a" : "#e2e8f0",
|
|
1014
|
+
height: "24px",
|
|
1015
|
+
padding: "0 8px"
|
|
1016
|
+
},
|
|
1017
|
+
title: "S\u1EEDa ch\u1EEF tr\u1EF1c ti\u1EBFp trong khung",
|
|
1018
|
+
children: "S\u1EEDa ch\u1EEF"
|
|
1019
|
+
}
|
|
1020
|
+
),
|
|
1021
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "1px", height: "14px", backgroundColor: isLight ? "rgba(0,0,0,0.12)" : "rgba(255,255,255,0.15)" } }),
|
|
904
1022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
905
1023
|
/* @__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: "
|
|
1024
|
+
/* @__PURE__ */ jsxRuntime.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" } })
|
|
907
1025
|
] }),
|
|
908
1026
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", whiteSpace: "nowrap" }, children: [
|
|
909
1027
|
/* @__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: "
|
|
1028
|
+
/* @__PURE__ */ jsxRuntime.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" } })
|
|
911
1029
|
] }),
|
|
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
|
|
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: "
|
|
1030
|
+
/* @__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 6px", height: "22px" }, children: align }, align)) }),
|
|
1031
|
+
/* @__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: "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" })
|
|
914
1032
|
]
|
|
915
1033
|
}
|
|
916
1034
|
)
|
|
@@ -1295,7 +1413,7 @@ function SlideViewer({
|
|
|
1295
1413
|
onSave: (layout) => {
|
|
1296
1414
|
setLiveLayout(layout);
|
|
1297
1415
|
if (onSaveMarkdown) {
|
|
1298
|
-
const updated =
|
|
1416
|
+
const updated = chunkRHZBBRQL_cjs.updateSlideLayoutInMarkdown(markdown, currentIndex, layout);
|
|
1299
1417
|
onSaveMarkdown(updated);
|
|
1300
1418
|
}
|
|
1301
1419
|
},
|