@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
@@ -0,0 +1,77 @@
1
+ import { themeXml, xmlDocument, xmlEscape } from "../../kernel/pptx-write/xml.js";
2
+ // ../core/dist/capabilities/shared/print-xml.js
3
+ const drawingNamespace = "http://schemas.openxmlformats.org/drawingml/2006/main";
4
+ const presentationNamespace = "http://schemas.openxmlformats.org/presentationml/2006/main";
5
+ const relationshipNamespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
6
+ const notesMasterContentType = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
7
+ const notesSlideContentType = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
8
+ const themeContentType = "application/vnd.openxmlformats-officedocument.theme+xml";
9
+ const notesMasterRelationshipType = `${relationshipNamespace}/notesMaster`;
10
+ const notesSlideRelationshipType = `${relationshipNamespace}/notesSlide`;
11
+ const themeRelationshipType = `${relationshipNamespace}/theme`;
12
+ const slideRelationshipType = `${relationshipNamespace}/slide`;
13
+ const notesMasterPathTemplate = "ppt/notesMasters/notesMaster{n}.xml";
14
+ const notesSlidePathTemplate = "ppt/notesSlides/notesSlide{n}.xml";
15
+ const themePathTemplate = "ppt/theme/theme{n}.xml";
16
+ 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\"/>";
17
+ const hiddenPrintHeaderFooter = "<p:hf hdr=\"0\" ftr=\"0\" dt=\"0\" sldNum=\"0\"/>";
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(corners, headerFooter) {
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=\"1036800\" 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=\"3\"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x=\"1036800\" y=\"4400550\"/><a:ext cx=\"5486400\" cy=\"5148450\"/></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>" + corners)}</p:spTree></p:cSld>${colorMap}${headerFooter}<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, corners) {
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\" idx=\"2\"/></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="3"/></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 + corners)}</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>`);
37
+ }
38
+ function handoutMasterXml(corners, headerFooter) {
39
+ return xmlDocument(`<p:handoutMaster 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(corners)}</p:spTree></p:cSld>${colorMap}${headerFooter}</p:handoutMaster>`);
40
+ }
41
+ /**
42
+ * Both print masters require a distinct theme part, even when the theme values match the deck.
43
+ * Deck configuration registers before page emitters so notes pages reuse the configured master.
44
+ */
45
+ function registerPrintMaster(emitContext, theme, kind, headerFooter, corners, renderSlideFragment) {
46
+ const notes = kind === "notes";
47
+ const themeKey = `${kind}-theme`;
48
+ emitContext.registerSharedPart(themeKey, {
49
+ part: {
50
+ pathTemplate: themePathTemplate,
51
+ contentType: themeContentType
52
+ },
53
+ content: () => themeXml(theme)
54
+ });
55
+ const master = notes ? "notesMaster" : "handoutMaster";
56
+ return emitContext.registerSharedPart(`${kind}-master`, {
57
+ part: {
58
+ pathTemplate: notes ? notesMasterPathTemplate : "ppt/handoutMasters/handoutMaster{n}.xml",
59
+ contentType: notes ? notesMasterContentType : "application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml"
60
+ },
61
+ presentationRelationshipType: `${relationshipNamespace}/${master}`,
62
+ relationships: [{
63
+ relationshipType: themeRelationshipType,
64
+ target: {
65
+ kind: "part",
66
+ key: themeKey
67
+ }
68
+ }],
69
+ presentationElement: {
70
+ position: notes ? "before-slides" : "after-notes-master",
71
+ content: (relationshipId) => `<p:${master}IdLst><p:${master}Id r:id="${xmlEscape(relationshipId)}"/></p:${master}IdLst>`
72
+ },
73
+ content: () => notes ? notesMasterXml(corners, headerFooter) : handoutMasterXml(corners, headerFooter),
74
+ renderSlideFragment
75
+ });
76
+ }
77
+ export { hiddenPrintHeaderFooter, notesMasterRelationshipType, notesSlideContentType, notesSlidePathTemplate, notesSlideRelationshipType, notesSlideXml, registerPrintMaster, slideRelationshipType };
@@ -0,0 +1,119 @@
1
+ import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
2
+ import { authorIdSchema } from "../../kernel/author-ids.js";
3
+ import { serializeImageDescriptorValue } from "./image-codegen.js";
4
+ import { motionPropKeySet } from "./motion-schemas.js";
5
+ import "../../kernel/capability.js";
6
+ import { expr, parseCodegenSchemaProp } from "../../kernel/codegen.js";
7
+ import { CommonNode } from "../../kernel/document.js";
8
+ import { dateTimeAuthorPropsSchema, inlineRichTextNodeTypes, isInlineRichTextNodeType, paragraphStyleSchema, placeholderRichTextNodeTypes, runStyleSchema, textBoxStyleSchema } from "./text-schemas.js";
9
+ // ../core/dist/capabilities/shared/rich-text-codegen.js
10
+ const objectMotionPropKeys = motionPropKeySet;
11
+ function isPlainRecord(value) {
12
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
13
+ const proto = Object.getPrototypeOf(value);
14
+ return proto === Object.prototype || proto === null;
15
+ }
16
+ function serializeRichTextStyleProp(nodeType, style, ctx) {
17
+ if (!isPlainRecord(style)) ctx.fail("unexpressible-value", `${nodeType}.style must be a plain object`, "@style");
18
+ const schema = nodeType === "text" ? textBoxStyleSchema : nodeType === "paragraph" ? paragraphStyleSchema : isInlineRichTextNodeType(nodeType) ? runStyleSchema : void 0;
19
+ if (schema !== void 0) parseCodegenSchemaProp(ctx, "style", style, schema);
20
+ const entries = [];
21
+ for (const [key, entryValue] of Object.entries(style)) {
22
+ if (entryValue === void 0) continue;
23
+ if (key === "background") {
24
+ const serializedImage = serializeImageDescriptorValue(entryValue, ctx);
25
+ entries.push([key, serializedImage ?? entryValue]);
26
+ continue;
27
+ }
28
+ entries.push([key, entryValue]);
29
+ }
30
+ return expr(ctx.formatProps(entries));
31
+ }
32
+ /** Container-level rich-text child declaration types allowed directly inside `Notes` and `Cell`. */
33
+ const blockRichTextChildKinds = new Set(placeholderRichTextNodeTypes);
34
+ /** Container-level rich-text child declaration types allowed directly inside `Text`. */
35
+ const steppableRichTextChildKinds = /* @__PURE__ */ new Set([...blockRichTextChildKinds, "motion-step"]);
36
+ /** Inline-level rich-text child declaration types allowed inside `P` and `Span`. */
37
+ const inlineRichTextChildKinds = new Set(inlineRichTextNodeTypes);
38
+ function singleTextLeaf(node) {
39
+ if (node.children.length !== 1) return void 0;
40
+ const only = node.children[0];
41
+ if (only === void 0 || only instanceof CommonNode) return void 0;
42
+ const leaf = only;
43
+ return leaf.type === "#text" ? leaf.text : void 0;
44
+ }
45
+ /** Collects and validates own defined props on a rich-text or slide-number node. */
46
+ function collectRichTextNodeProps(node, ctx, allowedPropKeys, supportObjectExtras) {
47
+ const props = readInternalDeclarationProps(node);
48
+ const extra = supportObjectExtras ? ctx.emitObjectExtraProps(props) : {};
49
+ const entries = [];
50
+ for (const [key, value] of Object.entries(props)) {
51
+ if (value === void 0) continue;
52
+ if (!allowedPropKeys.has(key)) ctx.fail("invalid-document", `${node.type} declaration does not support property ${JSON.stringify(key)}`, `@${key}`);
53
+ if (key === "style") {
54
+ entries.push([key, serializeRichTextStyleProp(node.type, value, ctx)]);
55
+ continue;
56
+ }
57
+ if (node.type === "date-time" && (key === "id" || key === "format")) {
58
+ if (!dateTimeAuthorPropsSchema.safeParse({ [key]: value }).success) ctx.fail("unexpressible-value", key === "format" ? "DateTime.format must be a supported date/time format" : "date-time.id must be a valid AuthorId", `@${key}`);
59
+ entries.push([key, value]);
60
+ continue;
61
+ }
62
+ if (key === "id") {
63
+ if (!authorIdSchema.safeParse(value).success) ctx.fail("unexpressible-value", `${node.type}.id must be a valid AuthorId`, "@id");
64
+ entries.push([key, value]);
65
+ continue;
66
+ }
67
+ if (supportObjectExtras && objectMotionPropKeys.has(key)) {
68
+ if (node.type === "paragraph" && !/^deck\/slide(?:\[[^\]]*\])?(?:\/.*)?\/(?:text|shape)(?:\[[^\]]*\])?(?:\/motion-step(?:\[[^\]]*\])?)?\/paragraph(?:\[[^\]]*\])?(?:@.*)?$/u.test(ctx.path)) ctx.fail("invalid-document", "Paragraph motion properties are only supported inside page-level Text and Shape", `@${key}`);
69
+ if (Object.hasOwn(extra, key)) entries.push([key, extra[key]]);
70
+ else ctx.fail("unexpressible-value", `Object property ${JSON.stringify(key)} requires motion codegen support`, `@${key}`);
71
+ continue;
72
+ }
73
+ entries.push([key, value]);
74
+ }
75
+ return entries;
76
+ }
77
+ function assertAllowedRichTextChildren(node, ctx, allowedChildKinds) {
78
+ let childIndex = 0;
79
+ for (const child of node.children) {
80
+ if (!(child instanceof CommonNode)) continue;
81
+ const label = child.id === void 0 ? `${child.type}[${childIndex + 1}]` : `${child.type}[${child.id}]`;
82
+ if (!allowedChildKinds.has(child.type)) ctx.fail("invalid-document", `${node.type} declaration cannot contain ${JSON.stringify(child.type)} child`, `${ctx.path}/${label}`);
83
+ childIndex += 1;
84
+ }
85
+ }
86
+ /**
87
+ * Creates a dual-target (`vanilla` / `react`) codegen handler for a rich-text container node
88
+ * (`Text`, `P`, `Span`, or `Notes`), validating props and child declaration types.
89
+ */
90
+ function createRichTextCodegenHandler(options) {
91
+ return {
92
+ emitVanilla(node, ctx) {
93
+ assertAllowedRichTextChildren(node, ctx, options.allowedChildKinds);
94
+ const callee = ctx.useImport(options.vanillaFactory);
95
+ const propsEntries = collectRichTextNodeProps(node, ctx, options.allowedPropKeys, options.supportObjectExtras);
96
+ const leafText = singleTextLeaf(node);
97
+ if (leafText !== void 0) {
98
+ const args = propsEntries.length === 0 ? [JSON.stringify(leafText)] : [JSON.stringify(leafText), ctx.formatProps(propsEntries)];
99
+ return ctx.formatVanillaCall(callee, args);
100
+ }
101
+ if (node.children.length === 0) {
102
+ const args = propsEntries.length === 0 ? [] : ["[]", ctx.formatProps(propsEntries)];
103
+ return ctx.formatVanillaCall(callee, args);
104
+ }
105
+ const children = ctx.emitRichTextChildren(node.children);
106
+ if (propsEntries.length === 0) return ctx.formatVanillaCall(callee, [], children);
107
+ const contentArg = ctx.emitValueExpr(children.map((code) => expr(code)));
108
+ return ctx.formatVanillaCall(callee, [contentArg, ctx.formatProps(propsEntries)]);
109
+ },
110
+ emitReact(node, ctx) {
111
+ assertAllowedRichTextChildren(node, ctx, options.allowedChildKinds);
112
+ const tag = ctx.useImport(options.reactComponent);
113
+ const propsEntries = collectRichTextNodeProps(node, ctx, options.allowedPropKeys, options.supportObjectExtras);
114
+ const children = ctx.emitRichTextChildren(node.children);
115
+ return ctx.formatJsxElement(tag, propsEntries, children);
116
+ }
117
+ };
118
+ }
119
+ export { blockRichTextChildKinds, collectRichTextNodeProps, createRichTextCodegenHandler, inlineRichTextChildKinds, isPlainRecord, serializeRichTextStyleProp, steppableRichTextChildKinds };
@@ -0,0 +1,472 @@
1
+ import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
2
+ import "./date-time.js";
3
+ import "./text-schemas.js";
4
+ import "../../kernel/capability.js";
5
+ import { A_NS, XML_NS } from "../../kernel/pptx-read/namespaces.js";
6
+ import { cascadeOoxmlTextDecoration, ooxmlBoolSchema, projectOoxmlTextDecoration, readOoxmlBoxInsets, readOoxmlRunAttrStyles, readOoxmlTextDecoration, reportOoxmlTextDecorationLoss } from "../../kernel/pptx-read/xml-fragments.js";
7
+ import { readEffectList, readRunFillAndStroke } from "../../kernel/pptx-read/visual.js";
8
+ import { readRunFontSlots } from "../../kernel/pptx-read/fonts.js";
9
+ import { cascadeDrawingParagraphProperties, readDrawingListStyles, readDrawingParagraphProperties } from "../../kernel/pptx-read/drawing-list-import.js";
10
+ import "../../kernel/pptx-read/index.js";
11
+ import { isTextGradient, textStyleKeys } from "../../kernel/theme.js";
12
+ import { createDateTimeNode, createParagraphNode, createSlideNumberNode, createSpanNode, createSubNode, createSupNode } from "./text-declaration.js";
13
+ import { z } from "zod";
14
+ // ../core/dist/capabilities/shared/rich-text-import.js
15
+ const BodyPrFragmentSchema = z.object({
16
+ wrap: z.enum(["square", "none"]).optional(),
17
+ rtlCol: ooxmlBoolSchema.optional(),
18
+ anchor: z.enum([
19
+ "t",
20
+ "ctr",
21
+ "b"
22
+ ]).optional(),
23
+ anchorCtr: ooxmlBoolSchema.optional(),
24
+ spcFirstLastPara: ooxmlBoolSchema.optional(),
25
+ numCol: z.string().optional(),
26
+ spcCol: z.string().optional()
27
+ });
28
+ const TextFieldXmlSchema = z.object({
29
+ id: z.string().min(1),
30
+ type: z.string().min(1)
31
+ });
32
+ const shapeFieldXmlSchema = TextFieldXmlSchema.omit({ id: true });
33
+ const anchorToVerticalAlign = {
34
+ t: "top",
35
+ ctr: "middle",
36
+ b: "bottom"
37
+ };
38
+ /** A bound slide keeps its native placeholder defaults. Consume the body-local overrides we can represent. */
39
+ function readPlaceholderListOverrides(body, location, diagnostics) {
40
+ if (body.ignoreEmptyChild("http://schemas.openxmlformats.org/drawingml/2006/main", "lstStyle")) return void 0;
41
+ const list = body.child(A_NS, "lstStyle");
42
+ if (list === void 0) return void 0;
43
+ const read = (name) => {
44
+ const properties = list.child(A_NS, name)?.child(A_NS, "defRPr");
45
+ if (properties === void 0) return void 0;
46
+ const decoration = readOoxmlTextDecoration(properties, location, diagnostics, true);
47
+ return {
48
+ style: readRunFillAndStroke(properties, location, diagnostics),
49
+ ...decoration === void 0 ? {} : { decoration }
50
+ };
51
+ };
52
+ const defaults = read("defPPr");
53
+ return Array.from({ length: 9 }, (_, level) => cascadeDrawingParagraphProperties(defaults, read(`lvl${level + 1}pPr`), level));
54
+ }
55
+ /** Folds inherited text effects into paragraph style while leaving each run's override intact. */
56
+ function resolveParagraphTextEffects(inherited, local, runs) {
57
+ const color = local?.color ?? inherited?.color;
58
+ const textStroke = local?.textStroke ?? inherited?.textStroke;
59
+ return {
60
+ ...color !== void 0 && (isTextGradient(color) || runs.some((run) => run.style.color === void 0)) ? { color } : {},
61
+ ...textStroke === void 0 ? {} : { textStroke }
62
+ };
63
+ }
64
+ function readRunProperties(rPrCursor, location, diagnostics, allowShadowNone = false) {
65
+ const attrStyles = readOoxmlRunAttrStyles({
66
+ rPrCursor,
67
+ location,
68
+ diagnostics,
69
+ allowBaseline: true,
70
+ diagnoseUnsupportedEnums: true
71
+ });
72
+ const { color, textStroke } = readRunFillAndStroke(rPrCursor, location, diagnostics);
73
+ const effects = rPrCursor.child(A_NS, "effectLst");
74
+ const textShadow = effects === void 0 ? void 0 : readEffectList(effects, location, diagnostics, "text").boxShadow ?? (allowShadowNone && effects.element.children.length === 0 ? "none" : void 0);
75
+ const { fontFamily, eastAsianFontFamily } = readRunFontSlots(rPrCursor);
76
+ return {
77
+ style: {
78
+ ...fontFamily === void 0 ? {} : { fontFamily },
79
+ ...eastAsianFontFamily === void 0 ? {} : { eastAsianFontFamily },
80
+ ...attrStyles.fontSize === void 0 ? {} : { fontSize: attrStyles.fontSize },
81
+ ...attrStyles.fontWeight === void 0 ? {} : { fontWeight: attrStyles.fontWeight },
82
+ ...attrStyles.fontStyle === void 0 ? {} : { fontStyle: attrStyles.fontStyle },
83
+ ...color === void 0 ? {} : { color },
84
+ ...attrStyles.letterSpacing === void 0 ? {} : { letterSpacing: attrStyles.letterSpacing },
85
+ ...attrStyles.textTransform === void 0 ? {} : { textTransform: attrStyles.textTransform },
86
+ ...textShadow === void 0 ? {} : { textShadow },
87
+ ...textStroke === void 0 ? {} : { textStroke },
88
+ ...attrStyles.lang === void 0 ? {} : { lang: attrStyles.lang },
89
+ ...attrStyles.baselineShift === void 0 ? {} : { baselineShift: attrStyles.baselineShift }
90
+ },
91
+ ...attrStyles.decoration === void 0 ? {} : { decoration: attrStyles.decoration },
92
+ ...attrStyles.sizePt === void 0 ? {} : { sizePt: attrStyles.sizePt },
93
+ ...attrStyles.inlineKind === void 0 ? {} : { inlineKind: attrStyles.inlineKind }
94
+ };
95
+ }
96
+ function readInlineField(cursor, location, shape) {
97
+ const diagnostics = [];
98
+ const rawField = cursor.attrsObject(["id", "type"]);
99
+ const parsedField = (shape ? shapeFieldXmlSchema : TextFieldXmlSchema).safeParse(rawField);
100
+ const rPrCursor = cursor.child(A_NS, "rPr");
101
+ cursor.ignoreEmptyChild(A_NS, "pPr");
102
+ const tCursor = cursor.child(A_NS, "t");
103
+ if (tCursor !== void 0) tCursor.consumeAttr("space", XML_NS);
104
+ const fallbackText = tCursor?.textContent ?? "";
105
+ if (!parsedField.success) {
106
+ diagnostics.push({
107
+ code: "invalid-xml-value",
108
+ category: "corrupt-input",
109
+ disposition: "omitted",
110
+ location: {
111
+ ...location,
112
+ xpath: cursor.xpath
113
+ },
114
+ attributeOrElement: "a:fld",
115
+ rawValue: JSON.stringify(rawField)
116
+ });
117
+ return {
118
+ kind: "unsupported",
119
+ fieldType: rawField["type"] ?? "",
120
+ ...rPrCursor === void 0 ? {} : { rPrCursor },
121
+ fallbackText,
122
+ diagnostics
123
+ };
124
+ }
125
+ const dateTime = dateTimeFormatSchema.safeParse(parsedField.data.type);
126
+ if (parsedField.data.type !== "slidenum" && !dateTime.success) {
127
+ diagnostics.push({
128
+ code: "unsupported-mechanism",
129
+ category: "unsupported",
130
+ disposition: "omitted",
131
+ location: {
132
+ ...location,
133
+ xpath: cursor.xpath
134
+ },
135
+ namespaceUri: cursor.namespaceUri,
136
+ localName: cursor.localName,
137
+ mechanismHint: `${shape ? "field" : "text-field"}:${parsedField.data.type}`
138
+ });
139
+ return {
140
+ kind: "unsupported",
141
+ fieldType: parsedField.data.type,
142
+ ...rPrCursor === void 0 ? {} : { rPrCursor },
143
+ fallbackText,
144
+ diagnostics
145
+ };
146
+ }
147
+ return {
148
+ ...dateTime.success ? {
149
+ kind: "date-time",
150
+ fieldType: dateTime.data
151
+ } : {
152
+ kind: "slide-number",
153
+ fieldType: "slidenum"
154
+ },
155
+ ...rPrCursor === void 0 ? {} : { rPrCursor },
156
+ fallbackText,
157
+ diagnostics
158
+ };
159
+ }
160
+ /**
161
+ * Import handler for `<a:fld type="slidenum">` inline text fields (`text-field-slidenum`).
162
+ */
163
+ const textFieldSlideNumImportHandler = {
164
+ target: "text-inline",
165
+ localName: "fld",
166
+ matches(cursor) {
167
+ return cursor.element.getAttribute("type") === "slidenum";
168
+ },
169
+ read({ cursor, part, slideIndex }) {
170
+ return readInlineField(cursor, {
171
+ part,
172
+ slideIndex
173
+ }, false);
174
+ }
175
+ };
176
+ /** Import handler for the native date/time field mechanism. */
177
+ const textFieldDateTimeImportHandler = {
178
+ ...textFieldSlideNumImportHandler,
179
+ matches(cursor) {
180
+ return dateTimeFormatSchema.safeParse(cursor.element.getAttribute("type")).success;
181
+ }
182
+ };
183
+ function readParagraph(pCursor, location, diagnostics, listStyles, ancestorDecorations, host) {
184
+ const pPr = pCursor.child(A_NS, "pPr");
185
+ const allowInheritedShadowClear = host === "placeholder" || host === "unbound-placeholder" || listStyles !== void 0;
186
+ let hasDefaultRun = false;
187
+ const readDefaultRun = (cursor) => {
188
+ hasDefaultRun = true;
189
+ const { style: { baselineShift: _baselineShift, ...style }, decoration } = readRunProperties(cursor, location, diagnostics, allowInheritedShadowClear);
190
+ return {
191
+ style,
192
+ ...decoration === void 0 ? {} : { decoration }
193
+ };
194
+ };
195
+ const local = pPr === void 0 ? void 0 : readDrawingParagraphProperties(pPr, location, diagnostics, readDefaultRun);
196
+ const readShadowClear = allowInheritedShadowClear || local?.style.textShadow !== void 0;
197
+ const lvl = local?.level;
198
+ const inherited = listStyles?.[lvl ?? 0];
199
+ const effective = cascadeDrawingParagraphProperties(host === "placeholder" ? void 0 : inherited, local, lvl ?? 0);
200
+ const materializeListStyle = inherited !== void 0 && (Object.keys(inherited.style).length > 0 || inherited.decoration !== void 0 || inherited.buNone || inherited.spacingAfterPercent !== void 0);
201
+ const localDecoration = cascadeOoxmlTextDecoration(inherited?.decoration, local?.decoration);
202
+ const decoration = cascadeOoxmlTextDecoration(ancestorDecorations?.[lvl ?? 0], localDecoration);
203
+ const hasLocalDecoration = inherited?.decoration !== void 0 || local?.decoration !== void 0;
204
+ const needsLevelOverride = lvl !== void 0 && lvl > 0 && effective.style.list === void 0 && projectOoxmlTextDecoration(ancestorDecorations?.[lvl]) !== projectOoxmlTextDecoration(ancestorDecorations?.[0]);
205
+ const paragraphDecoration = hasLocalDecoration || needsLevelOverride ? projectOoxmlTextDecoration(decoration) ?? "none" : void 0;
206
+ const readInline = (properties, position) => {
207
+ const parsed = properties === void 0 ? { style: {} } : readRunProperties(properties, location, diagnostics, readShadowClear);
208
+ const state = cascadeOoxmlTextDecoration(decoration, parsed.decoration);
209
+ reportOoxmlTextDecorationLoss(state, {
210
+ ...location,
211
+ xpath: position.xpath
212
+ }, diagnostics);
213
+ const textDecoration = projectOoxmlTextDecoration(state);
214
+ return {
215
+ ...parsed,
216
+ style: {
217
+ ...parsed.style,
218
+ ...parsed.decoration === void 0 || textDecoration === void 0 ? {} : { textDecoration }
219
+ }
220
+ };
221
+ };
222
+ const runs = [];
223
+ let endPara;
224
+ for (const child of pCursor.remainingElementChildren()) {
225
+ if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "r") {
226
+ const parsedRPr = readInline(child.child(A_NS, "rPr"), child);
227
+ const t = child.child(A_NS, "t");
228
+ if (t !== void 0) {
229
+ t.consumeAttr("space", XML_NS);
230
+ runs.push({
231
+ kind: parsedRPr.inlineKind ?? "text",
232
+ text: t.textContent,
233
+ style: parsedRPr.style,
234
+ ...parsedRPr.sizePt === void 0 ? {} : { sizePt: parsedRPr.sizePt }
235
+ });
236
+ }
237
+ continue;
238
+ }
239
+ if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "br") {
240
+ const parsedRPr = readInline(child.child(A_NS, "rPr"), child);
241
+ runs.push({
242
+ kind: parsedRPr.inlineKind ?? "text",
243
+ text: "\n",
244
+ style: parsedRPr.style,
245
+ ...parsedRPr.sizePt === void 0 ? {} : { sizePt: parsedRPr.sizePt }
246
+ });
247
+ continue;
248
+ }
249
+ if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "fld") {
250
+ const outcome = readInlineField(child, location, host === "shape");
251
+ diagnostics.push(...outcome.diagnostics);
252
+ if (outcome.kind === "unsupported" && host !== "shape") continue;
253
+ const parsedRPr = readInline(outcome.rPrCursor, child);
254
+ if (outcome.kind === "unsupported") {
255
+ if (outcome.fallbackText !== "") runs.push({
256
+ kind: parsedRPr.inlineKind ?? "text",
257
+ text: outcome.fallbackText,
258
+ style: parsedRPr.style,
259
+ ...parsedRPr.sizePt === void 0 ? {} : { sizePt: parsedRPr.sizePt }
260
+ });
261
+ } else {
262
+ const fieldStyle = parsedRPr.inlineKind === void 0 ? parsedRPr.style : {
263
+ ...parsedRPr.style,
264
+ baselineShift: parsedRPr.inlineKind === "sup" ? "30%" : "-25%"
265
+ };
266
+ runs.push({
267
+ ...outcome.kind === "date-time" ? {
268
+ kind: "date-time",
269
+ format: outcome.fieldType
270
+ } : { kind: "slide-number" },
271
+ style: fieldStyle,
272
+ ...parsedRPr.sizePt === void 0 ? {} : { sizePt: parsedRPr.sizePt }
273
+ });
274
+ }
275
+ continue;
276
+ }
277
+ if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "endParaRPr") {
278
+ endPara = readRunProperties(child, location, diagnostics, readShadowClear);
279
+ continue;
280
+ }
281
+ diagnostics.push({
282
+ code: "unconsumed-xml",
283
+ category: "unsupported",
284
+ disposition: "omitted",
285
+ kind: "element",
286
+ location: {
287
+ ...location,
288
+ xpath: child.xpath
289
+ },
290
+ namespaceUri: child.namespaceUri,
291
+ localName: child.localName
292
+ });
293
+ }
294
+ const effectiveStyle = materializeDrawingParagraphStyle(effective, {
295
+ ...location,
296
+ xpath: pCursor.xpath
297
+ }, diagnostics, runs.find((run) => run.sizePt !== void 0)?.sizePt ?? endPara?.sizePt);
298
+ const { align, lineHeight, spacingAfter, list } = effectiveStyle;
299
+ const finalDecoration = runs.length === 0 ? cascadeOoxmlTextDecoration(decoration, endPara?.decoration) : decoration;
300
+ if (runs.length === 0) reportOoxmlTextDecorationLoss(finalDecoration, {
301
+ ...location,
302
+ xpath: pCursor.xpath
303
+ }, diagnostics);
304
+ const textDecoration = runs.length === 0 && endPara?.decoration !== void 0 ? projectOoxmlTextDecoration(finalDecoration) : paragraphDecoration;
305
+ const { baselineShift: _endBaselineShift, ...endStyle } = endPara?.style ?? {};
306
+ return {
307
+ runs,
308
+ style: {
309
+ ...host === "placeholder" ? {
310
+ ...resolveParagraphTextEffects(inherited?.style, local?.style, runs),
311
+ ...align === void 0 ? {} : { align },
312
+ ...lineHeight === void 0 ? {} : { lineHeight },
313
+ ...spacingAfter === void 0 ? {} : { spacingAfter },
314
+ ...list === void 0 ? {} : { list }
315
+ } : {
316
+ ...effectiveStyle,
317
+ ...runs.length === 0 ? endStyle : {}
318
+ },
319
+ ...textDecoration === void 0 ? {} : { textDecoration }
320
+ },
321
+ ...lvl === void 0 ? {} : { level0: lvl },
322
+ ...materializeListStyle || hasDefaultRun ? { hasTextDefaults: true } : {},
323
+ ...effective.buNone ? { buNone: true } : {}
324
+ };
325
+ }
326
+ /** Converts DrawingML percentage space-after using the effective text size. */
327
+ function materializeDrawingParagraphStyle(effective, location, diagnostics, sizePt) {
328
+ const { spacingBefore: _spacingBefore, ...style } = effective.style;
329
+ if (effective.spacingAfterPercent === void 0) return style;
330
+ const { val, xpath } = effective.spacingAfterPercent;
331
+ const spacingAfter = (sizePt ?? (typeof style.fontSize === "string" ? Number.parseFloat(style.fontSize) : 18)) * val / 1e5 * (4 / 3);
332
+ if (Math.round(spacingAfter * 75) <= 158400) return {
333
+ ...style,
334
+ spacingAfter
335
+ };
336
+ diagnostics.push({
337
+ code: "invalid-xml-value",
338
+ category: "corrupt-input",
339
+ disposition: "omitted",
340
+ location: {
341
+ ...location,
342
+ xpath
343
+ },
344
+ attributeOrElement: "a:spcPct/@val",
345
+ rawValue: String(val)
346
+ });
347
+ return style;
348
+ }
349
+ /** Reads the body-local DrawingML hierarchy for an unbound rich text host. */
350
+ function readRichTextListStyles(txBody, location, diagnostics) {
351
+ return readDrawingListStyles(txBody.child(A_NS, "lstStyle"), location, diagnostics, (cursor) => {
352
+ const { style: { baselineShift: _baselineShift, ...style }, decoration } = readRunProperties(cursor, location, diagnostics, true);
353
+ return {
354
+ style,
355
+ ...decoration === void 0 ? {} : { decoration }
356
+ };
357
+ });
358
+ }
359
+ /**
360
+ * Shared rich-text body reader for text boxes, shapes, table cells, and speaker notes.
361
+ */
362
+ function readRichTextBody(txBody, location, diagnostics, host = "free", ancestorDecorations) {
363
+ let paddingTop;
364
+ let paddingRight;
365
+ let paddingBottom;
366
+ let paddingLeft;
367
+ let verticalAlign;
368
+ let textWrap;
369
+ const bodyPr = txBody.child(A_NS, "bodyPr");
370
+ if (bodyPr !== void 0) {
371
+ const rawBodyPr = bodyPr.attrsObject([
372
+ "wrap",
373
+ "rtlCol",
374
+ "lIns",
375
+ "tIns",
376
+ "rIns",
377
+ "bIns",
378
+ "anchor",
379
+ "anchorCtr",
380
+ "spcFirstLastPara",
381
+ "numCol",
382
+ "spcCol"
383
+ ]);
384
+ const parsedBodyPr = BodyPrFragmentSchema.safeParse(rawBodyPr);
385
+ if (!parsedBodyPr.success) diagnostics.push({
386
+ code: "invalid-xml-value",
387
+ category: "corrupt-input",
388
+ disposition: "recovered",
389
+ location: {
390
+ ...location,
391
+ xpath: bodyPr.xpath
392
+ },
393
+ attributeOrElement: "a:bodyPr",
394
+ rawValue: JSON.stringify(rawBodyPr)
395
+ });
396
+ else {
397
+ const b = parsedBodyPr.data;
398
+ if (b.wrap === "none") textWrap = "nowrap";
399
+ else if (b.wrap === "square") textWrap = "normal";
400
+ if (b.anchor !== void 0) verticalAlign = anchorToVerticalAlign[b.anchor];
401
+ }
402
+ const insets = readOoxmlBoxInsets({
403
+ rawAttrs: rawBodyPr,
404
+ attrNames: {
405
+ left: "lIns",
406
+ top: "tIns",
407
+ right: "rIns",
408
+ bottom: "bIns"
409
+ },
410
+ elementXpath: bodyPr.xpath,
411
+ location,
412
+ diagnostics
413
+ });
414
+ paddingLeft = insets.paddingLeft;
415
+ paddingTop = insets.paddingTop;
416
+ paddingRight = insets.paddingRight;
417
+ paddingBottom = insets.paddingBottom;
418
+ bodyPr.ignoreEmptyChild(A_NS, "noAutofit");
419
+ bodyPr.ignoreEmptyChild(A_NS, "spAutoFit");
420
+ bodyPr.child(A_NS, "normAutofit")?.attrsObject(["fontScale", "lnSpcReduction"]);
421
+ }
422
+ const listStyles = host === "placeholder" ? readPlaceholderListOverrides(txBody, location, diagnostics) : readRichTextListStyles(txBody, location, diagnostics);
423
+ const importedParagraphs = txBody.children(A_NS, "p").map((pCursor) => readParagraph(pCursor, location, diagnostics, listStyles, ancestorDecorations, host));
424
+ return {
425
+ boxStyle: {
426
+ ...paddingTop === void 0 ? {} : { paddingTop },
427
+ ...paddingRight === void 0 ? {} : { paddingRight },
428
+ ...paddingBottom === void 0 ? {} : { paddingBottom },
429
+ ...paddingLeft === void 0 ? {} : { paddingLeft },
430
+ ...verticalAlign === void 0 ? {} : { verticalAlign },
431
+ ...textWrap === void 0 ? {} : { textWrap }
432
+ },
433
+ importedParagraphs
434
+ };
435
+ }
436
+ /** Returns a flat TextStyle only when one whole paragraph can be expressed on the host. */
437
+ function promoteSingleParagraph(paragraphs) {
438
+ if (paragraphs.length !== 1) return void 0;
439
+ const paragraph = paragraphs[0];
440
+ const { list, marginLeft, indent } = paragraph.style;
441
+ if (list !== void 0 || marginLeft !== void 0 || indent !== void 0) return void 0;
442
+ const run = paragraph.runs[0];
443
+ if (paragraph.runs.length > 1 || run !== void 0 && (run.kind !== "text" || run.style.baselineShift !== void 0)) return void 0;
444
+ return {
445
+ style: Object.fromEntries(Object.entries({
446
+ ...paragraph.style,
447
+ ...run?.style
448
+ }).filter(([key]) => textStyleKeys.has(key))),
449
+ ...run === void 0 ? {} : { text: run.text }
450
+ };
451
+ }
452
+ /** Populates a `RichTextContainer` (`TextNode`, `ShapeNode`, `CellNode`, `NotesNode`) from imported paragraphs. */
453
+ function populateRichTextNode(target, importedParagraphs) {
454
+ const paragraphNodes = importedParagraphs.map((para) => {
455
+ const pNode = createParagraphNode(Object.keys(para.style).length === 0 ? {} : { style: para.style });
456
+ if (para.runs.length === 1 && para.runs[0].kind === "text" && Object.keys(para.runs[0].style).length === 0) pNode.content(para.runs[0].text);
457
+ else if (para.runs.length > 0) pNode.content(...para.runs.map((run) => {
458
+ const runProps = Object.keys(run.style).length === 0 ? {} : { style: run.style };
459
+ if (run.kind === "slide-number") return createSlideNumberNode(runProps);
460
+ if (run.kind === "date-time") return createDateTimeNode({
461
+ ...runProps,
462
+ format: run.format
463
+ });
464
+ if (run.kind === "sup") return createSupNode(runProps).content(run.text);
465
+ if (run.kind === "sub") return createSubNode(runProps).content(run.text);
466
+ return Object.keys(run.style).length === 0 ? run.text : createSpanNode({ style: run.style }).content(run.text);
467
+ }));
468
+ return pNode;
469
+ });
470
+ target.content(...paragraphNodes);
471
+ }
472
+ export { populateRichTextNode, promoteSingleParagraph, readRichTextBody, textFieldDateTimeImportHandler, textFieldSlideNumImportHandler };