@bendyline/squisq-formats 2.0.1 → 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.
- package/LICENSE +21 -0
- package/NOTICE.md +20 -0
- package/README.md +1 -1
- package/dist/{chunk-CRAVSMPZ.js → chunk-26ISNJ7Y.js} +356 -114
- package/dist/{chunk-NKAJPJ4G.js → chunk-2JJ5RFDZ.js} +0 -1
- package/dist/{chunk-HTW2M27H.js → chunk-3NKXBZSR.js} +193 -42
- package/dist/{chunk-U32AG3G3.js → chunk-4V3KCHAP.js} +3 -4
- package/dist/{chunk-MLX2BOJC.js → chunk-6RQOV3B3.js} +1 -2
- package/dist/{chunk-QRVN6A6E.js → chunk-6S6GU3ZG.js} +5 -6
- package/dist/{chunk-FE6OJV6O.js → chunk-7AWFHP5U.js} +1 -1
- package/dist/{chunk-RFAPOKHJ.js → chunk-AD2WT564.js} +59 -9
- package/dist/{chunk-O3GVVND4.js → chunk-AONELFLA.js} +0 -1
- package/dist/{chunk-XKUMNGBW.js → chunk-EJTNGKEA.js} +5 -8
- package/dist/chunk-GX7RAUME.js +121 -0
- package/dist/{chunk-SSUPBUF5.js → chunk-IIQYS2YH.js} +0 -1
- package/dist/{chunk-ABVI556T.js → chunk-IPN56VLW.js} +83 -58
- package/dist/{chunk-LXYLOOST.js → chunk-JE6LSIHE.js} +83 -22
- package/dist/{chunk-U4MRIFKL.js → chunk-JU2RHXUB.js} +0 -1
- package/dist/{chunk-4VUWTSGM.js → chunk-K6XRMVPW.js} +64 -31
- package/dist/{chunk-ODL3SSPT.js → chunk-KXOZMWBS.js} +0 -1
- package/dist/chunk-OGS5VCGJ.js +446 -0
- package/dist/{chunk-GVS2XXV6.js → chunk-PJXJI2LY.js} +449 -57
- package/dist/{chunk-2KPARF2P.js → chunk-PU7REGWV.js} +5 -8
- package/dist/{chunk-PN52A5AA.js → chunk-SBUW7NHR.js} +0 -1
- package/dist/{chunk-VSYHZECT.js → chunk-TAAENIRB.js} +5 -8
- package/dist/{chunk-WC7WULGV.js → chunk-X2DEAXNK.js} +62 -2
- package/dist/container/index.js +1 -2
- package/dist/csv/index.d.ts +27 -2
- package/dist/csv/index.js +1 -2
- package/dist/docx/index.d.ts +5 -1
- package/dist/docx/index.js +9 -10
- package/dist/epub/index.d.ts +2 -0
- package/dist/epub/index.js +5 -6
- package/dist/{export-D2NkylDT.d.ts → export-D9msROJS.d.ts} +18 -6
- package/dist/extract-MN7LA3NL.js +13 -0
- package/dist/html/index.d.ts +11 -4
- package/dist/html/index.js +3 -4
- package/dist/images-ESPQKVTW.js +6 -0
- package/dist/{import-K8mfc0fz.d.ts → import-C3htUTss.d.ts} +5 -1
- package/dist/{import-DTkDxHmZ.d.ts → import-C8whCC7_.d.ts} +6 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +28 -26
- package/dist/infer/index.d.ts +3 -3
- package/dist/infer/index.js +7 -9
- package/dist/{layouts-BHrgZ5FS.d.ts → layouts-CTdPlB-u.d.ts} +1 -1
- package/dist/layouts-DRWZGSPD.js +10 -0
- package/dist/{mapTheme-IR27S6IV.js → mapTheme-4TWH25FT.js} +1 -2
- package/dist/ooxml/index.d.ts +3 -3
- package/dist/ooxml/index.js +14 -13
- package/dist/pdf/index.d.ts +18 -0
- package/dist/pdf/index.js +2 -3
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.js +11 -13
- package/dist/{reader-B9L8Ucbj.d.ts → reader-B_m1aKZC.d.ts} +30 -1
- package/dist/registry/index.d.ts +21 -5
- package/dist/registry/index.js +9 -6
- package/dist/{themeReader-DJKErl_j.d.ts → themeReader-DCtwC83Q.d.ts} +1 -1
- package/dist/xlsx/index.d.ts +3 -3
- package/dist/xlsx/index.js +6 -7
- package/package.json +6 -3
- package/dist/chunk-2KPARF2P.js.map +0 -1
- package/dist/chunk-4VUWTSGM.js.map +0 -1
- package/dist/chunk-6M7Z25LA.js +0 -46
- package/dist/chunk-6M7Z25LA.js.map +0 -1
- package/dist/chunk-ABVI556T.js.map +0 -1
- package/dist/chunk-CRAVSMPZ.js.map +0 -1
- package/dist/chunk-FE6OJV6O.js.map +0 -1
- package/dist/chunk-GVS2XXV6.js.map +0 -1
- package/dist/chunk-HTW2M27H.js.map +0 -1
- package/dist/chunk-LXYLOOST.js.map +0 -1
- package/dist/chunk-MLX2BOJC.js.map +0 -1
- package/dist/chunk-NKAJPJ4G.js.map +0 -1
- package/dist/chunk-O3GVVND4.js.map +0 -1
- package/dist/chunk-ODL3SSPT.js.map +0 -1
- package/dist/chunk-PN52A5AA.js.map +0 -1
- package/dist/chunk-QRVN6A6E.js.map +0 -1
- package/dist/chunk-RFAPOKHJ.js.map +0 -1
- package/dist/chunk-SSUPBUF5.js.map +0 -1
- package/dist/chunk-U32AG3G3.js.map +0 -1
- package/dist/chunk-U4MRIFKL.js.map +0 -1
- package/dist/chunk-VJJM2SSH.js +0 -275
- package/dist/chunk-VJJM2SSH.js.map +0 -1
- package/dist/chunk-VSYHZECT.js.map +0 -1
- package/dist/chunk-WC7WULGV.js.map +0 -1
- package/dist/chunk-XKUMNGBW.js.map +0 -1
- package/dist/chunk-YRT7GQ5Y.js +0 -28
- package/dist/chunk-YRT7GQ5Y.js.map +0 -1
- package/dist/container/index.js.map +0 -1
- package/dist/csv/index.js.map +0 -1
- package/dist/docx/index.js.map +0 -1
- package/dist/epub/index.js.map +0 -1
- package/dist/extract-H6RXJMHP.js +0 -15
- package/dist/extract-H6RXJMHP.js.map +0 -1
- package/dist/html/index.js.map +0 -1
- package/dist/images-7FBWPKE3.js +0 -7
- package/dist/images-7FBWPKE3.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infer/index.js.map +0 -1
- package/dist/layouts-QVPK3ZCU.js +0 -12
- package/dist/layouts-QVPK3ZCU.js.map +0 -1
- package/dist/mapTheme-IR27S6IV.js.map +0 -1
- package/dist/ooxml/index.js.map +0 -1
- package/dist/pdf/index.js.map +0 -1
- package/dist/pptx/index.js.map +0 -1
- package/dist/registry/index.js.map +0 -1
- package/dist/xlsx/index.js.map +0 -1
- package/src/__tests__/container.test.ts +0 -230
- package/src/__tests__/convert.test.ts +0 -495
- package/src/__tests__/csvImport.test.ts +0 -84
- package/src/__tests__/docxExport.test.ts +0 -457
- package/src/__tests__/docxImport.test.ts +0 -410
- package/src/__tests__/epub.test.ts +0 -649
- package/src/__tests__/exportThemeReconciliation.test.ts +0 -87
- package/src/__tests__/formatRegistry.test.ts +0 -174
- package/src/__tests__/html.test.ts +0 -435
- package/src/__tests__/htmlImport.test.ts +0 -57
- package/src/__tests__/inferTheme.test.ts +0 -135
- package/src/__tests__/lossyWarnings.test.ts +0 -146
- package/src/__tests__/ooxml.test.ts +0 -271
- package/src/__tests__/ooxmlCancellation.test.ts +0 -113
- package/src/__tests__/ooxmlThemeReader.test.ts +0 -92
- package/src/__tests__/pdfExport.test.ts +0 -322
- package/src/__tests__/pdfImport.test.ts +0 -384
- package/src/__tests__/plainHtml.test.ts +0 -417
- package/src/__tests__/plainHtmlBundle.test.ts +0 -253
- package/src/__tests__/pptxExport.test.ts +0 -138
- package/src/__tests__/pptxImport.test.ts +0 -145
- package/src/__tests__/pptxInferFixtures.ts +0 -314
- package/src/__tests__/pptxLayoutInfer.test.ts +0 -395
- package/src/__tests__/roundTrip.test.ts +0 -201
- package/src/__tests__/roundTripAssets.test.ts +0 -50
- package/src/__tests__/roundTripMatrix.fixtures.ts +0 -86
- package/src/__tests__/roundTripMatrix.helpers.ts +0 -154
- package/src/__tests__/roundTripMatrix.test.ts +0 -142
- package/src/__tests__/sharedContainer.test.ts +0 -41
- package/src/__tests__/sharedImages.test.ts +0 -61
- package/src/__tests__/xlsxExport.test.ts +0 -164
- package/src/__tests__/xlsxImport.test.ts +0 -80
- package/src/__tests__/zipSafety.test.ts +0 -317
- package/src/container/index.ts +0 -94
- package/src/csv/index.ts +0 -188
- package/src/docx/export.ts +0 -1267
- package/src/docx/import.ts +0 -995
- package/src/docx/index.ts +0 -26
- package/src/docx/styles.ts +0 -145
- package/src/epub/export.ts +0 -968
- package/src/epub/index.ts +0 -20
- package/src/html/docsHtmlBundle.ts +0 -373
- package/src/html/htmlTemplate.ts +0 -385
- package/src/html/imageUtils.ts +0 -61
- package/src/html/import.ts +0 -297
- package/src/html/index.ts +0 -212
- package/src/html/plainHtml.ts +0 -790
- package/src/html/plainHtmlBundle.ts +0 -421
- package/src/index.ts +0 -109
- package/src/infer/extract.ts +0 -127
- package/src/infer/index.ts +0 -199
- package/src/infer/mapTheme.ts +0 -176
- package/src/infer/types.ts +0 -27
- package/src/ooxml/index.ts +0 -111
- package/src/ooxml/namespaces.ts +0 -196
- package/src/ooxml/readUtils.ts +0 -44
- package/src/ooxml/reader.ts +0 -318
- package/src/ooxml/themeReader.ts +0 -197
- package/src/ooxml/types.ts +0 -103
- package/src/ooxml/writer.ts +0 -339
- package/src/ooxml/xmlUtils.ts +0 -123
- package/src/pdf/export.ts +0 -1084
- package/src/pdf/import.ts +0 -1164
- package/src/pdf/index.ts +0 -29
- package/src/pdf/styles.ts +0 -180
- package/src/pptx/export.ts +0 -1184
- package/src/pptx/import.ts +0 -455
- package/src/pptx/index.ts +0 -52
- package/src/pptx/layouts.ts +0 -1222
- package/src/pptx/styles.ts +0 -96
- package/src/pptx/templates.ts +0 -187
- package/src/registry/convert.ts +0 -433
- package/src/registry/defaultFormats.ts +0 -413
- package/src/registry/errors.ts +0 -46
- package/src/registry/index.ts +0 -43
- package/src/registry/registry.ts +0 -48
- package/src/registry/types.ts +0 -170
- package/src/shared/boundedZipArchive.ts +0 -383
- package/src/shared/container.ts +0 -28
- package/src/shared/fidelity.ts +0 -130
- package/src/shared/images.ts +0 -44
- package/src/shared/inlineRuns.ts +0 -99
- package/src/shared/text.ts +0 -41
- package/src/shared/zipEntryCount.ts +0 -151
- package/src/shared/zipLimits.ts +0 -296
- package/src/shared/zipSafety.ts +0 -19
- package/src/xlsx/export.ts +0 -253
- package/src/xlsx/import.ts +0 -160
- package/src/xlsx/index.ts +0 -35
package/dist/index.js
CHANGED
|
@@ -1,68 +1,69 @@
|
|
|
1
1
|
import {
|
|
2
2
|
docToEpub,
|
|
3
3
|
markdownDocToEpub
|
|
4
|
-
} from "./chunk-
|
|
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
|
-
|
|
12
|
+
prepareConversion,
|
|
13
|
+
resolveConversionLimits
|
|
14
|
+
} from "./chunk-3NKXBZSR.js";
|
|
13
15
|
import {
|
|
14
16
|
inferThemeFromFile
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6S6GU3ZG.js";
|
|
16
18
|
import {
|
|
17
19
|
ConversionError
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-KXOZMWBS.js";
|
|
21
|
+
import "./chunk-PU7REGWV.js";
|
|
20
22
|
import {
|
|
21
23
|
compileExtractedTheme
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-2JJ5RFDZ.js";
|
|
23
25
|
import {
|
|
24
26
|
docToDocx,
|
|
25
27
|
docxToDoc,
|
|
26
28
|
docxToMarkdownDoc,
|
|
27
29
|
markdownDocToDocx
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-26ISNJ7Y.js";
|
|
29
31
|
import {
|
|
30
32
|
docToPptx,
|
|
31
33
|
markdownDocToPptx,
|
|
32
34
|
pptxToDoc,
|
|
33
35
|
pptxToMarkdownDoc
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
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-
|
|
43
|
-
import "./chunk-
|
|
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-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-WC7WULGV.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-
|
|
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-
|
|
65
|
-
import "./chunk-
|
|
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-
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
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
|
package/dist/infer/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Theme, DeepPartial, CustomTemplateDefinition } from '@bendyline/squisq/schemas';
|
|
2
|
-
import { a as OoxmlPackage, O as OoxmlOpenOptions } from '../reader-
|
|
3
|
-
import { O as OoxmlColorScheme, a as OoxmlFontScheme } from '../themeReader-
|
|
4
|
-
import { P as PptxColorHints } from '../layouts-
|
|
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
|
/**
|
package/dist/infer/index.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inferThemeFromFile
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-6S6GU3ZG.js";
|
|
4
|
+
import "../chunk-KXOZMWBS.js";
|
|
5
5
|
import {
|
|
6
6
|
extractDocxTheme,
|
|
7
7
|
extractPptxTheme,
|
|
8
8
|
extractXlsxTheme
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-PU7REGWV.js";
|
|
10
10
|
import {
|
|
11
11
|
colorHintsFromExtraction,
|
|
12
12
|
compileExtractedTheme,
|
|
13
13
|
extractedThemeToPartial
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-FE6OJV6O.js";
|
|
14
|
+
} from "../chunk-2JJ5RFDZ.js";
|
|
15
|
+
import "../chunk-EJTNGKEA.js";
|
|
16
|
+
import "../chunk-X2DEAXNK.js";
|
|
17
|
+
import "../chunk-7AWFHP5U.js";
|
|
19
18
|
export {
|
|
20
19
|
colorHintsFromExtraction,
|
|
21
20
|
compileExtractedTheme,
|
|
@@ -25,4 +24,3 @@ export {
|
|
|
25
24
|
extractedThemeToPartial,
|
|
26
25
|
inferThemeFromFile
|
|
27
26
|
};
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomTemplateDefinition } from '@bendyline/squisq/schemas';
|
|
2
|
-
import { O as OoxmlOpenOptions, a as OoxmlPackage } from './reader-
|
|
2
|
+
import { O as OoxmlOpenOptions, a as OoxmlPackage } from './reader-B_m1aKZC.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* PPTX slide-layout inference — reads the layouts/masters a deck actually
|
|
@@ -2,10 +2,9 @@ import {
|
|
|
2
2
|
colorHintsFromExtraction,
|
|
3
3
|
compileExtractedTheme,
|
|
4
4
|
extractedThemeToPartial
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2JJ5RFDZ.js";
|
|
6
6
|
export {
|
|
7
7
|
colorHintsFromExtraction,
|
|
8
8
|
compileExtractedTheme,
|
|
9
9
|
extractedThemeToPartial
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=mapTheme-IR27S6IV.js.map
|
package/dist/ooxml/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as Relationship, C as CoreProperties } from '../reader-
|
|
2
|
-
export { b as ContentTypeMap, O as OoxmlOpenOptions, a as OoxmlPackage, P as PackagePart, c as PendingRelationship, g as getCoreProperties, d as getPartBinary, e as getPartRelationships, f as getPartXml, o as openPackage } from '../reader-
|
|
1
|
+
import { R as Relationship, C as CoreProperties } from '../reader-B_m1aKZC.js';
|
|
2
|
+
export { b as ContentTypeMap, O as OoxmlOpenOptions, a as OoxmlPackage, P as PackagePart, c as PendingRelationship, g as getCoreProperties, d as getPartBinary, e as getPartRelationships, f as getPartXml, o as openPackage, r as requireMainPartPath, h as resolveMainPartPath } from '../reader-B_m1aKZC.js';
|
|
3
3
|
export { Z as ZipSafetyError, a as ZipSafetyErrorCode, b as ZipSafetyErrorOptions, c as ZipSafetyLimits } from '../zipLimits-BOKCB7qk.js';
|
|
4
|
-
export { O as OoxmlColorScheme, a as OoxmlFontScheme, b as OoxmlTheme, p as parseThemeXml, r as readThemePart } from '../themeReader-
|
|
4
|
+
export { O as OoxmlColorScheme, a as OoxmlFontScheme, b as OoxmlTheme, p as parseThemeXml, r as readThemePart } from '../themeReader-DCtwC83Q.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Shared DOM-read helpers for OOXML importers.
|
package/dist/ooxml/index.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseThemeXml,
|
|
3
3
|
readThemePart
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
attrNS,
|
|
7
|
-
baseDirOf,
|
|
8
|
-
findRelByType,
|
|
9
|
-
resolveTarget
|
|
10
|
-
} from "../chunk-YRT7GQ5Y.js";
|
|
4
|
+
} from "../chunk-EJTNGKEA.js";
|
|
11
5
|
import {
|
|
12
6
|
createPackage
|
|
13
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-4V3KCHAP.js";
|
|
14
8
|
import {
|
|
15
9
|
attrString,
|
|
16
10
|
escapeXml,
|
|
@@ -18,7 +12,7 @@ import {
|
|
|
18
12
|
textElement,
|
|
19
13
|
xmlDeclaration,
|
|
20
14
|
xmlElement
|
|
21
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-JU2RHXUB.js";
|
|
22
16
|
import {
|
|
23
17
|
CONTENT_TYPE_CORE_PROPERTIES,
|
|
24
18
|
CONTENT_TYPE_DOCX_DOCUMENT,
|
|
@@ -65,15 +59,21 @@ import {
|
|
|
65
59
|
REL_STYLES,
|
|
66
60
|
REL_THEME,
|
|
67
61
|
REL_WORKSHEET,
|
|
62
|
+
attrNS,
|
|
63
|
+
baseDirOf,
|
|
64
|
+
findRelByType,
|
|
68
65
|
getCoreProperties,
|
|
69
66
|
getPartBinary,
|
|
70
67
|
getPartRelationships,
|
|
71
68
|
getPartXml,
|
|
72
|
-
openPackage
|
|
73
|
-
|
|
69
|
+
openPackage,
|
|
70
|
+
requireMainPartPath,
|
|
71
|
+
resolveMainPartPath,
|
|
72
|
+
resolveTarget
|
|
73
|
+
} from "../chunk-X2DEAXNK.js";
|
|
74
74
|
import {
|
|
75
75
|
ZipSafetyError
|
|
76
|
-
} from "../chunk-
|
|
76
|
+
} from "../chunk-7AWFHP5U.js";
|
|
77
77
|
export {
|
|
78
78
|
CONTENT_TYPE_CORE_PROPERTIES,
|
|
79
79
|
CONTENT_TYPE_DOCX_DOCUMENT,
|
|
@@ -134,10 +134,11 @@ export {
|
|
|
134
134
|
openPackage,
|
|
135
135
|
parseThemeXml,
|
|
136
136
|
readThemePart,
|
|
137
|
+
requireMainPartPath,
|
|
138
|
+
resolveMainPartPath,
|
|
137
139
|
resolveTarget,
|
|
138
140
|
selfClosingElement,
|
|
139
141
|
textElement,
|
|
140
142
|
xmlDeclaration,
|
|
141
143
|
xmlElement
|
|
142
144
|
};
|
|
143
|
-
//# sourceMappingURL=index.js.map
|
package/dist/pdf/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ type PdfPageSize = 'letter' | 'a4';
|
|
|
29
29
|
* Options for PDF export.
|
|
30
30
|
*/
|
|
31
31
|
interface PdfExportOptions {
|
|
32
|
+
/** Cancel at bounded export checkpoints. */
|
|
33
|
+
signal?: AbortSignal;
|
|
32
34
|
/** Document title (PDF metadata). */
|
|
33
35
|
title?: string;
|
|
34
36
|
/** Document author (PDF metadata). */
|
|
@@ -47,6 +49,14 @@ interface PdfExportOptions {
|
|
|
47
49
|
themeId?: string;
|
|
48
50
|
/** Explicit caller-owned registry for non-document custom themes. */
|
|
49
51
|
themeRegistry?: ThemeRegistry;
|
|
52
|
+
/**
|
|
53
|
+
* Receives non-fatal notes about the export — today, the one-shot summary
|
|
54
|
+
* raised when characters outside the standard PDF fonts' WinAnsi encoding
|
|
55
|
+
* had to be substituted. When omitted, such notes go to `console.warn`.
|
|
56
|
+
* The registry passes a collector so the message reaches
|
|
57
|
+
* `ConversionResult.warnings` instead.
|
|
58
|
+
*/
|
|
59
|
+
onWarning?: (message: string) => void;
|
|
50
60
|
}
|
|
51
61
|
/**
|
|
52
62
|
* Convert a MarkdownDocument to a PDF ArrayBuffer.
|
|
@@ -85,6 +95,14 @@ declare function docToPdf(doc: Doc, options?: PdfExportOptions): Promise<ArrayBu
|
|
|
85
95
|
* Options for PDF import.
|
|
86
96
|
*/
|
|
87
97
|
interface PdfImportOptions {
|
|
98
|
+
/** Cancel between pages and image operations. */
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
/** Maximum pages processed. Default: 5,000. */
|
|
101
|
+
maxPages?: number;
|
|
102
|
+
/** Maximum positioned text items processed. Default: 1,000,000. */
|
|
103
|
+
maxTextItems?: number;
|
|
104
|
+
/** Maximum cumulative decoded image pixels. Default: 100 megapixels. */
|
|
105
|
+
maxImagePixels?: number;
|
|
88
106
|
/**
|
|
89
107
|
* Hint for the body font size used in the PDF (in points).
|
|
90
108
|
* Text items larger than this are considered headings.
|
package/dist/pdf/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
pdfToContainer,
|
|
6
6
|
pdfToDoc,
|
|
7
7
|
pdfToMarkdownDoc
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-PJXJI2LY.js";
|
|
9
|
+
import "../chunk-IIQYS2YH.js";
|
|
10
10
|
export {
|
|
11
11
|
configurePdfWorker,
|
|
12
12
|
docToPdf,
|
|
@@ -15,4 +15,3 @@ export {
|
|
|
15
15
|
pdfToDoc,
|
|
16
16
|
pdfToMarkdownDoc
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/dist/pptx/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as PptxImportOptions } from '../import-
|
|
2
|
-
export { P as PptxExportOptions, d as docToPptx, m as markdownDocToPptx, b as pptxToContainer, p as pptxToMarkdownDoc } from '../import-
|
|
1
|
+
import { a as PptxImportOptions } from '../import-C3htUTss.js';
|
|
2
|
+
export { P as PptxExportOptions, d as docToPptx, m as markdownDocToPptx, b as pptxToContainer, p as pptxToMarkdownDoc } from '../import-C3htUTss.js';
|
|
3
3
|
import { Doc } from '@bendyline/squisq/schemas';
|
|
4
|
-
export { A as AnalyzePptxLayoutsOptions, a as AnalyzedLayout, E as ExtractedPlaceholder, b as ExtractedSlideLayout, I as InspectPptxLayoutsOptions, L as LayoutVerdict, P as PptxColorHints, c as PptxLayoutInference, d as PptxLayoutSummary, e as analyzePptxLayouts, i as inspectPptxLayouts } from '../layouts-
|
|
4
|
+
export { A as AnalyzePptxLayoutsOptions, a as AnalyzedLayout, E as ExtractedPlaceholder, b as ExtractedSlideLayout, I as InspectPptxLayoutsOptions, L as LayoutVerdict, P as PptxColorHints, c as PptxLayoutInference, d as PptxLayoutSummary, e as analyzePptxLayouts, i as inspectPptxLayouts } from '../layouts-CTdPlB-u.js';
|
|
5
5
|
import '@bendyline/squisq/markdown';
|
|
6
|
-
import '../reader-
|
|
6
|
+
import '../reader-B_m1aKZC.js';
|
|
7
7
|
import '../zipLimits-BOKCB7qk.js';
|
|
8
8
|
import '@bendyline/squisq/storage';
|
|
9
9
|
|
package/dist/pptx/index.js
CHANGED
|
@@ -4,21 +4,20 @@ import {
|
|
|
4
4
|
pptxToContainer,
|
|
5
5
|
pptxToDoc,
|
|
6
6
|
pptxToMarkdownDoc
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-IPN56VLW.js";
|
|
8
8
|
import {
|
|
9
9
|
analyzePptxLayouts,
|
|
10
10
|
inspectPptxLayouts
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-O3GVVND4.js";
|
|
11
|
+
} from "../chunk-TAAENIRB.js";
|
|
12
|
+
import "../chunk-GX7RAUME.js";
|
|
13
|
+
import "../chunk-SBUW7NHR.js";
|
|
14
|
+
import "../chunk-4V3KCHAP.js";
|
|
15
|
+
import "../chunk-JU2RHXUB.js";
|
|
16
|
+
import "../chunk-X2DEAXNK.js";
|
|
17
|
+
import "../chunk-7AWFHP5U.js";
|
|
18
|
+
import "../chunk-IIQYS2YH.js";
|
|
19
|
+
import "../chunk-6RQOV3B3.js";
|
|
20
|
+
import "../chunk-AONELFLA.js";
|
|
22
21
|
export {
|
|
23
22
|
analyzePptxLayouts,
|
|
24
23
|
docToPptx,
|
|
@@ -28,4 +27,3 @@ export {
|
|
|
28
27
|
pptxToDoc,
|
|
29
28
|
pptxToMarkdownDoc
|
|
30
29
|
};
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -104,6 +104,35 @@ type OoxmlOpenOptions = ZipSafetyLimits;
|
|
|
104
104
|
* @returns A parsed OoxmlPackage
|
|
105
105
|
*/
|
|
106
106
|
declare function openPackage(data: ArrayBuffer | Blob, limits?: OoxmlOpenOptions): Promise<OoxmlPackage>;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve a package's main part (the "office document" part).
|
|
109
|
+
*
|
|
110
|
+
* Per OPC (ECMA-376 Part 2), the main part is whatever the **root**
|
|
111
|
+
* `officeDocument` relationship targets — the conventional paths
|
|
112
|
+
* (`word/document.xml`, `xl/workbook.xml`, `ppt/presentation.xml`) are a
|
|
113
|
+
* convention, not a rule. Real generators (and some Office save paths) emit
|
|
114
|
+
* e.g. `word/document2.xml`; reading the conventional path literally imports
|
|
115
|
+
* such a package as an empty document with no error.
|
|
116
|
+
*
|
|
117
|
+
* Resolution order:
|
|
118
|
+
* 1. The root `officeDocument` relationship target, when that part exists.
|
|
119
|
+
* 2. The conventional path, when it exists (covers packages with a missing
|
|
120
|
+
* or malformed root relationship).
|
|
121
|
+
* 3. `null` — no main part; callers must fail loudly rather than return empty.
|
|
122
|
+
*
|
|
123
|
+
* @param pkg - The opened package.
|
|
124
|
+
* @param conventionalPath - The format's by-convention main part path.
|
|
125
|
+
* @returns The resolved part path within the archive, or `null` if absent.
|
|
126
|
+
*/
|
|
127
|
+
declare function resolveMainPartPath(pkg: OoxmlPackage, conventionalPath: string): string | null;
|
|
128
|
+
/**
|
|
129
|
+
* Like {@link resolveMainPartPath}, but throws when no main part exists.
|
|
130
|
+
*
|
|
131
|
+
* @param pkg - The opened package.
|
|
132
|
+
* @param conventionalPath - The format's by-convention main part path.
|
|
133
|
+
* @param formatLabel - Human-readable format name for the error message.
|
|
134
|
+
*/
|
|
135
|
+
declare function requireMainPartPath(pkg: OoxmlPackage, conventionalPath: string, formatLabel: string): string;
|
|
107
136
|
/**
|
|
108
137
|
* Parse relationships for a specific part.
|
|
109
138
|
*
|
|
@@ -137,4 +166,4 @@ declare function getPartBinary(pkg: OoxmlPackage, partPath: string): Promise<Arr
|
|
|
137
166
|
*/
|
|
138
167
|
declare function getCoreProperties(pkg: OoxmlPackage): Promise<CoreProperties>;
|
|
139
168
|
|
|
140
|
-
export { type CoreProperties as C, type OoxmlOpenOptions as O, type PackagePart as P, type Relationship as R, type OoxmlPackage as a, type ContentTypeMap as b, type PendingRelationship as c, getPartBinary as d, getPartRelationships as e, getPartXml as f, getCoreProperties as g, openPackage as o };
|
|
169
|
+
export { type CoreProperties as C, type OoxmlOpenOptions as O, type PackagePart as P, type Relationship as R, type OoxmlPackage as a, type ContentTypeMap as b, type PendingRelationship as c, getPartBinary as d, getPartRelationships as e, getPartXml as f, getCoreProperties as g, resolveMainPartPath as h, openPackage as o, requireMainPartPath as r };
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -3,15 +3,29 @@ import { TransformStyleInput, TransformStyleRegistry } from '@bendyline/squisq/t
|
|
|
3
3
|
import { ParseOptions, StringifyOptions, MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
4
4
|
import { ContentContainer } from '@bendyline/squisq/storage';
|
|
5
5
|
import { DocxImportOptions, DocxExportOptions } from '../docx/index.js';
|
|
6
|
-
import { a as PptxImportOptions, P as PptxExportOptions } from '../import-
|
|
7
|
-
import { a as XlsxImportOptions, X as XlsxExportOptions } from '../export-
|
|
6
|
+
import { a as PptxImportOptions, P as PptxExportOptions } from '../import-C3htUTss.js';
|
|
7
|
+
import { a as XlsxImportOptions, X as XlsxExportOptions } from '../export-D9msROJS.js';
|
|
8
8
|
import { CsvImportOptions, 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-C8whCC7_.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';
|
|
14
|
-
import '../reader-
|
|
14
|
+
import '../reader-B_m1aKZC.js';
|
|
15
|
+
|
|
16
|
+
interface ConversionLimits {
|
|
17
|
+
maxInputBytes: number;
|
|
18
|
+
maxMarkdownBytes: number;
|
|
19
|
+
maxMarkdownNodes: number;
|
|
20
|
+
maxMarkdownDepth: number;
|
|
21
|
+
maxTableCells: number;
|
|
22
|
+
maxBlocks: number;
|
|
23
|
+
maxBlockDepth: number;
|
|
24
|
+
maxDurationSeconds: number;
|
|
25
|
+
maxAudioSegments: number;
|
|
26
|
+
}
|
|
27
|
+
declare const DEFAULT_CONVERSION_LIMITS: Readonly<ConversionLimits>;
|
|
28
|
+
declare function resolveConversionLimits(limits?: Partial<ConversionLimits>): ConversionLimits;
|
|
15
29
|
|
|
16
30
|
/**
|
|
17
31
|
* Format registry — shared types.
|
|
@@ -77,6 +91,8 @@ interface NormalizedInput {
|
|
|
77
91
|
interface ConvertOptions {
|
|
78
92
|
/** Cancel normalization, transformation, or export at the next bounded work boundary. */
|
|
79
93
|
signal?: AbortSignal;
|
|
94
|
+
/** Cross-format safety limits. Pass false only for explicitly trusted input. */
|
|
95
|
+
limits?: Partial<ConversionLimits> | false;
|
|
80
96
|
/** Registry to resolve formats against. Defaults to `defaultRegistry()`. */
|
|
81
97
|
registry?: FormatRegistry;
|
|
82
98
|
/** Explicit source format id (skips extension/byte sniffing). */
|
|
@@ -216,4 +232,4 @@ declare function prepareConversion(source: ConvertSource, options?: ConvertOptio
|
|
|
216
232
|
*/
|
|
217
233
|
declare function convert(source: ConvertSource, to: FormatId, options?: ConvertOptions): Promise<ConversionResult>;
|
|
218
234
|
|
|
219
|
-
export { BUILTIN_FORMAT_IDS, type BuiltinFormatOptions, ConversionError, type ConversionErrorCode, type ConversionErrorOptions, type ConversionResult, type ConvertOptions, type ConvertSource, type DbkFormatOptions, type FormatDefinition, type FormatId, type FormatRegistry, type MarkdownFormatOptions, type NormalizedInput, type PreparedConversion, type PreparedExportOptions, convert, createRegistry, defaultFormats, defaultRegistry, prepareConversion };
|
|
235
|
+
export { BUILTIN_FORMAT_IDS, type BuiltinFormatOptions, ConversionError, type ConversionErrorCode, type ConversionErrorOptions, type ConversionLimits, type ConversionResult, type ConvertOptions, type ConvertSource, DEFAULT_CONVERSION_LIMITS, type DbkFormatOptions, type FormatDefinition, type FormatId, type FormatRegistry, type MarkdownFormatOptions, type NormalizedInput, type PreparedConversion, type PreparedExportOptions, convert, createRegistry, defaultFormats, defaultRegistry, prepareConversion, resolveConversionLimits };
|
package/dist/registry/index.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILTIN_FORMAT_IDS,
|
|
3
|
+
DEFAULT_CONVERSION_LIMITS,
|
|
3
4
|
convert,
|
|
4
5
|
createRegistry,
|
|
5
6
|
defaultFormats,
|
|
6
7
|
defaultRegistry,
|
|
7
|
-
prepareConversion
|
|
8
|
-
|
|
8
|
+
prepareConversion,
|
|
9
|
+
resolveConversionLimits
|
|
10
|
+
} from "../chunk-3NKXBZSR.js";
|
|
9
11
|
import {
|
|
10
12
|
ConversionError
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
+
} from "../chunk-KXOZMWBS.js";
|
|
14
|
+
import "../chunk-7AWFHP5U.js";
|
|
13
15
|
export {
|
|
14
16
|
BUILTIN_FORMAT_IDS,
|
|
15
17
|
ConversionError,
|
|
18
|
+
DEFAULT_CONVERSION_LIMITS,
|
|
16
19
|
convert,
|
|
17
20
|
createRegistry,
|
|
18
21
|
defaultFormats,
|
|
19
22
|
defaultRegistry,
|
|
20
|
-
prepareConversion
|
|
23
|
+
prepareConversion,
|
|
24
|
+
resolveConversionLimits
|
|
21
25
|
};
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/dist/xlsx/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-D9msROJS.js';
|
|
3
|
+
export { X as XlsxExportOptions, d as docToXlsx, m as markdownDocToXlsx, x as xlsxToMarkdownDoc } from '../export-D9msROJS.js';
|
|
4
4
|
import '@bendyline/squisq/markdown';
|
|
5
|
-
import '../reader-
|
|
5
|
+
import '../reader-B_m1aKZC.js';
|
|
6
6
|
import '../zipLimits-BOKCB7qk.js';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/xlsx/index.js
CHANGED
|
@@ -3,16 +3,15 @@ import {
|
|
|
3
3
|
markdownDocToXlsx,
|
|
4
4
|
xlsxToDoc,
|
|
5
5
|
xlsxToMarkdownDoc
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-OGS5VCGJ.js";
|
|
7
|
+
import "../chunk-SBUW7NHR.js";
|
|
8
|
+
import "../chunk-4V3KCHAP.js";
|
|
9
|
+
import "../chunk-JU2RHXUB.js";
|
|
10
|
+
import "../chunk-X2DEAXNK.js";
|
|
11
|
+
import "../chunk-7AWFHP5U.js";
|
|
12
12
|
export {
|
|
13
13
|
docToXlsx,
|
|
14
14
|
markdownDocToXlsx,
|
|
15
15
|
xlsxToDoc,
|
|
16
16
|
xlsxToMarkdownDoc
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-formats",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Document format converters — DOCX, PDF, OOXML import/export",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
|
32
|
-
"
|
|
32
|
+
"!dist/**/*.map",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"NOTICE.md"
|
|
33
35
|
],
|
|
34
36
|
"exports": {
|
|
35
37
|
".": {
|
|
@@ -99,8 +101,9 @@
|
|
|
99
101
|
"typecheck": "tsc --noEmit"
|
|
100
102
|
},
|
|
101
103
|
"dependencies": {
|
|
104
|
+
"@pdf-lib/upng": "1.0.1",
|
|
102
105
|
"@xmldom/xmldom": "0.9.10",
|
|
103
|
-
"@bendyline/squisq": "2.0
|
|
106
|
+
"@bendyline/squisq": "2.2.0",
|
|
104
107
|
"jszip": "3.10.1",
|
|
105
108
|
"pdf-lib": "1.17.1",
|
|
106
109
|
"pdfjs-dist": "4.10.38"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/infer/extract.ts"],"sourcesContent":["/**\n * Per-format theme extraction: locate the theme part of an already-opened\n * OOXML package, parse it, and resolve the document's background/text color\n * mapping. Returns null when the file has no theme part at all.\n */\n\nimport type { OoxmlPackage } from '../ooxml/types.js';\nimport { getPartRelationships, getPartXml } from '../ooxml/reader.js';\nimport { CONTENT_TYPE_PPTX_THEME, NS_PML, NS_WML, REL_SLIDE_MASTER } from '../ooxml/namespaces.js';\nimport { findRelByType, resolveTarget } from '../ooxml/readUtils.js';\nimport type { OoxmlTheme } from '../ooxml/themeReader.js';\nimport { parseThemeXml, readThemePart } from '../ooxml/themeReader.js';\nimport type { ExtractedFileTheme, SchemeSlot } from './types.js';\n\nconst DEFAULT_COLOR_MAP: { bg1: SchemeSlot; tx1: SchemeSlot } = { bg1: 'lt1', tx1: 'dk1' };\n\nconst SCHEME_SLOTS: readonly SchemeSlot[] = ['dk1', 'lt1', 'dk2', 'lt2'];\n\nfunction asSchemeSlot(value: string | null | undefined): SchemeSlot | undefined {\n return SCHEME_SLOTS.includes(value as SchemeSlot) ? (value as SchemeSlot) : undefined;\n}\n\n/**\n * Fallback theme lookup for packages whose theme relationship is missing or\n * unconventional: scan `[Content_Types].xml` overrides for the theme content\n * type (shared by all three formats) and parse the first match.\n */\nasync function readThemeByContentType(pkg: OoxmlPackage): Promise<OoxmlTheme | null> {\n for (const [partPath, contentType] of pkg.contentTypes.overrides) {\n if (contentType !== CONTENT_TYPE_PPTX_THEME) continue;\n const doc = await getPartXml(pkg, partPath);\n if (doc) return parseThemeXml(doc);\n }\n return null;\n}\n\nfunction toExtracted(\n sourceFormat: ExtractedFileTheme['sourceFormat'],\n theme: OoxmlTheme,\n colorMap: { bg1: SchemeSlot; tx1: SchemeSlot },\n extraWarnings: string[] = [],\n): ExtractedFileTheme {\n return {\n sourceFormat,\n ...(theme.name ? { themeName: theme.name } : {}),\n ...(theme.colors ? { colors: theme.colors } : {}),\n colorMap,\n ...(theme.fonts ? { fonts: theme.fonts } : {}),\n warnings: [...theme.warnings, ...extraWarnings],\n };\n}\n\n/**\n * DOCX: theme hangs off `word/document.xml`; an optional\n * `w:clrSchemeMapping` in `word/settings.xml` remaps bg1/t1 slots\n * (values `light1`/`dark1`/`light2`/`dark2`).\n */\nexport async function extractDocxTheme(pkg: OoxmlPackage): Promise<ExtractedFileTheme | null> {\n const theme =\n (await readThemePart(pkg, 'word/document.xml')) ?? (await readThemeByContentType(pkg));\n if (!theme) return null;\n\n let colorMap = DEFAULT_COLOR_MAP;\n const settings = await getPartXml(pkg, 'word/settings.xml');\n const mappingEls = settings?.getElementsByTagNameNS(NS_WML, 'clrSchemeMapping');\n const mapping = mappingEls && mappingEls.length > 0 ? mappingEls[0]! : null;\n if (mapping) {\n const wordSlotToScheme: Record<string, SchemeSlot> = {\n light1: 'lt1',\n dark1: 'dk1',\n light2: 'lt2',\n dark2: 'dk2',\n };\n const bg1 =\n wordSlotToScheme[\n mapping.getAttributeNS(NS_WML, 'bg1') ?? mapping.getAttribute('w:bg1') ?? ''\n ];\n const tx1 =\n wordSlotToScheme[mapping.getAttributeNS(NS_WML, 't1') ?? mapping.getAttribute('w:t1') ?? ''];\n if (bg1 && tx1) colorMap = { bg1, tx1 };\n }\n\n return toExtracted('docx', theme, colorMap);\n}\n\n/**\n * PPTX: theme hangs off the first slide master, whose `<p:clrMap>` records\n * which scheme slots back the deck's background/text (dark decks set\n * `bg1=\"dk1\" tx1=\"lt1\"`).\n */\nexport async function extractPptxTheme(pkg: OoxmlPackage): Promise<ExtractedFileTheme | null> {\n const presRels = await getPartRelationships(pkg, 'ppt/presentation.xml');\n const masterRel = findRelByType(presRels, REL_SLIDE_MASTER);\n const masterPath = masterRel ? resolveTarget('ppt', masterRel.target) : undefined;\n\n const warnings: string[] = [];\n let theme: OoxmlTheme | null = null;\n let colorMap = DEFAULT_COLOR_MAP;\n\n if (masterPath) {\n theme = await readThemePart(pkg, masterPath);\n const masterDoc = await getPartXml(pkg, masterPath);\n const clrMaps = masterDoc?.getElementsByTagNameNS(NS_PML, 'clrMap');\n const clrMap = clrMaps && clrMaps.length > 0 ? clrMaps[0]! : null;\n if (clrMap) {\n const bg1 = asSchemeSlot(clrMap.getAttribute('bg1'));\n const tx1 = asSchemeSlot(clrMap.getAttribute('tx1'));\n if (bg1 && tx1) {\n colorMap = { bg1, tx1 };\n } else if (clrMap.getAttribute('bg1') || clrMap.getAttribute('tx1')) {\n warnings.push('theme: unsupported clrMap slot mapping; using default bg1/tx1');\n }\n }\n }\n if (!theme) theme = await readThemeByContentType(pkg);\n if (!theme) return null;\n\n return toExtracted('pptx', theme, colorMap, warnings);\n}\n\n/** XLSX: theme hangs off `xl/workbook.xml`; no color remapping exists. */\nexport async function extractXlsxTheme(pkg: OoxmlPackage): Promise<ExtractedFileTheme | null> {\n const theme =\n (await readThemePart(pkg, 'xl/workbook.xml')) ?? (await readThemeByContentType(pkg));\n if (!theme) return null;\n return toExtracted('xlsx', theme, DEFAULT_COLOR_MAP);\n}\n"],"mappings":"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","names":[]}
|