pptx-templates 0.0.0-stage → 0.1.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 (320) hide show
  1. package/AI-INSTRUCTOR.md +2253 -0
  2. package/CHANGELOG.md +49 -0
  3. package/LICENSE +23 -0
  4. package/README.md +86 -2
  5. package/dist/automizer.d.ts +224 -0
  6. package/dist/automizer.js +704 -0
  7. package/dist/automizer.js.map +1 -0
  8. package/dist/classes/content-type-registry.d.ts +46 -0
  9. package/dist/classes/content-type-registry.js +170 -0
  10. package/dist/classes/content-type-registry.js.map +1 -0
  11. package/dist/classes/element-importer.d.ts +49 -0
  12. package/dist/classes/element-importer.js +254 -0
  13. package/dist/classes/element-importer.js.map +1 -0
  14. package/dist/classes/has-shapes.d.ts +286 -0
  15. package/dist/classes/has-shapes.js +385 -0
  16. package/dist/classes/has-shapes.js.map +1 -0
  17. package/dist/classes/layout.d.ts +42 -0
  18. package/dist/classes/layout.js +113 -0
  19. package/dist/classes/layout.js.map +1 -0
  20. package/dist/classes/master.d.ts +45 -0
  21. package/dist/classes/master.js +146 -0
  22. package/dist/classes/master.js.map +1 -0
  23. package/dist/classes/placeholder-normalizer.d.ts +42 -0
  24. package/dist/classes/placeholder-normalizer.js +136 -0
  25. package/dist/classes/placeholder-normalizer.js.map +1 -0
  26. package/dist/classes/related-content-copier.d.ts +18 -0
  27. package/dist/classes/related-content-copier.js +114 -0
  28. package/dist/classes/related-content-copier.js.map +1 -0
  29. package/dist/classes/shape.d.ts +62 -0
  30. package/dist/classes/shape.js +194 -0
  31. package/dist/classes/shape.js.map +1 -0
  32. package/dist/classes/slide-master-remover.d.ts +44 -0
  33. package/dist/classes/slide-master-remover.js +201 -0
  34. package/dist/classes/slide-master-remover.js.map +1 -0
  35. package/dist/classes/slide-notes-copier.d.ts +26 -0
  36. package/dist/classes/slide-notes-copier.js +76 -0
  37. package/dist/classes/slide-notes-copier.js.map +1 -0
  38. package/dist/classes/slide.d.ts +91 -0
  39. package/dist/classes/slide.js +286 -0
  40. package/dist/classes/slide.js.map +1 -0
  41. package/dist/classes/template.d.ts +137 -0
  42. package/dist/classes/template.js +311 -0
  43. package/dist/classes/template.js.map +1 -0
  44. package/dist/constants/constants.d.ts +11 -0
  45. package/dist/constants/constants.js +182 -0
  46. package/dist/constants/constants.js.map +1 -0
  47. package/dist/enums/chart-type.d.ts +11 -0
  48. package/dist/enums/chart-type.js +16 -0
  49. package/dist/enums/chart-type.js.map +1 -0
  50. package/dist/enums/content-type-map.d.ts +16 -0
  51. package/dist/enums/content-type-map.js +23 -0
  52. package/dist/enums/content-type-map.js.map +1 -0
  53. package/dist/enums/element-type.d.ts +14 -0
  54. package/dist/enums/element-type.js +20 -0
  55. package/dist/enums/element-type.js.map +1 -0
  56. package/dist/errors.d.ts +81 -0
  57. package/dist/errors.js +100 -0
  58. package/dist/errors.js.map +1 -0
  59. package/dist/extensions/index.d.ts +5 -0
  60. package/dist/extensions/index.js +31 -0
  61. package/dist/extensions/index.js.map +1 -0
  62. package/dist/extensions/pptxgenjs-compat/img-broken-png.d.ts +5 -0
  63. package/dist/extensions/pptxgenjs-compat/img-broken-png.js +9 -0
  64. package/dist/extensions/pptxgenjs-compat/img-broken-png.js.map +1 -0
  65. package/dist/extensions/pptxgenjs-compat/index.d.ts +5 -0
  66. package/dist/extensions/pptxgenjs-compat/index.js +10 -0
  67. package/dist/extensions/pptxgenjs-compat/index.js.map +1 -0
  68. package/dist/extensions/pptxgenjs-compat/svg-fallback.d.ts +14 -0
  69. package/dist/extensions/pptxgenjs-compat/svg-fallback.js +139 -0
  70. package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -0
  71. package/dist/extensions/template-logic/commands.d.ts +22 -0
  72. package/dist/extensions/template-logic/commands.js +83 -0
  73. package/dist/extensions/template-logic/commands.js.map +1 -0
  74. package/dist/extensions/template-logic/expression.d.ts +61 -0
  75. package/dist/extensions/template-logic/expression.js +499 -0
  76. package/dist/extensions/template-logic/expression.js.map +1 -0
  77. package/dist/extensions/template-logic/images.d.ts +26 -0
  78. package/dist/extensions/template-logic/images.js +183 -0
  79. package/dist/extensions/template-logic/images.js.map +1 -0
  80. package/dist/extensions/template-logic/index.d.ts +14 -0
  81. package/dist/extensions/template-logic/index.js +64 -0
  82. package/dist/extensions/template-logic/index.js.map +1 -0
  83. package/dist/extensions/template-logic/list-commands.d.ts +9 -0
  84. package/dist/extensions/template-logic/list-commands.js +72 -0
  85. package/dist/extensions/template-logic/list-commands.js.map +1 -0
  86. package/dist/extensions/template-logic/renderer.d.ts +85 -0
  87. package/dist/extensions/template-logic/renderer.js +867 -0
  88. package/dist/extensions/template-logic/renderer.js.map +1 -0
  89. package/dist/extensions/template-logic/types.d.ts +62 -0
  90. package/dist/extensions/template-logic/types.js +3 -0
  91. package/dist/extensions/template-logic/types.js.map +1 -0
  92. package/dist/helper/archive/archive-fs.d.ts +45 -0
  93. package/dist/helper/archive/archive-fs.js +206 -0
  94. package/dist/helper/archive/archive-fs.js.map +1 -0
  95. package/dist/helper/archive/archive-jszip.d.ts +31 -0
  96. package/dist/helper/archive/archive-jszip.js +173 -0
  97. package/dist/helper/archive/archive-jszip.js.map +1 -0
  98. package/dist/helper/archive/archive.d.ts +27 -0
  99. package/dist/helper/archive/archive.js +78 -0
  100. package/dist/helper/archive/archive.js.map +1 -0
  101. package/dist/helper/cell-id-helper.d.ts +25 -0
  102. package/dist/helper/cell-id-helper.js +95 -0
  103. package/dist/helper/cell-id-helper.js.map +1 -0
  104. package/dist/helper/compute-src-rect.d.ts +9 -0
  105. package/dist/helper/compute-src-rect.js +52 -0
  106. package/dist/helper/compute-src-rect.js.map +1 -0
  107. package/dist/helper/content-tracker.d.ts +31 -0
  108. package/dist/helper/content-tracker.js +227 -0
  109. package/dist/helper/content-tracker.js.map +1 -0
  110. package/dist/helper/count-helper.d.ts +33 -0
  111. package/dist/helper/count-helper.js +140 -0
  112. package/dist/helper/count-helper.js.map +1 -0
  113. package/dist/helper/css-style-parser.d.ts +52 -0
  114. package/dist/helper/css-style-parser.js +246 -0
  115. package/dist/helper/css-style-parser.js.map +1 -0
  116. package/dist/helper/file-helper.d.ts +36 -0
  117. package/dist/helper/file-helper.js +150 -0
  118. package/dist/helper/file-helper.js.map +1 -0
  119. package/dist/helper/general-helper.d.ts +6 -0
  120. package/dist/helper/general-helper.js +34 -0
  121. package/dist/helper/general-helper.js.map +1 -0
  122. package/dist/helper/generate/generate-pptxgenjs.d.ts +37 -0
  123. package/dist/helper/generate/generate-pptxgenjs.js +134 -0
  124. package/dist/helper/generate/generate-pptxgenjs.js.map +1 -0
  125. package/dist/helper/html-to-multitext-helper.d.ts +84 -0
  126. package/dist/helper/html-to-multitext-helper.js +490 -0
  127. package/dist/helper/html-to-multitext-helper.js.map +1 -0
  128. package/dist/helper/hyperlink-processor.d.ts +54 -0
  129. package/dist/helper/hyperlink-processor.js +289 -0
  130. package/dist/helper/hyperlink-processor.js.map +1 -0
  131. package/dist/helper/image-dimensions.d.ts +21 -0
  132. package/dist/helper/image-dimensions.js +202 -0
  133. package/dist/helper/image-dimensions.js.map +1 -0
  134. package/dist/helper/jszip-helper.d.ts +21 -0
  135. package/dist/helper/jszip-helper.js +162 -0
  136. package/dist/helper/jszip-helper.js.map +1 -0
  137. package/dist/helper/layout-index.d.ts +55 -0
  138. package/dist/helper/layout-index.js +155 -0
  139. package/dist/helper/layout-index.js.map +1 -0
  140. package/dist/helper/logger.d.ts +53 -0
  141. package/dist/helper/logger.js +73 -0
  142. package/dist/helper/logger.js.map +1 -0
  143. package/dist/helper/media-deduplicator.d.ts +42 -0
  144. package/dist/helper/media-deduplicator.js +88 -0
  145. package/dist/helper/media-deduplicator.js.map +1 -0
  146. package/dist/helper/modify-background-helper.d.ts +19 -0
  147. package/dist/helper/modify-background-helper.js +59 -0
  148. package/dist/helper/modify-background-helper.js.map +1 -0
  149. package/dist/helper/modify-chart-helper.d.ts +159 -0
  150. package/dist/helper/modify-chart-helper.js +642 -0
  151. package/dist/helper/modify-chart-helper.js.map +1 -0
  152. package/dist/helper/modify-cleanup-helper.d.ts +69 -0
  153. package/dist/helper/modify-cleanup-helper.js +343 -0
  154. package/dist/helper/modify-cleanup-helper.js.map +1 -0
  155. package/dist/helper/modify-color-helper.d.ts +35 -0
  156. package/dist/helper/modify-color-helper.js +211 -0
  157. package/dist/helper/modify-color-helper.js.map +1 -0
  158. package/dist/helper/modify-helper.d.ts +23 -0
  159. package/dist/helper/modify-helper.js +61 -0
  160. package/dist/helper/modify-helper.js.map +1 -0
  161. package/dist/helper/modify-hyperlink-element.d.ts +9 -0
  162. package/dist/helper/modify-hyperlink-element.js +34 -0
  163. package/dist/helper/modify-hyperlink-element.js.map +1 -0
  164. package/dist/helper/modify-hyperlink-helper.d.ts +42 -0
  165. package/dist/helper/modify-hyperlink-helper.js +258 -0
  166. package/dist/helper/modify-hyperlink-helper.js.map +1 -0
  167. package/dist/helper/modify-image-helper.d.ts +23 -0
  168. package/dist/helper/modify-image-helper.js +157 -0
  169. package/dist/helper/modify-image-helper.js.map +1 -0
  170. package/dist/helper/modify-presentation-helper.d.ts +55 -0
  171. package/dist/helper/modify-presentation-helper.js +177 -0
  172. package/dist/helper/modify-presentation-helper.js.map +1 -0
  173. package/dist/helper/modify-shape-helper.d.ts +111 -0
  174. package/dist/helper/modify-shape-helper.js +340 -0
  175. package/dist/helper/modify-shape-helper.js.map +1 -0
  176. package/dist/helper/modify-table-helper.d.ts +11 -0
  177. package/dist/helper/modify-table-helper.js +100 -0
  178. package/dist/helper/modify-table-helper.js.map +1 -0
  179. package/dist/helper/modify-text-helper.d.ts +62 -0
  180. package/dist/helper/modify-text-helper.js +244 -0
  181. package/dist/helper/modify-text-helper.js.map +1 -0
  182. package/dist/helper/modify-xml-helper.d.ts +52 -0
  183. package/dist/helper/modify-xml-helper.js +305 -0
  184. package/dist/helper/modify-xml-helper.js.map +1 -0
  185. package/dist/helper/multitext-helper.d.ts +116 -0
  186. package/dist/helper/multitext-helper.js +462 -0
  187. package/dist/helper/multitext-helper.js.map +1 -0
  188. package/dist/helper/ppt-paths.d.ts +76 -0
  189. package/dist/helper/ppt-paths.js +116 -0
  190. package/dist/helper/ppt-paths.js.map +1 -0
  191. package/dist/helper/shape-type-detector.d.ts +34 -0
  192. package/dist/helper/shape-type-detector.js +99 -0
  193. package/dist/helper/shape-type-detector.js.map +1 -0
  194. package/dist/helper/text-replace-helper.d.ts +30 -0
  195. package/dist/helper/text-replace-helper.js +147 -0
  196. package/dist/helper/text-replace-helper.js.map +1 -0
  197. package/dist/helper/xml/lnLRTB.d.ts +1 -0
  198. package/dist/helper/xml/lnLRTB.js +62 -0
  199. package/dist/helper/xml/lnLRTB.js.map +1 -0
  200. package/dist/helper/xml/prstGeom.d.ts +1 -0
  201. package/dist/helper/xml/prstGeom.js +11 -0
  202. package/dist/helper/xml/prstGeom.js.map +1 -0
  203. package/dist/helper/xml-elements.d.ts +134 -0
  204. package/dist/helper/xml-elements.js +538 -0
  205. package/dist/helper/xml-elements.js.map +1 -0
  206. package/dist/helper/xml-helper.d.ts +120 -0
  207. package/dist/helper/xml-helper.js +495 -0
  208. package/dist/helper/xml-helper.js.map +1 -0
  209. package/dist/helper/xml-placeholder-helper.d.ts +92 -0
  210. package/dist/helper/xml-placeholder-helper.js +454 -0
  211. package/dist/helper/xml-placeholder-helper.js.map +1 -0
  212. package/dist/helper/xml-pretty-print.d.ts +17 -0
  213. package/dist/helper/xml-pretty-print.js +88 -0
  214. package/dist/helper/xml-pretty-print.js.map +1 -0
  215. package/dist/helper/xml-relationship-helper.d.ts +103 -0
  216. package/dist/helper/xml-relationship-helper.js +397 -0
  217. package/dist/helper/xml-relationship-helper.js.map +1 -0
  218. package/dist/helper/xml-slide-helper.d.ts +107 -0
  219. package/dist/helper/xml-slide-helper.js +676 -0
  220. package/dist/helper/xml-slide-helper.js.map +1 -0
  221. package/dist/helper/xml-template-helper.d.ts +42 -0
  222. package/dist/helper/xml-template-helper.js +252 -0
  223. package/dist/helper/xml-template-helper.js.map +1 -0
  224. package/dist/helper/xmldom-sax-patch.d.ts +18 -0
  225. package/dist/helper/xmldom-sax-patch.js +58 -0
  226. package/dist/helper/xmldom-sax-patch.js.map +1 -0
  227. package/dist/index.d.ts +81 -0
  228. package/dist/index.js +177 -0
  229. package/dist/index.js.map +1 -0
  230. package/dist/interfaces/iarchive.d.ts +43 -0
  231. package/dist/interfaces/iarchive.js +3 -0
  232. package/dist/interfaces/iarchive.js.map +1 -0
  233. package/dist/interfaces/ichart.d.ts +7 -0
  234. package/dist/interfaces/ichart.js +3 -0
  235. package/dist/interfaces/ichart.js.map +1 -0
  236. package/dist/interfaces/icounter.d.ts +7 -0
  237. package/dist/interfaces/icounter.js +3 -0
  238. package/dist/interfaces/icounter.js.map +1 -0
  239. package/dist/interfaces/igenerator.d.ts +4 -0
  240. package/dist/interfaces/igenerator.js +3 -0
  241. package/dist/interfaces/igenerator.js.map +1 -0
  242. package/dist/interfaces/iimage.d.ts +7 -0
  243. package/dist/interfaces/iimage.js +3 -0
  244. package/dist/interfaces/iimage.js.map +1 -0
  245. package/dist/interfaces/ilayout.d.ts +14 -0
  246. package/dist/interfaces/ilayout.js +3 -0
  247. package/dist/interfaces/ilayout.js.map +1 -0
  248. package/dist/interfaces/imaster.d.ts +15 -0
  249. package/dist/interfaces/imaster.js +3 -0
  250. package/dist/interfaces/imaster.js.map +1 -0
  251. package/dist/interfaces/imulti-text.d.ts +50 -0
  252. package/dist/interfaces/imulti-text.js +3 -0
  253. package/dist/interfaces/imulti-text.js.map +1 -0
  254. package/dist/interfaces/ipptxgenjs-slide.d.ts +40 -0
  255. package/dist/interfaces/ipptxgenjs-slide.js +3 -0
  256. package/dist/interfaces/ipptxgenjs-slide.js.map +1 -0
  257. package/dist/interfaces/ipresentation-props.d.ts +16 -0
  258. package/dist/interfaces/ipresentation-props.js +3 -0
  259. package/dist/interfaces/ipresentation-props.js.map +1 -0
  260. package/dist/interfaces/ishape-action.d.ts +18 -0
  261. package/dist/interfaces/ishape-action.js +3 -0
  262. package/dist/interfaces/ishape-action.js.map +1 -0
  263. package/dist/interfaces/ishape.d.ts +5 -0
  264. package/dist/interfaces/ishape.js +3 -0
  265. package/dist/interfaces/ishape.js.map +1 -0
  266. package/dist/interfaces/islide.d.ts +71 -0
  267. package/dist/interfaces/islide.js +3 -0
  268. package/dist/interfaces/islide.js.map +1 -0
  269. package/dist/interfaces/itemplate.d.ts +9 -0
  270. package/dist/interfaces/itemplate.js +3 -0
  271. package/dist/interfaces/itemplate.js.map +1 -0
  272. package/dist/interfaces/pres-template.d.ts +9 -0
  273. package/dist/interfaces/pres-template.js +3 -0
  274. package/dist/interfaces/pres-template.js.map +1 -0
  275. package/dist/interfaces/root-pres-template.d.ts +38 -0
  276. package/dist/interfaces/root-pres-template.js +3 -0
  277. package/dist/interfaces/root-pres-template.js.map +1 -0
  278. package/dist/modify/modify-chart.d.ts +74 -0
  279. package/dist/modify/modify-chart.js +753 -0
  280. package/dist/modify/modify-chart.js.map +1 -0
  281. package/dist/modify/modify-table.d.ts +64 -0
  282. package/dist/modify/modify-table.js +435 -0
  283. package/dist/modify/modify-table.js.map +1 -0
  284. package/dist/shapes/chart.d.ts +91 -0
  285. package/dist/shapes/chart.js +437 -0
  286. package/dist/shapes/chart.js.map +1 -0
  287. package/dist/shapes/diagram.d.ts +33 -0
  288. package/dist/shapes/diagram.js +167 -0
  289. package/dist/shapes/diagram.js.map +1 -0
  290. package/dist/shapes/generic.d.ts +27 -0
  291. package/dist/shapes/generic.js +118 -0
  292. package/dist/shapes/generic.js.map +1 -0
  293. package/dist/shapes/hyperlink.d.ts +27 -0
  294. package/dist/shapes/hyperlink.js +193 -0
  295. package/dist/shapes/hyperlink.js.map +1 -0
  296. package/dist/shapes/image.d.ts +47 -0
  297. package/dist/shapes/image.js +244 -0
  298. package/dist/shapes/image.js.map +1 -0
  299. package/dist/shapes/ole.d.ts +30 -0
  300. package/dist/shapes/ole.js +237 -0
  301. package/dist/shapes/ole.js.map +1 -0
  302. package/dist/types/chart-types.d.ts +115 -0
  303. package/dist/types/chart-types.js +3 -0
  304. package/dist/types/chart-types.js.map +1 -0
  305. package/dist/types/modify-types.d.ts +128 -0
  306. package/dist/types/modify-types.js +3 -0
  307. package/dist/types/modify-types.js.map +1 -0
  308. package/dist/types/shape-types.d.ts +40 -0
  309. package/dist/types/shape-types.js +3 -0
  310. package/dist/types/shape-types.js.map +1 -0
  311. package/dist/types/table-types.d.ts +38 -0
  312. package/dist/types/table-types.js +3 -0
  313. package/dist/types/table-types.js.map +1 -0
  314. package/dist/types/types.d.ts +317 -0
  315. package/dist/types/types.js +16 -0
  316. package/dist/types/types.js.map +1 -0
  317. package/dist/types/xml-types.d.ts +168 -0
  318. package/dist/types/xml-types.js +3 -0
  319. package/dist/types/xml-types.js.map +1 -0
  320. package/package.json +92 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-types.js","sourceRoot":"","sources":["../../src/types/chart-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ import { XmlElement, XmlElementCollection } from './xml-types';
2
+ export type ModifyCallback = {
3
+ (element: XmlElement): void;
4
+ };
5
+ export type ModifyCollectionCallback = {
6
+ (collection: XmlElementCollection): void;
7
+ };
8
+ /**
9
+ * A Modification is applied to xml elements by ModificationTags.
10
+ * Put one or more ModifyCallbacks to the 'modify' prop and address the
11
+ * target element with `index` or `matchIdx`.
12
+ *
13
+ * The contract of the control fields (enforced by ModifyXmlHelper):
14
+ *
15
+ * - `index` is *positional over the existing elements* of the tag, in
16
+ * document order — it is never compared to a `<c:idx>` payload. When the
17
+ * element at `index` does not exist, the collection can grow by at most
18
+ * ONE created/cloned element per modify() call; a positional index is
19
+ * therefore only satisfiable if callers walk 0, 1, 2, … without gaps.
20
+ * - `matchIdx` addresses sparse chart collections (`c:dPt`, `c:dLbl`) by
21
+ * the value of their `<c:idx val="…"/>` child instead of by position.
22
+ * A missing element is created (cloned from the clean `fromIndex`
23
+ * template when given, else built as a minimal shell), stamped with
24
+ * `matchIdx`, and inserted keeping ascending `c:idx` order. Takes
25
+ * precedence over `index`.
26
+ * - `isRequired: false` guarantees "modify if present, never create": an
27
+ * absent target makes the modification (and its `children`) a no-op,
28
+ * logged at debug level. With the default (`true`), a target that can
29
+ * neither be found nor created is logged as a warning.
30
+ * - `fromIndex` / `fromPrevious` select the clone source when the target
31
+ * has to be created from existing siblings: a clean pre-modification
32
+ * template of the element at `fromIndex`, or the direct predecessor.
33
+ */
34
+ export type Modification = {
35
+ index?: number;
36
+ matchIdx?: number;
37
+ last?: boolean;
38
+ all?: boolean;
39
+ collection?: ModifyCollectionCallback;
40
+ children?: ModificationTags;
41
+ modify?: ModifyCallback | ModifyCallback[];
42
+ create?: any;
43
+ isRequired?: boolean;
44
+ fromPrevious?: boolean;
45
+ fromIndex?: number;
46
+ forceCreate?: boolean;
47
+ };
48
+ /**
49
+ * ModificationTags will specify the target xml tags for your
50
+ * modifications. ModificationTags can be nested by using 'children'.
51
+ */
52
+ export type ModificationTags = {
53
+ [tag: string]: Modification;
54
+ };
55
+ /**
56
+ * Content for a bulleted list: items are stringified; a nested array
57
+ * increases the indentation level of its items.
58
+ */
59
+ export type BulletListContent = (string | number | BulletListContent)[];
60
+ export type Color = {
61
+ type?: 'schemeClr' | 'srgbClr';
62
+ value: string;
63
+ shade?: string | number;
64
+ tint?: string | number;
65
+ alpha?: string | number;
66
+ };
67
+ export type Border = {
68
+ tag: 'lnL' | 'lnR' | 'lnT' | 'lnB';
69
+ type?: 'solid' | 'sysDot' | string;
70
+ weight?: number;
71
+ color?: Color;
72
+ };
73
+ /**
74
+ * Outline (a.k.a. line/border) of a shape, picture or placeholder.
75
+ * Mirrors the vocabulary of `Border` (used for table cells), minus the
76
+ * cell-specific `tag`: a shape has exactly one outline.
77
+ */
78
+ export type ShapeOutline = {
79
+ /**
80
+ * Line width in EMU, same unit as `Border.weight`.
81
+ * 1pt = 12700 EMU, 1cm = 360000 EMU. Use `PtToEmu()`/`CmToDxa()`.
82
+ */
83
+ weight?: number;
84
+ /** Dash style, rendered as <a:prstDash val="..."/> */
85
+ type?: 'solid' | 'dot' | 'sysDot' | 'dash' | 'sysDash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | string;
86
+ color?: Color;
87
+ };
88
+ export type HyperlinkInfo = {
89
+ target: string | number;
90
+ isInternal?: boolean;
91
+ };
92
+ export type TextStyle = {
93
+ /** Font size in 1/100 pt (e.g. 1400 = 14pt) */
94
+ size?: number;
95
+ color?: Color;
96
+ isBold?: boolean;
97
+ isItalics?: boolean;
98
+ isUnderlined?: boolean;
99
+ isSuperscript?: boolean;
100
+ isSubscript?: boolean;
101
+ /** Strikethrough, rendered as strike="sngStrike" */
102
+ isStrike?: boolean;
103
+ /** Typeface name, rendered as <a:latin typeface="..."/> */
104
+ fontFamily?: string;
105
+ /** Text highlight (marker pen), rendered as <a:highlight> */
106
+ highlight?: Color;
107
+ hyperlink?: HyperlinkInfo;
108
+ };
109
+ export type ImageStyle = {
110
+ duotone?: {
111
+ color?: Color;
112
+ prstClr?: string;
113
+ tint?: number;
114
+ satMod?: number;
115
+ };
116
+ };
117
+ export type ReplaceText = {
118
+ replace: string;
119
+ by: ReplaceTextReplacement | ReplaceTextReplacement[];
120
+ };
121
+ export type ReplaceTextReplacement = {
122
+ text: string;
123
+ style?: TextStyle;
124
+ };
125
+ export type ReplaceTextOptions = {
126
+ openingTag: string;
127
+ closingTag: string;
128
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=modify-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-types.js","sourceRoot":"","sources":["../../src/types/modify-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { Color } from './modify-types';
2
+ export type ShapeCoordinates = {
3
+ /**
4
+ * Horizontal position measured from left corner
5
+ * in PowerPoint `DXA` unit.
6
+ * PowerPoint units are in `DXA` (except for font sizing)
7
+ * - 1 cm is 360000 DXA
8
+ * - 20 DXA is 1 point
9
+ */
10
+ x?: number;
11
+ /**
12
+ * Vertical position on the slide
13
+ * Measured from top corner in `DXA`
14
+ */
15
+ y?: number;
16
+ /**
17
+ * Shape width in `DXA`
18
+ */
19
+ w?: number;
20
+ /**
21
+ * Shape height in `DXA`
22
+ */
23
+ h?: number;
24
+ };
25
+ export type ShapeValueStyle = {
26
+ background?: Color;
27
+ gradient?: {
28
+ color: Color;
29
+ index: number;
30
+ }[];
31
+ border?: {
32
+ color?: Color;
33
+ weight?: number;
34
+ };
35
+ label?: {
36
+ color?: Color;
37
+ isBold?: boolean;
38
+ size?: number;
39
+ };
40
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=shape-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape-types.js","sourceRoot":"","sources":["../../src/types/shape-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import { Color, Border, TextStyle } from './modify-types';
2
+ import { XmlElement } from './xml-types';
3
+ export type TableRow = {
4
+ label?: string;
5
+ values: (string | number)[];
6
+ styles?: (null | TableRowStyle)[];
7
+ };
8
+ export type TableRowStyle = TextStyle & {
9
+ background?: Color;
10
+ border?: Border[];
11
+ };
12
+ export type TableData = {
13
+ header?: TableRow | TableRow[];
14
+ body?: TableRow[];
15
+ footer?: TableRow | TableRow[];
16
+ };
17
+ export type ModifyTableParams = {
18
+ adjustWidth?: boolean;
19
+ adjustHeight?: boolean;
20
+ setHeight?: number;
21
+ setWidth?: number;
22
+ expand?: ModifyTableExpand[];
23
+ };
24
+ export type ModifyTableExpand = {
25
+ tag: string;
26
+ mode: 'row' | 'column';
27
+ count: number;
28
+ };
29
+ export type TableInfo = {
30
+ row: number;
31
+ column: number;
32
+ rowXml: XmlElement;
33
+ columnXml: XmlElement;
34
+ text: string[];
35
+ textContent: string;
36
+ gridSpan: number;
37
+ hMerge: number;
38
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=table-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-types.js","sourceRoot":"","sources":["../../src/types/table-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,317 @@
1
+ import { ElementSubtype, ElementType } from '../enums/element-type';
2
+ import { ElementInfo, RelationshipAttribute, SlideInfo, TemplateInfo, XmlDocument, XmlElement } from './xml-types';
3
+ import IArchive, { ArchiveMode } from '../interfaces/iarchive';
4
+ import { ContentTypeExtension } from '../enums/content-type-map';
5
+ import type PptxGenJS from 'pptxgenjs';
6
+ import { ILogger, Verbosity } from '../helper/logger';
7
+ import { IPptxGenJSSlide } from '../interfaces/ipptxgenjs-slide';
8
+ import { ShapeActionMode } from '../interfaces/ishape-action';
9
+ import HasShapes from '../classes/has-shapes';
10
+ import { ISlide } from '../interfaces/islide';
11
+ import { IMaster } from '../interfaces/imaster';
12
+ export type ShapeTargetType = 'slide' | 'slideMaster' | 'slideLayout';
13
+ /**
14
+ * Selects a slide layout of the output presentation by name for
15
+ * `slide.useSlideLayout()`: the layout name as shown in PowerPoint's layout
16
+ * gallery, optionally narrowed down by the master's name and by the
17
+ * template the layout came from (`'root'` for the root template's own
18
+ * layouts, or the alias of a loaded template for layouts imported from it).
19
+ * Names are compared exactly.
20
+ */
21
+ export type SlideLayoutSelector = {
22
+ layout: string;
23
+ master?: string;
24
+ template?: 'root' | string;
25
+ };
26
+ export type SourceIdentifier = number | string;
27
+ export type SlideModificationCallback = (document: XmlDocument, parent?: HasShapes | ISlide | IMaster) => Promise<void> | void;
28
+ export type SlidePlaceholder = {
29
+ xml: XmlElement;
30
+ type: string;
31
+ /** Value of the ph 'id' attribute; has always been the raw attribute string. */
32
+ id?: string;
33
+ };
34
+ export type ModificationCallback = ChartModificationCallback | ShapeModificationCallback;
35
+ export type ShapeModificationCallback = (element: XmlElement, relation?: XmlElement, info?: ElementInfo) => void | Promise<void>;
36
+ export type ChartModificationCallback = (element: XmlElement, chart?: XmlDocument, workbook?: Workbook) => void;
37
+ export type GetRelationshipsCallback = (element: XmlElement, rels: Target[]) => void;
38
+ export type AutomizerFile = string | Buffer | Uint8Array;
39
+ export type AutomizerParams = {
40
+ /**
41
+ * Prefix for all template files. You can set a path here.
42
+ */
43
+ templateDir?: string;
44
+ /**
45
+ * Specify a fallback directory if template file was not found
46
+ * in templateDir.
47
+ */
48
+ templateFallbackDir?: string;
49
+ /**
50
+ * Prefix for the output files for `Automizer` instance.
51
+ * You can set a path here.
52
+ */
53
+ outputDir?: string;
54
+ /**
55
+ * Path to media directory, in case you need to import additional
56
+ * files. You can set a path here. Load files with Automizer.loadMedia
57
+ */
58
+ mediaDir?: string;
59
+ /**
60
+ * Use 'fs' if you want to extract all archive contents to disc.
61
+ * ArchiveParams.mode defaults to 'jszip'.
62
+ */
63
+ archiveType?: ArchiveParams;
64
+ /**
65
+ * Zip compression level 0-9
66
+ */
67
+ compression?: number;
68
+ /**
69
+ * Pass an AutomizerFile directly and skip loadRoot().
70
+ */
71
+ rootTemplate?: AutomizerFile;
72
+ /**
73
+ * If you require another version of pptxGenJs, you can e.g. use your
74
+ * customized library.
75
+ */
76
+ pptxGenJs?: PptxGenJS;
77
+ /**
78
+ * Array of template files to be loaded on initialization.
79
+ * If files are Buffer or Uint8Array, they will be named 0.pptx, 1.pptx, ...
80
+ * according to their order in the array.
81
+ */
82
+ presTemplates?: AutomizerFile[];
83
+ useCreationIds?: boolean;
84
+ /**
85
+ * Turn this to true if you always want to import all required slide masters.
86
+ * You don't need to adjust with slide.useSlideLayout, but it will have a
87
+ * negative impact on performance.
88
+ * It is highly recommended to activate autoImportSlideMasters in case your
89
+ * loaded templates have different sets of slideMasters & -layouts.
90
+ */
91
+ autoImportSlideMasters?: boolean;
92
+ /**
93
+ * In case you encounter weird pptx messages on opening a created presentation,
94
+ * you can turn this to true. It will log a message on missing related contents
95
+ * and help you to locate where it is. Use this along with "assertRelatedContents"
96
+ * to auto-fix broken relations.
97
+ */
98
+ showIntegrityInfo?: boolean;
99
+ /**
100
+ * Pptx-automizer can try to add any missing related content that could not be
101
+ * handled properly by "addElement" or "addMaster" or one of their subroutines.
102
+ * This probably fixes corrupted pptx files.
103
+ */
104
+ assertRelatedContents?: boolean;
105
+ /**
106
+ * Delete all existing slides from rootTemplate
107
+ * before automation starts.
108
+ */
109
+ removeExistingSlides?: boolean;
110
+ /**
111
+ * Eventually remove all unnecessary files from archive.
112
+ */
113
+ cleanup?: boolean;
114
+ /**
115
+ * Remove all unused shape placeholders from slide.
116
+ * Set to false when you are using slide.mergeIntoSlideLayout.
117
+ */
118
+ cleanupPlaceholders?: boolean;
119
+ /**
120
+ * statusTracker will be triggered on each appended slide.
121
+ * You can e.g. attach a custom callback to a progress bar.
122
+ */
123
+ statusTracker?: StatusTracker['next'];
124
+ /**
125
+ * Set logging verbosity of the default console logger.
126
+ * 0: errors only
127
+ * 1: errors and warnings (default)
128
+ * 2: everything, including info (e.g. on import & append)
129
+ */
130
+ verbosity?: Verbosity;
131
+ /**
132
+ * Inject a custom logger to route library output into your own
133
+ * logging stack. Defaults to a console logger filtered by `verbosity`.
134
+ * Use `NullLogger` to keep the library completely silent.
135
+ */
136
+ logger?: ILogger;
137
+ /**
138
+ * By default, a throwing modification callback or an unresolvable
139
+ * element selector fails the run loudly with a typed error.
140
+ * Set to true to restore the lenient behavior: log a warning,
141
+ * skip the failing modification and continue.
142
+ */
143
+ continueOnError?: boolean;
144
+ };
145
+ export type StatusTracker = {
146
+ current: number;
147
+ max: number;
148
+ share: number;
149
+ info: string | undefined;
150
+ next: (tracker: StatusTracker) => void;
151
+ increment: () => void;
152
+ };
153
+ export type AutomizerSummary = {
154
+ status: string;
155
+ duration: number;
156
+ file: string;
157
+ filename: string;
158
+ templates: number;
159
+ slides: number;
160
+ charts: number;
161
+ images: number;
162
+ masters: number;
163
+ };
164
+ export type PresentationInfo = {
165
+ templateByName: (tplName: string) => TemplateInfo;
166
+ slidesByTemplate: (tplName: string) => SlideInfo[];
167
+ slideByNumber: (tplName: string, slideNumber: number) => SlideInfo;
168
+ elementByName: (tplName: string, slideNumber: number, elementName: string) => ElementInfo;
169
+ };
170
+ export type Target = {
171
+ file: string;
172
+ type: string;
173
+ filename: string;
174
+ number?: number;
175
+ rId?: string;
176
+ prefix?: string;
177
+ element?: XmlElement;
178
+ subtype?: ElementSubtype;
179
+ filenameExt?: ContentTypeExtension;
180
+ filenameBase?: string;
181
+ isExternal?: boolean;
182
+ getCreatedContent?: () => TrackedRelationInfo;
183
+ getRelatedContent?: () => Promise<Target>;
184
+ getTargetValue?: () => string;
185
+ updateTargetValue?: (newTarget: string) => void;
186
+ updateTargetIndex?: (newIndex: number) => void;
187
+ updateId?: (newId: string) => void;
188
+ relatedContent?: Target;
189
+ copiedTarget?: string;
190
+ };
191
+ export type FileInfo = {
192
+ base: string;
193
+ extension: string;
194
+ dir: string;
195
+ isDir: boolean;
196
+ };
197
+ export type MediaFileFromPath = {
198
+ source: 'path';
199
+ file: string;
200
+ directory: string;
201
+ filepath: string;
202
+ prefix?: string;
203
+ extension: ContentTypeExtension;
204
+ };
205
+ export type MediaFileFromBuffer = {
206
+ source: 'buffer';
207
+ file: string;
208
+ buffer: Buffer;
209
+ prefix?: string;
210
+ extension: ContentTypeExtension;
211
+ };
212
+ export type MediaFile = MediaFileFromPath | MediaFileFromBuffer;
213
+ /**
214
+ * Gets the buffer data from a MediaFile, handling both path-based and buffer-based sources.
215
+ * @param file - The media file to get buffer from
216
+ * @param fsReadFileSync - The fs.readFileSync function (passed to avoid circular imports)
217
+ * @returns Buffer containing the media data
218
+ */
219
+ export declare function getMediaBuffer(file: MediaFile, fsReadFileSync: (path: string) => Buffer): Buffer;
220
+ export type TrackedFiles = Record<string, string[]>;
221
+ export type TrackedRelationInfo = {
222
+ base: string;
223
+ attributes?: RelationshipAttribute;
224
+ };
225
+ export type TrackedRelations = Record<string, TrackedRelationInfo[]>;
226
+ export type TrackedRelation = {
227
+ tag: string;
228
+ type?: string;
229
+ attribute?: string;
230
+ role?: 'image' | 'slideMaster' | 'slide' | 'chart' | 'externalData' | 'slideLayout' | 'hyperlink';
231
+ targets?: Target[];
232
+ };
233
+ export type TrackedRelationTag = {
234
+ source: string;
235
+ relationsKey: string;
236
+ isDir?: boolean;
237
+ tags: TrackedRelation[];
238
+ getTrackedRelations?: (role: string) => TrackedRelation[];
239
+ };
240
+ export type ArchiveParams = {
241
+ mode: ArchiveMode;
242
+ baseDir?: string;
243
+ workDir?: string;
244
+ cleanupWorkDir?: boolean;
245
+ name?: string;
246
+ decodeText?: boolean;
247
+ };
248
+ export type ImportElement = {
249
+ presName: string;
250
+ slideNumber: number;
251
+ selector: FindElementSelector;
252
+ mode: ShapeActionMode;
253
+ callback?: ShapeModificationCallback | ShapeModificationCallback[];
254
+ info?: ImportedElement;
255
+ };
256
+ export type GenerateOnSlideCallback = (pptxGenJSSlide: IPptxGenJSSlide, pptxGenJS: PptxGenJS) => Promise<void> | void;
257
+ export type GenerateElements = {
258
+ objectName?: string;
259
+ tmpSlideNumber?: number;
260
+ callback?: GenerateOnSlideCallback;
261
+ addedObjects?: AddedObject[];
262
+ };
263
+ export type AddedObject = {
264
+ objectName: string;
265
+ callbacks: ModificationCallback[];
266
+ };
267
+ export type FindElementSelector = string | FindElementMultiSelector;
268
+ export type FindElementMultiSelector = {
269
+ creationId?: string;
270
+ name: string;
271
+ nameIdx?: number;
272
+ };
273
+ export type FindElementStrategy = {
274
+ mode: 'findByElementCreationId' | 'findByElementName';
275
+ selector: string;
276
+ nameIdx?: number;
277
+ };
278
+ export type ImportedElement = {
279
+ mode: ShapeActionMode;
280
+ name?: string;
281
+ selector?: FindElementMultiSelector;
282
+ hasCreationId?: boolean;
283
+ sourceArchive: IArchive;
284
+ sourceSlideNumber: number;
285
+ callback?: ImportElement['callback'];
286
+ target?: AnalyzedElementType['target'];
287
+ type?: AnalyzedElementType['type'];
288
+ sourceElement?: XmlElement;
289
+ hash?: string;
290
+ sourceRid?: string;
291
+ sourceMode?: 'image:svg' | 'image:media' | 'image:audioFile' | 'image:videoFile';
292
+ continueOnError?: boolean;
293
+ };
294
+ export type AnalyzedElementType = {
295
+ type: ElementType;
296
+ target?: Target;
297
+ element?: XmlElement;
298
+ };
299
+ export type ElementOnSlide = {
300
+ sourceElement: XmlElement;
301
+ selector: string;
302
+ mode?: 'findByElementCreationId' | 'findByElementName';
303
+ };
304
+ export type TargetByRelIdMapParam = {
305
+ relRootTag: string;
306
+ relAttribute: string;
307
+ prefix: string;
308
+ expression?: RegExp;
309
+ findAll?: boolean;
310
+ relType?: string;
311
+ };
312
+ export type Workbook = {
313
+ archive: IArchive;
314
+ sheet: XmlDocument;
315
+ sharedStrings: XmlDocument;
316
+ table: XmlDocument;
317
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMediaBuffer = getMediaBuffer;
4
+ /**
5
+ * Gets the buffer data from a MediaFile, handling both path-based and buffer-based sources.
6
+ * @param file - The media file to get buffer from
7
+ * @param fsReadFileSync - The fs.readFileSync function (passed to avoid circular imports)
8
+ * @returns Buffer containing the media data
9
+ */
10
+ function getMediaBuffer(file, fsReadFileSync) {
11
+ if (file.source === 'buffer') {
12
+ return file.buffer;
13
+ }
14
+ return fsReadFileSync(file.filepath);
15
+ }
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":";;AAyPA,wCAQC;AAdD;;;;;GAKG;AACH,SAAgB,cAAc,CAC5B,IAAe,EACf,cAAwC;IAExC,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC"}