@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
@@ -1,3 +1,8 @@
1
+ import type { ImageElement } from '@web-ppt/core';
1
2
  import type { EditDoc } from '../types';
2
- import type { CommandPatches, ReplaceImageCommand } from './types';
3
+ import type { ClipboardResource, CommandPatches, ReplaceImageCommand } from './types';
3
4
  export declare function replaceImagePatches(doc: EditDoc, command: ReplaceImageCommand, origin: string): CommandPatches;
5
+ /** 普通图片与媒体海报只替换同一张 blip;资源、历史和保存不能各维护一套。 */
6
+ export declare function replaceImageResourcePatches(doc: EditDoc, record: EditDoc['elements'][string] & {
7
+ src: ImageElement;
8
+ }, resource: ClipboardResource, origin: string): CommandPatches;
@@ -0,0 +1,10 @@
1
+ import type { EditDoc, SectionState } from '../types';
2
+ import type { AddSectionCommand, CommandPatches, MoveSectionCommand, Patch, RemoveSectionCommand, RenameSectionCommand, SectionStatePatch } from './types';
3
+ export declare function assertSectionState(doc: EditDoc, value: unknown, label: string): asserts value is SectionState;
4
+ export declare function isSectionStatePatch(patch: Patch): patch is SectionStatePatch;
5
+ export declare function validateSectionStatePatch(doc: EditDoc, patch: SectionStatePatch, index: number): void;
6
+ export declare function applySectionStatePatch(doc: EditDoc, patch: SectionStatePatch): void;
7
+ export declare function addSectionPatches(doc: EditDoc, command: AddSectionCommand, origin: string): CommandPatches;
8
+ export declare function renameSectionPatches(doc: EditDoc, command: RenameSectionCommand, origin: string): CommandPatches;
9
+ export declare function moveSectionPatches(doc: EditDoc, command: MoveSectionCommand, origin: string): CommandPatches;
10
+ export declare function removeSectionPatches(doc: EditDoc, command: RemoveSectionCommand, origin: string): CommandPatches;
@@ -0,0 +1,4 @@
1
+ import type { EditDoc } from '../types';
2
+ import type { CommandPatches } from './types';
3
+ import type { SetGeometryCommand } from './geometry-types';
4
+ export declare function setGeometryPatches(doc: EditDoc, command: SetGeometryCommand, origin: string): CommandPatches;
@@ -0,0 +1,5 @@
1
+ import type { EditDoc } from '../types';
2
+ import type { CommandPatches } from './types';
3
+ import type { SetAdjCommand, SetPresetCommand } from './geometry-types';
4
+ export declare function setPresetPatches(doc: EditDoc, command: SetPresetCommand, origin: string): CommandPatches;
5
+ export declare function setAdjPatches(doc: EditDoc, command: SetAdjCommand, origin: string): CommandPatches;
@@ -0,0 +1,3 @@
1
+ import type { EditDoc } from '../types';
2
+ import type { CommandPatches, SetTableStyleCommand } from './types';
3
+ export declare function setTableStylePatches(doc: EditDoc, command: SetTableStyleCommand, origin: string): CommandPatches;
@@ -1,14 +1,23 @@
1
1
  import type { Fill, ImageTilePlacement, Transition } from '@web-ppt/core';
2
2
  import type { SlideTransitionInput } from '../slide-transition';
3
- import type { EditAnimationStep, ImageCrop, SlideId, SlideImageBackground, SlideNotesBinding } from '../types';
4
- export interface SetBackgroundCommand {
3
+ import type { DesignTarget, EditAnimationStep, ImageCrop, LayoutDesignTarget, SlideId, SlideImageBackground, SlideNotesBinding } from '../types';
4
+ export type SetBackgroundCommand = {
5
5
  readonly type: 'SetBackground';
6
6
  readonly id: SlideId;
7
+ readonly target?: never;
7
8
  /** null 恢复来源;显式无背景使用 { type: 'none' }。 */
8
9
  readonly fill: Exclude<Fill, {
9
10
  type: 'image';
10
11
  }> | null;
11
- }
12
+ } | {
13
+ readonly type: 'SetBackground';
14
+ readonly target: DesignTarget;
15
+ readonly id?: never;
16
+ /** null 恢复来源;版式背景不接受图片,避免隐式扩张 OPC 资源闭包。 */
17
+ readonly fill: Exclude<Fill, {
18
+ type: 'image';
19
+ }> | null;
20
+ };
12
21
  export interface SetBackgroundImageCommand {
13
22
  readonly type: 'SetBackgroundImage';
14
23
  readonly id: SlideId;
@@ -31,12 +40,18 @@ export interface SetHiddenCommand {
31
40
  /** null 恢复来源;false 可覆盖来源隐藏页。 */
32
41
  readonly v: boolean | null;
33
42
  }
34
- export interface SetTransitionCommand {
43
+ export type SetTransitionCommand = {
35
44
  readonly type: 'SetTransition';
36
45
  readonly id: SlideId;
46
+ readonly target?: never;
37
47
  /** null 恢复来源;type=none 明确关闭切换。 */
38
48
  readonly t: SlideTransitionInput | null;
39
- }
49
+ } | {
50
+ readonly type: 'SetTransition';
51
+ readonly target: LayoutDesignTarget;
52
+ readonly id?: never;
53
+ readonly t: SlideTransitionInput | null;
54
+ };
40
55
  export interface SetAnimationsCommand {
41
56
  readonly type: 'SetAnimations';
42
57
  readonly slideId: SlideId;
@@ -133,3 +148,38 @@ export type SlideAnimationsPatch = {
133
148
  readonly origin: string;
134
149
  };
135
150
  export type SlidePropertyPatch = SlideBackgroundPatch | SlideBackgroundImagePatch | SlideHiddenPatch | SlideTransitionPatch | SlideAnimationsPatch;
151
+ export type LayoutBackgroundPatch = {
152
+ readonly op: 'set';
153
+ readonly path: readonly ['layouts', string, 'ovr', 'background'];
154
+ readonly value: Exclude<Fill, {
155
+ type: 'image';
156
+ }>;
157
+ readonly origin: string;
158
+ } | {
159
+ readonly op: 'del';
160
+ readonly path: readonly ['layouts', string, 'ovr', 'background'];
161
+ readonly origin: string;
162
+ };
163
+ export type LayoutTransitionPatch = {
164
+ readonly op: 'set';
165
+ readonly path: readonly ['layouts', string, 'ovr', 'transition'];
166
+ readonly value: Transition;
167
+ readonly origin: string;
168
+ } | {
169
+ readonly op: 'del';
170
+ readonly path: readonly ['layouts', string, 'ovr', 'transition'];
171
+ readonly origin: string;
172
+ };
173
+ export type LayoutPropertyPatch = LayoutBackgroundPatch | LayoutTransitionPatch;
174
+ export type MasterBackgroundPatch = {
175
+ readonly op: 'set';
176
+ readonly path: readonly ['masters', string, 'ovr', 'background'];
177
+ readonly value: Exclude<Fill, {
178
+ type: 'image';
179
+ }>;
180
+ readonly origin: string;
181
+ } | {
182
+ readonly op: 'del';
183
+ readonly path: readonly ['masters', string, 'ovr', 'background'];
184
+ readonly origin: string;
185
+ };
@@ -0,0 +1,7 @@
1
+ import type { EditDoc } from '../types';
2
+ import type { CommandPatches, DocumentSizePatch, Patch, SetSlideSizeCommand } from './types';
3
+ export declare function isDocumentSizePatch(patch: Patch): patch is DocumentSizePatch;
4
+ export declare function validateDocumentSizePatch(patch: DocumentSizePatch, index: number): void;
5
+ export declare function applyDocumentSizePatch(doc: EditDoc, patch: DocumentSizePatch): void;
6
+ /** 画布与内容变化属于同一历史事务;按需策略只负责产出内容补丁。 */
7
+ export declare function setSlideSizePatches(doc: EditDoc, command: SetSlideSizeCommand, origin: string): CommandPatches;
@@ -1,4 +1,5 @@
1
1
  import type { EditDoc } from '../types';
2
+ export declare function maxPartSpid(doc: EditDoc, part: string): number;
3
+ export declare function prepareElementSpidNamespaces(doc: EditDoc): void;
2
4
  /** 来源 XML 里还有不进入 Schema 的 cNvPr;只扫模型会在空页或未知宿主上复用 spid。 */
3
5
  export declare function allocateElementSpid(doc: EditDoc, part: string): number;
4
- export declare function partSpidAllocator(doc: EditDoc, part: string): () => number;
@@ -0,0 +1,12 @@
1
+ import type { EditDoc, ElementRecord } from '../types';
2
+ import type { Patch, TableCellPropsPatch, TableColumnPatch, TableGridEntryPatch, TableMergePatch } from './types';
3
+ export declare function isTableColumnPatch(patch: Patch): patch is TableColumnPatch;
4
+ export declare function isTableGridEntryPatch(patch: Patch): patch is TableGridEntryPatch;
5
+ export declare function isTableMergePatch(patch: Patch): patch is TableMergePatch;
6
+ export declare function isTableCellPropsPatch(patch: Patch): patch is TableCellPropsPatch;
7
+ export declare function validateTableColumnPatch(doc: EditDoc, patch: TableColumnPatch, index: number): void;
8
+ export declare function validateTableGridEntryPatch(doc: EditDoc, patch: TableGridEntryPatch, index: number): void;
9
+ export declare function assertTableMergeRegions(record: ElementRecord, value: unknown, label: string): void;
10
+ export declare function validateTableMergePatch(doc: EditDoc, patch: TableMergePatch, index: number): void;
11
+ export declare function validateTableCellPropsPatch(doc: EditDoc, patch: TableCellPropsPatch, index: number): void;
12
+ export declare function applyTableGridPatch(doc: EditDoc, patch: TableColumnPatch | TableGridEntryPatch | TableMergePatch | TableCellPropsPatch): void;
@@ -0,0 +1,28 @@
1
+ import type { TableStyleSettings } from '@web-ppt/core';
2
+ import type { ElementId } from '../types';
3
+ type TableStyleSwitches = Omit<TableStyleSettings, 'styleId'>;
4
+ export type SetTableStyleCommand = {
5
+ readonly type: 'SetTableStyle';
6
+ readonly id: ElementId;
7
+ } & ({
8
+ readonly styleId: null;
9
+ readonly firstRow?: never;
10
+ readonly lastRow?: never;
11
+ readonly bandRow?: never;
12
+ readonly firstCol?: never;
13
+ readonly lastCol?: never;
14
+ readonly bandCol?: never;
15
+ } | ({
16
+ readonly styleId: string;
17
+ } & TableStyleSwitches));
18
+ export type ElementTableStylePatch = {
19
+ readonly op: 'set';
20
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableStyle'];
21
+ readonly value: TableStyleSettings;
22
+ readonly origin: string;
23
+ } | {
24
+ readonly op: 'del';
25
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableStyle'];
26
+ readonly origin: string;
27
+ };
28
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { TextBody } from '@web-ppt/core';
2
- import type { EditDoc, ElementRecord, TableCellAddress, TableCellRowRef, TextOverride } from '../types';
2
+ import type { EditDoc, ElementRecord, TableCellAddress, TableCellColumnRef, TableCellRowRef, TextOverride } from '../types';
3
3
  import type { ElementTextPatch } from './types';
4
4
  export interface TextTarget {
5
5
  readonly id: string;
@@ -8,6 +8,7 @@ export interface TextTarget {
8
8
  export interface TextTargetContext {
9
9
  readonly record: ElementRecord;
10
10
  readonly body: TextBody;
11
+ readonly levelTemplate?: TextBody;
11
12
  readonly before: TextOverride | undefined;
12
13
  readonly patchTarget: TextPatchTarget;
13
14
  readonly empty: boolean;
@@ -16,7 +17,7 @@ export interface TextPatchTarget {
16
17
  readonly id: string;
17
18
  readonly cell?: {
18
19
  readonly row: TableCellRowRef;
19
- readonly c: number;
20
+ readonly column: TableCellColumnRef;
20
21
  };
21
22
  }
22
23
  export declare function textTargetContextForRecord(record: ElementRecord, target: TextTarget): TextTargetContext;
@@ -0,0 +1,47 @@
1
+ import type { ThemeColorSlot } from '@web-ppt/core';
2
+ export interface ThemeFontCommandValue {
3
+ readonly latin?: string | null;
4
+ readonly ea?: string | null;
5
+ readonly cs?: string | null;
6
+ readonly scripts?: Readonly<Record<string, string | null>>;
7
+ }
8
+ export interface SetThemeCommand {
9
+ readonly type: 'SetTheme';
10
+ readonly id: string;
11
+ /** null 恢复该槽的来源值;未出现的槽保持当前覆盖。 */
12
+ readonly clrScheme?: Readonly<Partial<Record<ThemeColorSlot, string | null>>>;
13
+ readonly fontScheme?: {
14
+ readonly major?: ThemeFontCommandValue;
15
+ readonly minor?: ThemeFontCommandValue;
16
+ };
17
+ }
18
+ export type ThemeColorPatch = {
19
+ readonly op: 'set';
20
+ readonly path: readonly ['themes', string, 'ovr', 'colors', ThemeColorSlot];
21
+ readonly value: string;
22
+ readonly origin: string;
23
+ } | {
24
+ readonly op: 'del';
25
+ readonly path: readonly ['themes', string, 'ovr', 'colors', ThemeColorSlot];
26
+ readonly origin: string;
27
+ };
28
+ export type ThemeFontPatch = {
29
+ readonly op: 'set';
30
+ readonly path: readonly ['themes', string, 'ovr', 'fonts', 'major' | 'minor', 'latin' | 'ea' | 'cs'];
31
+ readonly value: string;
32
+ readonly origin: string;
33
+ } | {
34
+ readonly op: 'del';
35
+ readonly path: readonly ['themes', string, 'ovr', 'fonts', 'major' | 'minor', 'latin' | 'ea' | 'cs'];
36
+ readonly origin: string;
37
+ } | {
38
+ readonly op: 'set';
39
+ readonly path: readonly ['themes', string, 'ovr', 'fonts', 'major' | 'minor', 'scripts', string];
40
+ readonly value: string;
41
+ readonly origin: string;
42
+ } | {
43
+ readonly op: 'del';
44
+ readonly path: readonly ['themes', string, 'ovr', 'fonts', 'major' | 'minor', 'scripts', string];
45
+ readonly origin: string;
46
+ };
47
+ export type ThemePatch = ThemeColorPatch | ThemeFontPatch;
@@ -0,0 +1,9 @@
1
+ import type { EditDoc } from '../types';
2
+ import type { CommandPatches } from './types';
3
+ import type { SetThemeCommand, ThemePatch } from './theme-types';
4
+ export declare function isThemePatch(patch: {
5
+ readonly path: readonly unknown[];
6
+ }): patch is ThemePatch;
7
+ export declare function setThemePatches(doc: EditDoc, command: SetThemeCommand, origin: string): CommandPatches;
8
+ export declare function validateThemePatch(doc: EditDoc, patch: ThemePatch, index: number): void;
9
+ export declare function applyThemePatch(doc: EditDoc, patch: ThemePatch): void;
@@ -1,13 +1,24 @@
1
- import type { Effects, Fill, Stroke } from '@web-ppt/core';
2
- import type { ElementId, ElementImageReplacement, ElementInsertionResource, ElementRecord, ImageCrop, LinkOverride, LinkTarget, ParagraphPropertyOverrides, ProjectionInvalidation, RunPropertyOverrides, SlideId, TextFragment, TextOverride, SlideRecord, TableCellAddress, TextBodyPropertyOverrides } from '../types';
1
+ import type { CellBorders, Effects, Fill, Stroke, TableCell } from '@web-ppt/core';
2
+ import type { DesignTarget, EditIdentity, ElementId, ElementImageReplacement, ElementInsertionResource, ElementRecord, ImageCrop, LinkOverride, LinkTarget, ParagraphPropertyInput, ProjectionInvalidation, RunPropertyOverrides, SlideId, TextFragment, TextOverride, SlideRecord, TableCellAddress, TextBodyPropertyOverrides } from '../types';
3
3
  import type { ElementClipboardPayload } from './clipboard-types';
4
- import type { SetBackgroundCommand, SetBackgroundCropCommand, SetBackgroundImageCommand, SetHiddenCommand, SetAnimationsCommand, SetTransitionCommand, SetLayoutCommand, SetNotesCommand, SlideLayoutPatch, SlideNotesPatch, SlidePropertyPatch } from './slide-property-types';
4
+ import type { ElementHierarchyPatch, GroupCommand, UngroupCommand } from './group-types';
5
+ import type { ConvertToCustomGeometryCommand, ElementGeometryPatch, ElementPresetGeometryPatch, SetAdjCommand, SetGeometryCommand, SetPresetCommand } from './geometry-types';
6
+ import type { SetBackgroundCommand, SetBackgroundCropCommand, SetBackgroundImageCommand, SetHiddenCommand, SetAnimationsCommand, SetTransitionCommand, SetLayoutCommand, SetNotesCommand, LayoutPropertyPatch, MasterBackgroundPatch, SlideLayoutPatch, SlideNotesPatch, SlidePropertyPatch } from './slide-property-types';
5
7
  import type { ApplyFormatCommand } from './format-painter-types';
6
8
  import type { ReplaceTextCommand } from '../text-search-types';
9
+ import type { ElementTableStylePatch, SetTableStyleCommand } from './table-style-types';
10
+ import type { AddSectionCommand, DistributeElementsCommand, DocumentSizePatch, ElementAltTextPatch, MoveSectionCommand, RemoveSectionCommand, RenameSectionCommand, SectionStatePatch, SetAltTextCommand, SetSlideSizeCommand } from './common-object-slide-types';
11
+ import type { SetThemeCommand, ThemePatch } from './theme-types';
12
+ import type { MasterTextStylePatch, SetMasterTextStyleCommand } from './master-text-style-types';
7
13
  export type { ClipboardElementRecord, ClipboardPortableLink, ClipboardRelationship, ClipboardResource, ClipboardTextLink, ClipboardXmlRoot, ElementClipboardPayload, ElementClipboardRecordMeta, } from './clipboard-types';
8
- export type { SetBackgroundCommand, SetBackgroundCropCommand, SetBackgroundImageCommand, SetHiddenCommand, SetAnimationsCommand, SetTransitionCommand, SetLayoutCommand, SlideAnimationsPatch, SlideBackgroundImagePatch, SlideBackgroundPatch, SlideHiddenPatch, SlideTransitionPatch, SetNotesCommand, SlideLayoutPatch, SlideNotesPatch, SlidePropertyPatch, } from './slide-property-types';
14
+ export type { SetBackgroundCommand, SetBackgroundCropCommand, SetBackgroundImageCommand, SetHiddenCommand, SetAnimationsCommand, SetTransitionCommand, SetLayoutCommand, SlideAnimationsPatch, SlideBackgroundImagePatch, SlideBackgroundPatch, SlideHiddenPatch, SlideTransitionPatch, LayoutBackgroundPatch, LayoutTransitionPatch, LayoutPropertyPatch, MasterBackgroundPatch, SetNotesCommand, SlideLayoutPatch, SlideNotesPatch, SlidePropertyPatch, } from './slide-property-types';
9
15
  export type { ApplyFormatCommand, FormatMaskField } from './format-painter-types';
16
+ export type { ElementHierarchyPatch, ElementHierarchyState, GroupCommand, UngroupCommand, } from './group-types';
10
17
  export type { ReplaceTextCommand, ReplaceTextScope } from '../text-search-types';
18
+ export type { ElementTableStylePatch, SetTableStyleCommand } from './table-style-types';
19
+ export type { AddSectionCommand, DistributeElementsCommand, DocumentSizePatch, ElementAltTextPatch, MoveSectionCommand, RemoveSectionCommand, RenameSectionCommand, SectionStatePatch, SetAltTextCommand, SetSlideSizeCommand, } from './common-object-slide-types';
20
+ export type { SetThemeCommand, ThemeColorPatch, ThemeFontPatch, ThemePatch } from './theme-types';
21
+ export type { MasterParagraphTextStylePatch, MasterRunTextStylePatch, MasterTextStylePatch, SetMasterTextStyleCommand, } from './master-text-style-types';
11
22
  export type NumericXfrmField = 'x' | 'y' | 'w' | 'h' | 'rot';
12
23
  export type FlipField = 'flipH' | 'flipV';
13
24
  export type XfrmField = NumericXfrmField | FlipField;
@@ -77,9 +88,8 @@ export interface PasteElementsCommand {
77
88
  readonly y: number;
78
89
  };
79
90
  }
80
- export interface AddShapeCommand {
91
+ interface AddShapeFields {
81
92
  readonly type: 'AddShape';
82
- readonly slideId: SlideId;
83
93
  readonly preset: string;
84
94
  readonly rect: {
85
95
  readonly x: number;
@@ -88,9 +98,15 @@ export interface AddShapeCommand {
88
98
  readonly h: number;
89
99
  };
90
100
  }
91
- export interface AddImageCommand {
92
- readonly type: 'AddImage';
101
+ export type AddShapeCommand = AddShapeFields & ({
93
102
  readonly slideId: SlideId;
103
+ readonly target?: never;
104
+ } | {
105
+ readonly target: DesignTarget;
106
+ readonly slideId?: never;
107
+ });
108
+ interface AddImageFields {
109
+ readonly type: 'AddImage';
94
110
  /** 空图片占位符可由同一历史单元原子替换。 */
95
111
  readonly placeholderId?: ElementId;
96
112
  readonly bytes: Uint8Array;
@@ -102,6 +118,13 @@ export interface AddImageCommand {
102
118
  readonly h: number;
103
119
  };
104
120
  }
121
+ export type AddImageCommand = AddImageFields & ({
122
+ readonly slideId: SlideId;
123
+ readonly target?: never;
124
+ } | {
125
+ readonly target: DesignTarget;
126
+ readonly slideId?: never;
127
+ });
105
128
  export interface ReplaceImageCommand {
106
129
  readonly type: 'ReplaceImage';
107
130
  readonly id: ElementId;
@@ -114,9 +137,8 @@ export interface SetCropCommand {
114
137
  /** null 恢复来源;全零对象明确写出不裁剪。 */
115
138
  readonly crop: ImageCrop | null;
116
139
  }
117
- export interface AddTableCommand {
140
+ interface AddTableFields {
118
141
  readonly type: 'AddTable';
119
- readonly slideId: SlideId;
120
142
  readonly rows: number;
121
143
  readonly cols: number;
122
144
  readonly rect: {
@@ -128,6 +150,13 @@ export interface AddTableCommand {
128
150
  /** 空内容占位符可由同一历史单元原子替换。 */
129
151
  readonly placeholderId?: ElementId;
130
152
  }
153
+ export type AddTableCommand = AddTableFields & ({
154
+ readonly slideId: SlideId;
155
+ readonly target?: never;
156
+ } | {
157
+ readonly target: DesignTarget;
158
+ readonly slideId?: never;
159
+ });
131
160
  export interface AddSlideCommand {
132
161
  readonly type: 'AddSlide';
133
162
  readonly layoutId: string;
@@ -217,12 +246,18 @@ export interface SetRunPropsCommand {
217
246
  readonly range: TextRange;
218
247
  readonly props: RunPropertyOverrides;
219
248
  }
249
+ export interface ClearFormatCommand {
250
+ readonly type: 'ClearFormat';
251
+ readonly id: ElementId;
252
+ readonly cell?: TableCellAddress;
253
+ readonly range: TextRange;
254
+ }
220
255
  export interface SetParaPropsCommand {
221
256
  readonly type: 'SetParaProps';
222
257
  readonly id: ElementId;
223
258
  readonly cell?: TableCellAddress;
224
259
  readonly range: TextRange;
225
- readonly props: ParagraphPropertyOverrides;
260
+ readonly props: ParagraphPropertyInput;
226
261
  }
227
262
  export interface FitTextShapeCommand {
228
263
  readonly type: 'FitTextShape';
@@ -234,12 +269,90 @@ export interface SetBodyPropsCommand {
234
269
  readonly cell?: TableCellAddress;
235
270
  readonly props: TextBodyPropertyOverrides;
236
271
  }
237
- /** 当前公开语义是尾部追加;指定位置插行要先解决纵向合并与坐标重基。 */
272
+ /** 子路径只用纯数据命令接入主历史;payload 的语义由已加载命名空间校验。 */
273
+ export interface ExtensionCommand {
274
+ readonly type: 'Extension';
275
+ readonly namespace: string;
276
+ readonly scope?: 'element' | 'slide';
277
+ readonly id: ElementId;
278
+ readonly payload: unknown;
279
+ }
238
280
  export interface InsertRowCommand {
239
281
  readonly type: 'InsertRow';
240
282
  readonly id: ElementId;
283
+ /** 省略仍兼容尾部追加;null 也表示尾部。 */
284
+ readonly at?: {
285
+ readonly before: import('../types').TableRowId | null;
286
+ };
287
+ }
288
+ export interface InsertColumnCommand {
289
+ readonly type: 'InsertColumn';
290
+ readonly id: ElementId;
291
+ readonly at?: {
292
+ readonly before: import('../types').TableColumnId | null;
293
+ };
294
+ }
295
+ export interface RemoveRowCommand {
296
+ readonly type: 'RemoveRow';
297
+ readonly id: ElementId;
298
+ readonly row: import('../types').TableRowId;
299
+ }
300
+ export interface RemoveColumnCommand {
301
+ readonly type: 'RemoveColumn';
302
+ readonly id: ElementId;
303
+ readonly column: import('../types').TableColumnId;
304
+ }
305
+ export interface SetRowHeightCommand {
306
+ readonly type: 'SetRowHeight';
307
+ readonly id: ElementId;
308
+ readonly row: import('../types').TableRowId;
309
+ readonly height: number;
310
+ }
311
+ export interface SetColumnWidthCommand {
312
+ readonly type: 'SetColumnWidth';
313
+ readonly id: ElementId;
314
+ readonly column: import('../types').TableColumnId;
315
+ readonly width: number;
316
+ }
317
+ export interface MergeCellsCommand {
318
+ readonly type: 'MergeCells';
319
+ readonly id: ElementId;
320
+ readonly from: import('../types').TableCellRef;
321
+ readonly to: import('../types').TableCellRef;
322
+ }
323
+ export interface SplitCellCommand {
324
+ readonly type: 'SplitCell';
325
+ readonly id: ElementId;
326
+ readonly cell: import('../types').TableCellRef;
327
+ }
328
+ export interface SetCellPropsCommand {
329
+ readonly type: 'SetCellProps';
330
+ readonly id: ElementId;
331
+ readonly cell: import('../types').TableCellRef;
332
+ readonly props: {
333
+ readonly fill?: Exclude<Fill, {
334
+ type: 'image';
335
+ }> | null;
336
+ readonly borders?: CellBorders | null;
337
+ readonly margins?: [number, number, number, number] | null;
338
+ readonly vAlign?: TableCell['vAlign'] | null;
339
+ readonly vert?: TableCell['vert'] | null;
340
+ };
241
341
  }
242
- export type Command = SetXfrmCommand | SetFlipCommand | RemoveElementCommand | SetZCommand | SetNameCommand | SetLockedCommand | SetElementHiddenCommand | ApplyFormatCommand | ReplaceTextCommand | AlignElementsCommand | PasteElementsCommand | AddShapeCommand | AddImageCommand | ReplaceImageCommand | SetCropCommand | AddTableCommand | AddSlideCommand | MoveSlideCommand | RemoveSlideCommand | DuplicateSlideCommand | EditTextCommand | SetRunPropsCommand | SetParaPropsCommand | FitTextShapeCommand | SetBodyPropsCommand | InsertRowCommand | SetFillCommand | SetStrokeCommand | SetEffectsCommand | SetLinkCommand | SetBackgroundCommand | SetBackgroundCropCommand | SetBackgroundImageCommand | SetHiddenCommand | SetTransitionCommand | SetAnimationsCommand | SetLayoutCommand | SetNotesCommand;
342
+ export type Command = SetXfrmCommand | SetFlipCommand | RemoveElementCommand | SetZCommand | SetNameCommand | SetAltTextCommand | ExtensionCommand | SetLockedCommand | SetElementHiddenCommand | ApplyFormatCommand | ReplaceTextCommand | AlignElementsCommand | DistributeElementsCommand | GroupCommand | UngroupCommand | PasteElementsCommand | AddShapeCommand | AddImageCommand | ReplaceImageCommand | SetCropCommand | SetGeometryCommand | ConvertToCustomGeometryCommand | SetPresetCommand | SetAdjCommand | AddTableCommand | AddSlideCommand | MoveSlideCommand | RemoveSlideCommand | DuplicateSlideCommand | EditTextCommand | SetRunPropsCommand | ClearFormatCommand | SetParaPropsCommand | AddSectionCommand | RenameSectionCommand | MoveSectionCommand | RemoveSectionCommand | SetSlideSizeCommand | FitTextShapeCommand | SetBodyPropsCommand | InsertRowCommand | InsertColumnCommand | RemoveRowCommand | RemoveColumnCommand | SetRowHeightCommand | SetColumnWidthCommand | MergeCellsCommand | SplitCellCommand | SetCellPropsCommand | SetFillCommand | SetStrokeCommand | SetEffectsCommand | SetLinkCommand | SetBackgroundCommand | SetBackgroundCropCommand | SetBackgroundImageCommand | SetHiddenCommand | SetTransitionCommand | SetAnimationsCommand | SetLayoutCommand | SetNotesCommand | SetTableStyleCommand | SetThemeCommand | SetMasterTextStyleCommand;
343
+ type PageOnlyCommand = AddSlideCommand | MoveSlideCommand | RemoveSlideCommand | DuplicateSlideCommand | AddSectionCommand | RenameSectionCommand | MoveSectionCommand | RemoveSectionCommand | SetSlideSizeCommand | SetBackgroundCropCommand | SetBackgroundImageCommand | SetHiddenCommand | SetAnimationsCommand | SetLayoutCommand | SetNotesCommand | SetThemeCommand | AddShapeCommand | AddImageCommand | AddTableCommand | PasteElementsCommand | ReplaceTextCommand;
344
+ /** 版式命令沿用元素命令语言;只有画布属性命令显式携带 DesignTarget。 */
345
+ export type DesignCommand = Exclude<Command, PageOnlyCommand | SetBackgroundCommand | SetTransitionCommand> | Extract<SetBackgroundCommand, {
346
+ readonly target: import('../types').DesignTarget;
347
+ }> | Extract<SetTransitionCommand, {
348
+ readonly target: import('../types').DesignTarget;
349
+ }> | Extract<AddShapeCommand, {
350
+ readonly target: import('../types').DesignTarget;
351
+ }> | Extract<AddImageCommand, {
352
+ readonly target: import('../types').DesignTarget;
353
+ }> | Extract<AddTableCommand, {
354
+ readonly target: import('../types').DesignTarget;
355
+ }>;
243
356
  type SetXfrmPatch = {
244
357
  [F in XfrmField]: {
245
358
  readonly op: 'set';
@@ -339,12 +452,12 @@ export type ElementTextPatch = {
339
452
  readonly origin: string;
340
453
  } | {
341
454
  readonly op: 'set';
342
- readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', import('../types').TableCellRowRef, number, 'text'];
455
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', import('../types').TableCellRowRef, import('../types').TableCellColumnRef, 'text'];
343
456
  readonly value: TextOverride;
344
457
  readonly origin: string;
345
458
  } | {
346
459
  readonly op: 'del';
347
- readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', import('../types').TableCellRowRef, number, 'text'];
460
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableCells', import('../types').TableCellRowRef, import('../types').TableCellColumnRef, 'text'];
348
461
  readonly origin: string;
349
462
  };
350
463
  export type ElementOrderPatch = {
@@ -395,6 +508,12 @@ export interface SlideTreeSnapshot {
395
508
  /** 删除视图优先切到原后继;插入 patch 不依赖它定位。 */
396
509
  readonly before: SlideId | null;
397
510
  readonly records: Readonly<Record<ElementId, ElementRecord>>;
511
+ /** 直接复制来源用于冻结字段出处;不能从原生 part 推断中间副本。 */
512
+ readonly copySources?: Readonly<Record<ElementId, ElementId>>;
513
+ /** 复制发生时已证明的原操作;恢复与重做只运输这份不可变证据。 */
514
+ readonly extensionCopies?: string;
515
+ /** 页面结构 Patch 同步维护稳定节成员;省略表示该页不属于任何节。 */
516
+ readonly sectionId?: import('../types').SectionId;
398
517
  }
399
518
  export type SlideTreePatch = {
400
519
  readonly op: 'remove' | 'insert';
@@ -416,10 +535,74 @@ export type TableRowPatch = {
416
535
  readonly value: import('../types').TableRowInsertion;
417
536
  readonly origin: string;
418
537
  };
419
- export type Patch = ElementTransformPatch | ElementFillPatch | ElementStrokePatch | ElementEffectsPatch | ElementLinkPatch | ElementCropPatch | ElementImageReplacementPatch | ImageResourcePatch | ElementTextPatch | ElementOrderPatch | ElementNamePatch | ElementInteractionPatch | ElementTreePatch | SlideTreePatch | SlideOrderPatch | SlidePropertyPatch | SlideLayoutPatch | SlideNotesPatch | TableRowPatch;
538
+ export type TableColumnPatch = {
539
+ readonly op: 'insert' | 'remove';
540
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableColumns', string];
541
+ readonly value: import('../types').TableColumnInsertion;
542
+ readonly origin: string;
543
+ };
544
+ export type TableGridEntryPatch = {
545
+ readonly op: 'set' | 'del';
546
+ readonly path: readonly [
547
+ 'elements',
548
+ ElementId,
549
+ 'ovr',
550
+ 'tableRemovedRows' | 'tableRemovedColumns' | 'tableRowHeights' | 'tableColumnWidths',
551
+ string
552
+ ];
553
+ readonly value?: true | number;
554
+ readonly origin: string;
555
+ };
556
+ export type TableMergePatch = {
557
+ readonly op: 'set';
558
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableMerges'];
559
+ readonly value: readonly import('../types').TableMergeRegion[];
560
+ readonly origin: string;
561
+ } | {
562
+ readonly op: 'del';
563
+ readonly path: readonly ['elements', ElementId, 'ovr', 'tableMerges'];
564
+ readonly origin: string;
565
+ };
566
+ export type TableCellPropsPatch = {
567
+ readonly op: 'set' | 'del';
568
+ readonly path: readonly [
569
+ 'elements',
570
+ ElementId,
571
+ 'ovr',
572
+ 'tableCells',
573
+ string,
574
+ 'fill' | 'borders' | 'margins' | 'vAlign' | 'vert'
575
+ ];
576
+ readonly value?: import('../types').TableCellOverrides[keyof Omit<import('../types').TableCellOverrides, 'text'>];
577
+ readonly origin: string;
578
+ };
579
+ export type ExtensionPatch = {
580
+ readonly op: 'set';
581
+ readonly path: readonly ['elements' | 'slides', ElementId, 'ovr', 'extensions', string, ...string[]];
582
+ readonly value: unknown;
583
+ readonly origin: string;
584
+ } | {
585
+ readonly op: 'del';
586
+ readonly path: readonly ['elements' | 'slides', ElementId, 'ovr', 'extensions', string, ...string[]];
587
+ readonly origin: string;
588
+ };
589
+ export type DocumentExtensionPatch = {
590
+ readonly op: 'set';
591
+ readonly path: readonly ['document', 'extensions', string, ...string[]];
592
+ readonly value: unknown;
593
+ readonly origin: string;
594
+ } | {
595
+ readonly op: 'del';
596
+ readonly path: readonly ['document', 'extensions', string, ...string[]];
597
+ readonly origin: string;
598
+ };
599
+ /** 单个事务必须能作为一条协同消息原子传输。 */
600
+ export declare const MAX_PATCHES_PER_TRANSACTION = 10000;
601
+ export type Patch = ElementTransformPatch | ElementFillPatch | ElementStrokePatch | ElementEffectsPatch | ElementLinkPatch | ElementCropPatch | ElementGeometryPatch | ElementPresetGeometryPatch | ElementImageReplacementPatch | ImageResourcePatch | ElementTextPatch | ElementOrderPatch | ElementNamePatch | ElementAltTextPatch | ElementInteractionPatch | ExtensionPatch | DocumentExtensionPatch | ElementTreePatch | ElementHierarchyPatch | SlideTreePatch | SlideOrderPatch | SectionStatePatch | DocumentSizePatch | SlidePropertyPatch | SlideLayoutPatch | SlideNotesPatch | TableRowPatch | TableColumnPatch | TableGridEntryPatch | TableMergePatch | TableCellPropsPatch | ElementTableStylePatch | ThemePatch | LayoutPropertyPatch | MasterBackgroundPatch | MasterTextStylePatch;
420
602
  export interface CommandPatches {
421
603
  readonly forward: Patch[];
422
604
  readonly inverse: Patch[];
605
+ readonly selection?: Selection;
423
606
  }
424
607
  export interface TextPosition {
425
608
  readonly p: number;
@@ -474,7 +657,7 @@ export interface TransactionResult extends ProjectionInvalidation, CommandPatche
474
657
  readonly renderSlides: Set<SlideId>;
475
658
  }
476
659
  export interface EditorChange extends ProjectionInvalidation, SlideChangeSets {
477
- readonly source: 'transaction' | 'undo' | 'redo' | 'selection';
660
+ readonly source: 'transaction' | 'undo' | 'redo' | 'external' | 'selection';
478
661
  readonly selection: Selection;
479
662
  /** dirtyElements 含投影缓存祖先;DOM 增量分区必须以真正被 patch 的元素为准。 */
480
663
  readonly touchedElements: Set<ElementId>;
@@ -490,6 +673,25 @@ export interface EditorChange extends ProjectionInvalidation, SlideChangeSets {
490
673
  readonly paneElements: Set<ElementId>;
491
674
  }
492
675
  export type EditorSubscriber = (change: EditorChange) => void;
676
+ export interface EditorPatchEvent {
677
+ readonly source: Exclude<EditorChange['source'], 'selection'>;
678
+ readonly patches: readonly Patch[];
679
+ readonly identity: EditIdentity;
680
+ readonly origin: string;
681
+ readonly label: string;
682
+ readonly time: number;
683
+ }
684
+ export type EditorPatchSubscriber = (event: EditorPatchEvent) => void;
685
+ export interface EditorPatchSubscribeOptions {
686
+ /** 协同 checkpoint 必须先于 recovery 观察者看到同一事务;该阶段的订阅者不得重入编辑器。 */
687
+ readonly phase?: 'before-recovery' | 'after-observers';
688
+ }
689
+ export interface ExternalPatchOptions {
690
+ readonly identity?: EditIdentity;
691
+ readonly origin?: string;
692
+ readonly label?: string;
693
+ readonly time?: number;
694
+ }
493
695
  export interface Transaction {
494
696
  exec(...commands: Command[]): void;
495
697
  select(selection: Selection): void;
@@ -0,0 +1,3 @@
1
+ import type { EditDoc, ElementInsertionSource, ElementRecord } from '../types';
2
+ /** 完整插入来源随父组删除;孩子脱离前分取自己的闭包,不能依赖已消失的活父链。 */
3
+ export declare function ungroupInsertionSources(doc: EditDoc, group: ElementRecord): Map<string, ElementInsertionSource>;
@@ -0,0 +1,4 @@
1
+ import type { EditDoc } from '../types';
2
+ import type { CommandPatches, UngroupCommand } from './types';
3
+ /** 解组把每个孩子的 frame 分解到外部父空间,并以一个层级 Patch 原子替换组。 */
4
+ export declare function ungroupPatches(doc: EditDoc, command: UngroupCommand, origin: string): CommandPatches;