docrev 0.8.1 → 0.8.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 (306) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/PLAN-tables-and-postprocess.md +850 -0
  3. package/README.md +33 -0
  4. package/bin/rev.js +12 -131
  5. package/bin/rev.ts +145 -0
  6. package/dist/bin/rev.d.ts +9 -0
  7. package/dist/bin/rev.d.ts.map +1 -0
  8. package/dist/bin/rev.js +118 -0
  9. package/dist/bin/rev.js.map +1 -0
  10. package/dist/lib/annotations.d.ts +91 -0
  11. package/dist/lib/annotations.d.ts.map +1 -0
  12. package/dist/lib/annotations.js +554 -0
  13. package/dist/lib/annotations.js.map +1 -0
  14. package/dist/lib/build.d.ts +171 -0
  15. package/dist/lib/build.d.ts.map +1 -0
  16. package/dist/lib/build.js +755 -0
  17. package/dist/lib/build.js.map +1 -0
  18. package/dist/lib/citations.d.ts +34 -0
  19. package/dist/lib/citations.d.ts.map +1 -0
  20. package/dist/lib/citations.js +140 -0
  21. package/dist/lib/citations.js.map +1 -0
  22. package/dist/lib/commands/build.d.ts +13 -0
  23. package/dist/lib/commands/build.d.ts.map +1 -0
  24. package/dist/lib/commands/build.js +678 -0
  25. package/dist/lib/commands/build.js.map +1 -0
  26. package/dist/lib/commands/citations.d.ts +11 -0
  27. package/dist/lib/commands/citations.d.ts.map +1 -0
  28. package/dist/lib/commands/citations.js +428 -0
  29. package/dist/lib/commands/citations.js.map +1 -0
  30. package/dist/lib/commands/comments.d.ts +11 -0
  31. package/dist/lib/commands/comments.d.ts.map +1 -0
  32. package/dist/lib/commands/comments.js +883 -0
  33. package/dist/lib/commands/comments.js.map +1 -0
  34. package/dist/lib/commands/context.d.ts +35 -0
  35. package/dist/lib/commands/context.d.ts.map +1 -0
  36. package/dist/lib/commands/context.js +59 -0
  37. package/dist/lib/commands/context.js.map +1 -0
  38. package/dist/lib/commands/core.d.ts +11 -0
  39. package/dist/lib/commands/core.d.ts.map +1 -0
  40. package/dist/lib/commands/core.js +246 -0
  41. package/dist/lib/commands/core.js.map +1 -0
  42. package/dist/lib/commands/doi.d.ts +11 -0
  43. package/dist/lib/commands/doi.d.ts.map +1 -0
  44. package/dist/lib/commands/doi.js +373 -0
  45. package/dist/lib/commands/doi.js.map +1 -0
  46. package/dist/lib/commands/history.d.ts +11 -0
  47. package/dist/lib/commands/history.d.ts.map +1 -0
  48. package/dist/lib/commands/history.js +245 -0
  49. package/dist/lib/commands/history.js.map +1 -0
  50. package/dist/lib/commands/index.d.ts +28 -0
  51. package/dist/lib/commands/index.d.ts.map +1 -0
  52. package/dist/lib/commands/index.js +35 -0
  53. package/dist/lib/commands/index.js.map +1 -0
  54. package/dist/lib/commands/init.d.ts +11 -0
  55. package/dist/lib/commands/init.d.ts.map +1 -0
  56. package/dist/lib/commands/init.js +209 -0
  57. package/dist/lib/commands/init.js.map +1 -0
  58. package/dist/lib/commands/response.d.ts +11 -0
  59. package/dist/lib/commands/response.d.ts.map +1 -0
  60. package/dist/lib/commands/response.js +317 -0
  61. package/dist/lib/commands/response.js.map +1 -0
  62. package/dist/lib/commands/sections.d.ts +11 -0
  63. package/dist/lib/commands/sections.d.ts.map +1 -0
  64. package/dist/lib/commands/sections.js +1071 -0
  65. package/dist/lib/commands/sections.js.map +1 -0
  66. package/dist/lib/commands/utilities.d.ts +19 -0
  67. package/dist/lib/commands/utilities.d.ts.map +1 -0
  68. package/dist/lib/commands/utilities.js +2009 -0
  69. package/dist/lib/commands/utilities.js.map +1 -0
  70. package/dist/lib/comment-realign.d.ts +50 -0
  71. package/dist/lib/comment-realign.d.ts.map +1 -0
  72. package/dist/lib/comment-realign.js +372 -0
  73. package/dist/lib/comment-realign.js.map +1 -0
  74. package/dist/lib/config.d.ts +41 -0
  75. package/dist/lib/config.d.ts.map +1 -0
  76. package/dist/lib/config.js +76 -0
  77. package/dist/lib/config.js.map +1 -0
  78. package/dist/lib/crossref.d.ts +108 -0
  79. package/dist/lib/crossref.d.ts.map +1 -0
  80. package/dist/lib/crossref.js +597 -0
  81. package/dist/lib/crossref.js.map +1 -0
  82. package/dist/lib/dependencies.d.ts +30 -0
  83. package/dist/lib/dependencies.d.ts.map +1 -0
  84. package/dist/lib/dependencies.js +95 -0
  85. package/dist/lib/dependencies.js.map +1 -0
  86. package/dist/lib/doi-cache.d.ts +29 -0
  87. package/dist/lib/doi-cache.d.ts.map +1 -0
  88. package/dist/lib/doi-cache.js +104 -0
  89. package/dist/lib/doi-cache.js.map +1 -0
  90. package/dist/lib/doi.d.ts +65 -0
  91. package/dist/lib/doi.d.ts.map +1 -0
  92. package/dist/lib/doi.js +710 -0
  93. package/dist/lib/doi.js.map +1 -0
  94. package/dist/lib/equations.d.ts +61 -0
  95. package/dist/lib/equations.d.ts.map +1 -0
  96. package/dist/lib/equations.js +445 -0
  97. package/dist/lib/equations.js.map +1 -0
  98. package/dist/lib/errors.d.ts +60 -0
  99. package/dist/lib/errors.d.ts.map +1 -0
  100. package/dist/lib/errors.js +303 -0
  101. package/dist/lib/errors.js.map +1 -0
  102. package/dist/lib/format.d.ts +104 -0
  103. package/dist/lib/format.d.ts.map +1 -0
  104. package/dist/lib/format.js +416 -0
  105. package/dist/lib/format.js.map +1 -0
  106. package/dist/lib/git.d.ts +88 -0
  107. package/dist/lib/git.d.ts.map +1 -0
  108. package/dist/lib/git.js +304 -0
  109. package/dist/lib/git.js.map +1 -0
  110. package/dist/lib/grammar.d.ts +62 -0
  111. package/dist/lib/grammar.d.ts.map +1 -0
  112. package/dist/lib/grammar.js +244 -0
  113. package/dist/lib/grammar.js.map +1 -0
  114. package/dist/lib/image-registry.d.ts +68 -0
  115. package/dist/lib/image-registry.d.ts.map +1 -0
  116. package/dist/lib/image-registry.js +112 -0
  117. package/dist/lib/image-registry.js.map +1 -0
  118. package/dist/lib/import.d.ts +184 -0
  119. package/dist/lib/import.d.ts.map +1 -0
  120. package/dist/lib/import.js +1581 -0
  121. package/dist/lib/import.js.map +1 -0
  122. package/dist/lib/journals.d.ts +55 -0
  123. package/dist/lib/journals.d.ts.map +1 -0
  124. package/dist/lib/journals.js +417 -0
  125. package/dist/lib/journals.js.map +1 -0
  126. package/dist/lib/merge.d.ts +138 -0
  127. package/dist/lib/merge.d.ts.map +1 -0
  128. package/dist/lib/merge.js +603 -0
  129. package/dist/lib/merge.js.map +1 -0
  130. package/dist/lib/orcid.d.ts +36 -0
  131. package/dist/lib/orcid.d.ts.map +1 -0
  132. package/dist/lib/orcid.js +117 -0
  133. package/dist/lib/orcid.js.map +1 -0
  134. package/dist/lib/pdf-comments.d.ts +95 -0
  135. package/dist/lib/pdf-comments.d.ts.map +1 -0
  136. package/dist/lib/pdf-comments.js +192 -0
  137. package/dist/lib/pdf-comments.js.map +1 -0
  138. package/dist/lib/pdf-import.d.ts +118 -0
  139. package/dist/lib/pdf-import.d.ts.map +1 -0
  140. package/dist/lib/pdf-import.js +397 -0
  141. package/dist/lib/pdf-import.js.map +1 -0
  142. package/dist/lib/plugins.d.ts +76 -0
  143. package/dist/lib/plugins.d.ts.map +1 -0
  144. package/dist/lib/plugins.js +235 -0
  145. package/dist/lib/plugins.js.map +1 -0
  146. package/dist/lib/postprocess.d.ts +42 -0
  147. package/dist/lib/postprocess.d.ts.map +1 -0
  148. package/dist/lib/postprocess.js +138 -0
  149. package/dist/lib/postprocess.js.map +1 -0
  150. package/dist/lib/pptx-template.d.ts +59 -0
  151. package/dist/lib/pptx-template.d.ts.map +1 -0
  152. package/dist/lib/pptx-template.js +613 -0
  153. package/dist/lib/pptx-template.js.map +1 -0
  154. package/dist/lib/pptx-themes.d.ts +80 -0
  155. package/dist/lib/pptx-themes.d.ts.map +1 -0
  156. package/dist/lib/pptx-themes.js +818 -0
  157. package/dist/lib/pptx-themes.js.map +1 -0
  158. package/dist/lib/protect-restore.d.ts +137 -0
  159. package/dist/lib/protect-restore.d.ts.map +1 -0
  160. package/dist/lib/protect-restore.js +394 -0
  161. package/dist/lib/protect-restore.js.map +1 -0
  162. package/dist/lib/rate-limiter.d.ts +27 -0
  163. package/dist/lib/rate-limiter.d.ts.map +1 -0
  164. package/dist/lib/rate-limiter.js +79 -0
  165. package/dist/lib/rate-limiter.js.map +1 -0
  166. package/dist/lib/response.d.ts +41 -0
  167. package/dist/lib/response.d.ts.map +1 -0
  168. package/dist/lib/response.js +150 -0
  169. package/dist/lib/response.js.map +1 -0
  170. package/dist/lib/review.d.ts +35 -0
  171. package/dist/lib/review.d.ts.map +1 -0
  172. package/dist/lib/review.js +263 -0
  173. package/dist/lib/review.js.map +1 -0
  174. package/dist/lib/schema.d.ts +66 -0
  175. package/dist/lib/schema.d.ts.map +1 -0
  176. package/dist/lib/schema.js +339 -0
  177. package/dist/lib/schema.js.map +1 -0
  178. package/dist/lib/scientific-words.d.ts +6 -0
  179. package/dist/lib/scientific-words.d.ts.map +1 -0
  180. package/dist/lib/scientific-words.js +66 -0
  181. package/dist/lib/scientific-words.js.map +1 -0
  182. package/dist/lib/sections.d.ts +40 -0
  183. package/dist/lib/sections.d.ts.map +1 -0
  184. package/dist/lib/sections.js +288 -0
  185. package/dist/lib/sections.js.map +1 -0
  186. package/dist/lib/slides.d.ts +86 -0
  187. package/dist/lib/slides.d.ts.map +1 -0
  188. package/dist/lib/slides.js +676 -0
  189. package/dist/lib/slides.js.map +1 -0
  190. package/dist/lib/spelling.d.ts +76 -0
  191. package/dist/lib/spelling.d.ts.map +1 -0
  192. package/dist/lib/spelling.js +272 -0
  193. package/dist/lib/spelling.js.map +1 -0
  194. package/dist/lib/templates.d.ts +30 -0
  195. package/dist/lib/templates.d.ts.map +1 -0
  196. package/dist/lib/templates.js +504 -0
  197. package/dist/lib/templates.js.map +1 -0
  198. package/dist/lib/themes.d.ts +85 -0
  199. package/dist/lib/themes.d.ts.map +1 -0
  200. package/dist/lib/themes.js +652 -0
  201. package/dist/lib/themes.js.map +1 -0
  202. package/dist/lib/trackchanges.d.ts +51 -0
  203. package/dist/lib/trackchanges.d.ts.map +1 -0
  204. package/dist/lib/trackchanges.js +202 -0
  205. package/dist/lib/trackchanges.js.map +1 -0
  206. package/dist/lib/tui.d.ts +76 -0
  207. package/dist/lib/tui.d.ts.map +1 -0
  208. package/dist/lib/tui.js +377 -0
  209. package/dist/lib/tui.js.map +1 -0
  210. package/dist/lib/types.d.ts +447 -0
  211. package/dist/lib/types.d.ts.map +1 -0
  212. package/dist/lib/types.js +6 -0
  213. package/dist/lib/types.js.map +1 -0
  214. package/dist/lib/undo.d.ts +57 -0
  215. package/dist/lib/undo.d.ts.map +1 -0
  216. package/dist/lib/undo.js +185 -0
  217. package/dist/lib/undo.js.map +1 -0
  218. package/dist/lib/utils.d.ts +16 -0
  219. package/dist/lib/utils.d.ts.map +1 -0
  220. package/dist/lib/utils.js +40 -0
  221. package/dist/lib/utils.js.map +1 -0
  222. package/dist/lib/variables.d.ts +42 -0
  223. package/dist/lib/variables.d.ts.map +1 -0
  224. package/dist/lib/variables.js +141 -0
  225. package/dist/lib/variables.js.map +1 -0
  226. package/dist/lib/word.d.ts +80 -0
  227. package/dist/lib/word.d.ts.map +1 -0
  228. package/dist/lib/word.js +360 -0
  229. package/dist/lib/word.js.map +1 -0
  230. package/dist/lib/wordcomments.d.ts +51 -0
  231. package/dist/lib/wordcomments.d.ts.map +1 -0
  232. package/dist/lib/wordcomments.js +587 -0
  233. package/dist/lib/wordcomments.js.map +1 -0
  234. package/eslint.config.js +27 -0
  235. package/lib/annotations.ts +622 -0
  236. package/lib/apply-buildup-colors.py +88 -0
  237. package/lib/build.ts +1013 -0
  238. package/lib/{citations.js → citations.ts} +38 -27
  239. package/lib/commands/{build.js → build.ts} +80 -27
  240. package/lib/commands/{citations.js → citations.ts} +36 -18
  241. package/lib/commands/{comments.js → comments.ts} +187 -54
  242. package/lib/commands/{context.js → context.ts} +18 -8
  243. package/lib/commands/{core.js → core.ts} +34 -20
  244. package/lib/commands/{doi.js → doi.ts} +32 -16
  245. package/lib/commands/{history.js → history.ts} +25 -12
  246. package/lib/commands/{index.js → index.ts} +9 -5
  247. package/lib/commands/{init.js → init.ts} +20 -8
  248. package/lib/commands/{response.js → response.ts} +47 -20
  249. package/lib/commands/{sections.js → sections.ts} +273 -68
  250. package/lib/commands/{utilities.js → utilities.ts} +338 -158
  251. package/lib/{comment-realign.js → comment-realign.ts} +117 -45
  252. package/lib/config.ts +84 -0
  253. package/lib/{crossref.js → crossref.ts} +213 -138
  254. package/lib/dependencies.ts +106 -0
  255. package/lib/doi-cache.ts +115 -0
  256. package/lib/{doi.js → doi.ts} +115 -281
  257. package/lib/{equations.js → equations.ts} +60 -64
  258. package/lib/{errors.js → errors.ts} +56 -48
  259. package/lib/{format.js → format.ts} +137 -63
  260. package/lib/{git.js → git.ts} +66 -63
  261. package/lib/{grammar.js → grammar.ts} +45 -32
  262. package/lib/image-registry.ts +180 -0
  263. package/lib/import.ts +2060 -0
  264. package/lib/journals.ts +505 -0
  265. package/lib/{merge.js → merge.ts} +185 -135
  266. package/lib/{orcid.js → orcid.ts} +17 -22
  267. package/lib/{pdf-comments.js → pdf-comments.ts} +76 -18
  268. package/lib/{pdf-import.js → pdf-import.ts} +148 -70
  269. package/lib/{plugins.js → plugins.ts} +82 -39
  270. package/lib/postprocess.ts +188 -0
  271. package/lib/pptx-color-filter.lua +37 -0
  272. package/lib/pptx-template.ts +625 -0
  273. package/lib/pptx-themes/academic.pptx +0 -0
  274. package/lib/pptx-themes/corporate.pptx +0 -0
  275. package/lib/pptx-themes/dark.pptx +0 -0
  276. package/lib/pptx-themes/default.pptx +0 -0
  277. package/lib/pptx-themes/minimal.pptx +0 -0
  278. package/lib/pptx-themes/plant.pptx +0 -0
  279. package/lib/pptx-themes.ts +896 -0
  280. package/lib/protect-restore.ts +516 -0
  281. package/lib/rate-limiter.ts +94 -0
  282. package/lib/{response.js → response.ts} +36 -21
  283. package/lib/{review.js → review.ts} +53 -43
  284. package/lib/{schema.js → schema.ts} +70 -25
  285. package/lib/{sections.js → sections.ts} +71 -76
  286. package/lib/slides.ts +793 -0
  287. package/lib/{spelling.js → spelling.ts} +43 -59
  288. package/lib/{templates.js → templates.ts} +20 -17
  289. package/lib/themes.ts +742 -0
  290. package/lib/{trackchanges.js → trackchanges.ts} +52 -23
  291. package/lib/types.ts +509 -0
  292. package/lib/{undo.js → undo.ts} +75 -52
  293. package/lib/utils.ts +41 -0
  294. package/lib/{variables.js → variables.ts} +60 -54
  295. package/lib/word.ts +428 -0
  296. package/lib/{wordcomments.js → wordcomments.ts} +94 -40
  297. package/package.json +15 -5
  298. package/skill/REFERENCE.md +67 -0
  299. package/tsconfig.json +26 -0
  300. package/lib/annotations.js +0 -414
  301. package/lib/build.js +0 -639
  302. package/lib/config.js +0 -79
  303. package/lib/import.js +0 -1145
  304. package/lib/journals.js +0 -629
  305. package/lib/word.js +0 -225
  306. /package/lib/{scientific-words.js → scientific-words.ts} +0 -0
@@ -0,0 +1,896 @@
1
+ /**
2
+ * PPTX Theme System
3
+ *
4
+ * Provides 6 built-in themes for PPTX output, independent of Beamer themes.
5
+ * Each theme is a reference PPTX file that defines colors, fonts, and slide layouts.
6
+ *
7
+ * Uses pandoc's default reference.pptx as the base template and modifies the theme.xml
8
+ * to apply custom colors and fonts. This ensures all 11 required slide layouts are present.
9
+ *
10
+ * Themes:
11
+ * - default: Clean white with blue accents (professional)
12
+ * - dark: Dark background with light text (modern)
13
+ * - academic: Classic serif fonts, muted colors (scholarly)
14
+ * - minimal: High contrast black/white (clean)
15
+ * - corporate: Navy/gold color scheme (business)
16
+ * - plant: Nature-inspired green theme (ecology/biology)
17
+ */
18
+
19
+ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
20
+ import { join, dirname } from 'node:path';
21
+ import { fileURLToPath } from 'node:url';
22
+ import { execSync } from 'node:child_process';
23
+ import AdmZip from 'adm-zip';
24
+
25
+ const __dirname = dirname(fileURLToPath(import.meta.url));
26
+
27
+ /**
28
+ * Color scheme for a theme
29
+ */
30
+ interface ThemeColors {
31
+ dk1: string;
32
+ lt1: string;
33
+ dk2: string;
34
+ lt2: string;
35
+ accent1: string;
36
+ accent2: string;
37
+ accent3: string;
38
+ accent4: string;
39
+ accent5: string;
40
+ accent6: string;
41
+ hlink: string;
42
+ folHlink: string;
43
+ }
44
+
45
+ /**
46
+ * Font scheme for a theme
47
+ */
48
+ interface ThemeFonts {
49
+ major: string;
50
+ minor: string;
51
+ }
52
+
53
+ /**
54
+ * PPTX theme definition
55
+ */
56
+ interface PptxTheme {
57
+ name: string;
58
+ description: string;
59
+ colors: ThemeColors;
60
+ fonts: ThemeFonts;
61
+ background?: string;
62
+ }
63
+
64
+ /**
65
+ * Theme definitions with colors and fonts
66
+ */
67
+ export const PPTX_THEMES: Record<string, PptxTheme> = {
68
+ default: {
69
+ name: 'Default',
70
+ description: 'Clean white with blue accents',
71
+ colors: {
72
+ dk1: '000000', // Dark text
73
+ lt1: 'FFFFFF', // Light background
74
+ dk2: '1F497D', // Dark accent (navy)
75
+ lt2: 'EEECE1', // Light accent (cream)
76
+ accent1: '4472C4', // Blue
77
+ accent2: 'ED7D31', // Orange
78
+ accent3: 'A5A5A5', // Gray
79
+ accent4: 'FFC000', // Yellow
80
+ accent5: '5B9BD5', // Light blue
81
+ accent6: '70AD47', // Green
82
+ hlink: '0563C1', // Hyperlink blue
83
+ folHlink: '954F72', // Followed hyperlink
84
+ },
85
+ fonts: {
86
+ major: 'Calibri Light',
87
+ minor: 'Calibri',
88
+ },
89
+ },
90
+ dark: {
91
+ name: 'Dark',
92
+ description: 'Dark background with light text',
93
+ colors: {
94
+ dk1: 'FFFFFF', // Light text (inverted)
95
+ lt1: '1E1E1E', // Dark background
96
+ dk2: 'E0E0E0', // Light gray
97
+ lt2: '2D2D2D', // Darker gray
98
+ accent1: '00B4D8', // Cyan
99
+ accent2: 'FF6B6B', // Coral
100
+ accent3: '95E1D3', // Mint
101
+ accent4: 'F38181', // Pink
102
+ accent5: 'AA96DA', // Lavender
103
+ accent6: 'FCBAD3', // Light pink
104
+ hlink: '00B4D8',
105
+ folHlink: 'AA96DA',
106
+ },
107
+ fonts: {
108
+ major: 'Inter',
109
+ minor: 'Inter',
110
+ },
111
+ background: '1E1E1E',
112
+ },
113
+ academic: {
114
+ name: 'Academic',
115
+ description: 'Classic serif fonts, muted colors',
116
+ colors: {
117
+ dk1: '2C3E50', // Dark blue-gray
118
+ lt1: 'FFFEF9', // Warm white
119
+ dk2: '34495E', // Slate
120
+ lt2: 'F5F5DC', // Beige
121
+ accent1: '8B4513', // Saddle brown
122
+ accent2: '2E8B57', // Sea green
123
+ accent3: '708090', // Slate gray
124
+ accent4: 'B8860B', // Dark goldenrod
125
+ accent5: '4682B4', // Steel blue
126
+ accent6: '6B8E23', // Olive drab
127
+ hlink: '8B4513',
128
+ folHlink: '708090',
129
+ },
130
+ fonts: {
131
+ major: 'Georgia',
132
+ minor: 'Palatino Linotype',
133
+ },
134
+ },
135
+ minimal: {
136
+ name: 'Minimal',
137
+ description: 'High contrast black and white',
138
+ colors: {
139
+ dk1: '000000', // Pure black
140
+ lt1: 'FFFFFF', // Pure white
141
+ dk2: '333333', // Dark gray
142
+ lt2: 'F0F0F0', // Light gray
143
+ accent1: '000000', // Black accent
144
+ accent2: '666666', // Medium gray
145
+ accent3: '999999', // Light gray
146
+ accent4: 'CCCCCC', // Lighter gray
147
+ accent5: '333333', // Dark gray
148
+ accent6: '4D4D4D', // Charcoal
149
+ hlink: '000000',
150
+ folHlink: '666666',
151
+ },
152
+ fonts: {
153
+ major: 'Roboto Light',
154
+ minor: 'Roboto',
155
+ },
156
+ },
157
+ corporate: {
158
+ name: 'Corporate',
159
+ description: 'Navy and gold professional theme',
160
+ colors: {
161
+ dk1: '0D1B2A', // Very dark navy
162
+ lt1: 'FFFFFF', // White
163
+ dk2: '1B263B', // Dark navy
164
+ lt2: 'E0E1DD', // Light gray
165
+ accent1: 'D4AF37', // Gold
166
+ accent2: '415A77', // Steel blue
167
+ accent3: '778DA9', // Light steel
168
+ accent4: 'C5A900', // Darker gold
169
+ accent5: '1B4965', // Deep blue
170
+ accent6: '5FA8D3', // Sky blue
171
+ hlink: 'D4AF37',
172
+ folHlink: '778DA9',
173
+ },
174
+ fonts: {
175
+ major: 'Garamond',
176
+ minor: 'Garamond',
177
+ },
178
+ },
179
+ plant: {
180
+ name: 'Plant',
181
+ description: 'Nature-inspired green theme for ecology/biology',
182
+ colors: {
183
+ dk1: '2D4A22', // Dark forest green
184
+ lt1: 'FFFFFF', // White
185
+ dk2: '3D5A2E', // Medium forest
186
+ lt2: 'F5F7F2', // Light sage
187
+ accent1: '608C32', // Primary green (theme accent)
188
+ accent2: '8B4513', // Earth brown
189
+ accent3: '888888', // Gray (for buildup)
190
+ accent4: '7CB342', // Light green
191
+ accent5: '4A6B3A', // Olive green
192
+ accent6: 'A5D6A7', // Pale green
193
+ hlink: '608C32',
194
+ folHlink: '4A6B3A',
195
+ },
196
+ fonts: {
197
+ major: 'Aptos Display',
198
+ minor: 'Aptos',
199
+ },
200
+ },
201
+ };
202
+
203
+ /**
204
+ * Get list of available theme names
205
+ */
206
+ export function getThemeNames(): string[] {
207
+ return Object.keys(PPTX_THEMES);
208
+ }
209
+
210
+ /**
211
+ * Get theme definition by name
212
+ */
213
+ export function getTheme(name: string): PptxTheme | null {
214
+ return PPTX_THEMES[name] || null;
215
+ }
216
+
217
+ /**
218
+ * Generate [Content_Types].xml
219
+ */
220
+ function generateContentTypes(): string {
221
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
222
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
223
+ <Default Extension="jpeg" ContentType="image/jpeg"/>
224
+ <Default Extension="png" ContentType="image/png"/>
225
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
226
+ <Default Extension="xml" ContentType="application/xml"/>
227
+ <Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>
228
+ <Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>
229
+ <Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
230
+ <Override PartName="/ppt/slideLayouts/slideLayout2.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
231
+ <Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
232
+ <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
233
+ <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
234
+ </Types>`;
235
+ }
236
+
237
+ /**
238
+ * Generate _rels/.rels
239
+ */
240
+ function generateRels(): string {
241
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
242
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
243
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>
244
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
245
+ <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
246
+ </Relationships>`;
247
+ }
248
+
249
+ /**
250
+ * Generate ppt/_rels/presentation.xml.rels
251
+ */
252
+ function generatePresentationRels(): string {
253
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
254
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
255
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>
256
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
257
+ </Relationships>`;
258
+ }
259
+
260
+ /**
261
+ * Generate ppt/presentation.xml
262
+ */
263
+ function generatePresentation(): string {
264
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
265
+ <p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" saveSubsetFonts="1">
266
+ <p:sldMasterIdLst>
267
+ <p:sldMasterId id="2147483648" r:id="rId1"/>
268
+ </p:sldMasterIdLst>
269
+ <p:sldSz cx="12192000" cy="6858000"/>
270
+ <p:notesSz cx="6858000" cy="9144000"/>
271
+ <p:defaultTextStyle>
272
+ <a:defPPr>
273
+ <a:defRPr lang="en-US"/>
274
+ </a:defPPr>
275
+ </p:defaultTextStyle>
276
+ </p:presentation>`;
277
+ }
278
+
279
+ /**
280
+ * Generate ppt/theme/theme1.xml with theme colors and fonts
281
+ */
282
+ function generateTheme(theme: PptxTheme): string {
283
+ const c = theme.colors;
284
+ const f = theme.fonts;
285
+
286
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
287
+ <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${theme.name}">
288
+ <a:themeElements>
289
+ <a:clrScheme name="${theme.name}">
290
+ <a:dk1><a:srgbClr val="${c.dk1}"/></a:dk1>
291
+ <a:lt1><a:srgbClr val="${c.lt1}"/></a:lt1>
292
+ <a:dk2><a:srgbClr val="${c.dk2}"/></a:dk2>
293
+ <a:lt2><a:srgbClr val="${c.lt2}"/></a:lt2>
294
+ <a:accent1><a:srgbClr val="${c.accent1}"/></a:accent1>
295
+ <a:accent2><a:srgbClr val="${c.accent2}"/></a:accent2>
296
+ <a:accent3><a:srgbClr val="${c.accent3}"/></a:accent3>
297
+ <a:accent4><a:srgbClr val="${c.accent4}"/></a:accent4>
298
+ <a:accent5><a:srgbClr val="${c.accent5}"/></a:accent5>
299
+ <a:accent6><a:srgbClr val="${c.accent6}"/></a:accent6>
300
+ <a:hlink><a:srgbClr val="${c.hlink}"/></a:hlink>
301
+ <a:folHlink><a:srgbClr val="${c.folHlink}"/></a:folHlink>
302
+ </a:clrScheme>
303
+ <a:fontScheme name="${theme.name}">
304
+ <a:majorFont>
305
+ <a:latin typeface="${f.major}"/>
306
+ <a:ea typeface=""/>
307
+ <a:cs typeface=""/>
308
+ </a:majorFont>
309
+ <a:minorFont>
310
+ <a:latin typeface="${f.minor}"/>
311
+ <a:ea typeface=""/>
312
+ <a:cs typeface=""/>
313
+ </a:minorFont>
314
+ </a:fontScheme>
315
+ <a:fmtScheme name="${theme.name}">
316
+ <a:fillStyleLst>
317
+ <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>
318
+ <a:gradFill rotWithShape="1">
319
+ <a:gsLst>
320
+ <a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>
321
+ <a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>
322
+ <a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>
323
+ </a:gsLst>
324
+ <a:lin ang="16200000" scaled="1"/>
325
+ </a:gradFill>
326
+ <a:gradFill rotWithShape="1">
327
+ <a:gsLst>
328
+ <a:gs pos="0"><a:schemeClr val="phClr"><a:shade val="51000"/><a:satMod val="130000"/></a:schemeClr></a:gs>
329
+ <a:gs pos="80000"><a:schemeClr val="phClr"><a:shade val="93000"/><a:satMod val="130000"/></a:schemeClr></a:gs>
330
+ <a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="94000"/><a:satMod val="135000"/></a:schemeClr></a:gs>
331
+ </a:gsLst>
332
+ <a:lin ang="16200000" scaled="0"/>
333
+ </a:gradFill>
334
+ </a:fillStyleLst>
335
+ <a:lnStyleLst>
336
+ <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>
337
+ <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>
338
+ <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>
339
+ </a:lnStyleLst>
340
+ <a:effectStyleLst>
341
+ <a:effectStyle><a:effectLst/></a:effectStyle>
342
+ <a:effectStyle><a:effectLst/></a:effectStyle>
343
+ <a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle>
344
+ </a:effectStyleLst>
345
+ <a:bgFillStyleLst>
346
+ <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>
347
+ <a:gradFill rotWithShape="1">
348
+ <a:gsLst>
349
+ <a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>
350
+ <a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>
351
+ <a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>
352
+ </a:gsLst>
353
+ <a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>
354
+ </a:gradFill>
355
+ <a:gradFill rotWithShape="1">
356
+ <a:gsLst>
357
+ <a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>
358
+ <a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>
359
+ </a:gsLst>
360
+ <a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>
361
+ </a:gradFill>
362
+ </a:bgFillStyleLst>
363
+ </a:fmtScheme>
364
+ </a:themeElements>
365
+ <a:objectDefaults/>
366
+ <a:extraClrSchemeLst/>
367
+ </a:theme>`;
368
+ }
369
+
370
+ /**
371
+ * Generate slide master with background
372
+ */
373
+ function generateSlideMaster(theme: PptxTheme): string {
374
+ // For dark themes, set explicit background
375
+ let bgFill = '<a:solidFill><a:schemeClr val="lt1"/></a:solidFill>';
376
+ if (theme.background) {
377
+ bgFill = `<a:solidFill><a:srgbClr val="${theme.background}"/></a:solidFill>`;
378
+ }
379
+
380
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
381
+ <p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
382
+ <p:cSld>
383
+ <p:bg>
384
+ <p:bgPr>
385
+ ${bgFill}
386
+ <a:effectLst/>
387
+ </p:bgPr>
388
+ </p:bg>
389
+ <p:spTree>
390
+ <p:nvGrpSpPr>
391
+ <p:cNvPr id="1" name=""/>
392
+ <p:cNvGrpSpPr/>
393
+ <p:nvPr/>
394
+ </p:nvGrpSpPr>
395
+ <p:grpSpPr>
396
+ <a:xfrm>
397
+ <a:off x="0" y="0"/>
398
+ <a:ext cx="0" cy="0"/>
399
+ <a:chOff x="0" y="0"/>
400
+ <a:chExt cx="0" cy="0"/>
401
+ </a:xfrm>
402
+ </p:grpSpPr>
403
+ <p:sp>
404
+ <p:nvSpPr>
405
+ <p:cNvPr id="2" name="Title Placeholder 1"/>
406
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
407
+ <p:nvPr><p:ph type="title"/></p:nvPr>
408
+ </p:nvSpPr>
409
+ <p:spPr>
410
+ <a:xfrm>
411
+ <a:off x="838200" y="365125"/>
412
+ <a:ext cx="10515600" cy="1325563"/>
413
+ </a:xfrm>
414
+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>
415
+ </p:spPr>
416
+ <p:txBody>
417
+ <a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/>
418
+ <a:lstStyle>
419
+ <a:lvl1pPr algn="l">
420
+ <a:defRPr sz="4400" b="0">
421
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
422
+ <a:latin typeface="+mj-lt"/>
423
+ <a:ea typeface="+mj-ea"/>
424
+ <a:cs typeface="+mj-cs"/>
425
+ </a:defRPr>
426
+ </a:lvl1pPr>
427
+ </a:lstStyle>
428
+ <a:p><a:r><a:rPr lang="en-US"/><a:t>Click to edit Master title style</a:t></a:r></a:p>
429
+ </p:txBody>
430
+ </p:sp>
431
+ <p:sp>
432
+ <p:nvSpPr>
433
+ <p:cNvPr id="3" name="Text Placeholder 2"/>
434
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
435
+ <p:nvPr><p:ph type="body" idx="1"/></p:nvPr>
436
+ </p:nvSpPr>
437
+ <p:spPr>
438
+ <a:xfrm>
439
+ <a:off x="838200" y="1825625"/>
440
+ <a:ext cx="10515600" cy="4351338"/>
441
+ </a:xfrm>
442
+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>
443
+ </p:spPr>
444
+ <p:txBody>
445
+ <a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0"/>
446
+ <a:lstStyle>
447
+ <a:lvl1pPr marL="0" indent="0" algn="l">
448
+ <a:buNone/>
449
+ <a:defRPr sz="2800">
450
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
451
+ <a:latin typeface="+mn-lt"/>
452
+ </a:defRPr>
453
+ </a:lvl1pPr>
454
+ <a:lvl2pPr marL="457200" indent="0" algn="l">
455
+ <a:buNone/>
456
+ <a:defRPr sz="2400">
457
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
458
+ <a:latin typeface="+mn-lt"/>
459
+ </a:defRPr>
460
+ </a:lvl2pPr>
461
+ <a:lvl3pPr marL="914400" indent="0" algn="l">
462
+ <a:buNone/>
463
+ <a:defRPr sz="2000">
464
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
465
+ <a:latin typeface="+mn-lt"/>
466
+ </a:defRPr>
467
+ </a:lvl3pPr>
468
+ <a:lvl4pPr marL="1371600" indent="0" algn="l">
469
+ <a:buNone/>
470
+ <a:defRPr sz="1800">
471
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
472
+ <a:latin typeface="+mn-lt"/>
473
+ </a:defRPr>
474
+ </a:lvl4pPr>
475
+ <a:lvl5pPr marL="1828800" indent="0" algn="l">
476
+ <a:buNone/>
477
+ <a:defRPr sz="1800">
478
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
479
+ <a:latin typeface="+mn-lt"/>
480
+ </a:defRPr>
481
+ </a:lvl5pPr>
482
+ </a:lstStyle>
483
+ <a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US"/><a:t>Click to edit Master text styles</a:t></a:r></a:p>
484
+ <a:p><a:pPr lvl="1"/><a:r><a:rPr lang="en-US"/><a:t>Second level</a:t></a:r></a:p>
485
+ <a:p><a:pPr lvl="2"/><a:r><a:rPr lang="en-US"/><a:t>Third level</a:t></a:r></a:p>
486
+ </p:txBody>
487
+ </p:sp>
488
+ <p:sp>
489
+ <p:nvSpPr>
490
+ <p:cNvPr id="4" name="Slide Number Placeholder 3"/>
491
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
492
+ <p:nvPr><p:ph type="sldNum" sz="quarter" idx="4"/></p:nvPr>
493
+ </p:nvSpPr>
494
+ <p:spPr>
495
+ <a:xfrm>
496
+ <a:off x="8610600" y="6356350"/>
497
+ <a:ext cx="2743200" cy="365125"/>
498
+ </a:xfrm>
499
+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>
500
+ </p:spPr>
501
+ <p:txBody>
502
+ <a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" bIns="45720" rtlCol="0" anchor="ctr"/>
503
+ <a:lstStyle>
504
+ <a:lvl1pPr algn="r">
505
+ <a:defRPr sz="1200">
506
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
507
+ </a:defRPr>
508
+ </a:lvl1pPr>
509
+ </a:lstStyle>
510
+ <a:p>
511
+ <a:fld id="{B6F15528-21DE-4FAA-801F-C0D5B2D67AA7}" type="slidenum">
512
+ <a:rPr lang="en-US" smtClean="0"/>
513
+ <a:t>‹#›</a:t>
514
+ </a:fld>
515
+ <a:endParaRPr lang="en-US"/>
516
+ </a:p>
517
+ </p:txBody>
518
+ </p:sp>
519
+ </p:spTree>
520
+ </p:cSld>
521
+ <p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
522
+ <p:sldLayoutIdLst>
523
+ <p:sldLayoutId id="2147483649" r:id="rId1"/>
524
+ <p:sldLayoutId id="2147483650" r:id="rId2"/>
525
+ </p:sldLayoutIdLst>
526
+ <p:txStyles>
527
+ <p:titleStyle>
528
+ <a:lvl1pPr algn="l">
529
+ <a:defRPr sz="4400" b="0" kern="1200">
530
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
531
+ <a:latin typeface="+mj-lt"/>
532
+ <a:ea typeface="+mj-ea"/>
533
+ <a:cs typeface="+mj-cs"/>
534
+ </a:defRPr>
535
+ </a:lvl1pPr>
536
+ </p:titleStyle>
537
+ <p:bodyStyle>
538
+ <a:lvl1pPr marL="0" indent="0" algn="l">
539
+ <a:buNone/>
540
+ <a:defRPr sz="2800" kern="1200">
541
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
542
+ <a:latin typeface="+mn-lt"/>
543
+ <a:ea typeface="+mn-ea"/>
544
+ <a:cs typeface="+mn-cs"/>
545
+ </a:defRPr>
546
+ </a:lvl1pPr>
547
+ <a:lvl2pPr marL="457200" indent="0" algn="l">
548
+ <a:buNone/>
549
+ <a:defRPr sz="2400" kern="1200">
550
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
551
+ <a:latin typeface="+mn-lt"/>
552
+ </a:defRPr>
553
+ </a:lvl2pPr>
554
+ <a:lvl3pPr marL="914400" indent="0" algn="l">
555
+ <a:buNone/>
556
+ <a:defRPr sz="2000" kern="1200">
557
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
558
+ <a:latin typeface="+mn-lt"/>
559
+ </a:defRPr>
560
+ </a:lvl3pPr>
561
+ <a:lvl4pPr marL="1371600" indent="0" algn="l">
562
+ <a:buNone/>
563
+ <a:defRPr sz="1800" kern="1200">
564
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
565
+ <a:latin typeface="+mn-lt"/>
566
+ </a:defRPr>
567
+ </a:lvl4pPr>
568
+ <a:lvl5pPr marL="1828800" indent="0" algn="l">
569
+ <a:buNone/>
570
+ <a:defRPr sz="1800" kern="1200">
571
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
572
+ <a:latin typeface="+mn-lt"/>
573
+ </a:defRPr>
574
+ </a:lvl5pPr>
575
+ </p:bodyStyle>
576
+ <p:otherStyle>
577
+ <a:defPPr><a:defRPr lang="en-US"/></a:defPPr>
578
+ </p:otherStyle>
579
+ </p:txStyles>
580
+ </p:sldMaster>`;
581
+ }
582
+
583
+ /**
584
+ * Generate slide master relationships
585
+ */
586
+ function generateSlideMasterRels(): string {
587
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
588
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
589
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>
590
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout2.xml"/>
591
+ <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
592
+ </Relationships>`;
593
+ }
594
+
595
+ /**
596
+ * Generate title slide layout
597
+ */
598
+ function generateTitleLayout(theme: PptxTheme): string {
599
+ let bgFill = '<a:solidFill><a:schemeClr val="lt1"/></a:solidFill>';
600
+ if (theme.background) {
601
+ bgFill = `<a:solidFill><a:srgbClr val="${theme.background}"/></a:solidFill>`;
602
+ }
603
+
604
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
605
+ <p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="title" preserve="1">
606
+ <p:cSld name="Title Slide">
607
+ <p:bg>
608
+ <p:bgPr>
609
+ ${bgFill}
610
+ <a:effectLst/>
611
+ </p:bgPr>
612
+ </p:bg>
613
+ <p:spTree>
614
+ <p:nvGrpSpPr>
615
+ <p:cNvPr id="1" name=""/>
616
+ <p:cNvGrpSpPr/>
617
+ <p:nvPr/>
618
+ </p:nvGrpSpPr>
619
+ <p:grpSpPr>
620
+ <a:xfrm>
621
+ <a:off x="0" y="0"/>
622
+ <a:ext cx="0" cy="0"/>
623
+ <a:chOff x="0" y="0"/>
624
+ <a:chExt cx="0" cy="0"/>
625
+ </a:xfrm>
626
+ </p:grpSpPr>
627
+ <p:sp>
628
+ <p:nvSpPr>
629
+ <p:cNvPr id="2" name="Title 1"/>
630
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
631
+ <p:nvPr><p:ph type="ctrTitle"/></p:nvPr>
632
+ </p:nvSpPr>
633
+ <p:spPr>
634
+ <a:xfrm>
635
+ <a:off x="1524000" y="1122363"/>
636
+ <a:ext cx="9144000" cy="2387600"/>
637
+ </a:xfrm>
638
+ </p:spPr>
639
+ <p:txBody>
640
+ <a:bodyPr anchor="b"/>
641
+ <a:lstStyle>
642
+ <a:lvl1pPr algn="ctr">
643
+ <a:defRPr sz="6000">
644
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
645
+ </a:defRPr>
646
+ </a:lvl1pPr>
647
+ </a:lstStyle>
648
+ <a:p><a:r><a:rPr lang="en-US"/><a:t>Click to edit title</a:t></a:r></a:p>
649
+ </p:txBody>
650
+ </p:sp>
651
+ <p:sp>
652
+ <p:nvSpPr>
653
+ <p:cNvPr id="3" name="Subtitle 2"/>
654
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
655
+ <p:nvPr><p:ph type="subTitle" idx="1"/></p:nvPr>
656
+ </p:nvSpPr>
657
+ <p:spPr>
658
+ <a:xfrm>
659
+ <a:off x="1524000" y="3602038"/>
660
+ <a:ext cx="9144000" cy="1655762"/>
661
+ </a:xfrm>
662
+ </p:spPr>
663
+ <p:txBody>
664
+ <a:bodyPr/>
665
+ <a:lstStyle>
666
+ <a:lvl1pPr marL="0" indent="0" algn="ctr">
667
+ <a:buNone/>
668
+ <a:defRPr sz="2400">
669
+ <a:solidFill><a:schemeClr val="dk1"/></a:solidFill>
670
+ </a:defRPr>
671
+ </a:lvl1pPr>
672
+ </a:lstStyle>
673
+ <a:p><a:r><a:rPr lang="en-US"/><a:t>Click to edit subtitle</a:t></a:r></a:p>
674
+ </p:txBody>
675
+ </p:sp>
676
+ </p:spTree>
677
+ </p:cSld>
678
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
679
+ </p:sldLayout>`;
680
+ }
681
+
682
+ /**
683
+ * Generate content slide layout
684
+ */
685
+ function generateContentLayout(theme: PptxTheme): string {
686
+ let bgFill = '<a:solidFill><a:schemeClr val="lt1"/></a:solidFill>';
687
+ if (theme.background) {
688
+ bgFill = `<a:solidFill><a:srgbClr val="${theme.background}"/></a:solidFill>`;
689
+ }
690
+
691
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
692
+ <p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="obj" preserve="1">
693
+ <p:cSld name="Title and Content">
694
+ <p:bg>
695
+ <p:bgPr>
696
+ ${bgFill}
697
+ <a:effectLst/>
698
+ </p:bgPr>
699
+ </p:bg>
700
+ <p:spTree>
701
+ <p:nvGrpSpPr>
702
+ <p:cNvPr id="1" name=""/>
703
+ <p:cNvGrpSpPr/>
704
+ <p:nvPr/>
705
+ </p:nvGrpSpPr>
706
+ <p:grpSpPr>
707
+ <a:xfrm>
708
+ <a:off x="0" y="0"/>
709
+ <a:ext cx="0" cy="0"/>
710
+ <a:chOff x="0" y="0"/>
711
+ <a:chExt cx="0" cy="0"/>
712
+ </a:xfrm>
713
+ </p:grpSpPr>
714
+ <p:sp>
715
+ <p:nvSpPr>
716
+ <p:cNvPr id="2" name="Title 1"/>
717
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
718
+ <p:nvPr><p:ph type="title"/></p:nvPr>
719
+ </p:nvSpPr>
720
+ <p:spPr/>
721
+ <p:txBody>
722
+ <a:bodyPr/>
723
+ <a:lstStyle/>
724
+ <a:p><a:r><a:rPr lang="en-US"/><a:t>Click to edit title</a:t></a:r></a:p>
725
+ </p:txBody>
726
+ </p:sp>
727
+ <p:sp>
728
+ <p:nvSpPr>
729
+ <p:cNvPr id="3" name="Content Placeholder 2"/>
730
+ <p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr>
731
+ <p:nvPr><p:ph idx="1"/></p:nvPr>
732
+ </p:nvSpPr>
733
+ <p:spPr/>
734
+ <p:txBody>
735
+ <a:bodyPr/>
736
+ <a:lstStyle/>
737
+ <a:p><a:pPr lvl="0"/><a:r><a:rPr lang="en-US"/><a:t>Click to edit text</a:t></a:r></a:p>
738
+ </p:txBody>
739
+ </p:sp>
740
+ </p:spTree>
741
+ </p:cSld>
742
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
743
+ </p:sldLayout>`;
744
+ }
745
+
746
+ /**
747
+ * Generate slide layout relationships
748
+ */
749
+ function generateSlideLayoutRels(): string {
750
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
751
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
752
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml"/>
753
+ </Relationships>`;
754
+ }
755
+
756
+ /**
757
+ * Generate docProps/core.xml
758
+ */
759
+ function generateCore(themeName: string): string {
760
+ const now = new Date().toISOString();
761
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
762
+ <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
763
+ <dc:title>${themeName} Theme</dc:title>
764
+ <dc:creator>docrev</dc:creator>
765
+ <cp:lastModifiedBy>docrev</cp:lastModifiedBy>
766
+ <dcterms:created xsi:type="dcterms:W3CDTF">${now}</dcterms:created>
767
+ <dcterms:modified xsi:type="dcterms:W3CDTF">${now}</dcterms:modified>
768
+ </cp:coreProperties>`;
769
+ }
770
+
771
+ /**
772
+ * Generate docProps/app.xml
773
+ */
774
+ function generateApp(): string {
775
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
776
+ <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
777
+ <Application>docrev</Application>
778
+ <PresentationFormat>Widescreen</PresentationFormat>
779
+ <Slides>0</Slides>
780
+ </Properties>`;
781
+ }
782
+
783
+ /**
784
+ * Get pandoc's default reference.pptx as a base template
785
+ */
786
+ function getPandocReferenceTemplate(): Buffer {
787
+ try {
788
+ // Use pandoc to extract the default reference template
789
+ const result = execSync('pandoc --print-default-data-file reference.pptx', {
790
+ encoding: 'buffer',
791
+ maxBuffer: 1024 * 1024, // 1MB should be plenty
792
+ });
793
+ return result;
794
+ } catch (err: unknown) {
795
+ const message = err instanceof Error ? err.message : String(err);
796
+ throw new Error(`Failed to get pandoc reference template: ${message}`);
797
+ }
798
+ }
799
+
800
+ /**
801
+ * Generate a PPTX theme file by modifying pandoc's reference template
802
+ */
803
+ export function generateThemeFile(themeName: string, outputPath: string): string {
804
+ const theme = PPTX_THEMES[themeName];
805
+ if (!theme) {
806
+ throw new Error(`Unknown theme: ${themeName}`);
807
+ }
808
+
809
+ // Get pandoc's reference template as base
810
+ const templateBuffer = getPandocReferenceTemplate();
811
+ const zip = new AdmZip(templateBuffer);
812
+
813
+ // Replace theme.xml with our custom theme
814
+ zip.updateFile('ppt/theme/theme1.xml', Buffer.from(generateTheme(theme), 'utf-8'));
815
+
816
+ // For dark themes, update slide masters and layouts with background color
817
+ if (theme.background) {
818
+ updateBackgroundColor(zip, theme.background);
819
+ }
820
+
821
+ // Ensure output directory exists
822
+ const dir = dirname(outputPath);
823
+ if (!existsSync(dir)) {
824
+ mkdirSync(dir, { recursive: true });
825
+ }
826
+
827
+ zip.writeZip(outputPath);
828
+ return outputPath;
829
+ }
830
+
831
+ /**
832
+ * Update background color in slide masters and layouts for dark themes
833
+ */
834
+ function updateBackgroundColor(zip: AdmZip, bgColor: string): void {
835
+ const entries = zip.getEntries();
836
+
837
+ for (const entry of entries) {
838
+ const name = entry.entryName;
839
+
840
+ // Update slide masters and layouts
841
+ if (name.includes('slideMasters/') || name.includes('slideLayouts/')) {
842
+ if (name.endsWith('.xml') && !name.includes('_rels')) {
843
+ let content = entry.getData().toString('utf-8');
844
+
845
+ // Replace light background with dark background
846
+ // Look for <a:schemeClr val="lt1"/> in bgPr and replace
847
+ content = content.replace(
848
+ /<p:bg>[\s\S]*?<\/p:bg>/g,
849
+ `<p:bg><p:bgPr><a:solidFill><a:srgbClr val="${bgColor}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>`
850
+ );
851
+
852
+ zip.updateFile(name, Buffer.from(content, 'utf-8'));
853
+ }
854
+ }
855
+ }
856
+ }
857
+
858
+ /**
859
+ * Get path to bundled theme file, generating if needed
860
+ */
861
+ export function getThemePath(themeName: string): string | null {
862
+ if (!PPTX_THEMES[themeName]) {
863
+ return null;
864
+ }
865
+
866
+ const themesDir = join(__dirname, 'pptx-themes');
867
+ const themePath = join(themesDir, `${themeName}.pptx`);
868
+
869
+ // Generate if doesn't exist
870
+ if (!existsSync(themePath)) {
871
+ if (!existsSync(themesDir)) {
872
+ mkdirSync(themesDir, { recursive: true });
873
+ }
874
+ generateThemeFile(themeName, themePath);
875
+ }
876
+
877
+ return themePath;
878
+ }
879
+
880
+ /**
881
+ * Generate all theme files
882
+ */
883
+ export function generateAllThemes(outputDir: string): Array<{ theme: string; path: string }> {
884
+ if (!existsSync(outputDir)) {
885
+ mkdirSync(outputDir, { recursive: true });
886
+ }
887
+
888
+ const results = [];
889
+ for (const themeName of Object.keys(PPTX_THEMES)) {
890
+ const outputPath = join(outputDir, `${themeName}.pptx`);
891
+ generateThemeFile(themeName, outputPath);
892
+ results.push({ theme: themeName, path: outputPath });
893
+ }
894
+
895
+ return results;
896
+ }