pptx-templates 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/AI-INSTRUCTOR.md +2253 -0
  2. package/CHANGELOG.md +56 -0
  3. package/LICENSE +23 -0
  4. package/README.md +84 -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/run-merge/index.d.ts +13 -0
  72. package/dist/extensions/run-merge/index.js +89 -0
  73. package/dist/extensions/run-merge/index.js.map +1 -0
  74. package/dist/extensions/template-logic/commands.d.ts +22 -0
  75. package/dist/extensions/template-logic/commands.js +83 -0
  76. package/dist/extensions/template-logic/commands.js.map +1 -0
  77. package/dist/extensions/template-logic/expression.d.ts +61 -0
  78. package/dist/extensions/template-logic/expression.js +499 -0
  79. package/dist/extensions/template-logic/expression.js.map +1 -0
  80. package/dist/extensions/template-logic/images.d.ts +26 -0
  81. package/dist/extensions/template-logic/images.js +183 -0
  82. package/dist/extensions/template-logic/images.js.map +1 -0
  83. package/dist/extensions/template-logic/index.d.ts +14 -0
  84. package/dist/extensions/template-logic/index.js +64 -0
  85. package/dist/extensions/template-logic/index.js.map +1 -0
  86. package/dist/extensions/template-logic/list-commands.d.ts +9 -0
  87. package/dist/extensions/template-logic/list-commands.js +72 -0
  88. package/dist/extensions/template-logic/list-commands.js.map +1 -0
  89. package/dist/extensions/template-logic/renderer.d.ts +85 -0
  90. package/dist/extensions/template-logic/renderer.js +867 -0
  91. package/dist/extensions/template-logic/renderer.js.map +1 -0
  92. package/dist/extensions/template-logic/types.d.ts +62 -0
  93. package/dist/extensions/template-logic/types.js +3 -0
  94. package/dist/extensions/template-logic/types.js.map +1 -0
  95. package/dist/helper/archive/archive-fs.d.ts +45 -0
  96. package/dist/helper/archive/archive-fs.js +206 -0
  97. package/dist/helper/archive/archive-fs.js.map +1 -0
  98. package/dist/helper/archive/archive-jszip.d.ts +31 -0
  99. package/dist/helper/archive/archive-jszip.js +173 -0
  100. package/dist/helper/archive/archive-jszip.js.map +1 -0
  101. package/dist/helper/archive/archive.d.ts +27 -0
  102. package/dist/helper/archive/archive.js +78 -0
  103. package/dist/helper/archive/archive.js.map +1 -0
  104. package/dist/helper/cell-id-helper.d.ts +25 -0
  105. package/dist/helper/cell-id-helper.js +95 -0
  106. package/dist/helper/cell-id-helper.js.map +1 -0
  107. package/dist/helper/compute-src-rect.d.ts +9 -0
  108. package/dist/helper/compute-src-rect.js +52 -0
  109. package/dist/helper/compute-src-rect.js.map +1 -0
  110. package/dist/helper/content-tracker.d.ts +31 -0
  111. package/dist/helper/content-tracker.js +227 -0
  112. package/dist/helper/content-tracker.js.map +1 -0
  113. package/dist/helper/count-helper.d.ts +33 -0
  114. package/dist/helper/count-helper.js +140 -0
  115. package/dist/helper/count-helper.js.map +1 -0
  116. package/dist/helper/css-style-parser.d.ts +52 -0
  117. package/dist/helper/css-style-parser.js +246 -0
  118. package/dist/helper/css-style-parser.js.map +1 -0
  119. package/dist/helper/file-helper.d.ts +36 -0
  120. package/dist/helper/file-helper.js +150 -0
  121. package/dist/helper/file-helper.js.map +1 -0
  122. package/dist/helper/general-helper.d.ts +6 -0
  123. package/dist/helper/general-helper.js +34 -0
  124. package/dist/helper/general-helper.js.map +1 -0
  125. package/dist/helper/generate/generate-pptxgenjs.d.ts +37 -0
  126. package/dist/helper/generate/generate-pptxgenjs.js +134 -0
  127. package/dist/helper/generate/generate-pptxgenjs.js.map +1 -0
  128. package/dist/helper/html-to-multitext-helper.d.ts +84 -0
  129. package/dist/helper/html-to-multitext-helper.js +490 -0
  130. package/dist/helper/html-to-multitext-helper.js.map +1 -0
  131. package/dist/helper/hyperlink-processor.d.ts +54 -0
  132. package/dist/helper/hyperlink-processor.js +289 -0
  133. package/dist/helper/hyperlink-processor.js.map +1 -0
  134. package/dist/helper/image-dimensions.d.ts +21 -0
  135. package/dist/helper/image-dimensions.js +202 -0
  136. package/dist/helper/image-dimensions.js.map +1 -0
  137. package/dist/helper/jszip-helper.d.ts +21 -0
  138. package/dist/helper/jszip-helper.js +162 -0
  139. package/dist/helper/jszip-helper.js.map +1 -0
  140. package/dist/helper/layout-index.d.ts +55 -0
  141. package/dist/helper/layout-index.js +155 -0
  142. package/dist/helper/layout-index.js.map +1 -0
  143. package/dist/helper/logger.d.ts +53 -0
  144. package/dist/helper/logger.js +73 -0
  145. package/dist/helper/logger.js.map +1 -0
  146. package/dist/helper/media-deduplicator.d.ts +42 -0
  147. package/dist/helper/media-deduplicator.js +88 -0
  148. package/dist/helper/media-deduplicator.js.map +1 -0
  149. package/dist/helper/modify-background-helper.d.ts +19 -0
  150. package/dist/helper/modify-background-helper.js +59 -0
  151. package/dist/helper/modify-background-helper.js.map +1 -0
  152. package/dist/helper/modify-chart-helper.d.ts +159 -0
  153. package/dist/helper/modify-chart-helper.js +642 -0
  154. package/dist/helper/modify-chart-helper.js.map +1 -0
  155. package/dist/helper/modify-cleanup-helper.d.ts +69 -0
  156. package/dist/helper/modify-cleanup-helper.js +343 -0
  157. package/dist/helper/modify-cleanup-helper.js.map +1 -0
  158. package/dist/helper/modify-color-helper.d.ts +35 -0
  159. package/dist/helper/modify-color-helper.js +211 -0
  160. package/dist/helper/modify-color-helper.js.map +1 -0
  161. package/dist/helper/modify-helper.d.ts +23 -0
  162. package/dist/helper/modify-helper.js +61 -0
  163. package/dist/helper/modify-helper.js.map +1 -0
  164. package/dist/helper/modify-hyperlink-element.d.ts +9 -0
  165. package/dist/helper/modify-hyperlink-element.js +34 -0
  166. package/dist/helper/modify-hyperlink-element.js.map +1 -0
  167. package/dist/helper/modify-hyperlink-helper.d.ts +42 -0
  168. package/dist/helper/modify-hyperlink-helper.js +258 -0
  169. package/dist/helper/modify-hyperlink-helper.js.map +1 -0
  170. package/dist/helper/modify-image-helper.d.ts +23 -0
  171. package/dist/helper/modify-image-helper.js +157 -0
  172. package/dist/helper/modify-image-helper.js.map +1 -0
  173. package/dist/helper/modify-presentation-helper.d.ts +55 -0
  174. package/dist/helper/modify-presentation-helper.js +177 -0
  175. package/dist/helper/modify-presentation-helper.js.map +1 -0
  176. package/dist/helper/modify-shape-helper.d.ts +111 -0
  177. package/dist/helper/modify-shape-helper.js +340 -0
  178. package/dist/helper/modify-shape-helper.js.map +1 -0
  179. package/dist/helper/modify-table-helper.d.ts +11 -0
  180. package/dist/helper/modify-table-helper.js +100 -0
  181. package/dist/helper/modify-table-helper.js.map +1 -0
  182. package/dist/helper/modify-text-helper.d.ts +62 -0
  183. package/dist/helper/modify-text-helper.js +244 -0
  184. package/dist/helper/modify-text-helper.js.map +1 -0
  185. package/dist/helper/modify-xml-helper.d.ts +52 -0
  186. package/dist/helper/modify-xml-helper.js +305 -0
  187. package/dist/helper/modify-xml-helper.js.map +1 -0
  188. package/dist/helper/multitext-helper.d.ts +116 -0
  189. package/dist/helper/multitext-helper.js +462 -0
  190. package/dist/helper/multitext-helper.js.map +1 -0
  191. package/dist/helper/ppt-paths.d.ts +76 -0
  192. package/dist/helper/ppt-paths.js +116 -0
  193. package/dist/helper/ppt-paths.js.map +1 -0
  194. package/dist/helper/shape-type-detector.d.ts +34 -0
  195. package/dist/helper/shape-type-detector.js +99 -0
  196. package/dist/helper/shape-type-detector.js.map +1 -0
  197. package/dist/helper/text-replace-helper.d.ts +30 -0
  198. package/dist/helper/text-replace-helper.js +149 -0
  199. package/dist/helper/text-replace-helper.js.map +1 -0
  200. package/dist/helper/xml/lnLRTB.d.ts +1 -0
  201. package/dist/helper/xml/lnLRTB.js +62 -0
  202. package/dist/helper/xml/lnLRTB.js.map +1 -0
  203. package/dist/helper/xml/prstGeom.d.ts +1 -0
  204. package/dist/helper/xml/prstGeom.js +11 -0
  205. package/dist/helper/xml/prstGeom.js.map +1 -0
  206. package/dist/helper/xml-elements.d.ts +134 -0
  207. package/dist/helper/xml-elements.js +538 -0
  208. package/dist/helper/xml-elements.js.map +1 -0
  209. package/dist/helper/xml-helper.d.ts +120 -0
  210. package/dist/helper/xml-helper.js +495 -0
  211. package/dist/helper/xml-helper.js.map +1 -0
  212. package/dist/helper/xml-placeholder-helper.d.ts +92 -0
  213. package/dist/helper/xml-placeholder-helper.js +454 -0
  214. package/dist/helper/xml-placeholder-helper.js.map +1 -0
  215. package/dist/helper/xml-pretty-print.d.ts +17 -0
  216. package/dist/helper/xml-pretty-print.js +88 -0
  217. package/dist/helper/xml-pretty-print.js.map +1 -0
  218. package/dist/helper/xml-relationship-helper.d.ts +103 -0
  219. package/dist/helper/xml-relationship-helper.js +397 -0
  220. package/dist/helper/xml-relationship-helper.js.map +1 -0
  221. package/dist/helper/xml-slide-helper.d.ts +107 -0
  222. package/dist/helper/xml-slide-helper.js +676 -0
  223. package/dist/helper/xml-slide-helper.js.map +1 -0
  224. package/dist/helper/xml-template-helper.d.ts +42 -0
  225. package/dist/helper/xml-template-helper.js +252 -0
  226. package/dist/helper/xml-template-helper.js.map +1 -0
  227. package/dist/helper/xmldom-sax-patch.d.ts +18 -0
  228. package/dist/helper/xmldom-sax-patch.js +58 -0
  229. package/dist/helper/xmldom-sax-patch.js.map +1 -0
  230. package/dist/index.d.ts +81 -0
  231. package/dist/index.js +177 -0
  232. package/dist/index.js.map +1 -0
  233. package/dist/interfaces/iarchive.d.ts +43 -0
  234. package/dist/interfaces/iarchive.js +3 -0
  235. package/dist/interfaces/iarchive.js.map +1 -0
  236. package/dist/interfaces/ichart.d.ts +7 -0
  237. package/dist/interfaces/ichart.js +3 -0
  238. package/dist/interfaces/ichart.js.map +1 -0
  239. package/dist/interfaces/icounter.d.ts +7 -0
  240. package/dist/interfaces/icounter.js +3 -0
  241. package/dist/interfaces/icounter.js.map +1 -0
  242. package/dist/interfaces/igenerator.d.ts +4 -0
  243. package/dist/interfaces/igenerator.js +3 -0
  244. package/dist/interfaces/igenerator.js.map +1 -0
  245. package/dist/interfaces/iimage.d.ts +7 -0
  246. package/dist/interfaces/iimage.js +3 -0
  247. package/dist/interfaces/iimage.js.map +1 -0
  248. package/dist/interfaces/ilayout.d.ts +14 -0
  249. package/dist/interfaces/ilayout.js +3 -0
  250. package/dist/interfaces/ilayout.js.map +1 -0
  251. package/dist/interfaces/imaster.d.ts +15 -0
  252. package/dist/interfaces/imaster.js +3 -0
  253. package/dist/interfaces/imaster.js.map +1 -0
  254. package/dist/interfaces/imulti-text.d.ts +50 -0
  255. package/dist/interfaces/imulti-text.js +3 -0
  256. package/dist/interfaces/imulti-text.js.map +1 -0
  257. package/dist/interfaces/ipptxgenjs-slide.d.ts +40 -0
  258. package/dist/interfaces/ipptxgenjs-slide.js +3 -0
  259. package/dist/interfaces/ipptxgenjs-slide.js.map +1 -0
  260. package/dist/interfaces/ipresentation-props.d.ts +16 -0
  261. package/dist/interfaces/ipresentation-props.js +3 -0
  262. package/dist/interfaces/ipresentation-props.js.map +1 -0
  263. package/dist/interfaces/ishape-action.d.ts +18 -0
  264. package/dist/interfaces/ishape-action.js +3 -0
  265. package/dist/interfaces/ishape-action.js.map +1 -0
  266. package/dist/interfaces/ishape.d.ts +5 -0
  267. package/dist/interfaces/ishape.js +3 -0
  268. package/dist/interfaces/ishape.js.map +1 -0
  269. package/dist/interfaces/islide.d.ts +71 -0
  270. package/dist/interfaces/islide.js +3 -0
  271. package/dist/interfaces/islide.js.map +1 -0
  272. package/dist/interfaces/itemplate.d.ts +9 -0
  273. package/dist/interfaces/itemplate.js +3 -0
  274. package/dist/interfaces/itemplate.js.map +1 -0
  275. package/dist/interfaces/pres-template.d.ts +9 -0
  276. package/dist/interfaces/pres-template.js +3 -0
  277. package/dist/interfaces/pres-template.js.map +1 -0
  278. package/dist/interfaces/root-pres-template.d.ts +38 -0
  279. package/dist/interfaces/root-pres-template.js +3 -0
  280. package/dist/interfaces/root-pres-template.js.map +1 -0
  281. package/dist/modify/modify-chart.d.ts +74 -0
  282. package/dist/modify/modify-chart.js +753 -0
  283. package/dist/modify/modify-chart.js.map +1 -0
  284. package/dist/modify/modify-table.d.ts +64 -0
  285. package/dist/modify/modify-table.js +435 -0
  286. package/dist/modify/modify-table.js.map +1 -0
  287. package/dist/shapes/chart.d.ts +91 -0
  288. package/dist/shapes/chart.js +437 -0
  289. package/dist/shapes/chart.js.map +1 -0
  290. package/dist/shapes/diagram.d.ts +33 -0
  291. package/dist/shapes/diagram.js +167 -0
  292. package/dist/shapes/diagram.js.map +1 -0
  293. package/dist/shapes/generic.d.ts +27 -0
  294. package/dist/shapes/generic.js +118 -0
  295. package/dist/shapes/generic.js.map +1 -0
  296. package/dist/shapes/hyperlink.d.ts +27 -0
  297. package/dist/shapes/hyperlink.js +193 -0
  298. package/dist/shapes/hyperlink.js.map +1 -0
  299. package/dist/shapes/image.d.ts +47 -0
  300. package/dist/shapes/image.js +244 -0
  301. package/dist/shapes/image.js.map +1 -0
  302. package/dist/shapes/ole.d.ts +30 -0
  303. package/dist/shapes/ole.js +237 -0
  304. package/dist/shapes/ole.js.map +1 -0
  305. package/dist/types/chart-types.d.ts +115 -0
  306. package/dist/types/chart-types.js +3 -0
  307. package/dist/types/chart-types.js.map +1 -0
  308. package/dist/types/modify-types.d.ts +128 -0
  309. package/dist/types/modify-types.js +3 -0
  310. package/dist/types/modify-types.js.map +1 -0
  311. package/dist/types/shape-types.d.ts +40 -0
  312. package/dist/types/shape-types.js +3 -0
  313. package/dist/types/shape-types.js.map +1 -0
  314. package/dist/types/table-types.d.ts +38 -0
  315. package/dist/types/table-types.js +3 -0
  316. package/dist/types/table-types.js.map +1 -0
  317. package/dist/types/types.d.ts +317 -0
  318. package/dist/types/types.js +16 -0
  319. package/dist/types/types.js.map +1 -0
  320. package/dist/types/xml-types.d.ts +168 -0
  321. package/dist/types/xml-types.js +3 -0
  322. package/dist/types/xml-types.js.map +1 -0
  323. package/package.json +92 -4
@@ -0,0 +1,134 @@
1
+ import { BulletListContent, Color, ShapeOutline } from '../types/modify-types';
2
+ import { XmlDocument, XmlElement } from '../types/xml-types';
3
+ export type XmlElementParams = {
4
+ color?: Color;
5
+ outline?: ShapeOutline;
6
+ };
7
+ /**
8
+ * Children of <c:ser>, in OOXML schema order — the union of all CT_*Ser
9
+ * variants (bar, line, pie, scatter, radar, area, bubble, surface); their
10
+ * shared members never disagree on relative order.
11
+ */
12
+ export declare const C_SER_CHILD_ORDER: string[];
13
+ /**
14
+ * Children of <c:dPt> (CT_DPt), in OOXML schema order. Note that it differs
15
+ * from CT_Ser: inside a data point, `c:bubble3D` comes *before* `c:spPr`.
16
+ */
17
+ export declare const C_DPT_CHILD_ORDER: string[];
18
+ /**
19
+ * Children of <c:spPr>/<a:spPr> (CT_ShapeProperties), in OOXML schema order.
20
+ */
21
+ export declare const A_SPPR_CHILD_ORDER: string[];
22
+ /**
23
+ * Children of <c:dLbls> (CT_DLbls), in OOXML schema order: the sparse
24
+ * <c:dLbl> point overrides come first, followed by the group-level settings.
25
+ */
26
+ export declare const C_DLBLS_CHILD_ORDER: string[];
27
+ export default class XmlElements {
28
+ element: XmlDocument | XmlElement;
29
+ document: XmlDocument;
30
+ params: XmlElementParams;
31
+ defaultValues: Record<string, string>;
32
+ paragraphTemplate: XmlElement;
33
+ runTemplate: XmlElement;
34
+ constructor(element: XmlDocument | XmlElement, params?: XmlElementParams);
35
+ text(): this;
36
+ createTextBody(): XmlElement;
37
+ createBodyProperties(txBody: XmlElement): XmlElement;
38
+ addBulletList(list: BulletListContent): void;
39
+ processList(txBody: XmlElement, items: BulletListContent, level: number): void;
40
+ createParagraph(level: number): XmlElement;
41
+ createTextRun(text: string): XmlElement;
42
+ paragraphProps(): import("@xmldom/xmldom").Element;
43
+ textRangeProps(): import("@xmldom/xmldom").Element;
44
+ textContent(): XmlElement;
45
+ effectLst(): XmlElement;
46
+ lineTexture(): XmlElement;
47
+ fillTexture(): XmlElement;
48
+ line(): XmlElement;
49
+ /**
50
+ * Create an <a:ln> shape outline from this.params.outline
51
+ */
52
+ outline(): XmlElement;
53
+ /**
54
+ * Apply this.params.outline to an existing (or freshly created) <a:ln>.
55
+ * Only given properties are touched, the rest is left to the template.
56
+ * Insertion respects the schema sequence of CT_LineProperties:
57
+ * fill -> dash -> join -> head/tailEnd -> extLst
58
+ *
59
+ * @param ln - The <a:ln> element to update
60
+ */
61
+ applyOutline(ln: XmlElement): XmlElement;
62
+ solidFill(): XmlElement;
63
+ colorType(): XmlElement;
64
+ colorValue(colorType: XmlElement): void;
65
+ /**
66
+ * A minimal <c:dPt> shell: `c:idx`, `c:invertIfNegative` and `c:bubble3D`
67
+ * (which PowerPoint always writes) and nothing else. A data point carries
68
+ * no formatting the caller did not ask for — modifications create `c:spPr`
69
+ * etc. on demand. `c:invertIfNegative` must be written explicitly: OOXML
70
+ * defaults the absent element to *true*, which makes PowerPoint invert the
71
+ * fill of negative-value bars (white with a border) — silently overriding
72
+ * the very fill the caller styled the point for. LibreOffice ignores the
73
+ * flag, so pixel-based golden decks cannot catch this.
74
+ */
75
+ buildDataPoint(): XmlElement;
76
+ dataPoint(): this;
77
+ /**
78
+ * An empty <c:spPr> shell in schema position: all children of
79
+ * CT_ShapeProperties are optional, and an absent property inherits from the
80
+ * series/theme defaults. Fills, lines etc. are added by the modifications
81
+ * that asked for them — the former grey solidFill + <a:ln><a:noFill/>
82
+ * default erased the segments of line charts.
83
+ */
84
+ shapeProperties(): void;
85
+ /**
86
+ * A bare <a:ln> in schema position — no fabricated <a:noFill>. Border
87
+ * modifications fill it with the properties the caller asked for.
88
+ */
89
+ plainLine(): void;
90
+ idx(): XmlElement;
91
+ cellBorder(tag: 'lnL' | 'lnR' | 'lnT' | 'lnB'): this;
92
+ prstDash(): import("@xmldom/xmldom").Element;
93
+ round(): import("@xmldom/xmldom").Element;
94
+ lineEnd(type: 'headEnd' | 'tailEnd'): import("@xmldom/xmldom").Element;
95
+ /**
96
+ * An empty <c:dLbls>: all children of CT_DLbls are optional, and every
97
+ * label property (visibility included) is inherited from the chart's
98
+ * defaults. No fabricated formatting, no forced `showVal`.
99
+ */
100
+ dataPointLabels(): void;
101
+ /**
102
+ * A minimal <c:dLbl> point override: `c:idx` plus an empty `c:txPr`
103
+ * scaffold so that text styling modifications have a target — without
104
+ * opinionated defaults (no size, no fill, no `showVal`).
105
+ */
106
+ buildDataPointLabel(): XmlElement;
107
+ dataPointLabel(): void;
108
+ /**
109
+ * Containers that hold `<c:pt>` children, in order of likelihood. The
110
+ * modification is addressed to the `c:val`/`c:cat`/`c:xVal`/`c:yVal`
111
+ * wrapper (or `c15:datalabelsRange`), so the points live one level down.
112
+ */
113
+ static C_PT_CONTAINERS: string[];
114
+ /**
115
+ * A first `<c:pt idx="0"><c:v/></c:pt>` for a chart cache without any
116
+ * point (a "legend-only" chart, or a template whose cache was stripped).
117
+ * The `c:v` must carry a text node, even an empty one:
118
+ * `ModifyXmlHelper.value` writes `firstChild.textContent` and silently
119
+ * skips a `c:v` without one. Inserted after `c:formatCode`/`c:ptCount`
120
+ * and before an `c:extLst`, as CT_NumData/CT_StrData require. Later
121
+ * points are cloned from this one by `assertElement`.
122
+ *
123
+ * Returns false when `this.element` holds no cache to put the point in.
124
+ */
125
+ point(): boolean;
126
+ /**
127
+ * The chartex counterpart: a first `<cx:pt idx="0"/>` (text content, no
128
+ * `c:v`) inside the `cx:lvl` of a `cx:strDim`/`cx:numDim`. As with
129
+ * `point()`, the empty text node is what `ModifyXmlHelper.textContent`
130
+ * writes to.
131
+ */
132
+ extPoint(): boolean;
133
+ tableCellBorder(tag: 'a:lnL' | 'a:lnR' | 'a:lnT' | 'a:lnB'): void;
134
+ }
@@ -0,0 +1,538 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.C_DLBLS_CHILD_ORDER = exports.A_SPPR_CHILD_ORDER = exports.C_DPT_CHILD_ORDER = exports.C_SER_CHILD_ORDER = void 0;
4
+ const xml_helper_1 = require("./xml-helper");
5
+ const xmldom_1 = require("@xmldom/xmldom");
6
+ const lnLRTB_1 = require("./xml/lnLRTB");
7
+ /**
8
+ * Children of <a:ln>, in OOXML schema order (CT_LineProperties).
9
+ * Required to insert new children at a valid position: a wrong sequence
10
+ * makes PowerPoint ask to repair the file.
11
+ */
12
+ const LINE_FILL_TAGS = [
13
+ 'a:noFill',
14
+ 'a:solidFill',
15
+ 'a:gradFill',
16
+ 'a:pattFill',
17
+ ];
18
+ const LINE_DASH_TAGS = ['a:prstDash', 'a:custDash'];
19
+ const LINE_AFTER_DASH_TAGS = [
20
+ 'a:round',
21
+ 'a:bevel',
22
+ 'a:miter',
23
+ 'a:headEnd',
24
+ 'a:tailEnd',
25
+ 'a:extLst',
26
+ ];
27
+ /**
28
+ * Children of <c:ser>, in OOXML schema order — the union of all CT_*Ser
29
+ * variants (bar, line, pie, scatter, radar, area, bubble, surface); their
30
+ * shared members never disagree on relative order.
31
+ */
32
+ exports.C_SER_CHILD_ORDER = [
33
+ 'c:idx',
34
+ 'c:order',
35
+ 'c:tx',
36
+ 'c:spPr',
37
+ 'c:invertIfNegative',
38
+ 'c:pictureOptions',
39
+ 'c:explosion',
40
+ 'c:marker',
41
+ 'c:dPt',
42
+ 'c:dLbls',
43
+ 'c:trendline',
44
+ 'c:errBars',
45
+ 'c:cat',
46
+ 'c:val',
47
+ 'c:xVal',
48
+ 'c:yVal',
49
+ 'c:smooth',
50
+ 'c:shape',
51
+ 'c:bubbleSize',
52
+ 'c:bubble3D',
53
+ 'c:extLst',
54
+ ];
55
+ /**
56
+ * Children of <c:dPt> (CT_DPt), in OOXML schema order. Note that it differs
57
+ * from CT_Ser: inside a data point, `c:bubble3D` comes *before* `c:spPr`.
58
+ */
59
+ exports.C_DPT_CHILD_ORDER = [
60
+ 'c:idx',
61
+ 'c:invertIfNegative',
62
+ 'c:marker',
63
+ 'c:bubble3D',
64
+ 'c:explosion',
65
+ 'c:spPr',
66
+ 'c:pictureOptions',
67
+ 'c:extLst',
68
+ ];
69
+ /**
70
+ * Children of <c:spPr>/<a:spPr> (CT_ShapeProperties), in OOXML schema order.
71
+ */
72
+ exports.A_SPPR_CHILD_ORDER = [
73
+ 'a:xfrm',
74
+ 'a:custGeom',
75
+ 'a:prstGeom',
76
+ 'a:noFill',
77
+ 'a:solidFill',
78
+ 'a:gradFill',
79
+ 'a:blipFill',
80
+ 'a:pattFill',
81
+ 'a:grpFill',
82
+ 'a:ln',
83
+ 'a:effectLst',
84
+ 'a:effectDag',
85
+ 'a:scene3d',
86
+ 'a:sp3d',
87
+ 'a:extLst',
88
+ ];
89
+ /**
90
+ * Children of <c:dLbls> (CT_DLbls), in OOXML schema order: the sparse
91
+ * <c:dLbl> point overrides come first, followed by the group-level settings.
92
+ */
93
+ exports.C_DLBLS_CHILD_ORDER = [
94
+ 'c:dLbl',
95
+ 'c:delete',
96
+ 'c:numFmt',
97
+ 'c:spPr',
98
+ 'c:txPr',
99
+ 'c:dLblPos',
100
+ 'c:showLegendKey',
101
+ 'c:showVal',
102
+ 'c:showCatName',
103
+ 'c:showSerName',
104
+ 'c:showPercent',
105
+ 'c:showBubbleSize',
106
+ 'c:separator',
107
+ 'c:showLeaderLines',
108
+ 'c:leaderLines',
109
+ 'c:extLst',
110
+ ];
111
+ class XmlElements {
112
+ constructor(element, params) {
113
+ this.element = element;
114
+ this.document = element.ownerDocument;
115
+ this.params = params;
116
+ this.defaultValues = {
117
+ color: 'CCCCCC',
118
+ size: '1000',
119
+ };
120
+ }
121
+ text() {
122
+ const r = this.document.createElement('a:r');
123
+ r.appendChild(this.textRangeProps());
124
+ r.appendChild(this.textContent());
125
+ let paragraphProps = this.element.getElementsByTagName('a:pPr').item(0);
126
+ if (!paragraphProps) {
127
+ paragraphProps = this.paragraphProps();
128
+ }
129
+ xml_helper_1.XmlHelper.insertAfter(r, paragraphProps);
130
+ return this;
131
+ }
132
+ createTextBody() {
133
+ let txBody = this.element.getElementsByTagName('p:txBody')[0];
134
+ if (!txBody) {
135
+ txBody = this.document.createElement('p:txBody');
136
+ this.element.appendChild(txBody);
137
+ const bodyPr = this.document.createElement('a:bodyPr');
138
+ txBody.appendChild(bodyPr);
139
+ const lstStyle = this.document.createElement('a:lstStyle');
140
+ txBody.appendChild(lstStyle);
141
+ this.paragraphTemplate = this.document.createElement('a:p');
142
+ txBody.appendChild(this.paragraphTemplate);
143
+ this.runTemplate = this.document.createElement('a:r');
144
+ const rPr = this.document.createElement('a:rPr');
145
+ this.runTemplate.appendChild(rPr);
146
+ }
147
+ else {
148
+ let bodyPr = txBody.getElementsByTagName('a:bodyPr')[0];
149
+ if (!bodyPr) {
150
+ bodyPr = this.document.createElement('a:bodyPr');
151
+ txBody.insertBefore(bodyPr, txBody.firstChild);
152
+ }
153
+ let lstStyle = txBody.getElementsByTagName('a:lstStyle')[0];
154
+ if (!lstStyle) {
155
+ lstStyle = this.document.createElement('a:lstStyle');
156
+ txBody.insertBefore(lstStyle, bodyPr.nextSibling);
157
+ }
158
+ const paragraphs = txBody.getElementsByTagName('a:p');
159
+ this.paragraphTemplate = paragraphs[0];
160
+ xml_helper_1.XmlHelper.sliceCollection(paragraphs, 0);
161
+ const runs = this.paragraphTemplate.getElementsByTagName('a:r');
162
+ if (runs.length > 0) {
163
+ this.runTemplate = runs[0];
164
+ }
165
+ else {
166
+ this.runTemplate = this.document.createElement('a:r');
167
+ const rPr = this.document.createElement('a:rPr');
168
+ this.runTemplate.appendChild(rPr);
169
+ }
170
+ }
171
+ return txBody;
172
+ }
173
+ createBodyProperties(txBody) {
174
+ const bodyPr = this.document.createElement('a:bodyPr');
175
+ txBody.appendChild(bodyPr);
176
+ return bodyPr;
177
+ }
178
+ addBulletList(list) {
179
+ const txBody = this.createTextBody();
180
+ this.createBodyProperties(txBody);
181
+ this.processList(txBody, list, 0);
182
+ }
183
+ processList(txBody, items, level) {
184
+ items.forEach((item) => {
185
+ if (Array.isArray(item)) {
186
+ this.processList(txBody, item, level + 1);
187
+ }
188
+ else {
189
+ const p = this.createParagraph(level);
190
+ const r = this.createTextRun(String(item));
191
+ p.appendChild(r);
192
+ txBody.appendChild(p);
193
+ }
194
+ });
195
+ }
196
+ createParagraph(level) {
197
+ const p = this.paragraphTemplate.cloneNode(true);
198
+ const pPr = p.getElementsByTagName('a:pPr')[0];
199
+ if (pPr) {
200
+ if (level > 0) {
201
+ pPr.setAttribute('lvl', String(level));
202
+ pPr.removeAttribute('indent');
203
+ pPr.removeAttribute('marL');
204
+ }
205
+ else {
206
+ pPr.removeAttribute('lvl');
207
+ }
208
+ }
209
+ else {
210
+ const newPPr = this.document.createElement('a:pPr');
211
+ if (level > 0) {
212
+ newPPr.setAttribute('lvl', String(level));
213
+ }
214
+ p.insertBefore(newPPr, p.firstChild);
215
+ }
216
+ const runs = p.getElementsByTagName('a:r');
217
+ xml_helper_1.XmlHelper.sliceCollection(runs, 0);
218
+ return p;
219
+ }
220
+ createTextRun(text) {
221
+ const r = this.runTemplate.cloneNode(true);
222
+ const t = r.getElementsByTagName('a:t')[0];
223
+ if (t) {
224
+ t.textContent = xml_helper_1.XmlHelper.sanitizeText(text);
225
+ }
226
+ else {
227
+ const newT = this.document.createElement('a:t');
228
+ newT.textContent = xml_helper_1.XmlHelper.sanitizeText(text);
229
+ r.appendChild(newT);
230
+ }
231
+ return r;
232
+ }
233
+ paragraphProps() {
234
+ const p = this.element.getElementsByTagName('a:p').item(0);
235
+ p.appendChild(this.document.createElement('a:pPr'));
236
+ const paragraphRangeProps = this.element
237
+ .getElementsByTagName('a:pPr')
238
+ .item(0);
239
+ const endParaRPr = this.element
240
+ .getElementsByTagName('a:endParaRPr')
241
+ .item(0);
242
+ xml_helper_1.XmlHelper.moveChild(endParaRPr);
243
+ return paragraphRangeProps;
244
+ }
245
+ textRangeProps() {
246
+ const rPr = this.document.createElement('a:rPr');
247
+ const endParaRPr = this.element.getElementsByTagName('a:endParaRPr')[0];
248
+ rPr.setAttribute('lang', endParaRPr.getAttribute('lang'));
249
+ rPr.setAttribute('sz', endParaRPr.getAttribute('sz') || this.defaultValues.size);
250
+ rPr.appendChild(this.line());
251
+ rPr.appendChild(this.effectLst());
252
+ rPr.appendChild(this.lineTexture());
253
+ rPr.appendChild(this.fillTexture());
254
+ return rPr;
255
+ }
256
+ textContent() {
257
+ const t = this.document.createElement('a:t');
258
+ t.textContent = ' ';
259
+ return t;
260
+ }
261
+ effectLst() {
262
+ return this.document.createElement('a:effectLst');
263
+ }
264
+ lineTexture() {
265
+ return this.document.createElement('a:uLnTx');
266
+ }
267
+ fillTexture() {
268
+ return this.document.createElement('a:uFillTx');
269
+ }
270
+ line() {
271
+ const ln = this.document.createElement('a:ln');
272
+ const noFill = this.document.createElement('a:noFill');
273
+ ln.appendChild(noFill);
274
+ return ln;
275
+ }
276
+ /**
277
+ * Create an <a:ln> shape outline from this.params.outline
278
+ */
279
+ outline() {
280
+ const ln = this.document.createElement('a:ln');
281
+ return this.applyOutline(ln);
282
+ }
283
+ /**
284
+ * Apply this.params.outline to an existing (or freshly created) <a:ln>.
285
+ * Only given properties are touched, the rest is left to the template.
286
+ * Insertion respects the schema sequence of CT_LineProperties:
287
+ * fill -> dash -> join -> head/tailEnd -> extLst
288
+ *
289
+ * @param ln - The <a:ln> element to update
290
+ */
291
+ applyOutline(ln) {
292
+ var _a;
293
+ const outline = (_a = this.params) === null || _a === void 0 ? void 0 : _a.outline;
294
+ if (!outline)
295
+ return ln;
296
+ if (outline.weight !== undefined) {
297
+ ln.setAttribute('w', String(Math.round(outline.weight)));
298
+ }
299
+ if (outline.color) {
300
+ this.params.color = outline.color;
301
+ const solidFill = this.solidFill();
302
+ const currentFill = xml_helper_1.XmlHelper.getFirstDirectChild(ln, LINE_FILL_TAGS);
303
+ if (currentFill) {
304
+ ln.replaceChild(solidFill, currentFill);
305
+ }
306
+ else {
307
+ ln.insertBefore(solidFill, ln.firstChild);
308
+ }
309
+ }
310
+ if (outline.type) {
311
+ const prstDash = this.prstDash();
312
+ prstDash.setAttribute('val', outline.type);
313
+ const currentDash = xml_helper_1.XmlHelper.getFirstDirectChild(ln, LINE_DASH_TAGS);
314
+ if (currentDash) {
315
+ ln.replaceChild(prstDash, currentDash);
316
+ }
317
+ else {
318
+ const anchor = xml_helper_1.XmlHelper.getFirstDirectChild(ln, LINE_AFTER_DASH_TAGS);
319
+ if (anchor) {
320
+ ln.insertBefore(prstDash, anchor);
321
+ }
322
+ else {
323
+ ln.appendChild(prstDash);
324
+ }
325
+ }
326
+ }
327
+ return ln;
328
+ }
329
+ solidFill() {
330
+ const solidFill = this.document.createElement('a:solidFill');
331
+ const colorType = this.colorType();
332
+ solidFill.appendChild(colorType);
333
+ return solidFill;
334
+ }
335
+ colorType() {
336
+ var _a, _b;
337
+ const tag = 'a:' + (((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.color) === null || _b === void 0 ? void 0 : _b.type) || 'srgbClr');
338
+ const colorType = this.document.createElement(tag);
339
+ this.colorValue(colorType);
340
+ return colorType;
341
+ }
342
+ colorValue(colorType) {
343
+ var _a, _b, _c, _d;
344
+ colorType.setAttribute('val', ((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.color) === null || _b === void 0 ? void 0 : _b.value) || this.defaultValues.color);
345
+ if (((_d = (_c = this.params) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d.alpha) !== undefined) {
346
+ const alpha = this.document.createElement('a:alpha');
347
+ const rawAlpha = Number(this.params.color.alpha);
348
+ // Normalize alpha to OOXML thousandths of percent (0-100000):
349
+ // 0-1 (exclusive): fraction (e.g. 0.5 → 50000)
350
+ // 1-100: percentage (e.g. 50 → 50000)
351
+ // >100: already in thousandths of percent
352
+ let alphaVal;
353
+ if (rawAlpha > 0 && rawAlpha < 1) {
354
+ alphaVal = Math.round(rawAlpha * 100000);
355
+ }
356
+ else if (rawAlpha >= 1 && rawAlpha <= 100) {
357
+ alphaVal = Math.round(rawAlpha * 1000);
358
+ }
359
+ else {
360
+ alphaVal = Math.round(rawAlpha);
361
+ }
362
+ alpha.setAttribute('val', String(alphaVal));
363
+ colorType.appendChild(alpha);
364
+ }
365
+ }
366
+ /**
367
+ * A minimal <c:dPt> shell: `c:idx`, `c:invertIfNegative` and `c:bubble3D`
368
+ * (which PowerPoint always writes) and nothing else. A data point carries
369
+ * no formatting the caller did not ask for — modifications create `c:spPr`
370
+ * etc. on demand. `c:invertIfNegative` must be written explicitly: OOXML
371
+ * defaults the absent element to *true*, which makes PowerPoint invert the
372
+ * fill of negative-value bars (white with a border) — silently overriding
373
+ * the very fill the caller styled the point for. LibreOffice ignores the
374
+ * flag, so pixel-based golden decks cannot catch this.
375
+ */
376
+ buildDataPoint() {
377
+ const dPt = this.document.createElement('c:dPt');
378
+ dPt.appendChild(this.idx());
379
+ const invertIfNegative = this.document.createElement('c:invertIfNegative');
380
+ invertIfNegative.setAttribute('val', '0');
381
+ dPt.appendChild(invertIfNegative);
382
+ const bubble3D = this.document.createElement('c:bubble3D');
383
+ bubble3D.setAttribute('val', '0');
384
+ dPt.appendChild(bubble3D);
385
+ return dPt;
386
+ }
387
+ dataPoint() {
388
+ xml_helper_1.XmlHelper.insertInSchemaOrder(this.element, this.buildDataPoint(), exports.C_SER_CHILD_ORDER);
389
+ return this;
390
+ }
391
+ /**
392
+ * An empty <c:spPr> shell in schema position: all children of
393
+ * CT_ShapeProperties are optional, and an absent property inherits from the
394
+ * series/theme defaults. Fills, lines etc. are added by the modifications
395
+ * that asked for them — the former grey solidFill + <a:ln><a:noFill/>
396
+ * default erased the segments of line charts.
397
+ */
398
+ shapeProperties() {
399
+ const spPr = this.document.createElement('c:spPr');
400
+ const parentTag = this.element.nodeName;
401
+ const order = parentTag === 'c:dPt' ? exports.C_DPT_CHILD_ORDER : exports.C_SER_CHILD_ORDER;
402
+ xml_helper_1.XmlHelper.insertInSchemaOrder(this.element, spPr, order);
403
+ }
404
+ /**
405
+ * A bare <a:ln> in schema position — no fabricated <a:noFill>. Border
406
+ * modifications fill it with the properties the caller asked for.
407
+ */
408
+ plainLine() {
409
+ const ln = this.document.createElement('a:ln');
410
+ xml_helper_1.XmlHelper.insertInSchemaOrder(this.element, ln, exports.A_SPPR_CHILD_ORDER);
411
+ }
412
+ idx() {
413
+ const idx = this.document.createElement('c:idx');
414
+ idx.setAttribute('val', String(0));
415
+ return idx;
416
+ }
417
+ cellBorder(tag) {
418
+ const border = this.document.createElement(tag);
419
+ border.appendChild(this.solidFill());
420
+ border.appendChild(this.prstDash());
421
+ border.appendChild(this.round());
422
+ border.appendChild(this.lineEnd('headEnd'));
423
+ border.appendChild(this.lineEnd('tailEnd'));
424
+ return this;
425
+ }
426
+ prstDash() {
427
+ const prstDash = this.document.createElement('a:prstDash');
428
+ prstDash.setAttribute('val', 'solid');
429
+ return prstDash;
430
+ }
431
+ round() {
432
+ const round = this.document.createElement('a:round');
433
+ return round;
434
+ }
435
+ lineEnd(type) {
436
+ const lineEnd = this.document.createElement(type);
437
+ lineEnd.setAttribute('type', 'none');
438
+ lineEnd.setAttribute('w', 'med');
439
+ lineEnd.setAttribute('len', 'med');
440
+ return lineEnd;
441
+ }
442
+ /**
443
+ * An empty <c:dLbls>: all children of CT_DLbls are optional, and every
444
+ * label property (visibility included) is inherited from the chart's
445
+ * defaults. No fabricated formatting, no forced `showVal`.
446
+ */
447
+ dataPointLabels() {
448
+ const dLbls = this.document.createElement('c:dLbls');
449
+ xml_helper_1.XmlHelper.insertInSchemaOrder(this.element, dLbls, exports.C_SER_CHILD_ORDER);
450
+ }
451
+ /**
452
+ * A minimal <c:dLbl> point override: `c:idx` plus an empty `c:txPr`
453
+ * scaffold so that text styling modifications have a target — without
454
+ * opinionated defaults (no size, no fill, no `showVal`).
455
+ */
456
+ buildDataPointLabel() {
457
+ const dLbl = this.document.createElement('c:dLbl');
458
+ dLbl.appendChild(this.idx());
459
+ const txPr = this.document.createElement('c:txPr');
460
+ txPr.appendChild(this.document.createElement('a:bodyPr'));
461
+ txPr.appendChild(this.document.createElement('a:lstStyle'));
462
+ const p = this.document.createElement('a:p');
463
+ const pPr = this.document.createElement('a:pPr');
464
+ pPr.appendChild(this.document.createElement('a:defRPr'));
465
+ p.appendChild(pPr);
466
+ const endParaRPr = this.document.createElement('a:endParaRPr');
467
+ endParaRPr.setAttribute('lang', 'en-US');
468
+ p.appendChild(endParaRPr);
469
+ txPr.appendChild(p);
470
+ dLbl.appendChild(txPr);
471
+ return dLbl;
472
+ }
473
+ dataPointLabel() {
474
+ xml_helper_1.XmlHelper.insertInSchemaOrder(this.element, this.buildDataPointLabel(), exports.C_DLBLS_CHILD_ORDER);
475
+ }
476
+ /**
477
+ * A first `<c:pt idx="0"><c:v/></c:pt>` for a chart cache without any
478
+ * point (a "legend-only" chart, or a template whose cache was stripped).
479
+ * The `c:v` must carry a text node, even an empty one:
480
+ * `ModifyXmlHelper.value` writes `firstChild.textContent` and silently
481
+ * skips a `c:v` without one. Inserted after `c:formatCode`/`c:ptCount`
482
+ * and before an `c:extLst`, as CT_NumData/CT_StrData require. Later
483
+ * points are cloned from this one by `assertElement`.
484
+ *
485
+ * Returns false when `this.element` holds no cache to put the point in.
486
+ */
487
+ point() {
488
+ const cache = XmlElements.C_PT_CONTAINERS.map((tag) => this.element.getElementsByTagName(tag).item(0)).find((candidate) => candidate !== null && candidate !== undefined);
489
+ if (!cache) {
490
+ return false;
491
+ }
492
+ const pt = this.document.createElement('c:pt');
493
+ pt.setAttribute('idx', '0');
494
+ const v = this.document.createElement('c:v');
495
+ v.appendChild(this.document.createTextNode(''));
496
+ pt.appendChild(v);
497
+ const extLst = Array.from(cache.childNodes).find((child) => child.nodeName === 'c:extLst');
498
+ cache.insertBefore(pt, extLst !== null && extLst !== void 0 ? extLst : null);
499
+ return true;
500
+ }
501
+ /**
502
+ * The chartex counterpart: a first `<cx:pt idx="0"/>` (text content, no
503
+ * `c:v`) inside the `cx:lvl` of a `cx:strDim`/`cx:numDim`. As with
504
+ * `point()`, the empty text node is what `ModifyXmlHelper.textContent`
505
+ * writes to.
506
+ */
507
+ extPoint() {
508
+ const lvl = this.element.getElementsByTagName('cx:lvl').item(0);
509
+ if (!lvl) {
510
+ return false;
511
+ }
512
+ const pt = this.document.createElement('cx:pt');
513
+ pt.setAttribute('idx', '0');
514
+ pt.appendChild(this.document.createTextNode(''));
515
+ lvl.appendChild(pt);
516
+ return true;
517
+ }
518
+ tableCellBorder(tag) {
519
+ const doc = new xmldom_1.DOMParser().parseFromString(lnLRTB_1.lnLRTB, 'application/xml');
520
+ const ele = doc.getElementsByTagName(tag)[0];
521
+ const firstChild = this.element.firstChild;
522
+ this.element.insertBefore(ele.cloneNode(true), firstChild);
523
+ }
524
+ }
525
+ /**
526
+ * Containers that hold `<c:pt>` children, in order of likelihood. The
527
+ * modification is addressed to the `c:val`/`c:cat`/`c:xVal`/`c:yVal`
528
+ * wrapper (or `c15:datalabelsRange`), so the points live one level down.
529
+ */
530
+ XmlElements.C_PT_CONTAINERS = [
531
+ 'c:numCache',
532
+ 'c:strCache',
533
+ 'c15:dlblRangeCache',
534
+ 'c:numLit',
535
+ 'c:strLit',
536
+ ];
537
+ exports.default = XmlElements;
538
+ //# sourceMappingURL=xml-elements.js.map