@web-ppt/edit-core 0.5.0-beta.1 → 0.5.0-beta.7

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 (367) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +165 -22
  3. package/dist/alt-text.d.ts +5 -0
  4. package/dist/appearance/index.d.ts +12 -0
  5. package/dist/appearance/materialize.d.ts +4 -0
  6. package/dist/appearance/types.d.ts +26 -0
  7. package/dist/appearance/values.d.ts +9 -0
  8. package/dist/appearance.js +301 -0
  9. package/dist/cfb/index.d.ts +5 -0
  10. package/dist/cfb/read.d.ts +16 -0
  11. package/dist/cfb/write.d.ts +3 -0
  12. package/dist/cfb.js +208 -0
  13. package/dist/change-classification.d.ts +3 -3
  14. package/dist/chart/category-binding.d.ts +4 -0
  15. package/dist/chart/category-commands.d.ts +23 -0
  16. package/dist/chart/category-levels.d.ts +14 -0
  17. package/dist/chart/category-matrix.d.ts +2 -0
  18. package/dist/chart/category-value.d.ts +2 -0
  19. package/dist/chart/category-workbook.d.ts +13 -0
  20. package/dist/chart/commands.d.ts +28 -0
  21. package/dist/chart/context.d.ts +12 -0
  22. package/dist/chart/dataset-merge.d.ts +5 -0
  23. package/dist/chart/formula.d.ts +13 -0
  24. package/dist/chart/identity-frames.d.ts +4 -0
  25. package/dist/chart/identity-scopes.d.ts +6 -0
  26. package/dist/chart/identity.d.ts +24 -0
  27. package/dist/chart/index.d.ts +8 -0
  28. package/dist/chart/limits.d.ts +6 -0
  29. package/dist/chart/locator.d.ts +4 -0
  30. package/dist/chart/materialize.d.ts +7 -0
  31. package/dist/chart/ordering.d.ts +9 -0
  32. package/dist/chart/part-graph.d.ts +5 -0
  33. package/dist/chart/patch-validation.d.ts +3 -0
  34. package/dist/chart/plot-kinds.d.ts +2 -0
  35. package/dist/chart/projection.d.ts +8 -0
  36. package/dist/chart/save.d.ts +4 -0
  37. package/dist/chart/shared-added-plan.d.ts +19 -0
  38. package/dist/chart/shared-added-records.d.ts +8 -0
  39. package/dist/chart/shared-address.d.ts +5 -0
  40. package/dist/chart/shared-allocate.d.ts +7 -0
  41. package/dist/chart/shared-cache-codec.d.ts +5 -0
  42. package/dist/chart/shared-cache-identities.d.ts +3 -0
  43. package/dist/chart/shared-cache-migration.d.ts +7 -0
  44. package/dist/chart/shared-cache-save.d.ts +3 -0
  45. package/dist/chart/shared-cache-scopes.d.ts +13 -0
  46. package/dist/chart/shared-cache.d.ts +11 -0
  47. package/dist/chart/shared-category.d.ts +4 -0
  48. package/dist/chart/shared-cell.d.ts +9 -0
  49. package/dist/chart/shared-family.d.ts +26 -0
  50. package/dist/chart/shared-fields.d.ts +18 -0
  51. package/dist/chart/shared-graph.d.ts +19 -0
  52. package/dist/chart/shared-growth-space.d.ts +5 -0
  53. package/dist/chart/shared-inserted-cells.d.ts +14 -0
  54. package/dist/chart/shared-inserted-command.d.ts +7 -0
  55. package/dist/chart/shared-inserted-layout.d.ts +16 -0
  56. package/dist/chart/shared-inserted-project.d.ts +14 -0
  57. package/dist/chart/shared-inserted-records.d.ts +16 -0
  58. package/dist/chart/shared-inserted-save.d.ts +6 -0
  59. package/dist/chart/shared-joint-command.d.ts +9 -0
  60. package/dist/chart/shared-joint-records.d.ts +9 -0
  61. package/dist/chart/shared-record-axis.d.ts +25 -0
  62. package/dist/chart/shared-record-remove.d.ts +13 -0
  63. package/dist/chart/shared-record-stage.d.ts +2 -0
  64. package/dist/chart/shared-records.d.ts +2 -0
  65. package/dist/chart/shared-rows.d.ts +17 -0
  66. package/dist/chart/shared-runtime.d.ts +19 -0
  67. package/dist/chart/shared-save-plan.d.ts +4 -0
  68. package/dist/chart/shared-save.d.ts +3 -0
  69. package/dist/chart/shared-series.d.ts +6 -0
  70. package/dist/chart/shared-source-cache.d.ts +4 -0
  71. package/dist/chart/shared-topology.d.ts +9 -0
  72. package/dist/chart/shared-unresolved.d.ts +3 -0
  73. package/dist/chart/shared-validation.d.ts +6 -0
  74. package/dist/chart/shared-workbook-source.d.ts +6 -0
  75. package/dist/chart/shared-xy-command.d.ts +7 -0
  76. package/dist/chart/shared-xy-family.d.ts +16 -0
  77. package/dist/chart/shared-xy-project.d.ts +6 -0
  78. package/dist/chart/shared-xy-records.d.ts +23 -0
  79. package/dist/chart/shared-xy-save.d.ts +5 -0
  80. package/dist/chart/shared-xy-source.d.ts +39 -0
  81. package/dist/chart/shared.d.ts +13 -0
  82. package/dist/chart/source.d.ts +11 -0
  83. package/dist/chart/types.d.ts +86 -0
  84. package/dist/chart/validation.d.ts +24 -0
  85. package/dist/chart/workbook-range.d.ts +16 -0
  86. package/dist/chart/workbook-read.d.ts +7 -0
  87. package/dist/chart/workbook-write.d.ts +9 -0
  88. package/dist/chart/workbook.d.ts +25 -0
  89. package/dist/chart/xml-data.d.ts +14 -0
  90. package/dist/chart/xml-namespaces.d.ts +16 -0
  91. package/dist/chart-design/index.d.ts +10 -0
  92. package/dist/chart-design/types.d.ts +11 -0
  93. package/dist/chart-design/xml.d.ts +2 -0
  94. package/dist/chart-design.js +361 -0
  95. package/dist/chart-ex/index.d.ts +15 -0
  96. package/dist/chart-ex/workbook.d.ts +6 -0
  97. package/dist/chart-ex/xml.d.ts +14 -0
  98. package/dist/chart-ex.js +457 -0
  99. package/dist/chart-shared/index.d.ts +12 -0
  100. package/dist/chart-shared.js +1 -0
  101. package/dist/chart.js +1 -0
  102. package/dist/clipboard-links-GuPtqr1z.js +778 -0
  103. package/dist/clipboard-package.d.ts +4 -0
  104. package/dist/clipboard-source.d.ts +6 -2
  105. package/dist/clipboard-trees.d.ts +9 -0
  106. package/dist/collaboration-identity.d.ts +3 -0
  107. package/dist/commands/add-slide-identity.d.ts +4 -0
  108. package/dist/commands/bullet-image-resource.d.ts +11 -0
  109. package/dist/commands/clear-format.d.ts +4 -0
  110. package/dist/commands/common-object-slide-patch.d.ts +4 -0
  111. package/dist/commands/common-object-slide-types.d.ts +68 -0
  112. package/dist/commands/convert-to-custom-geometry.d.ts +4 -0
  113. package/dist/commands/direct-format-patches.d.ts +11 -5
  114. package/dist/commands/distribute-elements.d.ts +4 -0
  115. package/dist/commands/edit-table-grid.d.ts +10 -0
  116. package/dist/commands/element-alt-text.d.ts +8 -0
  117. package/dist/commands/element-arrangement.d.ts +17 -0
  118. package/dist/commands/element-effects.d.ts +1 -1
  119. package/dist/commands/element-fill.d.ts +1 -1
  120. package/dist/commands/element-geometry.d.ts +9 -0
  121. package/dist/commands/element-hierarchy.d.ts +6 -0
  122. package/dist/commands/element-image-content.d.ts +2 -2
  123. package/dist/commands/element-link.d.ts +1 -1
  124. package/dist/commands/element-name.d.ts +1 -1
  125. package/dist/commands/element-stroke.d.ts +1 -1
  126. package/dist/commands/element-table-style.d.ts +5 -0
  127. package/dist/commands/element-text.d.ts +1 -1
  128. package/dist/commands/element-transform.d.ts +2 -2
  129. package/dist/commands/frame-decomposition.d.ts +10 -0
  130. package/dist/commands/generated-creation-defaults.d.ts +4 -0
  131. package/dist/commands/geometry-types.d.ts +44 -0
  132. package/dist/commands/group-types.d.ts +24 -0
  133. package/dist/commands/group.d.ts +4 -0
  134. package/dist/commands/hierarchy-record.d.ts +5 -0
  135. package/dist/commands/image-resource.d.ts +8 -1
  136. package/dist/commands/insertion-host.d.ts +16 -0
  137. package/dist/commands/insertion-rect.d.ts +2 -0
  138. package/dist/commands/layout-property.d.ts +7 -0
  139. package/dist/commands/master-property.d.ts +5 -0
  140. package/dist/commands/master-text-style-types.d.ts +27 -0
  141. package/dist/commands/master-text-style.d.ts +7 -0
  142. package/dist/commands/paste-resources.d.ts +9 -5
  143. package/dist/commands/patch-apply.d.ts +3 -0
  144. package/dist/commands/patch-count.d.ts +1 -0
  145. package/dist/commands/patch-invalidation.d.ts +4 -0
  146. package/dist/commands/patch-stage.d.ts +4 -0
  147. package/dist/commands/patch.d.ts +4 -0
  148. package/dist/commands/record-clone.d.ts +3 -0
  149. package/dist/commands/record-override.d.ts +5 -0
  150. package/dist/commands/replace-image.d.ts +6 -1
  151. package/dist/commands/sections.d.ts +10 -0
  152. package/dist/commands/set-geometry.d.ts +4 -0
  153. package/dist/commands/set-preset.d.ts +5 -0
  154. package/dist/commands/set-table-style.d.ts +3 -0
  155. package/dist/commands/slide-property-types.d.ts +55 -5
  156. package/dist/commands/slide-size.d.ts +7 -0
  157. package/dist/commands/spid.d.ts +2 -1
  158. package/dist/commands/table-grid-patch.d.ts +12 -0
  159. package/dist/commands/table-style-types.d.ts +28 -0
  160. package/dist/commands/text-target.d.ts +3 -2
  161. package/dist/commands/theme-types.d.ts +47 -0
  162. package/dist/commands/theme.d.ts +9 -0
  163. package/dist/commands/types.d.ts +219 -17
  164. package/dist/commands/ungroup-source.d.ts +3 -0
  165. package/dist/commands/ungroup.d.ts +4 -0
  166. package/dist/comments/index.d.ts +35 -0
  167. package/dist/comments/save.d.ts +3 -0
  168. package/dist/comments/state.d.ts +10 -0
  169. package/dist/comments/xml.d.ts +12 -0
  170. package/dist/comments.js +782 -0
  171. package/dist/common-object-slide-types.d.ts +34 -0
  172. package/dist/custom-geometry-path.d.ts +3 -0
  173. package/dist/custom-geometry.d.ts +12 -0
  174. package/dist/data-validation.d.ts +1 -1
  175. package/dist/describe/budget.d.ts +3 -0
  176. package/dist/describe/index.d.ts +5 -0
  177. package/dist/describe/read.d.ts +4 -0
  178. package/dist/describe/types.d.ts +103 -0
  179. package/dist/describe.js +192 -0
  180. package/dist/design-dependencies.d.ts +8 -0
  181. package/dist/design-projection-package.d.ts +10 -0
  182. package/dist/design-target.d.ts +10 -0
  183. package/dist/design.d.ts +3 -0
  184. package/dist/document-extensions.d.ts +9 -0
  185. package/dist/document.d.ts +1 -1
  186. package/dist/dynamic-projection.d.ts +6 -0
  187. package/dist/edit-core.js +5680 -3413
  188. package/dist/editor.d.ts +19 -2
  189. package/dist/element-source.d.ts +11 -0
  190. package/dist/element-spids.d.ts +4 -0
  191. package/dist/extension-address-journal.d.ts +9 -0
  192. package/dist/extension-address-remap.d.ts +14 -0
  193. package/dist/extension-addresses.d.ts +20 -0
  194. package/dist/extension-copy-history.d.ts +7 -0
  195. package/dist/extension-copy.d.ts +16 -0
  196. package/dist/extension-migration-receipt.d.ts +34 -0
  197. package/dist/extension-recovery-context.d.ts +5 -0
  198. package/dist/extension-runtime.d.ts +64 -0
  199. package/dist/generate/comments.d.ts +3 -0
  200. package/dist/generate/compatibility-parts.d.ts +14 -0
  201. package/dist/generate/compatibility-references.d.ts +3 -0
  202. package/dist/generate/compatibility.d.ts +4 -0
  203. package/dist/generate/custom-geometry.d.ts +2 -0
  204. package/dist/generate/index.d.ts +13 -0
  205. package/dist/generate/links.d.ts +3 -0
  206. package/dist/generate/master-defaults.d.ts +4 -0
  207. package/dist/generate/materialize.d.ts +2 -0
  208. package/dist/generate/math.d.ts +3 -0
  209. package/dist/generate/media.d.ts +13 -0
  210. package/dist/generate/portable-clipboard.d.ts +4 -0
  211. package/dist/generate/projection-tree.d.ts +8 -0
  212. package/dist/generate/table.d.ts +4 -0
  213. package/dist/generate/template.d.ts +70 -0
  214. package/dist/generate/text-body.d.ts +2 -0
  215. package/dist/generate/text-effects.d.ts +5 -0
  216. package/dist/generate/text-override.d.ts +8 -0
  217. package/dist/generate/validation.d.ts +3 -0
  218. package/dist/generate/warp.d.ts +2 -0
  219. package/dist/generate.js +1464 -0
  220. package/dist/history.d.ts +11 -1
  221. package/dist/hyperlink.d.ts +2 -0
  222. package/dist/identities.d.ts +4 -0
  223. package/dist/identity-allocation.d.ts +12 -0
  224. package/dist/identity-watermark.d.ts +4 -0
  225. package/dist/image-content.d.ts +5 -2
  226. package/dist/image-resource-history.d.ts +2 -0
  227. package/dist/index-C2r7c6G6.js +714 -0
  228. package/dist/index-CYDvbiwF.js +1 -0
  229. package/dist/index.d.ts +43 -7
  230. package/dist/ink/index.d.ts +27 -0
  231. package/dist/ink/model.d.ts +4 -0
  232. package/dist/ink/save.d.ts +3 -0
  233. package/dist/ink/source.d.ts +7 -0
  234. package/dist/ink.js +324 -0
  235. package/dist/layout-assets.d.ts +3 -1
  236. package/dist/layout-projection.d.ts +19 -5
  237. package/dist/layout-state.d.ts +2 -0
  238. package/dist/layout-types.d.ts +42 -0
  239. package/dist/layout.d.ts +5 -0
  240. package/dist/lint/color.d.ts +5 -0
  241. package/dist/lint/index.d.ts +7 -0
  242. package/dist/lint/prompts.d.ts +3 -0
  243. package/dist/lint/report.d.ts +21 -0
  244. package/dist/lint/sampler-batch.d.ts +4 -0
  245. package/dist/lint/sampler-images.d.ts +2 -0
  246. package/dist/lint/sampler.d.ts +9 -0
  247. package/dist/lint/snapshot.d.ts +34 -0
  248. package/dist/lint/types.d.ts +67 -0
  249. package/dist/lint-sampler.js +187 -0
  250. package/dist/lint.js +659 -0
  251. package/dist/master-state.d.ts +3 -0
  252. package/dist/master-text-style-state.d.ts +3 -0
  253. package/dist/master-types.d.ts +55 -0
  254. package/dist/master.d.ts +5 -0
  255. package/dist/media/audio-icon.d.ts +2 -0
  256. package/dist/media/commands.d.ts +3 -0
  257. package/dist/media/index.d.ts +10 -0
  258. package/dist/media/markup.d.ts +10 -0
  259. package/dist/media/mp4-boxes.d.ts +12 -0
  260. package/dist/media/mp4-fragments.d.ts +8 -0
  261. package/dist/media/mp4-samples.d.ts +4 -0
  262. package/dist/media/mp4.d.ts +2 -0
  263. package/dist/media/poster.d.ts +2 -0
  264. package/dist/media/replace-poster.d.ts +3 -0
  265. package/dist/media/resource.d.ts +4 -0
  266. package/dist/media/source.d.ts +14 -0
  267. package/dist/media/types.d.ts +33 -0
  268. package/dist/media-properties.d.ts +4 -0
  269. package/dist/media.js +1630 -0
  270. package/dist/model-invariants-BM19JVxy.js +8980 -0
  271. package/dist/object-source.d.ts +11 -0
  272. package/dist/ole/container.d.ts +14 -0
  273. package/dist/ole/content.d.ts +94 -0
  274. package/dist/ole/index.d.ts +20 -0
  275. package/dist/ole/preview.d.ts +3 -0
  276. package/dist/ole/save.d.ts +2 -0
  277. package/dist/ole/state.d.ts +16 -0
  278. package/dist/ole.js +870 -0
  279. package/dist/opc/patch.d.ts +2 -0
  280. package/dist/opc.js +1 -1
  281. package/dist/paragraph-level.d.ts +11 -0
  282. package/dist/paragraph-property-schema.d.ts +5 -2
  283. package/dist/{patch-DO8497wO.js → patch-BwhfBbYE.js} +112 -95
  284. package/dist/patch-change.d.ts +4 -0
  285. package/dist/patch-events.d.ts +16 -0
  286. package/dist/ppt/appearance.d.ts +11 -0
  287. package/dist/ppt/binary.d.ts +20 -0
  288. package/dist/ppt/drawing.d.ts +18 -0
  289. package/dist/ppt/geometry.d.ts +4 -0
  290. package/dist/ppt/index.d.ts +12 -0
  291. package/dist/ppt/pictures.d.ts +11 -0
  292. package/dist/ppt/text.d.ts +9 -0
  293. package/dist/ppt.js +774 -0
  294. package/dist/preset-geometry.d.ts +6 -0
  295. package/dist/projection.d.ts +2 -0
  296. package/dist/query-BHLjWjnu.js +903 -0
  297. package/dist/recovery-identity.d.ts +3 -1
  298. package/dist/recovery-migrations.d.ts +3 -0
  299. package/dist/recovery.d.ts +3 -0
  300. package/dist/resize/index.d.ts +6 -0
  301. package/dist/resize/text.d.ts +4 -0
  302. package/dist/resize.js +5090 -0
  303. package/dist/retained-element-origins.d.ts +6 -0
  304. package/dist/run-property-fields.d.ts +12 -0
  305. package/dist/run-property-schema.d.ts +3 -1
  306. package/dist/run-style.d.ts +15 -0
  307. package/dist/save/alt-text.d.ts +4 -0
  308. package/dist/save/comments.d.ts +3 -0
  309. package/dist/save/effects.d.ts +2 -1
  310. package/dist/save/extension-availability.d.ts +3 -0
  311. package/dist/save/extension-elements.d.ts +26 -0
  312. package/dist/save/geometry.d.ts +5 -0
  313. package/dist/save/index.d.ts +6 -1
  314. package/dist/save/insertion.d.ts +7 -3
  315. package/dist/save/layout-properties.d.ts +4 -0
  316. package/dist/save/master-properties.d.ts +5 -0
  317. package/dist/save/notes.d.ts +2 -0
  318. package/dist/save/paragraph-overrides.d.ts +3 -0
  319. package/dist/save/run-overrides.d.ts +10 -0
  320. package/dist/save/shape-format.d.ts +3 -0
  321. package/dist/save/slide-parts.d.ts +1 -0
  322. package/dist/save/table-style-part.d.ts +11 -0
  323. package/dist/save/table.d.ts +5 -0
  324. package/dist/save/text-source-less.d.ts +6 -0
  325. package/dist/save/xfrm.d.ts +8 -2
  326. package/dist/save.js +502 -1480
  327. package/dist/sections.d.ts +8 -0
  328. package/dist/session-assets.d.ts +4 -0
  329. package/dist/slide-parts-D0o_DDhi.js +1331 -0
  330. package/dist/slide-size.d.ts +6 -0
  331. package/dist/smartart/drawing.d.ts +3 -0
  332. package/dist/smartart/index.d.ts +16 -0
  333. package/dist/smartart/model.d.ts +18 -0
  334. package/dist/smartart/save.d.ts +3 -0
  335. package/dist/smartart.js +604 -0
  336. package/dist/source-retention.d.ts +7 -0
  337. package/dist/space.d.ts +37 -0
  338. package/dist/table-cell.d.ts +7 -1
  339. package/dist/table-direct-markup.d.ts +7 -1
  340. package/dist/table-grid-projection.d.ts +6 -0
  341. package/dist/table-grid.d.ts +45 -0
  342. package/dist/table-invariants.d.ts +4 -0
  343. package/dist/table-rows.d.ts +2 -1
  344. package/dist/table-scale.d.ts +4 -0
  345. package/dist/table-style.d.ts +21 -0
  346. package/dist/templates/index.d.ts +4 -0
  347. package/dist/templates/recipes.d.ts +5 -0
  348. package/dist/templates/types.d.ts +17 -0
  349. package/dist/templates.js +543 -0
  350. package/dist/text-flatten.d.ts +6 -0
  351. package/dist/text-fragment.d.ts +5 -0
  352. package/dist/text-model.d.ts +8 -8
  353. package/dist/text-override-validation.d.ts +6 -2
  354. package/dist/text-selection.d.ts +4 -0
  355. package/dist/theme-projection.d.ts +8 -0
  356. package/dist/theme-xml.d.ts +3 -0
  357. package/dist/theme.d.ts +14 -0
  358. package/dist/types.d.ts +217 -8
  359. package/dist/xml/index.d.ts +1 -1
  360. package/dist/xml/nodes.d.ts +2 -2
  361. package/dist/xml/shape-ids.d.ts +3 -0
  362. package/dist/xml.js +19 -16
  363. package/package.json +77 -5
  364. package/schemas/describe.schema.json +479 -0
  365. package/schemas/lint.schema.json +145 -0
  366. package/dist/index-D4ZTaYOa.js +0 -706
  367. package/dist/insertion-DabLme_U.js +0 -5471
@@ -0,0 +1,34 @@
1
+ import type { SectionId, SlideId } from './identities';
2
+ export interface ElementAltTextOverrides {
3
+ title?: string;
4
+ descr?: string;
5
+ }
6
+ export interface ElementAltTextState {
7
+ readonly title: string;
8
+ readonly descr: string;
9
+ readonly sourceTitle: string;
10
+ readonly sourceDescr: string;
11
+ readonly directTitle: boolean;
12
+ readonly directDescr: boolean;
13
+ readonly direct: boolean;
14
+ }
15
+ export interface SlideSizeState {
16
+ readonly w: number;
17
+ readonly h: number;
18
+ readonly sourceW: number;
19
+ readonly sourceH: number;
20
+ readonly direct: boolean;
21
+ }
22
+ export interface SectionRecord {
23
+ readonly id: SectionId;
24
+ /** 写回 p14:section@id 的 GUID;与会话身份分开,避免格式身份渗入命令目标。 */
25
+ readonly presentationId: string;
26
+ name: string;
27
+ slideIds: SlideId[];
28
+ }
29
+ export interface SectionState {
30
+ records: Record<SectionId, SectionRecord>;
31
+ order: SectionId[];
32
+ /** 仅显式节命令置为 true;普通增删页仍走保留未知 XML 的增量写回。 */
33
+ edited: boolean;
34
+ }
@@ -0,0 +1,3 @@
1
+ import type { CustomGeometry } from '@web-ppt/core';
2
+ /** 将 core 已求值的预设 SVG 路径显式物化为稳定寻址的自由形状模型。 */
3
+ export declare function customGeometryFromSvgPath(d: string, width: number, height: number, open?: boolean): CustomGeometry;
@@ -0,0 +1,12 @@
1
+ import type { CustomGeometry } from '@web-ppt/core';
2
+ import type { EditDoc, ElementId } from './types';
3
+ export declare function assertCustomGeometry(value: unknown, label: string): asserts value is CustomGeometry;
4
+ /** 投影读 value、保存写 expression;覆盖边界必须保证二者不会形成两套真相。 */
5
+ export declare function assertCustomGeometryOverride(current: CustomGeometry | null, value: unknown, label: string): asserts value is CustomGeometry;
6
+ export declare function queryElementCustomGeometry(doc: EditDoc, id: ElementId): CustomGeometry | null;
7
+ export declare function moveCustomGeometryPoint(geometry: CustomGeometry, pointId: string, position: {
8
+ readonly x: number;
9
+ readonly y: number;
10
+ }): CustomGeometry;
11
+ export declare function setCustomGeometryClosed(geometry: CustomGeometry, pathId: string, closed: boolean): CustomGeometry;
12
+ export declare function setCustomGeometrySegmentType(geometry: CustomGeometry, pathId: string, commandId: string, type: 'line' | 'cubic'): CustomGeometry;
@@ -1,6 +1,6 @@
1
1
  import type { TextPosition, TextRange } from './commands/types';
2
2
  export declare const own: (object: object, key: PropertyKey) => boolean;
3
- export declare function assertDataObject(value: unknown, fields: readonly string[], label: string): asserts value is object;
3
+ export declare function assertDataObject(value: unknown, fields: readonly string[] | ReadonlySet<PropertyKey>, label: string): asserts value is object;
4
4
  /** JSON 数组必须稠密且只能拥有索引与 length;否则序列化会吞掉空洞、访问器或附加状态。 */
5
5
  export declare function assertDataArray(value: unknown, label: string): asserts value is readonly unknown[];
6
6
  export declare function assertTextPosition(value: unknown, label: string): asserts value is TextPosition;
@@ -0,0 +1,3 @@
1
+ import type { DescribeOptions, PresentationDescription } from './types';
2
+ export declare function validateBudget(options: DescribeOptions): void;
3
+ export declare function applyBudget(full: PresentationDescription, options: DescribeOptions): PresentationDescription;
@@ -0,0 +1,5 @@
1
+ import type { EditDoc } from '@web-ppt/edit-core';
2
+ import type { DescribeOptions, PresentationDescription } from './types';
3
+ export declare function describePresentation(doc: EditDoc, options?: DescribeOptions): PresentationDescription;
4
+ export { DescribeError } from './types';
5
+ export type { DescribeFailureReason, DescribeOptions, DescriptionElement, DescriptionParagraph, DescriptionPlaceholder, DescriptionReference, DescriptionSlide, PresentationDescription, } from './types';
@@ -0,0 +1,4 @@
1
+ import type { SlideElement } from '@web-ppt/core';
2
+ import type { EditDoc } from '@web-ppt/edit-core';
3
+ import type { PresentationDescription } from './types';
4
+ export declare function readDescription(doc: EditDoc, observe?: (page: number, id: string, element: SlideElement) => void): PresentationDescription;
@@ -0,0 +1,103 @@
1
+ export interface DescriptionReference {
2
+ readonly id: string;
3
+ readonly name: string;
4
+ }
5
+ export interface DescriptionPlaceholder {
6
+ readonly type: string;
7
+ readonly index: string | null;
8
+ readonly layout: {
9
+ readonly id: string;
10
+ readonly elementId: string;
11
+ } | null;
12
+ readonly master: {
13
+ readonly id: string;
14
+ readonly elementId: string;
15
+ } | null;
16
+ }
17
+ export interface DescriptionParagraph {
18
+ readonly text: string;
19
+ readonly level: number;
20
+ readonly bullet: {
21
+ readonly kind: 'none' | 'text' | 'image';
22
+ readonly text: string | null;
23
+ readonly numbering: {
24
+ readonly type: string;
25
+ readonly startAt: number;
26
+ } | null;
27
+ };
28
+ readonly cell: {
29
+ readonly row: number;
30
+ readonly column: number;
31
+ } | null;
32
+ }
33
+ export interface DescriptionElement {
34
+ readonly id: string;
35
+ readonly kind: 'shape' | 'image' | 'group' | 'table' | 'unsupported';
36
+ readonly name: string;
37
+ readonly altText: {
38
+ readonly title: string;
39
+ readonly description: string;
40
+ };
41
+ /** 根到自身的稳定 ID;先序截断后仍能解析每个已返回元素的祖先。 */
42
+ readonly path: readonly string[];
43
+ readonly canvas: {
44
+ readonly kind: 'slide' | 'layout' | 'master';
45
+ readonly id: string;
46
+ };
47
+ readonly bounds: {
48
+ readonly x: number;
49
+ readonly y: number;
50
+ readonly width: number;
51
+ readonly height: number;
52
+ };
53
+ readonly editable: 'full' | 'frame' | 'none';
54
+ readonly hidden: boolean;
55
+ readonly locked: boolean;
56
+ readonly placeholder: DescriptionPlaceholder | null;
57
+ readonly paragraphs: readonly DescriptionParagraph[];
58
+ }
59
+ export interface DescriptionSlide {
60
+ readonly id: string;
61
+ /** 面向使用者的页码,从 1 开始,包含隐藏页。 */
62
+ readonly number: number;
63
+ readonly hidden: boolean;
64
+ readonly layout: DescriptionReference | null;
65
+ readonly master: DescriptionReference | null;
66
+ readonly section: DescriptionReference | null;
67
+ readonly notes: string;
68
+ readonly elements: readonly DescriptionElement[];
69
+ }
70
+ export interface PresentationDescription {
71
+ readonly version: 1;
72
+ readonly source: 'pptx' | 'ppt';
73
+ readonly width: number;
74
+ readonly height: number;
75
+ readonly totalSlides: number;
76
+ /** 按页面计数,同一个设计对象在不同页面出现时分别计入。 */
77
+ readonly totalElements: number;
78
+ readonly slides: readonly DescriptionSlide[];
79
+ readonly truncation: {
80
+ readonly reason: 'max-chars' | 'max-tokens' | null;
81
+ readonly omittedSlides: number;
82
+ readonly omittedElements: number;
83
+ /** elementId 为 null 时,截断发生在整页元数据之前。 */
84
+ readonly next: {
85
+ readonly slideNumber: number;
86
+ readonly elementId: string | null;
87
+ } | null;
88
+ };
89
+ }
90
+ export interface DescribeOptions {
91
+ /** JSON.stringify(result) 的 UTF-16 单元数上限,包含截断说明。 */
92
+ readonly maxChars?: number;
93
+ readonly maxTokens?: number;
94
+ /** 使用目标模型的计数规则;设置 maxTokens 时必须提供,返回非负安全整数。 */
95
+ readonly countTokens?: (json: string) => number;
96
+ }
97
+ export type DescribeFailureReason = 'invalid-budget' | 'token-counter-required' | 'invalid-token-count' | 'token-count-failed' | 'budget-too-small' | 'invalid-document' | 'unaddressable-element' | 'invalid-geometry';
98
+ export declare class DescribeError extends Error {
99
+ readonly reason: DescribeFailureReason;
100
+ readonly slideNumber: number | null;
101
+ readonly elementId: string | null;
102
+ constructor(reason: DescribeFailureReason, message: string, slideNumber?: number | null, elementId?: string | null);
103
+ }
@@ -0,0 +1,192 @@
1
+ import { findPlaceholderByIdentity as D } from "@web-ppt/core";
2
+ import { toSlide as q, sectionOfSlide as F, querySelectionPane as L, effectiveElement as U, elementWorldBounds as H, queryElementAltText as J } from "@web-ppt/edit-core";
3
+ class c extends Error {
4
+ constructor(n, t, r = null, i = null) {
5
+ super(t), this.reason = n, this.slideNumber = r, this.elementId = i, this.name = "DescribeError";
6
+ }
7
+ }
8
+ function Q(e) {
9
+ if (!e || typeof e != "object" || Array.isArray(e))
10
+ throw new c("invalid-budget", "describe.options 必须为预算选项对象");
11
+ for (const n of ["maxChars", "maxTokens"]) {
12
+ const t = e[n];
13
+ if (t !== void 0 && (!Number.isSafeInteger(t) || t < 0))
14
+ throw new c("invalid-budget", `describe.${n} 实际为 ${String(t)},必须为非负安全整数`);
15
+ }
16
+ if (e.maxTokens !== void 0 && typeof e.countTokens != "function")
17
+ throw new c("token-counter-required", "describe.maxTokens 必须同时提供目标模型的 countTokens(json)");
18
+ }
19
+ function R(e, n) {
20
+ if (n.maxChars === void 0 && n.maxTokens === void 0) return e;
21
+ const t = (d) => {
22
+ const m = JSON.stringify(d);
23
+ let h = 0;
24
+ if (n.maxTokens !== void 0)
25
+ try {
26
+ h = n.countTokens(m);
27
+ } catch (f) {
28
+ throw new c("token-count-failed", `describe.countTokens 执行失败:${f instanceof Error ? f.message : String(f)}`);
29
+ }
30
+ if (!Number.isSafeInteger(h) || h < 0)
31
+ throw new c("invalid-token-count", `describe.countTokens 实际返回 ${String(h)},必须为非负安全整数`);
32
+ return n.maxChars !== void 0 && m.length > n.maxChars ? "max-chars" : n.maxTokens !== void 0 && h > n.maxTokens ? "max-tokens" : null;
33
+ }, r = t(e);
34
+ if (!r) return e;
35
+ const i = e.totalElements + e.totalSlides, s = (d) => {
36
+ const m = [];
37
+ let h = 0, f = d, x = null;
38
+ for (const w of e.slides) {
39
+ if (!f) {
40
+ x = { slideNumber: w.number, elementId: null };
41
+ break;
42
+ }
43
+ f--;
44
+ const b = Math.min(f, w.elements.length), E = w.elements.slice(0, b);
45
+ if (m.push({ ...w, elements: E }), h += b, f -= b, b < w.elements.length) {
46
+ x = { slideNumber: w.number, elementId: w.elements[b].id };
47
+ break;
48
+ }
49
+ }
50
+ return {
51
+ ...e,
52
+ slides: m,
53
+ truncation: { reason: r, omittedSlides: e.totalSlides - m.length, omittedElements: e.totalElements - h, next: x }
54
+ };
55
+ };
56
+ let a = s(0);
57
+ if (t(a)) throw new c("budget-too-small", `describe 的 ${r} 预算不足以容纳最小结果及截断定位`);
58
+ let u = 0, p = i - 1;
59
+ for (; u < p; ) {
60
+ const d = Math.ceil((u + p) / 2), m = s(d);
61
+ t(m) ? p = d - 1 : (u = d, a = m);
62
+ }
63
+ return a;
64
+ }
65
+ function W(e, n) {
66
+ let t = e.elements[n];
67
+ const r = /* @__PURE__ */ new Set();
68
+ for (; t; ) {
69
+ if (r.has(t.id)) throw new Error(`元素父链成环:${t.id}`);
70
+ if (r.add(t.id), e.slides[t.parent]) return { kind: "slide", id: t.parent };
71
+ if (e.layouts[t.parent]) return { kind: "layout", id: t.parent };
72
+ if (e.masters[t.parent]) return { kind: "master", id: t.parent };
73
+ t = e.elements[t.parent];
74
+ }
75
+ throw new Error(`元素 ${n} 的父链没有画布根`);
76
+ }
77
+ function P(e, n = !1) {
78
+ const t = (r, i) => ((r == null ? void 0 : r.paragraphs) ?? []).map((s) => {
79
+ var u;
80
+ const a = (u = s.editInfo) == null ? void 0 : u.autoNumbering;
81
+ return {
82
+ text: s.runs.map((p) => p.text).join(""),
83
+ level: s.lvl,
84
+ cell: i,
85
+ bullet: {
86
+ kind: s.bulletImage ? "image" : s.bullet !== null ? "text" : "none",
87
+ text: s.bullet,
88
+ numbering: a ? { type: a.scheme, startAt: a.startAt } : null
89
+ }
90
+ };
91
+ });
92
+ return e.kind === "shape" ? t(e.text, null) : e.kind === "group" && n ? e.children.flatMap((r) => P(r, !0)) : e.kind !== "table" ? [] : e.rows.flatMap((r, i) => r.cells.flatMap((s, a) => s.merged ? [] : t(s.text, { row: i, column: a })));
93
+ }
94
+ function z(e, n, t) {
95
+ const r = e.elements[t].meta.ph;
96
+ if (!r) return null;
97
+ const i = e.layouts[e.slides[n].layoutId ?? ""], s = i ? e.masters[i.origin.masterPart] : void 0, a = (m, h) => D(
98
+ m,
99
+ (f) => e.elements[f].meta.ph,
100
+ h
101
+ ), u = i ? a(i.children, r) : void 0, p = u ? e.elements[u].meta.ph : r, d = s ? a(s.children, p) : void 0;
102
+ return {
103
+ type: r.type,
104
+ index: r.idx ?? null,
105
+ layout: u ? { id: i.id, elementId: u } : null,
106
+ master: d ? { id: s.id, elementId: d } : null
107
+ };
108
+ }
109
+ function G(e, n, t, r) {
110
+ const i = q(e, n), s = e.slides[n], a = e.layouts[s.layoutId ?? ""], u = a ? e.masters[a.origin.masterPart] : void 0, p = F(e, n), d = p ? e.sections.records[p] : null, m = L(e, n), h = m.filter((l) => l.parentId === null).reverse().map((l) => l.id), f = new Map(m.map((l) => [l.id, l])), x = [...(u == null ? void 0 : u.children) ?? [], ...(a == null ? void 0 : a.children) ?? []], w = [], b = (l, o, $, T, S) => {
111
+ var M;
112
+ const g = e.elements[o];
113
+ if (!g || $.includes(o))
114
+ throw new c("unaddressable-element", `页面 ${t} 元素 ${o} 缺少有效的无环编辑身份`, t, o);
115
+ const k = H(e, o);
116
+ if (!Object.values(k).every(Number.isFinite))
117
+ throw new c("invalid-geometry", `页面 ${t} 元素 ${o} 的包围盒必须为有限数值`, t, o);
118
+ const y = J(e, o), v = f.get(o), N = [...$, o], I = T || (v == null ? void 0 : v.hidden) === !0 || g.meta.hiddenByUser === !0, j = S || (v == null ? void 0 : v.locked) === !0 || g.meta.locked === !0 || g.meta.moveLocked === !0, B = l.kind === "group" && (g.meta.editable === "frame" || ((M = l.editInfo) == null ? void 0 : M.editable) === "frame");
119
+ if (w.push({
120
+ id: o,
121
+ kind: l.kind,
122
+ name: (v == null ? void 0 : v.name) ?? l.name ?? "",
123
+ altText: { title: y.title, description: y.descr },
124
+ path: N,
125
+ canvas: W(e, o),
126
+ bounds: { x: k.left, y: k.top, width: k.right - k.left, height: k.bottom - k.top },
127
+ editable: g.meta.editable,
128
+ hidden: I,
129
+ locked: j,
130
+ placeholder: z(e, n, o),
131
+ paragraphs: P(l, B)
132
+ }), l.kind === "group" && !B) {
133
+ const O = g.children ?? [];
134
+ if (O.length !== l.children.length)
135
+ throw new c("unaddressable-element", `页面 ${t} 组合 ${o} 的投影后代与编辑记录数量不符`, t, o);
136
+ l.children.forEach((A, C) => b(A, O[C], N, I, j));
137
+ }
138
+ }, E = i.elements.length - h.length;
139
+ if (E < 0) throw new c("invalid-document", `页面 ${t} 的投影根数量小于编辑根数量`, t);
140
+ return i.elements.forEach((l, o) => {
141
+ var T;
142
+ let $ = h[o - E];
143
+ if (o < E) {
144
+ const S = (T = l.editInfo) == null ? void 0 : T.origin, g = x.filter((k) => {
145
+ if (U(e, k) === l) return !0;
146
+ const y = e.elements[k].meta.origin;
147
+ return !!S && (y == null ? void 0 : y.part) === S.part && y.spid === S.spid;
148
+ });
149
+ if (g.length !== 1)
150
+ throw new c("unaddressable-element", `页面 ${t} 设计投影 ${l.name ?? o} 必须对应唯一编辑记录,实际 ${g.length} 个`, t);
151
+ $ = g[0];
152
+ }
153
+ b(l, $, [], !1, !1);
154
+ }), {
155
+ id: n,
156
+ number: t,
157
+ hidden: i.hidden === !0,
158
+ layout: a ? { id: a.id, name: a.name } : i.layoutName ? { id: "", name: i.layoutName } : null,
159
+ master: u ? { id: u.id, name: u.name } : null,
160
+ section: d ? { id: d.id, name: d.name } : null,
161
+ notes: i.notes ?? "",
162
+ elements: w
163
+ };
164
+ }
165
+ function K(e, n) {
166
+ if (!e || !e.meta || !Number.isFinite(e.meta.width) || !Number.isFinite(e.meta.height) || e.meta.width <= 0 || e.meta.height <= 0 || !["pptx", "ppt"].includes(e.meta.source))
167
+ throw new c("invalid-document", "describe 要求尺寸为正有限数值、来源为 pptx/ppt 的 EditDoc");
168
+ const t = e.slideOrder.map((r, i) => {
169
+ try {
170
+ return G(e, r, i + 1, n);
171
+ } catch (s) {
172
+ throw s instanceof c ? s : new c("invalid-document", `页面 ${i + 1}(${r})读取失败:${s instanceof Error ? s.message : String(s)}`, i + 1);
173
+ }
174
+ });
175
+ return {
176
+ version: 1,
177
+ source: e.meta.source,
178
+ width: e.meta.width,
179
+ height: e.meta.height,
180
+ totalSlides: t.length,
181
+ totalElements: t.reduce((r, i) => r + i.elements.length, 0),
182
+ slides: t,
183
+ truncation: { reason: null, omittedSlides: 0, omittedElements: 0, next: null }
184
+ };
185
+ }
186
+ function Y(e, n = {}) {
187
+ return Q(n), R(K(e), n);
188
+ }
189
+ export {
190
+ c as DescribeError,
191
+ Y as describePresentation
192
+ };
@@ -0,0 +1,8 @@
1
+ import type { EditDoc, SlideId } from './types';
2
+ export declare function slidesForTheme(doc: EditDoc, themeId: string): ReadonlySet<SlideId>;
3
+ export declare function slidesForLayout(doc: EditDoc, layoutId: string): ReadonlySet<SlideId>;
4
+ export declare function slidesForMaster(doc: EditDoc, masterId: string): ReadonlySet<SlideId>;
5
+ /** 页面树与换版式命令在模型落地前后各调用一次,热路径无需重扫全部页面。 */
6
+ export declare function beforeSlideDesignChange(doc: EditDoc, slideId: SlideId): void;
7
+ export declare function afterSlideDesignChange(doc: EditDoc, slideId: SlideId): void;
8
+ export declare function releaseDesignDependencies(doc: EditDoc): void;
@@ -0,0 +1,10 @@
1
+ import { type OpcPackage } from '@web-ppt/core';
2
+ import type { EditDoc } from './types';
3
+ /** 母版元素的来源只含主题与母版属性;元素覆盖必须留到 effectiveElement 统一应用一次。 */
4
+ export declare function masterSourceProjectionPackage(doc: EditDoc): OpcPackage | null;
5
+ /**
6
+ * 母版元素覆盖物化到页面/版式重解析专用 OPC 视图;来源查询改走上面的属性视图,
7
+ * 因而页面能看到完整设计改动,母版元素自身又不会重复叠加同一份覆盖。
8
+ */
9
+ export declare function designProjectionPackage(doc: EditDoc): OpcPackage | null;
10
+ export declare function releaseDesignProjectionPackage(doc: EditDoc): void;
@@ -0,0 +1,10 @@
1
+ import type { EditDoc, DesignTarget, ElementId, SlideId } from './types';
2
+ export type CanvasTarget = {
3
+ readonly kind: 'slide';
4
+ readonly id: SlideId;
5
+ } | DesignTarget;
6
+ export declare function assertDesignTarget(doc: EditDoc, target: DesignTarget): void;
7
+ export declare function canvasTargetOfElement(doc: EditDoc, id: ElementId): CanvasTarget;
8
+ export declare function canvasChildren(doc: EditDoc, target: CanvasTarget): ElementId[];
9
+ export declare function isCanvasRoot(doc: EditDoc, id: string): boolean;
10
+ export declare function sameCanvas(left: CanvasTarget, right: CanvasTarget): boolean;
@@ -0,0 +1,3 @@
1
+ import type { Slide } from '@web-ppt/core';
2
+ import type { DesignTarget, EditDoc } from './types';
3
+ export declare function toDesignCanvas(doc: EditDoc, target: DesignTarget): Slide;
@@ -0,0 +1,9 @@
1
+ import type { EditDoc } from './types';
2
+ import type { DocumentExtensionPatch } from './commands/types';
3
+ /** 会话与保存入口只校验存储协议;未加载扩展的领域数据仍须能冷恢复。 */
4
+ export declare function assertDocumentExtensions(value: unknown): void;
5
+ export declare function isDocumentExtensionPatch(patch: {
6
+ path: readonly unknown[];
7
+ }): patch is DocumentExtensionPatch;
8
+ export declare function validateDocumentExtensionPatch(doc: EditDoc, patch: DocumentExtensionPatch, index: number): void;
9
+ export declare function applyDocumentExtensionPatch(doc: EditDoc, patch: DocumentExtensionPatch): void;
@@ -1,4 +1,4 @@
1
- import type { Presentation, SlideElement } from '@web-ppt/core';
1
+ import { type Presentation, type SlideElement } from '@web-ppt/core';
2
2
  import type { CreateDocOptions, EditDoc, EditableKind, ElementId, ElementMeta, SlideId } from './types';
3
3
  export declare function elementMetaOf(el: SlideElement, inherited: EditableKind, source: Presentation['source'], writablePart: string | null): ElementMeta;
4
4
  export declare function createDoc(pres: Presentation, opts?: CreateDocOptions): EditDoc;
@@ -0,0 +1,6 @@
1
+ import type { SlideElement } from '@web-ppt/core';
2
+ import type { EditDoc, SlideId } from './types';
3
+ /** 稳定模型元素的组后代会分别投影,因此这里只处理当前节点。 */
4
+ export declare const projectElementSlideFields: (doc: EditDoc, slideId: SlideId, element: SlideElement) => SlideElement;
5
+ /** 版式虚拟节点没有 ElementRecord,动态字段必须在值树内递归求值。 */
6
+ export declare const projectVirtualSlideFields: (doc: EditDoc, slideId: SlideId, element: SlideElement) => SlideElement;