@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,44 +0,0 @@
1
- import { slideBackgroundSchema } from "../../../core/dist/author-schemas.js";
2
- import "../../../codegen/dist/index.js";
3
- import { defineSlideCodegen, expr } from "../../../codegen/dist/types.js";
4
- import "../../../core/dist/capability.js";
5
- import { serializeImageDescriptorValue } from "../image/image-codegen.js";
6
- // ../capabilities/dist/slide-background/slide-background-codegen.js
7
- function isPlainObject(value) {
8
- if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
9
- const proto = Object.getPrototypeOf(value);
10
- return proto === Object.prototype || proto === null;
11
- }
12
- /**
13
- * Serializes `LinearGradient` and `RadialGradient` author values back into `linearGradient(...)`
14
- * and `radialGradient(...)` calls so gradients in `Slide.background` and `VisualStyle.backgroundImage`
15
- * round-trip idiomatically.
16
- */
17
- function serializeGradientValue(value, ctx) {
18
- if (!isPlainObject(value)) return void 0;
19
- const type = value["type"];
20
- if (type !== "linear-gradient" && type !== "radial-gradient") return;
21
- const definedKeys = Object.keys(value).filter((key) => value[key] !== void 0);
22
- const subPath = ctx.path.includes("@") ? void 0 : "@style.backgroundImage";
23
- if (type === "linear-gradient") {
24
- if (!definedKeys.every((key) => key === "type" || key === "angle" || key === "stops") || typeof value["angle"] !== "number" || !Array.isArray(value["stops"])) return;
25
- const fn = ctx.useImport("linearGradient");
26
- const angleExpr = ctx.emitValueExpr(value["angle"], subPath);
27
- const stopExprs = value["stops"].map((stop) => ctx.emitValueExpr(stop, subPath));
28
- return expr(ctx.formatVanillaCall(fn, [angleExpr, ...stopExprs]));
29
- }
30
- if (!definedKeys.every((key) => key === "type" || key === "stops") || !Array.isArray(value["stops"])) return;
31
- const fn = ctx.useImport("radialGradient");
32
- const stopExprs = value["stops"].map((stop) => ctx.emitValueExpr(stop, subPath));
33
- return expr(ctx.formatVanillaCall(fn, stopExprs));
34
- }
35
- /** Source codegen contribution for `Slide.background` / `SlideMaster.background` / `SlideLayout.background` and gradients. */
36
- const slideBackgroundCodegen = defineSlideCodegen({
37
- slideProps: { background: (value, ctx) => {
38
- const parsed = slideBackgroundSchema.safeParse(value);
39
- if (!parsed.success) ctx.fail("unexpressible-value", parsed.error.issues[0]?.message ?? "Slide.background declaration is invalid");
40
- return expr(ctx.emitValueExpr(parsed.data));
41
- } },
42
- valueSerializers: [serializeGradientValue, serializeImageDescriptorValue]
43
- });
44
- export { serializeGradientValue, slideBackgroundCodegen };
@@ -1,21 +0,0 @@
1
- import { resolvedColorXml, xmlEscape } from "../../../emit/dist/ooxml.js";
2
- import "../../../emit/dist/index.js";
3
- import { gradientFillXml } from "../shared/visual.js";
4
- // ../capabilities/dist/slide-background/slide-background-xml.js
5
- /** Internal PresentationML slide background wrapper for a resolved solid color. */
6
- function slideBackgroundSolidXml(color) {
7
- return `<p:bg><p:bgPr><a:solidFill>${resolvedColorXml(color)}</a:solidFill><a:effectLst/></p:bgPr></p:bg>`;
8
- }
9
- /** Internal PresentationML slide background wrapper for a resolved gradient. */
10
- function slideBackgroundGradientXml(gradient) {
11
- return `<p:bg><p:bgPr>${gradientFillXml(gradient)}<a:effectLst/></p:bgPr></p:bg>`;
12
- }
13
- /** Internal PresentationML slide background wrapper for a registered image relationship. */
14
- function slideBackgroundImageXml(relationshipId) {
15
- return `<p:bg><p:bgPr><a:blipFill><a:blip r:embed="${xmlEscape(relationshipId)}"/><a:srcRect/><a:stretch><a:fillRect/></a:stretch></a:blipFill><a:effectLst/></p:bgPr></p:bg>`;
16
- }
17
- /** Internal PresentationML slide background wrapper for a `<p:bgRef>` theme format-scheme reference. */
18
- function slideBackgroundRefXml(idx, color) {
19
- return `<p:bg><p:bgRef idx="${idx}">${resolvedColorXml(color)}</p:bgRef></p:bg>`;
20
- }
21
- export { slideBackgroundGradientXml, slideBackgroundImageXml, slideBackgroundRefXml, slideBackgroundSolidXml };
@@ -1,81 +0,0 @@
1
- import "../../../codegen/dist/index.js";
2
- import { defineObjectCodegen } from "../../../codegen/dist/types.js";
3
- import { CommonNode } from "../../../core/dist/document.js";
4
- import { blockRichTextChildKinds, collectRichTextNodeProps, createRichTextCodegenHandler } from "../text/text-codegen.js";
5
- import { cellDeclarationPropsSchema, rowDeclarationPropsSchema, tableColumnSchema, tableDeclarationPropsSchema } from "./table-schemas.js";
6
- // ../capabilities/dist/table/table-codegen.js
7
- const tableAllowedPropKeys = new Set(Object.keys(tableDeclarationPropsSchema.unwrap().shape));
8
- const rowAllowedPropKeys = new Set(Object.keys(rowDeclarationPropsSchema.unwrap().shape));
9
- const cellAllowedPropKeys = new Set(Object.keys(cellDeclarationPropsSchema.unwrap().shape));
10
- function validateTableColumns(node, ctx) {
11
- const columns = node.props["columns"];
12
- if (!Array.isArray(columns) || columns.length === 0) ctx.fail("invalid-document", "table declaration requires a non-empty columns array", "@columns");
13
- for (const [index, column] of columns.entries()) {
14
- if (typeof column === "number" && !Number.isFinite(column)) ctx.fail("unexpressible-value", `Non-finite number ${String(column)} cannot be expressed in TypeScript`, `@columns[${index}]`);
15
- if (!tableColumnSchema.safeParse(column).success) ctx.fail("invalid-document", `Invalid table column track at index ${index}`, `@columns[${index}]`);
16
- }
17
- }
18
- function emitTableContainerChildren(node, ctx, expectedChildType) {
19
- const children = [];
20
- let childIndex = 0;
21
- for (const child of node.children) {
22
- if (!(child instanceof CommonNode)) {
23
- if (child.type === "#text" && "text" in child && child.text.trim() !== "") ctx.fail("invalid-document", `${node.type} declaration cannot directly contain text content`);
24
- continue;
25
- }
26
- if (child.type !== expectedChildType) {
27
- const label = child.id === void 0 ? `${child.type}[${childIndex + 1}]` : `${child.type}[${child.id}]`;
28
- ctx.fail("invalid-document", `${node.type} declaration cannot contain ${JSON.stringify(child.type)} child`, `${ctx.path}/${label}`);
29
- }
30
- children.push(ctx.emitChildNode(child, childIndex));
31
- childIndex += 1;
32
- }
33
- return children;
34
- }
35
- /**
36
- * Source codegen contribution for native `table`, `row`, and `cell` declarations.
37
- *
38
- * Preserves column tracks (`px` / `"auto"` / `"Nfr"`), row order, `rowSpan`/`colSpan`
39
- * merges, layer-local styles and borders, placeholder bindings, and cell rich text.
40
- */
41
- const tableCodegen = defineObjectCodegen({ declarations: {
42
- table: {
43
- emitVanilla(node, ctx) {
44
- validateTableColumns(node, ctx);
45
- const callee = ctx.useImport("table");
46
- const propsEntries = collectRichTextNodeProps(node, ctx, tableAllowedPropKeys, true);
47
- const rows = emitTableContainerChildren(node, ctx, "row");
48
- return ctx.formatVanillaCall(callee, [ctx.formatProps(propsEntries)], rows);
49
- },
50
- emitReact(node, ctx) {
51
- validateTableColumns(node, ctx);
52
- const tag = ctx.useImport("Table");
53
- const propsEntries = collectRichTextNodeProps(node, ctx, tableAllowedPropKeys, true);
54
- const rows = emitTableContainerChildren(node, ctx, "row");
55
- return ctx.formatJsxElement(tag, propsEntries, rows);
56
- }
57
- },
58
- row: {
59
- emitVanilla(node, ctx) {
60
- const callee = ctx.useImport("row");
61
- const propsEntries = collectRichTextNodeProps(node, ctx, rowAllowedPropKeys, false);
62
- const cells = emitTableContainerChildren(node, ctx, "cell");
63
- const args = propsEntries.length === 0 ? [] : [ctx.formatProps(propsEntries)];
64
- return ctx.formatVanillaCall(callee, args, cells);
65
- },
66
- emitReact(node, ctx) {
67
- const tag = ctx.useImport("Row");
68
- const propsEntries = collectRichTextNodeProps(node, ctx, rowAllowedPropKeys, false);
69
- const cells = emitTableContainerChildren(node, ctx, "cell");
70
- return ctx.formatJsxElement(tag, propsEntries, cells);
71
- }
72
- },
73
- cell: createRichTextCodegenHandler({
74
- vanillaFactory: "cell",
75
- reactComponent: "Cell",
76
- allowedPropKeys: cellAllowedPropKeys,
77
- allowedChildKinds: blockRichTextChildKinds,
78
- supportObjectExtras: false
79
- })
80
- } });
81
- export { tableCodegen };
@@ -1,279 +0,0 @@
1
- import { CapabilityError } from "../../../core/dist/diagnostics.js";
2
- import { layoutStyleSchema } from "../../../core/dist/layout-schemas.js";
3
- import { colorValueSchema, textStyleSchema } from "../../../core/dist/theme.js";
4
- import { linkTargetSchema } from "../../../core/dist/author-schemas.js";
5
- import { nativePlaceholderRefSchema } from "../../../core/dist/placeholders.js";
6
- import "../../../core/dist/capability.js";
7
- import { pxToEmu } from "../../../emit/dist/ooxml.js";
8
- import "../../../emit/dist/index.js";
9
- import "../../../import/dist/index.js";
10
- import { ooxmlBoolSchema, ooxmlNonNegativeIntSchema, ooxmlPositiveIntSchema } from "../../../import/dist/xml-fragments.js";
11
- import { motionPropsSchema } from "../motion/motion-schemas.js";
12
- import { optionalNameSchema } from "../shared/identity.js";
13
- import { morphKeySchema } from "../shared/morph-api.js";
14
- import { parseTextInsets, textCoordinateSchema, textPaddingValueSchema, textPositiveSizeSchema } from "../shared/text-schemas.js";
15
- import { z } from "zod";
16
- // ../capabilities/dist/table/table-schemas.js
17
- const frColumnPattern = /^\d+(?:\.\d+)?fr$/u;
18
- const maximumExtentEmu = 2147483647;
19
- const tableVerticalAlignSchema = z.enum([
20
- "top",
21
- "middle",
22
- "bottom"
23
- ]);
24
- const tableColumnPxSchema = z.number().finite().positive();
25
- const tableColumnFrSchema = z.string().regex(frColumnPattern).refine((value) => Number(value.slice(0, -2)) > 0);
26
- /** Column width in px; Nfr allocates from remaining width, auto uses shared font measurement. */
27
- const tableColumnSchema = z.union([
28
- tableColumnPxSchema,
29
- tableColumnFrSchema,
30
- z.literal("auto")
31
- ]);
32
- const nonNegativeTableInsetSchema = z.number().finite().nonnegative().refine((value) => Number.isSafeInteger(pxToEmu(value)));
33
- z.union([
34
- nonNegativeTableInsetSchema,
35
- z.tuple([nonNegativeTableInsetSchema, nonNegativeTableInsetSchema]).readonly(),
36
- z.tuple([
37
- nonNegativeTableInsetSchema,
38
- nonNegativeTableInsetSchema,
39
- nonNegativeTableInsetSchema,
40
- nonNegativeTableInsetSchema
41
- ]).readonly()
42
- ]);
43
- const coreTextStyleShape = textStyleSchema.unwrap().shape;
44
- const tableTextStyleObjectSchema = z.strictObject({
45
- fontFamily: coreTextStyleShape.fontFamily,
46
- fontSize: coreTextStyleShape.fontSize,
47
- fontWeight: coreTextStyleShape.fontWeight,
48
- fontStyle: coreTextStyleShape.fontStyle,
49
- color: coreTextStyleShape.color,
50
- lineHeight: coreTextStyleShape.lineHeight,
51
- verticalAlign: coreTextStyleShape.verticalAlign,
52
- letterSpacing: coreTextStyleShape.letterSpacing,
53
- textTransform: coreTextStyleShape.textTransform,
54
- textDecoration: coreTextStyleShape.textDecoration,
55
- textShadow: coreTextStyleShape.textShadow,
56
- lang: coreTextStyleShape.lang
57
- });
58
- tableTextStyleObjectSchema.readonly();
59
- const tableStyleSchema = z.strictObject({
60
- ...tableTextStyleObjectSchema.shape,
61
- ...layoutStyleSchema.unwrap().shape
62
- }).readonly();
63
- const tableRowOwnStyleObjectSchema = z.strictObject({
64
- /** When unspecified, row height is determined from text measurement of unmerged cells in this row. */
65
- height: textPositiveSizeSchema.optional(),
66
- backgroundColor: colorValueSchema.optional()
67
- });
68
- const tableRowStyleSchema = z.strictObject({
69
- ...tableTextStyleObjectSchema.shape,
70
- ...tableRowOwnStyleObjectSchema.shape
71
- }).readonly();
72
- const tableBorderStyleSchema = z.enum([
73
- "solid",
74
- "dashed",
75
- "dotted"
76
- ]);
77
- const tableCellOwnStyleObjectSchema = z.strictObject({
78
- backgroundColor: colorValueSchema.optional(),
79
- borderColor: colorValueSchema.optional(),
80
- borderWidth: z.number().finite().nonnegative().optional(),
81
- borderStyle: tableBorderStyleSchema.optional(),
82
- padding: textPaddingValueSchema.optional(),
83
- paddingTop: z.number().finite().nonnegative().optional(),
84
- paddingRight: z.number().finite().nonnegative().optional(),
85
- paddingBottom: z.number().finite().nonnegative().optional(),
86
- paddingLeft: z.number().finite().nonnegative().optional()
87
- });
88
- const tableCellStyleSchema = z.strictObject({
89
- ...tableTextStyleObjectSchema.shape,
90
- ...tableCellOwnStyleObjectSchema.shape
91
- }).readonly();
92
- const tableMergeSpanSchema = z.number().int().min(1);
93
- const motionPropsShape = motionPropsSchema.unwrap().shape;
94
- const tableDeclarationPropsObjectSchema = z.strictObject({
95
- id: optionalNameSchema.optional(),
96
- name: optionalNameSchema.optional(),
97
- placeholder: z.string().optional(),
98
- nativePlaceholder: nativePlaceholderRefSchema.optional(),
99
- morphKey: morphKeySchema.optional(),
100
- link: linkTargetSchema.optional(),
101
- x: textCoordinateSchema.optional(),
102
- y: textCoordinateSchema.optional(),
103
- /** Provides allocatable width for fr columns; when omitted, all columns are sized to natural content width. */
104
- width: textPositiveSizeSchema.optional(),
105
- columns: z.array(tableColumnSchema).nonempty().readonly(),
106
- style: tableStyleSchema.optional(),
107
- enter: motionPropsShape.enter,
108
- emphasis: motionPropsShape.emphasis,
109
- motion: motionPropsShape.motion
110
- });
111
- const tableDeclarationPropsSchema = tableDeclarationPropsObjectSchema.readonly();
112
- const rowDeclarationPropsObjectSchema = z.strictObject({
113
- id: optionalNameSchema.optional(),
114
- style: tableRowStyleSchema.optional()
115
- });
116
- const rowDeclarationPropsSchema = rowDeclarationPropsObjectSchema.readonly();
117
- const cellDeclarationPropsObjectSchema = z.strictObject({
118
- id: optionalNameSchema.optional(),
119
- colSpan: tableMergeSpanSchema.optional(),
120
- rowSpan: tableMergeSpanSchema.optional(),
121
- style: tableCellStyleSchema.optional()
122
- });
123
- const cellDeclarationPropsSchema = cellDeclarationPropsObjectSchema.readonly();
124
- const tableAllowedParameters = [...Object.keys(tableDeclarationPropsObjectSchema.shape), "children"];
125
- const rowAllowedParameters = Object.keys(rowDeclarationPropsObjectSchema.shape);
126
- const cellAllowedParameters = Object.keys(cellDeclarationPropsObjectSchema.shape);
127
- const tableTextStyleKeys = Object.keys(tableTextStyleObjectSchema.shape);
128
- const tableStyleKeys = Object.keys(tableStyleSchema.unwrap().shape);
129
- const rowStyleKeys = Object.keys(tableRowOwnStyleObjectSchema.shape);
130
- const cellStyleKeys = Object.keys(tableCellOwnStyleObjectSchema.shape);
131
- /** OOXML `<p:cNvPr>` attribute fragment schema inside `<p:graphicFrame>`. */
132
- const nonVisualGraphicFrameIdSchema = z.object({
133
- id: ooxmlNonNegativeIntSchema,
134
- name: z.string().optional()
135
- });
136
- /** OOXML `<a:graphicFrameLocks>` attribute fragment schema. */
137
- const graphicFrameLocksXmlSchema = z.object({
138
- noGrp: ooxmlBoolSchema.optional(),
139
- noDrilldown: ooxmlBoolSchema.optional(),
140
- noSelect: ooxmlBoolSchema.optional(),
141
- noChangeAspect: ooxmlBoolSchema.optional(),
142
- noMove: ooxmlBoolSchema.optional(),
143
- noResize: ooxmlBoolSchema.optional()
144
- });
145
- /** OOXML `<a:tblPr>` attribute fragment schema. */
146
- const tblPrXmlSchema = z.object({
147
- firstRow: ooxmlBoolSchema.optional(),
148
- firstCol: ooxmlBoolSchema.optional(),
149
- lastRow: ooxmlBoolSchema.optional(),
150
- lastCol: ooxmlBoolSchema.optional(),
151
- bandRow: ooxmlBoolSchema.optional(),
152
- bandCol: ooxmlBoolSchema.optional(),
153
- rtl: ooxmlBoolSchema.optional()
154
- });
155
- /** OOXML `<a:gridCol w="..."/>` fragment schema. */
156
- const tblGridColXmlSchema = z.object({ w: ooxmlPositiveIntSchema });
157
- /** OOXML `<a:tr h="..."/>` fragment schema. */
158
- const tblRowXmlSchema = z.object({ h: ooxmlPositiveIntSchema });
159
- /** OOXML `<a:tc gridSpan="..." rowSpan="..." hMerge="..." vMerge="..."/>` fragment schema. */
160
- const tblCellXmlSchema = z.object({
161
- gridSpan: ooxmlPositiveIntSchema.optional(),
162
- rowSpan: ooxmlPositiveIntSchema.optional(),
163
- hMerge: ooxmlBoolSchema.optional(),
164
- vMerge: ooxmlBoolSchema.optional()
165
- });
166
- /** OOXML `<a:tcPr .../>` attribute fragment schema. */
167
- const tblCellPrXmlSchema = z.object({
168
- marL: ooxmlNonNegativeIntSchema.optional(),
169
- marR: ooxmlNonNegativeIntSchema.optional(),
170
- marT: ooxmlNonNegativeIntSchema.optional(),
171
- marB: ooxmlNonNegativeIntSchema.optional(),
172
- anchor: z.enum([
173
- "t",
174
- "ctr",
175
- "b"
176
- ]).optional(),
177
- vert: z.string().optional(),
178
- horzOverflow: z.string().optional(),
179
- anchorCtr: ooxmlBoolSchema.optional()
180
- });
181
- /** Validates a plain object parameter map against allowed parameter keys. */
182
- function assertAllowedTableKeys(value, allowed, label, path) {
183
- const unknown = Object.keys(value).find((key) => !allowed.includes(key));
184
- if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `${label} contains unsupported parameter ${unknown}`, path);
185
- }
186
- /** Validates an optional non-empty author ID on Row or Cell. */
187
- function parseOptionalTableId(value, path) {
188
- if (value === void 0) return void 0;
189
- const parsed = optionalNameSchema.safeParse(value);
190
- if (!parsed.success) throw new CapabilityError("invalid-parameter", "id must be a non-empty string", path);
191
- return parsed.data;
192
- }
193
- /** Validates table coordinate (`x` or `y`) via shared coordinate schema, defaulting omitted to `0`. */
194
- function parseTableCoordinate(value, label) {
195
- if (value === void 0) return 0;
196
- const parsed = textCoordinateSchema.safeParse(value);
197
- if (!parsed.success) throw new CapabilityError("invalid-table-geometry", `${label} must be a finite pixel number between -1000000 and 1000000`);
198
- return parsed.data;
199
- }
200
- /** Validates positive pixel extent (`width` or `Row.style.height`) via shared positive size schema. */
201
- function parseTablePositiveSize(value, label, path) {
202
- if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new CapabilityError("invalid-table-geometry", `${label} must be a finite positive pixel number`, path);
203
- const parsed = textPositiveSizeSchema.safeParse(value);
204
- if (!parsed.success) throw new CapabilityError("invalid-table-geometry", `${label} exceeds writable table dimension range after conversion`, path);
205
- return parsed.data;
206
- }
207
- /** Validates EMU extent bounds for resolved table tracks and borders. */
208
- function assertTableEmuExtent(value, label, path) {
209
- const emu = pxToEmu(value);
210
- if (!Number.isSafeInteger(emu) || emu < 1 || emu > maximumExtentEmu) throw new CapabilityError("invalid-table-geometry", `${label} exceeds writable table dimension range after conversion`, path);
211
- return emu;
212
- }
213
- /** Validates vertical alignment via Zod schema. */
214
- function parseTableVerticalAlign(value, path) {
215
- if (value === void 0) return void 0;
216
- const parsed = tableVerticalAlignSchema.safeParse(value);
217
- if (!parsed.success) throw new CapabilityError("invalid-vertical-align", "verticalAlign must be top, middle, or bottom", path);
218
- return parsed.data;
219
- }
220
- /** Validates non-empty `Table.columns` tracks via Zod schema. */
221
- function parseTableColumns(value) {
222
- if (!Array.isArray(value) || value.length === 0) throw new CapabilityError("invalid-table-column", "Table.columns must be a non-empty array");
223
- return value.map((column, index) => {
224
- const parsed = tableColumnSchema.safeParse(column);
225
- if (!parsed.success) {
226
- if (typeof column === "number" && (!Number.isFinite(column) || column <= 0) || typeof column === "string" && frColumnPattern.test(column) && Number(column.slice(0, -2)) <= 0) {
227
- const kindLabel = typeof column === "number" ? "width" : "fraction";
228
- throw new CapabilityError("invalid-table-column", `column ${index + 1} ${kindLabel} must be greater than 0`);
229
- }
230
- throw new CapabilityError("invalid-table-column", `Invalid width for column ${index + 1}; use positive px number, positive "Nfr", or "auto"`);
231
- }
232
- if (typeof parsed.data === "number") return {
233
- kind: "px",
234
- value: parsed.data
235
- };
236
- if (parsed.data === "auto") return { kind: "auto" };
237
- return {
238
- kind: "fr",
239
- value: Number(parsed.data.slice(0, -2))
240
- };
241
- });
242
- }
243
- /** Validates `colSpan` or `rowSpan` via Zod schema. */
244
- function parseTableMergeSpan(value, label, path) {
245
- if (value === void 0) return 1;
246
- const parsed = tableMergeSpanSchema.safeParse(value);
247
- if (!parsed.success) throw new CapabilityError("invalid-table-merge", `${label} must be a positive integer`, path);
248
- return parsed.data;
249
- }
250
- /** Validates cell padding declarations by reusing shared `parseTextInsets`. */
251
- function parseTableCellPadding(style, path) {
252
- try {
253
- return parseTextInsets(style);
254
- } catch (error) {
255
- if (error instanceof CapabilityError && error.code === "invalid-text-insets") throw new CapabilityError("invalid-table-padding", error.message, path);
256
- throw error;
257
- }
258
- }
259
- /** Validates cell border width, style, and color via Zod schemas and shared theme color resolver. */
260
- function parseTableCellBorder(style, resolveColor, theme, path) {
261
- const borderColor = resolveColor(style["borderColor"], "borderColor", path);
262
- const widthValue = style["borderWidth"];
263
- const styleValue = style["borderStyle"];
264
- if (widthValue !== void 0) {
265
- if (!z.number().finite().nonnegative().safeParse(widthValue).success) throw new CapabilityError("invalid-table-border", "borderWidth must be a finite non-negative pixel number", path);
266
- }
267
- if (styleValue !== void 0) {
268
- if (!tableBorderStyleSchema.safeParse(styleValue).success) throw new CapabilityError("invalid-table-border", "borderStyle must be solid, dashed, or dotted", path);
269
- }
270
- const width = typeof widthValue === "number" ? widthValue : borderColor === void 0 ? 0 : 1;
271
- if (width === 0) return void 0;
272
- assertTableEmuExtent(width, "borderWidth", path);
273
- return {
274
- color: borderColor ?? theme.resolveColor("dk1"),
275
- width,
276
- dash: styleValue === "dashed" ? "dash" : styleValue === "dotted" ? "dot" : "solid"
277
- };
278
- }
279
- export { assertAllowedTableKeys, assertTableEmuExtent, cellAllowedParameters, cellDeclarationPropsSchema, cellStyleKeys, graphicFrameLocksXmlSchema, nonVisualGraphicFrameIdSchema, parseOptionalTableId, parseTableCellBorder, parseTableCellPadding, parseTableColumns, parseTableCoordinate, parseTableMergeSpan, parseTablePositiveSize, parseTableVerticalAlign, rowAllowedParameters, rowDeclarationPropsSchema, rowStyleKeys, tableAllowedParameters, tableBorderStyleSchema, tableCellStyleSchema, tableColumnSchema, tableDeclarationPropsSchema, tableMergeSpanSchema, tableRowStyleSchema, tableStyleKeys, tableStyleSchema, tableTextStyleKeys, tableVerticalAlignSchema, tblCellPrXmlSchema, tblCellXmlSchema, tblGridColXmlSchema, tblPrXmlSchema, tblRowXmlSchema };
@@ -1,129 +0,0 @@
1
- import "../../../codegen/dist/index.js";
2
- import { defineObjectCodegen, expr } from "../../../codegen/dist/types.js";
3
- import { CommonNode } from "../../../core/dist/document.js";
4
- import { paragraphAuthorPropsSchema, slideNumberAuthorPropsSchema, spanAuthorPropsSchema, textAuthorPropsSchema } from "../shared/text-schemas.js";
5
- // ../capabilities/dist/text/text-codegen.js
6
- const objectMotionPropKeys = /* @__PURE__ */ new Set([
7
- "enter",
8
- "emphasis",
9
- "motion"
10
- ]);
11
- const textAllowedPropKeys = new Set(Object.keys(textAuthorPropsSchema.unwrap().shape));
12
- const paragraphAllowedPropKeys = new Set(Object.keys(paragraphAuthorPropsSchema.unwrap().shape));
13
- const spanAllowedPropKeys = new Set(Object.keys(spanAuthorPropsSchema.unwrap().shape));
14
- const slideNumberAllowedPropKeys = new Set(Object.keys(slideNumberAuthorPropsSchema.unwrap().shape));
15
- /** Container-level rich-text child declaration types allowed directly inside `Text` and `Notes`. */
16
- const blockRichTextChildKinds = /* @__PURE__ */ new Set([
17
- "paragraph",
18
- "span",
19
- "slide-number"
20
- ]);
21
- /** Inline-level rich-text child declaration types allowed inside `P` and `Span`. */
22
- const inlineRichTextChildKinds = /* @__PURE__ */ new Set(["span", "slide-number"]);
23
- function singleTextLeaf(node) {
24
- if (node.children.length !== 1) return void 0;
25
- const only = node.children[0];
26
- if (only === void 0 || only instanceof CommonNode) return void 0;
27
- const leaf = only;
28
- return leaf.type === "#text" ? leaf.text : void 0;
29
- }
30
- /** Collects and validates own defined props on a rich-text or slide-number node. */
31
- function collectRichTextNodeProps(node, ctx, allowedPropKeys, supportObjectExtras) {
32
- const extra = supportObjectExtras ? ctx.emitObjectExtraProps(node.props) : {};
33
- const entries = [];
34
- for (const [key, value] of Object.entries(node.props)) {
35
- if (value === void 0) continue;
36
- if (!allowedPropKeys.has(key)) ctx.fail("invalid-document", `${node.type} declaration does not support property ${JSON.stringify(key)}`, `@${key}`);
37
- if (supportObjectExtras && objectMotionPropKeys.has(key)) {
38
- if (Object.hasOwn(extra, key)) entries.push([key, extra[key]]);
39
- else ctx.fail("unexpressible-value", `Object property ${JSON.stringify(key)} requires motion codegen support`, `@${key}`);
40
- continue;
41
- }
42
- entries.push([key, value]);
43
- }
44
- return entries;
45
- }
46
- function assertAllowedRichTextChildren(node, ctx, allowedChildKinds) {
47
- let childIndex = 0;
48
- for (const child of node.children) {
49
- if (!(child instanceof CommonNode)) continue;
50
- const label = child.id === void 0 ? `${child.type}[${childIndex + 1}]` : `${child.type}[${child.id}]`;
51
- if (!allowedChildKinds.has(child.type)) ctx.fail("invalid-document", `${node.type} declaration cannot contain ${JSON.stringify(child.type)} child`, `${ctx.path}/${label}`);
52
- childIndex += 1;
53
- }
54
- }
55
- /**
56
- * Creates a dual-target (`vanilla` / `react`) codegen handler for a rich-text container node
57
- * (`Text`, `P`, `Span`, or `Notes`), validating props and child declaration types.
58
- */
59
- function createRichTextCodegenHandler(options) {
60
- return {
61
- emitVanilla(node, ctx) {
62
- assertAllowedRichTextChildren(node, ctx, options.allowedChildKinds);
63
- const callee = ctx.useImport(options.vanillaFactory);
64
- const propsEntries = collectRichTextNodeProps(node, ctx, options.allowedPropKeys, options.supportObjectExtras);
65
- const leafText = singleTextLeaf(node);
66
- if (leafText !== void 0) {
67
- const args = propsEntries.length === 0 ? [JSON.stringify(leafText)] : [JSON.stringify(leafText), ctx.formatProps(propsEntries)];
68
- return ctx.formatVanillaCall(callee, args);
69
- }
70
- if (node.children.length === 0) {
71
- const args = propsEntries.length === 0 ? [] : ["[]", ctx.formatProps(propsEntries)];
72
- return ctx.formatVanillaCall(callee, args);
73
- }
74
- const children = ctx.emitRichTextChildren(node.children);
75
- if (propsEntries.length === 0) return ctx.formatVanillaCall(callee, [], children);
76
- const contentArg = ctx.emitValueExpr(children.map((code) => expr(code)));
77
- return ctx.formatVanillaCall(callee, [contentArg, ctx.formatProps(propsEntries)]);
78
- },
79
- emitReact(node, ctx) {
80
- assertAllowedRichTextChildren(node, ctx, options.allowedChildKinds);
81
- const tag = ctx.useImport(options.reactComponent);
82
- const propsEntries = collectRichTextNodeProps(node, ctx, options.allowedPropKeys, options.supportObjectExtras);
83
- const children = ctx.emitRichTextChildren(node.children);
84
- return ctx.formatJsxElement(tag, propsEntries, children);
85
- }
86
- };
87
- }
88
- function emitSlideNumberProps(node, ctx) {
89
- if (node.children.length > 0) ctx.fail("invalid-document", "SlideNumber declaration cannot have children");
90
- return collectRichTextNodeProps(node, ctx, slideNumberAllowedPropKeys, false);
91
- }
92
- /** Source codegen contribution for `text`, `paragraph`, `span`, and `slide-number` declarations. */
93
- const textCodegen = defineObjectCodegen({ declarations: {
94
- text: createRichTextCodegenHandler({
95
- vanillaFactory: "text",
96
- reactComponent: "Text",
97
- allowedPropKeys: textAllowedPropKeys,
98
- allowedChildKinds: blockRichTextChildKinds,
99
- supportObjectExtras: true
100
- }),
101
- paragraph: createRichTextCodegenHandler({
102
- vanillaFactory: "paragraph",
103
- reactComponent: "P",
104
- allowedPropKeys: paragraphAllowedPropKeys,
105
- allowedChildKinds: inlineRichTextChildKinds,
106
- supportObjectExtras: false
107
- }),
108
- span: createRichTextCodegenHandler({
109
- vanillaFactory: "span",
110
- reactComponent: "Span",
111
- allowedPropKeys: spanAllowedPropKeys,
112
- allowedChildKinds: inlineRichTextChildKinds,
113
- supportObjectExtras: false
114
- }),
115
- "slide-number": {
116
- emitVanilla(node, ctx) {
117
- const callee = ctx.useImport("slideNumber");
118
- const propsEntries = emitSlideNumberProps(node, ctx);
119
- const args = propsEntries.length === 0 ? [] : [ctx.formatProps(propsEntries)];
120
- return ctx.formatVanillaCall(callee, args);
121
- },
122
- emitReact(node, ctx) {
123
- const tag = ctx.useImport("SlideNumber");
124
- const propsEntries = emitSlideNumberProps(node, ctx);
125
- return ctx.formatJsxElement(tag, propsEntries, []);
126
- }
127
- }
128
- } });
129
- export { blockRichTextChildKinds, collectRichTextNodeProps, createRichTextCodegenHandler, inlineRichTextChildKinds, textCodegen };
@@ -1,19 +0,0 @@
1
- import { CommonNode, RichTextContainer } from "../../../core/dist/document.js";
2
- // ../capabilities/dist/text/text-declaration.js
3
- /** Creates the editable text box shared by the command factory and the Text JSX element. */
4
- function createTextNode(props) {
5
- return new RichTextContainer("text", "text", props);
6
- }
7
- /** Creates the editable paragraph shared by P JSX and command authoring. */
8
- function createParagraphNode(props) {
9
- return new RichTextContainer("paragraph", "paragraph", props);
10
- }
11
- /** Creates the editable span shared by Span JSX and command authoring. */
12
- function createSpanNode(props) {
13
- return new RichTextContainer("span", "span", props);
14
- }
15
- /** Creates the editable slide number field shared by the command factory and JSX element. */
16
- function createSlideNumberNode(props) {
17
- return new CommonNode("slide-number", "slide-number", props);
18
- }
19
- export { createParagraphNode, createSlideNumberNode, createSpanNode, createTextNode };
@@ -1,38 +0,0 @@
1
- import { hostNodeCreator } from "../../../core/dist/host.js";
2
- import { motionElement } from "../motion/motion-elements.js";
3
- import { createParagraphNode, createSlideNumberNode, createSpanNode, createTextNode } from "./text-declaration.js";
4
- import { createElement } from "react";
5
- // ../capabilities/dist/text/text-elements.js
6
- /** Native text box; numeric height preserves a fixed region, while auto height uses explicit font measurement. */
7
- function Text(props) {
8
- return motionElement("text", {
9
- ...props,
10
- [hostNodeCreator]: createTextNode
11
- });
12
- }
13
- /** Declares a native paragraph within a text box, with line spacing and paragraph list semantics. */
14
- function P(props) {
15
- return createElement("paragraph", {
16
- ...props,
17
- [hostNodeCreator]: createParagraphNode
18
- }, props.children);
19
- }
20
- /** Declares an individually styled text run within a paragraph. */
21
- function Span(props) {
22
- return createElement("span", {
23
- ...props,
24
- [hostNodeCreator]: createSpanNode
25
- }, props.children);
26
- }
27
- /** Emits a native slide number field resolved by presentation applications. */
28
- function SlideNumber(props) {
29
- return createElement("slide-number", {
30
- ...props,
31
- [hostNodeCreator]: createSlideNumberNode
32
- });
33
- }
34
- const inlineTextMarker = Symbol.for("@pptxdk/text-inline-element");
35
- Object.defineProperty(P, inlineTextMarker, { value: true });
36
- Object.defineProperty(Span, inlineTextMarker, { value: true });
37
- Object.defineProperty(SlideNumber, inlineTextMarker, { value: true });
38
- export { P, SlideNumber, Span, Text };