@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,18 +1,75 @@
1
- import { CapabilityError } from "../../../core/dist/diagnostics.js";
2
- import { customGeometrySchema, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, presetGeometryNameSchema, presetGeometryTuple } from "../../../core/dist/geometry-schemas.js";
3
- import "../../../core/dist/capability.js";
4
- import { pxToEmu } from "../../../emit/dist/ooxml.js";
5
- import "../../../emit/dist/index.js";
6
- import { A_NS } from "../../../import/dist/namespaces.js";
7
- import { ooxmlBoolSchema, ooxmlIntSchema, ooxmlPositiveIntSchema } from "../../../import/dist/xml-fragments.js";
8
- import "../../../import/dist/index.js";
1
+ import { CapabilityError, zodIssueField } from "../../kernel/diagnostics.js";
2
+ import { emuToPx, pxToEmu } from "../../kernel/drawing-units.js";
3
+ import { customGeometrySchema, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, presetGeometryNameSchema, presetGeometryTuple } from "../../kernel/geometry-schemas.js";
4
+ import "../../kernel/capability.js";
5
+ import "../../kernel/pptx-read/index.js";
6
+ import { A_NS } from "../../kernel/pptx-read/namespaces.js";
7
+ import { ooxmlBoolSchema, ooxmlIntSchema, ooxmlPositiveIntSchema } from "../../kernel/pptx-read/xml-fragments.js";
8
+ import "../../kernel/pptx-write/xml.js";
9
9
  import { presetDefinitions } from "./preset-definitions.js";
10
10
  import { z } from "zod";
11
- // ../capabilities/dist/shared/geometry.js
11
+ // ../core/dist/capabilities/shared/geometry.js
12
+ const STANDARD_CARDINAL_CXN = [
13
+ ["hc", "t"],
14
+ ["l", "vc"],
15
+ ["hc", "b"],
16
+ ["r", "vc"]
17
+ ];
18
+ /** Returns the 4 standard cardinal connection sites (top, left, bottom, right) for an un-transformed box. */
19
+ function standardBoxConnectionSites(box) {
20
+ const cx = box.x + box.width / 2;
21
+ const cy = box.y + box.height / 2;
22
+ return [
23
+ {
24
+ x: cx,
25
+ y: box.y
26
+ },
27
+ {
28
+ x: box.x,
29
+ y: cy
30
+ },
31
+ {
32
+ x: cx,
33
+ y: box.y + box.height
34
+ },
35
+ {
36
+ x: box.x + box.width,
37
+ y: cy
38
+ }
39
+ ];
40
+ }
41
+ /** Applies flipH, flipV, and clockwise rotation (degrees) around `box` center to a list of points. */
42
+ function applyTransformToPoints(points, box, transform) {
43
+ const flipH = transform?.flipH ?? false;
44
+ const flipV = transform?.flipV ?? false;
45
+ const angleDeg = transform?.rotate ?? transform?.angle ?? 0;
46
+ if (!flipH && !flipV && angleDeg === 0) return points;
47
+ const cx = box.x + box.width / 2;
48
+ const cy = box.y + box.height / 2;
49
+ const rad = angleDeg * Math.PI / 180;
50
+ const cos = Math.cos(rad);
51
+ const sin = Math.sin(rad);
52
+ return points.map((pt) => {
53
+ const dx = (pt.x - cx) * (flipH ? -1 : 1);
54
+ const dy = (pt.y - cy) * (flipV ? -1 : 1);
55
+ return {
56
+ x: cx + dx * cos - dy * sin,
57
+ y: cy + dx * sin + dy * cos
58
+ };
59
+ });
60
+ }
61
+ /** Returns the ECMA-376 / custom connection site count for an author `Geometry` value. */
62
+ function getGeometryConnectionSiteCount(geometry) {
63
+ if (geometry === void 0) return 4;
64
+ if (typeof geometry === "string") return (presetDefinitions[geometry]?.cxn ?? STANDARD_CARDINAL_CXN).length;
65
+ if (geometry.type === "preset") return (presetDefinitions[geometry.name]?.cxn ?? STANDARD_CARDINAL_CXN).length;
66
+ if (geometry.connectionSites !== void 0) return geometry.connectionSites.length;
67
+ return 4;
68
+ }
12
69
  /** Complete DrawingML preset geometry enumeration from ECMA-376 ST_ShapeType. */
13
70
  const presetGeometryNames = new Set(presetGeometryTuple);
14
- function invalidGeometry(message) {
15
- throw new CapabilityError("invalid-geometry", message);
71
+ function invalidGeometry(message, field = "geometry") {
72
+ throw new CapabilityError("invalid-geometry", message, void 0, { field });
16
73
  }
17
74
  function preset(name, adjust) {
18
75
  if (!presetGeometryNameSchema.safeParse(name).success) throw new CapabilityError("unsupported-geometry", `Unsupported preset geometry ${String(name)}`);
@@ -503,34 +560,57 @@ function isRecord(value) {
503
560
  return typeof value === "object" && value !== null && !Array.isArray(value);
504
561
  }
505
562
  function finiteGeometryNumber(value, label) {
506
- if (typeof value !== "number" || !Number.isFinite(value)) throw new CapabilityError("invalid-visual-style", `${label} must be a finite number`);
563
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new CapabilityError("invalid-visual-style", `${label} must be a finite number`, void 0, { field: label });
507
564
  return value;
508
565
  }
566
+ /** Checks whether a path coordinate in point units (`value * 1000`) stays within DrawingML signed 32-bit bounds excluding `-2^31`. */
567
+ function isValidPathUnit(value) {
568
+ const units = Math.round(value * 1e3);
569
+ return Number.isSafeInteger(units) && Math.abs(units) <= 2147483647;
570
+ }
571
+ /** Checks whether a custom path viewBox dimension (`value * 1000`) stays strictly positive and within DrawingML bounds. */
572
+ function isValidPositivePathExtent(value) {
573
+ const units = Math.round(value * 1e3);
574
+ return Number.isSafeInteger(units) && units >= 1 && units <= 2147483647;
575
+ }
576
+ /** Checks whether every coordinate in a custom path stays within DrawingML path coordinate bounds. */
577
+ function arePathCommandsBounded(commands) {
578
+ return commands.every((cmd) => {
579
+ switch (cmd.op) {
580
+ case "Z": return true;
581
+ case "M":
582
+ case "L": return isValidPathUnit(cmd.x) && isValidPathUnit(cmd.y);
583
+ case "Q": return isValidPathUnit(cmd.x1) && isValidPathUnit(cmd.y1) && isValidPathUnit(cmd.x) && isValidPathUnit(cmd.y);
584
+ case "C": return isValidPathUnit(cmd.x1) && isValidPathUnit(cmd.y1) && isValidPathUnit(cmd.x2) && isValidPathUnit(cmd.y2) && isValidPathUnit(cmd.x) && isValidPathUnit(cmd.y);
585
+ default: return false;
586
+ }
587
+ });
588
+ }
509
589
  function pointUnit(value, label) {
510
590
  const coordinate = Math.round(finiteGeometryNumber(value, label) * 1e3);
511
- if (!Number.isSafeInteger(coordinate) || Math.abs(coordinate) > 2147483647) invalidGeometry(`${label} exceeds DrawingML path coordinate range after conversion`);
591
+ if (!Number.isSafeInteger(coordinate) || Math.abs(coordinate) > 2147483647) invalidGeometry(`${label} exceeds DrawingML path coordinate range after conversion`, label);
512
592
  return String(coordinate);
513
593
  }
514
- function validatePathCommand(command) {
594
+ function validatePathCommand(command, field) {
515
595
  switch (command.op) {
516
596
  case "M":
517
597
  case "L":
518
- pointUnit(command.x, "path.x");
519
- pointUnit(command.y, "path.y");
598
+ pointUnit(command.x, `${field}.x`);
599
+ pointUnit(command.y, `${field}.y`);
520
600
  return;
521
601
  case "C":
522
- pointUnit(command.x1, "path.x1");
523
- pointUnit(command.y1, "path.y1");
524
- pointUnit(command.x2, "path.x2");
525
- pointUnit(command.y2, "path.y2");
526
- pointUnit(command.x, "path.x");
527
- pointUnit(command.y, "path.y");
602
+ pointUnit(command.x1, `${field}.x1`);
603
+ pointUnit(command.y1, `${field}.y1`);
604
+ pointUnit(command.x2, `${field}.x2`);
605
+ pointUnit(command.y2, `${field}.y2`);
606
+ pointUnit(command.x, `${field}.x`);
607
+ pointUnit(command.y, `${field}.y`);
528
608
  return;
529
609
  case "Q":
530
- pointUnit(command.x1, "path.x1");
531
- pointUnit(command.y1, "path.y1");
532
- pointUnit(command.x, "path.x");
533
- pointUnit(command.y, "path.y");
610
+ pointUnit(command.x1, `${field}.x1`);
611
+ pointUnit(command.y1, `${field}.y1`);
612
+ pointUnit(command.x, `${field}.x`);
613
+ pointUnit(command.y, `${field}.y`);
534
614
  return;
535
615
  case "Z": return;
536
616
  default: invalidGeometry("Custom path contains unsupported command");
@@ -539,81 +619,78 @@ function validatePathCommand(command) {
539
619
  /** Validates and resolves author Geometry (+ optional borderRadius) into a closed ResolvedGeometry model. */
540
620
  function resolveGeometry(options) {
541
621
  const { geometry: value, borderRadius: radius, box } = options;
542
- const warnings = [];
543
622
  if (isRecord(value) && value["type"] === "custom") {
544
623
  if (radius !== void 0 && radius > 0) throw new CapabilityError("unsupported-style-combination", "borderRadius cannot be used together with custom geometry");
545
624
  const parsedCustom = customGeometrySchema.safeParse(value);
546
625
  if (!parsedCustom.success) {
547
626
  const issue = parsedCustom.error.issues[0];
548
- if (issue?.path[0] === "width" || issue?.path[0] === "height") {
549
- if (typeof value[issue.path[0]] !== "number" || !Number.isFinite(value[issue.path[0]])) finiteGeometryNumber(value[issue.path[0]], `geometry.${issue.path[0]}`);
550
- invalidGeometry("Custom geometry must have a positive viewBox and at least one path");
551
- }
552
- invalidGeometry(issue?.message ?? "Custom geometry must have a positive viewBox and at least one path");
627
+ const dimension = issue?.path[0];
628
+ if (dimension === "width" || dimension === "height") finiteGeometryNumber(value[dimension], `geometry.${dimension}`);
629
+ invalidGeometry(issue?.message ?? "Invalid custom geometry", zodIssueField(issue, "geometry"));
553
630
  }
554
631
  const custom = parsedCustom.data;
555
632
  const widthUnits = pointUnit(custom.width, "geometry.width");
556
633
  const heightUnits = pointUnit(custom.height, "geometry.height");
557
- if (Number(widthUnits) === 0 || Number(heightUnits) === 0) invalidGeometry("Custom geometry viewBox must retain positive width and height in path coordinate space after conversion");
558
- const resolvedPaths = custom.paths.map((item) => {
559
- for (const command of item.commands) validatePathCommand(command);
634
+ if (Number(widthUnits) === 0 || Number(heightUnits) === 0) invalidGeometry("Custom geometry viewBox must retain positive width and height in path coordinate space after conversion", Number(widthUnits) === 0 ? "geometry.width" : "geometry.height");
635
+ const resolvedPaths = custom.paths.map((item, pathIndex) => {
636
+ for (const [commandIndex, command] of item.commands.entries()) validatePathCommand(command, `geometry.paths.${pathIndex}.commands.${commandIndex}`);
560
637
  return {
561
638
  commands: item.commands,
562
639
  fill: item.fill ?? true,
563
640
  stroke: item.stroke ?? true
564
641
  };
565
642
  });
643
+ const resolvedSites = custom.connectionSites?.map((site, index) => {
644
+ pointUnit(site.x, `geometry.connectionSites.${index}.x`);
645
+ pointUnit(site.y, `geometry.connectionSites.${index}.y`);
646
+ return {
647
+ x: site.x,
648
+ y: site.y
649
+ };
650
+ });
566
651
  return {
567
652
  geometry: {
568
653
  kind: "custom",
569
654
  width: custom.width,
570
655
  height: custom.height,
571
- paths: resolvedPaths
656
+ paths: resolvedPaths,
657
+ ...resolvedSites === void 0 ? {} : { connectionSites: resolvedSites }
572
658
  },
573
- name: "custom",
574
- warnings
659
+ name: "custom"
575
660
  };
576
661
  }
577
662
  let rawName;
578
663
  const adjust = {};
579
664
  if (value === void 0) rawName = radius !== void 0 && radius > 0 ? "roundRect" : "rect";
580
665
  else if (typeof value === "string") rawName = value;
581
- else if (isRecord(value) && value["type"] === "preset" && typeof value["name"] === "string") {
666
+ else if (isRecord(value) && value["type"] === "preset") {
667
+ if (typeof value["name"] !== "string") invalidGeometry("preset.name must be a preset geometry name", "geometry.name");
582
668
  rawName = value["name"];
583
669
  if (value["adjust"] !== void 0) {
584
- if (!isRecord(value["adjust"])) invalidGeometry("preset.adjust must be an object");
670
+ if (!isRecord(value["adjust"])) invalidGeometry("preset.adjust must be an object", "geometry.adjust");
585
671
  const parsedAdjust = geometryAdjustSchema.safeParse(value["adjust"]);
586
- if (!parsedAdjust.success) invalidGeometry(`preset.adjust.${String(parsedAdjust.error.issues[0]?.path[0] ?? "adjust")} must be a finite integer`);
672
+ if (!parsedAdjust.success) invalidGeometry(`preset.adjust.${String(parsedAdjust.error.issues[0]?.path[0] ?? "adjust")} must be a finite integer`, zodIssueField(parsedAdjust.error.issues[0], "geometry.adjust"));
587
673
  Object.assign(adjust, parsedAdjust.data);
588
674
  }
589
- } else invalidGeometry("geometry must be a preset name, preset(...), or custom path");
675
+ } else invalidGeometry("geometry must be a preset name, preset(...), or custom path", isRecord(value) ? "geometry.type" : "geometry");
590
676
  const parsedPresetName = presetGeometryNameSchema.safeParse(rawName);
591
- if (!parsedPresetName.success) throw new CapabilityError("unsupported-geometry", `Unsupported preset geometry ${rawName}`);
677
+ if (!parsedPresetName.success) throw new CapabilityError("unsupported-geometry", `Unsupported preset geometry ${rawName}`, void 0, { field: typeof value === "string" ? "geometry" : "geometry.name" });
592
678
  let name = parsedPresetName.data;
593
679
  if (radius !== void 0 && radius > 0) {
594
680
  if (name !== "rect" && name !== "roundRect") throw new CapabilityError("unsupported-style-combination", "borderRadius is only applicable to rect or roundRect geometry");
595
681
  name = "roundRect";
596
682
  if (adjust["adj"] === void 0) {
597
683
  const raw = Math.round(radius / Math.min(box.width, box.height) * 1e5);
598
- adjust["adj"] = raw;
599
- if (raw > 5e4) warnings.push({
600
- code: "geometry-adjustment-range",
601
- message: "borderRadius exceeds half of the shorter side; preserved original radius and wrote native adjust value"
602
- });
684
+ adjust["adj"] = Math.max(0, Math.min(5e4, raw));
603
685
  }
604
686
  }
605
- for (const [key, amount] of Object.entries(adjust)) if (name === "blockArc" && ((key === "adj1" || key === "adj2") && (amount < 0 || amount > 216e5) || key === "adj3" && (amount < 0 || amount > 5e4))) warnings.push({
606
- code: "geometry-adjustment-range",
607
- message: `blockArc.${key} exceeds common preset range; preserved original adjust value`
608
- });
609
687
  return {
610
688
  geometry: {
611
689
  kind: "preset",
612
690
  name,
613
691
  adjust
614
692
  },
615
- name,
616
- warnings
693
+ name
617
694
  };
618
695
  }
619
696
  function pathCommandXml(command) {
@@ -626,20 +703,34 @@ function pathCommandXml(command) {
626
703
  default: return command;
627
704
  }
628
705
  }
706
+ function clampPresetAdjustValue(presetName, key, amount) {
707
+ if (presetName === "roundRect" && key === "adj") return Math.max(0, Math.min(5e4, amount));
708
+ if (presetName === "blockArc") {
709
+ if (key === "adj1" || key === "adj2") return Math.max(0, Math.min(216e5, amount));
710
+ if (key === "adj3") return Math.max(0, Math.min(5e4, amount));
711
+ }
712
+ return amount;
713
+ }
629
714
  /** Exhaustively serializes a ResolvedGeometry to DrawingML <a:prstGeom> or <a:custGeom>. */
630
715
  function resolvedGeometryXml(geometry) {
631
716
  switch (geometry.kind) {
632
717
  case "preset": {
633
- const values = Object.entries(geometry.adjust).map(([key, amount]) => `<a:gd name="${key}" fmla="val ${amount}"/>`).join("");
718
+ const values = Object.entries(geometry.adjust).map(([key, amount]) => `<a:gd name="${key}" fmla="val ${clampPresetAdjustValue(geometry.name, key, amount)}"/>`).join("");
634
719
  return `<a:prstGeom prst="${geometry.name}"><a:avLst>${values}</a:avLst></a:prstGeom>`;
635
720
  }
636
721
  case "custom": {
637
722
  const widthUnits = pointUnit(geometry.width, "geometry.width");
638
723
  const heightUnits = pointUnit(geometry.height, "geometry.height");
639
- return `<a:custGeom><a:avLst/><a:gdLst/><a:ahLst/><a:cxnLst/><a:rect l="l" t="t" r="r" b="b"/><a:pathLst>${geometry.paths.map((pathItem) => {
724
+ const pathList = geometry.paths.map((pathItem) => {
640
725
  const commands = pathItem.commands.map(pathCommandXml).join("");
641
726
  return `<a:path w="${widthUnits}" h="${heightUnits}"${pathItem.fill ? "" : " fill=\"none\""}${pathItem.stroke ? "" : " stroke=\"0\""}>${commands}</a:path>`;
642
- }).join("")}</a:pathLst></a:custGeom>`;
727
+ }).join("");
728
+ const sites = geometry.connectionSites ?? [];
729
+ return `<a:custGeom><a:avLst/>${sites.length === 0 ? "<a:gdLst/>" : `<a:gdLst>${sites.map((site, index) => {
730
+ const xUnits = pointUnit(site.x, `geometry.connectionSites.${index}.x`);
731
+ const yUnits = pointUnit(site.y, `geometry.connectionSites.${index}.y`);
732
+ return `<a:gd name="cxnX${index}" fmla="*/ ${xUnits} w ${widthUnits}"/><a:gd name="cxnY${index}" fmla="*/ ${yUnits} h ${heightUnits}"/>`;
733
+ }).join("")}</a:gdLst>`}<a:ahLst/>${sites.length === 0 ? "<a:cxnLst/>" : `<a:cxnLst>${sites.map((_site, index) => `<a:cxn ang="0"><a:pos x="cxnX${index}" y="cxnY${index}"/></a:cxn>`).join("")}</a:cxnLst>`}<a:rect l="l" t="t" r="r" b="b"/><a:pathLst>${pathList}</a:pathLst></a:custGeom>`;
643
734
  }
644
735
  default: return geometry;
645
736
  }
@@ -739,21 +830,18 @@ function drawingMlArcToLocalCubics(curX, curY, wR, hR, stAng, swAng) {
739
830
  endY: cy + ry * Math.sin(phi2)
740
831
  };
741
832
  }
742
- function evaluatePresetGeometry(name, adjust, box) {
743
- const def = presetDefinitions[name];
744
- const W = Math.max(1, pxToEmu(box.width));
745
- const H = Math.max(1, pxToEmu(box.height));
746
- const ss = Math.min(W, H);
747
- const ls = Math.max(W, H);
833
+ function createDrawingMlGuideEvaluator(wEmu, hEmu) {
834
+ const ss = Math.min(wEmu, hEmu);
835
+ const ls = Math.max(wEmu, hEmu);
748
836
  const builtins = {
749
- w: W,
750
- h: H,
837
+ w: wEmu,
838
+ h: hEmu,
751
839
  l: 0,
752
840
  t: 0,
753
- r: W,
754
- b: H,
755
- hc: W / 2,
756
- vc: H / 2,
841
+ r: wEmu,
842
+ b: hEmu,
843
+ hc: wEmu / 2,
844
+ vc: hEmu / 2,
757
845
  ss,
758
846
  ls,
759
847
  cd2: 108e5,
@@ -765,52 +853,113 @@ function evaluatePresetGeometry(name, adjust, box) {
765
853
  "7cd8": 189e5
766
854
  };
767
855
  const env = /* @__PURE__ */ new Map();
768
- const arg = (token) => {
769
- const bound = env.get(token);
856
+ const resolveToken = (token) => {
857
+ const trimmed = token.trim();
858
+ if (trimmed.length === 0) return void 0;
859
+ const bound = env.get(trimmed);
770
860
  if (bound !== void 0) return bound;
771
- const builtin = builtins[token];
861
+ const builtin = builtins[trimmed];
772
862
  if (builtin !== void 0) return builtin;
773
- const denomMatch = /^(wd|hd|ssd)(\d+)$/u.exec(token);
863
+ const denomMatch = /^(wd|hd|ssd)(\d+)$/u.exec(trimmed);
774
864
  if (denomMatch !== null) {
775
865
  const kind = denomMatch[1];
776
866
  const divisor = Number(denomMatch[2]);
777
- return kind === "wd" ? W / divisor : kind === "hd" ? H / divisor : ss / divisor;
867
+ if (divisor <= 0) return void 0;
868
+ return kind === "wd" ? wEmu / divisor : kind === "hd" ? hEmu / divisor : ss / divisor;
778
869
  }
779
- const numeric = Number(token);
780
- if (!Number.isFinite(numeric)) invalidGeometry(`Preset ${name} references unknown guide token ${token}`);
781
- return numeric;
870
+ if (!/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(trimmed)) return;
871
+ const numeric = Number(trimmed);
872
+ return Number.isFinite(numeric) ? numeric : void 0;
782
873
  };
783
- const evalFormula = (formula) => {
874
+ const evaluateFormula = (formula) => {
784
875
  const parts = formula.trim().split(/\s+/u);
785
876
  const op = parts[0];
786
- const x = parts[1] === void 0 ? 0 : arg(parts[1]);
787
- const y = parts[2] === void 0 ? 0 : arg(parts[2]);
788
- const z = parts[3] === void 0 ? 0 : arg(parts[3]);
877
+ if (op === void 0 || op.length === 0) return void 0;
878
+ const argAt = (index) => {
879
+ const token = parts[index];
880
+ return token === void 0 ? void 0 : resolveToken(token);
881
+ };
882
+ const x = argAt(1);
883
+ if (x === void 0) return void 0;
884
+ let result;
789
885
  switch (op) {
790
- case "val": return x;
791
- case "*/": return z === 0 ? 0 : x * y / z;
792
- case "+-": return x + y - z;
793
- case "+/": return z === 0 ? 0 : (x + y) / z;
886
+ case "val":
887
+ result = x;
888
+ break;
889
+ case "abs":
890
+ result = Math.abs(x);
891
+ break;
892
+ case "sqrt":
893
+ result = x <= 0 ? 0 : Math.sqrt(x);
894
+ break;
895
+ case "at2":
896
+ case "cos":
897
+ case "sin":
898
+ case "tan":
899
+ case "max":
900
+ case "min": {
901
+ const y = argAt(2);
902
+ if (y === void 0) return void 0;
903
+ if (op === "at2") result = radToDrawingAngle(Math.atan2(y, x));
904
+ else if (op === "cos") result = x * Math.cos(drawingAngleToRad(y));
905
+ else if (op === "sin") result = x * Math.sin(drawingAngleToRad(y));
906
+ else if (op === "tan") result = x * Math.tan(drawingAngleToRad(y));
907
+ else if (op === "max") result = Math.max(x, y);
908
+ else result = Math.min(x, y);
909
+ break;
910
+ }
911
+ case "*/":
912
+ case "+-":
913
+ case "+/":
794
914
  case "?:":
795
- case "ifelse": return x > 0 ? y : z;
796
- case "abs": return Math.abs(x);
797
- case "at2": return radToDrawingAngle(Math.atan2(y, x));
798
- case "cat2": return x * Math.cos(Math.atan2(z, y));
799
- case "sat2": return x * Math.sin(Math.atan2(z, y));
800
- case "cos": return x * Math.cos(drawingAngleToRad(y));
801
- case "sin": return x * Math.sin(drawingAngleToRad(y));
802
- case "tan": return x * Math.tan(drawingAngleToRad(y));
803
- case "max": return Math.max(x, y);
804
- case "min": return Math.min(x, y);
805
- case "mod": return Math.sqrt(x * x + y * y + z * z);
806
- case "pin": return y < x ? x : y > z ? z : y;
807
- case "sqrt": return x <= 0 ? 0 : Math.sqrt(x);
808
- default: invalidGeometry(`Preset ${name} uses unsupported guide operator ${op}`);
915
+ case "ifelse":
916
+ case "cat2":
917
+ case "sat2":
918
+ case "mod":
919
+ case "pin": {
920
+ const y = argAt(2);
921
+ const z = argAt(3);
922
+ if (y === void 0 || z === void 0) return void 0;
923
+ if (op === "*/") result = z === 0 ? 0 : x * y / z;
924
+ else if (op === "+-") result = x + y - z;
925
+ else if (op === "+/") result = z === 0 ? 0 : (x + y) / z;
926
+ else if (op === "?:" || op === "ifelse") result = x > 0 ? y : z;
927
+ else if (op === "cat2") result = x * Math.cos(Math.atan2(z, y));
928
+ else if (op === "sat2") result = x * Math.sin(Math.atan2(z, y));
929
+ else if (op === "mod") result = Math.sqrt(x * x + y * y + z * z);
930
+ else result = y < x ? x : y > z ? z : y;
931
+ break;
932
+ }
933
+ default: return;
934
+ }
935
+ return Number.isFinite(result) ? result : void 0;
936
+ };
937
+ return {
938
+ resolveToken,
939
+ evaluateFormula,
940
+ setGuide(name, value) {
941
+ env.set(name, value);
809
942
  }
810
943
  };
811
- if (def.av !== void 0) for (const [key, formula] of def.av) env.set(key, evalFormula(formula));
812
- for (const [key, value] of Object.entries(adjust)) env.set(key, value);
813
- if (def.gd !== void 0) for (const [key, formula] of def.gd) env.set(key, evalFormula(formula));
944
+ }
945
+ function evaluatePresetGeometry(name, adjust, box) {
946
+ const def = presetDefinitions[name];
947
+ const W = Math.max(1, pxToEmu(box.width));
948
+ const H = Math.max(1, pxToEmu(box.height));
949
+ const evaluator = createDrawingMlGuideEvaluator(W, H);
950
+ const arg = (token) => {
951
+ const resolved = evaluator.resolveToken(token);
952
+ if (resolved === void 0) invalidGeometry(`Preset ${name} references unknown guide token ${token}`);
953
+ return resolved;
954
+ };
955
+ const evalFormula = (formula) => {
956
+ const evaluated = evaluator.evaluateFormula(formula);
957
+ if (evaluated === void 0) invalidGeometry(`Preset ${name} uses invalid guide formula ${formula}`);
958
+ return evaluated;
959
+ };
960
+ if (def.av !== void 0) for (const [key, formula] of def.av) evaluator.setGuide(key, evalFormula(formula));
961
+ for (const [key, value] of Object.entries(adjust)) evaluator.setGuide(key, value);
962
+ if (def.gd !== void 0) for (const [key, formula] of def.gd) evaluator.setGuide(key, evalFormula(formula));
814
963
  const rectTokens = def.rect ?? [
815
964
  "l",
816
965
  "t",
@@ -860,6 +1009,7 @@ function evaluatePresetGeometry(name, adjust, box) {
860
1009
  x: toPageX(cmd.x),
861
1010
  y: toPageY(cmd.y)
862
1011
  };
1012
+ default: return cmd;
863
1013
  }
864
1014
  };
865
1015
  const commands = [];
@@ -935,6 +1085,8 @@ function evaluatePresetGeometry(name, adjust, box) {
935
1085
  curX = subStartX;
936
1086
  curY = subStartY;
937
1087
  commands.push({ op: "Z" });
1088
+ break;
1089
+ default: invalidGeometry(`Preset ${name} contains unsupported path command ${String(cmd[0])}`);
938
1090
  }
939
1091
  return {
940
1092
  d: commandsToSvgD(commands),
@@ -943,7 +1095,11 @@ function evaluatePresetGeometry(name, adjust, box) {
943
1095
  stroke: pathDef.stroke ?? true
944
1096
  };
945
1097
  }),
946
- textRect
1098
+ textRect,
1099
+ connectionSites: (def.cxn ?? STANDARD_CARDINAL_CXN).map(([cxToken, cyToken]) => ({
1100
+ x: box.x + arg(cxToken) / W * box.width,
1101
+ y: box.y + arg(cyToken) / H * box.height
1102
+ }))
947
1103
  };
948
1104
  }
949
1105
  function evaluateCustomGeometry(geometry, box) {
@@ -986,7 +1142,11 @@ function evaluateCustomGeometry(geometry, box) {
986
1142
  stroke: pathItem.stroke
987
1143
  };
988
1144
  }),
989
- textRect: box
1145
+ textRect: box,
1146
+ connectionSites: geometry.connectionSites !== void 0 ? geometry.connectionSites.map((site) => ({
1147
+ x: mapX(site.x),
1148
+ y: mapY(site.y)
1149
+ })) : standardBoxConnectionSites(box)
990
1150
  };
991
1151
  }
992
1152
  /** Exhaustively evaluates any ResolvedGeometry into page-space SVG paths and embedded textRect. */
@@ -1046,13 +1206,15 @@ function shadeHex(hex, lumMod, lumOff) {
1046
1206
  ].map((channel) => Math.round((channel + m) * 255).toString(16).padStart(2, "0")).join("").toUpperCase();
1047
1207
  }
1048
1208
  const PresetGeomAttrSchema = z.object({ prst: z.string().min(1) });
1049
- const AdjustGuideAttrSchema = z.object({
1050
- name: geometryAdjustKeySchema,
1209
+ const AdjustGuideXmlSchema = z.object({
1210
+ name: z.string().min(1),
1051
1211
  fmla: z.string().regex(/^val\s+(-?\d+)$/u)
1052
1212
  });
1213
+ const ooxmlInt32Schema = ooxmlIntSchema.refine((value) => value >= -2147483648 && value <= 2147483647);
1214
+ const ooxmlPositiveInt32Schema = ooxmlPositiveIntSchema.refine((value) => value <= 2147483647);
1053
1215
  const CustomPathAttrSchema = z.object({
1054
- w: ooxmlPositiveIntSchema.optional(),
1055
- h: ooxmlPositiveIntSchema.optional(),
1216
+ w: ooxmlPositiveInt32Schema.optional(),
1217
+ h: ooxmlPositiveInt32Schema.optional(),
1056
1218
  fill: z.enum([
1057
1219
  "none",
1058
1220
  "norm",
@@ -1064,8 +1226,8 @@ const CustomPathAttrSchema = z.object({
1064
1226
  stroke: ooxmlBoolSchema.optional()
1065
1227
  });
1066
1228
  const CustomPtAttrSchema = z.object({
1067
- x: ooxmlIntSchema,
1068
- y: ooxmlIntSchema
1229
+ x: ooxmlInt32Schema,
1230
+ y: ooxmlInt32Schema
1069
1231
  });
1070
1232
  const CustomArcAttrSchema = z.object({
1071
1233
  wR: ooxmlIntSchema,
@@ -1113,8 +1275,8 @@ function readPresetGeometryXml(prstGeomCursor, location, diagnostics) {
1113
1275
  const avLst = prstGeomCursor.child(A_NS, "avLst");
1114
1276
  if (avLst !== void 0) for (const gd of avLst.children(A_NS, "gd")) {
1115
1277
  const rawGd = gd.attrsObject(["name", "fmla"]);
1116
- const parsedGd = AdjustGuideAttrSchema.safeParse(rawGd);
1117
- if (!parsedGd.success) {
1278
+ const parsedXml = AdjustGuideXmlSchema.safeParse(rawGd);
1279
+ if (!parsedXml.success) {
1118
1280
  diagnostics.push({
1119
1281
  code: "invalid-xml-value",
1120
1282
  category: "corrupt-input",
@@ -1128,10 +1290,25 @@ function readPresetGeometryXml(prstGeomCursor, location, diagnostics) {
1128
1290
  });
1129
1291
  continue;
1130
1292
  }
1131
- const match = /^val\s+(-?\d+)$/u.exec(parsedGd.data.fmla);
1293
+ if (!geometryAdjustKeySchema.safeParse(parsedXml.data.name).success) {
1294
+ diagnostics.push({
1295
+ code: "unsupported-mechanism",
1296
+ category: "unsupported",
1297
+ disposition: "omitted",
1298
+ location: {
1299
+ ...location,
1300
+ xpath: gd.xpath
1301
+ },
1302
+ namespaceUri: A_NS,
1303
+ localName: "gd",
1304
+ mechanismHint: `geometry-adjust:${parsedXml.data.name}`
1305
+ });
1306
+ continue;
1307
+ }
1308
+ const match = /^val\s+(-?\d+)$/u.exec(parsedXml.data.fmla);
1132
1309
  if (match !== null) {
1133
1310
  const value = Number(match[1]);
1134
- if (Number.isSafeInteger(value)) adjust[parsedGd.data.name] = value;
1311
+ if (Number.isSafeInteger(value)) adjust[parsedXml.data.name] = value;
1135
1312
  }
1136
1313
  }
1137
1314
  return Object.keys(adjust).length === 0 ? parsedName.data : {
@@ -1176,14 +1353,43 @@ function readCustomPoint(ptCursor, location, diagnostics) {
1176
1353
  }
1177
1354
  /** Reads DrawingML `<a:custGeom>` into `CustomGeometry`, reporting localized diagnostics on unsupported guide formulas or invalid paths. */
1178
1355
  function readCustomGeometryXml(custGeomCursor, fallbackExtentUnits, location, diagnostics) {
1179
- custGeomCursor.ignoreEmptyChild(A_NS, "avLst");
1180
- const gdLst = custGeomCursor.child(A_NS, "gdLst");
1181
- if (gdLst !== void 0) for (const gd of gdLst.children(A_NS, "gd")) {
1182
- gd.consumeAttr("name");
1183
- gd.consumeAttr("fmla");
1184
- }
1356
+ const hasPositiveShapeExtent = Number.isFinite(fallbackExtentUnits.w) && Number.isFinite(fallbackExtentUnits.h) && fallbackExtentUnits.w > 0 && fallbackExtentUnits.h > 0;
1357
+ const guideEval = createDrawingMlGuideEvaluator(fallbackExtentUnits.w, fallbackExtentUnits.h);
1358
+ const readGuideList = (listCursor) => {
1359
+ if (listCursor === void 0) return;
1360
+ for (const gd of listCursor.children(A_NS, "gd")) {
1361
+ const { name, fmla } = gd.attrsObject(["name", "fmla"]);
1362
+ if (hasPositiveShapeExtent && name !== void 0 && fmla !== void 0) {
1363
+ const value = guideEval.evaluateFormula(fmla);
1364
+ if (value !== void 0) guideEval.setGuide(name, value);
1365
+ }
1366
+ }
1367
+ };
1368
+ readGuideList(custGeomCursor.child(A_NS, "avLst"));
1369
+ readGuideList(custGeomCursor.child(A_NS, "gdLst"));
1185
1370
  custGeomCursor.ignoreEmptyChild(A_NS, "ahLst");
1186
- custGeomCursor.ignoreEmptyChild(A_NS, "cxnLst");
1371
+ const cxnLstCursor = custGeomCursor.child(A_NS, "cxnLst");
1372
+ const rawCxnPositions = [];
1373
+ if (cxnLstCursor !== void 0) for (const cxnCursor of cxnLstCursor.children(A_NS, "cxn")) {
1374
+ cxnCursor.consumeAttr("ang");
1375
+ const posCursor = cxnCursor.child(A_NS, "pos");
1376
+ if (posCursor === void 0) {
1377
+ rawCxnPositions.push({
1378
+ xpath: cxnCursor.xpath,
1379
+ rawValue: "missing <a:pos>"
1380
+ });
1381
+ continue;
1382
+ }
1383
+ const rawPos = posCursor.attrsObject(["x", "y"]);
1384
+ const posX = hasPositiveShapeExtent && rawPos["x"] !== void 0 ? guideEval.resolveToken(rawPos["x"]) : void 0;
1385
+ const posY = hasPositiveShapeExtent && rawPos["y"] !== void 0 ? guideEval.resolveToken(rawPos["y"]) : void 0;
1386
+ rawCxnPositions.push({
1387
+ xpath: posCursor.xpath,
1388
+ rawValue: JSON.stringify(rawPos),
1389
+ ...posX === void 0 ? {} : { posX },
1390
+ ...posY === void 0 ? {} : { posY }
1391
+ });
1392
+ }
1187
1393
  const rect = custGeomCursor.child(A_NS, "rect");
1188
1394
  if (rect !== void 0) {
1189
1395
  rect.consumeAttr("l");
@@ -1406,6 +1612,19 @@ function readCustomGeometryXml(custGeomCursor, fallbackExtentUnits, location, di
1406
1612
  }
1407
1613
  }
1408
1614
  if (pathFailed || commands.length === 0) continue;
1615
+ if (!arePathCommandsBounded(commands)) {
1616
+ diagnostics.push({
1617
+ code: "invalid-xml-value",
1618
+ category: "corrupt-input",
1619
+ disposition: "omitted",
1620
+ location: {
1621
+ ...location,
1622
+ xpath: pathCursor.xpath
1623
+ },
1624
+ attributeOrElement: "a:path"
1625
+ });
1626
+ continue;
1627
+ }
1409
1628
  paths.push({
1410
1629
  commands,
1411
1630
  ...parsedPath.data.fill === "none" ? { fill: false } : {},
@@ -1413,11 +1632,53 @@ function readCustomGeometryXml(custGeomCursor, fallbackExtentUnits, location, di
1413
1632
  });
1414
1633
  }
1415
1634
  if (viewWidth === void 0 || viewHeight === void 0 || viewWidth <= 0 || viewHeight <= 0 || paths.length === 0) return;
1635
+ let importedConnectionSites;
1636
+ if (rawCxnPositions.length > 0) {
1637
+ const mappedSites = [];
1638
+ let failedCxn;
1639
+ for (const rawSite of rawCxnPositions) {
1640
+ if (!hasPositiveShapeExtent || rawSite.posX === void 0 || rawSite.posY === void 0 || !Number.isFinite(rawSite.posX) || !Number.isFinite(rawSite.posY) || Math.abs(emuToPx(rawSite.posX)) > 1e6 || Math.abs(emuToPx(rawSite.posY)) > 1e6) {
1641
+ failedCxn = {
1642
+ xpath: rawSite.xpath,
1643
+ rawValue: rawSite.rawValue
1644
+ };
1645
+ break;
1646
+ }
1647
+ const mappedX = rawSite.posX / fallbackExtentUnits.w * viewWidth;
1648
+ const mappedY = rawSite.posY / fallbackExtentUnits.h * viewHeight;
1649
+ const unitX = Math.round(mappedX * 1e3);
1650
+ const unitY = Math.round(mappedY * 1e3);
1651
+ if (!Number.isFinite(mappedX) || !Number.isFinite(mappedY) || !Number.isSafeInteger(unitX) || Math.abs(unitX) > 2147483647 || !Number.isSafeInteger(unitY) || Math.abs(unitY) > 2147483647) {
1652
+ failedCxn = {
1653
+ xpath: rawSite.xpath,
1654
+ rawValue: rawSite.rawValue
1655
+ };
1656
+ break;
1657
+ }
1658
+ mappedSites.push({
1659
+ x: mappedX,
1660
+ y: mappedY
1661
+ });
1662
+ }
1663
+ if (failedCxn !== void 0) diagnostics.push({
1664
+ code: "invalid-xml-value",
1665
+ category: "corrupt-input",
1666
+ disposition: "omitted",
1667
+ location: {
1668
+ ...location,
1669
+ xpath: failedCxn.xpath
1670
+ },
1671
+ attributeOrElement: "a:cxnLst",
1672
+ rawValue: failedCxn.rawValue
1673
+ });
1674
+ else if (mappedSites.length > 0) importedConnectionSites = mappedSites;
1675
+ }
1416
1676
  return {
1417
1677
  type: "custom",
1418
1678
  width: viewWidth,
1419
1679
  height: viewHeight,
1420
- paths
1680
+ paths,
1681
+ ...importedConnectionSites === void 0 ? {} : { connectionSites: importedConnectionSites }
1421
1682
  };
1422
1683
  }
1423
- export { blockArc, customGeometrySchema, evaluateGeometry, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, parseSvgPath, path, pathOptionsSchema, preset, presetGeometryNameSchema, presetGeometryNames, presetGeometryTuple, readCustomGeometryXml, readPresetGeometryXml, resolveGeometry, resolvedGeometryXml, shadeHex };
1684
+ export { applyTransformToPoints, arePathCommandsBounded, blockArc, customGeometrySchema, evaluateGeometry, geometryAdjustKeySchema, geometryAdjustSchema, geometrySchema, getGeometryConnectionSiteCount, isValidPathUnit, isValidPositivePathExtent, parseSvgPath, path, pathOptionsSchema, preset, presetGeometryNameSchema, presetGeometryNames, presetGeometryTuple, readCustomGeometryXml, readPresetGeometryXml, resolveGeometry, resolvedGeometryXml, shadeHex, standardBoxConnectionSites };