@web-ppt/edit-core 0.5.0-beta.2 → 0.5.0

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 (337) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +164 -21
  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/commands/add-slide-identity.d.ts +2 -0
  107. package/dist/commands/bullet-image-resource.d.ts +11 -0
  108. package/dist/commands/clear-format.d.ts +4 -0
  109. package/dist/commands/common-object-slide-patch.d.ts +4 -0
  110. package/dist/commands/common-object-slide-types.d.ts +68 -0
  111. package/dist/commands/direct-format-patches.d.ts +11 -5
  112. package/dist/commands/distribute-elements.d.ts +4 -0
  113. package/dist/commands/edit-table-grid.d.ts +10 -0
  114. package/dist/commands/element-alt-text.d.ts +8 -0
  115. package/dist/commands/element-arrangement.d.ts +17 -0
  116. package/dist/commands/element-effects.d.ts +1 -1
  117. package/dist/commands/element-fill.d.ts +1 -1
  118. package/dist/commands/element-geometry.d.ts +5 -2
  119. package/dist/commands/element-image-content.d.ts +2 -2
  120. package/dist/commands/element-link.d.ts +1 -1
  121. package/dist/commands/element-name.d.ts +1 -1
  122. package/dist/commands/element-stroke.d.ts +1 -1
  123. package/dist/commands/element-text.d.ts +1 -1
  124. package/dist/commands/element-transform.d.ts +2 -2
  125. package/dist/commands/geometry-types.d.ts +23 -1
  126. package/dist/commands/hierarchy-record.d.ts +5 -0
  127. package/dist/commands/image-resource.d.ts +8 -1
  128. package/dist/commands/insertion-host.d.ts +14 -1
  129. package/dist/commands/layout-property.d.ts +7 -0
  130. package/dist/commands/master-property.d.ts +5 -0
  131. package/dist/commands/master-text-style-types.d.ts +27 -0
  132. package/dist/commands/master-text-style.d.ts +7 -0
  133. package/dist/commands/paste-resources.d.ts +9 -5
  134. package/dist/commands/patch-apply.d.ts +3 -0
  135. package/dist/commands/patch-count.d.ts +1 -0
  136. package/dist/commands/patch-invalidation.d.ts +1 -1
  137. package/dist/commands/patch-stage.d.ts +4 -0
  138. package/dist/commands/record-override.d.ts +5 -0
  139. package/dist/commands/replace-image.d.ts +6 -1
  140. package/dist/commands/sections.d.ts +10 -0
  141. package/dist/commands/set-preset.d.ts +5 -0
  142. package/dist/commands/slide-property-types.d.ts +55 -5
  143. package/dist/commands/slide-size.d.ts +7 -0
  144. package/dist/commands/spid.d.ts +1 -1
  145. package/dist/commands/table-grid-patch.d.ts +12 -0
  146. package/dist/commands/text-target.d.ts +2 -2
  147. package/dist/commands/theme-types.d.ts +47 -0
  148. package/dist/commands/theme.d.ts +9 -0
  149. package/dist/commands/types.d.ts +194 -17
  150. package/dist/commands/ungroup-source.d.ts +3 -0
  151. package/dist/comments/index.d.ts +35 -0
  152. package/dist/comments/save.d.ts +3 -0
  153. package/dist/comments/state.d.ts +10 -0
  154. package/dist/comments/xml.d.ts +12 -0
  155. package/dist/comments.js +782 -0
  156. package/dist/common-object-slide-types.d.ts +34 -0
  157. package/dist/data-validation.d.ts +1 -1
  158. package/dist/describe/budget.d.ts +3 -0
  159. package/dist/describe/index.d.ts +5 -0
  160. package/dist/describe/read.d.ts +4 -0
  161. package/dist/describe/types.d.ts +103 -0
  162. package/dist/describe.js +192 -0
  163. package/dist/design-dependencies.d.ts +8 -0
  164. package/dist/design-projection-package.d.ts +10 -0
  165. package/dist/design-target.d.ts +10 -0
  166. package/dist/design.d.ts +3 -0
  167. package/dist/document-extensions.d.ts +9 -0
  168. package/dist/document.d.ts +1 -1
  169. package/dist/dynamic-projection.d.ts +6 -0
  170. package/dist/edit-core.js +5420 -4111
  171. package/dist/editor.d.ts +15 -3
  172. package/dist/element-source.d.ts +11 -0
  173. package/dist/element-spids.d.ts +4 -0
  174. package/dist/extension-address-journal.d.ts +9 -0
  175. package/dist/extension-address-remap.d.ts +14 -0
  176. package/dist/extension-addresses.d.ts +20 -0
  177. package/dist/extension-copy-history.d.ts +7 -0
  178. package/dist/extension-copy.d.ts +16 -0
  179. package/dist/extension-migration-receipt.d.ts +34 -0
  180. package/dist/extension-recovery-context.d.ts +5 -0
  181. package/dist/extension-runtime.d.ts +64 -0
  182. package/dist/generate/comments.d.ts +3 -0
  183. package/dist/generate/compatibility-parts.d.ts +14 -0
  184. package/dist/generate/compatibility-references.d.ts +3 -0
  185. package/dist/generate/compatibility.d.ts +4 -0
  186. package/dist/generate/index.d.ts +1 -0
  187. package/dist/generate/master-defaults.d.ts +4 -0
  188. package/dist/generate/materialize.d.ts +2 -2
  189. package/dist/generate/math.d.ts +3 -0
  190. package/dist/generate/portable-clipboard.d.ts +4 -0
  191. package/dist/generate/projection-tree.d.ts +8 -0
  192. package/dist/generate/template.d.ts +68 -1
  193. package/dist/generate/text-body.d.ts +2 -0
  194. package/dist/generate/text-effects.d.ts +5 -0
  195. package/dist/generate/text-override.d.ts +8 -0
  196. package/dist/generate/validation.d.ts +3 -0
  197. package/dist/generate/warp.d.ts +2 -0
  198. package/dist/generate.js +1232 -512
  199. package/dist/history.d.ts +11 -1
  200. package/dist/identities.d.ts +4 -0
  201. package/dist/image-content.d.ts +5 -2
  202. package/dist/image-resource-history.d.ts +2 -0
  203. package/dist/index-C2r7c6G6.js +714 -0
  204. package/dist/index-CYDvbiwF.js +1 -0
  205. package/dist/index.d.ts +35 -7
  206. package/dist/ink/index.d.ts +27 -0
  207. package/dist/ink/model.d.ts +4 -0
  208. package/dist/ink/save.d.ts +3 -0
  209. package/dist/ink/source.d.ts +7 -0
  210. package/dist/ink.js +324 -0
  211. package/dist/layout-assets.d.ts +3 -1
  212. package/dist/layout-projection.d.ts +17 -5
  213. package/dist/layout-state.d.ts +2 -0
  214. package/dist/layout-types.d.ts +42 -0
  215. package/dist/layout.d.ts +5 -0
  216. package/dist/lint/color.d.ts +5 -0
  217. package/dist/lint/index.d.ts +7 -0
  218. package/dist/lint/prompts.d.ts +3 -0
  219. package/dist/lint/report.d.ts +21 -0
  220. package/dist/lint/sampler-batch.d.ts +4 -0
  221. package/dist/lint/sampler-images.d.ts +2 -0
  222. package/dist/lint/sampler.d.ts +9 -0
  223. package/dist/lint/snapshot.d.ts +34 -0
  224. package/dist/lint/types.d.ts +67 -0
  225. package/dist/lint-sampler.js +187 -0
  226. package/dist/lint.js +659 -0
  227. package/dist/master-state.d.ts +3 -0
  228. package/dist/master-text-style-state.d.ts +3 -0
  229. package/dist/master-types.d.ts +55 -0
  230. package/dist/master.d.ts +5 -0
  231. package/dist/media/audio-icon.d.ts +2 -0
  232. package/dist/media/commands.d.ts +3 -0
  233. package/dist/media/index.d.ts +10 -0
  234. package/dist/media/markup.d.ts +10 -0
  235. package/dist/media/mp4-boxes.d.ts +12 -0
  236. package/dist/media/mp4-fragments.d.ts +8 -0
  237. package/dist/media/mp4-samples.d.ts +4 -0
  238. package/dist/media/mp4.d.ts +2 -0
  239. package/dist/media/poster.d.ts +2 -0
  240. package/dist/media/replace-poster.d.ts +3 -0
  241. package/dist/media/resource.d.ts +4 -0
  242. package/dist/media/source.d.ts +14 -0
  243. package/dist/media/types.d.ts +33 -0
  244. package/dist/media-properties.d.ts +4 -0
  245. package/dist/media.js +1630 -0
  246. package/dist/model-invariants-BM19JVxy.js +8980 -0
  247. package/dist/object-source.d.ts +11 -0
  248. package/dist/ole/container.d.ts +14 -0
  249. package/dist/ole/content.d.ts +94 -0
  250. package/dist/ole/index.d.ts +20 -0
  251. package/dist/ole/preview.d.ts +3 -0
  252. package/dist/ole/save.d.ts +2 -0
  253. package/dist/ole/state.d.ts +16 -0
  254. package/dist/ole.js +870 -0
  255. package/dist/opc.js +1 -1
  256. package/dist/paragraph-level.d.ts +2 -2
  257. package/dist/paragraph-property-schema.d.ts +4 -1
  258. package/dist/{patch-D7lZelRa.js → patch-BwhfBbYE.js} +10 -10
  259. package/dist/patch-events.d.ts +5 -1
  260. package/dist/ppt/appearance.d.ts +11 -0
  261. package/dist/ppt/binary.d.ts +20 -0
  262. package/dist/ppt/drawing.d.ts +18 -0
  263. package/dist/ppt/geometry.d.ts +4 -0
  264. package/dist/ppt/index.d.ts +12 -0
  265. package/dist/ppt/pictures.d.ts +11 -0
  266. package/dist/ppt/text.d.ts +9 -0
  267. package/dist/ppt.js +774 -0
  268. package/dist/preset-geometry.d.ts +6 -0
  269. package/dist/projection.d.ts +2 -0
  270. package/dist/query-BHLjWjnu.js +903 -0
  271. package/dist/recovery-identity.d.ts +1 -0
  272. package/dist/recovery-migrations.d.ts +3 -0
  273. package/dist/recovery.d.ts +3 -0
  274. package/dist/resize/index.d.ts +6 -0
  275. package/dist/resize/text.d.ts +4 -0
  276. package/dist/resize.js +5090 -0
  277. package/dist/retained-element-origins.d.ts +6 -0
  278. package/dist/run-property-fields.d.ts +12 -0
  279. package/dist/run-property-schema.d.ts +3 -1
  280. package/dist/run-style.d.ts +15 -0
  281. package/dist/save/alt-text.d.ts +4 -0
  282. package/dist/save/comments.d.ts +3 -0
  283. package/dist/save/effects.d.ts +2 -1
  284. package/dist/save/extension-availability.d.ts +3 -0
  285. package/dist/save/extension-elements.d.ts +26 -0
  286. package/dist/save/index.d.ts +6 -1
  287. package/dist/save/insertion.d.ts +6 -5
  288. package/dist/save/layout-properties.d.ts +4 -0
  289. package/dist/save/master-properties.d.ts +5 -0
  290. package/dist/save/paragraph-overrides.d.ts +3 -0
  291. package/dist/save/slide-parts.d.ts +1 -0
  292. package/dist/save/table.d.ts +2 -0
  293. package/dist/save/xfrm.d.ts +8 -2
  294. package/dist/save.js +493 -498
  295. package/dist/sections.d.ts +8 -0
  296. package/dist/session-assets.d.ts +4 -0
  297. package/dist/slide-parts-D0o_DDhi.js +1331 -0
  298. package/dist/slide-size.d.ts +6 -0
  299. package/dist/smartart/drawing.d.ts +3 -0
  300. package/dist/smartart/index.d.ts +16 -0
  301. package/dist/smartart/model.d.ts +18 -0
  302. package/dist/smartart/save.d.ts +3 -0
  303. package/dist/smartart.js +604 -0
  304. package/dist/source-retention.d.ts +7 -0
  305. package/dist/space.d.ts +37 -0
  306. package/dist/table-cell.d.ts +7 -1
  307. package/dist/table-grid-projection.d.ts +6 -0
  308. package/dist/table-grid.d.ts +45 -0
  309. package/dist/table-invariants.d.ts +4 -0
  310. package/dist/table-rows.d.ts +2 -1
  311. package/dist/table-scale.d.ts +4 -0
  312. package/dist/table-style.d.ts +5 -4
  313. package/dist/templates/index.d.ts +4 -0
  314. package/dist/templates/recipes.d.ts +5 -0
  315. package/dist/templates/types.d.ts +17 -0
  316. package/dist/templates.js +543 -0
  317. package/dist/text-flatten.d.ts +6 -0
  318. package/dist/text-fragment.d.ts +5 -0
  319. package/dist/text-model.d.ts +8 -8
  320. package/dist/text-override-validation.d.ts +6 -2
  321. package/dist/text-selection.d.ts +4 -0
  322. package/dist/theme-projection.d.ts +8 -0
  323. package/dist/theme-xml.d.ts +3 -0
  324. package/dist/theme.d.ts +14 -0
  325. package/dist/types.d.ts +174 -8
  326. package/dist/xml/index.d.ts +1 -1
  327. package/dist/xml/nodes.d.ts +2 -2
  328. package/dist/xml/shape-ids.d.ts +3 -0
  329. package/dist/xml.js +19 -16
  330. package/package.json +79 -5
  331. package/schemas/describe.schema.json +479 -0
  332. package/schemas/lint.schema.json +145 -0
  333. package/dist/document-B1jjN-QB.js +0 -274
  334. package/dist/image-resource-DbgJS9n-.js +0 -24
  335. package/dist/index-D2JizcOQ.js +0 -706
  336. package/dist/insertion-CGpb504L.js +0 -6152
  337. package/dist/table-style-part-DBtpxmuo.js +0 -1042
@@ -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,5 +1,5 @@
1
1
  import type { EditDoc } from '../types';
2
+ export declare function maxPartSpid(doc: EditDoc, part: string): number;
2
3
  export declare function prepareElementSpidNamespaces(doc: EditDoc): void;
3
4
  /** 来源 XML 里还有不进入 Schema 的 cNvPr;只扫模型会在空页或未知宿主上复用 spid。 */
4
5
  export declare function allocateElementSpid(doc: EditDoc, part: string): number;
5
- 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;
@@ -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;
@@ -17,7 +17,7 @@ export interface TextPatchTarget {
17
17
  readonly id: string;
18
18
  readonly cell?: {
19
19
  readonly row: TableCellRowRef;
20
- readonly c: number;
20
+ readonly column: TableCellColumnRef;
21
21
  };
22
22
  }
23
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,18 +1,24 @@
1
- import type { Effects, Fill, Stroke } from '@web-ppt/core';
2
- import type { EditIdentity, 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
4
  import type { ElementHierarchyPatch, GroupCommand, UngroupCommand } from './group-types';
5
- import type { ConvertToCustomGeometryCommand, ElementGeometryPatch, SetGeometryCommand } from './geometry-types';
6
- import type { SetBackgroundCommand, SetBackgroundCropCommand, SetBackgroundImageCommand, SetHiddenCommand, SetAnimationsCommand, SetTransitionCommand, SetLayoutCommand, SetNotesCommand, SlideLayoutPatch, SlideNotesPatch, SlidePropertyPatch } from './slide-property-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';
7
7
  import type { ApplyFormatCommand } from './format-painter-types';
8
8
  import type { ReplaceTextCommand } from '../text-search-types';
9
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';
10
13
  export type { ClipboardElementRecord, ClipboardPortableLink, ClipboardRelationship, ClipboardResource, ClipboardTextLink, ClipboardXmlRoot, ElementClipboardPayload, ElementClipboardRecordMeta, } from './clipboard-types';
11
- 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';
12
15
  export type { ApplyFormatCommand, FormatMaskField } from './format-painter-types';
13
16
  export type { ElementHierarchyPatch, ElementHierarchyState, GroupCommand, UngroupCommand, } from './group-types';
14
17
  export type { ReplaceTextCommand, ReplaceTextScope } from '../text-search-types';
15
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';
16
22
  export type NumericXfrmField = 'x' | 'y' | 'w' | 'h' | 'rot';
17
23
  export type FlipField = 'flipH' | 'flipV';
18
24
  export type XfrmField = NumericXfrmField | FlipField;
@@ -82,9 +88,8 @@ export interface PasteElementsCommand {
82
88
  readonly y: number;
83
89
  };
84
90
  }
85
- export interface AddShapeCommand {
91
+ interface AddShapeFields {
86
92
  readonly type: 'AddShape';
87
- readonly slideId: SlideId;
88
93
  readonly preset: string;
89
94
  readonly rect: {
90
95
  readonly x: number;
@@ -93,9 +98,15 @@ export interface AddShapeCommand {
93
98
  readonly h: number;
94
99
  };
95
100
  }
96
- export interface AddImageCommand {
97
- readonly type: 'AddImage';
101
+ export type AddShapeCommand = AddShapeFields & ({
98
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';
99
110
  /** 空图片占位符可由同一历史单元原子替换。 */
100
111
  readonly placeholderId?: ElementId;
101
112
  readonly bytes: Uint8Array;
@@ -107,6 +118,13 @@ export interface AddImageCommand {
107
118
  readonly h: number;
108
119
  };
109
120
  }
121
+ export type AddImageCommand = AddImageFields & ({
122
+ readonly slideId: SlideId;
123
+ readonly target?: never;
124
+ } | {
125
+ readonly target: DesignTarget;
126
+ readonly slideId?: never;
127
+ });
110
128
  export interface ReplaceImageCommand {
111
129
  readonly type: 'ReplaceImage';
112
130
  readonly id: ElementId;
@@ -119,9 +137,8 @@ export interface SetCropCommand {
119
137
  /** null 恢复来源;全零对象明确写出不裁剪。 */
120
138
  readonly crop: ImageCrop | null;
121
139
  }
122
- export interface AddTableCommand {
140
+ interface AddTableFields {
123
141
  readonly type: 'AddTable';
124
- readonly slideId: SlideId;
125
142
  readonly rows: number;
126
143
  readonly cols: number;
127
144
  readonly rect: {
@@ -133,6 +150,13 @@ export interface AddTableCommand {
133
150
  /** 空内容占位符可由同一历史单元原子替换。 */
134
151
  readonly placeholderId?: ElementId;
135
152
  }
153
+ export type AddTableCommand = AddTableFields & ({
154
+ readonly slideId: SlideId;
155
+ readonly target?: never;
156
+ } | {
157
+ readonly target: DesignTarget;
158
+ readonly slideId?: never;
159
+ });
136
160
  export interface AddSlideCommand {
137
161
  readonly type: 'AddSlide';
138
162
  readonly layoutId: string;
@@ -222,12 +246,18 @@ export interface SetRunPropsCommand {
222
246
  readonly range: TextRange;
223
247
  readonly props: RunPropertyOverrides;
224
248
  }
249
+ export interface ClearFormatCommand {
250
+ readonly type: 'ClearFormat';
251
+ readonly id: ElementId;
252
+ readonly cell?: TableCellAddress;
253
+ readonly range: TextRange;
254
+ }
225
255
  export interface SetParaPropsCommand {
226
256
  readonly type: 'SetParaProps';
227
257
  readonly id: ElementId;
228
258
  readonly cell?: TableCellAddress;
229
259
  readonly range: TextRange;
230
- readonly props: ParagraphPropertyOverrides;
260
+ readonly props: ParagraphPropertyInput;
231
261
  }
232
262
  export interface FitTextShapeCommand {
233
263
  readonly type: 'FitTextShape';
@@ -239,12 +269,90 @@ export interface SetBodyPropsCommand {
239
269
  readonly cell?: TableCellAddress;
240
270
  readonly props: TextBodyPropertyOverrides;
241
271
  }
242
- /** 当前公开语义是尾部追加;指定位置插行要先解决纵向合并与坐标重基。 */
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
+ }
243
280
  export interface InsertRowCommand {
244
281
  readonly type: 'InsertRow';
245
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;
246
304
  }
247
- export type Command = SetXfrmCommand | SetFlipCommand | RemoveElementCommand | SetZCommand | SetNameCommand | SetLockedCommand | SetElementHiddenCommand | ApplyFormatCommand | ReplaceTextCommand | AlignElementsCommand | GroupCommand | UngroupCommand | PasteElementsCommand | AddShapeCommand | AddImageCommand | ReplaceImageCommand | SetCropCommand | SetGeometryCommand | ConvertToCustomGeometryCommand | AddTableCommand | AddSlideCommand | MoveSlideCommand | RemoveSlideCommand | DuplicateSlideCommand | EditTextCommand | SetRunPropsCommand | SetParaPropsCommand | FitTextShapeCommand | SetBodyPropsCommand | InsertRowCommand | SetFillCommand | SetStrokeCommand | SetEffectsCommand | SetLinkCommand | SetBackgroundCommand | SetBackgroundCropCommand | SetBackgroundImageCommand | SetHiddenCommand | SetTransitionCommand | SetAnimationsCommand | SetLayoutCommand | SetNotesCommand | SetTableStyleCommand;
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
+ };
341
+ }
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
+ }>;
248
356
  type SetXfrmPatch = {
249
357
  [F in XfrmField]: {
250
358
  readonly op: 'set';
@@ -344,12 +452,12 @@ export type ElementTextPatch = {
344
452
  readonly origin: string;
345
453
  } | {
346
454
  readonly op: 'set';
347
- 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'];
348
456
  readonly value: TextOverride;
349
457
  readonly origin: string;
350
458
  } | {
351
459
  readonly op: 'del';
352
- 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'];
353
461
  readonly origin: string;
354
462
  };
355
463
  export type ElementOrderPatch = {
@@ -400,6 +508,12 @@ export interface SlideTreeSnapshot {
400
508
  /** 删除视图优先切到原后继;插入 patch 不依赖它定位。 */
401
509
  readonly before: SlideId | null;
402
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;
403
517
  }
404
518
  export type SlideTreePatch = {
405
519
  readonly op: 'remove' | 'insert';
@@ -421,7 +535,70 @@ export type TableRowPatch = {
421
535
  readonly value: import('../types').TableRowInsertion;
422
536
  readonly origin: string;
423
537
  };
424
- export type Patch = ElementTransformPatch | ElementFillPatch | ElementStrokePatch | ElementEffectsPatch | ElementLinkPatch | ElementCropPatch | ElementGeometryPatch | ElementImageReplacementPatch | ImageResourcePatch | ElementTextPatch | ElementOrderPatch | ElementNamePatch | ElementInteractionPatch | ElementTreePatch | ElementHierarchyPatch | SlideTreePatch | SlideOrderPatch | SlidePropertyPatch | SlideLayoutPatch | SlideNotesPatch | TableRowPatch | ElementTableStylePatch;
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;
425
602
  export interface CommandPatches {
426
603
  readonly forward: Patch[];
427
604
  readonly inverse: Patch[];
@@ -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,35 @@
1
+ import type { SlideComment } from '@web-ppt/core';
2
+ import type { Editor } from '../editor';
3
+ import type { SlideId } from '../types';
4
+ import type { CommentFields } from './state';
5
+ export { queryComments } from './state';
6
+ export type { CommentFields } from './state';
7
+ export type CommentCommand = {
8
+ type: 'AddComment';
9
+ slideId: SlideId;
10
+ comment: SlideComment & {
11
+ id: string;
12
+ };
13
+ } | {
14
+ type: 'UpdateComment';
15
+ slideId: SlideId;
16
+ id: string;
17
+ fields: Partial<CommentFields>;
18
+ } | {
19
+ type: 'RemoveComment';
20
+ slideId: SlideId;
21
+ id: string;
22
+ };
23
+ export declare function registerCommentEditing(): void;
24
+ export declare function createCommentEditor(editor: Pick<Editor, 'doc' | 'exec'>): {
25
+ exec: (command: CommentCommand) => import("..").TransactionResult;
26
+ query: (id: SlideId) => SlideComment[];
27
+ add(slideId: SlideId, comment: CommentFields & {
28
+ id?: string;
29
+ }): string;
30
+ update(slideId: SlideId, id: string, fields: Partial<CommentFields>): import("..").TransactionResult;
31
+ remove(slideId: SlideId, id: string): import("..").TransactionResult;
32
+ reply(slideId: SlideId, parentId: string, comment: CommentFields & {
33
+ id?: string;
34
+ }): string;
35
+ };
@@ -0,0 +1,3 @@
1
+ import type { EditDoc } from '../types';
2
+ /** 新部件隔离编辑覆盖,旧部件保持基线;撤销后保存可以精确恢复来源关系。 */
3
+ export declare function materializeCommentEdits(doc: EditDoc, baselines: Record<string, Uint8Array>, created: Set<string>, changes: Record<string, Uint8Array | null>): void;
@@ -0,0 +1,10 @@
1
+ import type { SlideComment } from '@web-ppt/core';
2
+ import type { EditDoc, SlideId } from '../types';
3
+ import type { ExtensionPatch } from '../commands/types';
4
+ export type CommentFields = Omit<SlideComment, 'id' | 'idx'>;
5
+ export type CommentState = Record<string, Partial<CommentFields> & {
6
+ deleted?: boolean;
7
+ }>;
8
+ export declare const commentState: (doc: EditDoc, id: SlideId) => CommentState;
9
+ export declare function queryComments(doc: EditDoc, slideId: SlideId): SlideComment[];
10
+ export declare function validateCommentPatch(_doc: EditDoc, patch: ExtensionPatch): void;
@@ -0,0 +1,12 @@
1
+ import type { SlideComment } from '@web-ppt/core';
2
+ import type { XmlElement } from '../xml/types';
3
+ export declare const THREAD_URI = "{C676402C-5697-4E1C-873F-D02D1690AC5C}";
4
+ export declare const THREAD_NS = "http://schemas.microsoft.com/office/powerpoint/2012/main";
5
+ export declare const attr: (node: XmlElement, name: string) => string | undefined;
6
+ export declare const children: (root: XmlElement, name: string) => XmlElement[];
7
+ export declare function add(parent: XmlElement, name: string, attributes?: Record<string, string>): XmlElement;
8
+ export type CommentIdentity = {
9
+ author: string;
10
+ idx: number;
11
+ };
12
+ export declare function writeComment(node: XmlElement, comment: SlideComment, identity: CommentIdentity, parent?: CommentIdentity): void;