@deckflow/deckuse 1.2.1 → 1.3.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 (281) hide show
  1. package/README.es.md +342 -0
  2. package/README.fr.md +342 -0
  3. package/README.ja.md +342 -0
  4. package/README.ko.md +342 -0
  5. package/README.md +46 -8
  6. package/README.pt-BR.md +342 -0
  7. package/README.ru.md +342 -0
  8. package/README.zh-CN.md +367 -0
  9. package/assets/default.docx +0 -0
  10. package/assets/default.pptx +0 -0
  11. package/dist/bin.js +183 -19
  12. package/dist/bin.js.map +1 -1
  13. package/dist/core/adapter.d.ts +24 -0
  14. package/dist/core/adapter.d.ts.map +1 -0
  15. package/dist/core/adapter.js +20 -0
  16. package/dist/core/adapter.js.map +1 -0
  17. package/dist/core/executor.d.ts +24 -0
  18. package/dist/core/executor.d.ts.map +1 -0
  19. package/dist/core/executor.js +65 -0
  20. package/dist/core/executor.js.map +1 -0
  21. package/dist/core/index.d.ts +7 -0
  22. package/dist/core/index.d.ts.map +1 -0
  23. package/dist/core/index.js +7 -0
  24. package/dist/core/index.js.map +1 -0
  25. package/dist/core/length.d.ts +27 -0
  26. package/dist/core/length.d.ts.map +1 -0
  27. package/dist/core/length.js +63 -0
  28. package/dist/core/length.js.map +1 -0
  29. package/dist/core/measure.d.ts +24 -0
  30. package/dist/core/measure.d.ts.map +1 -0
  31. package/dist/core/measure.js +79 -0
  32. package/dist/core/measure.js.map +1 -0
  33. package/dist/core/not-implemented.d.ts +3 -0
  34. package/dist/core/not-implemented.d.ts.map +1 -0
  35. package/dist/core/not-implemented.js +12 -0
  36. package/dist/core/not-implemented.js.map +1 -0
  37. package/dist/core/schema.d.ts +3035 -0
  38. package/dist/core/schema.d.ts.map +1 -0
  39. package/dist/core/schema.js +798 -0
  40. package/dist/core/schema.js.map +1 -0
  41. package/dist/default-template.d.ts +8 -0
  42. package/dist/default-template.d.ts.map +1 -0
  43. package/dist/default-template.js +29 -0
  44. package/dist/default-template.js.map +1 -0
  45. package/dist/docx/adapter.d.ts +29 -0
  46. package/dist/docx/adapter.d.ts.map +1 -0
  47. package/dist/docx/adapter.js +442 -0
  48. package/dist/docx/adapter.js.map +1 -0
  49. package/dist/docx/addressing.d.ts +18 -0
  50. package/dist/docx/addressing.d.ts.map +1 -0
  51. package/dist/docx/addressing.js +111 -0
  52. package/dist/docx/addressing.js.map +1 -0
  53. package/dist/docx/blank.d.ts +4 -0
  54. package/dist/docx/blank.d.ts.map +1 -0
  55. package/dist/docx/blank.js +75 -0
  56. package/dist/docx/blank.js.map +1 -0
  57. package/dist/docx/index-sync.d.ts +7 -0
  58. package/dist/docx/index-sync.d.ts.map +1 -0
  59. package/dist/docx/index-sync.js +24 -0
  60. package/dist/docx/index-sync.js.map +1 -0
  61. package/dist/docx/index.d.ts +5 -0
  62. package/dist/docx/index.d.ts.map +1 -0
  63. package/dist/docx/index.js +4 -0
  64. package/dist/docx/index.js.map +1 -0
  65. package/dist/docx/indexer.d.ts +41 -0
  66. package/dist/docx/indexer.d.ts.map +1 -0
  67. package/dist/docx/indexer.js +353 -0
  68. package/dist/docx/indexer.js.map +1 -0
  69. package/dist/docx/mutations.d.ts +5 -0
  70. package/dist/docx/mutations.d.ts.map +1 -0
  71. package/dist/docx/mutations.js +311 -0
  72. package/dist/docx/mutations.js.map +1 -0
  73. package/dist/docx/paragraphs.d.ts +26 -0
  74. package/dist/docx/paragraphs.d.ts.map +1 -0
  75. package/dist/docx/paragraphs.js +314 -0
  76. package/dist/docx/paragraphs.js.map +1 -0
  77. package/dist/docx/properties.d.ts +23 -0
  78. package/dist/docx/properties.d.ts.map +1 -0
  79. package/dist/docx/properties.js +414 -0
  80. package/dist/docx/properties.js.map +1 -0
  81. package/dist/docx/tables.d.ts +4 -0
  82. package/dist/docx/tables.d.ts.map +1 -0
  83. package/dist/docx/tables.js +64 -0
  84. package/dist/docx/tables.js.map +1 -0
  85. package/dist/docx/text-spans.d.ts +25 -0
  86. package/dist/docx/text-spans.d.ts.map +1 -0
  87. package/dist/docx/text-spans.js +142 -0
  88. package/dist/docx/text-spans.js.map +1 -0
  89. package/dist/docx/types.d.ts +27 -0
  90. package/dist/docx/types.d.ts.map +1 -0
  91. package/dist/docx/types.js +2 -0
  92. package/dist/docx/types.js.map +1 -0
  93. package/dist/docx/workspace.d.ts +20 -0
  94. package/dist/docx/workspace.d.ts.map +1 -0
  95. package/dist/docx/workspace.js +145 -0
  96. package/dist/docx/workspace.js.map +1 -0
  97. package/dist/docx/xml.d.ts +18 -0
  98. package/dist/docx/xml.d.ts.map +1 -0
  99. package/dist/docx/xml.js +87 -0
  100. package/dist/docx/xml.js.map +1 -0
  101. package/dist/edition-config/index.d.ts +25 -0
  102. package/dist/edition-config/index.d.ts.map +1 -0
  103. package/dist/edition-config/index.js +22 -0
  104. package/dist/edition-config/index.js.map +1 -0
  105. package/dist/edition.d.ts +2 -2
  106. package/dist/edition.d.ts.map +1 -1
  107. package/dist/edition.js +1 -1
  108. package/dist/edition.js.map +1 -1
  109. package/dist/help.d.ts.map +1 -1
  110. package/dist/help.js +124 -32
  111. package/dist/help.js.map +1 -1
  112. package/dist/index.d.ts +1 -1
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +6 -6
  115. package/dist/index.js.map +1 -1
  116. package/dist/key/index.d.ts +2 -0
  117. package/dist/key/index.d.ts.map +1 -0
  118. package/dist/key/index.js +3 -0
  119. package/dist/key/index.js.map +1 -0
  120. package/dist/monitor-daemon.d.ts +21 -8
  121. package/dist/monitor-daemon.d.ts.map +1 -1
  122. package/dist/monitor-daemon.js +189 -51
  123. package/dist/monitor-daemon.js.map +1 -1
  124. package/dist/monitor-registry.d.ts +34 -0
  125. package/dist/monitor-registry.d.ts.map +1 -0
  126. package/dist/monitor-registry.js +191 -0
  127. package/dist/monitor-registry.js.map +1 -0
  128. package/dist/monitor.js +1 -1
  129. package/dist/monitor.js.map +1 -1
  130. package/dist/numbers/index.d.ts +2 -0
  131. package/dist/numbers/index.d.ts.map +1 -0
  132. package/dist/numbers/index.js +3 -0
  133. package/dist/numbers/index.js.map +1 -0
  134. package/dist/opc/index.d.ts +90 -0
  135. package/dist/opc/index.d.ts.map +1 -0
  136. package/dist/opc/index.js +569 -0
  137. package/dist/opc/index.js.map +1 -0
  138. package/dist/pptx/adapter.d.ts +167 -0
  139. package/dist/pptx/adapter.d.ts.map +1 -0
  140. package/dist/pptx/adapter.js +807 -0
  141. package/dist/pptx/adapter.js.map +1 -0
  142. package/dist/pptx/addressing.d.ts +45 -0
  143. package/dist/pptx/addressing.d.ts.map +1 -0
  144. package/dist/pptx/addressing.js +428 -0
  145. package/dist/pptx/addressing.js.map +1 -0
  146. package/dist/pptx/align.d.ts +24 -0
  147. package/dist/pptx/align.d.ts.map +1 -0
  148. package/dist/pptx/align.js +112 -0
  149. package/dist/pptx/align.js.map +1 -0
  150. package/dist/pptx/chart-classify.d.ts +10 -0
  151. package/dist/pptx/chart-classify.d.ts.map +1 -0
  152. package/dist/pptx/chart-classify.js +58 -0
  153. package/dist/pptx/chart-classify.js.map +1 -0
  154. package/dist/pptx/chart.d.ts +42 -0
  155. package/dist/pptx/chart.d.ts.map +1 -0
  156. package/dist/pptx/chart.js +614 -0
  157. package/dist/pptx/chart.js.map +1 -0
  158. package/dist/pptx/edition-extension.d.ts +25 -0
  159. package/dist/pptx/edition-extension.d.ts.map +1 -0
  160. package/dist/pptx/edition-extension.js +10 -0
  161. package/dist/pptx/edition-extension.js.map +1 -0
  162. package/dist/pptx/edition.d.ts +20 -0
  163. package/dist/pptx/edition.d.ts.map +1 -0
  164. package/dist/pptx/edition.js +69 -0
  165. package/dist/pptx/edition.js.map +1 -0
  166. package/dist/pptx/elements.d.ts +12 -0
  167. package/dist/pptx/elements.d.ts.map +1 -0
  168. package/dist/pptx/elements.js +224 -0
  169. package/dist/pptx/elements.js.map +1 -0
  170. package/dist/pptx/hyperlink.d.ts +7 -0
  171. package/dist/pptx/hyperlink.d.ts.map +1 -0
  172. package/dist/pptx/hyperlink.js +81 -0
  173. package/dist/pptx/hyperlink.js.map +1 -0
  174. package/dist/pptx/index-sync.d.ts +7 -0
  175. package/dist/pptx/index-sync.d.ts.map +1 -0
  176. package/dist/pptx/index-sync.js +24 -0
  177. package/dist/pptx/index-sync.js.map +1 -0
  178. package/dist/pptx/index.d.ts +10 -0
  179. package/dist/pptx/index.d.ts.map +1 -0
  180. package/dist/pptx/index.js +7 -0
  181. package/dist/pptx/index.js.map +1 -0
  182. package/dist/pptx/indexer.d.ts +19 -0
  183. package/dist/pptx/indexer.d.ts.map +1 -0
  184. package/dist/pptx/indexer.js +319 -0
  185. package/dist/pptx/indexer.js.map +1 -0
  186. package/dist/pptx/layout-ref.d.ts +41 -0
  187. package/dist/pptx/layout-ref.d.ts.map +1 -0
  188. package/dist/pptx/layout-ref.js +145 -0
  189. package/dist/pptx/layout-ref.js.map +1 -0
  190. package/dist/pptx/media.d.ts +15 -0
  191. package/dist/pptx/media.d.ts.map +1 -0
  192. package/dist/pptx/media.js +145 -0
  193. package/dist/pptx/media.js.map +1 -0
  194. package/dist/pptx/mutations.d.ts +11 -0
  195. package/dist/pptx/mutations.d.ts.map +1 -0
  196. package/dist/pptx/mutations.js +1111 -0
  197. package/dist/pptx/mutations.js.map +1 -0
  198. package/dist/pptx/picture.d.ts +25 -0
  199. package/dist/pptx/picture.d.ts.map +1 -0
  200. package/dist/pptx/picture.js +118 -0
  201. package/dist/pptx/picture.js.map +1 -0
  202. package/dist/pptx/placeholder-role.d.ts +19 -0
  203. package/dist/pptx/placeholder-role.d.ts.map +1 -0
  204. package/dist/pptx/placeholder-role.js +71 -0
  205. package/dist/pptx/placeholder-role.js.map +1 -0
  206. package/dist/pptx/properties.d.ts +13 -0
  207. package/dist/pptx/properties.d.ts.map +1 -0
  208. package/dist/pptx/properties.js +587 -0
  209. package/dist/pptx/properties.js.map +1 -0
  210. package/dist/pptx/resolve-properties.d.ts +17 -0
  211. package/dist/pptx/resolve-properties.d.ts.map +1 -0
  212. package/dist/pptx/resolve-properties.js +571 -0
  213. package/dist/pptx/resolve-properties.js.map +1 -0
  214. package/dist/pptx/slide-size.d.ts +9 -0
  215. package/dist/pptx/slide-size.d.ts.map +1 -0
  216. package/dist/pptx/slide-size.js +29 -0
  217. package/dist/pptx/slide-size.js.map +1 -0
  218. package/dist/pptx/slides.d.ts +15 -0
  219. package/dist/pptx/slides.d.ts.map +1 -0
  220. package/dist/pptx/slides.js +236 -0
  221. package/dist/pptx/slides.js.map +1 -0
  222. package/dist/pptx/table-measure.d.ts +43 -0
  223. package/dist/pptx/table-measure.d.ts.map +1 -0
  224. package/dist/pptx/table-measure.js +70 -0
  225. package/dist/pptx/table-measure.js.map +1 -0
  226. package/dist/pptx/table.d.ts +23 -0
  227. package/dist/pptx/table.d.ts.map +1 -0
  228. package/dist/pptx/table.js +529 -0
  229. package/dist/pptx/table.js.map +1 -0
  230. package/dist/pptx/types.d.ts +27 -0
  231. package/dist/pptx/types.d.ts.map +1 -0
  232. package/dist/pptx/types.js +2 -0
  233. package/dist/pptx/types.js.map +1 -0
  234. package/dist/pptx/workspace.d.ts +23 -0
  235. package/dist/pptx/workspace.d.ts.map +1 -0
  236. package/dist/pptx/workspace.js +148 -0
  237. package/dist/pptx/workspace.js.map +1 -0
  238. package/dist/pptx/xml.d.ts +67 -0
  239. package/dist/pptx/xml.d.ts.map +1 -0
  240. package/dist/pptx/xml.js +355 -0
  241. package/dist/pptx/xml.js.map +1 -0
  242. package/dist/render.d.ts.map +1 -1
  243. package/dist/render.js +14 -2
  244. package/dist/render.js.map +1 -1
  245. package/dist/version.d.ts +1 -1
  246. package/dist/version.js +1 -1
  247. package/dist/workspace/git.d.ts +7 -0
  248. package/dist/workspace/git.d.ts.map +1 -0
  249. package/dist/workspace/git.js +82 -0
  250. package/dist/workspace/git.js.map +1 -0
  251. package/dist/workspace/index.d.ts +7 -0
  252. package/dist/workspace/index.d.ts.map +1 -0
  253. package/dist/workspace/index.js +7 -0
  254. package/dist/workspace/index.js.map +1 -0
  255. package/dist/workspace/lock.d.ts +3 -0
  256. package/dist/workspace/lock.d.ts.map +1 -0
  257. package/dist/workspace/lock.js +35 -0
  258. package/dist/workspace/lock.js.map +1 -0
  259. package/dist/workspace/metadata.d.ts +4 -0
  260. package/dist/workspace/metadata.d.ts.map +1 -0
  261. package/dist/workspace/metadata.js +21 -0
  262. package/dist/workspace/metadata.js.map +1 -0
  263. package/dist/workspace/operations.d.ts +14 -0
  264. package/dist/workspace/operations.d.ts.map +1 -0
  265. package/dist/workspace/operations.js +35 -0
  266. package/dist/workspace/operations.js.map +1 -0
  267. package/dist/workspace/paths.d.ts +11 -0
  268. package/dist/workspace/paths.d.ts.map +1 -0
  269. package/dist/workspace/paths.js +12 -0
  270. package/dist/workspace/paths.js.map +1 -0
  271. package/dist/workspace/revision.d.ts +6 -0
  272. package/dist/workspace/revision.d.ts.map +1 -0
  273. package/dist/workspace/revision.js +15 -0
  274. package/dist/workspace/revision.js.map +1 -0
  275. package/dist/xlsx/index.d.ts +2 -0
  276. package/dist/xlsx/index.d.ts.map +1 -0
  277. package/dist/xlsx/index.js +3 -0
  278. package/dist/xlsx/index.js.map +1 -0
  279. package/package.json +48 -27
  280. package/schema/command.schema.json +2399 -0
  281. package/dist/.tsbuildinfo +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slide-size.js","sourceRoot":"","sources":["../../src/pptx/slide-size.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAOvC,MAAM,UAAU,aAAa,CAAC,OAAmB;IAC/C,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC7B,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;YACb,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;YAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;YAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC;gBAC1F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,2BAA2B;IAC7B,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAmB,EACnB,OAA8B,UAAU;IAExC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,QAAQ;QAC5B,cAAc,EAAE,IAAI,CAAC,SAAS;QAC9B,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { OpcArchive } from '../opc/index.js';
2
+ /** Keep docProps/app.xml Slides/Notes in sync with the package (PowerPoint repairs on mismatch). */
3
+ export declare const syncAppSlideCounts: (archive: OpcArchive) => void;
4
+ /** Create a notes slide part for `slidePart` when missing; return the notes part URI. */
5
+ export declare function ensureNotes(archive: OpcArchive, slidePart: string): string;
6
+ export declare function addSlide(archive: OpcArchive, templatePart?: string, layoutPart?: string, afterIndex?: number): string;
7
+ export declare function duplicateSlide(archive: OpcArchive, part: string): string;
8
+ /**
9
+ * Rebind a slide's slideLayout relationship. Does not remap placeholders.
10
+ * Returns whether the relationship target actually changed.
11
+ */
12
+ export declare function setSlideLayout(archive: OpcArchive, slidePart: string, layoutPart: string): boolean;
13
+ export declare function removeSlide(archive: OpcArchive, part: string): void;
14
+ export declare function slideElementPart(refPart: string): string;
15
+ //# sourceMappingURL=slides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slides.d.ts","sourceRoot":"","sources":["../../src/pptx/slides.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AA2CnE,oGAAoG;AACpG,eAAO,MAAM,kBAAkB,GAAI,SAAS,UAAU,KAAG,IAyBxD,CAAC;AAEF,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAkC1E;AAmCD,wBAAgB,QAAQ,CACtB,OAAO,EAAE,UAAU,EACnB,YAAY,CAAC,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CA6DR;AACD,wBAAgB,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAmBT;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAyBnE;AACD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,236 @@
1
+ import { posix } from 'node:path';
2
+ import { OpcArchive } from '../opc/index.js';
3
+ import { cleanupUnreferencedPart } from './picture.js';
4
+ import { NS, REL, attr, descendants } from './xml.js';
5
+ const SLIDE_CT = 'application/vnd.openxmlformats-officedocument.presentationml.slide+xml';
6
+ const NOTES_CT = 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml';
7
+ const EP_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties';
8
+ const nextNumber = (archive, prefix) => Math.max(0, ...[...archive.parts.keys()]
9
+ .filter((n) => n.startsWith(prefix))
10
+ .map((n) => Number(/(\d+)\.xml$/.exec(n)?.[1] ?? 0))) + 1;
11
+ const relativeTarget = (source, target) => posix.relative(posix.dirname(source), target).replace(/^\//, '');
12
+ const nextRelId = (rels) => {
13
+ const used = new Set(rels.map((r) => r.id));
14
+ let n = 1;
15
+ while (used.has(`rId${String(n)}`))
16
+ n++;
17
+ return `rId${String(n)}`;
18
+ };
19
+ /**
20
+ * `p:sldId` entries in `p:sldIdLst` only.
21
+ *
22
+ * Decks with sections also carry `p14:sldId` under `p14:sectionLst`. Those share
23
+ * the local name `sldId` but must not be counted as slides — doing so makes
24
+ * `docProps/app.xml` `<Slides>` wrong and PowerPoint prompts to repair.
25
+ *
26
+ * Accepts either the presentation document or the `p:sldIdLst` element itself
27
+ * (`descendants` does not include the root node).
28
+ */
29
+ const presentationSlideIds = (node) => {
30
+ const el = node;
31
+ const list = el.nodeType === 1 && el.localName === 'sldIdLst' && el.namespaceURI === NS.p
32
+ ? el
33
+ : descendants(node, 'sldIdLst').find((item) => item.namespaceURI === NS.p);
34
+ if (!list)
35
+ return [];
36
+ return descendants(list, 'sldId').filter((item) => item.namespaceURI === NS.p);
37
+ };
38
+ /** Keep docProps/app.xml Slides/Notes in sync with the package (PowerPoint repairs on mismatch). */
39
+ export const syncAppSlideCounts = (archive) => {
40
+ const part = archive.getPart('/docProps/app.xml');
41
+ if (!part)
42
+ return;
43
+ const slideCount = presentationSlideIds(archive.readXml('/ppt/presentation.xml')).length;
44
+ let notesCount = 0;
45
+ for (const [slidePart, rels] of archive.relationships) {
46
+ if (!slidePart.startsWith('/ppt/slides/'))
47
+ continue;
48
+ if (rels.some((r) => r.type === REL.notes))
49
+ notesCount++;
50
+ }
51
+ const app = archive.readXml('/docProps/app.xml');
52
+ let dirty = false;
53
+ for (const [localName, value] of [
54
+ ['Slides', String(slideCount)],
55
+ ['Notes', String(notesCount)],
56
+ ]) {
57
+ const el = descendants(app, localName).find((node) => !node.namespaceURI || node.namespaceURI === EP_NS);
58
+ if (!el)
59
+ continue;
60
+ if ((el.textContent ?? '') === value)
61
+ continue;
62
+ while (el.firstChild)
63
+ el.removeChild(el.firstChild);
64
+ el.appendChild(app.createTextNode(value));
65
+ dirty = true;
66
+ }
67
+ if (dirty)
68
+ archive.writeXml('/docProps/app.xml', app, part.mediaType);
69
+ };
70
+ /** Create a notes slide part for `slidePart` when missing; return the notes part URI. */
71
+ export function ensureNotes(archive, slidePart) {
72
+ const existing = archive.getRelationships(slidePart).find((r) => r.type === REL.notes);
73
+ if (existing?.resolvedTarget && archive.getPart(existing.resolvedTarget))
74
+ return existing.resolvedTarget;
75
+ const number = nextNumber(archive, '/ppt/notesSlides/');
76
+ const part = `/ppt/notesSlides/notesSlide${String(number)}.xml`;
77
+ archive.setPart(part, new TextEncoder().encode(`<p:notes xmlns:p="${NS.p}" xmlns:a="${NS.a}" xmlns:r="${NS.r}"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr/><p:sp><p:nvSpPr><p:cNvPr id="2" name="Notes Placeholder"/><p:cNvSpPr txBox="1"/><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:t></a:t></a:r></a:p></p:txBody></p:sp></p:spTree></p:cSld></p:notes>`), NOTES_CT);
78
+ archive.setRelationships(part, [
79
+ {
80
+ id: 'rId1',
81
+ type: REL.slide,
82
+ target: relativeTarget(part, slidePart),
83
+ external: false,
84
+ resolvedTarget: slidePart,
85
+ },
86
+ ]);
87
+ const rels = [...archive.getRelationships(slidePart)];
88
+ const rid = nextRelId(rels);
89
+ rels.push({
90
+ id: rid,
91
+ type: REL.notes,
92
+ target: relativeTarget(slidePart, part),
93
+ external: false,
94
+ resolvedTarget: part,
95
+ });
96
+ archive.setRelationships(slidePart, rels);
97
+ return part;
98
+ }
99
+ const cloneMutableTargets = (archive, sourcePart, newPart) => archive.getRelationships(sourcePart).map((rel) => {
100
+ if (rel.external || !rel.resolvedTarget)
101
+ return rel;
102
+ if (rel.type !== REL.chart && rel.type !== REL.notes)
103
+ return { ...rel, resolvedTarget: rel.resolvedTarget };
104
+ const old = rel.resolvedTarget;
105
+ const folder = rel.type === REL.chart ? '/ppt/charts/' : '/ppt/notesSlides/';
106
+ const fresh = `${folder}${rel.type === REL.chart ? 'chart' : 'notesSlide'}${String(nextNumber(archive, folder))}.xml`;
107
+ const part = archive.getPart(old);
108
+ if (part)
109
+ archive.setPart(fresh, part.data.slice(), part.mediaType);
110
+ const childRels = archive.getRelationships(old);
111
+ if (childRels.length)
112
+ archive.setRelationships(fresh, childRels.map((child) => ({
113
+ ...child,
114
+ target: child.external || !child.resolvedTarget
115
+ ? child.target
116
+ : relativeTarget(fresh, child.resolvedTarget),
117
+ })));
118
+ return { ...rel, target: relativeTarget(newPart, fresh), resolvedTarget: fresh };
119
+ });
120
+ const presentationState = (archive) => {
121
+ const doc = archive.readXml('/ppt/presentation.xml');
122
+ const list = descendants(doc, 'sldIdLst').find((el) => el.namespaceURI === NS.p);
123
+ if (!list)
124
+ throw new Error('presentation.xml has no sldIdLst');
125
+ return { doc, list, rels: [...archive.getRelationships('/ppt/presentation.xml')] };
126
+ };
127
+ export function addSlide(archive, templatePart, layoutPart, afterIndex) {
128
+ const { doc, list, rels } = presentationState(archive);
129
+ const number = nextNumber(archive, '/ppt/slides/');
130
+ const part = `/ppt/slides/slide${String(number)}.xml`;
131
+ if (templatePart) {
132
+ const template = archive.getPart(templatePart);
133
+ if (!template)
134
+ throw new Error(`Template slide missing: ${templatePart}`);
135
+ archive.setPart(part, template.data.slice(), SLIDE_CT);
136
+ archive.setRelationships(part, cloneMutableTargets(archive, templatePart, part).map((rel) => ({
137
+ ...rel,
138
+ target: rel.external || !rel.resolvedTarget
139
+ ? rel.target
140
+ : relativeTarget(part, rel.resolvedTarget),
141
+ })));
142
+ }
143
+ else {
144
+ archive.setPart(part, new TextEncoder().encode(`<p:sld xmlns:p="${NS.p}" xmlns:a="${NS.a}" xmlns:r="${NS.r}"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name="Root"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`), SLIDE_CT);
145
+ if (layoutPart)
146
+ archive.setRelationships(part, [
147
+ {
148
+ id: 'rId1',
149
+ type: REL.layout,
150
+ target: relativeTarget(part, layoutPart),
151
+ external: false,
152
+ resolvedTarget: layoutPart,
153
+ },
154
+ ]);
155
+ }
156
+ const rid = nextRelId(rels);
157
+ rels.push({
158
+ id: rid,
159
+ type: REL.slide,
160
+ target: relativeTarget('/ppt/presentation.xml', part),
161
+ external: false,
162
+ resolvedTarget: part,
163
+ });
164
+ archive.setRelationships('/ppt/presentation.xml', rels);
165
+ const sld = doc.createElementNS(NS.p, 'p:sldId');
166
+ const existing = presentationSlideIds(list);
167
+ sld.setAttribute('id', String(Math.max(255, ...existing.map((n) => Number(attr(n, 'id') ?? 255))) + 1));
168
+ sld.setAttributeNS(NS.r, 'r:id', rid);
169
+ // Insert after the given 1-based slide index; append when omitted / out of range.
170
+ const anchor = afterIndex !== undefined && afterIndex > 0 ? existing[afterIndex - 1] : undefined;
171
+ if (anchor?.nextSibling)
172
+ list.insertBefore(sld, anchor.nextSibling);
173
+ else if (anchor)
174
+ list.appendChild(sld);
175
+ else
176
+ list.appendChild(sld);
177
+ archive.writeXml('/ppt/presentation.xml', doc);
178
+ syncAppSlideCounts(archive);
179
+ return part;
180
+ }
181
+ export function duplicateSlide(archive, part) {
182
+ return addSlide(archive, part);
183
+ }
184
+ /**
185
+ * Rebind a slide's slideLayout relationship. Does not remap placeholders.
186
+ * Returns whether the relationship target actually changed.
187
+ */
188
+ export function setSlideLayout(archive, slidePart, layoutPart) {
189
+ if (!archive.getPart(slidePart))
190
+ throw new Error(`Slide missing: ${slidePart}`);
191
+ if (!archive.getPart(layoutPart))
192
+ throw new Error(`Layout missing: ${layoutPart}`);
193
+ const rels = [...archive.getRelationships(slidePart)];
194
+ const existingIdx = rels.findIndex((r) => r.type === REL.layout);
195
+ const existing = existingIdx >= 0 ? rels[existingIdx] : undefined;
196
+ if (existing?.resolvedTarget === layoutPart)
197
+ return false;
198
+ const target = relativeTarget(slidePart, layoutPart);
199
+ const nextRel = {
200
+ id: existing?.id ?? nextRelId(rels),
201
+ type: REL.layout,
202
+ target,
203
+ external: false,
204
+ resolvedTarget: layoutPart,
205
+ };
206
+ if (existingIdx >= 0)
207
+ rels[existingIdx] = nextRel;
208
+ else
209
+ rels.push(nextRel);
210
+ archive.setRelationships(slidePart, rels);
211
+ return true;
212
+ }
213
+ export function removeSlide(archive, part) {
214
+ const { doc, list, rels } = presentationState(archive);
215
+ const rel = rels.find((r) => r.resolvedTarget === part);
216
+ if (!rel)
217
+ throw new Error(`Slide not registered: ${part}`);
218
+ const node = presentationSlideIds(list).find((n) => (n.getAttributeNS(NS.r, 'id') ?? attr(n, 'r:id')) === rel.id);
219
+ node?.parentNode?.removeChild(node);
220
+ archive.setRelationships('/ppt/presentation.xml', rels.filter((r) => r.id !== rel.id));
221
+ const targets = archive
222
+ .getRelationships(part)
223
+ .filter((r) => !r.external &&
224
+ r.resolvedTarget &&
225
+ (r.type === REL.chart || r.type === REL.notes || r.type === REL.image))
226
+ .flatMap((r) => (r.resolvedTarget ? [r.resolvedTarget] : []));
227
+ archive.deletePart(part);
228
+ for (const target of targets)
229
+ cleanupUnreferencedPart(archive, target);
230
+ archive.writeXml('/ppt/presentation.xml', doc);
231
+ syncAppSlideCounts(archive);
232
+ }
233
+ export function slideElementPart(refPart) {
234
+ return refPart.split('#')[0] ?? refPart;
235
+ }
236
+ //# sourceMappingURL=slides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slides.js","sourceRoot":"","sources":["../../src/pptx/slides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,QAAQ,GAAG,wEAAwE,CAAC;AAC1F,MAAM,QAAQ,GAAG,6EAA6E,CAAC;AAC/F,MAAM,KAAK,GAAG,2EAA2E,CAAC;AAC1F,MAAM,UAAU,GAAG,CAAC,OAAmB,EAAE,MAAc,EAAU,EAAE,CACjE,IAAI,CAAC,GAAG,CACN,CAAC,EACD,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;KACzB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;KACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACvD,GAAG,CAAC,CAAC;AACR,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,MAAc,EAAU,EAAE,CAChE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,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AAC,QAAQ;QACX,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,CACzE;SACA,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IAC/C,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,43 @@
1
+ /** Default DrawingML cell left/right margin (~0.1"). */
2
+ export declare const TABLE_CELL_PAD_X_EMU = 91440;
3
+ /** Default DrawingML cell top/bottom margin (~0.05"). */
4
+ export declare const TABLE_CELL_PAD_Y_EMU = 45720;
5
+ /** Matches table cell border width written by `tableXml` (`w="6350"`). */
6
+ export declare const TABLE_CELL_BORDER_EMU = 6350;
7
+ /** Extra headroom on total table height (~8%). */
8
+ export declare const TABLE_HEIGHT_SAFETY = 1.08;
9
+ /** Default body font for generated tables. */
10
+ export declare const TABLE_DEFAULT_FONT_PT = 11;
11
+ export interface TableMeasureInput {
12
+ readonly rows: readonly (readonly string[])[];
13
+ /** Full table width in EMU (sum of column widths). */
14
+ readonly widthEmu: number;
15
+ readonly fontPt?: number;
16
+ /** When true, row 0 uses bold glyph widths. */
17
+ readonly headerBold?: boolean;
18
+ }
19
+ export interface TableMeasureResult {
20
+ readonly rowHeightsEmu: readonly number[];
21
+ readonly totalHeightEmu: number;
22
+ readonly colWidthEmu: number;
23
+ readonly cols: number;
24
+ }
25
+ /** Minimum single-line row height including vertical padding and borders. */
26
+ export declare const estimateTableRowHeightEmu: (fontPt?: number) => number;
27
+ /** Empty-cell fallback: rowCount × single-line row height (no wrap). */
28
+ export declare const estimateTableHeightEmu: (rowCount: number, fontPt?: number) => number;
29
+ /**
30
+ * Per-row height from content wrap heuristics (measureText + cell padding/borders).
31
+ */
32
+ export declare function measureTableLayout(input: TableMeasureInput): TableMeasureResult;
33
+ export declare const tableHeightMayClipDiagnostic: (input: {
34
+ estimatedEmu: number;
35
+ givenEmu: number;
36
+ target?: string;
37
+ }) => {
38
+ severity: "warning";
39
+ code: "TABLE_HEIGHT_MAY_CLIP";
40
+ message: string;
41
+ details: Record<string, unknown>;
42
+ };
43
+ //# sourceMappingURL=table-measure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-measure.d.ts","sourceRoot":"","sources":["../../src/pptx/table-measure.ts"],"names":[],"mappings":"AAEA,wDAAwD;AACxD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAC3C,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,8CAA8C;AAC9C,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9C,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,GAAI,eAA8B,KAAG,MAG1E,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,EAAE,eAA8B,KAAG,MACG,CAAC;AAE9F;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CA2C/E;AAED,eAAO,MAAM,4BAA4B,GAAI,OAAO;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAUjC,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { EMU_PER_PT, measureText } from '../core/index.js';
2
+ /** Default DrawingML cell left/right margin (~0.1"). */
3
+ export const TABLE_CELL_PAD_X_EMU = 91_440;
4
+ /** Default DrawingML cell top/bottom margin (~0.05"). */
5
+ export const TABLE_CELL_PAD_Y_EMU = 45_720;
6
+ /** Matches table cell border width written by `tableXml` (`w="6350"`). */
7
+ export const TABLE_CELL_BORDER_EMU = 6_350;
8
+ /** Extra headroom on total table height (~8%). */
9
+ export const TABLE_HEIGHT_SAFETY = 1.08;
10
+ /** Default body font for generated tables. */
11
+ export const TABLE_DEFAULT_FONT_PT = 11;
12
+ /** Minimum single-line row height including vertical padding and borders. */
13
+ export const estimateTableRowHeightEmu = (fontPt = TABLE_DEFAULT_FONT_PT) => {
14
+ const textH = Math.round(fontPt * 1.2 * EMU_PER_PT);
15
+ return textH + TABLE_CELL_PAD_Y_EMU * 2 + TABLE_CELL_BORDER_EMU * 2;
16
+ };
17
+ /** Empty-cell fallback: rowCount × single-line row height (no wrap). */
18
+ export const estimateTableHeightEmu = (rowCount, fontPt = TABLE_DEFAULT_FONT_PT) => Math.round(Math.max(1, rowCount) * estimateTableRowHeightEmu(fontPt) * TABLE_HEIGHT_SAFETY);
19
+ /**
20
+ * Per-row height from content wrap heuristics (measureText + cell padding/borders).
21
+ */
22
+ export function measureTableLayout(input) {
23
+ const fontPt = input.fontPt ?? TABLE_DEFAULT_FONT_PT;
24
+ const rows = input.rows.length > 0 ? input.rows : [['']];
25
+ const cols = Math.max(1, ...rows.map((r) => r.length));
26
+ const widthEmu = Math.max(1, input.widthEmu);
27
+ const colWidthEmu = Math.floor(widthEmu / cols);
28
+ const contentWidthEmu = Math.max(1, colWidthEmu - TABLE_CELL_PAD_X_EMU * 2 - TABLE_CELL_BORDER_EMU * 2);
29
+ const headerBold = input.headerBold !== false;
30
+ const minRow = estimateTableRowHeightEmu(fontPt);
31
+ const rowHeightsEmu = rows.map((row, rowIndex) => {
32
+ let maxCell = minRow;
33
+ for (let c = 0; c < cols; c++) {
34
+ const raw = row[c];
35
+ const text = typeof raw === 'string' ? raw : '';
36
+ const measured = measureText({
37
+ text: text.length > 0 ? text : ' ',
38
+ fontSize: fontPt,
39
+ bold: headerBold && rowIndex === 0,
40
+ maxWidthEmu: contentWidthEmu,
41
+ });
42
+ const cellH = measured.heightEmu + TABLE_CELL_PAD_Y_EMU * 2 + TABLE_CELL_BORDER_EMU * 2;
43
+ maxCell = Math.max(maxCell, cellH);
44
+ }
45
+ return maxCell;
46
+ });
47
+ const rawTotal = rowHeightsEmu.reduce((sum, h) => sum + h, 0);
48
+ const totalHeightEmu = Math.max(1, Math.round(rawTotal * TABLE_HEIGHT_SAFETY));
49
+ // Distribute safety into the last row so Σ rowH ≈ frame height.
50
+ if (rowHeightsEmu.length > 0) {
51
+ const sum = rowHeightsEmu.reduce((a, b) => a + b, 0);
52
+ const delta = totalHeightEmu - sum;
53
+ if (delta !== 0) {
54
+ const last = rowHeightsEmu[rowHeightsEmu.length - 1];
55
+ rowHeightsEmu[rowHeightsEmu.length - 1] = Math.max(1, last + delta);
56
+ }
57
+ }
58
+ return { rowHeightsEmu, totalHeightEmu, colWidthEmu, cols };
59
+ }
60
+ export const tableHeightMayClipDiagnostic = (input) => ({
61
+ severity: 'warning',
62
+ code: 'TABLE_HEIGHT_MAY_CLIP',
63
+ message: `Table height ${String(input.givenEmu)} EMU is below estimated content height ${String(input.estimatedEmu)} EMU; bottom rows may clip`,
64
+ details: {
65
+ estimatedEmu: input.estimatedEmu,
66
+ givenEmu: input.givenEmu,
67
+ ...(input.target !== undefined ? { target: input.target } : {}),
68
+ },
69
+ });
70
+ //# sourceMappingURL=table-measure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-measure.js","sourceRoot":"","sources":["../../src/pptx/table-measure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3D,wDAAwD;AACxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAC3C,kDAAkD;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAkBxC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,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,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,cAAc,GAAG,GAAG,CAAC;QACnC,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;YACtD,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAI5C,EAKC,EAAE,CAAC,CAAC;IACJ,QAAQ,EAAE,SAAS;IACnB,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,gBAAgB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,0CAA0C,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,4BAA4B;IAC/I,OAAO,EAAE;QACP,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE;CACF,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type Result } from '../core/index.js';
2
+ import type { Element } from '@xmldom/xmldom';
3
+ import { type ShapePropertyContext } from './properties.js';
4
+ export declare function insertTableRow(node: Element, spec: unknown): void;
5
+ export declare function deleteTableRow(node: Element, spec: unknown): void;
6
+ export declare function insertTableColumn(node: Element, spec: unknown): void;
7
+ export declare function deleteTableColumn(node: Element, spec: unknown): void;
8
+ export declare function setTableCellFill(cell: Element, value: unknown): void;
9
+ export declare function applyTableProperties(node: Element, properties: Record<string, unknown>, context?: ShapePropertyContext): Result<{
10
+ applied: string[];
11
+ }>;
12
+ export declare function applyTableCellProperties(node: Element, properties: Record<string, unknown>): Result<{
13
+ applied: string[];
14
+ }>;
15
+ export declare function applyTableLayout(graphicFrame: Element, options: {
16
+ height?: 'auto' | number;
17
+ redistribute?: 'equal' | 'content';
18
+ }): Result<{
19
+ applied: string[];
20
+ totalHeightEmu: number;
21
+ estimatedEmu?: number;
22
+ }>;
23
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/pptx/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAiKzB,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAsBjE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAQjE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CA2BpE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAmBpE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA4BpE;AA6ED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,E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