@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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EditDoc, SlideSizeState } from './types';
|
|
2
|
+
/** ST_SlideSizeCoordinate 的闭区间换算为 CSS px;写回前仍会取整到 EMU。 */
|
|
3
|
+
export declare const MIN_SLIDE_SIZE = 96;
|
|
4
|
+
export declare const MAX_SLIDE_SIZE = 5376;
|
|
5
|
+
export declare function assertSlideSize(value: unknown, label: string): asserts value is number;
|
|
6
|
+
export declare function querySlideSize(doc: EditDoc): SlideSizeState;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EditDoc, Editor, ElementId } from '@web-ppt/edit-core';
|
|
2
|
+
import type { SmartArtNode } from './model';
|
|
3
|
+
export type { SmartArtNode } from './model';
|
|
4
|
+
export declare function querySmartArt(doc: EditDoc, id: ElementId): SmartArtNode[];
|
|
5
|
+
export declare function listEditableSmartArt(doc: EditDoc): {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare function createSmartArtEditor(editor: Pick<Editor, 'doc' | 'exec'>): {
|
|
10
|
+
query: (id: ElementId) => SmartArtNode[];
|
|
11
|
+
setText(id: ElementId, nodeId: string, text: string): void;
|
|
12
|
+
addNode(id: ElementId, parentId: string | null, text: string, nodeId?: string): string;
|
|
13
|
+
removeNode(id: ElementId, nodeId: string): void;
|
|
14
|
+
moveNode(id: ElementId, nodeId: string, parentId: string | null, beforeId?: string): void;
|
|
15
|
+
reset(id: ElementId): void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { XmlElement } from '@web-ppt/edit-core/xml';
|
|
2
|
+
export declare const DGM = "http://schemas.openxmlformats.org/drawingml/2006/diagram";
|
|
3
|
+
export declare const DSP = "http://schemas.microsoft.com/office/drawing/2008/diagram";
|
|
4
|
+
export declare const A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
5
|
+
export declare const children: (node: XmlElement | null, name?: string) => XmlElement[];
|
|
6
|
+
export declare const child: (node: XmlElement | null, name: string) => XmlElement;
|
|
7
|
+
export declare const attr: (node: XmlElement | null, name: string) => string | undefined;
|
|
8
|
+
export interface SmartArtNode {
|
|
9
|
+
id: string;
|
|
10
|
+
parentId: string | null;
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function readSmartArtNodes(xml: string): SmartArtNode[];
|
|
14
|
+
export declare function normalizeNodes(value: unknown): SmartArtNode[];
|
|
15
|
+
export declare const smartArtIdentity: (seed: string) => string;
|
|
16
|
+
export declare function replaceSmartArtText(point: XmlElement, text: string): void;
|
|
17
|
+
/** 数据点与 parent-of 关系写回 DiagramML;表现层/过渡点随结构重新生成。 */
|
|
18
|
+
export declare function writeSmartArtNodes(xml: string, nodes: SmartArtNode[]): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EditDoc } from '@web-ppt/edit-core';
|
|
2
|
+
export declare const storedSmartArt: (doc: EditDoc, id: string) => string | undefined;
|
|
3
|
+
export declare function saveSmartArt(doc: EditDoc, baselines: Record<string, Uint8Array>, created: Set<string>, changes: Record<string, Uint8Array | null>, generated?: boolean): void;
|
package/dist/smartart.js
ADDED
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
import { sourcePartBytes as R, effectiveElement as Bt } from "@web-ppt/edit-core";
|
|
2
|
+
import { layoutDiagramXml as Jt, renderDiagramXml as qt } from "@web-ppt/core/diagram-edit";
|
|
3
|
+
import { xmlElementChildren as U, parseXmlTree as M, findXmlAttribute as ct, cloneXmlNodeWithNamespaceClosure as Q, removeXmlChild as K, insertXmlChildUnchecked as b, setXmlAttribute as F, serializeXmlTree as Qt, createXmlElement as A, createXmlText as Kt, serializeXmlTreeBytes as st, cloneXmlNode as Ht, insertXmlInOrder as Mt } from "@web-ppt/edit-core/xml";
|
|
4
|
+
import { sha256 as Zt } from "@web-ppt/core";
|
|
5
|
+
const Vt = "http://schemas.openxmlformats.org/presentationml/2006/main", Yt = "http://schemas.openxmlformats.org/package/2006/relationships", te = "http://purl.oclc.org/ooxml", ee = `${te}/presentationml/main`, re = (t, e, n) => t === e || t === n, ne = (t) => re(t, Vt, ee), zt = R, Ut = /* @__PURE__ */ new WeakMap(), oe = {
|
|
6
|
+
bg1: "lt1",
|
|
7
|
+
tx1: "dk1",
|
|
8
|
+
bg2: "lt2",
|
|
9
|
+
tx2: "dk2",
|
|
10
|
+
accent1: "accent1",
|
|
11
|
+
accent2: "accent2",
|
|
12
|
+
accent3: "accent3",
|
|
13
|
+
accent4: "accent4",
|
|
14
|
+
accent5: "accent5",
|
|
15
|
+
accent6: "accent6",
|
|
16
|
+
hlink: "hlink",
|
|
17
|
+
folHlink: "folHlink"
|
|
18
|
+
};
|
|
19
|
+
function se(t) {
|
|
20
|
+
const e = t.lastIndexOf("/");
|
|
21
|
+
return `${t.slice(0, e + 1)}_rels/${t.slice(e + 1)}.rels`;
|
|
22
|
+
}
|
|
23
|
+
function ae(t, e) {
|
|
24
|
+
if (e.startsWith("/")) return e.slice(1);
|
|
25
|
+
const n = t.slice(0, t.lastIndexOf("/") + 1).split("/").filter(Boolean);
|
|
26
|
+
for (const o of e.split("/"))
|
|
27
|
+
o === ".." ? n.pop() : o && o !== "." && n.push(o);
|
|
28
|
+
return n.join("/");
|
|
29
|
+
}
|
|
30
|
+
function vt(t, e) {
|
|
31
|
+
var a, i, d, h;
|
|
32
|
+
const n = zt(t, se(e));
|
|
33
|
+
if (!n) return {};
|
|
34
|
+
let o = Ut.get(n);
|
|
35
|
+
o || (o = /* @__PURE__ */ new Map(), Ut.set(n, o));
|
|
36
|
+
const r = o.get(e);
|
|
37
|
+
if (r) return r;
|
|
38
|
+
const s = /* @__PURE__ */ Object.create(null);
|
|
39
|
+
for (const u of U(M(n).root, {
|
|
40
|
+
localName: "Relationship",
|
|
41
|
+
namespaceUri: Yt
|
|
42
|
+
})) {
|
|
43
|
+
const p = (a = ct(u, { localName: "Id", namespaceUri: null })) == null ? void 0 : a.value, c = (i = ct(u, { localName: "Type", namespaceUri: null })) == null ? void 0 : i.value, m = (d = ct(u, { localName: "Target", namespaceUri: null })) == null ? void 0 : d.value, l = ((h = ct(u, {
|
|
44
|
+
localName: "TargetMode",
|
|
45
|
+
namespaceUri: null
|
|
46
|
+
})) == null ? void 0 : h.value) === "External";
|
|
47
|
+
p && c && m && (s[p] = { type: c, target: l ? m : ae(e, m), ...l ? { external: !0 } : {} });
|
|
48
|
+
}
|
|
49
|
+
return o.set(e, s), s;
|
|
50
|
+
}
|
|
51
|
+
function ie(t, e) {
|
|
52
|
+
var o;
|
|
53
|
+
let n = (o = t.elements[e]) == null ? void 0 : o.parent;
|
|
54
|
+
for (; n && t.elements[n]; ) n = t.elements[n].parent;
|
|
55
|
+
return n ? t.slides[n] : void 0;
|
|
56
|
+
}
|
|
57
|
+
const ce = (t) => {
|
|
58
|
+
var n;
|
|
59
|
+
const e = (n = t.match(/rgba?\(([^)]+)\)/)) == null ? void 0 : n[1].split(",").slice(0, 3).map((o) => Math.max(0, Math.min(255, Math.round(Number(o.trim())))));
|
|
60
|
+
return (e == null ? void 0 : e.length) === 3 && e.every(Number.isFinite) ? e.map((o) => o.toString(16).padStart(2, "0")).join("").toUpperCase() : t.replace("#", "");
|
|
61
|
+
};
|
|
62
|
+
function le(t, e, n) {
|
|
63
|
+
var l;
|
|
64
|
+
const o = ie(t, e), r = o != null && o.layoutId ? t.layouts[o.layoutId] : void 0, s = r ? t.masters[r.origin.masterPart] : void 0, a = (r == null ? void 0 : r.themeId) ?? (s == null ? void 0 : s.themeId), i = a ? t.themes[a] : void 0, d = { ...i == null ? void 0 : i.src.colors, ...i == null ? void 0 : i.ovr.colors }, h = structuredClone((i == null ? void 0 : i.src.fonts) ?? {
|
|
65
|
+
major: { latin: "", ea: "", cs: "", scripts: {} },
|
|
66
|
+
minor: { latin: "", ea: "", cs: "", scripts: {} }
|
|
67
|
+
});
|
|
68
|
+
for (const f of ["major", "minor"])
|
|
69
|
+
Object.assign(h[f], (l = i == null ? void 0 : i.ovr.fonts) == null ? void 0 : l[f]);
|
|
70
|
+
const u = { ...oe }, p = s && zt(t, s.id), c = p ? M(p).root : null, m = c && ne(c.namespaceUri) ? U(c).find((f) => f.localName === "clrMap" && f.namespaceUri === c.namespaceUri) : null;
|
|
71
|
+
for (const f of (m == null ? void 0 : m.attributes) ?? []) u[f.localName] = f.value;
|
|
72
|
+
return {
|
|
73
|
+
ctx: { theme: Object.fromEntries(Object.entries(d).map(([f, y]) => [f, ce(y)])), clrMap: u },
|
|
74
|
+
fonts: h,
|
|
75
|
+
rels: structuredClone(vt(t, n))
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function Et(t, e, n, o = "id") {
|
|
79
|
+
var m, l, f, y;
|
|
80
|
+
const r = t.elements[e], s = r == null ? void 0 : r.meta.origin;
|
|
81
|
+
if (!s || r.meta.editable !== "frame") return null;
|
|
82
|
+
let a = r.parent;
|
|
83
|
+
for (; t.elements[a]; ) a = t.elements[a].parent;
|
|
84
|
+
const i = ((l = (m = t.slides[a]) == null ? void 0 : m.creation) == null ? void 0 : l.duplicateSourcePart) ?? s.part, d = R(t, i);
|
|
85
|
+
if (!d) return null;
|
|
86
|
+
const h = M(d).root, u = [h], p = h.namespaceUri, c = vt(t, i);
|
|
87
|
+
for (; u.length; ) {
|
|
88
|
+
const j = u.pop(), S = U(j);
|
|
89
|
+
if (j.localName !== "graphicFrame" || j.namespaceUri !== p) {
|
|
90
|
+
u.push(...S);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const P = S.find((g) => g.localName === "nvGraphicFramePr" && g.namespaceUri === p), N = P && U(P).find((g) => g.localName === "cNvPr" && g.namespaceUri === p);
|
|
94
|
+
if (Number((f = N == null ? void 0 : N.attributes.find((g) => g.localName === "id" && !g.namespaceUri)) == null ? void 0 : f.value) !== s.spid) continue;
|
|
95
|
+
const I = [...S];
|
|
96
|
+
for (; I.length; ) {
|
|
97
|
+
const g = I.pop();
|
|
98
|
+
if (g.localName === "graphicData" && g.attributes.some((v) => v.localName === "uri" && !v.namespaceUri && v.value === n)) {
|
|
99
|
+
const v = U(g).find((T) => T.namespaceUri === n || n.endsWith("/ole") && T.namespaceUri === p && T.localName === "oleObj"), W = Object.fromEntries(((v == null ? void 0 : v.attributes) ?? []).filter((T) => {
|
|
100
|
+
var B;
|
|
101
|
+
return ((B = T.namespaceUri) == null ? void 0 : B.endsWith("/relationships")) && c[T.value];
|
|
102
|
+
}).map((T) => [T.localName, c[T.value].target])), L = (y = v == null ? void 0 : v.attributes.find((T) => {
|
|
103
|
+
var B;
|
|
104
|
+
return T.localName === o && ((B = T.namespaceUri) == null ? void 0 : B.endsWith("/relationships"));
|
|
105
|
+
})) == null ? void 0 : y.value, k = L && c[L], C = k && k.target, at = C && R(t, C);
|
|
106
|
+
if (C && at) return {
|
|
107
|
+
part: C,
|
|
108
|
+
hostPart: i,
|
|
109
|
+
references: W,
|
|
110
|
+
xml: new TextDecoder().decode(at),
|
|
111
|
+
context: { ...le(t, e, C), readPart: (T) => R(t, T) }
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
I.push(...U(g));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function pe(t, e, n) {
|
|
120
|
+
if (!t || typeof t != "object" || Object.getPrototypeOf(t) !== Object.prototype && Object.getPrototypeOf(t) !== null)
|
|
121
|
+
throw new Error(`${n} 必须是纯数据对象`);
|
|
122
|
+
const o = Array.isArray(e) ? new Set(e) : e;
|
|
123
|
+
for (const r of Reflect.ownKeys(t)) {
|
|
124
|
+
const s = Object.getOwnPropertyDescriptor(t, r);
|
|
125
|
+
if (typeof r != "string" || !o.has(r) || !(s != null && s.enumerable) || !("value" in s))
|
|
126
|
+
throw new Error(`${n} 包含不可序列化或未知字段:${String(r)}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function fe(t, e) {
|
|
130
|
+
if (!Array.isArray(t) || Object.getPrototypeOf(t) !== Array.prototype)
|
|
131
|
+
throw new Error(`${e} 必须是纯数据数组`);
|
|
132
|
+
const n = Reflect.ownKeys(t);
|
|
133
|
+
if (n.length !== t.length + 1 || n[n.length - 1] !== "length")
|
|
134
|
+
throw new Error(`${e} 必须是没有附加字段的稠密数组`);
|
|
135
|
+
for (let o = 0; o < t.length; o++) {
|
|
136
|
+
const r = String(o), s = Object.getOwnPropertyDescriptor(t, r);
|
|
137
|
+
if (n[o] !== r || !(s != null && s.enumerable) || !("value" in s))
|
|
138
|
+
throw new Error(`${e}[${o}] 必须是可序列化的数据项`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function yt(t) {
|
|
142
|
+
const e = t.lastIndexOf("/"), n = e < 0 ? "" : t.slice(0, e + 1), o = e < 0 ? t : t.slice(e + 1);
|
|
143
|
+
return `${n}_rels/${o}.rels`;
|
|
144
|
+
}
|
|
145
|
+
function nt(t, e) {
|
|
146
|
+
const n = t.split("/").slice(0, -1), o = e.split("/");
|
|
147
|
+
let r = 0;
|
|
148
|
+
for (; r < n.length && r < o.length && n[r] === o[r]; ) r++;
|
|
149
|
+
return `${"../".repeat(n.length - r)}${o.slice(r).join("/")}`;
|
|
150
|
+
}
|
|
151
|
+
function de(t, e) {
|
|
152
|
+
const n = e.split("#", 1)[0], o = [
|
|
153
|
+
...n.startsWith("/") ? [] : t.split("/").slice(0, -1),
|
|
154
|
+
...n.replace(/^\//, "").split("/")
|
|
155
|
+
], r = [];
|
|
156
|
+
for (const s of o)
|
|
157
|
+
if (!(!s || s === "."))
|
|
158
|
+
if (s === "..") {
|
|
159
|
+
if (!r.length) throw new Error(`OPC 关系越出包根:${e}`);
|
|
160
|
+
r.pop();
|
|
161
|
+
} else r.push(s);
|
|
162
|
+
return r.join("/");
|
|
163
|
+
}
|
|
164
|
+
const bt = Symbol.for("@web-ppt/edit-core/extensions/v1"), jt = Symbol.for("@web-ppt/edit-core/extensions-generation/v1"), St = Symbol.for("@web-ppt/edit-core/extensions-listeners/v1"), me = /^[a-z][a-z0-9-]{0,63}$/;
|
|
165
|
+
function $t() {
|
|
166
|
+
const t = globalThis;
|
|
167
|
+
return t[St] ?? (t[St] = { documents: /* @__PURE__ */ new WeakMap(), pending: /* @__PURE__ */ new Map(), active: /* @__PURE__ */ new Set(), resolvers: /* @__PURE__ */ new WeakMap() });
|
|
168
|
+
}
|
|
169
|
+
function ue(t) {
|
|
170
|
+
if (!me.test(t))
|
|
171
|
+
throw new Error(`编辑扩展命名空间无效:${t}`);
|
|
172
|
+
}
|
|
173
|
+
function he() {
|
|
174
|
+
const t = globalThis;
|
|
175
|
+
return t[bt] ?? (t[bt] = /* @__PURE__ */ new Map());
|
|
176
|
+
}
|
|
177
|
+
function ge(t, e) {
|
|
178
|
+
var r;
|
|
179
|
+
ue(t), he().set(t, e);
|
|
180
|
+
const n = globalThis;
|
|
181
|
+
n[jt] = (n[jt] ?? 0) + 1;
|
|
182
|
+
const o = new Set($t().pending.get(t));
|
|
183
|
+
if (e.migrate) for (const s of $t().active) o.add(s);
|
|
184
|
+
$t().pending.delete(t);
|
|
185
|
+
for (const s of o ?? [])
|
|
186
|
+
try {
|
|
187
|
+
s(t);
|
|
188
|
+
} catch (a) {
|
|
189
|
+
(r = globalThis.reportError) == null || r.call(globalThis, a);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const X = "http://schemas.openxmlformats.org/drawingml/2006/diagram", G = "http://schemas.microsoft.com/office/drawing/2008/diagram", O = "http://schemas.openxmlformats.org/drawingml/2006/main", E = (t, e) => t ? U(t).filter((n) => n.namespaceUri === t.namespaceUri && (!e || n.localName === e)) : [], $ = (t, e) => E(t, e)[0] ?? null, x = (t, e) => {
|
|
193
|
+
var n;
|
|
194
|
+
return (n = t == null ? void 0 : t.attributes.find((o) => o.localName === e && !o.namespaceUri)) == null ? void 0 : n.value;
|
|
195
|
+
}, Ft = (t) => t.children.map((e) => e.type === "text" || e.type === "cdata" ? e.value : e.type === "element" ? Ft(e) : "").join(""), Nt = (t, e, n) => {
|
|
196
|
+
const o = [t], r = [];
|
|
197
|
+
for (; o.length; ) {
|
|
198
|
+
const s = o.shift();
|
|
199
|
+
s.namespaceUri === e && s.localName === n ? r.push(s) : o.unshift(...U(s));
|
|
200
|
+
}
|
|
201
|
+
return r;
|
|
202
|
+
};
|
|
203
|
+
function dt(t) {
|
|
204
|
+
const e = M(t).root;
|
|
205
|
+
if (e.namespaceUri !== X || e.localName !== "dataModel") throw new Error("对象没有 SmartArt 数据模型");
|
|
206
|
+
const n = E($(e, "ptLst"), "pt"), o = E($(e, "cxnLst"), "cxn"), r = x(n.find((a) => x(a, "type") === "doc") ?? null, "modelId");
|
|
207
|
+
return n.filter((a) => !x(a, "type") || x(a, "type") === "node").map((a) => {
|
|
208
|
+
const i = x(a, "modelId");
|
|
209
|
+
if (!i) throw new Error("SmartArt 节点缺少身份");
|
|
210
|
+
const d = o.filter((p) => (!x(p, "type") || x(p, "type") === "parOf") && x(p, "destId") === i);
|
|
211
|
+
if (d.length > 1) throw new Error("SmartArt 节点有多个父节点");
|
|
212
|
+
const h = x(d[0] ?? null, "srcId"), u = $(a, "t");
|
|
213
|
+
return {
|
|
214
|
+
id: i,
|
|
215
|
+
parentId: h && h !== r ? h : null,
|
|
216
|
+
text: u ? Nt(u, O, "p").map((p) => Nt(p, O, "t").map(Ft).join("")).join(`
|
|
217
|
+
`) : "",
|
|
218
|
+
order: Number(x(d[0] ?? null, "srcOrd") ?? 0)
|
|
219
|
+
};
|
|
220
|
+
}).sort((a, i) => a.order - i.order).map(({ order: a, ...i }) => i);
|
|
221
|
+
}
|
|
222
|
+
function mt(t) {
|
|
223
|
+
if (fe(t, "SmartArt 节点"), !t.length || t.length > 1e3) throw new Error("SmartArt 需要 1–1000 个节点");
|
|
224
|
+
const e = /* @__PURE__ */ new Set();
|
|
225
|
+
for (const r of t) {
|
|
226
|
+
pe(r, ["id", "parentId", "text"], "SmartArt 节点");
|
|
227
|
+
const s = r;
|
|
228
|
+
if (typeof s.id != "string" || !s.id || s.id.length > 128 || e.has(s.id) || /[\u0000-\u001f\ud800-\udfff]/u.test(s.id)) throw new Error("SmartArt 节点身份无效");
|
|
229
|
+
if (e.add(s.id), s.parentId !== null && typeof s.parentId != "string") throw new Error("SmartArt 父节点身份无效");
|
|
230
|
+
if (typeof s.text != "string" || s.text.length > 32767 || /[\u0000-\u0008\u000b\u000c\u000e-\u001f\ud800-\udfff\ufffe\uffff]/u.test(s.text)) throw new Error("SmartArt 文字无效");
|
|
231
|
+
}
|
|
232
|
+
const n = t, o = new Map(n.map((r) => [r.id, r]));
|
|
233
|
+
for (const r of n) {
|
|
234
|
+
let s = r.parentId;
|
|
235
|
+
const a = /* @__PURE__ */ new Set([r.id]);
|
|
236
|
+
for (; s !== null; ) {
|
|
237
|
+
if (!e.has(s) || a.has(s) || a.size > 12) throw new Error("SmartArt 父子关系存在环、缺失或层级过深");
|
|
238
|
+
a.add(s), s = o.get(s).parentId;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return structuredClone(n);
|
|
242
|
+
}
|
|
243
|
+
const _ = (t) => {
|
|
244
|
+
const e = [...Zt(new TextEncoder().encode(t)).slice(0, 16)].map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
245
|
+
return `{${e.slice(0, 8)}-${e.slice(8, 12)}-${e.slice(12, 16)}-${e.slice(16, 20)}-${e.slice(20)}}`.toUpperCase();
|
|
246
|
+
}, z = (t, e, n = []) => {
|
|
247
|
+
const o = A(`dgm:${e}`, { attributes: [["xmlns:dgm", X], ...n] });
|
|
248
|
+
return b(t, o, $(t, "extLst")), o;
|
|
249
|
+
};
|
|
250
|
+
function we(t, e) {
|
|
251
|
+
const n = $(t, "t"), o = n ? Q(n, t) : A("dgm:t", { attributes: [["xmlns:dgm", X], ["xmlns:a", O]] }), r = n && Nt(n, O, "rPr")[0];
|
|
252
|
+
for (const s of U(o).filter((a) => a.namespaceUri === O && a.localName === "p")) K(o, s);
|
|
253
|
+
U(o).some((s) => s.localName === "bodyPr" && s.namespaceUri === O) || b(o, A("a:bodyPr", { attributes: [["xmlns:a", O]] }), o.children[0] ?? null);
|
|
254
|
+
for (const s of e.split(`
|
|
255
|
+
`)) {
|
|
256
|
+
const a = A("a:p", { attributes: [["xmlns:a", O]] }), i = A("a:r");
|
|
257
|
+
b(o, a), b(a, i), r && b(i, Q(r, i));
|
|
258
|
+
const d = A("a:t", { attributes: [["xml:space", "preserve"]] });
|
|
259
|
+
b(i, d), b(d, Kt(s));
|
|
260
|
+
}
|
|
261
|
+
n && K(t, n), b(t, o, $(t, "extLst"));
|
|
262
|
+
}
|
|
263
|
+
function ut(t, e) {
|
|
264
|
+
const n = M(t), o = n.root, r = $(o, "ptLst"), s = $(o, "cxnLst");
|
|
265
|
+
if (!r || !s) throw new Error("SmartArt 缺少点或连接列表");
|
|
266
|
+
const a = new Map(E(r, "pt").map((c) => [x(c, "modelId"), Q(c, r)])), i = new Map(dt(t).map((c) => [c.id, c.text])), d = E(r, "pt").find((c) => x(c, "type") === "doc"), h = x(d ?? null, "modelId") ?? _("document"), u = /* @__PURE__ */ new Set([h]);
|
|
267
|
+
for (const c of e) {
|
|
268
|
+
if (!a.has(c.id) && !/^\{[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}\}$/i.test(c.id) && !/^\d+$/.test(c.id)) throw new Error("新增 SmartArt 节点身份需要 GUID 或整数");
|
|
269
|
+
for (const m of [c.id, _(`parent:${c.id}`), _(`sibling:${c.id}`)]) {
|
|
270
|
+
if (u.has(m)) throw new Error("SmartArt 内容节点与过渡节点身份冲突");
|
|
271
|
+
u.add(m);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
for (const c of E(r, "pt")) c !== d && K(r, c);
|
|
275
|
+
if (!d) {
|
|
276
|
+
const c = z(r, "pt", [["modelId", h], ["type", "doc"]]);
|
|
277
|
+
z(c, "prSet"), z(c, "spPr");
|
|
278
|
+
}
|
|
279
|
+
for (const c of E(s, "cxn")) K(s, c);
|
|
280
|
+
const p = /* @__PURE__ */ new Map();
|
|
281
|
+
for (const c of e) {
|
|
282
|
+
const m = a.get(c.id), l = m ?? z(r, "pt", [["modelId", c.id]]);
|
|
283
|
+
m ? b(r, l, $(r, "extLst")) : (z(l, "prSet"), z(l, "spPr")), F(l, "type", "node"), (!m || i.get(c.id) !== c.text) && we(l, c.text);
|
|
284
|
+
const f = _(`connection:${c.id}`), y = _(`parent:${c.id}`), j = _(`sibling:${c.id}`);
|
|
285
|
+
for (const [N, I] of [[y, "parTrans"], [j, "sibTrans"]]) {
|
|
286
|
+
const g = z(r, "pt", [["modelId", N], ["type", I], ["cxnId", f]]);
|
|
287
|
+
z(g, "prSet"), z(g, "spPr");
|
|
288
|
+
}
|
|
289
|
+
const S = c.parentId ?? h, P = p.get(S) ?? 0;
|
|
290
|
+
p.set(S, P + 1), z(s, "cxn", [
|
|
291
|
+
["modelId", f],
|
|
292
|
+
["type", "parOf"],
|
|
293
|
+
["srcId", S],
|
|
294
|
+
["destId", c.id],
|
|
295
|
+
["srcOrd", String(P)],
|
|
296
|
+
["destOrd", "0"],
|
|
297
|
+
["parTransId", y],
|
|
298
|
+
["sibTransId", j]
|
|
299
|
+
]);
|
|
300
|
+
}
|
|
301
|
+
return Qt(n);
|
|
302
|
+
}
|
|
303
|
+
const xe = /[A-Za-z]|[-+]?(?:\d*\.?\d+)(?:e[-+]?\d+)?/gi;
|
|
304
|
+
function H(t, e) {
|
|
305
|
+
const n = Math.round(t * 9525);
|
|
306
|
+
if (!Number.isSafeInteger(n)) throw new Error(`自定义几何 ${e} 超出 OOXML 安全整数范围`);
|
|
307
|
+
return String(n);
|
|
308
|
+
}
|
|
309
|
+
function J(t, e, n) {
|
|
310
|
+
const o = Number(t[e]), r = Number(t[e + 1]);
|
|
311
|
+
if (!Number.isFinite(o) || !Number.isFinite(r)) throw new Error(`自定义几何 ${n} 坐标无效`);
|
|
312
|
+
return [o, r];
|
|
313
|
+
}
|
|
314
|
+
const pt = ([t, e], n) => `<a:pt x="${H(t, `${n}.x`)}" y="${H(e, `${n}.y`)}"/>`;
|
|
315
|
+
function kt(t, e) {
|
|
316
|
+
const n = Math.round(t * 180 * 6e4 / Math.PI);
|
|
317
|
+
if (!Number.isSafeInteger(n)) throw new Error(`自定义几何 ${e} 角度无效`);
|
|
318
|
+
return String(n);
|
|
319
|
+
}
|
|
320
|
+
function ye(t, e, n) {
|
|
321
|
+
if (!n) throw new Error("生成保存的自定义圆弧缺少起点");
|
|
322
|
+
let o = Math.abs(Number(t[e])), r = Math.abs(Number(t[e + 1]));
|
|
323
|
+
const s = Number(t[e + 2]), a = Number(t[e + 3]), i = Number(t[e + 4]), d = J(t, e + 5, "A");
|
|
324
|
+
if (![o, r, s, a, i].every(Number.isFinite) || a !== 0 && a !== 1 || i !== 0 && i !== 1)
|
|
325
|
+
throw new Error("自定义几何 A 参数无效");
|
|
326
|
+
if (Math.abs(s) > 1e-9) throw new Error("生成保存不支持旋转椭圆的自定义圆弧");
|
|
327
|
+
if (o === 0 || r === 0)
|
|
328
|
+
return { markup: `<a:lnTo>${pt(d, "A")}</a:lnTo>`, target: d };
|
|
329
|
+
const [h, u] = n, [p, c] = d;
|
|
330
|
+
if (h === p && u === c) return { markup: "", target: d };
|
|
331
|
+
const m = (h - p) / 2, l = (u - c) / 2, f = m * m / (o * o) + l * l / (r * r);
|
|
332
|
+
if (f > 1) {
|
|
333
|
+
const C = Math.sqrt(f);
|
|
334
|
+
o *= C, r *= C;
|
|
335
|
+
}
|
|
336
|
+
const y = o * o, j = r * r, S = y * l * l + j * m * m, P = Math.max(0, y * j - S), I = S === 0 ? 0 : (a === i ? -1 : 1) * Math.sqrt(P / S), g = (h + p) / 2 + I * (o * l / r), v = (u + c) / 2 - I * (r * m / o), W = Math.atan2((u - v) / r, (h - g) / o);
|
|
337
|
+
let k = Math.atan2((c - v) / r, (p - g) / o) - W;
|
|
338
|
+
return i === 1 && k < 0 && (k += Math.PI * 2), i === 0 && k > 0 && (k -= Math.PI * 2), {
|
|
339
|
+
markup: `<a:arcTo wR="${H(o, "A.rx")}" hR="${H(r, "A.ry")}" stAng="${kt(W, "A.start")}" swAng="${kt(k, "A.sweep")}"/>`,
|
|
340
|
+
target: d
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function be(t, e, n, o) {
|
|
344
|
+
const r = t.match(xe) ?? [], s = [];
|
|
345
|
+
let a = 0, i = null, d = null;
|
|
346
|
+
for (; a < r.length; ) {
|
|
347
|
+
const p = r[a++];
|
|
348
|
+
if (p === "Z" || p === "z") {
|
|
349
|
+
s.push("<a:close/>"), i = d;
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (p === "M" || p === "L") {
|
|
353
|
+
const c = J(r, a, p);
|
|
354
|
+
a += 2;
|
|
355
|
+
const m = p === "M" ? "moveTo" : "lnTo";
|
|
356
|
+
s.push(`<a:${m}>${pt(c, p)}</a:${m}>`), i = c, p === "M" && (d = c);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (p === "C") {
|
|
360
|
+
const c = [
|
|
361
|
+
J(r, a, "C1"),
|
|
362
|
+
J(r, a + 2, "C2"),
|
|
363
|
+
J(r, a + 4, "C3")
|
|
364
|
+
];
|
|
365
|
+
a += 6, s.push(`<a:cubicBezTo>${c.map((m, l) => pt(m, `C${l + 1}`)).join("")}</a:cubicBezTo>`), i = c[2];
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (p === "Q") {
|
|
369
|
+
const c = [J(r, a, "Q1"), J(r, a + 2, "Q2")];
|
|
370
|
+
a += 4, s.push(`<a:quadBezTo>${c.map((m, l) => pt(m, `Q${l + 1}`)).join("")}</a:quadBezTo>`), i = c[1];
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
if (p === "A") {
|
|
374
|
+
const c = ye(r, a, i);
|
|
375
|
+
a += 7, c.markup && s.push(c.markup), i = c.target;
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
throw new Error(`生成保存不支持自定义路径命令:${p}`);
|
|
379
|
+
}
|
|
380
|
+
if (!s.length) throw new Error("生成保存的自定义路径为空");
|
|
381
|
+
const h = H(e, "width"), u = H(n, "height");
|
|
382
|
+
return `<a:custGeom><a:avLst/><a:gdLst/><a:ahLst/><a:cxnLst/><a:rect l="0" t="0" r="r" b="b"/>
|
|
383
|
+
<a:pathLst><a:path w="${h}" h="${u}" fill="${o ? "none" : "norm"}" stroke="1">${s.join("")}</a:path></a:pathLst></a:custGeom>`;
|
|
384
|
+
}
|
|
385
|
+
const Ct = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """), ot = (t) => String(Math.round(t * 9525)), Xt = (t) => t.startsWith("#") ? t.slice(1) : t.match(/[\d.]+/g).slice(0, 3).map((e) => Math.round(Number(e)).toString(16).padStart(2, "0")).join(""), Rt = (t) => `<a:solidFill><a:srgbClr val="${Xt(t)}"/></a:solidFill>`;
|
|
386
|
+
function Se(t, e) {
|
|
387
|
+
const n = A("dsp:txBody", { attributes: [["xmlns:dsp", G], ["xmlns:a", O]] });
|
|
388
|
+
for (const r of t.children) b(n, r.type === "element" ? Q(r, n) : Ht(r));
|
|
389
|
+
let o = U(n).find((r) => r.namespaceUri === O && r.localName === "bodyPr");
|
|
390
|
+
return o || (o = A("a:bodyPr"), b(n, o, n.children[0] ?? null)), F(o, "anchor", "ctr"), U(n).filter((r) => r.namespaceUri === O && r.localName === "p").forEach((r, s) => {
|
|
391
|
+
let a = $(r, "pPr");
|
|
392
|
+
a || (a = A("a:pPr"), b(r, a, r.children[0] ?? null)), F(a, "algn", "ctr");
|
|
393
|
+
const i = e.paragraphs[s];
|
|
394
|
+
i && E(r).filter((d) => ["r", "fld", "br"].includes(d.localName)).forEach((d, h) => {
|
|
395
|
+
const u = i.runs[h];
|
|
396
|
+
if (!u) return;
|
|
397
|
+
let p = $(d, "rPr");
|
|
398
|
+
p || (p = A("a:rPr"), b(d, p, d.children[0] ?? null)), F(p, "sz", String(Math.round(u.size * 75))), F(p, "b", u.b ? "1" : "0"), F(p, "i", u.i ? "1" : "0");
|
|
399
|
+
const c = (m) => E(m).some((l) => l.localName.endsWith("Fill"));
|
|
400
|
+
if (!c(p) && !c($(a, "defRPr"))) {
|
|
401
|
+
const m = M(`<a:solidFill xmlns:a="${O}"><a:srgbClr val="${Xt(u.color)}"/></a:solidFill>`).root;
|
|
402
|
+
Mt(p, Q(m, p));
|
|
403
|
+
}
|
|
404
|
+
for (const [m, l] of ["latin", "ea", "cs"].entries()) {
|
|
405
|
+
if ($(p, l) || !u.fonts.length) continue;
|
|
406
|
+
const f = A(`a:${l}`, { attributes: [["typeface", u.fonts[m] ?? u.fonts[0]]] });
|
|
407
|
+
Mt(p, f);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}), n;
|
|
411
|
+
}
|
|
412
|
+
function $e(t, e, n, o) {
|
|
413
|
+
var c;
|
|
414
|
+
const r = M(t).root, s = $(r, "ptLst"), a = M(`<dsp:drawing xmlns:dsp="${G}" xmlns:a="${O}"><dsp:spTree><dsp:nvGrpSpPr><dsp:cNvPr id="0" name=""/><dsp:cNvGrpSpPr/></dsp:nvGrpSpPr><dsp:grpSpPr/></dsp:spTree></dsp:drawing>`), i = $(a.root, "spTree"), d = [], h = (m) => {
|
|
415
|
+
const l = o.filter((f) => f.parentId === m);
|
|
416
|
+
d.push(...l.map((f) => f.id));
|
|
417
|
+
for (const f of l) h(f.id);
|
|
418
|
+
};
|
|
419
|
+
for (const m of o.filter((l) => l.parentId === null)) h(m.id);
|
|
420
|
+
let u = 0, p = 0;
|
|
421
|
+
for (const [m, l] of e.entries()) {
|
|
422
|
+
if (l.kind !== "shape" || !l.path) throw new Error("SmartArt 布局输出不是原生形状");
|
|
423
|
+
const f = l.name === "SmartArt 连线" ? _(`parent:${d[p++]}`) : n[u++], y = ((c = l.fill) == null ? void 0 : c.type) === "solid" ? Rt(l.fill.color) : "<a:noFill/>", j = l.stroke ? `<a:ln w="${ot(l.stroke.width)}">${Rt(l.stroke.color)}</a:ln>` : "<a:ln><a:noFill/></a:ln>", S = M(`<dsp:sp xmlns:dsp="${G}" xmlns:a="${O}" modelId="${Ct(f)}"><dsp:nvSpPr><dsp:cNvPr id="${m + 1}" name="${Ct(l.name ?? "")}"/><dsp:cNvSpPr/></dsp:nvSpPr><dsp:spPr><a:xfrm><a:off x="${ot(l.x)}" y="${ot(l.y)}"/><a:ext cx="${ot(l.w)}" cy="${ot(l.h)}"/></a:xfrm>${be(l.path, l.w, l.h, !!l.openGeom)}${y}${j}</dsp:spPr></dsp:sp>`).root, P = E(s, "pt").find((I) => x(I, "modelId") === f), N = P && $(P, "t");
|
|
424
|
+
N && l.text && b(S, Se(N, l.text)), b(i, Q(S, i));
|
|
425
|
+
}
|
|
426
|
+
return st(a);
|
|
427
|
+
}
|
|
428
|
+
const Ne = "http://schemas.openxmlformats.org/package/2006/relationships", lt = "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing", ht = (t, e) => {
|
|
429
|
+
var n, o, r;
|
|
430
|
+
return (r = (o = (n = t.elements[e]) == null ? void 0 : n.ovr.extensions) == null ? void 0 : o.smartart) == null ? void 0 : r.value;
|
|
431
|
+
};
|
|
432
|
+
function Lt(t, e, n, o, r = !1) {
|
|
433
|
+
var p, c, m;
|
|
434
|
+
const s = new Set([...n].filter((l) => l.startsWith("ppt/diagrams/") && l.includes("/web-ppt-drawing-")));
|
|
435
|
+
for (const l of s)
|
|
436
|
+
o[l] = null, n.delete(l);
|
|
437
|
+
const a = "[Content_Types].xml";
|
|
438
|
+
let i;
|
|
439
|
+
const d = () => {
|
|
440
|
+
if (!i) {
|
|
441
|
+
i = M(o[a] ?? t.package.parts[a]);
|
|
442
|
+
for (const l of E(i.root, "Override")) s.has((x(l, "PartName") ?? "").slice(1)) && K(i.root, l);
|
|
443
|
+
}
|
|
444
|
+
return i;
|
|
445
|
+
}, h = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
446
|
+
for (const l of Object.values(t.elements)) {
|
|
447
|
+
const f = Et(t, l.id, X, "dm");
|
|
448
|
+
if (!f) continue;
|
|
449
|
+
const y = ht(t, l.id), j = !!t.saveState.baselines[f.part];
|
|
450
|
+
if (!y && !j && !r) continue;
|
|
451
|
+
let S = l.parent;
|
|
452
|
+
for (; t.elements[S]; ) S = t.elements[S].parent;
|
|
453
|
+
const P = r ? `ppt/slides/slide${t.slideOrder.indexOf(S) + 1}.xml` : f.hostPart, N = yt(P), I = R(t, N), g = h.get(N) ?? M(o[N] ?? I ?? `<Relationships xmlns="${Ne}"/>`);
|
|
454
|
+
h.set(N, g), I && !r && (e[N] ?? (e[N] = I));
|
|
455
|
+
for (const w of E(g.root, "Relationship")) {
|
|
456
|
+
const q = x(w, "Target") ?? "";
|
|
457
|
+
[...s].some((rt) => q === nt(P, rt)) && K(g.root, w);
|
|
458
|
+
}
|
|
459
|
+
if (r || (e[p = f.part] ?? (e[p] = R(t, f.part))), !y && !r) {
|
|
460
|
+
o[f.part] = e[f.part];
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
const v = y ? JSON.parse(y) : dt(f.xml), W = y ?? JSON.stringify(v), L = u.get(f.part);
|
|
464
|
+
if (L) {
|
|
465
|
+
if (L.value !== W) throw new Error("共享 SmartArt 不能设置不同结构");
|
|
466
|
+
const w = E(g.root, "Relationship").find((q) => x(q, "Id") === L.rid);
|
|
467
|
+
if (w) {
|
|
468
|
+
if (x(w, "Type") !== lt || x(w, "Target") !== nt(P, L.drawing)) throw new Error("共享 SmartArt 绘图关系身份冲突");
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
b(g.root, A("Relationship", { attributes: [["Id", L.rid], ["Type", lt], ["Target", nt(P, L.drawing)]] }));
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
const k = (w) => w ? new TextDecoder().decode(R(t, w)) : void 0, C = vt(t, f.hostPart), at = M(f.xml).root, B = E($(at, "extLst"), "ext").flatMap((w) => U(w)).find((w) => w.namespaceUri === G && w.localName === "dataModelExt"), Z = ((c = C[x(B ?? null, "relId") ?? ""]) == null ? void 0 : c.target) ?? ((m = Object.values(C).find((w) => w.type === lt)) == null ? void 0 : m.target);
|
|
475
|
+
if (!y && !Z) continue;
|
|
476
|
+
const wt = y ? ut(f.xml, v) : f.xml, At = Bt(t, l.id), Pt = Jt(wt, k(f.references.lo), k(f.references.cs), At.w, At.h, f.context), it = _(f.part).replace(/[^\da-f]/gi, "").slice(0, 12).toLowerCase();
|
|
477
|
+
let D = `ppt/diagrams/web-ppt-drawing-${it}.xml`, _t = 1;
|
|
478
|
+
for (; R(t, D) && !s.has(D); ) D = `ppt/diagrams/web-ppt-drawing-${it}-${_t++}.xml`;
|
|
479
|
+
let V = `webPptSmartArt${it}`, Gt = 1;
|
|
480
|
+
for (; E(g.root, "Relationship").some((w) => x(w, "Id") === V); ) V = `webPptSmartArt${it}_${Gt++}`;
|
|
481
|
+
b(g.root, A("Relationship", { attributes: [["Id", V], ["Type", lt], ["Target", nt(P, D)]] }));
|
|
482
|
+
const xt = M(wt);
|
|
483
|
+
let Y = $(xt.root, "extLst");
|
|
484
|
+
Y || (Y = A("dgm:extLst", { attributes: [["xmlns:dgm", X]] }), b(xt.root, Y));
|
|
485
|
+
let tt = E(Y, "ext").find((w) => x(w, "uri") === G);
|
|
486
|
+
tt || (tt = A("dgm:ext", { attributes: [["xmlns:dgm", X], ["uri", G]] }), b(Y, tt));
|
|
487
|
+
let et = U(tt).find((w) => w.namespaceUri === G && w.localName === "dataModelExt");
|
|
488
|
+
et || (et = A("dsp:dataModelExt", { attributes: [["xmlns:dsp", G]] }), b(tt, et)), F(et, "relId", V), F(et, "minVer", X);
|
|
489
|
+
const Tt = st(xt);
|
|
490
|
+
o[f.part] = Tt, o[D] = !y && Z ? R(t, Z) : $e(wt, Pt.elements, Pt.nodes, v), n.add(D);
|
|
491
|
+
const It = !y && Z ? Z : f.part, Ot = R(t, yt(It));
|
|
492
|
+
if (Ot) {
|
|
493
|
+
const w = M(Ot);
|
|
494
|
+
for (const rt of E(w.root, "Relationship")) x(rt, "TargetMode") !== "External" && F(rt, "Target", nt(D, de(It, x(rt, "Target"))));
|
|
495
|
+
const q = yt(D);
|
|
496
|
+
o[q] = st(w), n.add(q);
|
|
497
|
+
}
|
|
498
|
+
u.set(f.part, { value: W, xml: Tt, drawing: D, rid: V });
|
|
499
|
+
const Wt = d();
|
|
500
|
+
b(Wt.root, A("Override", { attributes: [["PartName", `/${D}`], ["ContentType", "application/vnd.ms-office.drawingml.diagramDrawing+xml"]] }));
|
|
501
|
+
}
|
|
502
|
+
s.size && !i && d();
|
|
503
|
+
for (const [l, f] of h) o[l] = st(f);
|
|
504
|
+
i && (o[a] = st(i));
|
|
505
|
+
}
|
|
506
|
+
const ft = "smartart", gt = (t, e) => {
|
|
507
|
+
const n = Et(t, e, X, "dm");
|
|
508
|
+
if (!n) throw new Error("对象不是 SmartArt");
|
|
509
|
+
return n;
|
|
510
|
+
};
|
|
511
|
+
function Dt(t, e) {
|
|
512
|
+
const n = ht(t, e);
|
|
513
|
+
return n ? mt(JSON.parse(n)) : dt(gt(t, e).xml);
|
|
514
|
+
}
|
|
515
|
+
function ve(t, e) {
|
|
516
|
+
if (e.path[0] !== "elements" || e.path.length !== 6 || e.path[5] !== "value") throw new Error("SmartArt 补丁路径无效");
|
|
517
|
+
const n = gt(t, e.path[1]);
|
|
518
|
+
if (e.op === "set") {
|
|
519
|
+
if (typeof e.value != "string" || e.value.length > 1e6) throw new Error("SmartArt 补丁值无效");
|
|
520
|
+
ut(n.xml, mt(JSON.parse(e.value)));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function Ee(t, e, n) {
|
|
524
|
+
if (t.meta.readonly) throw new Error("文稿只读");
|
|
525
|
+
const o = gt(t, e.id), r = ht(t, e.id);
|
|
526
|
+
let s = e.payload === null ? void 0 : JSON.stringify(mt(e.payload));
|
|
527
|
+
s === JSON.stringify(dt(o.xml)) && (s = void 0), s !== void 0 && ut(o.xml, JSON.parse(s));
|
|
528
|
+
const a = ["elements", e.id, "ovr", "extensions", ft, "value"];
|
|
529
|
+
if (r === s) return { forward: [], inverse: [] };
|
|
530
|
+
const i = (d) => d === void 0 ? { op: "del", path: a, origin: n } : { op: "set", path: a, value: d, origin: n };
|
|
531
|
+
return { forward: [i(s)], inverse: [i(r)] };
|
|
532
|
+
}
|
|
533
|
+
ge(ft, {
|
|
534
|
+
command: Ee,
|
|
535
|
+
validatePatch: ve,
|
|
536
|
+
project(t, e, n) {
|
|
537
|
+
const o = ht(t, e);
|
|
538
|
+
if (!o || n.kind !== "group") return n;
|
|
539
|
+
const r = gt(t, e), s = ut(r.xml, mt(JSON.parse(o))), a = (i) => i ? new TextDecoder().decode(R(t, i)) : void 0;
|
|
540
|
+
return { ...n, children: qt(s, a(r.references.lo), a(r.references.cs), n.w, n.h, r.context) };
|
|
541
|
+
},
|
|
542
|
+
materializePackage: Lt,
|
|
543
|
+
generateParts(t, e) {
|
|
544
|
+
const n = { ...e };
|
|
545
|
+
Lt(t, {}, /* @__PURE__ */ new Set(), n, !0);
|
|
546
|
+
for (const [o, r] of Object.entries(n))
|
|
547
|
+
r ? e[o] = r : delete e[o];
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
function Oe(t) {
|
|
551
|
+
return Object.values(t.elements).filter((e) => Et(t, e.id, X, "dm")).map((e) => ({ id: e.id, name: e.src.name ?? "SmartArt" }));
|
|
552
|
+
}
|
|
553
|
+
function Me(t) {
|
|
554
|
+
const e = (o, r) => {
|
|
555
|
+
const s = Dt(t.doc, o);
|
|
556
|
+
r(s), t.exec({ type: "Extension", namespace: ft, id: o, payload: s });
|
|
557
|
+
}, n = (o, r) => {
|
|
558
|
+
const s = o.find((a) => a.id === r);
|
|
559
|
+
if (!s) throw new Error("SmartArt 节点不存在");
|
|
560
|
+
return s;
|
|
561
|
+
};
|
|
562
|
+
return {
|
|
563
|
+
query: (o) => Dt(t.doc, o),
|
|
564
|
+
setText(o, r, s) {
|
|
565
|
+
e(o, (a) => {
|
|
566
|
+
n(a, r).text = s;
|
|
567
|
+
});
|
|
568
|
+
},
|
|
569
|
+
addNode(o, r, s, a = `{${crypto.randomUUID().toUpperCase()}}`) {
|
|
570
|
+
return e(o, (i) => {
|
|
571
|
+
i.push({ id: a, parentId: r, text: s });
|
|
572
|
+
}), a;
|
|
573
|
+
},
|
|
574
|
+
removeNode(o, r) {
|
|
575
|
+
e(o, (s) => {
|
|
576
|
+
n(s, r);
|
|
577
|
+
const a = /* @__PURE__ */ new Set([r]);
|
|
578
|
+
for (let i = !0; i; ) {
|
|
579
|
+
i = !1;
|
|
580
|
+
for (const d of s) d.parentId && a.has(d.parentId) && !a.has(d.id) && (a.add(d.id), i = !0);
|
|
581
|
+
}
|
|
582
|
+
for (let i = s.length - 1; i >= 0; i--) a.has(s[i].id) && s.splice(i, 1);
|
|
583
|
+
});
|
|
584
|
+
},
|
|
585
|
+
moveNode(o, r, s, a) {
|
|
586
|
+
e(o, (i) => {
|
|
587
|
+
const d = n(i, r);
|
|
588
|
+
if (d.parentId = s, a === r) return;
|
|
589
|
+
i.splice(i.indexOf(d), 1);
|
|
590
|
+
const h = a ? n(i, a) : void 0;
|
|
591
|
+
if (h && h.parentId !== s) throw new Error("SmartArt 排序目标不是同级节点");
|
|
592
|
+
i.splice(h ? i.indexOf(h) : i.length, 0, d);
|
|
593
|
+
});
|
|
594
|
+
},
|
|
595
|
+
reset(o) {
|
|
596
|
+
t.exec({ type: "Extension", namespace: ft, id: o, payload: null });
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
export {
|
|
601
|
+
Me as createSmartArtEditor,
|
|
602
|
+
Oe as listEditableSmartArt,
|
|
603
|
+
Dt as querySmartArt
|
|
604
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EditDoc, ElementRecord, SlideRecord } from './types';
|
|
2
|
+
export declare function insertionPackageTargets(record: ElementRecord | null): string[];
|
|
3
|
+
/** 命令、协同和恢复都在结构补丁落模前保留依赖,不能依赖本地命令的准备过程。 */
|
|
4
|
+
export declare function retainInsertionSources(doc: EditDoc, tree: {
|
|
5
|
+
records: Readonly<Record<string, ElementRecord | null>>;
|
|
6
|
+
slide?: SlideRecord;
|
|
7
|
+
}): void;
|