@bendyline/squisq-formats 2.8.16 → 2.8.18

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.
Files changed (33) hide show
  1. package/dist/{chunk-MF4ZQQJ7.js → chunk-42ETCBAK.js} +14 -5
  2. package/dist/{chunk-5HUHSLGA.js → chunk-6OB2DSGW.js} +1 -1
  3. package/dist/{chunk-ATWVNF7D.js → chunk-6QVOHRRL.js} +1 -1
  4. package/dist/{chunk-YRFBWYAD.js → chunk-AQZ2CAET.js} +1 -1
  5. package/dist/{chunk-S5PCVMKU.js → chunk-BB3BLYLM.js} +8 -0
  6. package/dist/{chunk-OK622ILP.js → chunk-BGVT5I55.js} +1 -1
  7. package/dist/{chunk-WATAOG4Y.js → chunk-FD7IDL5V.js} +2 -2
  8. package/dist/{chunk-3KXEE7KH.js → chunk-GJWBVR4X.js} +3 -3
  9. package/dist/{chunk-KZUP6TIV.js → chunk-HAGYYPFR.js} +2 -2
  10. package/dist/{chunk-4SPMLGOG.js → chunk-J6LR22RZ.js} +9 -1
  11. package/dist/{chunk-4A3EHQJP.js → chunk-KWZDYOCB.js} +3 -3
  12. package/dist/{chunk-LSUMEIQ7.js → chunk-O4UYRQX7.js} +4 -4
  13. package/dist/{chunk-SWLDHEZI.js → chunk-ONPR2LAD.js} +561 -68
  14. package/dist/{chunk-6N2J7C2B.js → chunk-RBKUII3V.js} +1 -1
  15. package/dist/{chunk-ILCJ3WFD.js → chunk-SUWCBXZH.js} +1 -1
  16. package/dist/{chunk-ZJERBWTB.js → chunk-WPLCWAN3.js} +10 -4
  17. package/dist/data/index.js +4 -4
  18. package/dist/docx/index.js +3 -3
  19. package/dist/epub/index.js +1 -1
  20. package/dist/{extract-UTAOG7LV.js → extract-27YYYYBZ.js} +3 -3
  21. package/dist/html/index.js +1 -1
  22. package/dist/html/prepare.js +1 -1
  23. package/dist/index.js +14 -14
  24. package/dist/infer/index.js +4 -4
  25. package/dist/{layouts-2A7QNF6Y.js → layouts-5YNFCOMS.js} +2 -2
  26. package/dist/{materialize-ICXNO4S4.js → materialize-2MS3SXA6.js} +4 -4
  27. package/dist/ooxml/index.js +3 -3
  28. package/dist/outside-in/index.js +2 -2
  29. package/dist/pptx/index.js +4 -4
  30. package/dist/{readers-3P5A6A2A.js → readers-TAWBODNF.js} +3 -3
  31. package/dist/registry/index.js +1 -1
  32. package/dist/xlsx/index.js +4 -4
  33. package/package.json +2 -2
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-BZ5SHMOY.js";
18
18
  import {
19
19
  createPackage
20
- } from "./chunk-ILCJ3WFD.js";
20
+ } from "./chunk-SUWCBXZH.js";
21
21
  import {
22
22
  escapeXml,
23
23
  xmlDeclaration
@@ -53,7 +53,7 @@ import {
53
53
  openPackage,
54
54
  requireMainPartPath,
55
55
  resolveTarget
56
- } from "./chunk-S5PCVMKU.js";
56
+ } from "./chunk-BB3BLYLM.js";
57
57
  import {
58
58
  renumberFootnotes,
59
59
  withoutBlockTags
@@ -570,12 +570,13 @@ function convertCodeBlock(node) {
570
570
  return parts.join("");
571
571
  }
572
572
  function convertTable(node, ctx) {
573
+ const columnCount = Math.max(1, ...node.children.map((row) => row.children.length));
573
574
  const rows = [];
574
575
  for (let ri = 0; ri < node.children.length; ri++) {
575
576
  const row = node.children[ri];
576
577
  rows.push(convertTableRow(row, ctx, ri === 0, node.align));
577
578
  }
578
- return `<w:tbl><w:tblPr><w:tblStyle w:val="TableGrid"/><w:tblW w:w="0" w:type="auto"/><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders></w:tblPr><w:tblGrid/>` + rows.join("") + `</w:tbl>`;
579
+ return `<w:tbl><w:tblPr><w:tblStyle w:val="TableGrid"/><w:tblW w:w="0" w:type="auto"/><w:tblBorders><w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/><w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/></w:tblBorders></w:tblPr><w:tblGrid>${"<w:gridCol/>".repeat(columnCount)}</w:tblGrid>` + rows.join("") + `</w:tbl>`;
579
580
  }
580
581
  function convertTableRow(row, ctx, isHeader, align) {
581
582
  const cells = [];
@@ -588,11 +589,19 @@ function convertTableRow(row, ctx, isHeader, align) {
588
589
  return `<w:tr>${trPr}${cells.join("")}</w:tr>`;
589
590
  }
590
591
  function convertTableCell(cell, ctx, isHeader, align) {
591
- const runs = convertInlines(cell.children, ctx, bodyFormat(ctx));
592
+ const format = isHeader ? { ...bodyFormat(ctx), bold: true } : bodyFormat(ctx);
593
+ const runs = convertInlines(cell.children, ctx, format);
592
594
  const jcMap = { left: "left", center: "center", right: "right" };
593
595
  const jc = align ? `<w:jc w:val="${jcMap[align]}"/>` : "";
594
596
  const pPr = `<w:pPr><w:spacing w:after="0"/>${jc}</w:pPr>`;
595
- return `<w:tc><w:p>${pPr}${runs}</w:p></w:tc>`;
597
+ const tcPr = isHeader ? `<w:tcPr><w:shd w:val="clear" w:color="auto" w:fill="${tableHeaderFill(ctx)}"/></w:tcPr>` : "";
598
+ return `<w:tc>${tcPr}<w:p>${pPr}${runs}</w:p></w:tc>`;
599
+ }
600
+ function tableHeaderFill(ctx) {
601
+ const channels = (hex, fallback) => (/^[0-9a-f]{6}$/i.test(hex ?? "") ? hex : fallback).match(/../g).map((pair) => parseInt(pair, 16));
602
+ const page = channels(ctx.backgroundColor, "FFFFFF");
603
+ const ink = channels(ctx.bodyColor, "000000");
604
+ return page.map((channel, index) => Math.round(channel + (ink[index] - channel) * 0.1)).map((channel) => channel.toString(16).padStart(2, "0")).join("").toUpperCase();
596
605
  }
597
606
  function convertThematicBreak() {
598
607
  return `<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr></w:pPr></w:p>`;
@@ -2,7 +2,7 @@ import {
2
2
  columnLetter2 as columnLetter,
3
3
  parseCellRef,
4
4
  xlsxToTables
5
- } from "./chunk-ATWVNF7D.js";
5
+ } from "./chunk-6QVOHRRL.js";
6
6
  import {
7
7
  SIDECAR_CSV_LIMITS,
8
8
  parseCsv
@@ -9,7 +9,7 @@ import {
9
9
  getPartXml,
10
10
  openPackage,
11
11
  requireMainPartPath
12
- } from "./chunk-S5PCVMKU.js";
12
+ } from "./chunk-BB3BLYLM.js";
13
13
 
14
14
  // src/xlsx/cells.ts
15
15
  var MAX_COL_INDEX = 16383;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defaultDataReaders
3
- } from "./chunk-5HUHSLGA.js";
3
+ } from "./chunk-6OB2DSGW.js";
4
4
 
5
5
  // src/data/materialize.ts
6
6
  import {
@@ -52,6 +52,10 @@ var CONTENT_TYPE_PPTX_FONT = "application/x-fontdata";
52
52
  var REL_SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
53
53
  var REL_SLIDE_LAYOUT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
54
54
  var REL_SLIDE_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
55
+ var CONTENT_TYPE_PPTX_NOTES_MASTER = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
56
+ var CONTENT_TYPE_PPTX_NOTES_SLIDE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
57
+ var REL_NOTES_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
58
+ var REL_NOTES_SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
55
59
  var CONTENT_TYPE_XLSX_WORKBOOK = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
56
60
  var CONTENT_TYPE_XLSX_WORKSHEET = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
57
61
  var CONTENT_TYPE_XLSX_STYLES = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml";
@@ -313,6 +317,10 @@ export {
313
317
  REL_SLIDE,
314
318
  REL_SLIDE_LAYOUT,
315
319
  REL_SLIDE_MASTER,
320
+ CONTENT_TYPE_PPTX_NOTES_MASTER,
321
+ CONTENT_TYPE_PPTX_NOTES_SLIDE,
322
+ REL_NOTES_MASTER,
323
+ REL_NOTES_SLIDE,
316
324
  CONTENT_TYPE_XLSX_WORKBOOK,
317
325
  CONTENT_TYPE_XLSX_WORKSHEET,
318
326
  CONTENT_TYPE_XLSX_STYLES,
@@ -6,7 +6,7 @@ import {
6
6
  getPartRelationships,
7
7
  getPartXml,
8
8
  resolveTarget
9
- } from "./chunk-S5PCVMKU.js";
9
+ } from "./chunk-BB3BLYLM.js";
10
10
 
11
11
  // src/ooxml/themeReader.ts
12
12
  var HEX6_RE = /^[0-9a-fA-F]{6}$/;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parseThemeXml,
3
3
  readThemePart
4
- } from "./chunk-OK622ILP.js";
4
+ } from "./chunk-BGVT5I55.js";
5
5
  import {
6
6
  CONTENT_TYPE_PPTX_THEME,
7
7
  NS_PML,
@@ -11,7 +11,7 @@ import {
11
11
  getPartRelationships,
12
12
  getPartXml,
13
13
  resolveTarget
14
- } from "./chunk-S5PCVMKU.js";
14
+ } from "./chunk-BB3BLYLM.js";
15
15
 
16
16
  // src/infer/extract.ts
17
17
  var DEFAULT_COLOR_MAP = { bg1: "lt1", tx1: "dk1" };
@@ -2,7 +2,7 @@ import {
2
2
  extractDocxTheme,
3
3
  extractPptxTheme,
4
4
  extractXlsxTheme
5
- } from "./chunk-WATAOG4Y.js";
5
+ } from "./chunk-FD7IDL5V.js";
6
6
  import {
7
7
  colorHintsFromExtraction,
8
8
  compileExtractedTheme
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  openPackage,
15
15
  throwIfOoxmlAborted
16
- } from "./chunk-S5PCVMKU.js";
16
+ } from "./chunk-BB3BLYLM.js";
17
17
 
18
18
  // src/infer/index.ts
19
19
  async function looksLikePdf(data, signal) {
@@ -107,7 +107,7 @@ async function inferThemeFromFile(data, options = {}) {
107
107
  if (format !== "pptx") {
108
108
  warnings.push("Layout inference is only available for PowerPoint files; skipped.");
109
109
  } else {
110
- const { analyzePptxLayouts } = await import("./layouts-2A7QNF6Y.js");
110
+ const { analyzePptxLayouts } = await import("./layouts-5YNFCOMS.js");
111
111
  const analysis = await analyzePptxLayouts(pkg, {
112
112
  colors: colorHintsFromExtraction(extraction),
113
113
  signal: options.signal
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  convert,
8
8
  defaultRegistry
9
- } from "./chunk-LSUMEIQ7.js";
9
+ } from "./chunk-O4UYRQX7.js";
10
10
  import {
11
11
  ConversionError
12
12
  } from "./chunk-KXOZMWBS.js";
@@ -244,7 +244,7 @@ async function prepareOutsideInMarkdown(markdown, format, container, options, fo
244
244
  };
245
245
  return doc;
246
246
  }
247
- const { materializeDataReferences, DATA_PREVIEW_ROWS } = await import("./materialize-ICXNO4S4.js");
247
+ const { materializeDataReferences, DATA_PREVIEW_ROWS } = await import("./materialize-2MS3SXA6.js");
248
248
  doc = await materializeDataReferences(doc, container, onWarning, {
249
249
  maxRows: DATA_PREVIEW_ROWS
250
250
  });
@@ -1021,6 +1021,7 @@ function escapeAttr(s) {
1021
1021
  // src/html/plainHtmlBundle.ts
1022
1022
  import JSZip from "jszip";
1023
1023
  import { parseMarkdown, inferDocumentTitle } from "@bendyline/squisq/markdown";
1024
+ import { isMediaAnnotationName as isMediaAnnotationName2, parseStandaloneAnnotation as parseStandaloneAnnotation2 } from "@bendyline/squisq/doc";
1024
1025
  async function markdownDocsToPlainHtmlBundle(options) {
1025
1026
  const {
1026
1027
  entryPath,
@@ -1160,7 +1161,14 @@ function collectImageRefs(doc) {
1160
1161
  }
1161
1162
  if (Array.isArray(n.children)) for (const c of n.children) visit(c);
1162
1163
  }
1163
- for (const child of doc.children) visit(child);
1164
+ for (const child of doc.children) {
1165
+ visit(child);
1166
+ if (child.type !== "paragraph") continue;
1167
+ const tag = parseStandaloneAnnotation2(child);
1168
+ if (tag?.template && isMediaAnnotationName2(tag.template) && tag.params.src) {
1169
+ refs.add(tag.params.src);
1170
+ }
1171
+ }
1164
1172
  return refs;
1165
1173
  }
1166
1174
  function parseLinkRef(url) {
@@ -14,10 +14,10 @@ import {
14
14
  parseCellRef,
15
15
  readCellStyles,
16
16
  xlsxToMarkdownDoc
17
- } from "./chunk-ATWVNF7D.js";
17
+ } from "./chunk-6QVOHRRL.js";
18
18
  import {
19
19
  createPackage
20
- } from "./chunk-ILCJ3WFD.js";
20
+ } from "./chunk-SUWCBXZH.js";
21
21
  import {
22
22
  escapeXml,
23
23
  xmlDeclaration
@@ -34,7 +34,7 @@ import {
34
34
  getPartBinary,
35
35
  openPackage,
36
36
  requireMainPartPath
37
- } from "./chunk-S5PCVMKU.js";
37
+ } from "./chunk-BB3BLYLM.js";
38
38
 
39
39
  // src/xlsx/index.ts
40
40
  import { markdownToDoc } from "@bendyline/squisq/doc";
@@ -271,7 +271,7 @@ function dataReferenceWarnings(doc, formatLabel) {
271
271
  async function markdownWithDataPreview(input, warnings) {
272
272
  const markdownDoc = await markdownOf(input);
273
273
  if (dataReferenceSources(input.doc).size === 0) return markdownDoc;
274
- const { materializeDataReferences, DATA_PREVIEW_ROWS } = await import("./materialize-ICXNO4S4.js");
274
+ const { materializeDataReferences, DATA_PREVIEW_ROWS } = await import("./materialize-2MS3SXA6.js");
275
275
  return materializeDataReferences(
276
276
  markdownDoc,
277
277
  input.container,
@@ -283,7 +283,7 @@ async function docWithDataPreview(input, warnings) {
283
283
  if (dataReferenceSources(input.doc).size === 0) return input.doc;
284
284
  const [{ resolveDataReferences }, { defaultDataReaders }] = await Promise.all([
285
285
  import("@bendyline/squisq/doc"),
286
- import("./readers-3P5A6A2A.js")
286
+ import("./readers-TAWBODNF.js")
287
287
  ]);
288
288
  const { doc, diagnostics } = await resolveDataReferences(input.doc, input.container, {
289
289
  readers: defaultDataReaders()
@@ -489,7 +489,7 @@ function defaultFormats() {
489
489
  },
490
490
  async exportDoc(input, options) {
491
491
  const { markdownDocToXlsx } = await import("./xlsx/index.js");
492
- const { materializeDataReferences } = await import("./materialize-ICXNO4S4.js");
492
+ const { materializeDataReferences } = await import("./materialize-2MS3SXA6.js");
493
493
  const warnings = [];
494
494
  const markdownDoc = await materializeDataReferences(
495
495
  await markdownOf(input),
@@ -528,7 +528,7 @@ function defaultFormats() {
528
528
  },
529
529
  async exportDoc(input, options) {
530
530
  const { markdownDocToCsv } = await import("./csv/index.js");
531
- const { materializeDataReferences } = await import("./materialize-ICXNO4S4.js");
531
+ const { materializeDataReferences } = await import("./materialize-2MS3SXA6.js");
532
532
  const warnings = [];
533
533
  const markdownDoc = await materializeDataReferences(
534
534
  await markdownOf(input),