@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,289 +0,0 @@
1
- import { CapabilityError } from "../../../core/dist/diagnostics.js";
2
- import "../../../core/dist/capability.js";
3
- import { xmlEscape } from "../../../emit/dist/ooxml.js";
4
- import "../../../emit/dist/index.js";
5
- import { fontFamilyKey, matchesFontFamily } from "./font-family.js";
6
- import { subsetFont } from "./font-subset.js";
7
- import { createHash } from "node:crypto";
8
- import * as fontkit from "fontkit";
9
- // ../capabilities/dist/font/font-embedding.js
10
- /** Retains control characters and default ignorable code points in text stream without requiring standalone cmap glyphs. */
11
- function requiresFontGlyph(character) {
12
- return !/^[\p{Cc}\p{Default_Ignorable_Code_Point}]$/u.test(character);
13
- }
14
- const fontRelationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font";
15
- const fontContentType = "application/x-fontdata";
16
- function fail(use, code, message) {
17
- throw new CapabilityError(code, message, use.path);
18
- }
19
- function tablesOf(bytes, use) {
20
- if (bytes.byteLength < 12) return fail(use, "unsupported-font-format", "Font data is not a valid TrueType file");
21
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
22
- const signature = String.fromCharCode(...bytes.subarray(0, 4));
23
- if (signature !== "\0\0\0" && signature !== "true") return fail(use, "unsupported-font-format", "Font embedding currently only supports static TrueType outlines; WOFF, WOFF2, font collections, and CFF are not supported");
24
- const count = view.getUint16(4);
25
- if (12 + count * 16 > bytes.byteLength) return fail(use, "unsupported-font-format", "Font SFNT table directory is incomplete");
26
- const tables = /* @__PURE__ */ new Map();
27
- for (let index = 0; index < count; index += 1) {
28
- const record = 12 + index * 16;
29
- const name = String.fromCharCode(...bytes.subarray(record, record + 4));
30
- const offset = view.getUint32(record + 8);
31
- const length = view.getUint32(record + 12);
32
- if (offset > bytes.byteLength || length > bytes.byteLength - offset) return fail(use, "unsupported-font-format", `Font table ${name} exceeds file boundaries`);
33
- tables.set(name, {
34
- offset,
35
- length
36
- });
37
- }
38
- if (!tables.has("glyf") || tables.has("fvar") || !tables.has("OS/2") || !tables.has("head") || !tables.has("name")) return fail(use, "unsupported-font-format", "Font embedding requires a static TrueType font containing OS/2, head, name, and glyf tables");
39
- if (tables.get("OS/2").length < 64) return fail(use, "unsupported-font-format", "Font OS/2 table is missing weight, fsType, or style selection fields");
40
- return tables;
41
- }
42
- function checkedFont(use, mode) {
43
- if (!use.embeddable) return fail(use, "font-not-embeddable", `${use.family} explicitly declares embeddable: false and cannot satisfy font embedding request`);
44
- if (use.substitute) return fail(use, "font-substitute-not-embeddable", `${use.family} uses substitute font metrics and cannot satisfy embedding request for the declared family`);
45
- if (use.bytes === void 0 || use.identity === "missing") return fail(use, "font-embedding-resource-missing", `${use.family} ${use.weight} ${use.style} is missing embeddable font resource`);
46
- if (createHash("sha256").update(use.bytes).digest("hex") !== use.identity) return fail(use, "invalid-font-face", `Font resource identity for ${use.family} does not match actual bytes`);
47
- const tables = tablesOf(use.bytes, use);
48
- const os2 = tables.get("OS/2");
49
- const view = new DataView(use.bytes.buffer, use.bytes.byteOffset, use.bytes.byteLength);
50
- const fsType = view.getUint16(os2.offset + 8);
51
- const weightClass = view.getUint16(os2.offset + 4);
52
- const usagePermission = fsType & 15;
53
- if (![
54
- 0,
55
- 2,
56
- 4,
57
- 8
58
- ].includes(usagePermission) || (fsType & -784) !== 0) return fail(use, "invalid-font-permissions", `OS/2 fsType of ${use.family} contains invalid or reserved permission flags`);
59
- if (usagePermission === 2) return fail(use, "font-embedding-restricted", `OS/2 fsType of ${use.family} restricts embedding`);
60
- if (usagePermission === 4) return fail(use, "font-embedding-preview-print", `OS/2 fsType of ${use.family} permits only preview and print, which cannot satisfy font embedding for editable presentations`);
61
- if (mode === "subset" && (fsType & 256) !== 0) return fail(use, "font-subsetting-forbidden", `OS/2 fsType of ${use.family} forbids subsetting; switch to full embedding or omit embedding request`);
62
- if ((fsType & 512) !== 0) return fail(use, "font-embedding-bitmap-only", `OS/2 fsType of ${use.family} allows bitmap embedding only and cannot embed TrueType outlines`);
63
- let opened;
64
- try {
65
- opened = fontkit.create(Buffer.from(use.bytes.buffer, use.bytes.byteOffset, use.bytes.byteLength));
66
- } catch {
67
- return fail(use, "unsupported-font-format", `Failed to parse TrueType font tables for ${use.family}`);
68
- }
69
- if (opened.type !== "TTF") return fail(use, "unsupported-font-format", `Font data for ${use.family} is not a supported static TrueType font`);
70
- const font = opened;
71
- if (!matchesFontFamily(font, use.family)) return fail(use, "font-family-mismatch", `Font family ${font.familyName} declared in font file does not match output family ${use.family}; declare substitute explicitly if intended for measurement`);
72
- if (font.variationAxes && Object.keys(font.variationAxes).length > 0) return fail(use, "unsupported-font-format", `${use.family} is a variable font and cannot be embedded currently`);
73
- if (weightClass !== use.weight) return fail(use, "font-style-mismatch", `${use.family} requested ${use.weight} weight, but OS/2 usWeightClass is ${weightClass}`);
74
- if (font["OS/2"].fsSelection.bold !== use.bold || font["OS/2"].fsSelection.italic !== use.italic || font["OS/2"].fsSelection.italic !== (use.style === "italic")) return fail(use, "font-style-mismatch", `OS/2 fsSelection of ${use.family} does not match bold or italic styles emitted for text`);
75
- return {
76
- font,
77
- tables,
78
- fsType,
79
- weightClass
80
- };
81
- }
82
- function subsetBytes(use, checked, characters) {
83
- const requiredCharacters = [...new Set(characters)];
84
- for (const character of requiredCharacters) {
85
- const codePoint = character.codePointAt(0);
86
- if (codePoint !== void 0 && requiresFontGlyph(character) && !checked.font.hasGlyphForCodePoint(codePoint)) return fail(use, "font-missing-glyph", `${use.family} ${use.weight} ${use.style} font is missing glyph for emitted character ${character}`);
87
- }
88
- let bytes;
89
- try {
90
- bytes = subsetFont(use.bytes, characters);
91
- } catch (error) {
92
- return fail(use, "font-subsetting-failed", `Failed to generate character subset for ${use.family}: ${error instanceof Error ? error.message : String(error)}`);
93
- }
94
- let font;
95
- try {
96
- const opened = fontkit.create(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength));
97
- if (opened.type !== "TTF") throw new Error("Subset is not a static TrueType font");
98
- font = opened;
99
- tablesOf(bytes, use);
100
- } catch (error) {
101
- return fail(use, "font-subsetting-failed", `Failed to parse character subset for ${use.family} independently: ${error instanceof Error ? error.message : String(error)}`);
102
- }
103
- if (font["OS/2"].usWeightClass !== checked.weightClass || font["OS/2"].fsType.editable !== checked.font["OS/2"].fsType.editable || font["OS/2"].fsType.noSubsetting !== checked.font["OS/2"].fsType.noSubsetting || font["OS/2"].fsSelection.bold !== checked.font["OS/2"].fsSelection.bold || font["OS/2"].fsSelection.italic !== checked.font["OS/2"].fsSelection.italic) return fail(use, "font-subsetting-failed", `Character subset for ${use.family} did not retain embedding permissions and styles of the original font`);
104
- for (const character of requiredCharacters) {
105
- const codePoint = character.codePointAt(0);
106
- if (codePoint !== void 0 && requiresFontGlyph(character) && !font.hasGlyphForCodePoint(codePoint)) return fail(use, "font-subsetting-failed", `Character subset for ${use.family} did not retain emitted character ${character}`);
107
- }
108
- return bytes;
109
- }
110
- function nameString(bytes, table, id, use) {
111
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
112
- if (table.length < 6) return fail(use, "unsupported-font-format", "Font name table is incomplete");
113
- const count = view.getUint16(table.offset + 2);
114
- const stringsOffset = view.getUint16(table.offset + 4);
115
- if (6 + count * 12 > table.length || stringsOffset > table.length) return fail(use, "unsupported-font-format", "Font name table record out of bounds");
116
- let fallback;
117
- for (let index = 0; index < count; index += 1) {
118
- const record = table.offset + 6 + index * 12;
119
- if (view.getUint16(record + 6) !== id) continue;
120
- const platform = view.getUint16(record);
121
- const language = view.getUint16(record + 4);
122
- const length = view.getUint16(record + 8);
123
- const offset = stringsOffset + view.getUint16(record + 10);
124
- if (offset > table.length || length > table.length - offset) return fail(use, "unsupported-font-format", "Font name string out of bounds");
125
- if (platform !== 0 && platform !== 3) continue;
126
- const raw = bytes.subarray(table.offset + offset, table.offset + offset + length);
127
- if (raw.byteLength % 2 !== 0) return fail(use, "unsupported-font-format", "Font name string is not UTF-16 encoded");
128
- const littleEndian = new Uint8Array(raw.byteLength);
129
- for (let at = 0; at < raw.byteLength; at += 2) {
130
- littleEndian[at] = raw[at + 1];
131
- littleEndian[at + 1] = raw[at];
132
- }
133
- if (platform === 3 && language === 1033) return littleEndian;
134
- fallback ??= littleEndian;
135
- }
136
- if (fallback === void 0) return fail(use, "unsupported-font-format", `Font name table is missing Unicode name field ${id} required for EOT`);
137
- return fallback;
138
- }
139
- function eot(sourceBytes, use, checked, payloadBytes = sourceBytes) {
140
- const { tables, fsType, weightClass, font } = checked;
141
- const os2 = tables.get("OS/2");
142
- const names = tables.get("name");
143
- const view = new DataView(sourceBytes.buffer, sourceBytes.byteOffset, sourceBytes.byteLength);
144
- const payloadTables = tablesOf(payloadBytes, use);
145
- const payloadView = new DataView(payloadBytes.buffer, payloadBytes.byteOffset, payloadBytes.byteLength);
146
- const os2Version = view.getUint16(os2.offset);
147
- const field32 = (offset) => offset + 4 <= os2.length ? view.getUint32(os2.offset + offset) : 0;
148
- const panose = sourceBytes.slice(os2.offset + 32, os2.offset + 42);
149
- const chunks = [];
150
- const u8 = (value) => chunks.push(Uint8Array.of(value));
151
- const u16 = (value) => {
152
- const chunk = /* @__PURE__ */ new Uint8Array(2);
153
- new DataView(chunk.buffer).setUint16(0, value, true);
154
- chunks.push(chunk);
155
- };
156
- const u32 = (value) => {
157
- const chunk = /* @__PURE__ */ new Uint8Array(4);
158
- new DataView(chunk.buffer).setUint32(0, value >>> 0, true);
159
- chunks.push(chunk);
160
- };
161
- u32(0);
162
- u32(payloadBytes.byteLength);
163
- u32(131074);
164
- u32(0);
165
- chunks.push(panose);
166
- u8(1);
167
- u8(font["OS/2"].fsSelection.italic ? 1 : 0);
168
- u32(weightClass);
169
- u16(fsType);
170
- u16(20556);
171
- for (const offset of [
172
- 42,
173
- 46,
174
- 50,
175
- 54
176
- ]) u32(field32(offset));
177
- for (const offset of [78, 82]) u32(os2Version >= 1 && os2.length >= offset + 4 ? field32(offset) : 0);
178
- const payloadHead = payloadTables.get("head");
179
- u32(payloadView.getUint32(payloadHead.offset + 8));
180
- for (let index = 0; index < 4; index += 1) u32(0);
181
- for (const id of [
182
- 1,
183
- 2,
184
- 5,
185
- 4
186
- ]) {
187
- const name = nameString(sourceBytes, names, id, use);
188
- u16(0);
189
- u16(name.byteLength);
190
- chunks.push(name);
191
- }
192
- u16(0);
193
- u16(0);
194
- u32(1346851650);
195
- u32(0);
196
- u16(0);
197
- u16(0);
198
- u32(0);
199
- u32(0);
200
- chunks.push(payloadBytes);
201
- const size = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
202
- const output = new Uint8Array(size);
203
- let offset = 0;
204
- for (const chunk of chunks) {
205
- output.set(chunk, offset);
206
- offset += chunk.byteLength;
207
- }
208
- new DataView(output.buffer).setUint32(0, size, true);
209
- return output;
210
- }
211
- function fontCategory(font) {
212
- const panose = font["OS/2"].panose;
213
- const serifStyle = panose[1] ?? 0;
214
- const proportion = panose[3] ?? 0;
215
- const fixedPitch = (font.post?.isFixedPitch ?? 0) !== 0 || proportion === 9;
216
- const sansSerifStyles = /* @__PURE__ */ new Set([
217
- 11,
218
- 12,
219
- 13,
220
- 14,
221
- 15
222
- ]);
223
- return {
224
- pitchFamily: (fixedPitch ? 48 : panose[0] === 2 ? sansSerifStyles.has(serifStyle) ? 32 : serifStyle >= 2 ? 16 : 0 : panose[0] === 3 ? 64 : panose[0] === 4 || panose[0] === 5 ? 80 : 0) | (fixedPitch ? 1 : 2),
225
- charset: 0
226
- };
227
- }
228
- function slot(bold, italic) {
229
- if (bold) return italic ? "boldItalic" : "bold";
230
- return italic ? "italic" : "regular";
231
- }
232
- function slotOrder(value) {
233
- return {
234
- regular: 0,
235
- bold: 1,
236
- italic: 2,
237
- boldItalic: 3
238
- }[value];
239
- }
240
- /** Generates full fonts or presentation character subsets according to emitted families and styles. */
241
- function fontPresentationContributions(uses, requested) {
242
- if (requested === void 0) return [];
243
- const contributions = [];
244
- const slots = /* @__PURE__ */ new Map();
245
- for (const use of uses) {
246
- const checked = checkedFont(use, requested);
247
- const styleSlot = slot(use.bold, use.italic);
248
- const family = xmlEscape(use.family);
249
- const category = fontCategory(checked.font);
250
- const recordContent = `<p:font typeface="${family}" pitchFamily="${category.pitchFamily}" charset="${category.charset}"/>`;
251
- const recordKey = fontFamilyKey(use.family);
252
- const recordIdentity = `${recordContent}\u0000${category.pitchFamily}\u0000${category.charset}`;
253
- const itemKey = `${recordKey}\u0000${styleSlot}`;
254
- const existing = slots.get(itemKey);
255
- if (existing !== void 0 && existing !== use.identity) return fail(use, "conflicting-resource", `${use.family} style slot ${styleSlot} corresponds to multiple font files`);
256
- if (existing !== void 0) continue;
257
- slots.set(itemKey, use.identity);
258
- const resourceClaim = {
259
- kind: "font-face",
260
- key: use.claimKey
261
- };
262
- const resolveBytes = requested === "subset" ? (characters) => eot(use.bytes, use, checked, subsetBytes(use, checked, characters)) : void 0;
263
- contributions.push({
264
- collection: "p:embeddedFontLst",
265
- presentationAttributes: { embedTrueTypeFonts: "1" },
266
- record: {
267
- key: recordKey,
268
- identity: recordIdentity,
269
- tagName: "p:embeddedFont",
270
- content: recordContent
271
- },
272
- item: {
273
- key: styleSlot,
274
- identity: use.identity,
275
- order: slotOrder(styleSlot),
276
- relationshipType: fontRelationship,
277
- pathTemplate: "ppt/fonts/font{n}.fntdata",
278
- contentType: fontContentType,
279
- ...resolveBytes === void 0 ? { bytes: eot(use.bytes, use, checked) } : {
280
- resourceClaim,
281
- resolveBytes
282
- },
283
- content: (relationshipId) => `<p:${styleSlot} r:id="${xmlEscape(relationshipId)}"/>`
284
- }
285
- });
286
- }
287
- return contributions;
288
- }
289
- export { fontPresentationContributions, requiresFontGlyph };
@@ -1,10 +0,0 @@
1
- // ../capabilities/dist/font/font-family.js
2
- function fontFamilyKey(value) {
3
- return value.trim().replace(/\s+/gu, " ").toLocaleLowerCase("en-US");
4
- }
5
- /** Non-RIBBI weights can retain legacy families while declaring a unified preferred family via name ID 16. */
6
- function matchesFontFamily(font, family) {
7
- const preferredFamily = font.getName("preferredFamily", "en");
8
- return [font.familyName, preferredFamily].some((candidate) => candidate !== null && fontFamilyKey(candidate) === fontFamilyKey(family));
9
- }
10
- export { fontFamilyKey, matchesFontFamily };
@@ -1,302 +0,0 @@
1
- import { defaultTheme, defineTheme, isTheme } from "../../../core/dist/theme.js";
2
- import "../../../core/dist/capability.js";
3
- import { CommonNode } from "../../../core/dist/document.js";
4
- import { P_NS } from "../../../import/dist/namespaces.js";
5
- import { readEmbeddedFontList, readPresentationThemeFontScheme, unpackEotFontData } from "../../../import/dist/fonts.js";
6
- import "../../../import/dist/index.js";
7
- import { fontFamilyKey, matchesFontFamily } from "./font-family.js";
8
- import { font } from "./font.js";
9
- import * as fontkit from "fontkit";
10
- // ../capabilities/dist/font/font-import.js
11
- function fallbackWeightForSlot(slot) {
12
- return slot === "bold" || slot === "boldItalic" ? 700 : 400;
13
- }
14
- function fallbackStyleForSlot(slot) {
15
- return slot === "italic" || slot === "boldItalic" ? "italic" : "normal";
16
- }
17
- function upgradeFontToken(family, fontsByKey) {
18
- if (typeof family !== "string" || family === "major" || family === "minor") return;
19
- return fontsByKey.get(fontFamilyKey(family));
20
- }
21
- function upgradeStyleRecordFont(style, fontsByKey) {
22
- if (typeof style !== "object" || style === null || Array.isArray(style)) return { changed: false };
23
- const rec = style;
24
- const matched = upgradeFontToken(rec["fontFamily"], fontsByKey);
25
- if (matched === void 0) return { changed: false };
26
- return {
27
- changed: true,
28
- value: {
29
- ...rec,
30
- fontFamily: matched
31
- }
32
- };
33
- }
34
- function upgradePlaceholderListStylesFont(listStyles, fontsByKey) {
35
- if (listStyles === void 0) return {
36
- value: void 0,
37
- changed: false
38
- };
39
- let changed = false;
40
- const next = {};
41
- for (const [levelKey, levelStyle] of Object.entries(listStyles)) {
42
- if (levelStyle === void 0) continue;
43
- const upgraded = upgradeStyleRecordFont(levelStyle, fontsByKey);
44
- if (upgraded.changed && upgraded.value !== void 0) {
45
- next[levelKey] = upgraded.value;
46
- changed = true;
47
- } else next[levelKey] = levelStyle;
48
- }
49
- return changed ? {
50
- value: next,
51
- changed: true
52
- } : {
53
- value: listStyles,
54
- changed: false
55
- };
56
- }
57
- function upgradePlaceholdersFont(placeholders, fontsByKey) {
58
- if (placeholders === void 0) return {
59
- value: void 0,
60
- changed: false
61
- };
62
- let changed = false;
63
- const next = {};
64
- for (const [key, spec] of Object.entries(placeholders)) {
65
- const styleUp = upgradeStyleRecordFont(spec.style, fontsByKey);
66
- const listUp = upgradePlaceholderListStylesFont(spec.listStyles, fontsByKey);
67
- if (styleUp.changed || listUp.changed) {
68
- changed = true;
69
- next[key] = {
70
- ...spec,
71
- ...styleUp.changed && styleUp.value !== void 0 ? { style: styleUp.value } : {},
72
- ...listUp.changed && listUp.value !== void 0 ? { listStyles: listUp.value } : {}
73
- };
74
- } else next[key] = spec;
75
- }
76
- return changed ? {
77
- value: next,
78
- changed: true
79
- } : {
80
- value: placeholders,
81
- changed: false
82
- };
83
- }
84
- function attachEmbeddedFontsToSubtree(node, fontsByKey) {
85
- const mutableNode = node;
86
- const styleUp = upgradeStyleRecordFont(node.props["style"], fontsByKey);
87
- if (styleUp.changed && styleUp.value !== void 0) mutableNode.style({ fontFamily: styleUp.value["fontFamily"] });
88
- const textStyleUp = upgradeStyleRecordFont(node.props["textStyle"], fontsByKey);
89
- if (textStyleUp.changed && textStyleUp.value !== void 0) mutableNode.set({ textStyle: textStyleUp.value });
90
- if (node.type === "slide-master" || node.type === "slide-layout") {
91
- const rawPlaceholders = node.props["placeholders"];
92
- const upgradedPh = upgradePlaceholdersFont(rawPlaceholders, fontsByKey);
93
- if (upgradedPh.changed && upgradedPh.value !== void 0) mutableNode.set({ placeholders: upgradedPh.value });
94
- if (node.type === "slide-master") {
95
- const rawTextStyles = node.props["textStyles"];
96
- if (rawTextStyles !== void 0) {
97
- const titleUp = upgradePlaceholderListStylesFont(rawTextStyles.titleStyle, fontsByKey);
98
- const bodyUp = upgradePlaceholderListStylesFont(rawTextStyles.bodyStyle, fontsByKey);
99
- const otherUp = upgradePlaceholderListStylesFont(rawTextStyles.otherStyle, fontsByKey);
100
- if (titleUp.changed || bodyUp.changed || otherUp.changed) mutableNode.set({ textStyles: {
101
- ...titleUp.value === void 0 ? {} : { titleStyle: titleUp.value },
102
- ...bodyUp.value === void 0 ? {} : { bodyStyle: bodyUp.value },
103
- ...otherUp.value === void 0 ? {} : { otherStyle: otherUp.value }
104
- } });
105
- }
106
- }
107
- }
108
- const rawFooterPlaceholders = node.props["footerPlaceholders"];
109
- if (typeof rawFooterPlaceholders === "object" && rawFooterPlaceholders !== null && !Array.isArray(rawFooterPlaceholders)) {
110
- let changed = false;
111
- const nextPlaceholders = { ...rawFooterPlaceholders };
112
- for (const [slot, spec] of Object.entries(nextPlaceholders)) {
113
- if (typeof spec !== "object" || spec === null || Array.isArray(spec)) continue;
114
- const nextStyle = upgradeStyleRecordFont(spec["style"], fontsByKey);
115
- if (nextStyle.changed && nextStyle.value !== void 0) {
116
- nextPlaceholders[slot] = {
117
- ...spec,
118
- style: nextStyle.value
119
- };
120
- changed = true;
121
- }
122
- }
123
- if (changed) mutableNode.set({ footerPlaceholders: nextPlaceholders });
124
- }
125
- for (const slideSlot of [
126
- "dateTime",
127
- "footer",
128
- "slideNumber"
129
- ]) {
130
- const rawSlot = node.props[slideSlot];
131
- if (typeof rawSlot !== "object" || rawSlot === null || Array.isArray(rawSlot)) continue;
132
- const nextStyle = upgradeStyleRecordFont(rawSlot["style"], fontsByKey);
133
- if (nextStyle.changed && nextStyle.value !== void 0) mutableNode.set({ [slideSlot]: {
134
- ...rawSlot,
135
- style: nextStyle.value
136
- } });
137
- }
138
- for (const child of node.children) if (child instanceof CommonNode) attachEmbeddedFontsToSubtree(child, fontsByKey);
139
- }
140
- /**
141
- * Reads `<p:embeddedFontLst>` from `presentation.xml`, unpacks uncompressed EOT font parts
142
- * into detached `Font` resources, attaches them to theme font slots and text nodes, and
143
- * isolates compressed, obfuscated, or corrupt `.fntdata` gracefully.
144
- */
145
- function readEmbeddedFontsIntoDeck(context) {
146
- const { presentationCursor, deckNode, package: pkg } = context;
147
- const diagnostics = [];
148
- const records = readEmbeddedFontList(presentationCursor, pkg.presentationRels, pkg, diagnostics);
149
- const fontsByKey = /* @__PURE__ */ new Map();
150
- for (const record of records) {
151
- const faces = [];
152
- let requiresSubstitute = false;
153
- for (const slot of record.slots) {
154
- const unpacked = unpackEotFontData(slot.bytes);
155
- if (unpacked.status === "unsupported") {
156
- diagnostics.push({
157
- code: "unsupported-mechanism",
158
- category: "unsupported",
159
- disposition: "omitted",
160
- location: {
161
- part: slot.partPath,
162
- xpath: slot.xpath
163
- },
164
- namespaceUri: P_NS,
165
- localName: slot.slot,
166
- mechanismHint: unpacked.reason
167
- });
168
- continue;
169
- }
170
- if (unpacked.status === "corrupt") {
171
- diagnostics.push({
172
- code: "corrupt-part",
173
- category: "corrupt-input",
174
- disposition: "omitted",
175
- location: {
176
- part: slot.partPath,
177
- xpath: slot.xpath
178
- }
179
- });
180
- continue;
181
- }
182
- let opened;
183
- try {
184
- opened = fontkit.create(Buffer.from(unpacked.ttfBytes.buffer, unpacked.ttfBytes.byteOffset, unpacked.ttfBytes.byteLength));
185
- } catch {
186
- diagnostics.push({
187
- code: "corrupt-part",
188
- category: "corrupt-input",
189
- disposition: "omitted",
190
- location: {
191
- part: slot.partPath,
192
- xpath: slot.xpath
193
- }
194
- });
195
- continue;
196
- }
197
- if (opened.type !== "TTF") {
198
- diagnostics.push({
199
- code: "corrupt-part",
200
- category: "corrupt-input",
201
- disposition: "omitted",
202
- location: {
203
- part: slot.partPath,
204
- xpath: slot.xpath
205
- }
206
- });
207
- continue;
208
- }
209
- if (!matchesFontFamily(opened, record.typeface)) requiresSubstitute = true;
210
- const rawWeight = opened["OS/2"]?.usWeightClass;
211
- const weight = typeof rawWeight === "number" && rawWeight >= 100 && rawWeight <= 900 && rawWeight % 100 === 0 ? rawWeight : fallbackWeightForSlot(slot.slot);
212
- const isItalic = Boolean(opened["OS/2"]?.fsSelection?.italic) || Boolean(opened["OS/2"]?.fsSelection?.oblique) || opened.italicAngle !== 0;
213
- const style = opened["OS/2"] !== void 0 ? isItalic ? "italic" : "normal" : fallbackStyleForSlot(slot.slot);
214
- faces.push({
215
- weight,
216
- style,
217
- data: new Uint8Array(unpacked.ttfBytes)
218
- });
219
- }
220
- if (faces.length > 0) fontsByKey.set(fontFamilyKey(record.typeface), font(record.typeface, faces, requiresSubstitute ? { substitute: true } : {}));
221
- }
222
- const scheme = readPresentationThemeFontScheme(pkg);
223
- const attachFontsToThemeInput = (existing) => {
224
- if (existing === void 0) return { changed: false };
225
- const existingFonts = existing.fonts ?? {};
226
- const nextFonts = {};
227
- let changed = false;
228
- for (const [slot, token] of Object.entries(existingFonts)) {
229
- if (token === void 0) continue;
230
- if (typeof token === "string") {
231
- const matched = fontsByKey.get(fontFamilyKey(token));
232
- if (matched !== void 0) {
233
- nextFonts[slot] = matched;
234
- changed = true;
235
- continue;
236
- }
237
- }
238
- nextFonts[slot] = token;
239
- }
240
- if (!changed) return { changed: false };
241
- return {
242
- changed: true,
243
- theme: defineTheme({
244
- ...existing,
245
- fonts: nextFonts
246
- })
247
- };
248
- };
249
- let masterFallbackTheme;
250
- const mutatedThemes = /* @__PURE__ */ new Set();
251
- for (const child of deckNode.children) if (child instanceof CommonNode && child.type === "slide-master") {
252
- const masterTheme = child.props["theme"];
253
- masterFallbackTheme ??= masterTheme;
254
- if (isTheme(masterTheme) && masterTheme !== defaultTheme) {
255
- if (!mutatedThemes.has(masterTheme)) {
256
- mutatedThemes.add(masterTheme);
257
- const updatedMasterTheme = attachFontsToThemeInput(masterTheme);
258
- if (updatedMasterTheme.changed && updatedMasterTheme.theme !== void 0) masterTheme.set({ fonts: updatedMasterTheme.theme.fonts });
259
- }
260
- } else {
261
- const updatedMasterTheme = attachFontsToThemeInput(masterTheme);
262
- if (updatedMasterTheme.changed && updatedMasterTheme.theme !== void 0) child.set({ theme: updatedMasterTheme.theme });
263
- }
264
- }
265
- const existingDeckTheme = deckNode.props["theme"];
266
- const baseDeckTheme = existingDeckTheme ?? masterFallbackTheme;
267
- if (scheme !== void 0) {
268
- const resolvedMajor = scheme.majorTypeface === void 0 ? void 0 : fontsByKey.get(fontFamilyKey(scheme.majorTypeface)) ?? scheme.majorTypeface;
269
- const resolvedMinor = scheme.minorTypeface === void 0 ? void 0 : fontsByKey.get(fontFamilyKey(scheme.minorTypeface)) ?? scheme.minorTypeface;
270
- const hasCustomMajor = resolvedMajor !== void 0 && resolvedMajor !== defaultTheme.fonts.major;
271
- const hasCustomMinor = resolvedMinor !== void 0 && resolvedMinor !== defaultTheme.fonts.minor;
272
- if (hasCustomMajor || hasCustomMinor) {
273
- const upgradedBase = attachFontsToThemeInput(baseDeckTheme).theme ?? baseDeckTheme;
274
- const themeName = scheme.themeName ?? upgradedBase?.name;
275
- const nextFonts = {};
276
- if (upgradedBase?.fonts !== void 0) {
277
- for (const [slot, token] of Object.entries(upgradedBase.fonts)) if (token !== void 0) nextFonts[slot] = token;
278
- }
279
- if (resolvedMajor !== void 0) nextFonts["major"] = resolvedMajor;
280
- if (resolvedMinor !== void 0) nextFonts["minor"] = resolvedMinor;
281
- deckNode.set({ theme: defineTheme({
282
- ...upgradedBase,
283
- ...themeName === void 0 ? {} : { name: themeName },
284
- fonts: nextFonts
285
- }) });
286
- } else if (existingDeckTheme !== void 0) {
287
- const updated = attachFontsToThemeInput(existingDeckTheme);
288
- if (updated.changed && updated.theme !== void 0) deckNode.set({ theme: updated.theme });
289
- }
290
- } else if (existingDeckTheme !== void 0) {
291
- const updated = attachFontsToThemeInput(existingDeckTheme);
292
- if (updated.changed && updated.theme !== void 0) deckNode.set({ theme: updated.theme });
293
- }
294
- if (fontsByKey.size > 0) attachEmbeddedFontsToSubtree(deckNode, fontsByKey);
295
- return { diagnostics };
296
- }
297
- /** Deck-level import handler wired into `embeddedFontMechanism`. */
298
- const embeddedFontImportHandler = {
299
- target: "deck",
300
- read: readEmbeddedFontsIntoDeck
301
- };
302
- export { embeddedFontImportHandler, readEmbeddedFontsIntoDeck };
@@ -1,25 +0,0 @@
1
- import { fontOptionsSchema, fontSchema } from "../../../core/dist/theme.js";
2
- import "../../../core/dist/capability.js";
3
- // ../capabilities/dist/font/font.js
4
- /** Creates a Font value; resources are read only from caller-provided bytes. */
5
- function font(family, faces = [], options = {}) {
6
- const parsedOptions = fontOptionsSchema.safeParse(options);
7
- if (!parsedOptions.success) throw new TypeError("Font options.substitute must be a boolean");
8
- const validOptions = parsedOptions.data;
9
- const candidate = {
10
- family,
11
- faces,
12
- ...validOptions.substitute === true ? { substitute: true } : {},
13
- ...validOptions.embeddable === false ? { embeddable: false } : {}
14
- };
15
- const parsedFont = fontSchema.safeParse(candidate);
16
- if (!parsedFont.success) throw new TypeError(parsedFont.error.issues[0]?.message ?? "Invalid Font declaration");
17
- return Object.freeze({
18
- ...parsedFont.data,
19
- faces: Object.freeze((parsedFont.data.faces ?? []).map((face) => Object.freeze({
20
- ...face,
21
- ...face.data === void 0 ? {} : { data: new Uint8Array(face.data) }
22
- })))
23
- });
24
- }
25
- export { font, fontOptionsSchema, fontSchema };
@@ -1,51 +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
- // ../capabilities/dist/group/group-codegen.js
5
- const objectMotionPropKeys = /* @__PURE__ */ new Set([
6
- "enter",
7
- "emphasis",
8
- "motion"
9
- ]);
10
- function collectGroupProps(node, ctx) {
11
- const extra = ctx.emitObjectExtraProps(node.props);
12
- const entries = [];
13
- for (const [key, value] of Object.entries(node.props)) {
14
- if (value === void 0) continue;
15
- if (objectMotionPropKeys.has(key)) {
16
- if (Object.hasOwn(extra, key)) entries.push([key, extra[key]]);
17
- else ctx.fail("unexpressible-value", `Object property ${JSON.stringify(key)} requires motion codegen support`, `@${key}`);
18
- continue;
19
- }
20
- entries.push([key, value]);
21
- }
22
- return entries;
23
- }
24
- function emitGroupChildren(node, ctx) {
25
- const children = [];
26
- let childIndex = 0;
27
- for (const child of node.children) if (child instanceof CommonNode) {
28
- children.push(ctx.emitChildNode(child, childIndex));
29
- childIndex += 1;
30
- } else if ("text" in child && typeof child.text === "string" && child.text.trim() !== "") ctx.fail("invalid-document", "Group cannot directly contain text content");
31
- return children;
32
- }
33
- function emitGroupVanilla(node, ctx) {
34
- const callee = ctx.useImport("group");
35
- const propsEntries = collectGroupProps(node, ctx);
36
- const args = propsEntries.length === 0 ? [] : [ctx.formatProps(propsEntries)];
37
- const children = emitGroupChildren(node, ctx);
38
- return ctx.formatVanillaCall(callee, args, children);
39
- }
40
- function emitGroupReact(node, ctx) {
41
- const tag = ctx.useImport("Group");
42
- const propsEntries = collectGroupProps(node, ctx);
43
- const children = emitGroupChildren(node, ctx);
44
- return ctx.formatJsxElement(tag, propsEntries, children);
45
- }
46
- /** Source codegen contribution for native `group` container declarations. */
47
- const groupCodegen = defineObjectCodegen({ declarations: { group: {
48
- emitVanilla: emitGroupVanilla,
49
- emitReact: emitGroupReact
50
- } } });
51
- export { groupCodegen };