@officedk/pptxdk 0.1.0 → 0.2.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 (338) hide show
  1. package/dist/build.d.ts +14 -76
  2. package/dist/build.js +69 -97
  3. package/dist/cli.js +1 -1
  4. package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
  5. package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
  6. package/dist/core/dist/capabilities/audio/entry.js +122 -0
  7. package/dist/core/dist/capabilities/box/box-codegen.js +83 -0
  8. package/dist/core/dist/capabilities/box/box-declaration.js +32 -0
  9. package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +32 -29
  10. package/dist/core/dist/capabilities/box/entry.js +2 -0
  11. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +17 -22
  12. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
  13. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +1025 -471
  14. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
  15. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +3 -3
  16. package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
  17. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +216 -212
  18. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
  19. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +228 -171
  20. package/dist/core/dist/capabilities/chart/entry.js +2 -0
  21. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +23 -10
  22. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
  23. package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
  24. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
  25. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +30 -9
  26. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +160 -89
  27. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +4 -4
  28. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +4 -4
  29. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
  30. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
  31. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
  32. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +3 -3
  33. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +15 -3
  34. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
  35. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +5 -5
  36. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
  37. package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
  38. package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
  39. package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
  40. package/dist/core/dist/capabilities/comment/comment.js +141 -0
  41. package/dist/core/dist/capabilities/comment/entry.js +1 -0
  42. package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
  43. package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
  44. package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +194 -133
  45. package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
  46. package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
  47. package/dist/core/dist/capabilities/group/entry.js +2 -0
  48. package/dist/core/dist/capabilities/group/group-codegen.js +73 -0
  49. package/dist/core/dist/capabilities/group/group-declaration.js +41 -0
  50. package/dist/core/dist/capabilities/group/group-import.js +608 -0
  51. package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +4 -3
  52. package/dist/core/dist/capabilities/group/group.js +260 -0
  53. package/dist/core/dist/capabilities/image/entry.js +4 -0
  54. package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
  55. package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
  56. package/dist/core/dist/capabilities/image/image-import.js +26 -0
  57. package/dist/core/dist/capabilities/image/image.js +57 -0
  58. package/dist/core/dist/capabilities/line/entry.js +3 -0
  59. package/dist/core/dist/capabilities/line/line-codegen.js +88 -0
  60. package/dist/core/dist/capabilities/line/line-declaration.js +78 -0
  61. package/dist/core/dist/capabilities/line/line-import.js +424 -0
  62. package/dist/core/dist/capabilities/line/line-xml.js +9 -0
  63. package/dist/core/dist/capabilities/line/line.js +329 -0
  64. package/dist/core/dist/capabilities/masters/entry.js +1 -0
  65. package/dist/core/dist/capabilities/masters/masters-codegen.js +50 -0
  66. package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +35 -47
  67. package/dist/core/dist/capabilities/motion/entry.js +5 -0
  68. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +97 -51
  69. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +653 -102
  70. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +317 -163
  71. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +9 -6
  72. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +357 -108
  73. package/dist/core/dist/capabilities/notes/entry.js +2 -0
  74. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +5 -7
  75. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
  76. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
  77. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +12 -9
  78. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +20 -42
  79. package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
  80. package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
  81. package/dist/core/dist/capabilities/placeholder/placeholder-codegen.js +44 -0
  82. package/dist/core/dist/capabilities/placeholder/placeholder-schemas.js +31 -0
  83. package/dist/core/dist/capabilities/placeholder/placeholder.js +394 -0
  84. package/dist/core/dist/capabilities/shape/entry.js +6 -0
  85. package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
  86. package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
  87. package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
  88. package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +100 -103
  89. package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
  90. package/dist/core/dist/capabilities/shared/date-time.js +98 -0
  91. package/dist/core/dist/capabilities/shared/font/font-embedding.js +118 -0
  92. package/dist/core/dist/capabilities/shared/font/font-engine.js +855 -0
  93. package/dist/core/dist/capabilities/shared/font/font-import.js +805 -0
  94. package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
  95. package/dist/core/dist/capabilities/shared/font/font.js +72 -0
  96. package/dist/{capabilities/dist/shape/shape-codegen.js → core/dist/capabilities/shared/geometry-codegen.js} +4 -69
  97. package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +384 -123
  98. package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
  99. package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
  100. package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -56
  101. package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +49 -61
  102. package/dist/core/dist/capabilities/shared/line-match.js +78 -0
  103. package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
  104. package/dist/core/dist/capabilities/shared/media-import.js +156 -0
  105. package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
  106. package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
  107. package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
  108. package/dist/core/dist/capabilities/shared/media-source.js +107 -0
  109. package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
  110. package/dist/core/dist/capabilities/shared/media.js +134 -0
  111. package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
  112. package/dist/core/dist/capabilities/shared/motion-api.js +770 -0
  113. package/dist/core/dist/capabilities/shared/motion-schemas.js +353 -0
  114. package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +313 -168
  115. package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
  116. package/dist/core/dist/capabilities/shared/picture.js +510 -0
  117. package/dist/core/dist/capabilities/shared/placeholder-import.js +268 -0
  118. package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
  119. package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1221 -188
  120. package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
  121. package/dist/core/dist/capabilities/shared/rich-text-codegen.js +119 -0
  122. package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
  123. package/dist/core/dist/capabilities/shared/shape-declaration.js +45 -0
  124. package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +26 -24
  125. package/dist/core/dist/capabilities/shared/text-declaration.js +31 -0
  126. package/dist/core/dist/capabilities/shared/text-schemas.js +241 -0
  127. package/dist/core/dist/capabilities/shared/text-service.js +2563 -0
  128. package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +441 -137
  129. package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
  130. package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
  131. package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +12 -7
  132. package/dist/core/dist/capabilities/slide-background/slide-background-xml.js +33 -0
  133. package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +61 -50
  134. package/dist/core/dist/capabilities/table/entry.js +2 -0
  135. package/dist/core/dist/capabilities/table/table-codegen.js +118 -0
  136. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
  137. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +116 -84
  138. package/dist/core/dist/capabilities/table/table-schemas.js +337 -0
  139. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +13 -15
  140. package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +284 -192
  141. package/dist/core/dist/capabilities/text/entry.js +3 -0
  142. package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
  143. package/dist/core/dist/capabilities/text/text-import.js +468 -0
  144. package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
  145. package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +103 -111
  146. package/dist/core/dist/capabilities/transition/entry.js +3 -0
  147. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +13 -16
  148. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
  149. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
  150. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
  151. package/dist/core/dist/capabilities/video/entry.js +77 -0
  152. package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
  153. package/dist/core/dist/capabilities/video/video-source.js +42 -0
  154. package/dist/{codegen/dist → core/dist/codegen}/assets.js +16 -10
  155. package/dist/{codegen/dist → core/dist/codegen}/codegen.js +152 -140
  156. package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +27 -1
  157. package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
  158. package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
  159. package/dist/core/dist/document/all.js +41 -0
  160. package/dist/core/dist/document/default.js +10 -0
  161. package/dist/core/dist/document/document.js +218 -0
  162. package/dist/core/dist/document/index.js +62 -0
  163. package/dist/core/dist/document/stages.js +54 -0
  164. package/dist/{emit/dist → core/dist/emit}/emit.js +173 -90
  165. package/dist/core/dist/emit/index.js +6 -0
  166. package/dist/core/dist/emit/ooxml.js +241 -0
  167. package/dist/core/dist/import/import.js +547 -0
  168. package/dist/core/dist/import/index.js +19 -0
  169. package/dist/{import/dist → core/dist/import}/masters.js +404 -328
  170. package/dist/core/dist/import/media-timing.js +233 -0
  171. package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
  172. package/dist/core/dist/index.js +47 -15
  173. package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +9 -6
  174. package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +105 -127
  175. package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +225 -142
  176. package/dist/core/dist/kernel/build.js +4 -0
  177. package/dist/core/dist/kernel/capability.js +17 -0
  178. package/dist/core/dist/kernel/codegen.js +97 -0
  179. package/dist/core/dist/kernel/container-slots.js +104 -0
  180. package/dist/core/dist/kernel/date-time-format.js +18 -0
  181. package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
  182. package/dist/core/dist/{declaration.js → kernel/declaration.js} +3 -2
  183. package/dist/core/dist/kernel/diagnostics.js +370 -0
  184. package/dist/core/dist/kernel/document-internals.js +26 -0
  185. package/dist/core/dist/{document.js → kernel/document.js} +23 -13
  186. package/dist/core/dist/kernel/drawing-units.js +14 -0
  187. package/dist/core/dist/kernel/font-seal.js +204 -0
  188. package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +21 -18
  189. package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +177 -72
  190. package/dist/core/dist/{host.js → kernel/host.js} +1 -1
  191. package/dist/core/dist/kernel/index.js +24 -0
  192. package/dist/core/dist/kernel/input-values.js +62 -0
  193. package/dist/core/dist/kernel/layout-definition.js +7 -0
  194. package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +5 -10
  195. package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +33 -44
  196. package/dist/core/dist/kernel/layout.js +339 -0
  197. package/dist/core/dist/kernel/masters.js +171 -0
  198. package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
  199. package/dist/core/dist/kernel/placeholders.js +289 -0
  200. package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
  201. package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +33 -29
  202. package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
  203. package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +71 -12
  204. package/dist/core/dist/kernel/pptx-read/index.js +15 -0
  205. package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
  206. package/dist/core/dist/kernel/pptx-read/media.js +26 -0
  207. package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +6 -7
  208. package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
  209. package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
  210. package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
  211. package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +182 -41
  212. package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +175 -88
  213. package/dist/core/dist/kernel/pptx-read/xml-fragments.js +320 -0
  214. package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
  215. package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
  216. package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
  217. package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +133 -290
  218. package/dist/core/dist/{query.js → kernel/query.js} +76 -37
  219. package/dist/core/dist/{resolution.js → kernel/resolution.js} +2 -1
  220. package/dist/core/dist/kernel/resolve-work.js +58 -0
  221. package/dist/core/dist/{resolve.js → kernel/resolve.js} +797 -409
  222. package/dist/core/dist/kernel/resource-source.js +11 -0
  223. package/dist/core/dist/kernel/stage-options.js +312 -0
  224. package/dist/core/dist/{theme.js → kernel/theme.js} +399 -289
  225. package/dist/core/dist/kernel/transform-geometry.js +72 -0
  226. package/dist/core/dist/kernel/xml-values.js +13 -0
  227. package/dist/document-C0lPlH-L.d.ts +1442 -0
  228. package/dist/index-B9_OUeA-.d.ts +2238 -0
  229. package/dist/index-BJEzQxWV.d.ts +75 -0
  230. package/dist/index-DA9flrlR.d.ts +146 -0
  231. package/dist/index-GSt0t9VO.d.ts +54 -0
  232. package/dist/index.d.ts +7 -7
  233. package/dist/index.js +75 -61
  234. package/dist/node.d.ts +37 -35
  235. package/dist/node.js +125 -51
  236. package/dist/pptxdk/src/cli-commands.js +79 -81
  237. package/dist/pptxdk/src/compose.js +32 -24
  238. package/dist/pptxdk/src/preview-result.js +24 -0
  239. package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
  240. package/dist/preview/dist/index.js +229 -77
  241. package/dist/preview/dist/options.js +17 -26
  242. package/dist/preview/dist/raster.js +66 -0
  243. package/dist/preview/dist/svg-guard.js +1090 -0
  244. package/dist/preview.d.ts +6 -3
  245. package/dist/preview.js +8 -24
  246. package/dist/react/dist/append.js +3 -3
  247. package/dist/react/dist/author/audio-elements.js +14 -0
  248. package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
  249. package/dist/react/dist/author/chart-elements.js +14 -0
  250. package/dist/react/dist/author/comment-elements.js +15 -0
  251. package/dist/react/dist/author/group-elements.js +14 -0
  252. package/dist/react/dist/author/image-elements.js +14 -0
  253. package/dist/react/dist/author/line-elements.js +14 -0
  254. package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
  255. package/dist/react/dist/author/notes-elements.js +14 -0
  256. package/dist/react/dist/author/placeholder-elements.js +14 -0
  257. package/dist/react/dist/author/shape-elements.js +14 -0
  258. package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
  259. package/dist/react/dist/author/text-elements.js +64 -0
  260. package/dist/react/dist/author/video-elements.js +14 -0
  261. package/dist/react/dist/document-adapter.js +376 -37
  262. package/dist/react/dist/elements.js +30 -4
  263. package/dist/react/dist/from-vanilla.js +57 -0
  264. package/dist/react/dist/index.js +47 -12
  265. package/dist/react/dist/mount.js +34 -0
  266. package/dist/react/dist/reconciler.js +26 -26
  267. package/dist/react.d.ts +174 -50
  268. package/dist/react.js +31 -27
  269. package/dist/stages-DYHSHKt4.d.ts +80 -0
  270. package/dist/vanilla.d.ts +4 -4
  271. package/dist/vanilla.js +14 -14
  272. package/package.json +6 -8
  273. package/README.md +0 -49
  274. package/dist/capabilities/dist/all.js +0 -32
  275. package/dist/capabilities/dist/box/box-codegen.js +0 -51
  276. package/dist/capabilities/dist/box/box-declaration.js +0 -31
  277. package/dist/capabilities/dist/chart/chart-elements.js +0 -12
  278. package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
  279. package/dist/capabilities/dist/document.js +0 -148
  280. package/dist/capabilities/dist/font/font-embedding.js +0 -289
  281. package/dist/capabilities/dist/font/font-family.js +0 -10
  282. package/dist/capabilities/dist/font/font-import.js +0 -302
  283. package/dist/capabilities/dist/font/font.js +0 -25
  284. package/dist/capabilities/dist/group/group-codegen.js +0 -51
  285. package/dist/capabilities/dist/group/group-declaration.js +0 -42
  286. package/dist/capabilities/dist/group/group-elements.js +0 -12
  287. package/dist/capabilities/dist/group/group-import.js +0 -319
  288. package/dist/capabilities/dist/group/group.js +0 -211
  289. package/dist/capabilities/dist/image/image-codegen.js +0 -94
  290. package/dist/capabilities/dist/image/image-declaration.js +0 -8
  291. package/dist/capabilities/dist/image/image-elements.js +0 -12
  292. package/dist/capabilities/dist/image/image-xml.js +0 -12
  293. package/dist/capabilities/dist/image/image.js +0 -472
  294. package/dist/capabilities/dist/masters/masters-codegen.js +0 -21
  295. package/dist/capabilities/dist/motion/motion-api.js +0 -527
  296. package/dist/capabilities/dist/motion/motion-schemas.js +0 -216
  297. package/dist/capabilities/dist/notes/notes-elements.js +0 -12
  298. package/dist/capabilities/dist/notes/notes-xml.js +0 -38
  299. package/dist/capabilities/dist/placeholder/placeholder-codegen.js +0 -23
  300. package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -12
  301. package/dist/capabilities/dist/placeholder/placeholder.js +0 -292
  302. package/dist/capabilities/dist/shape/shape-declaration.js +0 -57
  303. package/dist/capabilities/dist/shape/shape-elements.js +0 -12
  304. package/dist/capabilities/dist/shape/shape-import.js +0 -579
  305. package/dist/capabilities/dist/shared/placeholder-import.js +0 -113
  306. package/dist/capabilities/dist/shared/style-parse.js +0 -11
  307. package/dist/capabilities/dist/shared/text-schemas.js +0 -216
  308. package/dist/capabilities/dist/shared/text-service.js +0 -1883
  309. package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
  310. package/dist/capabilities/dist/slide-background/slide-background-xml.js +0 -21
  311. package/dist/capabilities/dist/table/table-codegen.js +0 -81
  312. package/dist/capabilities/dist/table/table-schemas.js +0 -279
  313. package/dist/capabilities/dist/text/text-codegen.js +0 -129
  314. package/dist/capabilities/dist/text/text-declaration.js +0 -19
  315. package/dist/capabilities/dist/text/text-elements.js +0 -38
  316. package/dist/capabilities/dist/text/text-import.js +0 -1077
  317. package/dist/capability-D_xeNVIw.d.ts +0 -29496
  318. package/dist/codegen/dist/types.js +0 -49
  319. package/dist/core/dist/build.js +0 -4
  320. package/dist/core/dist/capability.js +0 -13
  321. package/dist/core/dist/diagnostics.js +0 -21
  322. package/dist/core/dist/document-internals.js +0 -13
  323. package/dist/core/dist/input-values.js +0 -45
  324. package/dist/core/dist/layout.js +0 -299
  325. package/dist/core/dist/masters.js +0 -169
  326. package/dist/core/dist/placeholders.js +0 -213
  327. package/dist/core/dist/stage-options.js +0 -67
  328. package/dist/document-BHPUODPP.d.ts +0 -27759
  329. package/dist/emit/dist/index.js +0 -5
  330. package/dist/import/dist/import.js +0 -504
  331. package/dist/import/dist/index.js +0 -16
  332. package/dist/import/dist/xml-fragments.js +0 -36
  333. package/dist/index-B5m3hqjC.d.ts +0 -7
  334. package/dist/index-CCy-Yo8G.d.ts +0 -1208
  335. package/dist/index-DpxcZ4Gs.d.ts +0 -725
  336. package/dist/pptxdk/src/slide.js +0 -9
  337. package/dist/preview-Cfw0QdMM.d.ts +0 -86
  338. package/dist/transition-Cips9wma.d.ts +0 -82
@@ -1,19 +1,17 @@
1
- import { BuildError, CapabilityError } from "../../core/dist/diagnostics.js";
2
- import { buildOptionsSchema, formatBaseline, targets } from "../../core/dist/stage-options.js";
3
- import "../../core/dist/build.js";
4
- import { createBuildQuery } from "../../core/dist/query.js";
5
- import { getInternalResolution } from "../../core/dist/resolution.js";
6
- import { assertXml10Characters, countAllocatedMasterThemeParts, hasThemeOverrideContent, pptxParts } from "./ooxml.js";
7
- import { createHash } from "node:crypto";
1
+ import { BuildError, CapabilityError, capabilityErrorToDiagnostic, toBuildDiagnostic } from "../kernel/diagnostics.js";
2
+ import { bytesSha256 } from "../kernel/font-seal.js";
3
+ import { buildOptionsSchema, emitOptionsSchema, formatBaseline, targets } from "../kernel/stage-options.js";
4
+ import { countAllocatedMasterThemeParts, pptxParts } from "./ooxml.js";
5
+ import "../kernel/build.js";
6
+ import "../kernel/capability.js";
7
+ import { assertXml10Characters, hasThemeOverrideContent } from "../kernel/pptx-write/xml.js";
8
+ import { writeTiming } from "../kernel/pptx-write/timing.js";
9
+ import { createBuildQuery } from "../kernel/query.js";
10
+ import { getInternalResolution } from "../kernel/resolution.js";
8
11
  import { strToU8, zipSync } from "fflate";
9
- // ../emit/dist/emit.js
10
- function diagnostic(path, code, message) {
11
- return {
12
- severity: "error",
13
- path,
14
- code,
15
- message
16
- };
12
+ // ../core/dist/emit/emit.js
13
+ function diagnostic(path, code, message, details) {
14
+ return toBuildDiagnostic(path, code, message, details);
17
15
  }
18
16
  function allocateTextFieldId(document) {
19
17
  return `{00000000-0000-4000-8000-${(document.nextTextFieldId++).toString(16).padStart(12, "0").toUpperCase()}}`;
@@ -29,33 +27,53 @@ function readValueAtPath(root, path) {
29
27
  function mapBuildOptionsIssue(rawOptions, issue) {
30
28
  const [head, second, third] = issue.path;
31
29
  if (head === void 0) {
32
- if (issue.code === "unrecognized_keys") return diagnostic("build", "unknown-parameter", `Build options contain unknown parameter ${issue.keys[0]}`);
30
+ if (issue.code === "unrecognized_keys") return diagnostic("build", "unknown-parameter", `Build options contain unknown parameter ${issue.keys[0]}`, {
31
+ prop: String(issue.keys[0]),
32
+ scope: "options"
33
+ });
33
34
  return diagnostic("build", "invalid-options", "Build options must be an object");
34
35
  }
35
- if (head === "embedFonts") return diagnostic("build.embedFonts", "unsupported-font-embedding", "embedFonts currently only supports 'full' or 'subset'");
36
- if (head === "signal") return diagnostic("build.signal", "invalid-options", "Build options signal must be an AbortSignal");
36
+ if (head === "embedFonts") return diagnostic("build.embedFonts", "unsupported-font-embedding", "embedFonts currently only supports 'full' or 'subset'", {
37
+ field: "embedFonts",
38
+ mechanism: "embedFonts"
39
+ });
40
+ if (head === "referenceDate") return diagnostic("build.referenceDate", "invalid-options", "referenceDate must be a valid Date or ISO date string", { field: "referenceDate" });
41
+ if (head === "signal") return diagnostic("build.signal", "invalid-options", "Build options signal must be an AbortSignal", { field: "signal" });
37
42
  if (head === "target") {
38
43
  if (second === void 0) {
39
- if (issue.code === "unrecognized_keys") return diagnostic("build.target", "unknown-parameter", `Target contains unknown parameter ${issue.keys[0]}`);
40
- return diagnostic("build.target", "invalid-target", "Target must be an object");
44
+ if (issue.code === "unrecognized_keys") return diagnostic("build.target", "unknown-parameter", `Target contains unknown parameter ${issue.keys[0]}`, {
45
+ prop: String(issue.keys[0]),
46
+ scope: "options",
47
+ field: "target"
48
+ });
49
+ return diagnostic("build.target", "invalid-target", "Target must be an object", { field: "target" });
41
50
  }
42
- if (second === "name") return diagnostic("build.target", "invalid-target", "Target requires a non-empty name");
43
- if (second === "format") return diagnostic("build.target", "unsupported-format", `This build only emits ${formatBaseline}`);
51
+ if (second === "name") return diagnostic("build.target", "invalid-target", "Target requires a non-empty name", { field: "target.name" });
52
+ if (second === "format") return diagnostic("build.target", "unsupported-format", `This build only emits ${formatBaseline}`, {
53
+ field: "target.format",
54
+ expected: formatBaseline
55
+ });
44
56
  if (second === "extensions") {
45
- if (third === void 0) return diagnostic("build.target", "invalid-target", "Target extensions must be an array");
46
- if (issue.code === "custom") return diagnostic("build.target", "duplicate-extension", issue.message);
57
+ if (third === void 0) return diagnostic("build.target", "invalid-target", "Target extensions must be an array", { field: "target.extensions" });
58
+ if (issue.code === "custom") return diagnostic("build.target", "duplicate-extension", issue.message, { field: "target.extensions" });
47
59
  const badExtension = readValueAtPath(rawOptions, issue.path);
48
- return diagnostic("build.target", "unsupported-extension", `Unsupported target extension ${String(badExtension)}`);
60
+ return diagnostic("build.target", "unsupported-extension", `Unsupported target extension ${String(badExtension)}`, {
61
+ field: "target.extensions",
62
+ extension: String(badExtension)
63
+ });
49
64
  }
50
65
  }
51
66
  return diagnostic("build", "invalid-options", issue.message);
52
67
  }
53
- /** Validates emit/build options (`target`, `embedFonts`, `signal`) and normalizes the target. */
54
- function validateOptions(options) {
55
- const parsed = buildOptionsSchema.safeParse(options);
68
+ function validateTargetOptions(options, schema) {
69
+ const parsed = schema.safeParse(options);
56
70
  if (!parsed.success) throw new BuildError(parsed.error.issues.map((issue) => mapBuildOptionsIssue(options, issue)));
57
71
  return parsed.data.target ?? targets.transitional;
58
72
  }
73
+ /** Validates the build options and returns the selected output target. */
74
+ function validateOptions(options) {
75
+ return validateTargetOptions(options, buildOptionsSchema);
76
+ }
59
77
  function addResource(resource, context, objectId) {
60
78
  if ("externalTarget" in resource) {
61
79
  if (typeof resource.externalTarget !== "string" || resource.externalTarget.trim() === "" || typeof resource.relationshipType !== "string" || resource.relationshipType.trim() === "") throw new CapabilityError("invalid-resource", "External resource target or relationship type is invalid");
@@ -91,7 +109,7 @@ function addResource(resource, context, objectId) {
91
109
  } catch {
92
110
  throw new CapabilityError("invalid-resource", "Resource relationship contains characters not allowed in XML");
93
111
  }
94
- const digest = createHash("sha256").update(resource.bytes).digest("hex");
112
+ const digest = bytesSha256(resource.bytes);
95
113
  const assetKey = `${extension}\u0000${resource.contentType}\u0000${digest}`;
96
114
  let asset = context.document.resources.get(assetKey);
97
115
  if (asset === void 0) {
@@ -137,20 +155,29 @@ function recordResourceObservation(slide, objectId, resource) {
137
155
  });
138
156
  }
139
157
  function packagePartPath(template, sequence) {
140
- if ((template.match(/\{n\}/gu) ?? []).length !== 1 || !/^(?:[a-z0-9_-]+\/)*[a-z0-9_-]+\.[a-z0-9]+$/iu.test(template.replace("{n}", String(sequence)))) throw new CapabilityError("invalid-part", "Native part path must be a safe package-relative path containing a single part number");
141
- return template.replace("{n}", String(sequence));
158
+ const path = sequence === void 0 ? template : template.replace("{n}", String(sequence));
159
+ if (sequence !== void 0 && (template.match(/\{n\}/gu) ?? []).length !== 1 || !/^(?:[a-z0-9_-]+\/)*[a-z0-9_-]+\.[a-z0-9]+$/iu.test(path)) throw new CapabilityError("invalid-part", sequence === void 0 ? "Native part path must be a safe package-relative path" : "Native part path must be a safe package-relative path containing a single part number");
160
+ return path;
142
161
  }
143
162
  /**
144
- * Allocates a shared part path without colliding with generated deck parts.
163
+ * Allocates a capability part path without colliding with generated deck parts.
145
164
  *
146
- * Shared part templates normally start at a free sequence number. A template such as
165
+ * Part numbering starts at 1 for each path template. A template such as
147
166
  * `ppt/theme/theme{n}.xml` must nevertheless skip the theme part generated from the deck theme,
148
167
  * which is written outside shared part registration but already reserved for the package.
149
168
  */
150
- function allocateSharedPackagePartPath(template, document) {
151
- for (;;) {
152
- const path = packagePartPath(template, document.nextPackagePartId++);
153
- if (!document.packageParts.has(path) && !document.presentationPartPaths.has(path)) return path;
169
+ function allocateCapabilityPartPath(template, document) {
170
+ if (!template.includes("{n}")) {
171
+ const path = packagePartPath(template);
172
+ if (document.packageParts.has(path) || document.presentationPartPaths.has(path)) throw new CapabilityError("duplicate-part", "Duplicate PPTX part path");
173
+ return path;
174
+ }
175
+ for (let sequence = document.nextCapabilityPartIdByTemplate.get(template) ?? 1;; sequence += 1) {
176
+ const path = packagePartPath(template, sequence);
177
+ if (!document.packageParts.has(path) && !document.presentationPartPaths.has(path)) {
178
+ document.nextCapabilityPartIdByTemplate.set(template, sequence + 1);
179
+ return path;
180
+ }
154
181
  }
155
182
  }
156
183
  function addPackagePart(packagePart, context, objectId) {
@@ -165,7 +192,7 @@ function addPackagePart(packagePart, context, objectId) {
165
192
  const sequence = context.document.nextPackagePartId++;
166
193
  const partPath = packagePartPath(part.pathTemplate, sequence);
167
194
  const related = relatedParts.map((item, index) => ({
168
- path: packagePartPath(item.pathTemplate, sequence),
195
+ path: item.independentSequence ? allocateCapabilityPartPath(item.pathTemplate, context.document) : packagePartPath(item.pathTemplate, sequence),
169
196
  relationship: {
170
197
  id: `rId${index + 1}`,
171
198
  type: item.relationshipType,
@@ -238,10 +265,13 @@ function packagePartDescriptor(part, relationshipType, relationships, content, l
238
265
  relationships: relationships ?? []
239
266
  };
240
267
  }
241
- function targetPartPath(target, context) {
242
- if (target.kind === "slide") return `ppt/slides/slide${context.slide.index}.xml`;
268
+ function targetPartPath(target, document, slideIndex) {
269
+ if (target.kind === "slide") {
270
+ if (slideIndex === void 0) throw new CapabilityError("invalid-part", "The package part has no owning slide");
271
+ return `ppt/slides/slide${slideIndex}.xml`;
272
+ }
243
273
  if (target.kind === "part") {
244
- const shared = context.document.sharedParts.get(target.key);
274
+ const shared = document.sharedParts.get(target.key);
245
275
  if (shared === void 0) throw new CapabilityError("missing-part-target", `Package part relationship references unregistered shared part ${JSON.stringify(target.key)}`);
246
276
  return shared.path;
247
277
  }
@@ -256,13 +286,11 @@ function addSlidePackagePart(part, context) {
256
286
  const descriptor = packagePartDescriptor(part.part, part.slideRelationshipType, part.relationships, part.content, "slide part", true);
257
287
  const slideRelationshipType = descriptor.relationshipType;
258
288
  if (slideRelationshipType === void 0) throw new CapabilityError("invalid-part", "Slide part relationship type is required");
259
- const sequence = context.document.nextPackagePartId++;
260
- const partPath = packagePartPath(descriptor.pathTemplate, sequence);
261
- if (context.document.packageParts.has(partPath) || context.document.presentationPartPaths.has(partPath)) throw new CapabilityError("duplicate-part", "Duplicate PPTX part path");
289
+ const partPath = allocateCapabilityPartPath(descriptor.pathTemplate, context.document);
262
290
  const relationships = descriptor.relationships.map((relationship, index) => ({
263
291
  id: `rId${index + 1}`,
264
292
  type: relationship.relationshipType,
265
- target: relationshipTarget(partPath, targetPartPath(relationship.target, context))
293
+ target: relationshipTarget(partPath, targetPartPath(relationship.target, context.document, context.slide.index))
266
294
  }));
267
295
  const content = partContent(part.content(relationships.map(({ id }) => id)), "Slide part");
268
296
  context.document.presentationPartPaths.add(partPath);
@@ -280,56 +308,57 @@ function addSlidePackagePart(part, context) {
280
308
  });
281
309
  return relationshipId;
282
310
  }
283
- function addSharedPackagePart(key, part, context) {
311
+ function addSharedPackagePart(key, part, document) {
284
312
  if (typeof key !== "string" || key.trim() === "") throw new CapabilityError("invalid-part", "Shared part key must be a non-empty string");
285
313
  const descriptor = packagePartDescriptor(part.part, part.presentationRelationshipType, part.relationships, part.content, "shared part");
286
314
  const presentationRelationshipType = descriptor.relationshipType;
287
315
  if (part.presentationElement !== void 0 && presentationRelationshipType === void 0) throw new CapabilityError("invalid-part", "Shared part presentation element requires a presentation relationship type");
288
- const existing = context.document.sharedParts.get(key);
316
+ const existing = document.sharedParts.get(key);
289
317
  if (existing !== void 0) {
290
318
  if (!(existing.descriptor.part.pathTemplate === descriptor.pathTemplate && existing.descriptor.part.contentType === descriptor.contentType && existing.descriptor.presentationRelationshipType === descriptor.relationshipType && JSON.stringify(existing.descriptor.relationships ?? []) === JSON.stringify(descriptor.relationships))) throw new CapabilityError("conflicting-shared-part", `Shared part ${JSON.stringify(key)} has conflicting declarations`);
291
319
  return {
292
320
  path: existing.path,
321
+ renderSlideFragment: existing.descriptor.renderSlideFragment,
293
322
  ...existing.relationshipId === void 0 ? {} : { relationshipId: existing.relationshipId }
294
323
  };
295
324
  }
296
- const partPath = allocateSharedPackagePartPath(descriptor.pathTemplate, context.document);
325
+ const partPath = allocateCapabilityPartPath(descriptor.pathTemplate, document);
297
326
  const relationships = descriptor.relationships.map((relationship, index) => ({
298
327
  id: `rId${index + 1}`,
299
328
  type: relationship.relationshipType,
300
- target: relationshipTarget(partPath, targetPartPath(relationship.target, context))
329
+ target: relationshipTarget(partPath, targetPartPath(relationship.target, document))
301
330
  }));
302
331
  const content = partContent(part.content(relationships.map(({ id }) => id)), "Shared part");
303
- context.document.presentationPartPaths.add(partPath);
304
- context.document.packageParts.set(partPath, {
332
+ document.presentationPartPaths.add(partPath);
333
+ document.packageParts.set(partPath, {
305
334
  path: partPath,
306
335
  content,
307
336
  contentType: descriptor.contentType
308
337
  });
309
- if (relationships.length > 0) context.document.packageRelationships.set(partPath, relationships);
338
+ if (relationships.length > 0) document.packageRelationships.set(partPath, relationships);
310
339
  let relationshipId;
311
340
  if (presentationRelationshipType !== void 0) {
312
- relationshipId = `rId${context.document.nextPresentationRelationshipId++}`;
313
- const presentationRelationships = context.document.packageRelationships.get("ppt/presentation.xml") ?? [];
341
+ relationshipId = `rId${document.nextPresentationRelationshipId++}`;
342
+ const presentationRelationships = document.packageRelationships.get("ppt/presentation.xml") ?? [];
314
343
  presentationRelationships.push({
315
344
  id: relationshipId,
316
345
  type: presentationRelationshipType,
317
346
  target: relationshipTarget("ppt/presentation.xml", partPath)
318
347
  });
319
- context.document.packageRelationships.set("ppt/presentation.xml", presentationRelationships);
348
+ document.packageRelationships.set("ppt/presentation.xml", presentationRelationships);
320
349
  const element = part.presentationElement;
321
350
  if (element !== void 0) {
322
- if (element.position !== "before-slides" && element.position !== "after-notes-size" || typeof element.content !== "function") throw new CapabilityError("invalid-part", "Shared part presentation element declaration is invalid");
351
+ if (element.position !== "before-slides" && element.position !== "after-notes-master" && element.position !== "after-notes-size" || typeof element.content !== "function") throw new CapabilityError("invalid-part", "Shared part presentation element declaration is invalid");
323
352
  const xml = element.content(relationshipId);
324
353
  if (typeof xml !== "string" || xml.trim() === "") throw new CapabilityError("invalid-part", "Shared part presentation element must generate content");
325
354
  assertXml10Characters(xml);
326
- context.document.presentationElements.push({
355
+ document.presentationElements.push({
327
356
  position: element.position,
328
357
  content: xml
329
358
  });
330
359
  }
331
360
  }
332
- context.document.sharedParts.set(key, {
361
+ document.sharedParts.set(key, {
333
362
  path: partPath,
334
363
  ...relationshipId === void 0 ? {} : { relationshipId },
335
364
  descriptor: {
@@ -340,11 +369,13 @@ function addSharedPackagePart(key, part, context) {
340
369
  ...presentationRelationshipType === void 0 ? {} : { presentationRelationshipType },
341
370
  ...part.relationships === void 0 ? {} : { relationships: descriptor.relationships },
342
371
  ...part.presentationElement === void 0 ? {} : { presentationElement: part.presentationElement },
343
- content: part.content
372
+ content: part.content,
373
+ renderSlideFragment: part.renderSlideFragment
344
374
  }
345
375
  });
346
376
  return {
347
377
  path: partPath,
378
+ renderSlideFragment: part.renderSlideFragment,
348
379
  ...relationshipId === void 0 ? {} : { relationshipId }
349
380
  };
350
381
  }
@@ -353,7 +384,7 @@ function xmlName(value) {
353
384
  }
354
385
  function addPresentationContribution(contribution, context, path, objectId) {
355
386
  const { collection, record, item } = contribution;
356
- if (!xmlName(collection) || typeof record.key !== "string" || record.key === "" || typeof record.identity !== "string" || typeof record.tagName !== "string" || !xmlName(record.tagName) || typeof record.content !== "string" || typeof item.key !== "string" || item.key === "" || typeof item.identity !== "string" || !Number.isInteger(item.order) || item.order < 0 || typeof item.relationshipType !== "string" || item.relationshipType.trim() === "" || typeof item.pathTemplate !== "string" || typeof item.contentType !== "string" || item.contentType.trim() === "" || item.bytes !== void 0 && (!(item.bytes instanceof Uint8Array) || item.bytes.byteLength === 0) || item.bytes === void 0 && item.resolveBytes === void 0 || item.resourceClaim === void 0 !== (item.resolveBytes === void 0) || item.resourceClaim !== void 0 && (typeof item.resourceClaim.kind !== "string" || item.resourceClaim.kind === "" || typeof item.resourceClaim.key !== "string" || item.resourceClaim.key === "") || item.resolveBytes !== void 0 && typeof item.resolveBytes !== "function" || typeof item.content !== "function") throw new CapabilityError("invalid-presentation-contribution", "Presentation-level contribution record, relationship, or resource is invalid");
387
+ if (!xmlName(collection) || typeof record.key !== "string" || record.key === "" || typeof record.identity !== "string" || typeof record.tagName !== "string" || !xmlName(record.tagName) || typeof record.content !== "string" || typeof item.key !== "string" || item.key === "" || typeof item.identity !== "string" || !Number.isInteger(item.order) || item.order < 0 || typeof item.relationshipType !== "string" || item.relationshipType.trim() === "" || typeof item.pathTemplate !== "string" || typeof item.contentType !== "string" || item.contentType.trim() === "" || item.bytes !== void 0 && (!(item.bytes instanceof Uint8Array) || item.bytes.byteLength === 0) || item.bytes === void 0 && item.resolveBytes === void 0 || item.resourceClaim === void 0 !== (item.resolveBytes === void 0) || item.resourceClaim !== void 0 && (typeof item.resourceClaim.kind !== "string" || item.resourceClaim.kind === "" || typeof item.resourceClaim.key !== "string" || item.resourceClaim.key === "") || item.resolveBytes !== void 0 && typeof item.resolveBytes !== "function" || typeof item.content !== "function" || item.onConflict !== void 0 && (typeof item.onConflict !== "object" || item.onConflict === null || typeof item.onConflict.code !== "string" || item.onConflict.code.trim() === "" || typeof item.onConflict.message !== "string" || item.onConflict.message.trim() === "" || item.onConflict.details !== void 0 && (typeof item.onConflict.details !== "object" || item.onConflict.details === null))) throw new CapabilityError("invalid-presentation-contribution", "Presentation-level contribution record, relationship, or resource is invalid");
357
388
  try {
358
389
  assertXml10Characters(collection);
359
390
  assertXml10Characters(record.content);
@@ -388,7 +419,7 @@ function addPresentationContribution(contribution, context, path, objectId) {
388
419
  items: /* @__PURE__ */ new Map()
389
420
  };
390
421
  targetCollection.records.set(record.key, targetRecord);
391
- } else if (targetRecord.identity !== record.identity || targetRecord.tagName !== record.tagName || targetRecord.content !== record.content) {
422
+ } else if (targetRecord.identity !== record.identity || targetRecord.tagName !== record.tagName) {
392
423
  context.slide.diagnostics.push(diagnostic(path, "conflicting-presentation-record", `Conflicting declaration for presentation-level record ${record.key}`));
393
424
  return;
394
425
  }
@@ -402,7 +433,7 @@ function addPresentationContribution(contribution, context, path, objectId) {
402
433
  if (preview.trim() === "") throw new CapabilityError("invalid-presentation-contribution", "Presentation-level contribution must generate content");
403
434
  const existingItem = targetRecord.items.get(item.key);
404
435
  if (existingItem !== void 0) {
405
- if (existingItem.identity !== item.identity || existingItem.order !== item.order || existingItem.preview !== preview || existingItem.resourceClaim?.kind !== item.resourceClaim?.kind || existingItem.resourceClaim?.key !== item.resourceClaim?.key) context.slide.diagnostics.push(diagnostic(path, "conflicting-presentation-item", `Presentation-level record ${record.key} item ${item.key} uses conflicting resources`));
436
+ if (existingItem.identity !== item.identity || existingItem.order !== item.order || existingItem.preview !== preview || existingItem.resourceClaim?.kind !== item.resourceClaim?.kind || existingItem.resourceClaim?.key !== item.resourceClaim?.key) context.slide.diagnostics.push(item.onConflict === void 0 ? diagnostic(path, "conflicting-presentation-item", `Presentation-level record ${record.key} item ${item.key} uses conflicting resources`) : diagnostic(path, item.onConflict.code, item.onConflict.message, item.onConflict.details));
406
437
  else {
407
438
  const objectIds = existingItem.resourceOwners.get(context.slide) ?? /* @__PURE__ */ new Set();
408
439
  if (objectId !== void 0) objectIds.add(objectId);
@@ -435,7 +466,7 @@ function addPresentationContribution(contribution, context, path, objectId) {
435
466
  ...item.resolveBytes === void 0 ? {} : { resolveBytes: item.resolveBytes }
436
467
  });
437
468
  }
438
- function finalizePresentationContributions(document) {
469
+ async function finalizePresentationContributions(document, options) {
439
470
  for (const collection of document.presentationCollections.values()) for (const record of collection.records.values()) for (const item of record.items.values()) {
440
471
  let bytes = item.bytes;
441
472
  if (item.resourceClaim !== void 0) {
@@ -443,9 +474,12 @@ function finalizePresentationContributions(document) {
443
474
  const claim = document.resourceClaims.get(claimKey);
444
475
  if (claim === void 0 || claim.identity !== item.identity) throw new BuildError([diagnostic(item.path, "missing-resource-claim", `Presentation resource ${item.resourceClaim.key} is missing matching character claims`)]);
445
476
  try {
446
- bytes = item.resolveBytes(claim.characters);
477
+ const prepared = item.resolveBytes(claim.characters, { signal: options.signal });
478
+ bytes = prepared instanceof Uint8Array ? prepared : await prepared;
479
+ if (options.signal?.aborted) throw options.signal.reason;
447
480
  } catch (error) {
448
- if (error instanceof CapabilityError) throw new BuildError([diagnostic(error.path ?? item.path, error.code, error.message)]);
481
+ if (options.signal?.aborted) throw options.signal.reason;
482
+ if (error instanceof CapabilityError) throw new BuildError([capabilityErrorToDiagnostic(error, item.path)]);
449
483
  throw new BuildError([diagnostic(item.path, "resource-contribution-failed", error instanceof Error ? error.message : String(error))]);
450
484
  }
451
485
  }
@@ -473,7 +507,7 @@ function presentationContent(document) {
473
507
  const rendered = [...document.presentationCollections.values()].map(({ tagName, records }) => `<${tagName}>${[...records.values()].map((record) => `<${record.tagName}>${record.content}${[...record.items.values()].sort((left, right) => left.order - right.order).map(({ content }) => content).join("")}</${record.tagName}>`).join("")}</${tagName}>`).join("");
474
508
  const elements = (position) => document.presentationElements.filter((element) => element.position === position).map(({ content }) => content).join("");
475
509
  return {
476
- beforeSlides: elements("before-slides"),
510
+ beforeSlides: elements("before-slides") + elements("after-notes-master"),
477
511
  afterNotesSize: rendered + elements("after-notes-size")
478
512
  };
479
513
  }
@@ -525,7 +559,6 @@ function createDocumentEmitState(internal) {
525
559
  const themePartCount = countAllocatedMasterThemeParts(internal.masters, internal.theme.theme);
526
560
  return {
527
561
  usedExtensions: /* @__PURE__ */ new Set(),
528
- warnings: [...internal.warnings],
529
562
  resourceClaims: internal.resourceClaims,
530
563
  resources: /* @__PURE__ */ new Map(),
531
564
  resourceTypes: /* @__PURE__ */ new Map(),
@@ -536,13 +569,17 @@ function createDocumentEmitState(internal) {
536
569
  presentationCollections: /* @__PURE__ */ new Map(),
537
570
  sharedParts: /* @__PURE__ */ new Map(),
538
571
  presentationElements: [],
572
+ nextCapabilityPartIdByTemplate: /* @__PURE__ */ new Map(),
539
573
  nextPackagePartId: 1,
540
574
  nextPresentationRelationshipId: (internal.masters?.length ?? 1) + internal.slides.length + 1,
541
575
  nextTextFieldId: 1
542
576
  };
543
577
  }
544
578
  function checkExtensions(extensions, target, usedExtensions, diagnostics, path) {
545
- for (const extension of extensions) if (!target.extensions.includes(extension)) diagnostics.push(diagnostic(path, "forbidden-mechanism", `Target forbids ${extension}`));
579
+ for (const extension of extensions) if (!target.extensions.includes(extension)) diagnostics.push(diagnostic(path, "forbidden-mechanism", `Target forbids ${extension}`, {
580
+ target: target.name,
581
+ extension
582
+ }));
546
583
  else usedExtensions.add(extension);
547
584
  }
548
585
  function emitLayer(layer, slideIndexById, docEmit, slideEmit, target, options) {
@@ -570,13 +607,17 @@ function emitLayer(layer, slideIndexById, docEmit, slideEmit, target, options) {
570
607
  };
571
608
  const output = layer.emit(emitContext);
572
609
  ownXml = output.xml;
610
+ if (output.timing !== void 0) slideEmit.objectTiming.push({
611
+ path: layer.path,
612
+ timing: output.timing
613
+ });
573
614
  if (layer.morphKey !== void 0 && layer.emitsObject && ownXml === "") slideEmit.diagnostics.push(diagnostic(layer.path, "morph-needs-object", "morphKey can only be used with capabilities that produce native objects"));
574
615
  for (const contribution of output.presentationContributions ?? []) addPresentationContribution(contribution, {
575
616
  document: docEmit,
576
617
  slide: slideEmit
577
618
  }, layer.path, layer.objectId);
578
619
  } catch (error) {
579
- slideEmit.diagnostics.push(error instanceof CapabilityError ? diagnostic(error.path === void 0 ? layer.path : `${layer.path}/${error.path}`, error.code, error.message) : diagnostic(layer.path, "capability-failure", error instanceof Error ? error.message : String(error)));
620
+ slideEmit.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, layer.path, true) : diagnostic(layer.path, "capability-failure", error instanceof Error ? error.message : String(error)));
580
621
  }
581
622
  return layer.childComposition === "members" ? ownXml : ownXml + siblingXml;
582
623
  }
@@ -593,11 +634,17 @@ function maxResolvedObjectId(layers) {
593
634
  return maxId;
594
635
  }
595
636
  /**
596
- * Returns the BuildQuery enriched with emitted package resources for a BuildReport produced by `emit()`.
637
+ * Returns the slide locator index enriched with emitted package resources for a BuildReport produced by `emit()`.
597
638
  */
598
639
  function emittedBuildQuery(report, fallbackQuery) {
599
640
  return emittedQueries.get(report) ?? fallbackQuery;
600
641
  }
642
+ function emitPartTiming(contributions, diagnostics) {
643
+ return writeTiming(contributions.map((entry) => entry.timing), (index, error) => {
644
+ const { path } = contributions[index];
645
+ diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, path) : diagnostic(path, "capability-failure", error instanceof Error ? error.message : String(error)));
646
+ });
647
+ }
601
648
  function emitMasterOrLayoutCapabilities(capabilities, internal, docEmit, partEmit, target, options) {
602
649
  if (capabilities === void 0 || capabilities.length === 0) return {
603
650
  transitionXml: "",
@@ -609,6 +656,7 @@ function emitMasterOrLayoutCapabilities(capabilities, internal, docEmit, partEmi
609
656
  };
610
657
  const transitionParts = [];
611
658
  const timingParts = [];
659
+ const timing = [];
612
660
  for (const cap of capabilities) {
613
661
  checkExtensions(cap.extensions, target, docEmit.usedExtensions, partEmit.diagnostics, cap.path);
614
662
  try {
@@ -621,17 +669,21 @@ function emitMasterOrLayoutCapabilities(capabilities, internal, docEmit, partEmi
621
669
  createTextFieldId: () => allocateTextFieldId(docEmit),
622
670
  registerResource: (resource) => addResource(resource, packageCtx),
623
671
  registerPackagePart: (part) => addSlidePackagePart(part, packageCtx),
624
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, packageCtx)
672
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
673
+ });
674
+ if (output.timing !== void 0) timing.push({
675
+ path: cap.path,
676
+ timing: output.timing
625
677
  });
626
678
  if (cap.slot === "transition" && output.xml !== "") transitionParts.push(output.xml);
627
679
  else if (cap.slot === "timing" && output.xml !== "") timingParts.push(output.xml);
628
680
  } catch (error) {
629
- partEmit.diagnostics.push(error instanceof CapabilityError ? diagnostic(error.path ?? cap.path, error.code, error.message) : diagnostic(cap.path, "capability-failure", error instanceof Error ? error.message : String(error)));
681
+ partEmit.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, cap.path) : diagnostic(cap.path, "capability-failure", error instanceof Error ? error.message : String(error)));
630
682
  }
631
683
  }
632
684
  return {
633
685
  transitionXml: transitionParts.join(""),
634
- timingXml: timingParts.join("")
686
+ timingXml: timingParts.join("") + emitPartTiming(timing, partEmit.diagnostics)
635
687
  };
636
688
  }
637
689
  function emitOwnerPlaceholderVisuals(placeholderVisuals, internal, docEmit, ownerEmit, ownerCtx, target, options) {
@@ -646,20 +698,34 @@ function emitOwnerPlaceholderVisuals(placeholderVisuals, internal, docEmit, owne
646
698
  createTextFieldId: () => allocateTextFieldId(docEmit),
647
699
  registerResource: (resource) => addResource(resource, ownerCtx),
648
700
  registerPackagePart: (part) => addSlidePackagePart(part, ownerCtx),
649
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, ownerCtx)
701
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
650
702
  }).placeholderSpPrByKey;
651
703
  }
652
704
  /**
653
705
  * Emits a PPTX archive and BuildReport from an existing Resolution without re-resolving the document.
654
706
  */
655
- function emit(resolution, options = {}) {
656
- const target = validateOptions(options);
707
+ async function emit(resolution, options = {}) {
708
+ const target = validateTargetOptions(options, emitOptionsSchema);
657
709
  if (options.signal?.aborted) throw options.signal.reason;
658
710
  const internal = getInternalResolution(resolution);
659
711
  const docEmit = createDocumentEmitState(internal);
712
+ for (const emitDeck of internal.deckEmitters ?? []) try {
713
+ emitDeck({
714
+ createTextFieldId: () => allocateTextFieldId(docEmit),
715
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
716
+ });
717
+ } catch (error) {
718
+ if (!(error instanceof CapabilityError)) throw error;
719
+ throw new BuildError([capabilityErrorToDiagnostic(error, "deck")]);
720
+ }
660
721
  let sectionXml = "";
661
722
  if (internal.sectionsEmitter !== void 0) {
662
- if (!internal.sectionsEmitter.extensions.every((ext) => target.extensions.includes(ext))) throw new BuildError([diagnostic("deck/sections", "forbidden-mechanism", "Current target forbids p14 section mechanism")]);
723
+ const forbiddenExtensions = internal.sectionsEmitter.extensions.filter((ext) => !target.extensions.includes(ext));
724
+ if (forbiddenExtensions.length > 0) throw new BuildError([diagnostic("deck/sections", "forbidden-mechanism", "Current target forbids p14 section mechanism", {
725
+ target: target.name,
726
+ extension: forbiddenExtensions[0],
727
+ mechanism: "sections"
728
+ })]);
663
729
  for (const ext of internal.sectionsEmitter.extensions) docEmit.usedExtensions.add(ext);
664
730
  sectionXml = internal.sectionsEmitter.emit().xml;
665
731
  }
@@ -674,7 +740,8 @@ function emit(resolution, options = {}) {
674
740
  diagnostics: [],
675
741
  relationships: [],
676
742
  relationshipIds: /* @__PURE__ */ new Map(),
677
- resourceObservations: []
743
+ resourceObservations: [],
744
+ objectTiming: []
678
745
  };
679
746
  const masterCtx = {
680
747
  document: docEmit,
@@ -693,7 +760,7 @@ function emit(resolution, options = {}) {
693
760
  createTextFieldId: () => allocateTextFieldId(docEmit),
694
761
  registerResource: (resource) => addResource(resource, masterCtx),
695
762
  registerPackagePart: (part) => addSlidePackagePart(part, masterCtx),
696
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, masterCtx)
763
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
697
764
  }).xml;
698
765
  }
699
766
  let nextMasterObjectId = Math.max(maxResolvedObjectId(master.layers ?? []), 1 + Object.keys(master.placeholders ?? {}).length) + 1;
@@ -710,7 +777,7 @@ function emit(resolution, options = {}) {
710
777
  allocateObjectId: () => nextMasterObjectId++,
711
778
  registerResource: (resource) => addResource(resource, masterCtx),
712
779
  registerPackagePart: (part) => addSlidePackagePart(part, masterCtx),
713
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, masterCtx)
780
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
714
781
  });
715
782
  masterShapeFragments.push(fpOut.xml);
716
783
  for (const contribution of fpOut.presentationContributions ?? []) addPresentationContribution(contribution, {
@@ -729,7 +796,8 @@ function emit(resolution, options = {}) {
729
796
  diagnostics: [],
730
797
  relationships: [],
731
798
  relationshipIds: /* @__PURE__ */ new Map(),
732
- resourceObservations: []
799
+ resourceObservations: [],
800
+ objectTiming: []
733
801
  };
734
802
  const layoutCtx = {
735
803
  document: docEmit,
@@ -748,7 +816,7 @@ function emit(resolution, options = {}) {
748
816
  createTextFieldId: () => allocateTextFieldId(docEmit),
749
817
  registerResource: (resource) => addResource(resource, layoutCtx),
750
818
  registerPackagePart: (part) => addSlidePackagePart(part, layoutCtx),
751
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, layoutCtx)
819
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
752
820
  }).xml;
753
821
  }
754
822
  let nextLayoutObjectId = Math.max(maxResolvedObjectId(layout.layers ?? []), 1 + Object.keys(layout.placeholders ?? {}).length) + 1;
@@ -765,7 +833,7 @@ function emit(resolution, options = {}) {
765
833
  allocateObjectId: () => nextLayoutObjectId++,
766
834
  registerResource: (resource) => addResource(resource, layoutCtx),
767
835
  registerPackagePart: (part) => addSlidePackagePart(part, layoutCtx),
768
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, layoutCtx)
836
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
769
837
  });
770
838
  layoutShapeFragments.push(fpOut.xml);
771
839
  for (const contribution of fpOut.presentationContributions ?? []) addPresentationContribution(contribution, {
@@ -824,7 +892,8 @@ function emit(resolution, options = {}) {
824
892
  diagnostics: [],
825
893
  relationships: [],
826
894
  relationshipIds: /* @__PURE__ */ new Map(),
827
- resourceObservations: []
895
+ resourceObservations: [],
896
+ objectTiming: []
828
897
  };
829
898
  const packageCtx = {
830
899
  document: docEmit,
@@ -832,6 +901,7 @@ function emit(resolution, options = {}) {
832
901
  };
833
902
  let nextSlideObjectId = maxResolvedObjectId(resolvedSlide.layers) + 1;
834
903
  let shapeXml = resolvedSlide.layers.map((layer) => emitLayer(layer, slideIndexById, docEmit, slideEmit, target, options)).join("");
904
+ const slideTiming = [];
835
905
  let backgroundXml = "";
836
906
  const slideXmlParts = [];
837
907
  for (const slideCap of resolvedSlide.slideCapabilities) {
@@ -843,13 +913,18 @@ function emit(resolution, options = {}) {
843
913
  theme: slideCap.theme,
844
914
  options,
845
915
  slideNumber: resolvedSlide.index,
916
+ slides: resolution.report.slides,
846
917
  createTextFieldId: () => allocateTextFieldId(docEmit),
847
918
  allocateObjectId: () => nextSlideObjectId++,
848
919
  registerResource: (resource) => addResource(resource, packageCtx),
849
920
  registerPackagePart: (part) => addSlidePackagePart(part, packageCtx),
850
- registerSharedPart: (key, part) => addSharedPackagePart(key, part, packageCtx)
921
+ registerSharedPart: (key, part) => addSharedPackagePart(key, part, docEmit)
851
922
  };
852
923
  const output = slideCap.emit(slideEmitContext);
924
+ if (output.timing !== void 0) slideTiming.push({
925
+ path: slideCap.path,
926
+ timing: output.timing
927
+ });
853
928
  if (slideCap.slot === "background") backgroundXml += output.xml;
854
929
  else if (slideCap.slot === "shape-tree") shapeXml += output.xml;
855
930
  else slideXmlParts.push({
@@ -861,9 +936,14 @@ function emit(resolution, options = {}) {
861
936
  slide: slideEmit
862
937
  }, slideCap.path);
863
938
  } catch (error) {
864
- slideEmit.diagnostics.push(error instanceof CapabilityError ? diagnostic(error.path ?? slideCap.path, error.code, error.message) : diagnostic(slideCap.path, "capability-failure", error instanceof Error ? error.message : String(error)));
939
+ slideEmit.diagnostics.push(error instanceof CapabilityError ? capabilityErrorToDiagnostic(error, slideCap.path) : diagnostic(slideCap.path, "capability-failure", error instanceof Error ? error.message : String(error)));
865
940
  }
866
941
  }
942
+ const timingXml = emitPartTiming([...slideTiming, ...slideEmit.objectTiming], slideEmit.diagnostics);
943
+ if (timingXml !== "") slideXmlParts.push({
944
+ slot: "timing",
945
+ xml: timingXml
946
+ });
867
947
  if (slideEmit.diagnostics.length > 0) throw new BuildError(slideEmit.diagnostics);
868
948
  return {
869
949
  id: resolvedSlide.id,
@@ -884,8 +964,9 @@ function emit(resolution, options = {}) {
884
964
  resourceObservations: slideEmit.resourceObservations
885
965
  };
886
966
  });
887
- finalizePresentationContributions(docEmit);
888
- const parts = pptxParts(internal.dimensions, emittedSlides.map(({ id, name, layoutKey, colorMapOverride, themeOverride, hidden, showMasterPlaceholderAnimations, showMasterShapes, shapeXml, backgroundXml, slideXml, relationships }) => ({
967
+ await finalizePresentationContributions(docEmit, options);
968
+ options.signal?.throwIfAborted();
969
+ const parts = pptxParts((template) => allocateCapabilityPartPath(template, docEmit), internal.dimensions, emittedSlides.map(({ id, name, layoutKey, colorMapOverride, themeOverride, hidden, showMasterPlaceholderAnimations, showMasterShapes, shapeXml, backgroundXml, slideXml, relationships }) => ({
889
970
  id,
890
971
  ...name === void 0 ? {} : { name },
891
972
  ...layoutKey === void 0 ? {} : { layoutKey },
@@ -912,18 +993,20 @@ function emit(resolution, options = {}) {
912
993
  const report = Object.freeze({
913
994
  evidence: "generation",
914
995
  ...typeof internal.title === "string" ? { title: internal.title } : {},
996
+ dimensions: resolution.report.dimensions,
915
997
  target: Object.freeze({
916
998
  name: target.name,
917
999
  format: target.format,
918
1000
  extensions: Object.freeze([...target.extensions])
919
1001
  }),
920
1002
  extensions: Object.freeze([...docEmit.usedExtensions]),
1003
+ fonts: resolution.report.fonts,
921
1004
  ...resolution.report.masters === void 0 ? {} : { masters: resolution.report.masters },
922
- slides: resolution.report.slides,
923
- diagnostics: Object.freeze(docEmit.warnings.map((warning) => Object.freeze({ ...warning })))
1005
+ slides: resolution.report.slides
924
1006
  });
925
1007
  const query = createBuildQuery(internal.slides.map((slide, index) => ({
926
1008
  observation: report.slides[index],
1009
+ dimensions: report.dimensions,
927
1010
  content: slide.content,
928
1011
  resources: emittedSlides[index].resourceObservations
929
1012
  })));
@@ -0,0 +1,6 @@
1
+ import "../kernel/drawing-units.js";
2
+ import "../kernel/stage-options.js";
3
+ export { emit, emittedBuildQuery, validateOptions } from "./emit.js";
4
+ import "./ooxml.js";
5
+ import "../kernel/pptx-write/xml.js";
6
+ import "../kernel/build.js";