@bendyline/squisq-formats 1.4.2 → 2.0.1

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 (140) hide show
  1. package/README.md +48 -2
  2. package/dist/chunk-2KPARF2P.js +99 -0
  3. package/dist/chunk-2KPARF2P.js.map +1 -0
  4. package/dist/{chunk-5LSSWZPU.js → chunk-4VUWTSGM.js} +72 -25
  5. package/dist/chunk-4VUWTSGM.js.map +1 -0
  6. package/dist/{chunk-YESS7VY3.js → chunk-ABVI556T.js} +154 -39
  7. package/dist/chunk-ABVI556T.js.map +1 -0
  8. package/dist/{chunk-WWBIKRNP.js → chunk-CRAVSMPZ.js} +13 -11
  9. package/dist/chunk-CRAVSMPZ.js.map +1 -0
  10. package/dist/chunk-FE6OJV6O.js +560 -0
  11. package/dist/chunk-FE6OJV6O.js.map +1 -0
  12. package/dist/{chunk-D7IFPWNZ.js → chunk-GVS2XXV6.js} +27 -26
  13. package/dist/chunk-GVS2XXV6.js.map +1 -0
  14. package/dist/{chunk-RTS5XBZ7.js → chunk-HTW2M27H.js} +341 -100
  15. package/dist/chunk-HTW2M27H.js.map +1 -0
  16. package/dist/{chunk-46FMDOWZ.js → chunk-LXYLOOST.js} +49 -17
  17. package/dist/chunk-LXYLOOST.js.map +1 -0
  18. package/dist/{chunk-MJGRI6XR.js → chunk-MLX2BOJC.js} +12 -7
  19. package/dist/chunk-MLX2BOJC.js.map +1 -0
  20. package/dist/chunk-NKAJPJ4G.js +106 -0
  21. package/dist/chunk-NKAJPJ4G.js.map +1 -0
  22. package/dist/{chunk-DQAZR57U.js → chunk-O3GVVND4.js} +1 -1
  23. package/dist/chunk-ODL3SSPT.js +18 -0
  24. package/dist/chunk-ODL3SSPT.js.map +1 -0
  25. package/dist/chunk-QRVN6A6E.js +127 -0
  26. package/dist/chunk-QRVN6A6E.js.map +1 -0
  27. package/dist/chunk-U32AG3G3.js +195 -0
  28. package/dist/chunk-U32AG3G3.js.map +1 -0
  29. package/dist/{chunk-EHLGMSTE.js → chunk-VJJM2SSH.js} +10 -8
  30. package/dist/chunk-VJJM2SSH.js.map +1 -0
  31. package/dist/chunk-VSYHZECT.js +778 -0
  32. package/dist/chunk-VSYHZECT.js.map +1 -0
  33. package/dist/{chunk-SHLPSADL.js → chunk-WC7WULGV.js} +81 -189
  34. package/dist/chunk-WC7WULGV.js.map +1 -0
  35. package/dist/chunk-XKUMNGBW.js +131 -0
  36. package/dist/chunk-XKUMNGBW.js.map +1 -0
  37. package/dist/chunk-YRT7GQ5Y.js +28 -0
  38. package/dist/chunk-YRT7GQ5Y.js.map +1 -0
  39. package/dist/container/index.d.ts +13 -3
  40. package/dist/container/index.js +23 -20
  41. package/dist/container/index.js.map +1 -1
  42. package/dist/docx/index.d.ts +6 -2
  43. package/dist/docx/index.js +5 -3
  44. package/dist/epub/index.d.ts +3 -1
  45. package/dist/epub/index.js +3 -3
  46. package/dist/export-D2NkylDT.d.ts +69 -0
  47. package/dist/extract-H6RXJMHP.js +15 -0
  48. package/dist/extract-H6RXJMHP.js.map +1 -0
  49. package/dist/html/index.d.ts +15 -85
  50. package/dist/html/index.js +3 -3
  51. package/dist/images-7FBWPKE3.js +7 -0
  52. package/dist/images-7FBWPKE3.js.map +1 -0
  53. package/dist/import-DTkDxHmZ.d.ts +84 -0
  54. package/dist/import-K8mfc0fz.d.ts +136 -0
  55. package/dist/index.d.ts +14 -4
  56. package/dist/index.js +33 -12
  57. package/dist/infer/index.d.ts +138 -0
  58. package/dist/infer/index.js +28 -0
  59. package/dist/infer/index.js.map +1 -0
  60. package/dist/layouts-BHrgZ5FS.d.ts +150 -0
  61. package/dist/layouts-QVPK3ZCU.js +12 -0
  62. package/dist/layouts-QVPK3ZCU.js.map +1 -0
  63. package/dist/mapTheme-IR27S6IV.js +11 -0
  64. package/dist/mapTheme-IR27S6IV.js.map +1 -0
  65. package/dist/ooxml/index.d.ts +21 -127
  66. package/dist/ooxml/index.js +31 -9
  67. package/dist/pdf/index.d.ts +3 -1
  68. package/dist/pdf/index.js +1 -1
  69. package/dist/pptx/index.d.ts +8 -108
  70. package/dist/pptx/index.js +13 -4
  71. package/dist/reader-B9L8Ucbj.d.ts +140 -0
  72. package/dist/registry/index.d.ts +60 -8
  73. package/dist/registry/index.js +9 -4
  74. package/dist/themeReader-DJKErl_j.d.ts +56 -0
  75. package/dist/xlsx/index.d.ts +6 -66
  76. package/dist/xlsx/index.js +4 -2
  77. package/dist/zipLimits-BOKCB7qk.d.ts +31 -0
  78. package/package.json +8 -2
  79. package/src/__tests__/container.test.ts +41 -0
  80. package/src/__tests__/convert.test.ts +310 -1
  81. package/src/__tests__/epub.test.ts +102 -1
  82. package/src/__tests__/html.test.ts +62 -0
  83. package/src/__tests__/inferTheme.test.ts +135 -0
  84. package/src/__tests__/lossyWarnings.test.ts +41 -0
  85. package/src/__tests__/ooxml.test.ts +76 -2
  86. package/src/__tests__/ooxmlCancellation.test.ts +113 -0
  87. package/src/__tests__/ooxmlThemeReader.test.ts +92 -0
  88. package/src/__tests__/plainHtml.test.ts +15 -1
  89. package/src/__tests__/plainHtmlBundle.test.ts +18 -0
  90. package/src/__tests__/pptxImport.test.ts +30 -0
  91. package/src/__tests__/pptxInferFixtures.ts +314 -0
  92. package/src/__tests__/pptxLayoutInfer.test.ts +395 -0
  93. package/src/__tests__/zipSafety.test.ts +317 -0
  94. package/src/container/index.ts +37 -32
  95. package/src/docx/export.ts +4 -2
  96. package/src/docx/import.ts +4 -3
  97. package/src/epub/export.ts +94 -25
  98. package/src/html/docsHtmlBundle.ts +6 -2
  99. package/src/html/htmlTemplate.ts +31 -6
  100. package/src/html/imageUtils.ts +14 -5
  101. package/src/html/index.ts +12 -1
  102. package/src/html/plainHtml.ts +7 -3
  103. package/src/html/plainHtmlBundle.ts +11 -9
  104. package/src/index.ts +23 -0
  105. package/src/infer/extract.ts +127 -0
  106. package/src/infer/index.ts +199 -0
  107. package/src/infer/mapTheme.ts +176 -0
  108. package/src/infer/types.ts +27 -0
  109. package/src/ooxml/index.ts +14 -0
  110. package/src/ooxml/readUtils.ts +44 -0
  111. package/src/ooxml/reader.ts +129 -29
  112. package/src/ooxml/themeReader.ts +197 -0
  113. package/src/ooxml/types.ts +8 -9
  114. package/src/ooxml/writer.ts +28 -10
  115. package/src/pdf/export.ts +4 -2
  116. package/src/pdf/import.ts +40 -34
  117. package/src/pptx/export.ts +4 -2
  118. package/src/pptx/import.ts +214 -32
  119. package/src/pptx/index.ts +14 -0
  120. package/src/pptx/layouts.ts +1222 -0
  121. package/src/registry/convert.ts +168 -53
  122. package/src/registry/defaultFormats.ts +135 -45
  123. package/src/registry/index.ts +6 -1
  124. package/src/registry/types.ts +69 -6
  125. package/src/shared/boundedZipArchive.ts +383 -0
  126. package/src/shared/fidelity.ts +130 -0
  127. package/src/shared/zipEntryCount.ts +151 -0
  128. package/src/shared/zipLimits.ts +296 -0
  129. package/src/shared/zipSafety.ts +19 -0
  130. package/src/xlsx/import.ts +3 -2
  131. package/dist/chunk-46FMDOWZ.js.map +0 -1
  132. package/dist/chunk-5LSSWZPU.js.map +0 -1
  133. package/dist/chunk-D7IFPWNZ.js.map +0 -1
  134. package/dist/chunk-EHLGMSTE.js.map +0 -1
  135. package/dist/chunk-MJGRI6XR.js.map +0 -1
  136. package/dist/chunk-RTS5XBZ7.js.map +0 -1
  137. package/dist/chunk-SHLPSADL.js.map +0 -1
  138. package/dist/chunk-WWBIKRNP.js.map +0 -1
  139. package/dist/chunk-YESS7VY3.js.map +0 -1
  140. /package/dist/{chunk-DQAZR57U.js.map → chunk-O3GVVND4.js.map} +0 -0
@@ -0,0 +1,150 @@
1
+ import { CustomTemplateDefinition } from '@bendyline/squisq/schemas';
2
+ import { O as OoxmlOpenOptions, a as OoxmlPackage } from './reader-B9L8Ucbj.js';
3
+
4
+ /**
5
+ * PPTX slide-layout inference — reads the layouts/masters a deck actually
6
+ * uses and, per layout, either matches it to a close built-in Squisq
7
+ * template (title, sectionHeader, twoColumn, leftFeature, …) or generates a
8
+ * reusable `CustomTemplateDefinition` from its placeholder geometry.
9
+ *
10
+ * The classifier is a deterministic three-stage waterfall — the layout's
11
+ * `type` attribute, then well-known layout names, then placeholder-set
12
+ * geometry — biased toward *not* templating: a title over a single body
13
+ * flows better as plain markdown, and only genuinely distinctive geometry
14
+ * (side-by-side content, positioned picture placeholders) becomes a custom
15
+ * template.
16
+ *
17
+ * Shared by the PPTX importer (`inferLayouts`) and the theme dialog's
18
+ * `inspectPptxLayouts` — one implementation, two consumers.
19
+ */
20
+
21
+ /** Percent-of-slide rect, 0–100 per axis (2-decimal precision). */
22
+ interface PctRect {
23
+ x: number;
24
+ y: number;
25
+ w: number;
26
+ h: number;
27
+ }
28
+ type PlaceholderKind = 'title' | 'subtitle' | 'text' | 'picture' | 'table' | 'chart' | 'other';
29
+ interface PlaceholderTextStyle {
30
+ fontSizePt?: number;
31
+ bold?: boolean;
32
+ align?: 'left' | 'center' | 'right';
33
+ anchor?: 'top' | 'middle' | 'bottom';
34
+ }
35
+ interface ExtractedPlaceholder {
36
+ kind: PlaceholderKind;
37
+ /** `p:ph@type` verbatim ('' when absent — spec default is body). */
38
+ rawType: string;
39
+ /** `p:ph@idx`, default 0. */
40
+ idx: number;
41
+ /** Geometry resolved through the layout→master inheritance chain. */
42
+ rect: PctRect;
43
+ inheritedFromMaster: boolean;
44
+ vertical: boolean;
45
+ textStyle?: PlaceholderTextStyle;
46
+ }
47
+ interface ExtractedDecoration {
48
+ shape: 'rect' | 'line';
49
+ rect: PctRect;
50
+ fill?: string;
51
+ stroke?: string;
52
+ strokeWidthPx?: number;
53
+ borderRadius?: number;
54
+ }
55
+ interface ExtractedSlideLayout {
56
+ partPath: string;
57
+ /** `p:cSld@name` ('' when absent). */
58
+ name: string;
59
+ /** `p:sldLayout@type` (ST_SlideLayoutType) when present. */
60
+ typeAttr?: string;
61
+ masterPath?: string;
62
+ masterName?: string;
63
+ /** Content placeholders — dt/ftr/sldNum/hdr chrome already excluded. */
64
+ placeholders: ExtractedPlaceholder[];
65
+ decorations: ExtractedDecoration[];
66
+ /** Number of slides in this deck using this layout (0 = defined but unused). */
67
+ slideCount: number;
68
+ }
69
+ /** Scheme-color hints for decoration fills, supplied by theme extraction. */
70
+ interface PptxColorHints {
71
+ text?: string;
72
+ background?: string;
73
+ /** `a:schemeClr@val` (accent1…, bg1, tx1, dk1, …) → resolved hex. */
74
+ schemeColors?: Record<string, string>;
75
+ }
76
+ type BuiltinParamSpec = 'titleSubtitle' | 'comparisonPairs' | 'featureImage' | 'photoGridGate';
77
+ type LayoutVerdict = {
78
+ kind: 'plain';
79
+ } | {
80
+ kind: 'skip';
81
+ } | {
82
+ kind: 'builtin';
83
+ template: string;
84
+ paramSpec?: BuiltinParamSpec;
85
+ /** For `comparisonPairs`: placeholder idx lists per column, top-to-bottom. */
86
+ columns?: {
87
+ left: number[];
88
+ right: number[];
89
+ };
90
+ } | {
91
+ kind: 'custom';
92
+ def: CustomTemplateDefinition;
93
+ };
94
+ interface AnalyzedLayout {
95
+ extracted: ExtractedSlideLayout;
96
+ verdict: LayoutVerdict;
97
+ /** Human-readable caveats: dropped regions, unsupported placeholders, … */
98
+ notes: string[];
99
+ }
100
+ interface PptxLayoutInference {
101
+ slideSize: {
102
+ cx: number;
103
+ cy: number;
104
+ };
105
+ layouts: AnalyzedLayout[];
106
+ byLayoutPath: Map<string, AnalyzedLayout>;
107
+ layoutPathBySlide: Map<string, string>;
108
+ warnings: string[];
109
+ }
110
+ interface AnalyzePptxLayoutsOptions extends OoxmlOpenOptions {
111
+ /** Also analyze layouts no slide references (default false). */
112
+ includeUnused?: boolean;
113
+ colors?: PptxColorHints;
114
+ /** Cap on generated custom templates (default 12); excess downgrades to plain. */
115
+ maxTemplates?: number;
116
+ }
117
+ /**
118
+ * Analyze the deck's slide layouts: extract placeholder geometry (with
119
+ * master inheritance), classify each layout against the built-in template
120
+ * set, and generate custom template definitions for the distinctive ones.
121
+ */
122
+ declare function analyzePptxLayouts(pkg: OoxmlPackage, options?: AnalyzePptxLayoutsOptions): Promise<PptxLayoutInference>;
123
+ interface PptxLayoutSummary {
124
+ layoutPath: string;
125
+ name: string;
126
+ masterName?: string;
127
+ typeAttr?: string;
128
+ slideCount: number;
129
+ verdict: 'builtin' | 'custom' | 'plain' | 'skip';
130
+ /** Set when verdict is 'builtin' — the close built-in alternative. */
131
+ builtinTemplate?: string;
132
+ /** Set when verdict is 'custom' — ready to save as a doc/library template. */
133
+ customTemplate?: CustomTemplateDefinition;
134
+ notes?: string[];
135
+ }
136
+ type InspectPptxLayoutsOptions = AnalyzePptxLayoutsOptions;
137
+ /**
138
+ * Inspect a deck's layouts without importing it — used by the theme dialog
139
+ * to list what a PPTX would contribute (built-in matches shown as
140
+ * informational rows; custom templates offered for confirmation).
141
+ */
142
+ declare function inspectPptxLayouts(data: ArrayBuffer | Blob, options?: InspectPptxLayoutsOptions): Promise<{
143
+ layouts: PptxLayoutSummary[];
144
+ slideSize: {
145
+ cx: number;
146
+ cy: number;
147
+ };
148
+ }>;
149
+
150
+ export { type AnalyzePptxLayoutsOptions as A, type ExtractedPlaceholder as E, type InspectPptxLayoutsOptions as I, type LayoutVerdict as L, type PptxColorHints as P, type AnalyzedLayout as a, type ExtractedSlideLayout as b, type PptxLayoutInference as c, type PptxLayoutSummary as d, analyzePptxLayouts as e, inspectPptxLayouts as i };
@@ -0,0 +1,12 @@
1
+ import {
2
+ analyzePptxLayouts,
3
+ inspectPptxLayouts
4
+ } from "./chunk-VSYHZECT.js";
5
+ import "./chunk-YRT7GQ5Y.js";
6
+ import "./chunk-WC7WULGV.js";
7
+ import "./chunk-FE6OJV6O.js";
8
+ export {
9
+ analyzePptxLayouts,
10
+ inspectPptxLayouts
11
+ };
12
+ //# sourceMappingURL=layouts-QVPK3ZCU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+ import {
2
+ colorHintsFromExtraction,
3
+ compileExtractedTheme,
4
+ extractedThemeToPartial
5
+ } from "./chunk-NKAJPJ4G.js";
6
+ export {
7
+ colorHintsFromExtraction,
8
+ compileExtractedTheme,
9
+ extractedThemeToPartial
10
+ };
11
+ //# sourceMappingURL=mapTheme-IR27S6IV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,138 +1,32 @@
1
- import JSZip from 'jszip';
1
+ import { R as Relationship, C as CoreProperties } from '../reader-B9L8Ucbj.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 } from '../reader-B9L8Ucbj.js';
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-DJKErl_j.js';
2
5
 
3
6
  /**
4
- * OOXML Types
7
+ * Shared DOM-read helpers for OOXML importers.
5
8
  *
6
- * Shared type definitions for all Office Open XML formats (DOCX, PPTX, XLSX).
7
- * These model the common structural elements of the OOXML package format:
8
- * ZIP archive, relationships, content types, and core properties.
9
+ * Every importer walks parts with `getElementsByTagNameNS` and resolves
10
+ * relationship targets relative to the referencing part; these helpers hold
11
+ * the common pieces so new readers (theme, slide layouts) don't re-implement
12
+ * them per format.
9
13
  */
10
14
 
11
15
  /**
12
- * An opened OOXML package wraps the JSZip archive plus parsed
13
- * structural metadata (content types, root relationships).
16
+ * Read a namespaced attribute with a qualified-name fallback for documents
17
+ * whose producer omitted the namespace declaration (e.g. `r:id`).
14
18
  */
15
- interface OoxmlPackage {
16
- /** The underlying JSZip archive */
17
- zip: JSZip;
18
- /** Parsed [Content_Types].xml entries */
19
- contentTypes: ContentTypeMap;
20
- /** Root-level relationships (_rels/.rels) */
21
- rootRelationships: Relationship[];
22
- }
23
- /**
24
- * Content type map built from [Content_Types].xml.
25
- * Maps part paths → content type strings plus extension defaults.
26
- */
27
- interface ContentTypeMap {
28
- /** Explicit overrides: partName → contentType */
29
- overrides: Map<string, string>;
30
- /** Default extensions: extension → contentType */
31
- defaults: Map<string, string>;
32
- }
33
- /**
34
- * An OOXML relationship entry (from any _rels/*.rels file).
35
- */
36
- interface Relationship {
37
- /** Relationship ID (e.g., "rId1") */
38
- id: string;
39
- /** Relationship type URI (e.g., "http://...officedocument/...") */
40
- type: string;
41
- /** Target path or URL */
42
- target: string;
43
- /** "Internal" (default) or "External" for hyperlinks */
44
- targetMode?: 'Internal' | 'External';
45
- }
46
- /**
47
- * Document core properties from docProps/core.xml (Dublin Core metadata).
48
- */
49
- interface CoreProperties {
50
- title?: string;
51
- subject?: string;
52
- creator?: string;
53
- keywords?: string;
54
- description?: string;
55
- lastModifiedBy?: string;
56
- revision?: string;
57
- created?: string;
58
- modified?: string;
59
- }
60
- /**
61
- * A part (file) that will be written into an OOXML package.
62
- */
63
- interface PackagePart {
64
- /** Path within the ZIP (e.g., "word/document.xml") */
65
- path: string;
66
- /** XML or text content (mutually exclusive with binaryContent) */
67
- content?: string;
68
- /** Binary content (mutually exclusive with content) */
69
- binaryContent?: ArrayBuffer | Uint8Array;
70
- /** MIME content type for [Content_Types].xml */
71
- contentType: string;
72
- }
73
- /**
74
- * A relationship to be written into a _rels/*.rels file.
75
- * `sourcePart` identifies which part the relationship belongs to.
76
- * Use "" (empty string) for root-level relationships (_rels/.rels).
77
- */
78
- interface PendingRelationship {
79
- /** The part this relationship belongs to ("" for root) */
80
- sourcePart: string;
81
- /** The relationship entry */
82
- relationship: Relationship;
83
- }
84
-
85
- /**
86
- * OOXML Package Reader
87
- *
88
- * Opens OOXML archives (.docx, .pptx, .xlsx) and parses their
89
- * structural metadata: [Content_Types].xml, relationships, and
90
- * core properties.
91
- *
92
- * Uses JSZip to unzip and the browser's DOMParser to parse XML.
93
- */
94
-
95
- /**
96
- * Open an OOXML package from raw data.
97
- *
98
- * Parses the ZIP archive, [Content_Types].xml, and root relationships.
99
- *
100
- * @param data - The raw .docx/.pptx/.xlsx file as ArrayBuffer or Blob
101
- * @returns A parsed OoxmlPackage
102
- */
103
- declare function openPackage(data: ArrayBuffer | Blob): Promise<OoxmlPackage>;
104
- /**
105
- * Parse relationships for a specific part.
106
- *
107
- * @param pkg - The OOXML package (or the zip directly)
108
- * @param partPath - The part path (e.g., "word/document.xml").
109
- * Use "" for root-level relationships (_rels/.rels).
110
- * @returns Array of relationship entries
111
- */
112
- declare function getPartRelationships(pkg: OoxmlPackage, partPath: string): Promise<Relationship[]>;
113
- /**
114
- * Extract an XML part from the package and parse it as a DOM Document.
115
- *
116
- * @param pkg - The OOXML package
117
- * @param partPath - Path within the archive (e.g., "word/document.xml")
118
- * @returns Parsed XML Document, or null if the part doesn't exist
119
- */
120
- declare function getPartXml(pkg: OoxmlPackage, partPath: string): Promise<Document | null>;
19
+ declare function attrNS(el: Element, ns: string, local: string, qualified: string): string | null;
20
+ /** Directory portion of a part path, e.g. `ppt/slides/slide1.xml` → `ppt/slides`. */
21
+ declare function baseDirOf(path: string): string;
121
22
  /**
122
- * Extract a binary part from the package (e.g., an image from word/media/).
123
- *
124
- * @param pkg - The OOXML package
125
- * @param partPath - Path within the archive
126
- * @returns The binary content, or null if the part doesn't exist
127
- */
128
- declare function getPartBinary(pkg: OoxmlPackage, partPath: string): Promise<ArrayBuffer | null>;
129
- /**
130
- * Parse core document properties from docProps/core.xml.
131
- *
132
- * @param pkg - The OOXML package
133
- * @returns Parsed core properties (all fields optional)
23
+ * Resolve a relationship target against the referencing part's directory.
24
+ * Absolute targets (leading `/`) are package-rooted; relative targets may
25
+ * climb with `..` segments (e.g. `../slideLayouts/slideLayout1.xml`).
134
26
  */
135
- declare function getCoreProperties(pkg: OoxmlPackage): Promise<CoreProperties>;
27
+ declare function resolveTarget(baseDir: string, target: string): string;
28
+ /** First relationship of the given type, if any. */
29
+ declare function findRelByType(rels: Relationship[], type: string): Relationship | undefined;
136
30
 
137
31
  /**
138
32
  * OOXML Package Writer
@@ -362,4 +256,4 @@ declare const CONTENT_TYPE_XLSX_STYLES = "application/vnd.openxmlformats-officed
362
256
  /** Relationship type: Worksheet */
363
257
  declare const REL_WORKSHEET = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
364
258
 
365
- export { CONTENT_TYPE_CORE_PROPERTIES, CONTENT_TYPE_DOCX_DOCUMENT, CONTENT_TYPE_DOCX_FONT_TABLE, CONTENT_TYPE_DOCX_FOOTNOTES, CONTENT_TYPE_DOCX_NUMBERING, CONTENT_TYPE_DOCX_SETTINGS, CONTENT_TYPE_DOCX_STYLES, CONTENT_TYPE_PPTX_PRESENTATION, CONTENT_TYPE_PPTX_SLIDE, CONTENT_TYPE_PPTX_SLIDE_LAYOUT, CONTENT_TYPE_PPTX_SLIDE_MASTER, CONTENT_TYPE_PPTX_THEME, CONTENT_TYPE_RELATIONSHIPS, CONTENT_TYPE_XLSX_STYLES, CONTENT_TYPE_XLSX_WORKBOOK, CONTENT_TYPE_XLSX_WORKSHEET, type ContentTypeMap, type CoreProperties, NS_CONTENT_TYPES, NS_CORE_PROPERTIES, NS_DC, NS_DCTERMS, NS_DRAWINGML, NS_MC, NS_PICTURE, NS_PML, NS_R, NS_RELATIONSHIPS, NS_SML, NS_WML, NS_WP_DRAWING, NS_XSI, type OoxmlPackage, type OoxmlPackageBuilder, type PackagePart, type PendingRelationship, REL_CORE_PROPERTIES, REL_EXTENDED_PROPERTIES, REL_FONT_TABLE, REL_FOOTNOTES, REL_HYPERLINK, REL_IMAGE, REL_NUMBERING, REL_OFFICE_DOCUMENT, REL_SETTINGS, REL_SLIDE, REL_SLIDE_LAYOUT, REL_SLIDE_MASTER, REL_STYLES, REL_THEME, REL_WORKSHEET, type Relationship, attrString, createPackage, escapeXml, getCoreProperties, getPartBinary, getPartRelationships, getPartXml, openPackage, selfClosingElement, textElement, xmlDeclaration, xmlElement };
259
+ export { CONTENT_TYPE_CORE_PROPERTIES, CONTENT_TYPE_DOCX_DOCUMENT, CONTENT_TYPE_DOCX_FONT_TABLE, CONTENT_TYPE_DOCX_FOOTNOTES, CONTENT_TYPE_DOCX_NUMBERING, CONTENT_TYPE_DOCX_SETTINGS, CONTENT_TYPE_DOCX_STYLES, CONTENT_TYPE_PPTX_PRESENTATION, CONTENT_TYPE_PPTX_SLIDE, CONTENT_TYPE_PPTX_SLIDE_LAYOUT, CONTENT_TYPE_PPTX_SLIDE_MASTER, CONTENT_TYPE_PPTX_THEME, CONTENT_TYPE_RELATIONSHIPS, CONTENT_TYPE_XLSX_STYLES, CONTENT_TYPE_XLSX_WORKBOOK, CONTENT_TYPE_XLSX_WORKSHEET, CoreProperties, NS_CONTENT_TYPES, NS_CORE_PROPERTIES, NS_DC, NS_DCTERMS, NS_DRAWINGML, NS_MC, NS_PICTURE, NS_PML, NS_R, NS_RELATIONSHIPS, NS_SML, NS_WML, NS_WP_DRAWING, NS_XSI, type OoxmlPackageBuilder, REL_CORE_PROPERTIES, REL_EXTENDED_PROPERTIES, REL_FONT_TABLE, REL_FOOTNOTES, REL_HYPERLINK, REL_IMAGE, REL_NUMBERING, REL_OFFICE_DOCUMENT, REL_SETTINGS, REL_SLIDE, REL_SLIDE_LAYOUT, REL_SLIDE_MASTER, REL_STYLES, REL_THEME, REL_WORKSHEET, Relationship, attrNS, attrString, baseDirOf, createPackage, escapeXml, findRelByType, resolveTarget, selfClosingElement, textElement, xmlDeclaration, xmlElement };
@@ -1,3 +1,24 @@
1
+ import {
2
+ parseThemeXml,
3
+ readThemePart
4
+ } from "../chunk-XKUMNGBW.js";
5
+ import {
6
+ attrNS,
7
+ baseDirOf,
8
+ findRelByType,
9
+ resolveTarget
10
+ } from "../chunk-YRT7GQ5Y.js";
11
+ import {
12
+ createPackage
13
+ } from "../chunk-U32AG3G3.js";
14
+ import {
15
+ attrString,
16
+ escapeXml,
17
+ selfClosingElement,
18
+ textElement,
19
+ xmlDeclaration,
20
+ xmlElement
21
+ } from "../chunk-U4MRIFKL.js";
1
22
  import {
2
23
  CONTENT_TYPE_CORE_PROPERTIES,
3
24
  CONTENT_TYPE_DOCX_DOCUMENT,
@@ -44,21 +65,15 @@ import {
44
65
  REL_STYLES,
45
66
  REL_THEME,
46
67
  REL_WORKSHEET,
47
- createPackage,
48
68
  getCoreProperties,
49
69
  getPartBinary,
50
70
  getPartRelationships,
51
71
  getPartXml,
52
72
  openPackage
53
- } from "../chunk-SHLPSADL.js";
73
+ } from "../chunk-WC7WULGV.js";
54
74
  import {
55
- attrString,
56
- escapeXml,
57
- selfClosingElement,
58
- textElement,
59
- xmlDeclaration,
60
- xmlElement
61
- } from "../chunk-U4MRIFKL.js";
75
+ ZipSafetyError
76
+ } from "../chunk-FE6OJV6O.js";
62
77
  export {
63
78
  CONTENT_TYPE_CORE_PROPERTIES,
64
79
  CONTENT_TYPE_DOCX_DOCUMENT,
@@ -105,14 +120,21 @@ export {
105
120
  REL_STYLES,
106
121
  REL_THEME,
107
122
  REL_WORKSHEET,
123
+ ZipSafetyError,
124
+ attrNS,
108
125
  attrString,
126
+ baseDirOf,
109
127
  createPackage,
110
128
  escapeXml,
129
+ findRelByType,
111
130
  getCoreProperties,
112
131
  getPartBinary,
113
132
  getPartRelationships,
114
133
  getPartXml,
115
134
  openPackage,
135
+ parseThemeXml,
136
+ readThemePart,
137
+ resolveTarget,
116
138
  selfClosingElement,
117
139
  textElement,
118
140
  xmlDeclaration,
@@ -1,4 +1,4 @@
1
- import { Doc } from '@bendyline/squisq/schemas';
1
+ import { ThemeRegistry, Doc } from '@bendyline/squisq/schemas';
2
2
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
3
3
  import { ContentContainer } from '@bendyline/squisq/storage';
4
4
 
@@ -45,6 +45,8 @@ interface PdfExportOptions {
45
45
  * Font changes are not supported (pdf-lib uses standard 14 PDF fonts only).
46
46
  */
47
47
  themeId?: string;
48
+ /** Explicit caller-owned registry for non-document custom themes. */
49
+ themeRegistry?: ThemeRegistry;
48
50
  }
49
51
  /**
50
52
  * Convert a MarkdownDocument to a PDF ArrayBuffer.
package/dist/pdf/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  pdfToContainer,
6
6
  pdfToDoc,
7
7
  pdfToMarkdownDoc
8
- } from "../chunk-D7IFPWNZ.js";
8
+ } from "../chunk-GVS2XXV6.js";
9
9
  import "../chunk-SSUPBUF5.js";
10
10
  export {
11
11
  configurePdfWorker,
@@ -1,111 +1,11 @@
1
+ import { a as PptxImportOptions } from '../import-K8mfc0fz.js';
2
+ export { P as PptxExportOptions, d as docToPptx, m as markdownDocToPptx, b as pptxToContainer, p as pptxToMarkdownDoc } from '../import-K8mfc0fz.js';
1
3
  import { Doc } from '@bendyline/squisq/schemas';
2
- import { MarkdownDocument } from '@bendyline/squisq/markdown';
3
- import { ContentContainer } from '@bendyline/squisq/storage';
4
-
5
- /**
6
- * PPTX Export
7
- *
8
- * Converts a squisq MarkdownDocument (or Doc) into a .pptx file
9
- * by generating PresentationML + DrawingML XML and assembling the
10
- * OOXML package.
11
- *
12
- * Slide segmentation: each H1 or H2 heading starts a new slide.
13
- * The heading becomes the slide title; content below becomes the body.
14
- *
15
- * Supports:
16
- * - Theme-based styling (background, text colors, fonts from squisq themes)
17
- * - Image embedding (pass images as ArrayBuffers via options)
18
- * - Inline formatting (bold, italic, strikethrough, code, links)
19
- * - Lists, code blocks, blockquotes, tables, math
20
- *
21
- * No third-party pptx library — all XML is generated directly using
22
- * the shared ooxml/ infrastructure.
23
- *
24
- * @example
25
- * ```ts
26
- * import { parseMarkdown } from '@bendyline/squisq/markdown';
27
- * import { markdownDocToPptx } from '@bendyline/squisq-formats/pptx';
28
- *
29
- * const md = parseMarkdown('# Slide 1\n\nHello world\n\n## Slide 2\n\nMore content');
30
- * const blob = await markdownDocToPptx(md, { themeId: 'documentary' });
31
- * ```
32
- */
33
-
34
- /**
35
- * Options for PPTX export.
36
- */
37
- interface PptxExportOptions {
38
- /** Presentation title (appears in core properties) */
39
- title?: string;
40
- /** Presentation author */
41
- author?: string;
42
- /** Presentation description */
43
- description?: string;
44
- /**
45
- * Which heading depth triggers a new slide.
46
- * - `'h1'` — only H1 headings start slides
47
- * - `'h2'` — H1 and H2 headings start slides (default)
48
- * - `'heading'` — any heading (H1–H6) starts a slide
49
- */
50
- slideBreak?: 'h1' | 'h2' | 'heading';
51
- /** Default body font family. Default: "Calibri" */
52
- defaultFont?: string;
53
- /** Default body font size in points. Default: 18 */
54
- defaultFontSize?: number;
55
- /**
56
- * Squisq theme ID to apply (e.g., 'documentary', 'cinematic', 'bold').
57
- * Controls slide background, text colors, and fonts.
58
- * Falls back to the document's frontmatter `themeId` if not set here.
59
- */
60
- themeId?: string;
61
- /**
62
- * Image data keyed by the path/URL used in markdown.
63
- * When provided, images are embedded as picture shapes instead of
64
- * showing `[Image: alt]` placeholders.
65
- */
66
- images?: Map<string, ArrayBuffer>;
67
- }
68
- /**
69
- * Convert a MarkdownDocument to a .pptx ArrayBuffer.
70
- */
71
- declare function markdownDocToPptx(doc: MarkdownDocument, options?: PptxExportOptions): Promise<ArrayBuffer>;
72
- /**
73
- * Convert a squisq Doc to a .pptx ArrayBuffer.
74
- *
75
- * Convenience wrapper: Doc -> MarkdownDocument -> PPTX.
76
- */
77
- declare function docToPptx(doc: Doc, options?: PptxExportOptions): Promise<ArrayBuffer>;
78
-
79
- /**
80
- * PPTX import — PresentationML (.pptx) → MarkdownDocument.
81
- *
82
- * Reuses the shared ooxml/ reader. Reads slide order from
83
- * `ppt/presentation.xml` (`<p:sldIdLst>`), resolves each slide part via
84
- * relationships, and converts each slide to: an H2 of the title placeholder
85
- * (or "Slide N"), the remaining text as a bullet list, and any slide tables
86
- * (`<a:tbl>`) as markdown tables. Text lives in the DrawingML namespace
87
- * (`a:p` / `a:r` / `a:t`) inside PresentationML shapes (`p:sp`).
88
- */
89
-
90
- interface PptxImportOptions {
91
- /**
92
- * Whether to extract embedded slide images into the document as image nodes
93
- * (referencing `images/imageN.ext`). When false, pictures are ignored so the
94
- * markdown never carries dangling image references with no backing container.
95
- * `pptxToContainer` forces this on. Default: false.
96
- */
97
- extractImages?: boolean;
98
- }
99
- declare function pptxToMarkdownDoc(data: ArrayBuffer | Blob, options?: PptxImportOptions): Promise<MarkdownDocument>;
100
- /**
101
- * Convert a .pptx file to a ContentContainer with markdown + extracted images.
102
- *
103
- * The container holds the primary markdown document plus every embedded slide
104
- * image under `images/` (e.g. `images/image1.png`). Image extraction is always
105
- * forced on here so the markdown's image references resolve inside the
106
- * container. Mirrors `docxToContainer`.
107
- */
108
- declare function pptxToContainer(data: ArrayBuffer | Blob, options?: PptxImportOptions): Promise<ContentContainer>;
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-BHrgZ5FS.js';
5
+ import '@bendyline/squisq/markdown';
6
+ import '../reader-B9L8Ucbj.js';
7
+ import '../zipLimits-BOKCB7qk.js';
8
+ import '@bendyline/squisq/storage';
109
9
 
110
10
  /**
111
11
  * @bendyline/squisq-formats PPTX Module
@@ -129,4 +29,4 @@ declare function pptxToContainer(data: ArrayBuffer | Blob, options?: PptxImportO
129
29
  */
130
30
  declare function pptxToDoc(data: ArrayBuffer | Blob, options?: PptxImportOptions): Promise<Doc>;
131
31
 
132
- export { type PptxExportOptions, type PptxImportOptions, docToPptx, markdownDocToPptx, pptxToContainer, pptxToDoc, pptxToMarkdownDoc };
32
+ export { PptxImportOptions, pptxToDoc };
@@ -4,16 +4,25 @@ import {
4
4
  pptxToContainer,
5
5
  pptxToDoc,
6
6
  pptxToMarkdownDoc
7
- } from "../chunk-YESS7VY3.js";
7
+ } from "../chunk-ABVI556T.js";
8
+ import {
9
+ analyzePptxLayouts,
10
+ inspectPptxLayouts
11
+ } from "../chunk-VSYHZECT.js";
8
12
  import "../chunk-6M7Z25LA.js";
9
13
  import "../chunk-PN52A5AA.js";
10
- import "../chunk-SHLPSADL.js";
14
+ import "../chunk-YRT7GQ5Y.js";
15
+ import "../chunk-U32AG3G3.js";
11
16
  import "../chunk-U4MRIFKL.js";
17
+ import "../chunk-WC7WULGV.js";
18
+ import "../chunk-FE6OJV6O.js";
12
19
  import "../chunk-SSUPBUF5.js";
13
- import "../chunk-MJGRI6XR.js";
14
- import "../chunk-DQAZR57U.js";
20
+ import "../chunk-MLX2BOJC.js";
21
+ import "../chunk-O3GVVND4.js";
15
22
  export {
23
+ analyzePptxLayouts,
16
24
  docToPptx,
25
+ inspectPptxLayouts,
17
26
  markdownDocToPptx,
18
27
  pptxToContainer,
19
28
  pptxToDoc,