@bendyline/squisq-formats 2.4.1 → 2.4.2

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.
@@ -396,13 +396,13 @@ function defaultFormats() {
396
396
  return pptxToMarkdownDoc(data, pptxImportOptionsFrom(options));
397
397
  },
398
398
  async exportDoc(input, options) {
399
- const { markdownDocToPptx } = await import("./pptx/index.js");
399
+ const { docToPptx } = await import("./pptx/index.js");
400
400
  const raw = optionsFor(options, "pptx");
401
401
  const markdownDoc = await markdownOf(input);
402
402
  const containerImages = await collectContainerImages(input.container, options.signal);
403
403
  const images = new Map([...containerImages, ...raw.images ?? /* @__PURE__ */ new Map()]);
404
404
  const pptxWarnings = [];
405
- const buf = await markdownDocToPptx(markdownDoc, {
405
+ const buf = await docToPptx(input.doc, {
406
406
  ...raw,
407
407
  ...options.title !== void 0 ? { title: options.title } : {},
408
408
  themeId: resolveThemeId(input, options),
@@ -63,6 +63,7 @@ import {
63
63
  // src/pptx/export.ts
64
64
  import { resolveFontFamily, VIEWPORT_PRESETS } from "@bendyline/squisq/schemas";
65
65
  import {
66
+ buildPreviewDoc,
66
67
  createTemplateContext,
67
68
  docToMarkdown,
68
69
  expandCoverBlock,
@@ -140,19 +141,23 @@ async function markdownDocToPptx(doc, options = {}) {
140
141
  }
141
142
  return buildPptxPackage(slideXmls, slideContexts, options);
142
143
  }
144
+ function needsSlideshowProjection(doc) {
145
+ return (doc.blocks ?? []).some((block) => !!block.sourceHeading);
146
+ }
143
147
  async function docToPptx(doc, options = {}) {
144
148
  options.signal?.throwIfAborted();
145
149
  const effectiveOptions = !options.themeId && doc.themeId ? { ...options, themeId: doc.themeId } : options;
146
- const flatBlocks = flattenRenderableBlocks(doc.blocks);
150
+ const slideshowDoc = needsSlideshowProjection(doc) ? buildPreviewDoc(doc) : doc;
151
+ const flatBlocks = flattenRenderableBlocks(slideshowDoc.blocks);
147
152
  if (!flatBlocks.some(isTemplateBlock)) {
148
153
  return markdownDocToPptx(docToMarkdown(doc), effectiveOptions);
149
154
  }
150
155
  const theme = resolveThemeForDoc(doc, effectiveOptions.themeId, effectiveOptions.themeRegistry);
151
156
  const style = slideStyleFromTheme(theme, effectiveOptions);
152
- const audioSegments = doc.audio?.segments?.map((segment) => ({
157
+ const audioSegments = doc.audio?.segments?.length ? slideshowDoc.audio?.segments?.map((segment) => ({
153
158
  startTime: segment.startTime,
154
159
  duration: segment.duration
155
- }));
160
+ })) : void 0;
156
161
  const persistentLayers = resolvePersistentLayers(
157
162
  { persistentLayers: doc.persistentLayers },
158
163
  theme
@@ -164,9 +169,11 @@ async function docToPptx(doc, options = {}) {
164
169
  theme,
165
170
  customTemplates: doc.customTemplates,
166
171
  // A .pptx is a discrete deck: the >20s pacing split would emit N identical
167
- // copies of one authored slide (a long single block became 18 duplicates).
168
- // Keep one authored slide as one slide, matching the slideshow.
169
- splitLongBlocks: false
172
+ // copies of one authored slide (a long single block became 18 duplicates),
173
+ // and the <5s pacing merge would delete authored slides outright. Keep one
174
+ // authored slide as one slide, matching the slideshow.
175
+ splitLongBlocks: false,
176
+ mergeShortBlocks: false
170
177
  });
171
178
  const slideBlocks = [];
172
179
  if (shouldIncludeCoverSlide(doc, effectiveOptions) && doc.startBlock) {
@@ -87,10 +87,14 @@ declare function markdownDocToPptx(doc: MarkdownDocument, options?: PptxExportOp
87
87
  /**
88
88
  * Convert a squisq Doc to a .pptx ArrayBuffer.
89
89
  *
90
- * Template-backed Docs are exported through the same canonical slideshow
91
- * expansion as the player, then their materialized visual layers are mapped
92
- * to native DrawingML shapes. Plain, non-template Docs retain the semantic
93
- * Markdown export path for backward compatibility.
90
+ * The deck IS the slideshow rendition: an authored Doc runs through the same
91
+ * `buildPreviewDoc` projection and `expandDocBlocks` expansion the player uses,
92
+ * then its materialized visual layers are mapped to native DrawingML shapes.
93
+ * Without that projection a heading with no `{[template]}` annotation renders
94
+ * through `sectionHeader` — heading only — and silently drops its body prose.
95
+ *
96
+ * Docs with no templates at all retain the semantic Markdown export path for
97
+ * backward compatibility.
94
98
  */
95
99
  declare function docToPptx(doc: Doc, options?: PptxExportOptions): Promise<ArrayBuffer>;
96
100
 
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { ExtractedFileTheme, InferSourceFormat, InferThemeOptions, InferredFileT
9
9
  export { BUILTIN_FORMAT_IDS, BuiltinFormatOptions, ConversionError, ConversionErrorCode, ConversionErrorOptions, ConversionLimits, ConversionResult, ConvertOptions, ConvertSource, DEFAULT_CONVERSION_LIMITS, DbkFormatOptions, FormatDefinition, FormatId, FormatRegistry, MarkdownFormatOptions, NormalizedInput, PreparedConversion, PreparedExportOptions, convert, createRegistry, defaultFormats, defaultRegistry, prepareConversion, resolveConversionLimits } from './registry/index.js';
10
10
  export { Z as ZipSafetyError, a as ZipSafetyErrorCode, b as ZipSafetyErrorOptions, c as ZipSafetyLimits } from './zipLimits-BOKCB7qk.js';
11
11
  export { H as HtmlExportOptions, a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from './import-BQFf0iEG.js';
12
- export { P as PptxExportOptions, a as PptxImportOptions, d as docToPptx, m as markdownDocToPptx, p as pptxToMarkdownDoc } from './import-Dug5rlEL.js';
12
+ export { P as PptxExportOptions, a as PptxImportOptions, d as docToPptx, m as markdownDocToPptx, p as pptxToMarkdownDoc } from './import-C16E8Y4X.js';
13
13
  export { X as XlsxExportOptions, a as XlsxImportOptions, d as docToXlsx, m as markdownDocToXlsx, x as xlsxToMarkdownDoc } from './export-D9msROJS.js';
14
14
  import '@bendyline/squisq/schemas';
15
15
  import '@bendyline/squisq/markdown';
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  defaultRegistry,
12
12
  prepareConversion,
13
13
  resolveConversionLimits
14
- } from "./chunk-XXNCA3EH.js";
14
+ } from "./chunk-24VREWAZ.js";
15
15
  import {
16
16
  inferThemeFromFile
17
17
  } from "./chunk-KMBBO5H7.js";
@@ -33,7 +33,7 @@ import {
33
33
  markdownDocToPptx,
34
34
  pptxToDoc,
35
35
  pptxToMarkdownDoc
36
- } from "./chunk-ZRRZY57C.js";
36
+ } from "./chunk-RVGOYKVW.js";
37
37
  import "./chunk-6N2J7C2B.js";
38
38
  import "./chunk-DWNNYO5H.js";
39
39
  import {
@@ -1,5 +1,5 @@
1
- import { a as PptxImportOptions } from '../import-Dug5rlEL.js';
2
- export { P as PptxExportOptions, d as docToPptx, m as markdownDocToPptx, b as pptxToContainer, p as pptxToMarkdownDoc } from '../import-Dug5rlEL.js';
1
+ import { a as PptxImportOptions } from '../import-C16E8Y4X.js';
2
+ export { P as PptxExportOptions, d as docToPptx, m as markdownDocToPptx, b as pptxToContainer, p as pptxToMarkdownDoc } from '../import-C16E8Y4X.js';
3
3
  import { Doc } from '@bendyline/squisq/schemas';
4
4
  export { A as AnalyzePptxLayoutsOptions, a as AnalyzedLayout, E as ExtractedPlaceholder, b as ExtractedSlideLayout, I as InspectPptxLayoutsOptions, L as LayoutVerdict, P as PptxColorHints, c as PptxLayoutInference, d as PptxLayoutSummary, e as analyzePptxLayouts, i as inspectPptxLayouts } from '../layouts-CTdPlB-u.js';
5
5
  import '@bendyline/squisq/markdown';
@@ -4,7 +4,7 @@ import {
4
4
  pptxToContainer,
5
5
  pptxToDoc,
6
6
  pptxToMarkdownDoc
7
- } from "../chunk-ZRRZY57C.js";
7
+ } from "../chunk-RVGOYKVW.js";
8
8
  import {
9
9
  analyzePptxLayouts,
10
10
  inspectPptxLayouts
@@ -3,7 +3,7 @@ import { TransformStyleInput, TransformStyleRegistry } from '@bendyline/squisq/t
3
3
  import { ParseOptions, StringifyOptions, MarkdownDocument } from '@bendyline/squisq/markdown';
4
4
  import { ContentContainer } from '@bendyline/squisq/storage';
5
5
  import { DocxImportOptions, DocxExportOptions } from '../docx/index.js';
6
- import { a as PptxImportOptions, P as PptxExportOptions } from '../import-Dug5rlEL.js';
6
+ import { a as PptxImportOptions, P as PptxExportOptions } from '../import-C16E8Y4X.js';
7
7
  import { a as XlsxImportOptions, X as XlsxExportOptions } from '../export-D9msROJS.js';
8
8
  import { CsvImportOptions, CsvExportOptions } from '../csv/index.js';
9
9
  import { PdfImportOptions, PdfExportOptions } from '../pdf/index.js';
@@ -7,7 +7,7 @@ import {
7
7
  defaultRegistry,
8
8
  prepareConversion,
9
9
  resolveConversionLimits
10
- } from "../chunk-XXNCA3EH.js";
10
+ } from "../chunk-24VREWAZ.js";
11
11
  import {
12
12
  ConversionError
13
13
  } from "../chunk-KXOZMWBS.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-formats",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Document format converters — DOCX, PDF, OOXML import/export",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -108,7 +108,7 @@
108
108
  "@pdf-lib/fontkit": "1.1.1",
109
109
  "@pdf-lib/upng": "1.0.1",
110
110
  "@xmldom/xmldom": "0.9.10",
111
- "@bendyline/squisq": "2.7.0",
111
+ "@bendyline/squisq": "2.7.1",
112
112
  "jszip": "3.10.1",
113
113
  "pdf-lib": "1.17.1",
114
114
  "pdfjs-dist": "4.10.38"