@ohos-ports/slides-grab 1.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README-ko.md +292 -0
  3. package/README.md +301 -0
  4. package/bin/ohos-postinstall.cjs +118 -0
  5. package/bin/ppt-agent.js +620 -0
  6. package/convert.cjs +20 -0
  7. package/native/@img/sharp-libvips-openharmony-arm64/lib/glib-2.0/include/glibconfig.h +220 -0
  8. package/native/@img/sharp-libvips-openharmony-arm64/lib/index.js +1 -0
  9. package/native/@img/sharp-libvips-openharmony-arm64/lib/libexpat.so +0 -0
  10. package/native/@img/sharp-libvips-openharmony-arm64/lib/libffi.so +0 -0
  11. package/native/@img/sharp-libvips-openharmony-arm64/lib/libjpeg.so +0 -0
  12. package/native/@img/sharp-libvips-openharmony-arm64/lib/libpcre2-8.so.0 +0 -0
  13. package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips-cpp.so.42.20.3 +0 -0
  14. package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips.so.42.20.3 +0 -0
  15. package/native/@img/sharp-libvips-openharmony-arm64/package.json +13 -0
  16. package/native/@img/sharp-openharmony-arm64/lib/sharp-openharmony-arm64.node +0 -0
  17. package/native/@img/sharp-openharmony-arm64/package.json +16 -0
  18. package/package.json +95 -0
  19. package/runtimes/claude-code/agents/design-critic-agent.md +23 -0
  20. package/runtimes/codex/agents/slides-grab-design-critic.md +22 -0
  21. package/scripts/build-viewer.js +444 -0
  22. package/scripts/design-gate.js +258 -0
  23. package/scripts/download-video.js +213 -0
  24. package/scripts/editor-server.js +1167 -0
  25. package/scripts/figma-export.js +169 -0
  26. package/scripts/generate-image.js +116 -0
  27. package/scripts/generate-images.js +164 -0
  28. package/scripts/html2pdf.js +822 -0
  29. package/scripts/html2png.js +246 -0
  30. package/scripts/html2pptx.js +162 -0
  31. package/scripts/import-template.js +86 -0
  32. package/scripts/install-runtime.js +216 -0
  33. package/scripts/render-tldraw.js +44 -0
  34. package/scripts/validate-slides.js +221 -0
  35. package/skills/slides-grab/SKILL.md +65 -0
  36. package/skills/slides-grab/references/presentation-workflow-reference.md +61 -0
  37. package/skills/slides-grab-card-news/SKILL.md +35 -0
  38. package/skills/slides-grab-design/SKILL.md +88 -0
  39. package/skills/slides-grab-design/references/beautiful-slide-defaults.md +88 -0
  40. package/skills/slides-grab-design/references/design-gate.md +349 -0
  41. package/skills/slides-grab-design/references/design-rules.md +76 -0
  42. package/skills/slides-grab-design/references/design-system-full.md +568 -0
  43. package/skills/slides-grab-design/references/detailed-design-rules.md +70 -0
  44. package/skills/slides-grab-export/SKILL.md +55 -0
  45. package/skills/slides-grab-export/references/export-rules.md +27 -0
  46. package/skills/slides-grab-export/references/html2pptx.md +627 -0
  47. package/skills/slides-grab-export/references/ooxml.md +427 -0
  48. package/skills/slides-grab-export/references/pptx-skill-reference.md +189 -0
  49. package/skills/slides-grab-html/SKILL.md +67 -0
  50. package/skills/slides-grab-image/SKILL.md +82 -0
  51. package/skills/slides-grab-plan/SKILL.md +68 -0
  52. package/skills/slides-grab-plan/references/design-md-to-slides-conversion.md +135 -0
  53. package/skills/slides-grab-plan/references/outline-format.md +47 -0
  54. package/skills/slides-grab-plan/references/plan-workflow-reference.md +140 -0
  55. package/src/codex-imagen.js +182 -0
  56. package/src/design-diversity-data.js +6932 -0
  57. package/src/design-gate-report.js +244 -0
  58. package/src/design-gate-state.js +329 -0
  59. package/src/design-import.js +164 -0
  60. package/src/design-md-parser.js +415 -0
  61. package/src/design-styles-data.js +1928 -0
  62. package/src/design-styles.js +209 -0
  63. package/src/editor/codex-edit.js +584 -0
  64. package/src/editor/edit-subprocess.js +170 -0
  65. package/src/editor/editor-codex-prompt.md +50 -0
  66. package/src/editor/editor.html +1785 -0
  67. package/src/editor/js/editor-bbox.js +332 -0
  68. package/src/editor/js/editor-chat.js +56 -0
  69. package/src/editor/js/editor-direct-edit.js +238 -0
  70. package/src/editor/js/editor-dom.js +59 -0
  71. package/src/editor/js/editor-init.js +405 -0
  72. package/src/editor/js/editor-navigation.js +54 -0
  73. package/src/editor/js/editor-select.js +558 -0
  74. package/src/editor/js/editor-send.js +175 -0
  75. package/src/editor/js/editor-sse.js +163 -0
  76. package/src/editor/js/editor-state.js +41 -0
  77. package/src/editor/js/editor-type.js +71 -0
  78. package/src/editor/js/editor-utils.js +167 -0
  79. package/src/editor/js/model-registry.js +37 -0
  80. package/src/editor/screenshot.js +82 -0
  81. package/src/export-resolution.cjs +68 -0
  82. package/src/figma.js +71 -0
  83. package/src/html2pptx-scale.cjs +120 -0
  84. package/src/html2pptx.cjs +1262 -0
  85. package/src/image-contract.js +329 -0
  86. package/src/image-native.js +468 -0
  87. package/src/nano-banana.js +841 -0
  88. package/src/ohos-browser-bridge.cjs +272 -0
  89. package/src/pptx-raster-export.cjs +299 -0
  90. package/src/resolve.js +110 -0
  91. package/src/slide-mode.cjs +72 -0
  92. package/src/template-fidelity.js +267 -0
  93. package/src/template-import.js +505 -0
  94. package/src/template-layout.js +261 -0
  95. package/src/template-pack.js +255 -0
  96. package/src/tldraw/render.js +473 -0
  97. package/src/validation/cli.js +120 -0
  98. package/src/validation/core.js +1023 -0
  99. package/templates/chart.html +121 -0
  100. package/templates/closing.html +54 -0
  101. package/templates/content.html +50 -0
  102. package/templates/contents.html +60 -0
  103. package/templates/cover.html +64 -0
  104. package/templates/custom/.gitkeep +0 -0
  105. package/templates/custom/README.md +7 -0
  106. package/templates/design-styles/README.md +20 -0
  107. package/templates/design-styles/preview.html +4438 -0
  108. package/templates/diagram-tldraw.html +56 -0
  109. package/templates/diagram.html +98 -0
  110. package/templates/quote.html +31 -0
  111. package/templates/section-divider.html +43 -0
  112. package/templates/split-layout.html +43 -0
  113. package/templates/statistics.html +55 -0
  114. package/templates/team.html +49 -0
  115. package/templates/timeline.html +59 -0
@@ -0,0 +1,427 @@
1
+ # Office Open XML Technical Reference for PowerPoint
2
+
3
+ **Important: Read this entire document before starting.** Critical XML schema rules and formatting requirements are covered throughout. Incorrect implementation can create invalid PPTX files that PowerPoint cannot open.
4
+
5
+ ## Technical Guidelines
6
+
7
+ ### Schema Compliance
8
+ - **Element ordering in `<p:txBody>`**: `<a:bodyPr>`, `<a:lstStyle>`, `<a:p>`
9
+ - **Whitespace**: Add `xml:space='preserve'` to `<a:t>` elements with leading/trailing spaces
10
+ - **Unicode**: Escape characters in ASCII content: `"` becomes `&#8220;`
11
+ - **Images**: Add to `ppt/media/`, reference in slide XML, set dimensions to fit slide bounds
12
+ - **Relationships**: Update `ppt/slides/_rels/slideN.xml.rels` for each slide's resources
13
+ - **Dirty attribute**: Add `dirty="0"` to `<a:rPr>` and `<a:endParaRPr>` elements to indicate clean state
14
+
15
+ ## Presentation Structure
16
+
17
+ ### Basic Slide Structure
18
+ ```xml
19
+ <!-- ppt/slides/slide1.xml -->
20
+ <p:sld>
21
+ <p:cSld>
22
+ <p:spTree>
23
+ <p:nvGrpSpPr>...</p:nvGrpSpPr>
24
+ <p:grpSpPr>...</p:grpSpPr>
25
+ <!-- Shapes go here -->
26
+ </p:spTree>
27
+ </p:cSld>
28
+ </p:sld>
29
+ ```
30
+
31
+ ### Text Box / Shape with Text
32
+ ```xml
33
+ <p:sp>
34
+ <p:nvSpPr>
35
+ <p:cNvPr id="2" name="Title"/>
36
+ <p:cNvSpPr>
37
+ <a:spLocks noGrp="1"/>
38
+ </p:cNvSpPr>
39
+ <p:nvPr>
40
+ <p:ph type="ctrTitle"/>
41
+ </p:nvPr>
42
+ </p:nvSpPr>
43
+ <p:spPr>
44
+ <a:xfrm>
45
+ <a:off x="838200" y="365125"/>
46
+ <a:ext cx="7772400" cy="1470025"/>
47
+ </a:xfrm>
48
+ </p:spPr>
49
+ <p:txBody>
50
+ <a:bodyPr/>
51
+ <a:lstStyle/>
52
+ <a:p>
53
+ <a:r>
54
+ <a:t>Slide Title</a:t>
55
+ </a:r>
56
+ </a:p>
57
+ </p:txBody>
58
+ </p:sp>
59
+ ```
60
+
61
+ ### Text Formatting
62
+ ```xml
63
+ <!-- Bold -->
64
+ <a:r>
65
+ <a:rPr b="1"/>
66
+ <a:t>Bold Text</a:t>
67
+ </a:r>
68
+
69
+ <!-- Italic -->
70
+ <a:r>
71
+ <a:rPr i="1"/>
72
+ <a:t>Italic Text</a:t>
73
+ </a:r>
74
+
75
+ <!-- Underline -->
76
+ <a:r>
77
+ <a:rPr u="sng"/>
78
+ <a:t>Underlined</a:t>
79
+ </a:r>
80
+
81
+ <!-- Highlight -->
82
+ <a:r>
83
+ <a:rPr>
84
+ <a:highlight>
85
+ <a:srgbClr val="FFFF00"/>
86
+ </a:highlight>
87
+ </a:rPr>
88
+ <a:t>Highlighted Text</a:t>
89
+ </a:r>
90
+
91
+ <!-- Font and Size -->
92
+ <a:r>
93
+ <a:rPr sz="2400" typeface="Arial">
94
+ <a:solidFill>
95
+ <a:srgbClr val="FF0000"/>
96
+ </a:solidFill>
97
+ </a:rPr>
98
+ <a:t>Colored Arial 24pt</a:t>
99
+ </a:r>
100
+
101
+ <!-- Complete formatting example -->
102
+ <a:r>
103
+ <a:rPr lang="en-US" sz="1400" b="1" dirty="0">
104
+ <a:solidFill>
105
+ <a:srgbClr val="FAFAFA"/>
106
+ </a:solidFill>
107
+ </a:rPr>
108
+ <a:t>Formatted text</a:t>
109
+ </a:r>
110
+ ```
111
+
112
+ ### Lists
113
+ ```xml
114
+ <!-- Bullet list -->
115
+ <a:p>
116
+ <a:pPr lvl="0">
117
+ <a:buChar char="•"/>
118
+ </a:pPr>
119
+ <a:r>
120
+ <a:t>First bullet point</a:t>
121
+ </a:r>
122
+ </a:p>
123
+
124
+ <!-- Numbered list -->
125
+ <a:p>
126
+ <a:pPr lvl="0">
127
+ <a:buAutoNum type="arabicPeriod"/>
128
+ </a:pPr>
129
+ <a:r>
130
+ <a:t>First numbered item</a:t>
131
+ </a:r>
132
+ </a:p>
133
+
134
+ <!-- Second level indent -->
135
+ <a:p>
136
+ <a:pPr lvl="1">
137
+ <a:buChar char="•"/>
138
+ </a:pPr>
139
+ <a:r>
140
+ <a:t>Indented bullet</a:t>
141
+ </a:r>
142
+ </a:p>
143
+ ```
144
+
145
+ ### Shapes
146
+ ```xml
147
+ <!-- Rectangle -->
148
+ <p:sp>
149
+ <p:nvSpPr>
150
+ <p:cNvPr id="3" name="Rectangle"/>
151
+ <p:cNvSpPr/>
152
+ <p:nvPr/>
153
+ </p:nvSpPr>
154
+ <p:spPr>
155
+ <a:xfrm>
156
+ <a:off x="1000000" y="1000000"/>
157
+ <a:ext cx="3000000" cy="2000000"/>
158
+ </a:xfrm>
159
+ <a:prstGeom prst="rect">
160
+ <a:avLst/>
161
+ </a:prstGeom>
162
+ <a:solidFill>
163
+ <a:srgbClr val="FF0000"/>
164
+ </a:solidFill>
165
+ <a:ln w="25400">
166
+ <a:solidFill>
167
+ <a:srgbClr val="000000"/>
168
+ </a:solidFill>
169
+ </a:ln>
170
+ </p:spPr>
171
+ </p:sp>
172
+
173
+ <!-- Rounded Rectangle -->
174
+ <p:sp>
175
+ <p:spPr>
176
+ <a:prstGeom prst="roundRect">
177
+ <a:avLst/>
178
+ </a:prstGeom>
179
+ </p:spPr>
180
+ </p:sp>
181
+
182
+ <!-- Circle/Ellipse -->
183
+ <p:sp>
184
+ <p:spPr>
185
+ <a:prstGeom prst="ellipse">
186
+ <a:avLst/>
187
+ </a:prstGeom>
188
+ </p:spPr>
189
+ </p:sp>
190
+ ```
191
+
192
+ ### Images
193
+ ```xml
194
+ <p:pic>
195
+ <p:nvPicPr>
196
+ <p:cNvPr id="4" name="Picture">
197
+ <a:hlinkClick r:id="" action="ppaction://media"/>
198
+ </p:cNvPr>
199
+ <p:cNvPicPr>
200
+ <a:picLocks noChangeAspect="1"/>
201
+ </p:cNvPicPr>
202
+ <p:nvPr/>
203
+ </p:nvPicPr>
204
+ <p:blipFill>
205
+ <a:blip r:embed="rId2"/>
206
+ <a:stretch>
207
+ <a:fillRect/>
208
+ </a:stretch>
209
+ </p:blipFill>
210
+ <p:spPr>
211
+ <a:xfrm>
212
+ <a:off x="1000000" y="1000000"/>
213
+ <a:ext cx="3000000" cy="2000000"/>
214
+ </a:xfrm>
215
+ <a:prstGeom prst="rect">
216
+ <a:avLst/>
217
+ </a:prstGeom>
218
+ </p:spPr>
219
+ </p:pic>
220
+ ```
221
+
222
+ ### Tables
223
+ ```xml
224
+ <p:graphicFrame>
225
+ <p:nvGraphicFramePr>
226
+ <p:cNvPr id="5" name="Table"/>
227
+ <p:cNvGraphicFramePr>
228
+ <a:graphicFrameLocks noGrp="1"/>
229
+ </p:cNvGraphicFramePr>
230
+ <p:nvPr/>
231
+ </p:nvGraphicFramePr>
232
+ <p:xfrm>
233
+ <a:off x="1000000" y="1000000"/>
234
+ <a:ext cx="6000000" cy="2000000"/>
235
+ </p:xfrm>
236
+ <a:graphic>
237
+ <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
238
+ <a:tbl>
239
+ <a:tblGrid>
240
+ <a:gridCol w="3000000"/>
241
+ <a:gridCol w="3000000"/>
242
+ </a:tblGrid>
243
+ <a:tr h="500000">
244
+ <a:tc>
245
+ <a:txBody>
246
+ <a:bodyPr/>
247
+ <a:lstStyle/>
248
+ <a:p>
249
+ <a:r>
250
+ <a:t>Cell 1</a:t>
251
+ </a:r>
252
+ </a:p>
253
+ </a:txBody>
254
+ </a:tc>
255
+ <a:tc>
256
+ <a:txBody>
257
+ <a:bodyPr/>
258
+ <a:lstStyle/>
259
+ <a:p>
260
+ <a:r>
261
+ <a:t>Cell 2</a:t>
262
+ </a:r>
263
+ </a:p>
264
+ </a:txBody>
265
+ </a:tc>
266
+ </a:tr>
267
+ </a:tbl>
268
+ </a:graphicData>
269
+ </a:graphic>
270
+ </p:graphicFrame>
271
+ ```
272
+
273
+ ### Slide Layouts
274
+
275
+ ```xml
276
+ <!-- Title Slide Layout -->
277
+ <p:sp>
278
+ <p:nvSpPr>
279
+ <p:nvPr>
280
+ <p:ph type="ctrTitle"/>
281
+ </p:nvPr>
282
+ </p:nvSpPr>
283
+ <!-- Title content -->
284
+ </p:sp>
285
+
286
+ <p:sp>
287
+ <p:nvSpPr>
288
+ <p:nvPr>
289
+ <p:ph type="subTitle" idx="1"/>
290
+ </p:nvPr>
291
+ </p:nvSpPr>
292
+ <!-- Subtitle content -->
293
+ </p:sp>
294
+
295
+ <!-- Content Slide Layout -->
296
+ <p:sp>
297
+ <p:nvSpPr>
298
+ <p:nvPr>
299
+ <p:ph type="title"/>
300
+ </p:nvPr>
301
+ </p:nvSpPr>
302
+ <!-- Slide title -->
303
+ </p:sp>
304
+
305
+ <p:sp>
306
+ <p:nvSpPr>
307
+ <p:nvPr>
308
+ <p:ph type="body" idx="1"/>
309
+ </p:nvPr>
310
+ </p:nvSpPr>
311
+ <!-- Content body -->
312
+ </p:sp>
313
+ ```
314
+
315
+ ## File Updates
316
+
317
+ When adding content, update these files:
318
+
319
+ **`ppt/_rels/presentation.xml.rels`:**
320
+ ```xml
321
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide1.xml"/>
322
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>
323
+ ```
324
+
325
+ **`ppt/slides/_rels/slide1.xml.rels`:**
326
+ ```xml
327
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>
328
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image1.png"/>
329
+ ```
330
+
331
+ **`[Content_Types].xml`:**
332
+ ```xml
333
+ <Default Extension="png" ContentType="image/png"/>
334
+ <Default Extension="jpg" ContentType="image/jpeg"/>
335
+ <Override PartName="/ppt/slides/slide1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>
336
+ ```
337
+
338
+ **`ppt/presentation.xml`:**
339
+ ```xml
340
+ <p:sldIdLst>
341
+ <p:sldId id="256" r:id="rId1"/>
342
+ <p:sldId id="257" r:id="rId2"/>
343
+ </p:sldIdLst>
344
+ ```
345
+
346
+ **`docProps/app.xml`:** Update slide count and statistics
347
+ ```xml
348
+ <Slides>2</Slides>
349
+ <Paragraphs>10</Paragraphs>
350
+ <Words>50</Words>
351
+ ```
352
+
353
+ ## Slide Operations
354
+
355
+ ### Adding a New Slide
356
+ When adding a slide to the end of the presentation:
357
+
358
+ 1. **Create the slide file** (`ppt/slides/slideN.xml`)
359
+ 2. **Update `[Content_Types].xml`**: Add Override for the new slide
360
+ 3. **Update `ppt/_rels/presentation.xml.rels`**: Add relationship for the new slide
361
+ 4. **Update `ppt/presentation.xml`**: Add slide ID to `<p:sldIdLst>`
362
+ 5. **Create slide relationships** (`ppt/slides/_rels/slideN.xml.rels`) if needed
363
+ 6. **Update `docProps/app.xml`**: Increment slide count and update statistics (if present)
364
+
365
+ ### Duplicating a Slide
366
+ 1. Copy the source slide XML file with a new name
367
+ 2. Update all IDs in the new slide to be unique
368
+ 3. Follow the "Adding a New Slide" steps above
369
+ 4. **CRITICAL**: Remove or update any notes slide references in `_rels` files
370
+ 5. Remove references to unused media files
371
+
372
+ ### Reordering Slides
373
+ 1. **Update `ppt/presentation.xml`**: Reorder `<p:sldId>` elements in `<p:sldIdLst>`
374
+ 2. The order of `<p:sldId>` elements determines slide order
375
+ 3. Keep slide IDs and relationship IDs unchanged
376
+
377
+ Example:
378
+ ```xml
379
+ <!-- Original order -->
380
+ <p:sldIdLst>
381
+ <p:sldId id="256" r:id="rId2"/>
382
+ <p:sldId id="257" r:id="rId3"/>
383
+ <p:sldId id="258" r:id="rId4"/>
384
+ </p:sldIdLst>
385
+
386
+ <!-- After moving slide 3 to position 2 -->
387
+ <p:sldIdLst>
388
+ <p:sldId id="256" r:id="rId2"/>
389
+ <p:sldId id="258" r:id="rId4"/>
390
+ <p:sldId id="257" r:id="rId3"/>
391
+ </p:sldIdLst>
392
+ ```
393
+
394
+ ### Deleting a Slide
395
+ 1. **Remove from `ppt/presentation.xml`**: Delete the `<p:sldId>` entry
396
+ 2. **Remove from `ppt/_rels/presentation.xml.rels`**: Delete the relationship
397
+ 3. **Remove from `[Content_Types].xml`**: Delete the Override entry
398
+ 4. **Delete files**: Remove `ppt/slides/slideN.xml` and `ppt/slides/_rels/slideN.xml.rels`
399
+ 5. **Update `docProps/app.xml`**: Decrement slide count and update statistics
400
+ 6. **Clean up unused media**: Remove orphaned images from `ppt/media/`
401
+
402
+ Note: Don't renumber remaining slides - keep their original IDs and filenames.
403
+
404
+
405
+ ## Common Errors to Avoid
406
+
407
+ - **Encodings**: Escape unicode characters in ASCII content: `"` becomes `&#8220;`
408
+ - **Images**: Add to `ppt/media/` and update relationship files
409
+ - **Lists**: Omit bullets from list headers
410
+ - **IDs**: Use valid hexadecimal values for UUIDs
411
+ - **Themes**: Check all themes in `theme` directory for colors
412
+
413
+ ## Validation Checklist for Template-Based Presentations
414
+
415
+ ### Before Packing, Always:
416
+ - **Clean unused resources**: Remove unreferenced media, fonts, and notes directories
417
+ - **Fix Content_Types.xml**: Declare ALL slides, layouts, and themes present in the package
418
+ - **Fix relationship IDs**:
419
+ - Remove font embed references if not using embedded fonts
420
+ - **Remove broken references**: Check all `_rels` files for references to deleted resources
421
+
422
+ ### Common Template Duplication Pitfalls:
423
+ - Multiple slides referencing the same notes slide after duplication
424
+ - Image/media references from template slides that no longer exist
425
+ - Font embedding references when fonts aren't included
426
+ - Missing slideLayout declarations for layouts 12-25
427
+ - docProps directory may not unpack - this is optional
@@ -0,0 +1,189 @@
1
+ # PPTX Skill - Experimental / Unstable PowerPoint Conversion
2
+
3
+ Converts HTML slides into experimental / unstable PowerPoint presentation files on a best-effort basis.
4
+
5
+ ## Feature Overview
6
+
7
+ ### 1. New Presentation (HTML -> PPTX)
8
+ Convert HTML slide files to experimental / unstable PowerPoint output
9
+
10
+ ### 2. Edit Existing Presentation
11
+ Modify contents of a PPTX file
12
+
13
+ ### 3. Thumbnail Generation
14
+ Generate preview images of a presentation
15
+
16
+ ## Prerequisites (Stage 3)
17
+
18
+ This skill is **Stage 3**. It executes only when ALL of the following conditions are met:
19
+
20
+ 1. **Explicit user request required**: Only run when the user explicitly requests PPTX conversion ("convert to PPTX", "make a PowerPoint", etc.).
21
+ 2. **HTML slides reviewed**: All HTML slides must have been reviewed and approved by the user in `viewer.html`.
22
+ 3. **No automatic execution**: Do not automatically start PPTX conversion just because slide generation is complete.
23
+
24
+ If prerequisites are not met, guide the user to review slides in `<slides-dir>/viewer.html` first (default: `slides/viewer.html`).
25
+
26
+ ---
27
+
28
+ ## Core Workflow
29
+
30
+ ### HTML -> PPTX Conversion
31
+
32
+ 1. **Prepare HTML slides**
33
+ - Verify HTML files exist in selected `--slides-dir` (default: `slides/`)
34
+ - Validate each file is 720pt x 405pt (16:9) specification
35
+
36
+ 2. **Run the editable-text engine** (experimental / unstable)
37
+ ```bash
38
+ slides-grab convert --slides-dir <path> --output presentation.pptx --engine text
39
+ ```
40
+ - Use the packaged `slides-grab convert` command rather than runtime-local skill scripts.
41
+ - Omit `--engine text` to use the default raster engine for higher visual fidelity.
42
+
43
+ 3. **Verify results**
44
+ - Check generated PPTX file carefully; expect best-effort fidelity only
45
+ - Visual verification via thumbnail
46
+
47
+ ## Script Usage
48
+
49
+ ### Programmatic Conversion Note
50
+ The packaged runtime exposes PPTX conversion through `slides-grab convert`. Do not import converter files from runtime-local skill directories in installed-agent workflows.
51
+
52
+ ```bash
53
+ slides-grab convert --slides-dir <path> --output presentation.pptx --engine text
54
+ ```
55
+
56
+ ### Thumbnail / OOXML Inspection
57
+
58
+ Use standard local tools such as LibreOffice, Poppler, or OOXML unzip/zip inspection when you need thumbnails or package-level debugging. These steps are diagnostic aids, not required packaged runtime commands.
59
+
60
+ ```bash
61
+ unzip presentation.pptx -d output_dir
62
+ ```
63
+
64
+ ## Reference Documents
65
+
66
+ - [html2pptx.md](html2pptx.md) - HTML to PPTX conversion detailed guide
67
+ - [ooxml.md](ooxml.md) - Office Open XML technical reference
68
+
69
+ ## PptxGenJS Key Rules
70
+
71
+ ### Color Codes
72
+ ```javascript
73
+ // Correct - without #
74
+ { color: 'FF0000' }
75
+
76
+ // Wrong - causes file corruption
77
+ { color: '#FF0000' }
78
+ ```
79
+
80
+ ### Adding Slides
81
+ ```javascript
82
+ const slide = pres.addSlide();
83
+
84
+ // Add text
85
+ slide.addText('Title', {
86
+ x: 0.5,
87
+ y: 0.5,
88
+ w: 9,
89
+ h: 1,
90
+ fontSize: 36,
91
+ color: '1a1a2e',
92
+ bold: true
93
+ });
94
+
95
+ // Add image
96
+ slide.addImage({
97
+ path: 'image.png',
98
+ x: 1,
99
+ y: 2,
100
+ w: 4,
101
+ h: 3
102
+ });
103
+
104
+ // Add shape
105
+ slide.addShape(pres.ShapeType.rect, {
106
+ x: 0.5,
107
+ y: 1,
108
+ w: 3,
109
+ h: 2,
110
+ fill: { color: '1e3a5f' }
111
+ });
112
+ ```
113
+
114
+ ### Adding Charts
115
+ ```javascript
116
+ // Bar chart
117
+ slide.addChart(pres.ChartType.bar, [
118
+ {
119
+ name: 'Series 1',
120
+ labels: ['A', 'B', 'C'],
121
+ values: [10, 20, 30]
122
+ }
123
+ ], {
124
+ x: 1,
125
+ y: 2,
126
+ w: 8,
127
+ h: 4
128
+ });
129
+
130
+ // Pie chart
131
+ slide.addChart(pres.ChartType.pie, [...], {...});
132
+
133
+ // Line chart
134
+ slide.addChart(pres.ChartType.line, [...], {...});
135
+ ```
136
+
137
+ ## Full Conversion Process
138
+
139
+ ```
140
+ +-------------------+
141
+ | HTML Slides |
142
+ | <slides-dir>/*.html |
143
+ +---------+---------+
144
+ |
145
+ v
146
+ +-------------------+
147
+ | html2pptx.js |
148
+ | (Playwright + |
149
+ | PptxGenJS) |
150
+ +---------+---------+
151
+ |
152
+ v
153
+ +-------------------+
154
+ | PPTX File |
155
+ | presentation.pptx |
156
+ +---------+---------+
157
+ |
158
+ v
159
+ +-------------------+
160
+ | thumbnail.py |
161
+ | (Preview) |
162
+ +-------------------+
163
+ ```
164
+
165
+ ## Dependencies
166
+
167
+ ### Node.js
168
+ - pptxgenjs: PowerPoint generation
169
+ - playwright: Browser rendering
170
+ - sharp: Image processing
171
+
172
+ ### Python
173
+ - markitdown: Markdown conversion
174
+ - defusedxml: XML parsing
175
+ - pillow: Image processing
176
+
177
+ ### System
178
+ - LibreOffice: PDF/image conversion (soffice)
179
+ - Poppler: PDF to image (pdftoppm)
180
+
181
+ ## Important Notes
182
+
183
+ - PPTX export is **experimental / unstable** and may require manual cleanup after generation.
184
+
185
+ 1. **Color codes**: No `#` prefix in PptxGenJS
186
+ 2. **Fonts**: Web-safe fonts only
187
+ 3. **Text**: Only p, h1-h6, ul, ol tags are converted
188
+ 4. **Gradients**: Replace CSS gradients with images
189
+ 5. **Validation**: Always verify with thumbnails after conversion
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: slides-grab-html
3
+ description: HTML-mode presentation pipeline usable in Codex and Claude Code. Build semantic slide-XX.html files, generate bespoke hero/accent imagery with slides-grab image, run the design gate, and export. Use when the deck needs editable, searchable, accessible text or when no existing template must be matched pixel-for-pixel.
4
+ metadata:
5
+ short-description: Semantic HTML slide pipeline with bespoke imagery
6
+ ---
7
+
8
+ # slides-grab HTML Skill
9
+
10
+ Build semantic `slide-XX.html` files where text is real HTML (selectable, editable, accessible) and imagery is generated as supporting accent/hero assets — **never** as whole-slide rasters. Use this pipeline when the user wants a deck they can edit, when slides contain charts or diagrams, or when no existing template demands pixel-perfect visual matching.
11
+
12
+ ## Mode signal
13
+ The plan stage records `mode: html` in `slide-outline.md`. If no mode is recorded, default to this pipeline.
14
+
15
+ ## Bespoke imagery rule
16
+ - Use `slides-grab image` to generate individual hero/accent images that sit *beside* or *behind* semantic text inside an HTML slide. The generated image is a supporting visual — text and layout stay in HTML/CSS.
17
+ - A bespoke image prompt describes **the accent visual only** — the atmospheric mood, the hero illustration, the background texture — not the slide's title, body copy, or layout. Let HTML handle text and layout.
18
+ - Good prompt: *"Atmospheric dawn horizon, cyan and silver tones, dreamy Y2K mood, no text, 16:9"* — describes a hero background.
19
+ - If you instead need the generated image to BE the whole slide (title, body, layout burned into the raster), use the image-native pipeline (`../slides-grab-image/SKILL.md`) — semantic HTML is the wrong tool for that.
20
+
21
+ ## Workflow
22
+
23
+ ### Stage 1 — Plan
24
+ Use the installed **slides-grab-plan** skill.
25
+ 1. Take topic, audience, and tone.
26
+ 2. Run `slides-grab list-styles`, shortlist 2–3 bundled styles, get explicit approval. Optionally offer `slides-grab preview-styles`. If none fit, propose a custom direction. If the user provides a reference template/PDF/PPTX for color tokens only (not pixel-perfect matching), import it with `slides-grab import-template` and record `style: template-pack` — the template pack supplies design tokens, but slides stay semantic HTML.
27
+ 3. Record `mode: html` in `slide-outline.md` meta.
28
+ 4. Present outline, revise until approved.
29
+
30
+ ### Stage 2 — Design
31
+ Use the installed **slides-grab-design** skill.
32
+ 1. Read approved `slide-outline.md`, load the style spec (`src/design-styles-data.js` for bundled ids, `slides-grab show-design` for `DESIGN.slides.md`, or `.slides-grab/template-pack.json` for imported packs).
33
+ 2. Write a visual thesis, content plan, system declaration, and design tokens before generating slides.
34
+ 3. Generate `slide-XX.html` semantic HTML files with 2-digit numbering in `--slides-dir`.
35
+ 4. **Bespoke imagery**: when a slide needs a hero/accent image, run `slides-grab image --prompt "<accent-visual prompt>" --slides-dir <path>`. The default codex provider reuses the local Codex ChatGPT login (`~/.codex/auth.json` — run `codex login` once; no API key required). Save under `<slides-dir>/assets/`. To guide the style, pass reference images with `--reference <path>` (repeatable). Optional providers: `--provider openai` (OpenAI gpt-image-2 via `OPENAI_API_KEY`), `--provider nano-banana` (Google `gemini-3-pro-image-preview` via `GOOGLE_API_KEY`/`GEMINI_API_KEY`, supports `--image-size 2K|4K`). If credentials are unavailable, fall back to web search + download into `<slides-dir>/assets/`.
36
+ 5. **Diagrams**: for complex diagrams (architecture, workflows, relationship maps), use `tldraw` via `slides-grab tldraw`, store under `<slides-dir>/assets/`.
37
+ 6. **Charts**: default to Chart.js (`<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>`), start from `templates/chart.html`, keep `animation: false`, `responsive: true`, `maintainAspectRatio: false`, wrap `<canvas>` in a stable container. `slides-grab validate` reports `empty-canvas` for unpainted canvases.
38
+ 7. **Video**: store under `<slides-dir>/assets/`, prefer `poster="./assets/<file>"`. Use `slides-grab fetch-video` or `yt-dlp` for web sources.
39
+ 8. **Icons**: prefer Lucide before emoji.
40
+ 9. Run `slides-grab validate --slides-dir <path>`. Auto-fix failures until it passes.
41
+ 10. Run the design gate (`../slides-grab-design/references/design-gate.md`): capture PNG evidence, run Pass A (System Contract) + Pass B (Audience Impact), synthesize verdict. Resolve all Critical findings, re-render, re-review until `Proceed`. Record with `slides-grab design-gate --slides-dir <path> --verdict proceed --pass-a-report <a.md> --pass-b-report <b.md>`.
42
+ 11. Launch the HTML editor: `slides-grab edit --slides-dir <path>`. For chart decks, also run `slides-grab build-viewer` and confirm charts render in `viewer.html`.
43
+
44
+ ### Stage 3 — Export
45
+ Use the installed **slides-grab-export** skill. Requires a fresh `Proceed` gate receipt.
46
+ 1. Widescreen → `slides-grab pdf --slides-dir <path> --output <name>.pdf`.
47
+ 2. Per-slide PNG → `slides-grab png --slides-dir <path> --output-dir <path>/out-png --resolution 2160p`.
48
+ 3. Card-news → `slides-grab png --slide-mode card-news` (see `../slides-grab-card-news`).
49
+ 4. PPTX/Figma (experimental / unstable) → `slides-grab convert` / `slides-grab figma`.
50
+
51
+ ## Rules
52
+ - Keep slide size 720pt × 405pt.
53
+ - Keep semantic text tags (`p`, `h1-h6`, `ul`, `ol`, `li`). Never put text directly in `<div>`/`<span>`.
54
+ - Backgrounds only on `<div>`; text only in semantic tags.
55
+ - No CSS gradients — use flat fills; rasterize gradients to PNG with Sharp if needed.
56
+ - Put local images/videos under `<slides-dir>/assets/`, reference as `./assets/<file>`.
57
+ - Allow `data:` URLs when a slide must be self-contained; never leave remote `http(s)://` image URLs in saved HTML.
58
+ - Prefer Lucide for iconography; avoid emoji unless the brief explicitly asks.
59
+ - Keep body copy ≥14pt on a 720pt × 405pt slide; 10pt absolute floor.
60
+ - Avoid AI slop tropes (aggressive gradient backgrounds, left-border accent cards, SVG-drawn imagery, generic font stacks, generic 3×2 icon-plus-blurb grids).
61
+ - Do not present slides for review until `slides-grab validate` passes.
62
+ - Do not advance to export while any Critical design-gate finding is unresolved.
63
+
64
+ ## Reference
65
+ - `../slides-grab-plan/SKILL.md` and `../slides-grab-plan/references/`
66
+ - `../slides-grab-design/SKILL.md` and `../slides-grab-design/references/`
67
+ - `../slides-grab-export/SKILL.md` and `../slides-grab-export/references/`