@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.
- package/dist/{chunk-MF4ZQQJ7.js → chunk-42ETCBAK.js} +14 -5
- package/dist/{chunk-5HUHSLGA.js → chunk-6OB2DSGW.js} +1 -1
- package/dist/{chunk-ATWVNF7D.js → chunk-6QVOHRRL.js} +1 -1
- package/dist/{chunk-YRFBWYAD.js → chunk-AQZ2CAET.js} +1 -1
- package/dist/{chunk-S5PCVMKU.js → chunk-BB3BLYLM.js} +8 -0
- package/dist/{chunk-OK622ILP.js → chunk-BGVT5I55.js} +1 -1
- package/dist/{chunk-WATAOG4Y.js → chunk-FD7IDL5V.js} +2 -2
- package/dist/{chunk-3KXEE7KH.js → chunk-GJWBVR4X.js} +3 -3
- package/dist/{chunk-KZUP6TIV.js → chunk-HAGYYPFR.js} +2 -2
- package/dist/{chunk-4SPMLGOG.js → chunk-J6LR22RZ.js} +9 -1
- package/dist/{chunk-4A3EHQJP.js → chunk-KWZDYOCB.js} +3 -3
- package/dist/{chunk-LSUMEIQ7.js → chunk-O4UYRQX7.js} +4 -4
- package/dist/{chunk-SWLDHEZI.js → chunk-ONPR2LAD.js} +561 -68
- package/dist/{chunk-6N2J7C2B.js → chunk-RBKUII3V.js} +1 -1
- package/dist/{chunk-ILCJ3WFD.js → chunk-SUWCBXZH.js} +1 -1
- package/dist/{chunk-ZJERBWTB.js → chunk-WPLCWAN3.js} +10 -4
- package/dist/data/index.js +4 -4
- package/dist/docx/index.js +3 -3
- package/dist/epub/index.js +1 -1
- package/dist/{extract-UTAOG7LV.js → extract-27YYYYBZ.js} +3 -3
- package/dist/html/index.js +1 -1
- package/dist/html/prepare.js +1 -1
- package/dist/index.js +14 -14
- package/dist/infer/index.js +4 -4
- package/dist/{layouts-2A7QNF6Y.js → layouts-5YNFCOMS.js} +2 -2
- package/dist/{materialize-ICXNO4S4.js → materialize-2MS3SXA6.js} +4 -4
- package/dist/ooxml/index.js +3 -3
- package/dist/outside-in/index.js +2 -2
- package/dist/pptx/index.js +4 -4
- package/dist/{readers-3P5A6A2A.js → readers-TAWBODNF.js} +3 -3
- package/dist/registry/index.js +1 -1
- package/dist/xlsx/index.js +4 -4
- 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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
-
|
|
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>`;
|
|
@@ -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,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseThemeXml,
|
|
3
3
|
readThemePart
|
|
4
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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)
|
|
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-
|
|
17
|
+
} from "./chunk-6QVOHRRL.js";
|
|
18
18
|
import {
|
|
19
19
|
createPackage
|
|
20
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
531
|
+
const { materializeDataReferences } = await import("./materialize-2MS3SXA6.js");
|
|
532
532
|
const warnings = [];
|
|
533
533
|
const markdownDoc = await materializeDataReferences(
|
|
534
534
|
await markdownOf(input),
|