@thanh01.pmt/presentation-kit 0.2.14 → 0.2.15

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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkTGI6YSZP_cjs = require('../chunk-TGI6YSZP.cjs');
4
- var chunkJIIUW2TN_cjs = require('../chunk-JIIUW2TN.cjs');
4
+ var chunkSUGKWGJJ_cjs = require('../chunk-SUGKWGJJ.cjs');
5
5
  var React2 = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
 
@@ -914,7 +914,7 @@ function SlideDesignOverlay({
914
914
  "select",
915
915
  {
916
916
  onChange: (e) => {
917
- const preset = chunkJIIUW2TN_cjs.SLIDE_LAYOUT_PRESETS.find((p) => p.id === e.target.value);
917
+ const preset = chunkSUGKWGJJ_cjs.SLIDE_LAYOUT_PRESETS.find((p) => p.id === e.target.value);
918
918
  if (preset) {
919
919
  const clonedBoxes = JSON.parse(JSON.stringify(preset.layout.boxes));
920
920
  setBoxes(clonedBoxes);
@@ -934,7 +934,7 @@ function SlideDesignOverlay({
934
934
  title: "\xC1p d\u1EE5ng m\u1EABu b\u1ED1 c\u1EE5c c\xF3 s\u1EB5n",
935
935
  children: [
936
936
  /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, style: { backgroundColor: isLight ? "#ffffff" : "#1e1f29", color: subtextColor }, children: "M\u1EABu b\u1ED1 c\u1EE5c (Presets)..." }),
937
- chunkJIIUW2TN_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))
937
+ chunkSUGKWGJJ_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))
938
938
  ]
939
939
  }
940
940
  ),
@@ -1567,7 +1567,7 @@ function SlideViewer({
1567
1567
  onSave: (layout) => {
1568
1568
  setLiveLayout(layout);
1569
1569
  if (onSaveMarkdown) {
1570
- const updated = chunkJIIUW2TN_cjs.updateSlideLayoutInMarkdown(markdown, currentIndex, layout);
1570
+ const updated = chunkSUGKWGJJ_cjs.updateSlideLayoutInMarkdown(markdown, currentIndex, layout);
1571
1571
  onSaveMarkdown(updated);
1572
1572
  }
1573
1573
  },
@@ -1610,6 +1610,7 @@ var HtmlSlideViewer = ({
1610
1610
  title: propTitle,
1611
1611
  className = "",
1612
1612
  onSlideChange,
1613
+ onSaveHtml,
1613
1614
  showTopBar = true
1614
1615
  }) => {
1615
1616
  const iframeRef = React2.useRef(null);
@@ -1620,7 +1621,7 @@ var HtmlSlideViewer = ({
1620
1621
  const fullHtml = React2.useMemo(() => {
1621
1622
  if (initialHtml) return initialHtml;
1622
1623
  if (deckData) {
1623
- return chunkJIIUW2TN_cjs.compileHtmlDeck(deckData).html;
1624
+ return chunkSUGKWGJJ_cjs.compileHtmlDeck(deckData).html;
1624
1625
  }
1625
1626
  return "";
1626
1627
  }, [initialHtml, deckData]);
@@ -1636,11 +1637,15 @@ var HtmlSlideViewer = ({
1636
1637
  if (onSlideChange) {
1637
1638
  onSlideChange(cur, tot);
1638
1639
  }
1640
+ } else if (e.data.type === "SLIDE_HTML_SAVED") {
1641
+ if (onSaveHtml && typeof e.data.html === "string") {
1642
+ onSaveHtml(e.data.html);
1643
+ }
1639
1644
  }
1640
1645
  };
1641
1646
  window.addEventListener("message", handleMessage);
1642
1647
  return () => window.removeEventListener("message", handleMessage);
1643
- }, [onSlideChange]);
1648
+ }, [onSlideChange, onSaveHtml]);
1644
1649
  React2.useEffect(() => {
1645
1650
  const onFsChange = () => {
1646
1651
  setIsFullscreen(Boolean(document.fullscreenElement));
@@ -1653,6 +1658,14 @@ var HtmlSlideViewer = ({
1653
1658
  iframeRef.current.contentWindow.postMessage(msg, "*");
1654
1659
  }
1655
1660
  }, []);
1661
+ React2.useEffect(() => {
1662
+ if (!containerRef.current || typeof ResizeObserver === "undefined") return;
1663
+ const ro = new ResizeObserver(() => {
1664
+ sendIframeMessage({ type: "RESIZE" });
1665
+ });
1666
+ ro.observe(containerRef.current);
1667
+ return () => ro.disconnect();
1668
+ }, [sendIframeMessage]);
1656
1669
  const handleNext = () => sendIframeMessage({ type: "NEXT_SLIDE" });
1657
1670
  const handlePrev = () => sendIframeMessage({ type: "PREV_SLIDE" });
1658
1671
  const handleToggleFullscreen = () => {
@@ -1751,7 +1764,10 @@ var HtmlSlideViewer = ({
1751
1764
  srcDoc: fullHtml,
1752
1765
  title: deckTitle,
1753
1766
  sandbox: "allow-scripts allow-same-origin allow-popups allow-forms",
1754
- className: "w-full h-full border-0 block"
1767
+ className: "w-full h-full border-0 block",
1768
+ onLoad: () => {
1769
+ sendIframeMessage({ type: "RESIZE" });
1770
+ }
1755
1771
  }
1756
1772
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-neutral-500 text-sm", children: "No slide deck content loaded." }) })
1757
1773
  ]