@thanh01.pmt/presentation-kit 0.2.14 → 0.2.16

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/index.cjs CHANGED
@@ -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 chunkJNTRKKJX_cjs = require('./chunk-JNTRKKJX.cjs');
5
5
 
6
6
  // src/engine.ts
7
7
  function createEngine(config = {}) {
@@ -102,7 +102,7 @@ async function convertMarkdownToPptx(markdown, options) {
102
102
  if (options?.title) pptx.title = options.title;
103
103
  if (options?.author) pptx.author = options.author;
104
104
  const renderResult = chunkTGI6YSZP_cjs.renderSlide(markdown);
105
- const { slides } = chunkJIIUW2TN_cjs.splitMarkdownSlides(markdown);
105
+ const { slides } = chunkJNTRKKJX_cjs.splitMarkdownSlides(markdown);
106
106
  const isDark = options?.theme !== "light";
107
107
  const defaultBg = isDark ? "14151B" : "FFFFFF";
108
108
  const defaultText = isDark ? "F1F5F9" : "1E293B";
@@ -313,55 +313,59 @@ Object.defineProperty(exports, "sanitizeMermaidCode", {
313
313
  });
314
314
  Object.defineProperty(exports, "HTML_SLIDE_PRESETS", {
315
315
  enumerable: true,
316
- get: function () { return chunkJIIUW2TN_cjs.HTML_SLIDE_PRESETS; }
316
+ get: function () { return chunkJNTRKKJX_cjs.HTML_SLIDE_PRESETS; }
317
317
  });
318
318
  Object.defineProperty(exports, "HTML_THEMES", {
319
319
  enumerable: true,
320
- get: function () { return chunkJIIUW2TN_cjs.HTML_THEMES; }
320
+ get: function () { return chunkJNTRKKJX_cjs.HTML_THEMES; }
321
321
  });
322
322
  Object.defineProperty(exports, "SLIDE_LAYOUT_PRESETS", {
323
323
  enumerable: true,
324
- get: function () { return chunkJIIUW2TN_cjs.SLIDE_LAYOUT_PRESETS; }
324
+ get: function () { return chunkJNTRKKJX_cjs.SLIDE_LAYOUT_PRESETS; }
325
325
  });
326
326
  Object.defineProperty(exports, "compileHtmlDeck", {
327
327
  enumerable: true,
328
- get: function () { return chunkJIIUW2TN_cjs.compileHtmlDeck; }
328
+ get: function () { return chunkJNTRKKJX_cjs.compileHtmlDeck; }
329
329
  });
330
330
  Object.defineProperty(exports, "generateHtmlShell", {
331
331
  enumerable: true,
332
- get: function () { return chunkJIIUW2TN_cjs.generateHtmlShell; }
332
+ get: function () { return chunkJNTRKKJX_cjs.generateHtmlShell; }
333
333
  });
334
334
  Object.defineProperty(exports, "getSlideLayoutPresetById", {
335
335
  enumerable: true,
336
- get: function () { return chunkJIIUW2TN_cjs.getSlideLayoutPresetById; }
336
+ get: function () { return chunkJNTRKKJX_cjs.getSlideLayoutPresetById; }
337
337
  });
338
338
  Object.defineProperty(exports, "getSlideLayoutPresetsByCategory", {
339
339
  enumerable: true,
340
- get: function () { return chunkJIIUW2TN_cjs.getSlideLayoutPresetsByCategory; }
340
+ get: function () { return chunkJNTRKKJX_cjs.getSlideLayoutPresetsByCategory; }
341
+ });
342
+ Object.defineProperty(exports, "normalizeSlideSlots", {
343
+ enumerable: true,
344
+ get: function () { return chunkJNTRKKJX_cjs.normalizeSlideSlots; }
341
345
  });
342
346
  Object.defineProperty(exports, "removeSlideElementFromMarkdown", {
343
347
  enumerable: true,
344
- get: function () { return chunkJIIUW2TN_cjs.removeSlideElementFromMarkdown; }
348
+ get: function () { return chunkJNTRKKJX_cjs.removeSlideElementFromMarkdown; }
345
349
  });
346
350
  Object.defineProperty(exports, "resolveHtmlTheme", {
347
351
  enumerable: true,
348
- get: function () { return chunkJIIUW2TN_cjs.resolveHtmlTheme; }
352
+ get: function () { return chunkJNTRKKJX_cjs.resolveHtmlTheme; }
349
353
  });
350
354
  Object.defineProperty(exports, "serializeLayoutToComment", {
351
355
  enumerable: true,
352
- get: function () { return chunkJIIUW2TN_cjs.serializeLayoutToComment; }
356
+ get: function () { return chunkJNTRKKJX_cjs.serializeLayoutToComment; }
353
357
  });
354
358
  Object.defineProperty(exports, "splitMarkdownSlides", {
355
359
  enumerable: true,
356
- get: function () { return chunkJIIUW2TN_cjs.splitMarkdownSlides; }
360
+ get: function () { return chunkJNTRKKJX_cjs.splitMarkdownSlides; }
357
361
  });
358
362
  Object.defineProperty(exports, "updateSlideLayoutInMarkdown", {
359
363
  enumerable: true,
360
- get: function () { return chunkJIIUW2TN_cjs.updateSlideLayoutInMarkdown; }
364
+ get: function () { return chunkJNTRKKJX_cjs.updateSlideLayoutInMarkdown; }
361
365
  });
362
366
  Object.defineProperty(exports, "updateSlideTextInMarkdown", {
363
367
  enumerable: true,
364
- get: function () { return chunkJIIUW2TN_cjs.updateSlideTextInMarkdown; }
368
+ get: function () { return chunkJNTRKKJX_cjs.updateSlideTextInMarkdown; }
365
369
  });
366
370
  exports.cleanHexColor = cleanHexColor;
367
371
  exports.convertMarkdownToPptx = convertMarkdownToPptx;
package/dist/index.d.cts CHANGED
@@ -174,9 +174,12 @@ interface GenerateHtmlShellOptions {
174
174
  slidesHtml: string;
175
175
  slideCount: number;
176
176
  customHeadTags?: string;
177
+ deckId?: string;
177
178
  }
178
179
  declare function generateHtmlShell(options: GenerateHtmlShellOptions): string;
179
180
 
180
181
  declare function compileHtmlDeck(deckData: HtmlDeckData, options?: HtmlCompileOptions): CompiledHtmlDeckResult;
181
182
 
182
- export { CompiledHtmlDeckResult, type GenerateHtmlShellOptions, HTML_SLIDE_PRESETS, HTML_THEMES, HtmlCompileOptions, HtmlDeckData, HtmlDeckTheme, HtmlLayoutPresetId, HtmlSlidePreset, HtmlThemeName, MermaidBlock, type PptxExportOptions, SlideEngine, SlideEngineConfig, SlideLayoutData, ThemeTokens, cleanHexColor, compileHtmlDeck, convertMarkdownToPptx, convertTextArrows, createEngine, darkThemeTokens, detectMermaidBlocks, extractLayoutsAndNotes, extractMarpSource, filterPresenterNotes, generateHtmlShell, generateLayoutCss, generateScopedCss as generateScopedCssFromTokens, getHighlighter, highlightCodeBlocks, isLayoutComment, lightThemeTokens, navyThemeTokens, parseFontSizeToPt, parseLayoutFromComment, removeSlideElementFromMarkdown, renderMermaidDiagrams, resolveHtmlTheme, sanitizeMermaidCode, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown };
183
+ declare function normalizeSlideSlots(slide: any): Record<string, any>;
184
+
185
+ export { CompiledHtmlDeckResult, type GenerateHtmlShellOptions, HTML_SLIDE_PRESETS, HTML_THEMES, HtmlCompileOptions, HtmlDeckData, HtmlDeckTheme, HtmlLayoutPresetId, HtmlSlidePreset, HtmlThemeName, MermaidBlock, type PptxExportOptions, SlideEngine, SlideEngineConfig, SlideLayoutData, ThemeTokens, cleanHexColor, compileHtmlDeck, convertMarkdownToPptx, convertTextArrows, createEngine, darkThemeTokens, detectMermaidBlocks, extractLayoutsAndNotes, extractMarpSource, filterPresenterNotes, generateHtmlShell, generateLayoutCss, generateScopedCss as generateScopedCssFromTokens, getHighlighter, highlightCodeBlocks, isLayoutComment, lightThemeTokens, navyThemeTokens, normalizeSlideSlots, parseFontSizeToPt, parseLayoutFromComment, removeSlideElementFromMarkdown, renderMermaidDiagrams, resolveHtmlTheme, sanitizeMermaidCode, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown };
package/dist/index.d.ts CHANGED
@@ -174,9 +174,12 @@ interface GenerateHtmlShellOptions {
174
174
  slidesHtml: string;
175
175
  slideCount: number;
176
176
  customHeadTags?: string;
177
+ deckId?: string;
177
178
  }
178
179
  declare function generateHtmlShell(options: GenerateHtmlShellOptions): string;
179
180
 
180
181
  declare function compileHtmlDeck(deckData: HtmlDeckData, options?: HtmlCompileOptions): CompiledHtmlDeckResult;
181
182
 
182
- export { CompiledHtmlDeckResult, type GenerateHtmlShellOptions, HTML_SLIDE_PRESETS, HTML_THEMES, HtmlCompileOptions, HtmlDeckData, HtmlDeckTheme, HtmlLayoutPresetId, HtmlSlidePreset, HtmlThemeName, MermaidBlock, type PptxExportOptions, SlideEngine, SlideEngineConfig, SlideLayoutData, ThemeTokens, cleanHexColor, compileHtmlDeck, convertMarkdownToPptx, convertTextArrows, createEngine, darkThemeTokens, detectMermaidBlocks, extractLayoutsAndNotes, extractMarpSource, filterPresenterNotes, generateHtmlShell, generateLayoutCss, generateScopedCss as generateScopedCssFromTokens, getHighlighter, highlightCodeBlocks, isLayoutComment, lightThemeTokens, navyThemeTokens, parseFontSizeToPt, parseLayoutFromComment, removeSlideElementFromMarkdown, renderMermaidDiagrams, resolveHtmlTheme, sanitizeMermaidCode, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown };
183
+ declare function normalizeSlideSlots(slide: any): Record<string, any>;
184
+
185
+ export { CompiledHtmlDeckResult, type GenerateHtmlShellOptions, HTML_SLIDE_PRESETS, HTML_THEMES, HtmlCompileOptions, HtmlDeckData, HtmlDeckTheme, HtmlLayoutPresetId, HtmlSlidePreset, HtmlThemeName, MermaidBlock, type PptxExportOptions, SlideEngine, SlideEngineConfig, SlideLayoutData, ThemeTokens, cleanHexColor, compileHtmlDeck, convertMarkdownToPptx, convertTextArrows, createEngine, darkThemeTokens, detectMermaidBlocks, extractLayoutsAndNotes, extractMarpSource, filterPresenterNotes, generateHtmlShell, generateLayoutCss, generateScopedCss as generateScopedCssFromTokens, getHighlighter, highlightCodeBlocks, isLayoutComment, lightThemeTokens, navyThemeTokens, normalizeSlideSlots, parseFontSizeToPt, parseLayoutFromComment, removeSlideElementFromMarkdown, renderMermaidDiagrams, resolveHtmlTheme, sanitizeMermaidCode, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { resolveTheme, generateScopedCss2, renderSlideAsync, renderSlide } from './chunk-NYLDRVHZ.js';
2
2
  export { convertTextArrows, countSlides, darkThemeTokens, defineTheme, detectMermaidBlocks, extractLayoutsAndNotes, extractMarpSource, extractMaxClicks, filterPresenterNotes, generateClickCss, generateLayoutCss, generateScopedCss2 as generateScopedCss, generateScopedCss as generateScopedCssFromTokens, getHighlighter, getThemeTokens, highlightCodeBlocks, isLayoutComment, lightThemeTokens, navyThemeTokens, parseLayoutFromComment, postprocessClicks, preprocessClicks, renderMarp, renderMermaidDiagrams, renderSlide, renderSlideAsync, resolveTheme, sanitizeMermaidCode } from './chunk-NYLDRVHZ.js';
3
- import { splitMarkdownSlides } from './chunk-A7T5Y2G4.js';
4
- export { HTML_SLIDE_PRESETS, HTML_THEMES, SLIDE_LAYOUT_PRESETS, compileHtmlDeck, generateHtmlShell, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, removeSlideElementFromMarkdown, resolveHtmlTheme, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown } from './chunk-A7T5Y2G4.js';
3
+ import { splitMarkdownSlides } from './chunk-7QHDWDSB.js';
4
+ export { HTML_SLIDE_PRESETS, HTML_THEMES, SLIDE_LAYOUT_PRESETS, compileHtmlDeck, generateHtmlShell, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, normalizeSlideSlots, removeSlideElementFromMarkdown, resolveHtmlTheme, serializeLayoutToComment, splitMarkdownSlides, updateSlideLayoutInMarkdown, updateSlideTextInMarkdown } from './chunk-7QHDWDSB.js';
5
5
 
6
6
  // src/engine.ts
7
7
  function createEngine(config = {}) {
@@ -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 chunkJNTRKKJX_cjs = require('../chunk-JNTRKKJX.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 = chunkJNTRKKJX_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
+ chunkJNTRKKJX_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 = chunkJNTRKKJX_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 chunkJNTRKKJX_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
  ]