@bendyline/squisq-formats 2.6.11 → 2.6.13
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-ONG4DBRZ.js → chunk-2SUIARE4.js} +30 -4
- package/dist/{chunk-POO3PJFH.js → chunk-C7SPLITE.js} +12 -0
- package/dist/{chunk-XLJAHVWL.js → chunk-XG6KFCPM.js} +1 -1
- package/dist/{chunk-Q5RENHYS.js → chunk-ZULJFSA4.js} +6 -1
- package/dist/html/index.d.ts +2 -2
- package/dist/html/index.js +1 -1
- package/dist/{import-D59rxNTj.d.ts → import-D8y5SV0T.d.ts} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/outside-in/index.d.ts +2 -2
- package/dist/outside-in/index.js +2 -2
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.js +1 -1
- package/dist/{types-kgE_mzON.d.ts → types-Ba_aUHZJ.d.ts} +1 -1
- package/dist/xlsx/index.d.ts +2 -0
- package/dist/xlsx/index.js +1 -1
- package/package.json +2 -2
|
@@ -225,6 +225,7 @@ async function markdownOf(input) {
|
|
|
225
225
|
return docToMarkdown(input.doc);
|
|
226
226
|
}
|
|
227
227
|
var IMAGE_ASSET_RE = /\.(jpg|jpeg|png|gif|webp|svg|bmp|avif)$/i;
|
|
228
|
+
var MEDIA_ASSET_RE = /\.(mp3|wav|ogg|oga|opus|m4a|aac|flac|mp4|webm|ogv|mov)$/i;
|
|
228
229
|
var DATA_ASSET_RE = /\.(csv|tsv|xlsx|parquet)$/i;
|
|
229
230
|
async function collectContainerAssets(container, pattern, signal, flattenBasenames = true) {
|
|
230
231
|
const assets = /* @__PURE__ */ new Map();
|
|
@@ -490,10 +491,16 @@ function defaultFormats() {
|
|
|
490
491
|
},
|
|
491
492
|
async exportDoc(input, options) {
|
|
492
493
|
const { markdownDocToCsv } = await import("./csv/index.js");
|
|
493
|
-
const
|
|
494
|
+
const { materializeDataReferences } = await import("./materialize-G4WC5UG3.js");
|
|
495
|
+
const warnings = [];
|
|
496
|
+
const markdownDoc = await materializeDataReferences(
|
|
497
|
+
await markdownOf(input),
|
|
498
|
+
input.container,
|
|
499
|
+
(message) => warnings.push(message)
|
|
500
|
+
);
|
|
494
501
|
const raw = optionsFor(options, "csv");
|
|
495
502
|
const tableCount = markdownDoc.children.filter((n) => n.type === "table").length;
|
|
496
|
-
|
|
503
|
+
if (tableCount === 0) warnings.push("CSV export found no table to export.");
|
|
497
504
|
if (tableCount > 1 && raw.tableIndex === void 0) {
|
|
498
505
|
warnings.push(
|
|
499
506
|
`Document has ${tableCount} tables; CSV export emitted only the first. Use the csv converter's tableIndex option to select another.`
|
|
@@ -532,11 +539,18 @@ function defaultFormats() {
|
|
|
532
539
|
const playerScript = await requirePlayerScript(options, "html");
|
|
533
540
|
const { docToHtml } = await import("./html/index.js");
|
|
534
541
|
const containerImages = await collectContainerImages(input.container, options.signal);
|
|
535
|
-
const
|
|
542
|
+
const media = await collectContainerAssets(
|
|
543
|
+
input.container,
|
|
544
|
+
MEDIA_ASSET_RE,
|
|
545
|
+
options.signal,
|
|
546
|
+
false
|
|
547
|
+
);
|
|
548
|
+
const images = new Map([...containerImages, ...media, ...raw.images ?? /* @__PURE__ */ new Map()]);
|
|
536
549
|
const htmlText = docToHtml(input.doc, {
|
|
537
550
|
...raw,
|
|
538
551
|
playerScript,
|
|
539
552
|
images,
|
|
553
|
+
audio: new Map([...media, ...raw.audio ?? /* @__PURE__ */ new Map()]),
|
|
540
554
|
title: options.title ?? input.baseName,
|
|
541
555
|
mode: raw.mode ?? "static",
|
|
542
556
|
themeId: resolveThemeId(input, options),
|
|
@@ -560,17 +574,29 @@ function defaultFormats() {
|
|
|
560
574
|
const { docToHtmlZip } = await import("./html/index.js");
|
|
561
575
|
const raw = optionsFor(options, "htmlzip");
|
|
562
576
|
const containerImages = await collectContainerImages(input.container, options.signal);
|
|
577
|
+
const media = await collectContainerAssets(
|
|
578
|
+
input.container,
|
|
579
|
+
MEDIA_ASSET_RE,
|
|
580
|
+
options.signal,
|
|
581
|
+
false
|
|
582
|
+
);
|
|
563
583
|
const containerData = await collectContainerAssets(
|
|
564
584
|
input.container,
|
|
565
585
|
DATA_ASSET_RE,
|
|
566
586
|
options.signal,
|
|
567
587
|
false
|
|
568
588
|
);
|
|
569
|
-
const images = new Map([
|
|
589
|
+
const images = new Map([
|
|
590
|
+
...containerImages,
|
|
591
|
+
...containerData,
|
|
592
|
+
...media,
|
|
593
|
+
...raw.images ?? /* @__PURE__ */ new Map()
|
|
594
|
+
]);
|
|
570
595
|
const blob = await docToHtmlZip(input.doc, {
|
|
571
596
|
...raw,
|
|
572
597
|
playerScript,
|
|
573
598
|
images,
|
|
599
|
+
audio: new Map([...media, ...raw.audio ?? /* @__PURE__ */ new Map()]),
|
|
574
600
|
title: options.title ?? input.baseName,
|
|
575
601
|
mode: raw.mode ?? "static",
|
|
576
602
|
themeId: resolveThemeId(input, options),
|
|
@@ -157,9 +157,13 @@ function generateInlineHtml(doc, options) {
|
|
|
157
157
|
} = options;
|
|
158
158
|
doc = applyThemeSelection(doc, themeId, themeRegistry);
|
|
159
159
|
const { imageMap, imageAliases } = buildInlineImageMaps(images);
|
|
160
|
+
const { imageMap: audioMap, imageAliases: audioAliases } = buildInlineImageMaps(options.audio);
|
|
161
|
+
for (const [alias, original] of Object.entries(audioAliases))
|
|
162
|
+
audioMap[alias] = audioMap[original];
|
|
160
163
|
const docJson = escapeForScript(JSON.stringify(doc));
|
|
161
164
|
const imageMapJson = escapeForScript(JSON.stringify(imageMap));
|
|
162
165
|
const imageAliasJson = escapeForScript(JSON.stringify(imageAliases));
|
|
166
|
+
const audioMapJson = escapeForScript(JSON.stringify(audioMap));
|
|
163
167
|
return `<!DOCTYPE html>
|
|
164
168
|
<html lang="en">
|
|
165
169
|
<head>
|
|
@@ -192,6 +196,7 @@ ${mode === "static" ? "#squisq-root{display:block}" : ""}
|
|
|
192
196
|
SquisqPlayer.mount(document.getElementById("squisq-root"), doc, {
|
|
193
197
|
mode: ${JSON.stringify(mode)},
|
|
194
198
|
images: images,
|
|
199
|
+
audio: JSON.parse(${JSON.stringify(audioMapJson)}),
|
|
195
200
|
autoPlay: ${JSON.stringify(autoPlay)},${captionStyle ? `
|
|
196
201
|
captionStyle: ${JSON.stringify(captionStyle)},` : ""}${captionPosition ? `
|
|
197
202
|
captionPosition: ${JSON.stringify(captionPosition)},` : ""}
|
|
@@ -1798,8 +1803,15 @@ async function docToHtmlZip(doc, options) {
|
|
|
1798
1803
|
const usedAudioNames = /* @__PURE__ */ new Set();
|
|
1799
1804
|
for (const [segmentKey, buffer] of audio.entries()) {
|
|
1800
1805
|
if ((audioIndex++ & 63) === 0) options.signal?.throwIfAborted();
|
|
1806
|
+
if (imagePathMap[segmentKey] && images?.get(segmentKey) === buffer) {
|
|
1807
|
+
audioPathMap[segmentKey] = imagePathMap[segmentKey];
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1801
1810
|
const filename = extractFilename(segmentKey);
|
|
1802
1811
|
const named = filename.includes(".") ? filename : `${filename}.mp3`;
|
|
1812
|
+
for (const existing of Object.keys(zip.files)) {
|
|
1813
|
+
if (existing.startsWith("audio/")) usedAudioNames.add(existing.slice(6));
|
|
1814
|
+
}
|
|
1803
1815
|
const finalName = uniqueFilename(named, usedAudioNames);
|
|
1804
1816
|
usedAudioNames.add(finalName);
|
|
1805
1817
|
const zipPath = `audio/${finalName}`;
|
|
@@ -689,7 +689,12 @@ async function patchXlsxCellValues(bytes, patches, options = {}) {
|
|
|
689
689
|
refuseSharedMaster(cell, patch.sheet, normalizedRef);
|
|
690
690
|
writeCellFormula(part.doc, cell, patch.formula, patch.cachedValue);
|
|
691
691
|
} else {
|
|
692
|
-
|
|
692
|
+
if (patch.removeFormula) {
|
|
693
|
+
refuseSharedMaster(cell, patch.sheet, normalizedRef);
|
|
694
|
+
clearCellFormula(cell);
|
|
695
|
+
} else {
|
|
696
|
+
refuseFormulaCell(cell, patch.sheet, normalizedRef);
|
|
697
|
+
}
|
|
693
698
|
refuseDateStyled(cell, styles, patch.sheet, normalizedRef, patch.value ?? null);
|
|
694
699
|
writeCellValue(part.doc, cell, patch.value ?? null);
|
|
695
700
|
}
|
package/dist/html/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Theme, ThemeRegistry, Doc } from '@bendyline/squisq/schemas';
|
|
2
|
-
import { H as HtmlExportOptions } from '../import-
|
|
3
|
-
export { a as HtmlImportOptions, c as collectImagePaths, g as generateExternalHtml, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from '../import-
|
|
2
|
+
import { H as HtmlExportOptions } from '../import-D8y5SV0T.js';
|
|
3
|
+
export { a as HtmlImportOptions, c as collectImagePaths, g as generateExternalHtml, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from '../import-D8y5SV0T.js';
|
|
4
4
|
import { HtmlPolicy, MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/html/index.js
CHANGED
|
@@ -37,8 +37,8 @@ interface HtmlExportOptions {
|
|
|
37
37
|
images?: Map<string, ArrayBuffer>;
|
|
38
38
|
/**
|
|
39
39
|
* Map of audio segment identifiers to binary audio data.
|
|
40
|
-
* Keys should match
|
|
41
|
-
*
|
|
40
|
+
* Keys should match an audio segment's `name` or `src` field in the Doc.
|
|
41
|
+
* Embedded as data URIs in single HTML, or separate files in ZIP exports.
|
|
42
42
|
*/
|
|
43
43
|
audio?: Map<string, ArrayBuffer>;
|
|
44
44
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export { PdfExportOptions, PdfImportOptions, configurePdfWorker, docToPdf, markd
|
|
|
6
6
|
export { HtmlZipExportOptions, docToHtml, docToHtmlZip } from './html/index.js';
|
|
7
7
|
export { EpubExportOptions, docToEpub, markdownDocToEpub } from './epub/index.js';
|
|
8
8
|
export { ExtractedFileTheme, InferSourceFormat, InferThemeOptions, InferredFileTheme, compileExtractedTheme, inferThemeFromFile } from './infer/index.js';
|
|
9
|
-
export { B as BUILTIN_FORMAT_IDS, a as BuiltinFormatOptions, C as ConversionLimits, b as ConversionResult, c as ConvertOptions, d as ConvertSource, D as DEFAULT_CONVERSION_LIMITS, e as DbkFormatOptions, F as FormatDefinition, f as FormatId, g as FormatRegistry, M as MarkdownFormatOptions, N as NormalizedInput, P as PreparedConversion, h as PreparedExportOptions, r as resolveConversionLimits } from './types-
|
|
9
|
+
export { B as BUILTIN_FORMAT_IDS, a as BuiltinFormatOptions, C as ConversionLimits, b as ConversionResult, c as ConvertOptions, d as ConvertSource, D as DEFAULT_CONVERSION_LIMITS, e as DbkFormatOptions, F as FormatDefinition, f as FormatId, g as FormatRegistry, M as MarkdownFormatOptions, N as NormalizedInput, P as PreparedConversion, h as PreparedExportOptions, r as resolveConversionLimits } from './types-Ba_aUHZJ.js';
|
|
10
10
|
export { ConversionError, ConversionErrorCode, ConversionErrorOptions, convert, createRegistry, defaultFormats, defaultRegistry, prepareConversion } from './registry/index.js';
|
|
11
11
|
export { ImportedOutsideInDocument, OUTSIDE_IN_FORMAT_IDS, OUTSIDE_IN_UPDATE_FROM_MARKDOWN_KEY, OutsideInFormatId, OutsideInLayout, OutsideInMetadata, RenderOutsideInOptions, chooseOutsideInMarkdownPath, importOutsideInDocument, isOutsideInMarkdownEditingEnabled, isOutsideInTargetPath, readOutsideInMetadata, renderOutsideInDocument, resolveOutsideInLayout, withOutsideInMarkdownEditing, withOutsideInMetadata } from './outside-in/index.js';
|
|
12
12
|
export { Z as ZipSafetyError, a as ZipSafetyErrorCode, b as ZipSafetyErrorOptions, c as ZipSafetyLimits } from './zipLimits-BOKCB7qk.js';
|
|
13
|
-
export { H as HtmlExportOptions, a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from './import-
|
|
13
|
+
export { H as HtmlExportOptions, a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from './import-D8y5SV0T.js';
|
|
14
14
|
export { P as PptxExportOptions, a as PptxImportOptions, d as docToPptx, m as markdownDocToPptx, p as pptxToMarkdownDoc } from './import-C16E8Y4X.js';
|
|
15
15
|
export { X as XlsxExportOptions, a as XlsxImportOptions, b as XlsxTable, c as XlsxTableColumn, d as XlsxTablesOptions, e as docToXlsx, g as gridToTables, m as markdownDocToXlsx, x as xlsxToMarkdownDoc, f as xlsxToTables } from './export-C4bBD3Mx.js';
|
|
16
16
|
import '@bendyline/squisq/schemas';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
htmlToMarkdown,
|
|
6
6
|
htmlToMarkdownDoc,
|
|
7
7
|
htmlToMarkdownDocSync
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C7SPLITE.js";
|
|
9
9
|
import {
|
|
10
10
|
docToEpub,
|
|
11
11
|
markdownDocToEpub
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
resolveOutsideInLayout,
|
|
32
32
|
withOutsideInMarkdownEditing,
|
|
33
33
|
withOutsideInMetadata
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-XG6KFCPM.js";
|
|
35
35
|
import {
|
|
36
36
|
DEFAULT_CONVERSION_LIMITS,
|
|
37
37
|
convert,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
defaultRegistry,
|
|
41
41
|
prepareConversion,
|
|
42
42
|
resolveConversionLimits
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-2SUIARE4.js";
|
|
44
44
|
import {
|
|
45
45
|
ConversionError
|
|
46
46
|
} from "./chunk-KXOZMWBS.js";
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
docToXlsx,
|
|
66
66
|
markdownDocToXlsx,
|
|
67
67
|
xlsxToDoc
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-ZULJFSA4.js";
|
|
69
69
|
import "./chunk-AVOZAKGP.js";
|
|
70
70
|
import {
|
|
71
71
|
gridToTables,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
2
2
|
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
3
|
-
import { c as ConvertOptions, b as ConversionResult } from '../types-
|
|
3
|
+
import { c as ConvertOptions, b as ConversionResult } from '../types-Ba_aUHZJ.js';
|
|
4
4
|
import '@bendyline/squisq/schemas';
|
|
5
5
|
import '@bendyline/squisq/transform';
|
|
6
6
|
import '../docx/index.js';
|
|
@@ -10,7 +10,7 @@ import '../import-C16E8Y4X.js';
|
|
|
10
10
|
import '../export-C4bBD3Mx.js';
|
|
11
11
|
import '../csv/index.js';
|
|
12
12
|
import '../pdf/index.js';
|
|
13
|
-
import '../import-
|
|
13
|
+
import '../import-D8y5SV0T.js';
|
|
14
14
|
import '../epub/index.js';
|
|
15
15
|
import '../container/index.js';
|
|
16
16
|
|
package/dist/outside-in/index.js
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
resolveOutsideInLayout,
|
|
11
11
|
withOutsideInMarkdownEditing,
|
|
12
12
|
withOutsideInMetadata
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
} from "../chunk-XG6KFCPM.js";
|
|
14
|
+
import "../chunk-2SUIARE4.js";
|
|
15
15
|
import "../chunk-KXOZMWBS.js";
|
|
16
16
|
import "../chunk-7AWFHP5U.js";
|
|
17
17
|
export {
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as FormatId, g as FormatRegistry, F as FormatDefinition, d as ConvertSource, c as ConvertOptions, b as ConversionResult, P as PreparedConversion } from '../types-
|
|
2
|
-
export { B as BUILTIN_FORMAT_IDS, a as BuiltinFormatOptions, C as ConversionLimits, D as DEFAULT_CONVERSION_LIMITS, e as DbkFormatOptions, M as MarkdownFormatOptions, N as NormalizedInput, h as PreparedExportOptions, r as resolveConversionLimits } from '../types-
|
|
1
|
+
import { f as FormatId, g as FormatRegistry, F as FormatDefinition, d as ConvertSource, c as ConvertOptions, b as ConversionResult, P as PreparedConversion } from '../types-Ba_aUHZJ.js';
|
|
2
|
+
export { B as BUILTIN_FORMAT_IDS, a as BuiltinFormatOptions, C as ConversionLimits, D as DEFAULT_CONVERSION_LIMITS, e as DbkFormatOptions, M as MarkdownFormatOptions, N as NormalizedInput, h as PreparedExportOptions, r as resolveConversionLimits } from '../types-Ba_aUHZJ.js';
|
|
3
3
|
import '@bendyline/squisq/schemas';
|
|
4
4
|
import '@bendyline/squisq/transform';
|
|
5
5
|
import '@bendyline/squisq/markdown';
|
|
@@ -11,7 +11,7 @@ import '../import-C16E8Y4X.js';
|
|
|
11
11
|
import '../export-C4bBD3Mx.js';
|
|
12
12
|
import '../csv/index.js';
|
|
13
13
|
import '../pdf/index.js';
|
|
14
|
-
import '../import-
|
|
14
|
+
import '../import-D8y5SV0T.js';
|
|
15
15
|
import '../epub/index.js';
|
|
16
16
|
import '../container/index.js';
|
|
17
17
|
|
package/dist/registry/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { a as PptxImportOptions, P as PptxExportOptions } from './import-C16E8Y4
|
|
|
7
7
|
import { j as XlsxContainerOptions, X as XlsxExportOptions } from './export-C4bBD3Mx.js';
|
|
8
8
|
import { CsvContainerOptions, CsvExportOptions } from './csv/index.js';
|
|
9
9
|
import { PdfImportOptions, PdfExportOptions } from './pdf/index.js';
|
|
10
|
-
import { a as HtmlImportOptions, H as HtmlExportOptions } from './import-
|
|
10
|
+
import { a as HtmlImportOptions, H as HtmlExportOptions } from './import-D8y5SV0T.js';
|
|
11
11
|
import { EpubExportOptions } from './epub/index.js';
|
|
12
12
|
import { ContainerToZipOptions } from './container/index.js';
|
|
13
13
|
import { c as ZipSafetyLimits } from './zipLimits-BOKCB7qk.js';
|
package/dist/xlsx/index.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ interface XlsxCellPatch {
|
|
|
54
54
|
* Mutually exclusive with `formula`.
|
|
55
55
|
*/
|
|
56
56
|
value?: number | boolean | string | null;
|
|
57
|
+
/** Explicitly replace a formula with `value`; shared masters remain protected. */
|
|
58
|
+
removeFormula?: boolean;
|
|
57
59
|
/**
|
|
58
60
|
* New formula source WITHOUT the leading `=` — the grid's formula-editing
|
|
59
61
|
* save path. The cell's `<f>` is replaced (a shared-formula FOLLOWER's
|
package/dist/xlsx/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-formats",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.13",
|
|
4
4
|
"description": "Document format converters — DOCX, PDF, OOXML import/export",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"typecheck": "tsc --noEmit"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@bendyline/squisq": "2.11.
|
|
118
|
+
"@bendyline/squisq": "2.11.13",
|
|
119
119
|
"@pdf-lib/fontkit": "1.1.1",
|
|
120
120
|
"@pdf-lib/upng": "1.0.1",
|
|
121
121
|
"@xmldom/xmldom": "0.9.12",
|