@thanh01.pmt/presentation-kit 0.2.9 → 0.2.10

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.
@@ -1,6 +1,6 @@
1
1
  import { renderSlide, renderMermaidDiagrams } from '../chunk-NYLDRVHZ.js';
2
2
  export { defineTheme, extractMaxClicks, generateClickCss, postprocessClicks, preprocessClicks, renderSlide, renderSlideAsync, resolveTheme } from '../chunk-NYLDRVHZ.js';
3
- import { SLIDE_LAYOUT_PRESETS, updateSlideLayoutInMarkdown } from '../chunk-ZPASRL75.js';
3
+ import { SLIDE_LAYOUT_PRESETS, updateSlideLayoutInMarkdown } from '../chunk-V6X7D44H.js';
4
4
  import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -610,10 +610,12 @@ function SlideDesignOverlay({
610
610
  setBoxes(layout?.boxes ?? []);
611
611
  }, [layout, slideIndex]);
612
612
  const selectedBox = boxes.find((b) => b.id === selectedId) ?? null;
613
+ const hasMovedRef = useRef(false);
613
614
  const [dragging, setDragging] = useState(null);
614
615
  const handleMouseDown = (e, box, type) => {
615
616
  e.preventDefault();
616
617
  e.stopPropagation();
618
+ hasMovedRef.current = false;
617
619
  setSelectedId(box.id);
618
620
  setDragging({
619
621
  type,
@@ -630,6 +632,9 @@ function SlideDesignOverlay({
630
632
  const scaleY = 720 / rect.height;
631
633
  const dx = (e.clientX - dragging.startX) * scaleX;
632
634
  const dy = (e.clientY - dragging.startY) * scaleY;
635
+ if (Math.abs(dx) > 1 || Math.abs(dy) > 1) {
636
+ hasMovedRef.current = true;
637
+ }
633
638
  const [origX, origY, origW, origH] = dragging.startPos;
634
639
  setBoxes((prev) => {
635
640
  const updated = prev.map((b) => {
@@ -682,9 +687,10 @@ function SlideDesignOverlay({
682
687
  });
683
688
  }, [dragging, onLayoutChange]);
684
689
  const handleMouseUp = useCallback(() => {
685
- if (dragging && onSave) {
690
+ if (dragging && hasMovedRef.current && onSave) {
686
691
  onSave({ boxes });
687
692
  }
693
+ hasMovedRef.current = false;
688
694
  setDragging(null);
689
695
  }, [dragging, boxes, onSave]);
690
696
  useEffect(() => {
@@ -913,8 +919,9 @@ function SlideDesignOverlay({
913
919
  style: {
914
920
  width: "100%",
915
921
  height: "100%",
916
- background: "transparent",
917
- border: "none",
922
+ backgroundColor: isLight ? "#ffffff" : isNavy ? "#0b132b" : "#181920",
923
+ border: isLight ? "1px solid #0284c7" : "1px solid #38bdf8",
924
+ borderRadius: "4px",
918
925
  outline: "none",
919
926
  resize: "none",
920
927
  fontSize: box.fontSize ?? (box.target === "h1" ? "2.2rem" : "1.1rem"),
@@ -923,8 +930,9 @@ function SlideDesignOverlay({
923
930
  fontFamily: "Inter, sans-serif",
924
931
  fontWeight: box.target === "h1" ? 700 : 400,
925
932
  lineHeight: 1.25,
926
- padding: 0,
927
- margin: 0
933
+ padding: "4px 6px",
934
+ margin: 0,
935
+ boxShadow: "0 4px 16px rgba(0,0,0,0.25)"
928
936
  }
929
937
  }
930
938
  ) : /* @__PURE__ */ jsx(
@@ -938,20 +946,9 @@ function SlideDesignOverlay({
938
946
  style: {
939
947
  width: "100%",
940
948
  height: "100%",
941
- fontSize: box.fontSize ?? (box.target === "h1" ? "2.2rem" : "1.1rem"),
942
- color: box.color ?? (isLight ? "#0f172a" : "#f8fafc"),
943
- textAlign: box.textAlign ?? "left",
944
- fontFamily: "Inter, sans-serif",
945
- fontWeight: box.target === "h1" ? 700 : 400,
946
- lineHeight: 1.25,
947
- wordBreak: "break-word",
948
- userSelect: "none",
949
- cursor: "pointer",
950
- display: "flex",
951
- alignItems: "center"
949
+ cursor: "pointer"
952
950
  },
953
- title: "Click \u0111\xFAp \u0111\u1EC3 s\u1EEDa ch\u1EEF",
954
- 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)..." })
951
+ title: "Click \u0111\xFAp \u0111\u1EC3 s\u1EEDa ch\u1EEF"
955
952
  }
956
953
  )
957
954
  }