@bendyline/squisq-formats 2.1.0 → 2.2.0

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 (195) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +20 -0
  3. package/README.md +1 -1
  4. package/dist/{chunk-NNHKUXKA.js → chunk-26ISNJ7Y.js} +85 -65
  5. package/dist/{chunk-NKAJPJ4G.js → chunk-2JJ5RFDZ.js} +0 -1
  6. package/dist/{chunk-WQSHGBLN.js → chunk-3NKXBZSR.js} +193 -42
  7. package/dist/{chunk-KURGXM4I.js → chunk-4V3KCHAP.js} +3 -4
  8. package/dist/{chunk-MLX2BOJC.js → chunk-6RQOV3B3.js} +1 -2
  9. package/dist/{chunk-EW54IRRS.js → chunk-6S6GU3ZG.js} +5 -6
  10. package/dist/{chunk-FE6OJV6O.js → chunk-7AWFHP5U.js} +1 -1
  11. package/dist/{chunk-RFAPOKHJ.js → chunk-AD2WT564.js} +59 -9
  12. package/dist/{chunk-O3GVVND4.js → chunk-AONELFLA.js} +0 -1
  13. package/dist/{chunk-SC67HYQJ.js → chunk-EJTNGKEA.js} +5 -8
  14. package/dist/chunk-GX7RAUME.js +121 -0
  15. package/dist/{chunk-SSUPBUF5.js → chunk-IIQYS2YH.js} +0 -1
  16. package/dist/{chunk-RLU7UFYU.js → chunk-IPN56VLW.js} +83 -58
  17. package/dist/{chunk-DTDF6QDP.js → chunk-JE6LSIHE.js} +81 -20
  18. package/dist/{chunk-U4MRIFKL.js → chunk-JU2RHXUB.js} +0 -1
  19. package/dist/{chunk-4VUWTSGM.js → chunk-K6XRMVPW.js} +64 -31
  20. package/dist/{chunk-ODL3SSPT.js → chunk-KXOZMWBS.js} +0 -1
  21. package/dist/chunk-OGS5VCGJ.js +446 -0
  22. package/dist/{chunk-GVS2XXV6.js → chunk-PJXJI2LY.js} +449 -57
  23. package/dist/{chunk-74GO3FVS.js → chunk-PU7REGWV.js} +5 -8
  24. package/dist/{chunk-PN52A5AA.js → chunk-SBUW7NHR.js} +0 -1
  25. package/dist/{chunk-QFLDYKCR.js → chunk-TAAENIRB.js} +5 -8
  26. package/dist/{chunk-7ARKUCQT.js → chunk-X2DEAXNK.js} +54 -2
  27. package/dist/container/index.js +1 -2
  28. package/dist/csv/index.d.ts +27 -2
  29. package/dist/csv/index.js +1 -2
  30. package/dist/docx/index.d.ts +5 -1
  31. package/dist/docx/index.js +9 -11
  32. package/dist/epub/index.d.ts +2 -0
  33. package/dist/epub/index.js +5 -6
  34. package/dist/{export-D2NkylDT.d.ts → export-D9msROJS.d.ts} +18 -6
  35. package/dist/extract-MN7LA3NL.js +13 -0
  36. package/dist/html/index.d.ts +11 -4
  37. package/dist/html/index.js +3 -4
  38. package/dist/images-ESPQKVTW.js +6 -0
  39. package/dist/{import-K8mfc0fz.d.ts → import-C3htUTss.d.ts} +5 -1
  40. package/dist/{import-DTkDxHmZ.d.ts → import-C8whCC7_.d.ts} +6 -0
  41. package/dist/index.d.ts +7 -7
  42. package/dist/index.js +28 -26
  43. package/dist/infer/index.d.ts +3 -3
  44. package/dist/infer/index.js +7 -9
  45. package/dist/{layouts-BHrgZ5FS.d.ts → layouts-CTdPlB-u.d.ts} +1 -1
  46. package/dist/layouts-DRWZGSPD.js +10 -0
  47. package/dist/{mapTheme-IR27S6IV.js → mapTheme-4TWH25FT.js} +1 -2
  48. package/dist/ooxml/index.d.ts +3 -3
  49. package/dist/ooxml/index.js +14 -13
  50. package/dist/pdf/index.d.ts +18 -0
  51. package/dist/pdf/index.js +2 -3
  52. package/dist/pptx/index.d.ts +4 -4
  53. package/dist/pptx/index.js +11 -13
  54. package/dist/{reader-B9L8Ucbj.d.ts → reader-B_m1aKZC.d.ts} +30 -1
  55. package/dist/registry/index.d.ts +21 -5
  56. package/dist/registry/index.js +9 -6
  57. package/dist/{themeReader-DJKErl_j.d.ts → themeReader-DCtwC83Q.d.ts} +1 -1
  58. package/dist/xlsx/index.d.ts +3 -3
  59. package/dist/xlsx/index.js +6 -7
  60. package/package.json +6 -3
  61. package/dist/chunk-4VUWTSGM.js.map +0 -1
  62. package/dist/chunk-6M7Z25LA.js +0 -46
  63. package/dist/chunk-6M7Z25LA.js.map +0 -1
  64. package/dist/chunk-74GO3FVS.js.map +0 -1
  65. package/dist/chunk-7ARKUCQT.js.map +0 -1
  66. package/dist/chunk-DTDF6QDP.js.map +0 -1
  67. package/dist/chunk-EW54IRRS.js.map +0 -1
  68. package/dist/chunk-FE6OJV6O.js.map +0 -1
  69. package/dist/chunk-GVS2XXV6.js.map +0 -1
  70. package/dist/chunk-KURGXM4I.js.map +0 -1
  71. package/dist/chunk-MLX2BOJC.js.map +0 -1
  72. package/dist/chunk-NKAJPJ4G.js.map +0 -1
  73. package/dist/chunk-NNHKUXKA.js.map +0 -1
  74. package/dist/chunk-O3GVVND4.js.map +0 -1
  75. package/dist/chunk-ODL3SSPT.js.map +0 -1
  76. package/dist/chunk-PN52A5AA.js.map +0 -1
  77. package/dist/chunk-QFLDYKCR.js.map +0 -1
  78. package/dist/chunk-RFAPOKHJ.js.map +0 -1
  79. package/dist/chunk-RLU7UFYU.js.map +0 -1
  80. package/dist/chunk-SC67HYQJ.js.map +0 -1
  81. package/dist/chunk-SSUPBUF5.js.map +0 -1
  82. package/dist/chunk-U4MRIFKL.js.map +0 -1
  83. package/dist/chunk-UGYF5AZE.js +0 -275
  84. package/dist/chunk-UGYF5AZE.js.map +0 -1
  85. package/dist/chunk-WQSHGBLN.js.map +0 -1
  86. package/dist/chunk-YRT7GQ5Y.js +0 -28
  87. package/dist/chunk-YRT7GQ5Y.js.map +0 -1
  88. package/dist/container/index.js.map +0 -1
  89. package/dist/csv/index.js.map +0 -1
  90. package/dist/docx/index.js.map +0 -1
  91. package/dist/epub/index.js.map +0 -1
  92. package/dist/extract-OJ7ZQV6P.js +0 -15
  93. package/dist/extract-OJ7ZQV6P.js.map +0 -1
  94. package/dist/html/index.js.map +0 -1
  95. package/dist/images-7FBWPKE3.js +0 -7
  96. package/dist/images-7FBWPKE3.js.map +0 -1
  97. package/dist/index.js.map +0 -1
  98. package/dist/infer/index.js.map +0 -1
  99. package/dist/layouts-5VDIRPIJ.js +0 -12
  100. package/dist/layouts-5VDIRPIJ.js.map +0 -1
  101. package/dist/mapTheme-IR27S6IV.js.map +0 -1
  102. package/dist/ooxml/index.js.map +0 -1
  103. package/dist/pdf/index.js.map +0 -1
  104. package/dist/pptx/index.js.map +0 -1
  105. package/dist/registry/index.js.map +0 -1
  106. package/dist/xlsx/index.js.map +0 -1
  107. package/src/__tests__/container.test.ts +0 -230
  108. package/src/__tests__/convert.test.ts +0 -495
  109. package/src/__tests__/csvImport.test.ts +0 -84
  110. package/src/__tests__/docxExport.test.ts +0 -491
  111. package/src/__tests__/docxImport.test.ts +0 -531
  112. package/src/__tests__/epub.test.ts +0 -649
  113. package/src/__tests__/exportThemeReconciliation.test.ts +0 -87
  114. package/src/__tests__/formatRegistry.test.ts +0 -174
  115. package/src/__tests__/html.test.ts +0 -439
  116. package/src/__tests__/htmlImport.test.ts +0 -57
  117. package/src/__tests__/inferTheme.test.ts +0 -135
  118. package/src/__tests__/lossyWarnings.test.ts +0 -146
  119. package/src/__tests__/ooxml.test.ts +0 -271
  120. package/src/__tests__/ooxmlCancellation.test.ts +0 -113
  121. package/src/__tests__/ooxmlThemeReader.test.ts +0 -92
  122. package/src/__tests__/pdfExport.test.ts +0 -322
  123. package/src/__tests__/pdfImport.test.ts +0 -384
  124. package/src/__tests__/plainHtml.test.ts +0 -417
  125. package/src/__tests__/plainHtmlBundle.test.ts +0 -253
  126. package/src/__tests__/pptxExport.test.ts +0 -138
  127. package/src/__tests__/pptxImport.test.ts +0 -145
  128. package/src/__tests__/pptxInferFixtures.ts +0 -314
  129. package/src/__tests__/pptxLayoutInfer.test.ts +0 -395
  130. package/src/__tests__/roundTrip.test.ts +0 -201
  131. package/src/__tests__/roundTripAssets.test.ts +0 -50
  132. package/src/__tests__/roundTripMatrix.fixtures.ts +0 -86
  133. package/src/__tests__/roundTripMatrix.helpers.ts +0 -154
  134. package/src/__tests__/roundTripMatrix.test.ts +0 -142
  135. package/src/__tests__/sharedContainer.test.ts +0 -41
  136. package/src/__tests__/sharedImages.test.ts +0 -61
  137. package/src/__tests__/xlsxExport.test.ts +0 -164
  138. package/src/__tests__/xlsxImport.test.ts +0 -80
  139. package/src/__tests__/zipSafety.test.ts +0 -317
  140. package/src/container/index.ts +0 -94
  141. package/src/csv/index.ts +0 -188
  142. package/src/docx/export.ts +0 -1375
  143. package/src/docx/import.ts +0 -1250
  144. package/src/docx/index.ts +0 -26
  145. package/src/docx/styles.ts +0 -145
  146. package/src/epub/export.ts +0 -968
  147. package/src/epub/index.ts +0 -20
  148. package/src/html/docsHtmlBundle.ts +0 -373
  149. package/src/html/htmlTemplate.ts +0 -385
  150. package/src/html/imageUtils.ts +0 -61
  151. package/src/html/import.ts +0 -297
  152. package/src/html/index.ts +0 -212
  153. package/src/html/plainHtml.ts +0 -790
  154. package/src/html/plainHtmlBundle.ts +0 -421
  155. package/src/index.ts +0 -109
  156. package/src/infer/extract.ts +0 -127
  157. package/src/infer/index.ts +0 -199
  158. package/src/infer/mapTheme.ts +0 -176
  159. package/src/infer/types.ts +0 -27
  160. package/src/ooxml/index.ts +0 -111
  161. package/src/ooxml/namespaces.ts +0 -217
  162. package/src/ooxml/readUtils.ts +0 -44
  163. package/src/ooxml/reader.ts +0 -318
  164. package/src/ooxml/themeReader.ts +0 -197
  165. package/src/ooxml/types.ts +0 -103
  166. package/src/ooxml/writer.ts +0 -339
  167. package/src/ooxml/xmlUtils.ts +0 -123
  168. package/src/pdf/export.ts +0 -1084
  169. package/src/pdf/import.ts +0 -1164
  170. package/src/pdf/index.ts +0 -29
  171. package/src/pdf/styles.ts +0 -180
  172. package/src/pptx/export.ts +0 -1184
  173. package/src/pptx/import.ts +0 -455
  174. package/src/pptx/index.ts +0 -52
  175. package/src/pptx/layouts.ts +0 -1222
  176. package/src/pptx/styles.ts +0 -96
  177. package/src/pptx/templates.ts +0 -187
  178. package/src/registry/convert.ts +0 -433
  179. package/src/registry/defaultFormats.ts +0 -413
  180. package/src/registry/errors.ts +0 -46
  181. package/src/registry/index.ts +0 -43
  182. package/src/registry/registry.ts +0 -48
  183. package/src/registry/types.ts +0 -170
  184. package/src/shared/boundedZipArchive.ts +0 -383
  185. package/src/shared/container.ts +0 -28
  186. package/src/shared/fidelity.ts +0 -130
  187. package/src/shared/images.ts +0 -44
  188. package/src/shared/inlineRuns.ts +0 -99
  189. package/src/shared/text.ts +0 -41
  190. package/src/shared/zipEntryCount.ts +0 -151
  191. package/src/shared/zipLimits.ts +0 -296
  192. package/src/shared/zipSafety.ts +0 -19
  193. package/src/xlsx/export.ts +0 -253
  194. package/src/xlsx/import.ts +0 -160
  195. package/src/xlsx/index.ts +0 -35
@@ -1,19 +1,17 @@
1
1
  import {
2
2
  parseThemeXml,
3
3
  readThemePart
4
- } from "./chunk-SC67HYQJ.js";
5
- import {
6
- findRelByType,
7
- resolveTarget
8
- } from "./chunk-YRT7GQ5Y.js";
4
+ } from "./chunk-EJTNGKEA.js";
9
5
  import {
10
6
  CONTENT_TYPE_PPTX_THEME,
11
7
  NS_PML,
12
8
  NS_WML,
13
9
  REL_SLIDE_MASTER,
10
+ findRelByType,
14
11
  getPartRelationships,
15
- getPartXml
16
- } from "./chunk-7ARKUCQT.js";
12
+ getPartXml,
13
+ resolveTarget
14
+ } from "./chunk-X2DEAXNK.js";
17
15
 
18
16
  // src/infer/extract.ts
19
17
  var DEFAULT_COLOR_MAP = { bg1: "lt1", tx1: "dk1" };
@@ -96,4 +94,3 @@ export {
96
94
  extractPptxTheme,
97
95
  extractXlsxTheme
98
96
  };
99
- //# sourceMappingURL=chunk-74GO3FVS.js.map
@@ -29,4 +29,3 @@ export {
29
29
  stripHtmlTags,
30
30
  extractPlainText
31
31
  };
32
- //# sourceMappingURL=chunk-PN52A5AA.js.map
@@ -1,9 +1,3 @@
1
- import {
2
- attrNS,
3
- baseDirOf,
4
- findRelByType,
5
- resolveTarget
6
- } from "./chunk-YRT7GQ5Y.js";
7
1
  import {
8
2
  CONTENT_TYPE_PPTX_SLIDE_LAYOUT,
9
3
  NS_DRAWINGML,
@@ -11,11 +5,15 @@ import {
11
5
  NS_R,
12
6
  REL_SLIDE_LAYOUT,
13
7
  REL_SLIDE_MASTER,
8
+ attrNS,
9
+ baseDirOf,
10
+ findRelByType,
14
11
  getPartRelationships,
15
12
  getPartXml,
16
13
  openPackage,
14
+ resolveTarget,
17
15
  throwIfOoxmlAborted
18
- } from "./chunk-7ARKUCQT.js";
16
+ } from "./chunk-X2DEAXNK.js";
19
17
 
20
18
  // src/pptx/layouts.ts
21
19
  var DEFAULT_SLIDE_SIZE = { cx: 12192e3, cy: 6858e3 };
@@ -775,4 +773,3 @@ export {
775
773
  analyzePptxLayouts,
776
774
  inspectPptxLayouts
777
775
  };
778
- //# sourceMappingURL=chunk-QFLDYKCR.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  openBoundedZipArchive
3
- } from "./chunk-FE6OJV6O.js";
3
+ } from "./chunk-7AWFHP5U.js";
4
4
 
5
5
  // src/ooxml/namespaces.ts
6
6
  var NS_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
@@ -54,6 +54,27 @@ var CONTENT_TYPE_XLSX_WORKSHEET = "application/vnd.openxmlformats-officedocument
54
54
  var CONTENT_TYPE_XLSX_STYLES = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml";
55
55
  var REL_WORKSHEET = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
56
56
 
57
+ // src/ooxml/readUtils.ts
58
+ function attrNS(el, ns, local, qualified) {
59
+ return el.getAttributeNS(ns, local) ?? el.getAttribute(qualified);
60
+ }
61
+ function baseDirOf(path) {
62
+ const slash = path.lastIndexOf("/");
63
+ return slash === -1 ? "" : path.slice(0, slash);
64
+ }
65
+ function resolveTarget(baseDir, target) {
66
+ if (target.startsWith("/")) return target.replace(/^\//, "");
67
+ const stack = baseDir ? baseDir.split("/") : [];
68
+ for (const seg of target.split("/")) {
69
+ if (seg === "..") stack.pop();
70
+ else if (seg !== ".") stack.push(seg);
71
+ }
72
+ return stack.join("/");
73
+ }
74
+ function findRelByType(rels, type) {
75
+ return rels.find((r) => r.type === type);
76
+ }
77
+
57
78
  // src/ooxml/reader.ts
58
79
  import { DOMParser as XmldomDOMParser } from "@xmldom/xmldom";
59
80
  var packageArchives = /* @__PURE__ */ new WeakMap();
@@ -99,6 +120,32 @@ async function openPackage(data, limits = {}) {
99
120
  if (limits.signal) packageSignals.set(pkg, limits.signal);
100
121
  return pkg;
101
122
  }
123
+ function hasPackagePart(pkg, path) {
124
+ const archive = packageArchives.get(pkg);
125
+ if (!archive) {
126
+ throw new TypeError("Invalid OoxmlPackage: create packages with openPackage().");
127
+ }
128
+ return archive.entries.some((entry) => entry.path === path);
129
+ }
130
+ function resolveMainPartPath(pkg, conventionalPath) {
131
+ const rel = pkg.rootRelationships.find(
132
+ (r) => r.type === REL_OFFICE_DOCUMENT && r.targetMode !== "External"
133
+ );
134
+ if (rel) {
135
+ const resolved = resolveTarget("", rel.target);
136
+ if (resolved && hasPackagePart(pkg, resolved)) return resolved;
137
+ }
138
+ return hasPackagePart(pkg, conventionalPath) ? conventionalPath : null;
139
+ }
140
+ function requireMainPartPath(pkg, conventionalPath, formatLabel) {
141
+ const path = resolveMainPartPath(pkg, conventionalPath);
142
+ if (!path) {
143
+ throw new Error(
144
+ `Invalid ${formatLabel} package: no main document part found. Expected the root officeDocument relationship to target an existing part, or "${conventionalPath}" to exist.`
145
+ );
146
+ }
147
+ return path;
148
+ }
102
149
  async function parseContentTypes(archive, signal) {
103
150
  const overrides = /* @__PURE__ */ new Map();
104
151
  const defaults = /* @__PURE__ */ new Map();
@@ -264,11 +311,16 @@ export {
264
311
  CONTENT_TYPE_XLSX_WORKSHEET,
265
312
  CONTENT_TYPE_XLSX_STYLES,
266
313
  REL_WORKSHEET,
314
+ attrNS,
315
+ baseDirOf,
316
+ resolveTarget,
317
+ findRelByType,
267
318
  throwIfOoxmlAborted,
268
319
  openPackage,
320
+ resolveMainPartPath,
321
+ requireMainPartPath,
269
322
  getPartRelationships,
270
323
  getPartXml,
271
324
  getPartBinary,
272
325
  getCoreProperties
273
326
  };
274
- //# sourceMappingURL=chunk-7ARKUCQT.js.map
@@ -2,7 +2,7 @@ import {
2
2
  ZipSafetyError,
3
3
  assertSafeZipPath,
4
4
  openBoundedZipArchive
5
- } from "../chunk-FE6OJV6O.js";
5
+ } from "../chunk-7AWFHP5U.js";
6
6
 
7
7
  // src/container/index.ts
8
8
  import JSZip from "jszip";
@@ -43,4 +43,3 @@ export {
43
43
  containerToZip,
44
44
  zipToContainer
45
45
  };
46
- //# sourceMappingURL=index.js.map
@@ -20,19 +20,44 @@ interface CsvImportOptions {
20
20
  delimiter?: string;
21
21
  /** Treat the first row as a header row. Default true. */
22
22
  hasHeader?: boolean;
23
+ /** Maximum parsed cells. Default: 100,000. */
24
+ maxCells?: number;
25
+ /** Maximum rows. Default: 10,000. */
26
+ maxRows?: number;
27
+ /** Maximum characters in one field. Default: 1 MiB. */
28
+ maxFieldChars?: number;
29
+ /** Cancel during parsing checkpoints. */
30
+ signal?: AbortSignal;
23
31
  }
24
32
  interface CsvExportOptions {
25
33
  /** Field delimiter. Default `,`. */
26
34
  delimiter?: string;
35
+ /**
36
+ * How to handle values that spreadsheet applications may execute as
37
+ * formulas. The safe default, `escape`, prefixes a leading apostrophe when
38
+ * the first non-space character is `=`, `+`, `-`, or `@`. Use `preserve`
39
+ * only when the CSV will not be opened by a spreadsheet application.
40
+ */
41
+ formulaHandling?: 'escape' | 'preserve';
27
42
  /**
28
43
  * Zero-based index of the table to export when the document contains more
29
44
  * than one. Default 0 (the first table). An explicitly provided index that
30
45
  * doesn't match a table in the document is an error.
31
46
  */
32
47
  tableIndex?: number;
48
+ /** Maximum cells emitted. Default: 100,000. */
49
+ maxCells?: number;
50
+ /** Cancel during export checkpoints. */
51
+ signal?: AbortSignal;
52
+ }
53
+ interface CsvSafetyLimits {
54
+ maxCells?: number;
55
+ maxRows?: number;
56
+ maxFieldChars?: number;
57
+ signal?: AbortSignal;
33
58
  }
34
59
  /** Parse CSV text into a grid of string cells (RFC 4180: quotes, escaped quotes). */
35
- declare function parseCsv(text: string, delimiter?: string): string[][];
60
+ declare function parseCsv(text: string, delimiter?: string, limits?: CsvSafetyLimits): string[][];
36
61
  /** Convert CSV to a MarkdownDocument containing a single table. */
37
62
  declare function csvToMarkdownDoc(data: ArrayBuffer | Blob | string, options?: CsvImportOptions): Promise<MarkdownDocument>;
38
63
  /** Convert CSV to a squisq Doc. */
@@ -47,4 +72,4 @@ declare function csvToDoc(data: ArrayBuffer | Blob | string, options?: CsvImport
47
72
  */
48
73
  declare function markdownDocToCsv(doc: MarkdownDocument, options?: CsvExportOptions): string;
49
74
 
50
- export { type CsvExportOptions, type CsvImportOptions, csvToDoc, csvToMarkdownDoc, markdownDocToCsv, parseCsv };
75
+ export { type CsvExportOptions, type CsvImportOptions, type CsvSafetyLimits, csvToDoc, csvToMarkdownDoc, markdownDocToCsv, parseCsv };
package/dist/csv/index.js CHANGED
@@ -3,11 +3,10 @@ import {
3
3
  csvToMarkdownDoc,
4
4
  markdownDocToCsv,
5
5
  parseCsv
6
- } from "../chunk-RFAPOKHJ.js";
6
+ } from "../chunk-AD2WT564.js";
7
7
  export {
8
8
  csvToDoc,
9
9
  csvToMarkdownDoc,
10
10
  markdownDocToCsv,
11
11
  parseCsv
12
12
  };
13
- //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { ThemeRegistry, Doc } from '@bendyline/squisq/schemas';
2
2
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
3
- import { O as OoxmlOpenOptions } from '../reader-B9L8Ucbj.js';
3
+ import { O as OoxmlOpenOptions } from '../reader-B_m1aKZC.js';
4
4
  import { ContentContainer } from '@bendyline/squisq/storage';
5
5
  import '../zipLimits-BOKCB7qk.js';
6
6
 
@@ -27,6 +27,8 @@ import '../zipLimits-BOKCB7qk.js';
27
27
  * Options for DOCX export.
28
28
  */
29
29
  interface DocxExportOptions {
30
+ /** Cancel at bounded export checkpoints. */
31
+ signal?: AbortSignal;
30
32
  /** Document title (appears in core properties) */
31
33
  title?: string;
32
34
  /** Document author */
@@ -54,6 +56,8 @@ interface DocxExportOptions {
54
56
  data: ArrayBuffer | Uint8Array;
55
57
  contentType: string;
56
58
  }>;
59
+ /** Permit carefully validated relative hyperlink targets. Default: false. */
60
+ allowRelativeHyperlinks?: boolean;
57
61
  }
58
62
  /**
59
63
  * Convert a MarkdownDocument to a .docx Blob.
@@ -4,16 +4,15 @@ import {
4
4
  docxToDoc,
5
5
  docxToMarkdownDoc,
6
6
  markdownDocToDocx
7
- } from "../chunk-NNHKUXKA.js";
8
- import "../chunk-6M7Z25LA.js";
9
- import "../chunk-PN52A5AA.js";
10
- import "../chunk-YRT7GQ5Y.js";
11
- import "../chunk-KURGXM4I.js";
12
- import "../chunk-U4MRIFKL.js";
13
- import "../chunk-7ARKUCQT.js";
14
- import "../chunk-FE6OJV6O.js";
15
- import "../chunk-SSUPBUF5.js";
16
- import "../chunk-O3GVVND4.js";
7
+ } from "../chunk-26ISNJ7Y.js";
8
+ import "../chunk-GX7RAUME.js";
9
+ import "../chunk-SBUW7NHR.js";
10
+ import "../chunk-4V3KCHAP.js";
11
+ import "../chunk-JU2RHXUB.js";
12
+ import "../chunk-X2DEAXNK.js";
13
+ import "../chunk-7AWFHP5U.js";
14
+ import "../chunk-IIQYS2YH.js";
15
+ import "../chunk-AONELFLA.js";
17
16
  export {
18
17
  docToDocx,
19
18
  docxToContainer,
@@ -21,4 +20,3 @@ export {
21
20
  docxToMarkdownDoc,
22
21
  markdownDocToDocx
23
22
  };
24
- //# sourceMappingURL=index.js.map
@@ -25,6 +25,8 @@ import { MarkdownDocument } from '@bendyline/squisq/markdown';
25
25
  */
26
26
 
27
27
  interface EpubExportOptions {
28
+ /** Cancel at bounded export checkpoints. */
29
+ signal?: AbortSignal;
28
30
  /** Book title (default: 'Untitled') */
29
31
  title?: string;
30
32
  /** Author name */
@@ -1,13 +1,12 @@
1
1
  import {
2
2
  docToEpub,
3
3
  markdownDocToEpub
4
- } from "../chunk-4VUWTSGM.js";
5
- import "../chunk-PN52A5AA.js";
6
- import "../chunk-U4MRIFKL.js";
7
- import "../chunk-MLX2BOJC.js";
8
- import "../chunk-O3GVVND4.js";
4
+ } from "../chunk-K6XRMVPW.js";
5
+ import "../chunk-SBUW7NHR.js";
6
+ import "../chunk-JU2RHXUB.js";
7
+ import "../chunk-6RQOV3B3.js";
8
+ import "../chunk-AONELFLA.js";
9
9
  export {
10
10
  docToEpub,
11
11
  markdownDocToEpub
12
12
  };
13
- //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
2
- import { O as OoxmlOpenOptions } from './reader-B9L8Ucbj.js';
2
+ import { O as OoxmlOpenOptions } from './reader-B_m1aKZC.js';
3
3
  import { Doc } from '@bendyline/squisq/schemas';
4
4
 
5
5
  /**
@@ -27,11 +27,12 @@ declare function xlsxToMarkdownDoc(data: ArrayBuffer | Blob, options?: XlsxImpor
27
27
  * used to name the sheet. This mirrors the import side (`xlsxToMarkdownDoc`),
28
28
  * which turns each worksheet grid back into a markdown table.
29
29
  *
30
- * Cells are emitted as inline strings (`t="inlineStr"`) so no sharedStrings
31
- * part is needed, except values matching a plain-number pattern, which are
32
- * emitted as numeric cells. The package is assembled with the shared ooxml/
33
- * writer (auto-generates `[Content_Types].xml` + `_rels`), so only the
34
- * SpreadsheetML-specific parts (workbook, worksheets, styles) are written here.
30
+ * Cells are emitted as inline strings (`t="inlineStr"`) by default so no
31
+ * sharedStrings part is needed and identifier-like numbers remain lossless.
32
+ * Callers can explicitly opt into conservative numeric inference. The package
33
+ * is assembled with the shared ooxml/ writer (auto-generates
34
+ * `[Content_Types].xml` + `_rels`), so only the SpreadsheetML-specific parts
35
+ * (workbook, worksheets, styles) are written here.
35
36
  *
36
37
  * @example
37
38
  * ```ts
@@ -47,12 +48,23 @@ declare function xlsxToMarkdownDoc(data: ArrayBuffer | Blob, options?: XlsxImpor
47
48
  * Options for XLSX export.
48
49
  */
49
50
  interface XlsxExportOptions {
51
+ /** Cancel at bounded export checkpoints. */
52
+ signal?: AbortSignal;
53
+ /** Maximum cells emitted. Default: 100,000. */
54
+ maxCells?: number;
50
55
  /** Workbook title (written to core properties). */
51
56
  title?: string;
52
57
  /** Workbook author (written to core properties). */
53
58
  author?: string;
54
59
  /** Prefix used for auto-named sheets when no heading precedes a table. Default: "Sheet". */
55
60
  sheetNamePrefix?: string;
61
+ /**
62
+ * Emit canonical, Excel-safe number strings as numeric cells. Default false:
63
+ * Markdown tables have no column schema, so preserving authored text is the
64
+ * only lossless default. Leading-zero and >15-significant-digit values remain
65
+ * strings even when this option is enabled.
66
+ */
67
+ inferNumericCells?: boolean;
56
68
  }
57
69
  /**
58
70
  * Convert a MarkdownDocument to a .xlsx file (tables-only fidelity).
@@ -0,0 +1,13 @@
1
+ import {
2
+ extractDocxTheme,
3
+ extractPptxTheme,
4
+ extractXlsxTheme
5
+ } from "./chunk-PU7REGWV.js";
6
+ import "./chunk-EJTNGKEA.js";
7
+ import "./chunk-X2DEAXNK.js";
8
+ import "./chunk-7AWFHP5U.js";
9
+ export {
10
+ extractDocxTheme,
11
+ extractPptxTheme,
12
+ extractXlsxTheme
13
+ };
@@ -1,6 +1,6 @@
1
1
  import { Theme, ThemeRegistry, Doc } from '@bendyline/squisq/schemas';
2
- import { H as HtmlExportOptions } from '../import-DTkDxHmZ.js';
3
- export { a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from '../import-DTkDxHmZ.js';
2
+ import { H as HtmlExportOptions } from '../import-C8whCC7_.js';
3
+ export { a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from '../import-C8whCC7_.js';
4
4
  import { HtmlPolicy, MarkdownDocument } from '@bendyline/squisq/markdown';
5
5
 
6
6
  /**
@@ -100,10 +100,17 @@ interface PlainHtmlExportOptions {
100
100
  * inlining keeps the icons resolvable purely from same-origin
101
101
  * resources. Hosts typically gather this string by scraping
102
102
  * `document.styleSheets` for `@font-face` rules whose family starts
103
- * with `"Font Awesome"`. The CDN `<link>` is only emitted when this
104
- * option is not provided.
103
+ * with `"Font Awesome"`. A CDN `<link>` is emitted only when this option
104
+ * is absent and {@link externalResources} is explicitly `allow`.
105
105
  */
106
106
  iconsCss?: string;
107
+ /**
108
+ * Whether this exporter may add remote font/icon stylesheets. Defaults to
109
+ * `deny`, keeping the generated file self-contained. Authored links and
110
+ * images are unaffected; bundle exporters are responsible for inlining or
111
+ * rewriting those document resources.
112
+ */
113
+ externalResources?: 'deny' | 'allow';
107
114
  /**
108
115
  * Raw HTML policy. Defaults to `sanitize`, which removes unsafe tags,
109
116
  * event handlers, and executable URL schemes before emitting HTML.
@@ -9,13 +9,13 @@ import {
9
9
  markdownDocToPlainHtml,
10
10
  markdownDocsToHtmlBundle,
11
11
  markdownDocsToPlainHtmlBundle
12
- } from "../chunk-DTDF6QDP.js";
12
+ } from "../chunk-JE6LSIHE.js";
13
13
  import {
14
14
  arrayBufferToBase64DataUrl,
15
15
  extractFilename,
16
16
  inferMimeType
17
- } from "../chunk-MLX2BOJC.js";
18
- import "../chunk-O3GVVND4.js";
17
+ } from "../chunk-6RQOV3B3.js";
18
+ import "../chunk-AONELFLA.js";
19
19
  export {
20
20
  arrayBufferToBase64DataUrl,
21
21
  collectImagePaths,
@@ -31,4 +31,3 @@ export {
31
31
  markdownDocsToHtmlBundle,
32
32
  markdownDocsToPlainHtmlBundle
33
33
  };
34
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ import {
2
+ extToMime
3
+ } from "./chunk-AONELFLA.js";
4
+ export {
5
+ extToMime
6
+ };
@@ -1,6 +1,6 @@
1
1
  import { ThemeRegistry, Doc } from '@bendyline/squisq/schemas';
2
2
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
3
- import { O as OoxmlOpenOptions } from './reader-B9L8Ucbj.js';
3
+ import { O as OoxmlOpenOptions } from './reader-B_m1aKZC.js';
4
4
  import { ContentContainer } from '@bendyline/squisq/storage';
5
5
 
6
6
  /**
@@ -36,6 +36,8 @@ import { ContentContainer } from '@bendyline/squisq/storage';
36
36
  * Options for PPTX export.
37
37
  */
38
38
  interface PptxExportOptions {
39
+ /** Cancel at bounded export checkpoints. */
40
+ signal?: AbortSignal;
39
41
  /** Presentation title (appears in core properties) */
40
42
  title?: string;
41
43
  /** Presentation author */
@@ -67,6 +69,8 @@ interface PptxExportOptions {
67
69
  * showing `[Image: alt]` placeholders.
68
70
  */
69
71
  images?: Map<string, ArrayBuffer>;
72
+ /** Permit carefully validated relative hyperlink targets. Default: false. */
73
+ allowRelativeHyperlinks?: boolean;
70
74
  }
71
75
  /**
72
76
  * Convert a MarkdownDocument to a .pptx ArrayBuffer.
@@ -14,6 +14,8 @@ import { MarkdownDocument } from '@bendyline/squisq/markdown';
14
14
  */
15
15
 
16
16
  interface HtmlExportOptions {
17
+ /** Cancel before synchronous generation and during asset checkpoints. */
18
+ signal?: AbortSignal;
17
19
  /** The IIFE player bundle source code (from @bendyline/squisq-react/standalone-source) */
18
20
  playerScript: string;
19
21
  /**
@@ -67,6 +69,10 @@ declare function collectImagePaths(doc: Doc): Set<string>;
67
69
  */
68
70
 
69
71
  interface HtmlImportOptions {
72
+ /** Cancel before parsing. */
73
+ signal?: AbortSignal;
74
+ /** Maximum HTML source characters. Default: 16 MiB. */
75
+ maxInputChars?: number;
70
76
  /**
71
77
  * Strip scripts / styles / event handlers / dangerous URLs before walking
72
78
  * the tree. Default `true` — HTML email is untrusted; only disable for
package/dist/index.d.ts CHANGED
@@ -6,16 +6,16 @@ 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 { BUILTIN_FORMAT_IDS, BuiltinFormatOptions, ConversionError, ConversionErrorCode, ConversionErrorOptions, ConversionResult, ConvertOptions, ConvertSource, DbkFormatOptions, FormatDefinition, FormatId, FormatRegistry, MarkdownFormatOptions, NormalizedInput, PreparedConversion, PreparedExportOptions, convert, createRegistry, defaultFormats, defaultRegistry, prepareConversion } from './registry/index.js';
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
- export { H as HtmlExportOptions, a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from './import-DTkDxHmZ.js';
12
- export { P as PptxExportOptions, a as PptxImportOptions, d as docToPptx, m as markdownDocToPptx, p as pptxToMarkdownDoc } from './import-K8mfc0fz.js';
13
- export { X as XlsxExportOptions, a as XlsxImportOptions, d as docToXlsx, m as markdownDocToXlsx, x as xlsxToMarkdownDoc } from './export-D2NkylDT.js';
11
+ export { H as HtmlExportOptions, a as HtmlImportOptions, c as collectImagePaths, h as htmlToMarkdown, b as htmlToMarkdownDoc, d as htmlToMarkdownDocSync } from './import-C8whCC7_.js';
12
+ export { P as PptxExportOptions, a as PptxImportOptions, d as docToPptx, m as markdownDocToPptx, p as pptxToMarkdownDoc } from './import-C3htUTss.js';
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';
16
- import './reader-B9L8Ucbj.js';
16
+ import './reader-B_m1aKZC.js';
17
17
  import '@bendyline/squisq/storage';
18
- import './layouts-BHrgZ5FS.js';
19
- import './themeReader-DJKErl_j.js';
18
+ import './layouts-CTdPlB-u.js';
19
+ import './themeReader-DCtwC83Q.js';
20
20
  import '@bendyline/squisq/transform';
21
21
  import './container/index.js';
package/dist/index.js CHANGED
@@ -1,68 +1,69 @@
1
1
  import {
2
2
  docToEpub,
3
3
  markdownDocToEpub
4
- } from "./chunk-4VUWTSGM.js";
4
+ } from "./chunk-K6XRMVPW.js";
5
5
  import {
6
6
  BUILTIN_FORMAT_IDS,
7
+ DEFAULT_CONVERSION_LIMITS,
7
8
  convert,
8
9
  createRegistry,
9
10
  defaultFormats,
10
11
  defaultRegistry,
11
- prepareConversion
12
- } from "./chunk-WQSHGBLN.js";
12
+ prepareConversion,
13
+ resolveConversionLimits
14
+ } from "./chunk-3NKXBZSR.js";
13
15
  import {
14
16
  inferThemeFromFile
15
- } from "./chunk-EW54IRRS.js";
17
+ } from "./chunk-6S6GU3ZG.js";
16
18
  import {
17
19
  ConversionError
18
- } from "./chunk-ODL3SSPT.js";
19
- import "./chunk-74GO3FVS.js";
20
+ } from "./chunk-KXOZMWBS.js";
21
+ import "./chunk-PU7REGWV.js";
20
22
  import {
21
23
  compileExtractedTheme
22
- } from "./chunk-NKAJPJ4G.js";
24
+ } from "./chunk-2JJ5RFDZ.js";
23
25
  import {
24
26
  docToDocx,
25
27
  docxToDoc,
26
28
  docxToMarkdownDoc,
27
29
  markdownDocToDocx
28
- } from "./chunk-NNHKUXKA.js";
30
+ } from "./chunk-26ISNJ7Y.js";
29
31
  import {
30
32
  docToPptx,
31
33
  markdownDocToPptx,
32
34
  pptxToDoc,
33
35
  pptxToMarkdownDoc
34
- } from "./chunk-RLU7UFYU.js";
35
- import "./chunk-QFLDYKCR.js";
36
- import "./chunk-6M7Z25LA.js";
36
+ } from "./chunk-IPN56VLW.js";
37
+ import "./chunk-TAAENIRB.js";
38
+ import "./chunk-GX7RAUME.js";
37
39
  import {
38
40
  docToXlsx,
39
41
  markdownDocToXlsx,
40
42
  xlsxToDoc,
41
43
  xlsxToMarkdownDoc
42
- } from "./chunk-UGYF5AZE.js";
43
- import "./chunk-PN52A5AA.js";
44
+ } from "./chunk-OGS5VCGJ.js";
45
+ import "./chunk-SBUW7NHR.js";
44
46
  import {
45
47
  csvToDoc,
46
48
  csvToMarkdownDoc,
47
49
  markdownDocToCsv,
48
50
  parseCsv
49
- } from "./chunk-RFAPOKHJ.js";
50
- import "./chunk-SC67HYQJ.js";
51
- import "./chunk-YRT7GQ5Y.js";
52
- import "./chunk-KURGXM4I.js";
53
- import "./chunk-U4MRIFKL.js";
54
- import "./chunk-7ARKUCQT.js";
51
+ } from "./chunk-AD2WT564.js";
52
+ import "./chunk-EJTNGKEA.js";
53
+ import "./chunk-4V3KCHAP.js";
54
+ import "./chunk-JU2RHXUB.js";
55
+ import "./chunk-X2DEAXNK.js";
55
56
  import {
56
57
  ZipSafetyError
57
- } from "./chunk-FE6OJV6O.js";
58
+ } from "./chunk-7AWFHP5U.js";
58
59
  import {
59
60
  configurePdfWorker,
60
61
  docToPdf,
61
62
  markdownDocToPdf,
62
63
  pdfToDoc,
63
64
  pdfToMarkdownDoc
64
- } from "./chunk-GVS2XXV6.js";
65
- import "./chunk-SSUPBUF5.js";
65
+ } from "./chunk-PJXJI2LY.js";
66
+ import "./chunk-IIQYS2YH.js";
66
67
  import {
67
68
  collectImagePaths,
68
69
  docToHtml,
@@ -70,12 +71,13 @@ import {
70
71
  htmlToMarkdown,
71
72
  htmlToMarkdownDoc,
72
73
  htmlToMarkdownDocSync
73
- } from "./chunk-DTDF6QDP.js";
74
- import "./chunk-MLX2BOJC.js";
75
- import "./chunk-O3GVVND4.js";
74
+ } from "./chunk-JE6LSIHE.js";
75
+ import "./chunk-6RQOV3B3.js";
76
+ import "./chunk-AONELFLA.js";
76
77
  export {
77
78
  BUILTIN_FORMAT_IDS,
78
79
  ConversionError,
80
+ DEFAULT_CONVERSION_LIMITS,
79
81
  ZipSafetyError,
80
82
  collectImagePaths,
81
83
  compileExtractedTheme,
@@ -111,7 +113,7 @@ export {
111
113
  pptxToDoc,
112
114
  pptxToMarkdownDoc,
113
115
  prepareConversion,
116
+ resolveConversionLimits,
114
117
  xlsxToDoc,
115
118
  xlsxToMarkdownDoc
116
119
  };
117
- //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import { Theme, DeepPartial, CustomTemplateDefinition } from '@bendyline/squisq/schemas';
2
- import { a as OoxmlPackage, O as OoxmlOpenOptions } from '../reader-B9L8Ucbj.js';
3
- import { O as OoxmlColorScheme, a as OoxmlFontScheme } from '../themeReader-DJKErl_j.js';
4
- import { P as PptxColorHints } from '../layouts-BHrgZ5FS.js';
2
+ import { a as OoxmlPackage, O as OoxmlOpenOptions } from '../reader-B_m1aKZC.js';
3
+ import { O as OoxmlColorScheme, a as OoxmlFontScheme } from '../themeReader-DCtwC83Q.js';
4
+ import { P as PptxColorHints } from '../layouts-CTdPlB-u.js';
5
5
  import '../zipLimits-BOKCB7qk.js';
6
6
 
7
7
  /**