docgen-utils 1.0.5

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 (88) hide show
  1. package/README.md +118 -0
  2. package/dist/bundle.js +36086 -0
  3. package/dist/bundle.min.js +197 -0
  4. package/dist/cli.js +47432 -0
  5. package/dist/index.d.ts +9 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +9 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/packages/cli/commands/export-docs.d.ts +5 -0
  10. package/dist/packages/cli/commands/export-docs.d.ts.map +1 -0
  11. package/dist/packages/cli/commands/export-docs.js +24 -0
  12. package/dist/packages/cli/commands/export-docs.js.map +1 -0
  13. package/dist/packages/cli/commands/export-slides.d.ts +5 -0
  14. package/dist/packages/cli/commands/export-slides.d.ts.map +1 -0
  15. package/dist/packages/cli/commands/export-slides.js +86 -0
  16. package/dist/packages/cli/commands/export-slides.js.map +1 -0
  17. package/dist/packages/cli/commands/import-docx.d.ts +5 -0
  18. package/dist/packages/cli/commands/import-docx.d.ts.map +1 -0
  19. package/dist/packages/cli/commands/import-docx.js +27 -0
  20. package/dist/packages/cli/commands/import-docx.js.map +1 -0
  21. package/dist/packages/cli/commands/import-pptx.d.ts +5 -0
  22. package/dist/packages/cli/commands/import-pptx.d.ts.map +1 -0
  23. package/dist/packages/cli/commands/import-pptx.js +44 -0
  24. package/dist/packages/cli/commands/import-pptx.js.map +1 -0
  25. package/dist/packages/cli/index.d.ts +11 -0
  26. package/dist/packages/cli/index.d.ts.map +1 -0
  27. package/dist/packages/cli/index.js +103 -0
  28. package/dist/packages/cli/index.js.map +1 -0
  29. package/dist/packages/docs/common.d.ts +183 -0
  30. package/dist/packages/docs/common.d.ts.map +1 -0
  31. package/dist/packages/docs/common.js +27 -0
  32. package/dist/packages/docs/common.js.map +1 -0
  33. package/dist/packages/docs/convert.d.ts +7 -0
  34. package/dist/packages/docs/convert.d.ts.map +1 -0
  35. package/dist/packages/docs/convert.js +1399 -0
  36. package/dist/packages/docs/convert.js.map +1 -0
  37. package/dist/packages/docs/create-document.d.ts +30 -0
  38. package/dist/packages/docs/create-document.d.ts.map +1 -0
  39. package/dist/packages/docs/create-document.js +170 -0
  40. package/dist/packages/docs/create-document.js.map +1 -0
  41. package/dist/packages/docs/export.d.ts +57 -0
  42. package/dist/packages/docs/export.d.ts.map +1 -0
  43. package/dist/packages/docs/export.js +430 -0
  44. package/dist/packages/docs/export.js.map +1 -0
  45. package/dist/packages/docs/import-docx.d.ts +13 -0
  46. package/dist/packages/docs/import-docx.d.ts.map +1 -0
  47. package/dist/packages/docs/import-docx.js +2299 -0
  48. package/dist/packages/docs/import-docx.js.map +1 -0
  49. package/dist/packages/docs/parse.d.ts +6 -0
  50. package/dist/packages/docs/parse.d.ts.map +1 -0
  51. package/dist/packages/docs/parse.js +4253 -0
  52. package/dist/packages/docs/parse.js.map +1 -0
  53. package/dist/packages/shared/dom-parser-shim.d.ts +30 -0
  54. package/dist/packages/shared/dom-parser-shim.d.ts.map +1 -0
  55. package/dist/packages/shared/dom-parser-shim.js +152 -0
  56. package/dist/packages/shared/dom-parser-shim.js.map +1 -0
  57. package/dist/packages/slides/common.d.ts +325 -0
  58. package/dist/packages/slides/common.d.ts.map +1 -0
  59. package/dist/packages/slides/common.js +12 -0
  60. package/dist/packages/slides/common.js.map +1 -0
  61. package/dist/packages/slides/convert.d.ts +35 -0
  62. package/dist/packages/slides/convert.d.ts.map +1 -0
  63. package/dist/packages/slides/convert.js +308 -0
  64. package/dist/packages/slides/convert.js.map +1 -0
  65. package/dist/packages/slides/createPresentation.d.ts +51 -0
  66. package/dist/packages/slides/createPresentation.d.ts.map +1 -0
  67. package/dist/packages/slides/createPresentation.js +265 -0
  68. package/dist/packages/slides/createPresentation.js.map +1 -0
  69. package/dist/packages/slides/export.d.ts +24 -0
  70. package/dist/packages/slides/export.d.ts.map +1 -0
  71. package/dist/packages/slides/export.js +52 -0
  72. package/dist/packages/slides/export.js.map +1 -0
  73. package/dist/packages/slides/import-pptx.d.ts +13 -0
  74. package/dist/packages/slides/import-pptx.d.ts.map +1 -0
  75. package/dist/packages/slides/import-pptx.js +619 -0
  76. package/dist/packages/slides/import-pptx.js.map +1 -0
  77. package/dist/packages/slides/parse.d.ts +45 -0
  78. package/dist/packages/slides/parse.d.ts.map +1 -0
  79. package/dist/packages/slides/parse.js +1185 -0
  80. package/dist/packages/slides/parse.js.map +1 -0
  81. package/dist/packages/slides/transform.d.ts +37 -0
  82. package/dist/packages/slides/transform.d.ts.map +1 -0
  83. package/dist/packages/slides/transform.js +140 -0
  84. package/dist/packages/slides/transform.js.map +1 -0
  85. package/dist/packages/slides/vendor/VENDORING.md +58 -0
  86. package/dist/packages/slides/vendor/pptxgen.d.ts +805 -0
  87. package/dist/packages/slides/vendor/pptxgen.js +7442 -0
  88. package/package.json +57 -0
@@ -0,0 +1,325 @@
1
+ /**
2
+ * Intermediate representation for slide elements.
3
+ *
4
+ * These types describe the data produced by `extractSlideData()` (in html2pptx.js)
5
+ * and consumed by the PptxGenJS rendering layer. They form a clean boundary between
6
+ * HTML parsing and PPTX generation.
7
+ *
8
+ * This is the "common language" of the slide pipeline: parsers produce `ParsedSlide`,
9
+ * and renderers consume it to call PptxGenJS APIs.
10
+ */
11
+ import type { GradientFillProps, ShapeFillProps, HAlign, VAlign } from './vendor/pptxgen.d.ts';
12
+ /** Element position and size in inches. */
13
+ export interface Position {
14
+ /** Horizontal position from left edge (inches). */
15
+ x: number;
16
+ /** Vertical position from top edge (inches). */
17
+ y: number;
18
+ /** Width (inches). */
19
+ w: number;
20
+ /** Height (inches). */
21
+ h: number;
22
+ }
23
+ /** Options for a single text run within a rich-text array. */
24
+ export interface TextRunOptions {
25
+ bold?: boolean;
26
+ italic?: boolean;
27
+ underline?: boolean;
28
+ color?: string;
29
+ fontSize?: number;
30
+ fontFace?: string;
31
+ transparency?: number;
32
+ /** Insert a line break after this run. */
33
+ breakLine?: boolean;
34
+ /** Insert a soft line-break (shift+enter) before this run's content. */
35
+ softBreakBefore?: boolean;
36
+ /** Bullet options for list items. */
37
+ bullet?: boolean | {
38
+ indent?: number;
39
+ };
40
+ }
41
+ /**
42
+ * A single run of text with optional inline formatting.
43
+ *
44
+ * Used in rich-text elements (paragraphs with `<b>`, `<i>`, `<span>`, etc.)
45
+ * and in list items.
46
+ */
47
+ export interface TextRun {
48
+ text: string;
49
+ options: TextRunOptions;
50
+ }
51
+ /**
52
+ * Shared style properties applied to text-bearing elements.
53
+ *
54
+ * These are the CSS-derived style values that `extractSlideData()` computes
55
+ * from `getComputedStyle()` on each DOM element.
56
+ */
57
+ export interface ElementStyle {
58
+ /** Font size (points). */
59
+ fontSize?: number;
60
+ /** Font family name (first family from CSS font-family, quotes stripped). */
61
+ fontFace?: string;
62
+ /** Text color (6-char hex, no '#'). `null` when `fontFill` is used instead. */
63
+ color?: string | null;
64
+ /** Bold weight. */
65
+ bold?: boolean;
66
+ /** Italic style. */
67
+ italic?: boolean;
68
+ /** Underline decoration. */
69
+ underline?: boolean;
70
+ /** Horizontal text alignment. */
71
+ align?: HAlign;
72
+ /**
73
+ * Vertical text alignment within the text box.
74
+ * Note: our patched PptxGenJS defaults to 'top' (not 'center').
75
+ */
76
+ valign?: VAlign | null;
77
+ /** Line spacing (points). Typically `fontSize * lineHeightMultiplier`. */
78
+ lineSpacing?: number;
79
+ /** Space before paragraph (points). */
80
+ paraSpaceBefore?: number;
81
+ /** Space after paragraph (points). */
82
+ paraSpaceAfter?: number;
83
+ /**
84
+ * Margin / padding as [left, right, bottom, top] in points.
85
+ * Derived from CSS `padding-*` properties.
86
+ */
87
+ margin?: [number, number, number, number];
88
+ /** Rotation angle (degrees, 0-359). `null` or `undefined` = no rotation. */
89
+ rotate?: number;
90
+ /** Text transparency (percent 0-100). Derived from rgba alpha channel. */
91
+ transparency?: number | null;
92
+ /**
93
+ * Gradient text fill (CUSTOM PATCH).
94
+ * When set, `color` is ignored and the text is filled with a gradient.
95
+ * Produced when CSS `-webkit-background-clip: text` is detected.
96
+ */
97
+ fontFill?: ShapeFillProps | null;
98
+ /**
99
+ * Internal inset for the text box (points).
100
+ * Set to 0 for shapes that contain text.
101
+ */
102
+ inset?: number;
103
+ /**
104
+ * Whether text should wrap within the text box.
105
+ * `false` for narrow or nowrap containers.
106
+ */
107
+ wrap?: boolean;
108
+ }
109
+ /** Line/border on a shape element. */
110
+ export interface ShapeLine {
111
+ /** Border color (6-char hex). */
112
+ color: string;
113
+ /** Border width (points). */
114
+ width: number;
115
+ }
116
+ /** Shadow on a shape element. Derived from CSS `box-shadow`. */
117
+ export interface ShapeShadow {
118
+ /** Shadow type (always 'outer' from CSS box-shadow). */
119
+ type: string;
120
+ /** Shadow angle (degrees 0-359). */
121
+ angle: number;
122
+ /** Blur radius (points). */
123
+ blur: number;
124
+ /** Shadow color (6-char hex). */
125
+ color: string;
126
+ /** Shadow offset (points). */
127
+ offset: number;
128
+ /** Shadow opacity (0.0-1.0). */
129
+ opacity: number;
130
+ }
131
+ /** Visual properties of a shape element (DIV or SPAN with background/border). */
132
+ export interface ShapeProperties {
133
+ /** Solid fill color (hex). `null` if no background color. */
134
+ fill: string | null;
135
+ /** Gradient fill. `null` if no gradient. */
136
+ gradient: GradientFillProps | null;
137
+ /** Background transparency (percent 0-100). `null` if opaque. */
138
+ transparency: number | null;
139
+ /** Uniform border. `null` if no border or non-uniform borders. */
140
+ line: ShapeLine | null;
141
+ /** Rounded corner radius (inches). 0 for square corners. */
142
+ rectRadius: number;
143
+ /** Shadow. `null` if no shadow. */
144
+ shadow: ShapeShadow | null;
145
+ }
146
+ /** Image sizing/fit mode, derived from CSS `object-fit`. */
147
+ export interface ImageSizing {
148
+ type: 'contain' | 'cover' | 'crop';
149
+ /** Background position string (for background images). */
150
+ position?: string;
151
+ }
152
+ /**
153
+ * A text element: `<p>`, `<h1>` through `<h6>`.
154
+ *
155
+ * The `type` field carries the original HTML tag name in lowercase.
156
+ * `text` is either a plain string (for simple text) or an array of TextRun
157
+ * objects (for text with inline formatting like `<b>`, `<i>`, `<span>`).
158
+ */
159
+ export interface TextElement {
160
+ type: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
161
+ /** Plain string or array of rich-text runs. */
162
+ text: string | TextRun[];
163
+ position: Position;
164
+ style: ElementStyle;
165
+ }
166
+ /**
167
+ * A shape element: `<div>` or `<span>` with a background color, gradient,
168
+ * border, or shadow.
169
+ *
170
+ * Shapes may contain text (single child text element) or rich-text runs
171
+ * (multiple formatted child elements).
172
+ */
173
+ export interface ShapeElement {
174
+ type: 'shape';
175
+ /** Plain text content of the shape (if single text child). */
176
+ text: string;
177
+ /** Rich-text runs (if multiple formatted text children). `null` otherwise. */
178
+ textRuns: TextRun[] | null;
179
+ /** Text style (alignment, font, color, etc.). `null` if no text. */
180
+ style: ElementStyle | null;
181
+ position: Position;
182
+ /** Visual shape properties (fill, gradient, border, shadow, rounding). */
183
+ shape: ShapeProperties;
184
+ }
185
+ /**
186
+ * An image element: `<img>`.
187
+ *
188
+ * For regular images positioned within the slide content.
189
+ */
190
+ export interface ImageElement {
191
+ type: 'image';
192
+ /** Image source URL or data URI. */
193
+ src: string;
194
+ position: Position;
195
+ /** Image sizing (object-fit mode). `null` for default sizing. */
196
+ sizing: ImageSizing | null;
197
+ /**
198
+ * Rounded corner radius (inches). CUSTOM PATCH.
199
+ * Detected from ancestor elements with `overflow: hidden` + `border-radius`.
200
+ */
201
+ rectRadius?: number;
202
+ }
203
+ /**
204
+ * A full-slide background image: an `<img>` that covers >= 95% of the slide
205
+ * and is positioned near the origin.
206
+ *
207
+ * These are rendered first (before other elements) to appear behind everything.
208
+ */
209
+ export interface SlideBackgroundImageElement {
210
+ type: 'slideBackgroundImage';
211
+ src: string;
212
+ position: Position;
213
+ sizing: ImageSizing | null;
214
+ rectRadius?: number;
215
+ }
216
+ /**
217
+ * A background image on a `<div>` (CSS `background-image: url(...)`).
218
+ */
219
+ export interface BackgroundImageElement {
220
+ type: 'backgroundImage';
221
+ src: string;
222
+ position: Position;
223
+ sizing: ImageSizing | null;
224
+ }
225
+ /**
226
+ * A border line element.
227
+ *
228
+ * Produced when a `<div>` has non-uniform borders (e.g. only a top border).
229
+ * Each individual border side is rendered as a separate line.
230
+ */
231
+ export interface LineElement {
232
+ type: 'line';
233
+ /** Start X (inches). */
234
+ x1: number;
235
+ /** Start Y (inches). */
236
+ y1: number;
237
+ /** End X (inches). */
238
+ x2: number;
239
+ /** End Y (inches). */
240
+ y2: number;
241
+ /** Line width (points). */
242
+ width: number;
243
+ /** Line color (6-char hex). */
244
+ color: string;
245
+ }
246
+ /**
247
+ * A bullet list element: `<ul>` or `<ol>`.
248
+ *
249
+ * All list items are flattened into a single `items` array of TextRun objects.
250
+ * Bullet formatting is applied via `TextRunOptions.bullet`.
251
+ * Line breaks between items use `TextRunOptions.breakLine`.
252
+ */
253
+ export interface ListElement {
254
+ type: 'list';
255
+ /** Flattened array of text runs for all list items. */
256
+ items: TextRun[];
257
+ position: Position;
258
+ style: ElementStyle;
259
+ }
260
+ /**
261
+ * Discriminated union of all slide element types.
262
+ *
263
+ * Use the `type` field to narrow:
264
+ * ```ts
265
+ * if (element.type === 'shape') {
266
+ * element.shape.fill; // ShapeProperties is available
267
+ * }
268
+ * ```
269
+ */
270
+ export type SlideElement = TextElement | ShapeElement | ImageElement | SlideBackgroundImageElement | BackgroundImageElement | LineElement | ListElement;
271
+ /** Solid color background. */
272
+ export interface ColorBackground {
273
+ type: 'color';
274
+ /** Hex color value (6-char, no '#'). */
275
+ value: string;
276
+ }
277
+ /** Gradient background. */
278
+ export interface GradientBackground {
279
+ type: 'gradient';
280
+ gradient: GradientFillProps;
281
+ }
282
+ /** Image background. */
283
+ export interface ImageBackground {
284
+ type: 'image';
285
+ /** Image URL or data URI path. */
286
+ path: string;
287
+ }
288
+ /** Slide background: solid color, gradient, or image. */
289
+ export type SlideBackground = ColorBackground | GradientBackground | ImageBackground;
290
+ /**
291
+ * A placeholder region on the slide.
292
+ *
293
+ * Placeholders are empty regions (elements with class="placeholder") that
294
+ * callers can use to position charts, tables, or other dynamic content
295
+ * after the static HTML is converted.
296
+ */
297
+ export interface Placeholder {
298
+ /** Element ID (or auto-generated "placeholder-N"). */
299
+ id: string;
300
+ /** X position (inches). */
301
+ x: number;
302
+ /** Y position (inches). */
303
+ y: number;
304
+ /** Width (inches). */
305
+ w: number;
306
+ /** Height (inches). */
307
+ h: number;
308
+ }
309
+ /**
310
+ * The complete parsed representation of a single HTML slide.
311
+ *
312
+ * This is the output of `extractSlideData()` and the input to the
313
+ * PptxGenJS rendering pipeline (`addBackground()` + `addElements()`).
314
+ */
315
+ export interface ParsedSlide {
316
+ /** Slide background (color, gradient, or image). */
317
+ background: SlideBackground;
318
+ /** All visual elements on the slide, in render order. */
319
+ elements: SlideElement[];
320
+ /** Placeholder regions for dynamic content injection. */
321
+ placeholders: Placeholder[];
322
+ /** Validation warnings/errors from parsing. */
323
+ errors: string[];
324
+ }
325
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../packages/slides/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,MAAM,EACP,MAAM,uBAAuB,CAAC;AAM/B,2CAA2C;AAC3C,MAAM,WAAW,QAAQ;IACvB,mDAAmD;IACnD,CAAC,EAAE,MAAM,CAAC;IACV,gDAAgD;IAChD,CAAC,EAAE,MAAM,CAAC;IACV,sBAAsB;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,uBAAuB;IACvB,CAAC,EAAE,MAAM,CAAC;CACX;AAMD,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CA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MAAM,CAAC;IACV,sBAAsB;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,uBAAuB;IACvB,CAAC,EAAE,MAAM,CAAC;CACX;AAMD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,UAAU,EAAE,eAAe,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,yDAAyD;IACzD,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Intermediate representation for slide elements.
3
+ *
4
+ * These types describe the data produced by `extractSlideData()` (in html2pptx.js)
5
+ * and consumed by the PptxGenJS rendering layer. They form a clean boundary between
6
+ * HTML parsing and PPTX generation.
7
+ *
8
+ * This is the "common language" of the slide pipeline: parsers produce `ParsedSlide`,
9
+ * and renderers consume it to call PptxGenJS APIs.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../packages/slides/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Convert parsed slide data into PptxGenJS slide elements.
3
+ *
4
+ * This is a faithful TypeScript port of the `addBackground()`, `addElements()`,
5
+ * and `fetchImageAsDataUrl()` functions from `dist/html2pptx.js`.
6
+ *
7
+ * It consumes the intermediate representation defined in `./common.ts` and calls
8
+ * the PptxGenJS Slide API to render backgrounds, images, shapes, text, and lists.
9
+ */
10
+ import type { Slide } from './vendor/pptxgen.d.ts';
11
+ import type { SlideBackground, SlideElement } from './common';
12
+ /**
13
+ * Download an external image and convert it to a base64 data URL using fetch.
14
+ *
15
+ * Throws on network errors or non-OK responses.
16
+ */
17
+ export declare function fetchImageAsDataUrl(url: string): Promise<string>;
18
+ /**
19
+ * Apply a slide background (color, gradient, or image) to a PptxGenJS Slide.
20
+ */
21
+ export declare function applyBackground(background: SlideBackground, slide: Slide): Promise<void>;
22
+ /**
23
+ * Add all slide elements to a PptxGenJS Slide.
24
+ *
25
+ * Performs TWO passes over the elements array:
26
+ * 1. First pass - adds `slideBackgroundImage` elements (rendered behind everything).
27
+ * 2. Second pass - adds all other element types (image, backgroundImage, line, shape, list, text).
28
+ *
29
+ * @param elements - The parsed slide elements array.
30
+ * @param slide - The target PptxGenJS Slide instance.
31
+ * @param pres - The PptxGenJS presentation instance (needed for `pres.ShapeType`).
32
+ * Typed as `any` because `ShapeType` is a runtime property.
33
+ */
34
+ export declare function addElementsToSlide(elements: SlideElement[], slide: Slide, pres: any): Promise<void>;
35
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../packages/slides/convert.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,KAAK,EAIN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAEb,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBtE;AAMD;;GAEG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,IAAI,CAAC,CAkBf;AAgCD;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,YAAY,EAAE,EACxB,KAAK,EAAE,KAAK,EAEZ,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,IAAI,CAAC,CAsLf"}