@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.
- package/CHANGELOG.md +188 -0
- package/README.md +165 -22
- package/dist/alt-text.d.ts +5 -0
- package/dist/appearance/index.d.ts +12 -0
- package/dist/appearance/materialize.d.ts +4 -0
- package/dist/appearance/types.d.ts +26 -0
- package/dist/appearance/values.d.ts +9 -0
- package/dist/appearance.js +301 -0
- package/dist/cfb/index.d.ts +5 -0
- package/dist/cfb/read.d.ts +16 -0
- package/dist/cfb/write.d.ts +3 -0
- package/dist/cfb.js +208 -0
- package/dist/change-classification.d.ts +3 -3
- package/dist/chart/category-binding.d.ts +4 -0
- package/dist/chart/category-commands.d.ts +23 -0
- package/dist/chart/category-levels.d.ts +14 -0
- package/dist/chart/category-matrix.d.ts +2 -0
- package/dist/chart/category-value.d.ts +2 -0
- package/dist/chart/category-workbook.d.ts +13 -0
- package/dist/chart/commands.d.ts +28 -0
- package/dist/chart/context.d.ts +12 -0
- package/dist/chart/dataset-merge.d.ts +5 -0
- package/dist/chart/formula.d.ts +13 -0
- package/dist/chart/identity-frames.d.ts +4 -0
- package/dist/chart/identity-scopes.d.ts +6 -0
- package/dist/chart/identity.d.ts +24 -0
- package/dist/chart/index.d.ts +8 -0
- package/dist/chart/limits.d.ts +6 -0
- package/dist/chart/locator.d.ts +4 -0
- package/dist/chart/materialize.d.ts +7 -0
- package/dist/chart/ordering.d.ts +9 -0
- package/dist/chart/part-graph.d.ts +5 -0
- package/dist/chart/patch-validation.d.ts +3 -0
- package/dist/chart/plot-kinds.d.ts +2 -0
- package/dist/chart/projection.d.ts +8 -0
- package/dist/chart/save.d.ts +4 -0
- package/dist/chart/shared-added-plan.d.ts +19 -0
- package/dist/chart/shared-added-records.d.ts +8 -0
- package/dist/chart/shared-address.d.ts +5 -0
- package/dist/chart/shared-allocate.d.ts +7 -0
- package/dist/chart/shared-cache-codec.d.ts +5 -0
- package/dist/chart/shared-cache-identities.d.ts +3 -0
- package/dist/chart/shared-cache-migration.d.ts +7 -0
- package/dist/chart/shared-cache-save.d.ts +3 -0
- package/dist/chart/shared-cache-scopes.d.ts +13 -0
- package/dist/chart/shared-cache.d.ts +11 -0
- package/dist/chart/shared-category.d.ts +4 -0
- package/dist/chart/shared-cell.d.ts +9 -0
- package/dist/chart/shared-family.d.ts +26 -0
- package/dist/chart/shared-fields.d.ts +18 -0
- package/dist/chart/shared-graph.d.ts +19 -0
- package/dist/chart/shared-growth-space.d.ts +5 -0
- package/dist/chart/shared-inserted-cells.d.ts +14 -0
- package/dist/chart/shared-inserted-command.d.ts +7 -0
- package/dist/chart/shared-inserted-layout.d.ts +16 -0
- package/dist/chart/shared-inserted-project.d.ts +14 -0
- package/dist/chart/shared-inserted-records.d.ts +16 -0
- package/dist/chart/shared-inserted-save.d.ts +6 -0
- package/dist/chart/shared-joint-command.d.ts +9 -0
- package/dist/chart/shared-joint-records.d.ts +9 -0
- package/dist/chart/shared-record-axis.d.ts +25 -0
- package/dist/chart/shared-record-remove.d.ts +13 -0
- package/dist/chart/shared-record-stage.d.ts +2 -0
- package/dist/chart/shared-records.d.ts +2 -0
- package/dist/chart/shared-rows.d.ts +17 -0
- package/dist/chart/shared-runtime.d.ts +19 -0
- package/dist/chart/shared-save-plan.d.ts +4 -0
- package/dist/chart/shared-save.d.ts +3 -0
- package/dist/chart/shared-series.d.ts +6 -0
- package/dist/chart/shared-source-cache.d.ts +4 -0
- package/dist/chart/shared-topology.d.ts +9 -0
- package/dist/chart/shared-unresolved.d.ts +3 -0
- package/dist/chart/shared-validation.d.ts +6 -0
- package/dist/chart/shared-workbook-source.d.ts +6 -0
- package/dist/chart/shared-xy-command.d.ts +7 -0
- package/dist/chart/shared-xy-family.d.ts +16 -0
- package/dist/chart/shared-xy-project.d.ts +6 -0
- package/dist/chart/shared-xy-records.d.ts +23 -0
- package/dist/chart/shared-xy-save.d.ts +5 -0
- package/dist/chart/shared-xy-source.d.ts +39 -0
- package/dist/chart/shared.d.ts +13 -0
- package/dist/chart/source.d.ts +11 -0
- package/dist/chart/types.d.ts +86 -0
- package/dist/chart/validation.d.ts +24 -0
- package/dist/chart/workbook-range.d.ts +16 -0
- package/dist/chart/workbook-read.d.ts +7 -0
- package/dist/chart/workbook-write.d.ts +9 -0
- package/dist/chart/workbook.d.ts +25 -0
- package/dist/chart/xml-data.d.ts +14 -0
- package/dist/chart/xml-namespaces.d.ts +16 -0
- package/dist/chart-design/index.d.ts +10 -0
- package/dist/chart-design/types.d.ts +11 -0
- package/dist/chart-design/xml.d.ts +2 -0
- package/dist/chart-design.js +361 -0
- package/dist/chart-ex/index.d.ts +15 -0
- package/dist/chart-ex/workbook.d.ts +6 -0
- package/dist/chart-ex/xml.d.ts +14 -0
- package/dist/chart-ex.js +457 -0
- package/dist/chart-shared/index.d.ts +12 -0
- package/dist/chart-shared.js +1 -0
- package/dist/chart.js +1 -0
- package/dist/clipboard-links-GuPtqr1z.js +778 -0
- package/dist/clipboard-package.d.ts +4 -0
- package/dist/clipboard-source.d.ts +6 -2
- package/dist/clipboard-trees.d.ts +9 -0
- package/dist/collaboration-identity.d.ts +3 -0
- package/dist/commands/add-slide-identity.d.ts +4 -0
- package/dist/commands/bullet-image-resource.d.ts +11 -0
- package/dist/commands/clear-format.d.ts +4 -0
- package/dist/commands/common-object-slide-patch.d.ts +4 -0
- package/dist/commands/common-object-slide-types.d.ts +68 -0
- package/dist/commands/convert-to-custom-geometry.d.ts +4 -0
- package/dist/commands/direct-format-patches.d.ts +11 -5
- package/dist/commands/distribute-elements.d.ts +4 -0
- package/dist/commands/edit-table-grid.d.ts +10 -0
- package/dist/commands/element-alt-text.d.ts +8 -0
- package/dist/commands/element-arrangement.d.ts +17 -0
- package/dist/commands/element-effects.d.ts +1 -1
- package/dist/commands/element-fill.d.ts +1 -1
- package/dist/commands/element-geometry.d.ts +9 -0
- package/dist/commands/element-hierarchy.d.ts +6 -0
- package/dist/commands/element-image-content.d.ts +2 -2
- package/dist/commands/element-link.d.ts +1 -1
- package/dist/commands/element-name.d.ts +1 -1
- package/dist/commands/element-stroke.d.ts +1 -1
- package/dist/commands/element-table-style.d.ts +5 -0
- package/dist/commands/element-text.d.ts +1 -1
- package/dist/commands/element-transform.d.ts +2 -2
- package/dist/commands/frame-decomposition.d.ts +10 -0
- package/dist/commands/generated-creation-defaults.d.ts +4 -0
- package/dist/commands/geometry-types.d.ts +44 -0
- package/dist/commands/group-types.d.ts +24 -0
- package/dist/commands/group.d.ts +4 -0
- package/dist/commands/hierarchy-record.d.ts +5 -0
- package/dist/commands/image-resource.d.ts +8 -1
- package/dist/commands/insertion-host.d.ts +16 -0
- package/dist/commands/insertion-rect.d.ts +2 -0
- package/dist/commands/layout-property.d.ts +7 -0
- package/dist/commands/master-property.d.ts +5 -0
- package/dist/commands/master-text-style-types.d.ts +27 -0
- package/dist/commands/master-text-style.d.ts +7 -0
- package/dist/commands/paste-resources.d.ts +9 -5
- package/dist/commands/patch-apply.d.ts +3 -0
- package/dist/commands/patch-count.d.ts +1 -0
- package/dist/commands/patch-invalidation.d.ts +4 -0
- package/dist/commands/patch-stage.d.ts +4 -0
- package/dist/commands/patch.d.ts +4 -0
- package/dist/commands/record-clone.d.ts +3 -0
- package/dist/commands/record-override.d.ts +5 -0
- package/dist/commands/replace-image.d.ts +6 -1
- package/dist/commands/sections.d.ts +10 -0
- package/dist/commands/set-geometry.d.ts +4 -0
- package/dist/commands/set-preset.d.ts +5 -0
- package/dist/commands/set-table-style.d.ts +3 -0
- package/dist/commands/slide-property-types.d.ts +55 -5
- package/dist/commands/slide-size.d.ts +7 -0
- package/dist/commands/spid.d.ts +2 -1
- package/dist/commands/table-grid-patch.d.ts +12 -0
- package/dist/commands/table-style-types.d.ts +28 -0
- package/dist/commands/text-target.d.ts +3 -2
- package/dist/commands/theme-types.d.ts +47 -0
- package/dist/commands/theme.d.ts +9 -0
- package/dist/commands/types.d.ts +219 -17
- package/dist/commands/ungroup-source.d.ts +3 -0
- package/dist/commands/ungroup.d.ts +4 -0
- package/dist/comments/index.d.ts +35 -0
- package/dist/comments/save.d.ts +3 -0
- package/dist/comments/state.d.ts +10 -0
- package/dist/comments/xml.d.ts +12 -0
- package/dist/comments.js +782 -0
- package/dist/common-object-slide-types.d.ts +34 -0
- package/dist/custom-geometry-path.d.ts +3 -0
- package/dist/custom-geometry.d.ts +12 -0
- package/dist/data-validation.d.ts +1 -1
- package/dist/describe/budget.d.ts +3 -0
- package/dist/describe/index.d.ts +5 -0
- package/dist/describe/read.d.ts +4 -0
- package/dist/describe/types.d.ts +103 -0
- package/dist/describe.js +192 -0
- package/dist/design-dependencies.d.ts +8 -0
- package/dist/design-projection-package.d.ts +10 -0
- package/dist/design-target.d.ts +10 -0
- package/dist/design.d.ts +3 -0
- package/dist/document-extensions.d.ts +9 -0
- package/dist/document.d.ts +1 -1
- package/dist/dynamic-projection.d.ts +6 -0
- package/dist/edit-core.js +5680 -3413
- package/dist/editor.d.ts +19 -2
- package/dist/element-source.d.ts +11 -0
- package/dist/element-spids.d.ts +4 -0
- package/dist/extension-address-journal.d.ts +9 -0
- package/dist/extension-address-remap.d.ts +14 -0
- package/dist/extension-addresses.d.ts +20 -0
- package/dist/extension-copy-history.d.ts +7 -0
- package/dist/extension-copy.d.ts +16 -0
- package/dist/extension-migration-receipt.d.ts +34 -0
- package/dist/extension-recovery-context.d.ts +5 -0
- package/dist/extension-runtime.d.ts +64 -0
- package/dist/generate/comments.d.ts +3 -0
- package/dist/generate/compatibility-parts.d.ts +14 -0
- package/dist/generate/compatibility-references.d.ts +3 -0
- package/dist/generate/compatibility.d.ts +4 -0
- package/dist/generate/custom-geometry.d.ts +2 -0
- package/dist/generate/index.d.ts +13 -0
- package/dist/generate/links.d.ts +3 -0
- package/dist/generate/master-defaults.d.ts +4 -0
- package/dist/generate/materialize.d.ts +2 -0
- package/dist/generate/math.d.ts +3 -0
- package/dist/generate/media.d.ts +13 -0
- package/dist/generate/portable-clipboard.d.ts +4 -0
- package/dist/generate/projection-tree.d.ts +8 -0
- package/dist/generate/table.d.ts +4 -0
- package/dist/generate/template.d.ts +70 -0
- package/dist/generate/text-body.d.ts +2 -0
- package/dist/generate/text-effects.d.ts +5 -0
- package/dist/generate/text-override.d.ts +8 -0
- package/dist/generate/validation.d.ts +3 -0
- package/dist/generate/warp.d.ts +2 -0
- package/dist/generate.js +1464 -0
- package/dist/history.d.ts +11 -1
- package/dist/hyperlink.d.ts +2 -0
- package/dist/identities.d.ts +4 -0
- package/dist/identity-allocation.d.ts +12 -0
- package/dist/identity-watermark.d.ts +4 -0
- package/dist/image-content.d.ts +5 -2
- package/dist/image-resource-history.d.ts +2 -0
- package/dist/index-C2r7c6G6.js +714 -0
- package/dist/index-CYDvbiwF.js +1 -0
- package/dist/index.d.ts +43 -7
- package/dist/ink/index.d.ts +27 -0
- package/dist/ink/model.d.ts +4 -0
- package/dist/ink/save.d.ts +3 -0
- package/dist/ink/source.d.ts +7 -0
- package/dist/ink.js +324 -0
- package/dist/layout-assets.d.ts +3 -1
- package/dist/layout-projection.d.ts +19 -5
- package/dist/layout-state.d.ts +2 -0
- package/dist/layout-types.d.ts +42 -0
- package/dist/layout.d.ts +5 -0
- package/dist/lint/color.d.ts +5 -0
- package/dist/lint/index.d.ts +7 -0
- package/dist/lint/prompts.d.ts +3 -0
- package/dist/lint/report.d.ts +21 -0
- package/dist/lint/sampler-batch.d.ts +4 -0
- package/dist/lint/sampler-images.d.ts +2 -0
- package/dist/lint/sampler.d.ts +9 -0
- package/dist/lint/snapshot.d.ts +34 -0
- package/dist/lint/types.d.ts +67 -0
- package/dist/lint-sampler.js +187 -0
- package/dist/lint.js +659 -0
- package/dist/master-state.d.ts +3 -0
- package/dist/master-text-style-state.d.ts +3 -0
- package/dist/master-types.d.ts +55 -0
- package/dist/master.d.ts +5 -0
- package/dist/media/audio-icon.d.ts +2 -0
- package/dist/media/commands.d.ts +3 -0
- package/dist/media/index.d.ts +10 -0
- package/dist/media/markup.d.ts +10 -0
- package/dist/media/mp4-boxes.d.ts +12 -0
- package/dist/media/mp4-fragments.d.ts +8 -0
- package/dist/media/mp4-samples.d.ts +4 -0
- package/dist/media/mp4.d.ts +2 -0
- package/dist/media/poster.d.ts +2 -0
- package/dist/media/replace-poster.d.ts +3 -0
- package/dist/media/resource.d.ts +4 -0
- package/dist/media/source.d.ts +14 -0
- package/dist/media/types.d.ts +33 -0
- package/dist/media-properties.d.ts +4 -0
- package/dist/media.js +1630 -0
- package/dist/model-invariants-BM19JVxy.js +8980 -0
- package/dist/object-source.d.ts +11 -0
- package/dist/ole/container.d.ts +14 -0
- package/dist/ole/content.d.ts +94 -0
- package/dist/ole/index.d.ts +20 -0
- package/dist/ole/preview.d.ts +3 -0
- package/dist/ole/save.d.ts +2 -0
- package/dist/ole/state.d.ts +16 -0
- package/dist/ole.js +870 -0
- package/dist/opc/patch.d.ts +2 -0
- package/dist/opc.js +1 -1
- package/dist/paragraph-level.d.ts +11 -0
- package/dist/paragraph-property-schema.d.ts +5 -2
- package/dist/{patch-DO8497wO.js → patch-BwhfBbYE.js} +112 -95
- package/dist/patch-change.d.ts +4 -0
- package/dist/patch-events.d.ts +16 -0
- package/dist/ppt/appearance.d.ts +11 -0
- package/dist/ppt/binary.d.ts +20 -0
- package/dist/ppt/drawing.d.ts +18 -0
- package/dist/ppt/geometry.d.ts +4 -0
- package/dist/ppt/index.d.ts +12 -0
- package/dist/ppt/pictures.d.ts +11 -0
- package/dist/ppt/text.d.ts +9 -0
- package/dist/ppt.js +774 -0
- package/dist/preset-geometry.d.ts +6 -0
- package/dist/projection.d.ts +2 -0
- package/dist/query-BHLjWjnu.js +903 -0
- package/dist/recovery-identity.d.ts +3 -1
- package/dist/recovery-migrations.d.ts +3 -0
- package/dist/recovery.d.ts +3 -0
- package/dist/resize/index.d.ts +6 -0
- package/dist/resize/text.d.ts +4 -0
- package/dist/resize.js +5090 -0
- package/dist/retained-element-origins.d.ts +6 -0
- package/dist/run-property-fields.d.ts +12 -0
- package/dist/run-property-schema.d.ts +3 -1
- package/dist/run-style.d.ts +15 -0
- package/dist/save/alt-text.d.ts +4 -0
- package/dist/save/comments.d.ts +3 -0
- package/dist/save/effects.d.ts +2 -1
- package/dist/save/extension-availability.d.ts +3 -0
- package/dist/save/extension-elements.d.ts +26 -0
- package/dist/save/geometry.d.ts +5 -0
- package/dist/save/index.d.ts +6 -1
- package/dist/save/insertion.d.ts +7 -3
- package/dist/save/layout-properties.d.ts +4 -0
- package/dist/save/master-properties.d.ts +5 -0
- package/dist/save/notes.d.ts +2 -0
- package/dist/save/paragraph-overrides.d.ts +3 -0
- package/dist/save/run-overrides.d.ts +10 -0
- package/dist/save/shape-format.d.ts +3 -0
- package/dist/save/slide-parts.d.ts +1 -0
- package/dist/save/table-style-part.d.ts +11 -0
- package/dist/save/table.d.ts +5 -0
- package/dist/save/text-source-less.d.ts +6 -0
- package/dist/save/xfrm.d.ts +8 -2
- package/dist/save.js +502 -1480
- package/dist/sections.d.ts +8 -0
- package/dist/session-assets.d.ts +4 -0
- package/dist/slide-parts-D0o_DDhi.js +1331 -0
- package/dist/slide-size.d.ts +6 -0
- package/dist/smartart/drawing.d.ts +3 -0
- package/dist/smartart/index.d.ts +16 -0
- package/dist/smartart/model.d.ts +18 -0
- package/dist/smartart/save.d.ts +3 -0
- package/dist/smartart.js +604 -0
- package/dist/source-retention.d.ts +7 -0
- package/dist/space.d.ts +37 -0
- package/dist/table-cell.d.ts +7 -1
- package/dist/table-direct-markup.d.ts +7 -1
- package/dist/table-grid-projection.d.ts +6 -0
- package/dist/table-grid.d.ts +45 -0
- package/dist/table-invariants.d.ts +4 -0
- package/dist/table-rows.d.ts +2 -1
- package/dist/table-scale.d.ts +4 -0
- package/dist/table-style.d.ts +21 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/recipes.d.ts +5 -0
- package/dist/templates/types.d.ts +17 -0
- package/dist/templates.js +543 -0
- package/dist/text-flatten.d.ts +6 -0
- package/dist/text-fragment.d.ts +5 -0
- package/dist/text-model.d.ts +8 -8
- package/dist/text-override-validation.d.ts +6 -2
- package/dist/text-selection.d.ts +4 -0
- package/dist/theme-projection.d.ts +8 -0
- package/dist/theme-xml.d.ts +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/types.d.ts +217 -8
- package/dist/xml/index.d.ts +1 -1
- package/dist/xml/nodes.d.ts +2 -2
- package/dist/xml/shape-ids.d.ts +3 -0
- package/dist/xml.js +19 -16
- package/package.json +77 -5
- package/schemas/describe.schema.json +479 -0
- package/schemas/lint.schema.json +145 -0
- package/dist/index-D4ZTaYOa.js +0 -706
- 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,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;
|
|
@@ -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
|
|
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
|
|
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;
|
package/dist/commands/spid.d.ts
CHANGED
|
@@ -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
|
|
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;
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import type { Effects, Fill, Stroke } from '@web-ppt/core';
|
|
2
|
-
import type { ElementId, ElementImageReplacement, ElementInsertionResource, ElementRecord, ImageCrop, LinkOverride, LinkTarget,
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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:
|
|
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,
|
|
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,
|
|
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
|
|
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;
|