@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,216 +0,0 @@
1
- import { colorValueSchema } from "../../../core/dist/theme.js";
2
- import "../../../core/dist/capability.js";
3
- import { z } from "zod";
4
- // ../capabilities/dist/motion/motion-schemas.js
5
- /** ST_TLTime uses unsignedInt; repeatCount unit is one thousandth of a round. */
6
- const maximumTimeNodeValue = 4294967295;
7
- const maxRepeatCount = Math.floor(maximumTimeNodeValue / 1e3);
8
- const minimumRotationUnits = -2147483648;
9
- const maximumRotationUnits = 2147483647;
10
- const motionDirectionSchema = z.enum([
11
- "left",
12
- "right",
13
- "top",
14
- "bottom"
15
- ]);
16
- const entrancePresetSchema = z.enum([
17
- "fade",
18
- "wipe",
19
- "zoom",
20
- "fly",
21
- "floatUp",
22
- "floatDown",
23
- "spinIn",
24
- "stretch"
25
- ]);
26
- const emphasisPresetSchema = z.enum([
27
- "spin",
28
- "breathe",
29
- "fillColor"
30
- ]);
31
- const effectPresetSchema = z.enum([
32
- "fade",
33
- "wipe",
34
- "zoom",
35
- "fly",
36
- "floatUp",
37
- "floatDown",
38
- "spinIn",
39
- "stretch",
40
- "spin",
41
- "breathe",
42
- "fillColor"
43
- ]);
44
- const repeatCountSchema = z.union([z.number().int().min(1).max(maxRepeatCount), z.literal("forever")]);
45
- const motionGranularitySchema = z.enum([
46
- "paragraph",
47
- "word",
48
- "letter",
49
- "series",
50
- "category",
51
- "seriesElements",
52
- "categoryElements"
53
- ]);
54
- const motionChartStepSchema = z.enum([
55
- "gridLegend",
56
- "series",
57
- "category",
58
- "ptInSeries",
59
- "ptInCategory"
60
- ]);
61
- const motionTargetRangeSchema = z.discriminatedUnion("type", [z.strictObject({
62
- type: z.literal("paragraph"),
63
- start: z.number().int().nonnegative(),
64
- end: z.number().int().nonnegative()
65
- }).readonly(), z.strictObject({
66
- type: z.literal("chart"),
67
- step: motionChartStepSchema,
68
- seriesIndex: z.number().int(),
69
- categoryIndex: z.number().int()
70
- }).readonly()]);
71
- const easingSchema = z.strictObject({
72
- accelerate: z.number().finite().min(0).max(1).optional(),
73
- decelerate: z.number().finite().min(0).max(1).optional()
74
- }).readonly().refine((value) => (value.accelerate ?? 0) + (value.decelerate ?? 0) <= 1, "easing accelerate and decelerate proportions must be non-negative and sum to at most 1");
75
- /** Hex RGB color (`#RRGGBB`) validated against core's color value domain and normalized to uppercase. */
76
- const motionHexColorSchema = colorValueSchema.pipe(z.string().regex(/^#[0-9a-f]{6}$/iu, "color must be a #RRGGBB color")).transform((value) => value.toUpperCase());
77
- const effectDurationSchema = z.number().finite().positive().refine((value) => Math.round(value) >= 1 && Number.isSafeInteger(Math.round(value)), "Animation duration must be writable as a finite positive integer in milliseconds");
78
- const effectDelaySchema = z.number().finite().min(0).refine((value) => Number.isSafeInteger(Math.round(value)), "Animation delay must be writable as a finite non-negative integer in milliseconds");
79
- const intervalMsSchema = z.number().int().min(1);
80
- const spinAngleSchema = z.number().finite().refine((value) => {
81
- const units = Math.round(value * 6e4);
82
- return Number.isSafeInteger(units) && units >= -2147483648 && units <= 2147483647;
83
- }, "spin angle converted value must fall within signed 32-bit angle range");
84
- const effectOptionsSchema = z.strictObject({
85
- duration: effectDurationSchema.optional(),
86
- delay: effectDelaySchema.optional(),
87
- easing: easingSchema.optional(),
88
- intervalMs: intervalMsSchema.optional(),
89
- by: motionGranularitySchema.optional()
90
- }).readonly();
91
- const spinOptionsSchema = z.strictObject({
92
- duration: effectDurationSchema.optional(),
93
- delay: effectDelaySchema.optional(),
94
- easing: easingSchema.optional(),
95
- intervalMs: intervalMsSchema.optional(),
96
- by: z.union([motionGranularitySchema, spinAngleSchema]).optional(),
97
- from: spinAngleSchema.optional()
98
- }).readonly();
99
- const fillColorOptionsSchema = z.strictObject({
100
- duration: effectDurationSchema.optional(),
101
- delay: effectDelaySchema.optional(),
102
- easing: easingSchema.optional(),
103
- from: motionHexColorSchema,
104
- to: motionHexColorSchema
105
- }).readonly();
106
- const breatheOptionsSchema = z.strictObject({
107
- period: z.number().int().min(2).refine((value) => value % 2 === 0 && value / 2 <= 4294967295, "breathe period must be an even integer in milliseconds greater than 1"),
108
- from: motionHexColorSchema,
109
- to: motionHexColorSchema,
110
- delay: effectDelaySchema.refine((value) => Math.round(value) <= maximumTimeNodeValue, "breathe delay exceeds native timing value range").optional(),
111
- easing: easingSchema.optional()
112
- }).readonly();
113
- const effectCommonFields = {
114
- type: z.literal("effect"),
115
- duration: effectDurationSchema,
116
- delay: effectDelaySchema,
117
- from: z.union([motionDirectionSchema, spinAngleSchema]).optional(),
118
- fromColor: motionHexColorSchema.optional(),
119
- toColor: motionHexColorSchema.optional(),
120
- easing: easingSchema.optional(),
121
- by: z.union([motionGranularitySchema, spinAngleSchema]).optional(),
122
- intervalMs: intervalMsSchema.optional()
123
- };
124
- const entranceEffectObjectSchema = z.strictObject({
125
- ...effectCommonFields,
126
- kind: z.literal("entrance"),
127
- preset: entrancePresetSchema
128
- });
129
- const entranceEffectSchema = entranceEffectObjectSchema.readonly();
130
- const emphasisEffectObjectSchema = z.strictObject({
131
- ...effectCommonFields,
132
- kind: z.literal("emphasis"),
133
- preset: emphasisPresetSchema
134
- });
135
- const emphasisEffectSchema = emphasisEffectObjectSchema.readonly();
136
- z.strictObject({
137
- ...effectCommonFields,
138
- kind: z.literal("emphasis"),
139
- preset: z.literal("breathe"),
140
- fromColor: motionHexColorSchema,
141
- toColor: motionHexColorSchema
142
- }).readonly();
143
- const effectSchema = z.discriminatedUnion("kind", [entranceEffectSchema, emphasisEffectSchema]);
144
- z.strictObject({
145
- type: z.literal("repeated-effect"),
146
- effect: effectSchema,
147
- count: repeatCountSchema
148
- }).readonly();
149
- const entranceEffectDeclarationSchema = z.union([entranceEffectSchema, z.strictObject({
150
- type: z.literal("repeated-effect"),
151
- effect: entranceEffectSchema,
152
- count: repeatCountSchema
153
- }).readonly()]);
154
- const emphasisEffectDeclarationSchema = z.union([emphasisEffectSchema, z.strictObject({
155
- type: z.literal("repeated-effect"),
156
- effect: emphasisEffectSchema,
157
- count: repeatCountSchema
158
- }).readonly()]);
159
- z.discriminatedUnion("kind", [entranceEffectObjectSchema.extend({ repeatCount: repeatCountSchema.optional() }).readonly(), emphasisEffectObjectSchema.extend({ repeatCount: repeatCountSchema.optional() }).readonly()]);
160
- const motionScopeModeSchema = z.enum([
161
- "parallel",
162
- "sequence",
163
- "stagger"
164
- ]);
165
- z.enum([
166
- "known",
167
- "unknown",
168
- "no-natural-completion"
169
- ]);
170
- const motionMomentSchema = z.strictObject({
171
- type: z.literal("motion-moment"),
172
- scope: z.string().min(1),
173
- point: z.enum([
174
- "start",
175
- "end",
176
- "named"
177
- ]),
178
- name: z.string().min(1).optional()
179
- }).readonly().refine((value) => value.point === "named" ? value.name !== void 0 && value.name.trim() !== "" : value.name === void 0, "Moment handle scope, type, or name is invalid");
180
- const motionMomentOffsetSchema = z.strictObject({
181
- type: z.literal("motion-offset"),
182
- moment: motionMomentSchema,
183
- offsetMs: z.number().int().min(0)
184
- }).readonly();
185
- const motionTimingSchema = z.union([motionMomentSchema, motionMomentOffsetSchema]);
186
- /** Runtime-identity-preserving schema for handles created by `createMotionScopeHandle()` / `useMotionScope()`. */
187
- const motionScopeHandleSchema = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value) && value.type === "motion-scope-handle" && typeof value.identity === "string" && value.identity !== "" && motionMomentSchema.safeParse(value.start).success && motionMomentSchema.safeParse(value.end).success && typeof value.cue === "function", "MotionScope requires a handle created by createMotionScopeHandle() or useMotionScope()");
188
- const motionPropsSchema = z.strictObject({
189
- enter: z.union([entranceEffectDeclarationSchema, z.array(entranceEffectDeclarationSchema).readonly()]).optional(),
190
- emphasis: emphasisEffectDeclarationSchema.optional(),
191
- motion: z.boolean().optional()
192
- }).readonly();
193
- const motionScopeAuthorPropsSchema = z.strictObject({
194
- scope: motionScopeHandleSchema,
195
- mode: motionScopeModeSchema.optional(),
196
- each: z.number().int().min(0).optional(),
197
- delay: effectDelaySchema.optional(),
198
- startAt: motionTimingSchema.optional(),
199
- publishStart: motionMomentSchema.optional(),
200
- publishEnd: motionMomentSchema.optional(),
201
- motion: z.boolean().optional()
202
- }).readonly();
203
- const motionStepAuthorPropsSchema = z.strictObject({ n: z.number().int().min(1).optional() }).readonly();
204
- /** Structured target and step timing declaration retained directly on `SlideMaster` and `SlideLayout` owners. */
205
- const ownerMotionTargetSchema = z.union([z.strictObject({ placeholder: z.string().min(1) }).readonly(), z.strictObject({ spid: z.number().int().positive() }).readonly()]);
206
- const ownerMotionEffectSchema = z.strictObject({
207
- target: ownerMotionTargetSchema,
208
- effect: z.union([entranceEffectDeclarationSchema, emphasisEffectDeclarationSchema]),
209
- range: motionTargetRangeSchema.optional()
210
- }).readonly();
211
- const ownerMotionStepSchema = z.strictObject({
212
- trigger: z.enum(["auto", "click"]),
213
- effects: z.array(ownerMotionEffectSchema).readonly()
214
- }).readonly();
215
- const ownerMotionSchema = z.strictObject({ steps: z.array(ownerMotionStepSchema).readonly() }).readonly();
216
- export { breatheOptionsSchema, easingSchema, effectDelaySchema, effectDurationSchema, effectOptionsSchema, effectPresetSchema, effectSchema, emphasisEffectDeclarationSchema, emphasisEffectSchema, emphasisPresetSchema, entranceEffectDeclarationSchema, entranceEffectSchema, entrancePresetSchema, fillColorOptionsSchema, intervalMsSchema, maxRepeatCount, maximumRotationUnits, maximumTimeNodeValue, minimumRotationUnits, motionChartStepSchema, motionDirectionSchema, motionGranularitySchema, motionHexColorSchema, motionMomentOffsetSchema, motionMomentSchema, motionPropsSchema, motionScopeAuthorPropsSchema, motionScopeHandleSchema, motionScopeModeSchema, motionStepAuthorPropsSchema, motionTargetRangeSchema, motionTimingSchema, ownerMotionEffectSchema, ownerMotionSchema, ownerMotionStepSchema, ownerMotionTargetSchema, repeatCountSchema, spinAngleSchema, spinOptionsSchema };
@@ -1,12 +0,0 @@
1
- import { hostNodeCreator } from "../../../core/dist/host.js";
2
- import { createNotesNode } from "./notes-declaration.js";
3
- import { createElement } from "react";
4
- // ../capabilities/dist/notes/notes-elements.js
5
- /** Declares one page's rich-text speaker notes; repeated declarations on a page are a build error. */
6
- function Notes(props) {
7
- return createElement("notes", {
8
- ...props,
9
- [hostNodeCreator]: createNotesNode
10
- }, props.children);
11
- }
12
- export { Notes };
@@ -1,38 +0,0 @@
1
- import { xmlDocument } from "../../../emit/dist/ooxml.js";
2
- import "../../../emit/dist/index.js";
3
- // ../capabilities/dist/notes/notes-xml.js
4
- const drawingNamespace = "http://schemas.openxmlformats.org/drawingml/2006/main";
5
- const presentationNamespace = "http://schemas.openxmlformats.org/presentationml/2006/main";
6
- const relationshipNamespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
7
- const notesMasterContentType = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
8
- const notesSlideContentType = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
9
- const themeContentType = "application/vnd.openxmlformats-officedocument.theme+xml";
10
- const notesMasterRelationshipType = `${relationshipNamespace}/notesMaster`;
11
- const notesSlideRelationshipType = `${relationshipNamespace}/notesSlide`;
12
- const themeRelationshipType = `${relationshipNamespace}/theme`;
13
- const slideRelationshipType = `${relationshipNamespace}/slide`;
14
- const notesMasterPathTemplate = "ppt/notesMasters/notesMaster{n}.xml";
15
- const notesSlidePathTemplate = "ppt/notesSlides/notesSlide{n}.xml";
16
- const themePathTemplate = "ppt/theme/theme{n}.xml";
17
- const colorMap = "<p:clrMap bg1=\"lt1\" tx1=\"dk1\" bg2=\"lt2\" tx2=\"dk2\" accent1=\"accent1\" accent2=\"accent2\" accent3=\"accent3\" accent4=\"accent4\" accent5=\"accent5\" accent6=\"accent6\" hlink=\"hlink\" folHlink=\"folHlink\"/>";
18
- function groupShapeTree(shapes) {
19
- return `<p:nvGrpSpPr><p:cNvPr id="1" name=""/><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>${shapes}`;
20
- }
21
- /**
22
- * Shared notes master for one deck.
23
- *
24
- * The master is intentionally fixed rather than author-composed: it supplies the slide-image and
25
- * body placeholders plus the notes text defaults, while the page's notes body carries the actual
26
- * rich-text content. Its theme relationship targets a notes-owned theme part with the deck theme
27
- * values, so the notes master never shares the slide master's theme part.
28
- */
29
- function notesMasterXml() {
30
- return xmlDocument(`<p:notesMaster xmlns:a="${drawingNamespace}" xmlns:r="${relationshipNamespace}" xmlns:p="${presentationNamespace}"><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree>${groupShapeTree("<p:sp><p:nvSpPr><p:cNvPr id=\"2\" name=\"Slide Image Placeholder 1\"/><p:cNvSpPr><a:spLocks noGrp=\"1\" noRot=\"1\" noChangeAspect=\"1\"/></p:cNvSpPr><p:nvPr><p:ph type=\"sldImg\" idx=\"2\"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x=\"685800\" y=\"1143000\"/><a:ext cx=\"5486400\" cy=\"3086100\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom><a:noFill/><a:ln><a:noFill/></a:ln></p:spPr></p:sp><p:sp><p:nvSpPr><p:cNvPr id=\"3\" name=\"Notes Placeholder 1\"/><p:cNvSpPr><a:spLocks noGrp=\"1\"/></p:cNvSpPr><p:nvPr><p:ph type=\"body\" idx=\"1\"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x=\"685800\" y=\"4400550\"/><a:ext cx=\"5486400\" cy=\"3600450\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang=\"en-US\" sz=\"1200\"/></a:p></p:txBody></p:sp>")}</p:spTree></p:cSld>${colorMap}<p:notesStyle><a:lvl1pPr><a:defRPr sz="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl1pPr></p:notesStyle></p:notesMaster>`);
31
- }
32
- /** One notes slide body placeholder containing the parsed notes rich text. */
33
- function notesSlideXml(textBody) {
34
- const slideImage = "<p:sp><p:nvSpPr><p:cNvPr id=\"2\" name=\"Slide Image Placeholder 1\"/><p:cNvSpPr><a:spLocks noGrp=\"1\" noRot=\"1\" noChangeAspect=\"1\"/></p:cNvSpPr><p:nvPr><p:ph type=\"sldImg\"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp>";
35
- const body = `<p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/>${textBody}</p:sp>`;
36
- return xmlDocument(`<p:notes xmlns:a="${drawingNamespace}" xmlns:r="${relationshipNamespace}" xmlns:p="${presentationNamespace}"><p:cSld><p:spTree>${groupShapeTree(slideImage + body)}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>`);
37
- }
38
- export { notesMasterContentType, notesMasterPathTemplate, notesMasterRelationshipType, notesMasterXml, notesSlideContentType, notesSlidePathTemplate, notesSlideRelationshipType, notesSlideXml, slideRelationshipType, themeContentType, themePathTemplate, themeRelationshipType };
@@ -1,23 +0,0 @@
1
- import { defineObjectCodegen } from "../../../codegen/dist/types.js";
2
- import "../../../codegen/dist/index.js";
3
- // ../capabilities/dist/placeholder/placeholder-codegen.js
4
- function collectPlaceholderProps(node, ctx) {
5
- if (node.children.length > 0) return ctx.fail("unexpressible-value", "Unpopulated placeholder cannot contain children");
6
- const entries = [];
7
- for (const [key, value] of Object.entries(node.props)) if (value !== void 0) entries.push([key, value]);
8
- return entries;
9
- }
10
- /** Source codegen contribution for unpopulated `placeholder` declarations. */
11
- const placeholderCodegen = defineObjectCodegen({ declarations: { placeholder: {
12
- emitVanilla: (node, ctx) => {
13
- const callee = ctx.useImport("placeholder");
14
- const propsEntries = collectPlaceholderProps(node, ctx);
15
- return propsEntries.length === 0 ? ctx.formatVanillaCall(callee, []) : ctx.formatVanillaCall(callee, [ctx.formatProps(propsEntries)]);
16
- },
17
- emitReact: (node, ctx) => {
18
- const tag = ctx.useImport("Placeholder");
19
- const propsEntries = collectPlaceholderProps(node, ctx);
20
- return ctx.formatJsxElement(tag, propsEntries);
21
- }
22
- } } });
23
- export { placeholderCodegen };
@@ -1,12 +0,0 @@
1
- import { hostNodeCreator } from "../../../core/dist/host.js";
2
- import { createPlaceholderNode } from "./placeholder.js";
3
- import { createElement } from "react";
4
- // ../capabilities/dist/placeholder/placeholder-elements.js
5
- /** Declares an unpopulated native content placeholder bound to a layout placeholder slot. */
6
- function Placeholder(props) {
7
- return createElement("placeholder", {
8
- ...props,
9
- [hostNodeCreator]: createPlaceholderNode
10
- });
11
- }
12
- export { Placeholder };
@@ -1,292 +0,0 @@
1
- import { CapabilityError } from "../../../core/dist/diagnostics.js";
2
- import { authorIdSchema } from "../../../core/dist/author-ids.js";
3
- import { isMorphKey } from "../../../core/dist/morph.js";
4
- import { linkTargetSchema, parseLinkTarget } from "../../../core/dist/author-schemas.js";
5
- import { matchLayoutPlaceholderKey, nativePlaceholderRefSchema } from "../../../core/dist/placeholders.js";
6
- import { layoutStyleKeys, parseCapabilityLayoutContract } from "../../../core/dist/layout.js";
7
- import "../../../core/dist/capability.js";
8
- import { assertXml10Characters, placeholderRefXml, pxToEmu, xmlEscape } from "../../../emit/dist/ooxml.js";
9
- import { CommonNode } from "../../../core/dist/document.js";
10
- import "../../../emit/dist/index.js";
11
- import { A_NS, P_NS, emuToPx } from "../../../import/dist/namespaces.js";
12
- import { extentEmuFragmentSchema, offsetEmuFragmentSchema, ooxmlBoolSchema, ooxmlNonNegativeIntSchema } from "../../../import/dist/xml-fragments.js";
13
- import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
14
- import "../../../import/dist/index.js";
15
- import { nativeLinkXml, optionalNameSchema, parseMorphKey, parseOptionalName, readClickLink } from "../shared/identity.js";
16
- import { directElementChild, isPlaceholderSpElement, readNvPrPlaceholder } from "../shared/placeholder-import.js";
17
- import { resolvePlaceholderGeometry } from "../shared/style-inheritance.js";
18
- import { placeholderCodegen } from "./placeholder-codegen.js";
19
- import { z } from "zod";
20
- // ../capabilities/dist/placeholder/placeholder.js
21
- const NonVisualSpIdSchema = z.object({
22
- id: ooxmlNonNegativeIntSchema,
23
- name: z.string().optional()
24
- });
25
- const NonVisualSpPrFlagsSchema = z.object({ txBox: ooxmlBoolSchema.optional() });
26
- const placeholderDeclarationPropsSchema = z.strictObject({
27
- id: authorIdSchema.optional(),
28
- name: optionalNameSchema.optional(),
29
- morphKey: z.custom(isMorphKey).optional(),
30
- placeholder: z.string().min(1).optional(),
31
- nativePlaceholder: nativePlaceholderRefSchema.optional(),
32
- link: linkTargetSchema.optional(),
33
- x: z.number().finite().optional(),
34
- y: z.number().finite().optional(),
35
- width: z.number().finite().positive().optional(),
36
- height: z.number().finite().positive().optional()
37
- });
38
- const placeholderAllowedParameters = Object.keys(placeholderDeclarationPropsSchema.shape);
39
- /** Creates an editable AST node representing an unpopulated native content placeholder (`<p:sp><p:ph .../></p:sp>` without `<p:txBody>`). */
40
- function createPlaceholderNode(props) {
41
- return new CommonNode("placeholder", "placeholder", props);
42
- }
43
- function emitPlaceholderModel(model, emitContext) {
44
- const escapedName = xmlEscape(model.name);
45
- const spPrXml = model.omitSpPrTransform ? "<p:spPr/>" : `<p:spPr><a:xfrm><a:off x="${pxToEmu(model.box.x)}" y="${pxToEmu(model.box.y)}"/><a:ext cx="${pxToEmu(model.box.width)}" cy="${pxToEmu(model.box.height)}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr>`;
46
- return { xml: `<p:sp><p:nvSpPr><p:cNvPr id="${emitContext.id}" name="${escapedName}">${nativeLinkXml(emitContext.nativeLink)}</p:cNvPr><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr>${placeholderRefXml(model.nativeRef)}</p:nvPr></p:nvSpPr>${spPrXml}</p:sp>` };
47
- }
48
- function paintPlaceholderModel() {
49
- return { svg: "" };
50
- }
51
- /**
52
- * Reads an unpopulated `<p:sp>` content/object placeholder (no `<p:txBody>`)
53
- * into a layout-bound `PlaceholderNode` while preserving `<p:ph>` binding.
54
- */
55
- function readContentPlaceholderSp(context) {
56
- const { cursor, part, slideIndex, layoutPlaceholders } = context;
57
- const diagnostics = [];
58
- const nvSpPr = cursor.child(P_NS, "nvSpPr");
59
- if (nvSpPr === void 0) {
60
- diagnostics.push({
61
- code: "corrupt-part",
62
- category: "corrupt-input",
63
- disposition: "omitted",
64
- location: {
65
- part,
66
- xpath: cursor.xpath,
67
- slideIndex
68
- }
69
- });
70
- return { diagnostics };
71
- }
72
- let objectId;
73
- let objectName;
74
- let clickResult;
75
- const cNvPr = nvSpPr.child(P_NS, "cNvPr");
76
- if (cNvPr !== void 0) {
77
- const rawCNvPr = cNvPr.attrsObject(["id", "name"]);
78
- const parsedCNvPr = NonVisualSpIdSchema.safeParse(rawCNvPr);
79
- if (!parsedCNvPr.success) diagnostics.push({
80
- code: "invalid-xml-value",
81
- category: "corrupt-input",
82
- disposition: "recovered",
83
- location: {
84
- part,
85
- xpath: cNvPr.xpath,
86
- slideIndex
87
- },
88
- attributeOrElement: "p:cNvPr",
89
- rawValue: JSON.stringify(rawCNvPr)
90
- });
91
- else {
92
- objectId = parsedCNvPr.data.id;
93
- if (parsedCNvPr.data.name !== void 0 && parsedCNvPr.data.name.trim() !== "") objectName = parsedCNvPr.data.name;
94
- }
95
- const hlinkClick = cNvPr.child(A_NS, "hlinkClick");
96
- if (hlinkClick !== void 0) {
97
- clickResult = readClickLink(hlinkClick, context, {
98
- ...objectId === void 0 ? {} : { objectId },
99
- ...objectName === void 0 ? {} : { objectName }
100
- });
101
- diagnostics.push(...clickResult.diagnostics);
102
- }
103
- cNvPr.ignoreEmptyChild(A_NS, "extLst");
104
- }
105
- const cNvSpPr = nvSpPr.child(P_NS, "cNvSpPr");
106
- if (cNvSpPr !== void 0) {
107
- NonVisualSpPrFlagsSchema.safeParse(cNvSpPr.attrsObject(["txBox"]));
108
- cNvSpPr.child(A_NS, "spLocks")?.attrsObject([
109
- "noGrp",
110
- "noRot",
111
- "noChangeAspect",
112
- "noMove",
113
- "noResize",
114
- "noSelect"
115
- ]);
116
- }
117
- const phLocation = {
118
- part,
119
- xpath: cursor.xpath,
120
- slideIndex,
121
- ...objectId === void 0 ? {} : { objectId },
122
- ...objectName === void 0 ? {} : { objectName }
123
- };
124
- const nvPr = nvSpPr.child(P_NS, "nvPr");
125
- const phResult = readNvPrPlaceholder(nvPr, phLocation, diagnostics);
126
- if (phResult.kind === "none") {
127
- diagnostics.push({
128
- code: "corrupt-part",
129
- category: "corrupt-input",
130
- disposition: "omitted",
131
- location: phLocation
132
- });
133
- return { diagnostics };
134
- }
135
- if (phResult.kind === "error") return { diagnostics };
136
- const nativeRef = phResult.nativeRef;
137
- const spPr = cursor.child(P_NS, "spPr");
138
- if (spPr === void 0) {
139
- diagnostics.push({
140
- code: "corrupt-part",
141
- category: "corrupt-input",
142
- disposition: "omitted",
143
- location: phLocation
144
- });
145
- return { diagnostics };
146
- }
147
- let localBox;
148
- const xfrm = spPr.child(A_NS, "xfrm");
149
- if (xfrm !== void 0) {
150
- xfrm.attrsObject([
151
- "rot",
152
- "flipH",
153
- "flipV"
154
- ]);
155
- const off = xfrm.child(A_NS, "off");
156
- const ext = xfrm.child(A_NS, "ext");
157
- if (off !== void 0 && ext !== void 0) {
158
- const parsedOff = offsetEmuFragmentSchema.safeParse(off.attrsObject(["x", "y"]));
159
- const parsedExt = extentEmuFragmentSchema.safeParse(ext.attrsObject(["cx", "cy"]));
160
- if (parsedOff.success && parsedExt.success) localBox = {
161
- x: emuToPx(parsedOff.data.x),
162
- y: emuToPx(parsedOff.data.y),
163
- width: emuToPx(parsedExt.data.cx),
164
- height: emuToPx(parsedExt.data.cy)
165
- };
166
- }
167
- }
168
- const prstGeomEl = directElementChild(spPr.element, A_NS, "prstGeom");
169
- if (prstGeomEl !== void 0 && prstGeomEl.getAttribute("prst") === "rect" && prstGeomEl.attributes.length === 1) {
170
- const prstGeom = spPr.child(A_NS, "prstGeom");
171
- prstGeom.consumeAttr("prst");
172
- const avLstEl = directElementChild(prstGeom.element, A_NS, "avLst");
173
- if (avLstEl !== void 0 && avLstEl.children.length === 0 && avLstEl.attributes.length === 0) prstGeom.child(A_NS, "avLst");
174
- }
175
- const noFillEl = directElementChild(spPr.element, A_NS, "noFill");
176
- if (noFillEl !== void 0 && noFillEl.children.length === 0 && noFillEl.attributes.length === 0) spPr.child(A_NS, "noFill");
177
- const matchedKey = matchLayoutPlaceholderKey(layoutPlaceholders, {
178
- type: nativeRef.type,
179
- idx: nativeRef.idx
180
- });
181
- const node = createPlaceholderNode({
182
- ...objectName === void 0 ? {} : { name: objectName },
183
- ...matchedKey === void 0 ? {} : { placeholder: matchedKey },
184
- nativePlaceholder: nativeRef,
185
- ...clickResult?.link === void 0 ? {} : { link: clickResult.link },
186
- ...localBox
187
- });
188
- if (clickResult?.deferredSlideLink !== void 0 && context.registerDeferredSlideLink !== void 0) {
189
- const deferred = clickResult.deferredSlideLink;
190
- context.registerDeferredSlideLink({
191
- ...deferred,
192
- apply(targetSlideId) {
193
- node.set({ link: { id: targetSlideId } });
194
- }
195
- });
196
- }
197
- return {
198
- node,
199
- diagnostics
200
- };
201
- }
202
- /** Shape-tree import handler wired into `contentPlaceholderMechanism` for unpopulated `<p:sp><p:ph .../></p:sp>` placeholders without `<p:txBody>`. */
203
- const contentPlaceholderImportHandler = {
204
- target: "shape-tree",
205
- localName: "sp",
206
- matches: (cursor) => isPlaceholderSpElement(cursor) && directElementChild(cursor.element, "http://schemas.openxmlformats.org/presentationml/2006/main", "txBody") === void 0,
207
- read: readContentPlaceholderSp
208
- };
209
- /** Typed native canvas mechanism connecting emit, paint, and import for unpopulated `content-placeholder`. */
210
- const contentPlaceholderMechanism = defineCanvasMechanism({
211
- key: "content-placeholder",
212
- role: "canvas",
213
- emit: emitPlaceholderModel,
214
- paint: paintPlaceholderModel,
215
- import: contentPlaceholderImportHandler
216
- });
217
- /** Capability preserving unpopulated non-text content placeholder slots across import/emit without synthesizing empty text bodies. */
218
- const placeholderCapability = {
219
- declaration: "placeholder",
220
- mechanisms: [contentPlaceholderMechanism],
221
- codegen: placeholderCodegen,
222
- bind(input, context) {
223
- const unknown = Object.keys(input.props).find((key) => !placeholderAllowedParameters.includes(key));
224
- if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Placeholder contains unsupported parameter ${unknown}`);
225
- if (input.children.length > 0) throw new CapabilityError("unsupported-children", "Unpopulated content placeholder does not accept children");
226
- const placeholder = context.placeholder;
227
- const rawNative = nativePlaceholderRefSchema.safeParse(input.props["nativePlaceholder"]);
228
- const nativeRef = placeholder?.nativeRef ?? (rawNative.success ? rawNative.data : void 0);
229
- if (nativeRef === void 0) throw new CapabilityError("missing-placeholder-binding", "Content placeholder requires a bound layout placeholder or nativePlaceholder descriptor");
230
- const requestedName = parseOptionalName(input.props["name"]);
231
- const morphKey = parseMorphKey(input.props["morphKey"]);
232
- const link = parseLinkTarget(input.props["link"]);
233
- const contract = parseCapabilityLayoutContract({
234
- nativeKind: "sp",
235
- props: input.props,
236
- allowedStyleKeys: new Set(layoutStyleKeys),
237
- allowPadding: false,
238
- path: context.path
239
- });
240
- const placeholderGeometry = placeholder === void 0 ? void 0 : resolvePlaceholderGeometry(placeholder, input.props);
241
- const rawX = placeholderGeometry?.x ?? input.props["x"];
242
- const rawY = placeholderGeometry?.y ?? input.props["y"];
243
- const rawWidth = placeholderGeometry?.width ?? input.props["width"];
244
- const rawHeight = placeholderGeometry?.height ?? input.props["height"];
245
- const native = {
246
- ...morphKey === void 0 ? {} : { morphKey },
247
- ...requestedName === void 0 ? {} : { hasExplicitName: true },
248
- ...link === void 0 ? {} : { link }
249
- };
250
- return {
251
- contract,
252
- ...morphKey !== void 0 || requestedName !== void 0 || link !== void 0 ? { native } : {},
253
- resolve(resolveContext) {
254
- const box = {
255
- x: resolveContext.layoutBox?.x ?? (typeof rawX === "number" ? rawX : 0),
256
- y: resolveContext.layoutBox?.y ?? (typeof rawY === "number" ? rawY : 0),
257
- width: resolveContext.layoutBox?.width ?? (typeof rawWidth === "number" ? rawWidth : 100),
258
- height: resolveContext.layoutBox?.height ?? (typeof rawHeight === "number" ? rawHeight : 100)
259
- };
260
- const name = resolveContext.morphName ?? requestedName ?? placeholder?.layoutPlaceholder?.name ?? `Placeholder ${resolveContext.id - 1}`;
261
- try {
262
- assertXml10Characters(name);
263
- } catch {
264
- throw new CapabilityError("invalid-xml-character", "Placeholder.name contains characters not allowed in XML 1.0");
265
- }
266
- const omitSpPrTransform = placeholder !== void 0 && placeholderGeometry?.hasLocalBoxOverride !== true;
267
- const model = {
268
- box,
269
- name,
270
- nativeRef,
271
- omitSpPrTransform
272
- };
273
- return {
274
- observation: {
275
- id: resolveContext.id,
276
- kind: "placeholder",
277
- name,
278
- box
279
- },
280
- extensions: [],
281
- emit(emitContext) {
282
- return contentPlaceholderMechanism.emit(model, emitContext);
283
- },
284
- paint() {
285
- return contentPlaceholderMechanism.paint(model, void 0);
286
- }
287
- };
288
- }
289
- };
290
- }
291
- };
292
- export { contentPlaceholderImportHandler, contentPlaceholderMechanism, createPlaceholderNode, placeholderCapability, placeholderDeclarationPropsSchema, readContentPlaceholderSp };
@@ -1,57 +0,0 @@
1
- import { authorIdSchema } from "../../../core/dist/author-ids.js";
2
- import { layoutStyleSchema } from "../../../core/dist/layout-schemas.js";
3
- import { colorValueSchema, textStyleSchema, visualStyleSchema } from "../../../core/dist/theme.js";
4
- import { linkTargetSchema } from "../../../core/dist/author-schemas.js";
5
- import { geometrySchema } from "../../../core/dist/geometry-schemas.js";
6
- import "../../../core/dist/capability.js";
7
- import { pxToEmu } from "../../../emit/dist/ooxml.js";
8
- import { RichTextContainer } from "../../../core/dist/document.js";
9
- import "../../../emit/dist/index.js";
10
- import { motionPropsSchema } from "../motion/motion-schemas.js";
11
- import "../shared/geometry.js";
12
- import { optionalNameSchema } from "../shared/identity.js";
13
- import { morphKeySchema } from "../shared/morph-api.js";
14
- import { lineEndStyleSchema } from "../shared/visual.js";
15
- import { z } from "zod";
16
- // ../capabilities/dist/shape/shape-declaration.js
17
- const shapeCoordinateSchema = z.number().finite().min(-1e6).max(1e6);
18
- const shapeSizeSchema = z.number().finite().positive().refine((value) => {
19
- const extentEmu = pxToEmu(value);
20
- return extentEmu >= 1 && extentEmu <= 2147483647;
21
- });
22
- const shapeStyleSchema = z.strictObject({
23
- ...layoutStyleSchema.unwrap().shape,
24
- ...visualStyleSchema.unwrap().shape,
25
- ...lineEndStyleSchema.unwrap().shape,
26
- ...textStyleSchema.unwrap().shape
27
- }).readonly();
28
- const motionPropsShape = motionPropsSchema.unwrap().shape;
29
- const shapeDeclarationPropsObjectSchema = z.strictObject({
30
- id: authorIdSchema.optional(),
31
- name: optionalNameSchema.optional(),
32
- morphKey: morphKeySchema.optional(),
33
- link: linkTargetSchema.optional(),
34
- geometry: geometrySchema.optional(),
35
- flipH: z.boolean().optional(),
36
- flipV: z.boolean().optional(),
37
- x: shapeCoordinateSchema.optional(),
38
- y: shapeCoordinateSchema.optional(),
39
- width: shapeSizeSchema.optional(),
40
- height: shapeSizeSchema.optional(),
41
- style: shapeStyleSchema.optional(),
42
- fill: colorValueSchema.optional(),
43
- /** Directly writes native text into this shape without creating an additional text box; mutually exclusive with children. */
44
- text: z.string().optional(),
45
- /** Shape text uses shared text services and can still be emitted when text box capability is omitted. */
46
- textStyle: textStyleSchema.optional(),
47
- enter: motionPropsShape.enter,
48
- emphasis: motionPropsShape.emphasis,
49
- motion: motionPropsShape.motion
50
- });
51
- const shapeDeclarationPropsKeys = [...Object.keys(shapeDeclarationPropsObjectSchema.shape), "children"];
52
- shapeDeclarationPropsObjectSchema.readonly();
53
- /** Creates the editable native shape shared by the command factory and the Shape JSX element. */
54
- function createShapeNode(props) {
55
- return new RichTextContainer("shape", "shape", props);
56
- }
57
- export { createShapeNode, shapeCoordinateSchema, shapeDeclarationPropsKeys, shapeSizeSchema, shapeStyleSchema };