@thanh01.pmt/presentation-kit 0.2.13 → 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.
@@ -186,6 +186,8 @@ interface HtmlSlideViewerProps {
186
186
  className?: string;
187
187
  /** Callback fired when active slide index changes */
188
188
  onSlideChange?: (current: number, total: number) => void;
189
+ /** Callback fired when slide deck is exported or saved from inline editor */
190
+ onSaveHtml?: (savedHtml: string) => void;
189
191
  /** Show top control bar */
190
192
  showTopBar?: boolean;
191
193
  }
@@ -186,6 +186,8 @@ interface HtmlSlideViewerProps {
186
186
  className?: string;
187
187
  /** Callback fired when active slide index changes */
188
188
  onSlideChange?: (current: number, total: number) => void;
189
+ /** Callback fired when slide deck is exported or saved from inline editor */
190
+ onSaveHtml?: (savedHtml: string) => void;
189
191
  /** Show top control bar */
190
192
  showTopBar?: boolean;
191
193
  }
@@ -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, compileHtmlDeck } from '../chunk-3VGV5KYZ.js';
3
+ import { SLIDE_LAYOUT_PRESETS, updateSlideLayoutInMarkdown, compileHtmlDeck } from '../chunk-YPYAP4TF.js';
4
4
  import React2, { useState, useRef, useMemo, useEffect, useCallback } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -625,7 +625,10 @@ function PresenterNotesDrawer({
625
625
  borderRadius: "4px"
626
626
  },
627
627
  title: "\u0110\xF3ng ghi ch\xFA",
628
- children: "\u2715"
628
+ children: /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
629
+ /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
630
+ /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
631
+ ] })
629
632
  }
630
633
  )
631
634
  ]
@@ -1602,6 +1605,7 @@ var HtmlSlideViewer = ({
1602
1605
  title: propTitle,
1603
1606
  className = "",
1604
1607
  onSlideChange,
1608
+ onSaveHtml,
1605
1609
  showTopBar = true
1606
1610
  }) => {
1607
1611
  const iframeRef = useRef(null);
@@ -1628,11 +1632,15 @@ var HtmlSlideViewer = ({
1628
1632
  if (onSlideChange) {
1629
1633
  onSlideChange(cur, tot);
1630
1634
  }
1635
+ } else if (e.data.type === "SLIDE_HTML_SAVED") {
1636
+ if (onSaveHtml && typeof e.data.html === "string") {
1637
+ onSaveHtml(e.data.html);
1638
+ }
1631
1639
  }
1632
1640
  };
1633
1641
  window.addEventListener("message", handleMessage);
1634
1642
  return () => window.removeEventListener("message", handleMessage);
1635
- }, [onSlideChange]);
1643
+ }, [onSlideChange, onSaveHtml]);
1636
1644
  useEffect(() => {
1637
1645
  const onFsChange = () => {
1638
1646
  setIsFullscreen(Boolean(document.fullscreenElement));
@@ -1645,6 +1653,14 @@ var HtmlSlideViewer = ({
1645
1653
  iframeRef.current.contentWindow.postMessage(msg, "*");
1646
1654
  }
1647
1655
  }, []);
1656
+ useEffect(() => {
1657
+ if (!containerRef.current || typeof ResizeObserver === "undefined") return;
1658
+ const ro = new ResizeObserver(() => {
1659
+ sendIframeMessage({ type: "RESIZE" });
1660
+ });
1661
+ ro.observe(containerRef.current);
1662
+ return () => ro.disconnect();
1663
+ }, [sendIframeMessage]);
1648
1664
  const handleNext = () => sendIframeMessage({ type: "NEXT_SLIDE" });
1649
1665
  const handlePrev = () => sendIframeMessage({ type: "PREV_SLIDE" });
1650
1666
  const handleToggleFullscreen = () => {
@@ -1673,27 +1689,27 @@ var HtmlSlideViewer = ({
1673
1689
  "div",
1674
1690
  {
1675
1691
  ref: containerRef,
1676
- className: `relative flex flex-col w-full h-full bg-neutral-950 text-neutral-100 rounded-xl overflow-hidden shadow-2xl ${className}`,
1692
+ className: `relative flex flex-col w-full h-full bg-card text-txt-pri rounded-xl overflow-hidden border border-border/80 shadow-xs ${className}`,
1677
1693
  style: { minHeight: "480px" },
1678
1694
  children: [
1679
- showTopBar && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2 bg-neutral-900/90 backdrop-blur border-b border-neutral-800 text-xs select-none z-20", children: [
1695
+ showTopBar && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2 bg-panel/90 backdrop-blur border-b border-border/80 text-meta select-none z-20", children: [
1680
1696
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 font-medium truncate max-w-md", children: [
1681
- /* @__PURE__ */ jsx("span", { className: "w-2 h-2 rounded-full bg-blue-500 inline-block" }),
1682
- /* @__PURE__ */ jsx("span", { className: "truncate text-neutral-200", children: deckTitle })
1697
+ /* @__PURE__ */ jsx("span", { className: "w-2 h-2 rounded-full bg-primary inline-block shrink-0" }),
1698
+ /* @__PURE__ */ jsx("span", { className: "truncate text-txt-pri", children: deckTitle })
1683
1699
  ] }),
1684
1700
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1685
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-neutral-800/80 px-2 py-1 rounded border border-neutral-700 font-mono text-[11px]", children: [
1701
+ /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1 bg-card px-2 py-0.5 rounded-lg border border-border/80 font-mono text-meta text-txt-sec h-7.5", children: [
1686
1702
  /* @__PURE__ */ jsx(
1687
1703
  "button",
1688
1704
  {
1689
1705
  onClick: handlePrev,
1690
1706
  disabled: currentSlide <= 0,
1691
- className: "hover:text-white disabled:opacity-40 p-0.5",
1692
- title: "Previous Slide",
1693
- children: "\u25C0"
1707
+ className: "hover:text-txt-pri disabled:opacity-30 p-1 text-txt-sec cursor-pointer transition-colors flex items-center justify-center rounded",
1708
+ title: "Previous Slide (\u2190)",
1709
+ children: /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "15 18 9 12 15 6" }) })
1694
1710
  }
1695
1711
  ),
1696
- /* @__PURE__ */ jsxs("span", { className: "px-1 font-semibold text-neutral-200", children: [
1712
+ /* @__PURE__ */ jsxs("span", { className: "px-1.5 font-semibold text-txt-pri text-center min-w-[45px]", children: [
1697
1713
  String(currentSlide + 1).padStart(2, "0"),
1698
1714
  " / ",
1699
1715
  String(totalSlides).padStart(2, "0")
@@ -1703,9 +1719,9 @@ var HtmlSlideViewer = ({
1703
1719
  {
1704
1720
  onClick: handleNext,
1705
1721
  disabled: currentSlide >= totalSlides - 1,
1706
- className: "hover:text-white disabled:opacity-40 p-0.5",
1707
- title: "Next Slide",
1708
- children: "\u25B6"
1722
+ className: "hover:text-txt-pri disabled:opacity-30 p-1 text-txt-sec cursor-pointer transition-colors flex items-center justify-center rounded",
1723
+ title: "Next Slide (\u2192)",
1724
+ children: /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" }) })
1709
1725
  }
1710
1726
  )
1711
1727
  ] }),
@@ -1713,10 +1729,10 @@ var HtmlSlideViewer = ({
1713
1729
  "button",
1714
1730
  {
1715
1731
  onClick: handleDownloadHtml,
1716
- className: "flex items-center gap-1 px-2.5 py-1 rounded bg-neutral-800 hover:bg-neutral-700 text-neutral-300 hover:text-white border border-neutral-700 transition-colors",
1732
+ className: "flex items-center gap-1.5 h-7.5 px-2.5 rounded-lg bg-panel hover:bg-txt-pri/5 text-txt-pri border border-border/80 text-meta font-medium transition-colors cursor-pointer shadow-2xs leading-none shrink-0",
1717
1733
  title: "Download standalone offline HTML file",
1718
1734
  children: [
1719
- /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1735
+ /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1720
1736
  /* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
1721
1737
  /* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
1722
1738
  /* @__PURE__ */ jsx("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
@@ -1729,9 +1745,9 @@ var HtmlSlideViewer = ({
1729
1745
  "button",
1730
1746
  {
1731
1747
  onClick: handleToggleFullscreen,
1732
- className: "p-1 rounded bg-neutral-800 hover:bg-neutral-700 text-neutral-300 hover:text-white border border-neutral-700 transition-colors",
1748
+ className: "h-7.5 px-2 rounded-lg bg-panel hover:bg-txt-pri/5 text-txt-pri border border-border/80 text-meta transition-colors cursor-pointer shadow-2xs flex items-center justify-center shrink-0",
1733
1749
  title: "Toggle Fullscreen (F)",
1734
- children: /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: isFullscreen ? /* @__PURE__ */ jsx("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }) : /* @__PURE__ */ jsx("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) })
1750
+ children: /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: isFullscreen ? /* @__PURE__ */ jsx("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }) : /* @__PURE__ */ jsx("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) })
1735
1751
  }
1736
1752
  )
1737
1753
  ] })
@@ -1743,7 +1759,10 @@ var HtmlSlideViewer = ({
1743
1759
  srcDoc: fullHtml,
1744
1760
  title: deckTitle,
1745
1761
  sandbox: "allow-scripts allow-same-origin allow-popups allow-forms",
1746
- className: "w-full h-full border-0 block"
1762
+ className: "w-full h-full border-0 block",
1763
+ onLoad: () => {
1764
+ sendIframeMessage({ type: "RESIZE" });
1765
+ }
1747
1766
  }
1748
1767
  ) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-neutral-500 text-sm", children: "No slide deck content loaded." }) })
1749
1768
  ]