@bendyline/squisq-formats 2.5.0 → 2.6.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.
- package/NOTICE.md +10 -9
- package/dist/{chunk-2LT3JL7U.js → chunk-3ITGQRL5.js} +8 -8
- package/dist/{chunk-FMQWNPCV.js → chunk-AGGNLRHV.js} +6 -6
- package/dist/{chunk-AONELFLA.js → chunk-B7GEAZBI.js} +6 -1
- package/dist/chunk-CKSTGNVZ.js +724 -0
- package/dist/chunk-DXYWKZ52.js +57 -0
- package/dist/{chunk-T4PX33AG.js → chunk-EEDQRZ2M.js} +17 -1
- package/dist/chunk-FLR2ARKC.js +240 -0
- package/dist/{chunk-JTGWQK5V.js → chunk-GRKQTQOF.js} +64 -12
- package/dist/{chunk-A6LSCIO5.js → chunk-OBADJV7C.js} +286 -420
- package/dist/{chunk-AD2WT564.js → chunk-Q77KNJIN.js} +45 -0
- package/dist/{chunk-5PUIFU5I.js → chunk-VDTGQ4MW.js} +1 -1
- package/dist/{chunk-6RQOV3B3.js → chunk-VPWPEMZJ.js} +1 -1
- package/dist/{chunk-FIOSE4BO.js → chunk-XJNOZTAY.js} +6 -6
- package/dist/csv/index.d.ts +67 -1
- package/dist/csv/index.js +10 -3
- package/dist/data/index.d.ts +78 -0
- package/dist/data/index.js +30 -0
- package/dist/docx/index.js +3 -3
- package/dist/epub/index.js +4 -4
- package/dist/export-6iQXd-lQ.d.ts +366 -0
- package/dist/html/index.d.ts +2 -8
- package/dist/html/index.js +3 -3
- package/dist/{images-ESPQKVTW.js → images-JLBFCDD4.js} +1 -1
- package/dist/{import-B0gBYUmd.d.ts → import-C7c9tQHK.d.ts} +5 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +33 -26
- package/dist/infer/index.js +6 -6
- package/dist/materialize-A34OZGEU.js +11 -0
- package/dist/outside-in/index.d.ts +3 -3
- package/dist/outside-in/index.js +2 -2
- package/dist/pdf/index.js +2 -2
- package/dist/pptx/index.js +3 -3
- package/dist/registry/index.d.ts +4 -4
- package/dist/registry/index.js +1 -1
- package/dist/{types-DByrrXeB.d.ts → types-Dzd_5H2A.d.ts} +5 -5
- package/dist/xlsx/index.d.ts +85 -4
- package/dist/xlsx/index.js +25 -4
- package/package.json +18 -3
- package/dist/export-m0tr9r9d.d.ts +0 -130
- package/dist/{chunk-KMBBO5H7.js → chunk-7DQP2I57.js} +4 -4
- package/dist/{chunk-M7XPXGXW.js → chunk-ROF7SSQP.js} +3 -3
package/dist/pptx/index.js
CHANGED
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
pptxToContainer,
|
|
5
5
|
pptxToDoc,
|
|
6
6
|
pptxToMarkdownDoc
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-AGGNLRHV.js";
|
|
8
8
|
import {
|
|
9
9
|
analyzePptxLayouts,
|
|
10
10
|
inspectPptxLayouts
|
|
11
11
|
} from "../chunk-6N2J7C2B.js";
|
|
12
|
+
import "../chunk-VPWPEMZJ.js";
|
|
12
13
|
import "../chunk-A6N6IN3I.js";
|
|
14
|
+
import "../chunk-B7GEAZBI.js";
|
|
13
15
|
import "../chunk-AVOZAKGP.js";
|
|
14
16
|
import "../chunk-ILCJ3WFD.js";
|
|
15
17
|
import "../chunk-JU2RHXUB.js";
|
|
@@ -17,8 +19,6 @@ import "../chunk-S5PCVMKU.js";
|
|
|
17
19
|
import "../chunk-7AWFHP5U.js";
|
|
18
20
|
import "../chunk-IIQYS2YH.js";
|
|
19
21
|
import "../chunk-USU6HTKB.js";
|
|
20
|
-
import "../chunk-6RQOV3B3.js";
|
|
21
|
-
import "../chunk-AONELFLA.js";
|
|
22
22
|
export {
|
|
23
23
|
analyzePptxLayouts,
|
|
24
24
|
docToPptx,
|
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-Dzd_5H2A.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-Dzd_5H2A.js';
|
|
3
3
|
import '@bendyline/squisq/schemas';
|
|
4
4
|
import '@bendyline/squisq/transform';
|
|
5
5
|
import '@bendyline/squisq/markdown';
|
|
@@ -8,10 +8,10 @@ import '../docx/index.js';
|
|
|
8
8
|
import '../reader-B_m1aKZC.js';
|
|
9
9
|
import '../zipLimits-BOKCB7qk.js';
|
|
10
10
|
import '../import-C16E8Y4X.js';
|
|
11
|
-
import '../export-
|
|
11
|
+
import '../export-6iQXd-lQ.js';
|
|
12
12
|
import '../csv/index.js';
|
|
13
13
|
import '../pdf/index.js';
|
|
14
|
-
import '../import-
|
|
14
|
+
import '../import-C7c9tQHK.js';
|
|
15
15
|
import '../epub/index.js';
|
|
16
16
|
import '../container/index.js';
|
|
17
17
|
|
package/dist/registry/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import { ParseOptions, StringifyOptions, MarkdownDocument } from '@bendyline/squ
|
|
|
4
4
|
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
5
5
|
import { DocxImportOptions, DocxExportOptions } from './docx/index.js';
|
|
6
6
|
import { a as PptxImportOptions, P as PptxExportOptions } from './import-C16E8Y4X.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { j as XlsxContainerOptions, X as XlsxExportOptions } from './export-6iQXd-lQ.js';
|
|
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-C7c9tQHK.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';
|
|
@@ -67,8 +67,8 @@ interface BuiltinFormatOptions {
|
|
|
67
67
|
md: MarkdownFormatOptions;
|
|
68
68
|
docx: DocxImportOptions & DocxExportOptions;
|
|
69
69
|
pptx: PptxImportOptions & PptxExportOptions;
|
|
70
|
-
xlsx:
|
|
71
|
-
csv:
|
|
70
|
+
xlsx: XlsxContainerOptions & XlsxExportOptions;
|
|
71
|
+
csv: CsvContainerOptions & CsvExportOptions;
|
|
72
72
|
pdf: PdfImportOptions & PdfExportOptions;
|
|
73
73
|
html: HtmlImportOptions & Partial<Omit<HtmlExportOptions, 'playerScript'>>;
|
|
74
74
|
htmlzip: Partial<Omit<HtmlExportOptions, 'playerScript'>>;
|
package/dist/xlsx/index.d.ts
CHANGED
|
@@ -1,10 +1,91 @@
|
|
|
1
1
|
import { Doc } from '@bendyline/squisq/schemas';
|
|
2
|
-
import { a as XlsxImportOptions } from '../export-
|
|
3
|
-
export { X as XlsxExportOptions, d as docToXlsx, m as markdownDocToXlsx, x as xlsxToMarkdownDoc } from '../export-
|
|
2
|
+
import { a as XlsxImportOptions } from '../export-6iQXd-lQ.js';
|
|
3
|
+
export { C as CellRect, S as SheetRef, h as XlsxCell, i as XlsxCellKind, j as XlsxContainerOptions, X as XlsxExportOptions, k as XlsxSheetGrid, b as XlsxTable, c as XlsxTableColumn, d as XlsxTablesOptions, l as XlsxWorkbookGrids, e as docToXlsx, n as formatCellRef, g as gridToTables, o as listSheetParts, m as markdownDocToXlsx, p as parseCellRef, q as xlsxToCellGrids, r as xlsxToContainer, x as xlsxToMarkdownDoc, f as xlsxToTables } from '../export-6iQXd-lQ.js';
|
|
4
|
+
import { O as OoxmlOpenOptions } from '../reader-B_m1aKZC.js';
|
|
4
5
|
import '@bendyline/squisq/markdown';
|
|
5
|
-
import '
|
|
6
|
+
import '@bendyline/squisq/storage';
|
|
6
7
|
import '../zipLimits-BOKCB7qk.js';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* XLSX in-place cell-value patching — the grid's XLSX save path.
|
|
11
|
+
*
|
|
12
|
+
* `patchXlsxCellValues(bytes, patches)` rewrites ONLY the worksheet parts a
|
|
13
|
+
* patch touches (plus `xl/workbook.xml` for the calc flag) and copies every
|
|
14
|
+
* other archive member through untouched, so charts, pivot caches, styles,
|
|
15
|
+
* macros and anything else this library does not model survive a save
|
|
16
|
+
* byte-for-byte (uncompressed content — the archive itself is re-deflated).
|
|
17
|
+
*
|
|
18
|
+
* All-or-nothing: any per-cell refusal throws `XlsxPatchRefusal` BEFORE any
|
|
19
|
+
* output is produced. Refusals, and their whys:
|
|
20
|
+
* - `sheet-missing` / `cell-ref-invalid` — the patch addresses nothing.
|
|
21
|
+
* - `formula-cell` — overwriting `<v>` under an `<f>` silently desyncs the
|
|
22
|
+
* cached value from the formula; deleting the `<f>` destroys authored
|
|
23
|
+
* logic. Formula editing arrives with the calculation engine (Phase 3).
|
|
24
|
+
* - `shared-formula-follower` — worse: the cell LOOKS empty (`<f t="shared"
|
|
25
|
+
* si="…"/>` with no text) but is the fill-down continuation of a master
|
|
26
|
+
* formula; distinguished from `formula-cell` so a UI can explain it.
|
|
27
|
+
* - `date-value-unsupported` — a date-styled cell stores a serial number
|
|
28
|
+
* whose meaning depends on the workbook epoch and format code; writing a
|
|
29
|
+
* naive number or string produces a silently wrong date. Clearing
|
|
30
|
+
* (value `null`) is allowed — it keeps the style.
|
|
31
|
+
*
|
|
32
|
+
* Values write the way Excel does: number → `<v>` with no `t`; boolean →
|
|
33
|
+
* `t="b"`; string → `t="inlineStr"` (a shared-string cell is switched to
|
|
34
|
+
* inlineStr — orphaned sst entries are legal per ECMA-376); `null` clears
|
|
35
|
+
* content but keeps the cell and its style. After a successful patch the
|
|
36
|
+
* workbook's `<calcPr fullCalcOnLoad="1"/>` is set (inserted in CT_Workbook
|
|
37
|
+
* sequence position when absent) so Excel recomputes every formula on open
|
|
38
|
+
* instead of trusting caches that may reference patched inputs.
|
|
39
|
+
*
|
|
40
|
+
* XML is parsed AND serialized with the package-owned xmldom in every
|
|
41
|
+
* environment — browser DOMParser/XMLSerializer output differs across
|
|
42
|
+
* engines, and a deterministic writer is what makes the untouched-member and
|
|
43
|
+
* zero-patch guardrail tests meaningful. The XML declaration is re-prefixed
|
|
44
|
+
* from the original bytes (a serializer never reproduces it verbatim).
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
interface XlsxCellPatch {
|
|
48
|
+
/** Sheet name, exactly as the workbook lists it. */
|
|
49
|
+
sheet: string;
|
|
50
|
+
/** A1-style cell reference (e.g. `B4`). */
|
|
51
|
+
ref: string;
|
|
52
|
+
/**
|
|
53
|
+
* New cell value; `null` clears the cell's content, keeping its style.
|
|
54
|
+
* Mutually exclusive with `formula`.
|
|
55
|
+
*/
|
|
56
|
+
value?: number | boolean | string | null;
|
|
57
|
+
/**
|
|
58
|
+
* New formula source WITHOUT the leading `=` — the grid's formula-editing
|
|
59
|
+
* save path. The cell's `<f>` is replaced (a shared-formula FOLLOWER's
|
|
60
|
+
* membership is self-contained, so overwriting it simply removes that
|
|
61
|
+
* cell from the group; a shared MASTER is refused — its followers'
|
|
62
|
+
* `si` would dangle). Pair with `cachedValue` so viewers that don't
|
|
63
|
+
* recalculate still show the engine's result; `fullCalcOnLoad` makes
|
|
64
|
+
* Excel recompute regardless.
|
|
65
|
+
*/
|
|
66
|
+
formula?: string;
|
|
67
|
+
/** Engine-computed result stored beside `formula` as the cached `<v>`. */
|
|
68
|
+
cachedValue?: number | boolean | string;
|
|
69
|
+
}
|
|
70
|
+
type XlsxPatchRefusalCode = 'sheet-missing' | 'cell-ref-invalid' | 'formula-cell' | 'shared-formula-follower' | 'shared-formula-master' | 'date-value-unsupported' | 'number-not-finite' | 'patch-invalid';
|
|
71
|
+
/** A per-cell condition that makes the whole patch refuse (all-or-nothing). */
|
|
72
|
+
declare class XlsxPatchRefusal extends Error {
|
|
73
|
+
readonly code: XlsxPatchRefusalCode;
|
|
74
|
+
readonly sheet: string;
|
|
75
|
+
readonly ref: string;
|
|
76
|
+
constructor(code: XlsxPatchRefusalCode, sheet: string, ref: string, message: string);
|
|
77
|
+
}
|
|
78
|
+
type XlsxPatchOptions = OoxmlOpenOptions;
|
|
79
|
+
/**
|
|
80
|
+
* Apply cell-value patches to an XLSX file in place.
|
|
81
|
+
*
|
|
82
|
+
* @param bytes - The original workbook bytes.
|
|
83
|
+
* @param patches - Cell writes; all applied, or none (`XlsxPatchRefusal`).
|
|
84
|
+
* @param options - Zip safety limits (same contract as import).
|
|
85
|
+
* @returns The patched workbook as a new ArrayBuffer.
|
|
86
|
+
*/
|
|
87
|
+
declare function patchXlsxCellValues(bytes: ArrayBuffer, patches: readonly XlsxCellPatch[], options?: XlsxPatchOptions): Promise<ArrayBuffer>;
|
|
88
|
+
|
|
8
89
|
/**
|
|
9
90
|
* @bendyline/squisq-formats XLSX Module
|
|
10
91
|
*
|
|
@@ -26,4 +107,4 @@ import '../zipLimits-BOKCB7qk.js';
|
|
|
26
107
|
*/
|
|
27
108
|
declare function xlsxToDoc(data: ArrayBuffer | Blob, options?: XlsxImportOptions): Promise<Doc>;
|
|
28
109
|
|
|
29
|
-
export { XlsxImportOptions, xlsxToDoc };
|
|
110
|
+
export { type XlsxCellPatch, XlsxImportOptions, type XlsxPatchOptions, XlsxPatchRefusal, type XlsxPatchRefusalCode, patchXlsxCellValues, xlsxToDoc };
|
package/dist/xlsx/index.js
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
|
+
XlsxPatchRefusal,
|
|
2
3
|
docToXlsx,
|
|
3
4
|
markdownDocToXlsx,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../chunk-
|
|
5
|
+
patchXlsxCellValues,
|
|
6
|
+
xlsxToDoc
|
|
7
|
+
} from "../chunk-CKSTGNVZ.js";
|
|
7
8
|
import "../chunk-AVOZAKGP.js";
|
|
9
|
+
import {
|
|
10
|
+
formatCellRef,
|
|
11
|
+
gridToTables,
|
|
12
|
+
listSheetParts,
|
|
13
|
+
parseCellRef,
|
|
14
|
+
xlsxToCellGrids,
|
|
15
|
+
xlsxToContainer,
|
|
16
|
+
xlsxToMarkdownDoc,
|
|
17
|
+
xlsxToTables
|
|
18
|
+
} from "../chunk-OBADJV7C.js";
|
|
19
|
+
import "../chunk-DXYWKZ52.js";
|
|
8
20
|
import "../chunk-ILCJ3WFD.js";
|
|
9
21
|
import "../chunk-JU2RHXUB.js";
|
|
10
22
|
import "../chunk-S5PCVMKU.js";
|
|
11
23
|
import "../chunk-7AWFHP5U.js";
|
|
12
24
|
export {
|
|
25
|
+
XlsxPatchRefusal,
|
|
13
26
|
docToXlsx,
|
|
27
|
+
formatCellRef,
|
|
28
|
+
gridToTables,
|
|
29
|
+
listSheetParts,
|
|
14
30
|
markdownDocToXlsx,
|
|
31
|
+
parseCellRef,
|
|
32
|
+
patchXlsxCellValues,
|
|
33
|
+
xlsxToCellGrids,
|
|
34
|
+
xlsxToContainer,
|
|
15
35
|
xlsxToDoc,
|
|
16
|
-
xlsxToMarkdownDoc
|
|
36
|
+
xlsxToMarkdownDoc,
|
|
37
|
+
xlsxToTables
|
|
17
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-formats",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Document format converters — DOCX, PDF, OOXML import/export",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -63,6 +63,11 @@
|
|
|
63
63
|
"import": "./dist/csv/index.js",
|
|
64
64
|
"default": "./dist/csv/index.js"
|
|
65
65
|
},
|
|
66
|
+
"./data": {
|
|
67
|
+
"types": "./dist/data/index.d.ts",
|
|
68
|
+
"import": "./dist/data/index.js",
|
|
69
|
+
"default": "./dist/data/index.js"
|
|
70
|
+
},
|
|
66
71
|
"./ooxml": {
|
|
67
72
|
"types": "./dist/ooxml/index.d.ts",
|
|
68
73
|
"import": "./dist/ooxml/index.js",
|
|
@@ -110,16 +115,26 @@
|
|
|
110
115
|
"typecheck": "tsc --noEmit"
|
|
111
116
|
},
|
|
112
117
|
"dependencies": {
|
|
118
|
+
"@bendyline/squisq": "2.11.0",
|
|
113
119
|
"@pdf-lib/fontkit": "1.1.1",
|
|
114
120
|
"@pdf-lib/upng": "1.0.1",
|
|
115
|
-
"@xmldom/xmldom": "0.9.
|
|
116
|
-
"@bendyline/squisq": "2.10.0",
|
|
121
|
+
"@xmldom/xmldom": "0.9.12",
|
|
117
122
|
"jszip": "3.10.1",
|
|
118
123
|
"pdf-lib": "1.17.1",
|
|
119
124
|
"pdfjs-dist": "4.10.38"
|
|
120
125
|
},
|
|
126
|
+
"peerDependencies": {
|
|
127
|
+
"hyparquet": "^1.29.1"
|
|
128
|
+
},
|
|
129
|
+
"peerDependenciesMeta": {
|
|
130
|
+
"hyparquet": {
|
|
131
|
+
"optional": true
|
|
132
|
+
}
|
|
133
|
+
},
|
|
121
134
|
"devDependencies": {
|
|
122
135
|
"@fortawesome/fontawesome-free": "7.2.0",
|
|
136
|
+
"hyparquet": "1.29.1",
|
|
137
|
+
"hyparquet-writer": "0.16.6",
|
|
123
138
|
"tsup": "8.5.1",
|
|
124
139
|
"typescript": "5.9.3"
|
|
125
140
|
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
2
|
-
import { O as OoxmlOpenOptions } from './reader-B_m1aKZC.js';
|
|
3
|
-
import { Doc } from '@bendyline/squisq/schemas';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* XLSX import — SpreadsheetML (.xlsx) → MarkdownDocument.
|
|
7
|
-
*
|
|
8
|
-
* Reuses the shared ooxml/ reader (zip + DOMParser). Reads the workbook's sheet
|
|
9
|
-
* list, resolves each sheet part via relationships, pulls shared strings, and
|
|
10
|
-
* turns each worksheet into markdown. By default every sheet is imported, each
|
|
11
|
-
* preceded by an H1 of the sheet name; pass `options.sheet` (index or name) to
|
|
12
|
-
* import just one.
|
|
13
|
-
*
|
|
14
|
-
* A sheet is NOT one table. It is usually several tables scattered across the
|
|
15
|
-
* grid with stray labels and notes in the gaps, so by default each worksheet is
|
|
16
|
-
* split into its contiguous data islands (see `regions.ts`) and every island
|
|
17
|
-
* becomes its own block:
|
|
18
|
-
*
|
|
19
|
-
* ```markdown
|
|
20
|
-
* ## Q3 Revenue {[dataTable sheet=Sales anchor=B7]}
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* The `sheet`/`anchor` params on the heading annotation are what let
|
|
24
|
-
* `markdownDocToXlsx` put each table back where it came from, so the round trip
|
|
25
|
-
* reproduces addresses rather than piling everything at A1. A region holding
|
|
26
|
-
* formulas additionally emits a `role=formulas` companion table, and every
|
|
27
|
-
* left-over single cell on a sheet collects into one `role=loose` table.
|
|
28
|
-
*
|
|
29
|
-
* Pass `{ regions: false }` for the historical behavior: one table per sheet,
|
|
30
|
-
* spanning the whole used range.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
interface XlsxImportOptions extends OoxmlOpenOptions {
|
|
34
|
-
/** Which sheet to import (0-based index or sheet name). Default: all sheets. */
|
|
35
|
-
sheet?: number | string;
|
|
36
|
-
/**
|
|
37
|
-
* Split each sheet into its contiguous data islands, one block each, anchored
|
|
38
|
-
* with `{[dataTable sheet=… anchor=…]}`. Default true. Set false for the
|
|
39
|
-
* historical one-table-per-sheet output.
|
|
40
|
-
*/
|
|
41
|
-
regions?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Emit a `role=formulas` companion table for regions that contain formulas.
|
|
44
|
-
* Default true. Ignored when `regions` is false.
|
|
45
|
-
*/
|
|
46
|
-
formulas?: boolean;
|
|
47
|
-
/** Cap on region tables per sheet before the rest fold into loose cells. Default 64. */
|
|
48
|
-
maxRegionsPerSheet?: number;
|
|
49
|
-
/** Smallest island that stays a table of its own. Default 2 — single cells coalesce. */
|
|
50
|
-
minRegionCells?: number;
|
|
51
|
-
}
|
|
52
|
-
declare function xlsxToMarkdownDoc(data: ArrayBuffer | Blob, options?: XlsxImportOptions): Promise<MarkdownDocument>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* XLSX export — MarkdownDocument → SpreadsheetML (.xlsx).
|
|
56
|
-
*
|
|
57
|
-
* Tables-only fidelity (honestly documented): every `table` node in the
|
|
58
|
-
* markdown AST becomes worksheet cells; all other content (prose, lists,
|
|
59
|
-
* images, …) is dropped, and headings survive only as sheet names and as the
|
|
60
|
-
* carrier of placement metadata.
|
|
61
|
-
*
|
|
62
|
-
* Placement has two modes, decided per table by `workbookPlan.ts`. A table
|
|
63
|
-
* whose heading carries `{[dataTable sheet=… anchor=…]}` — what
|
|
64
|
-
* `xlsxToMarkdownDoc` emits for every data island it finds — is placed on the
|
|
65
|
-
* named sheet at the named cell, so several mini tables share one worksheet at
|
|
66
|
-
* their original addresses and formulas ride along. A table with no such
|
|
67
|
-
* annotation keeps the historical behavior exactly: its own worksheet, named
|
|
68
|
-
* from the nearest preceding heading, starting at A1.
|
|
69
|
-
*
|
|
70
|
-
* Cells are emitted as inline strings (`t="inlineStr"`) by default so no
|
|
71
|
-
* sharedStrings part is needed and identifier-like numbers remain lossless.
|
|
72
|
-
* Callers can explicitly opt into conservative numeric inference. The package
|
|
73
|
-
* is assembled with the shared ooxml/ writer (auto-generates
|
|
74
|
-
* `[Content_Types].xml` + `_rels`), so only the SpreadsheetML-specific parts
|
|
75
|
-
* (workbook, worksheets, styles) are written here.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* import { parseMarkdown } from '@bendyline/squisq/markdown';
|
|
80
|
-
* import { markdownDocToXlsx } from '@bendyline/squisq-formats/xlsx';
|
|
81
|
-
*
|
|
82
|
-
* const md = parseMarkdown('# Metrics\n\n| A | B |\n| - | - |\n| 1 | 2 |');
|
|
83
|
-
* const buffer = await markdownDocToXlsx(md);
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Options for XLSX export.
|
|
89
|
-
*/
|
|
90
|
-
interface XlsxExportOptions {
|
|
91
|
-
/** Cancel at bounded export checkpoints. */
|
|
92
|
-
signal?: AbortSignal;
|
|
93
|
-
/** Maximum cells emitted. Default: 100,000. */
|
|
94
|
-
maxCells?: number;
|
|
95
|
-
/** Workbook title (written to core properties). */
|
|
96
|
-
title?: string;
|
|
97
|
-
/** Workbook author (written to core properties). */
|
|
98
|
-
author?: string;
|
|
99
|
-
/** Prefix used for auto-named sheets when no heading precedes a table. Default: "Sheet". */
|
|
100
|
-
sheetNamePrefix?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Emit canonical, Excel-safe number strings as numeric cells.
|
|
103
|
-
*
|
|
104
|
-
* Defaults to false for hand-authored documents — markdown tables have no
|
|
105
|
-
* column schema, so preserving authored text is the only lossless choice —
|
|
106
|
-
* and to true when the document carries `sheet=` anchors, which only an XLSX
|
|
107
|
-
* import produces. Leading-zero and >15-significant-digit values remain
|
|
108
|
-
* strings either way. Set explicitly to override both defaults.
|
|
109
|
-
*/
|
|
110
|
-
inferNumericCells?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Called for each non-fatal placement problem (a malformed anchor, an
|
|
113
|
-
* overlapping region, an unusable loose-cell reference). Export never throws
|
|
114
|
-
* for these — a hand-edited markdown file must still convert.
|
|
115
|
-
*/
|
|
116
|
-
onWarning?: (message: string) => void;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Convert a MarkdownDocument to a .xlsx file (tables-only fidelity).
|
|
120
|
-
*
|
|
121
|
-
* Each markdown `table` becomes one worksheet; a document with no tables
|
|
122
|
-
* yields a single empty sheet (a valid, openable file — never throws).
|
|
123
|
-
*/
|
|
124
|
-
declare function markdownDocToXlsx(doc: MarkdownDocument, options?: XlsxExportOptions): Promise<ArrayBuffer>;
|
|
125
|
-
/**
|
|
126
|
-
* Convert a squisq Doc to a .xlsx file (via the markdown table model).
|
|
127
|
-
*/
|
|
128
|
-
declare function docToXlsx(doc: Doc, options?: XlsxExportOptions): Promise<ArrayBuffer>;
|
|
129
|
-
|
|
130
|
-
export { type XlsxExportOptions as X, type XlsxImportOptions as a, docToXlsx as d, markdownDocToXlsx as m, xlsxToMarkdownDoc as x };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
colorHintsFromExtraction,
|
|
3
|
+
compileExtractedTheme
|
|
4
|
+
} from "./chunk-2JJ5RFDZ.js";
|
|
1
5
|
import {
|
|
2
6
|
ConversionError
|
|
3
7
|
} from "./chunk-KXOZMWBS.js";
|
|
@@ -6,10 +10,6 @@ import {
|
|
|
6
10
|
extractPptxTheme,
|
|
7
11
|
extractXlsxTheme
|
|
8
12
|
} from "./chunk-WATAOG4Y.js";
|
|
9
|
-
import {
|
|
10
|
-
colorHintsFromExtraction,
|
|
11
|
-
compileExtractedTheme
|
|
12
|
-
} from "./chunk-2JJ5RFDZ.js";
|
|
13
13
|
import {
|
|
14
14
|
openPackage,
|
|
15
15
|
throwIfOoxmlAborted
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FootnoteIndex
|
|
3
|
+
} from "./chunk-BXWNU4T5.js";
|
|
1
4
|
import {
|
|
2
5
|
buildContainer
|
|
3
6
|
} from "./chunk-IIQYS2YH.js";
|
|
@@ -6,9 +9,6 @@ import {
|
|
|
6
9
|
fontAwesomeFaces,
|
|
7
10
|
fontAwesomeGlyph
|
|
8
11
|
} from "./chunk-USU6HTKB.js";
|
|
9
|
-
import {
|
|
10
|
-
FootnoteIndex
|
|
11
|
-
} from "./chunk-BXWNU4T5.js";
|
|
12
12
|
|
|
13
13
|
// src/pdf/export.ts
|
|
14
14
|
import { PDFDocument, StandardFonts, rgb, PDFString } from "pdf-lib";
|