@univerjs-pro/engine-shape 1.0.0-beta.0 → 1.0.0-beta.1
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/facade/f-shape.d.ts +39 -1
- package/lib/types/index.d.ts +17 -3
- package/lib/types/models/shape-model.d.ts +4 -3
- package/lib/types/render-engine/shape-3d-renderer.d.ts +91 -0
- package/lib/types/services/shape-host-adapter.service.d.ts +21 -0
- package/lib/types/shape-enum.d.ts +144 -17
- package/lib/types/shape-type.d.ts +225 -2
- package/lib/types/smart-art/smart-art-color-style.d.ts +11 -0
- package/lib/types/smart-art/smart-art-enum.d.ts +59 -0
- package/lib/types/smart-art/smart-art-layout-template.d.ts +32 -0
- package/lib/types/smart-art/smart-art-layout-templates.generated.d.ts +2 -0
- package/lib/types/smart-art/smart-art-model.d.ts +46 -0
- package/lib/types/smart-art/smart-art-operation.d.ts +83 -0
- package/lib/types/smart-art/smart-art-quick-style.d.ts +12 -0
- package/lib/types/smart-art/smart-art-transform.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IFormulaLastValue } from '@univerjs-pro/engine-formula';
|
|
2
2
|
import type { HorizontalAlign, IDocumentData, IGlowEffect, IShadowEffect, VerticalAlign } from '@univerjs/core';
|
|
3
|
-
import type { BasicShapeEnum, ImageFillModeEnum, ImageSourceTypeEnum, ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeFillEnum, ShapeGradientTypeEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeOperatorEnum, ShapeRenderModeEnum, ShapeSketchTypeEnum, ShapeTypeEnum } from './shape-enum';
|
|
3
|
+
import type { BasicShapeEnum, ImageFillModeEnum, ImageSourceTypeEnum, ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeBevelPresetEnum, ShapeCameraPresetEnum, ShapeFillEnum, ShapeGradientTypeEnum, ShapeLightRigDirectionEnum, ShapeLightRigPresetEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeMaterialPresetEnum, ShapeOperatorEnum, ShapeRenderModeEnum, ShapeSketchTypeEnum, ShapeTypeEnum } from './shape-enum';
|
|
4
|
+
import type { SmartArtCategoryEnum, SmartArtDefinitionScopeEnum, SmartArtDirectionEnum, SmartArtNodeRoleEnum, SmartArtPresentationShapeRoleEnum, SmartArtPresentationTextSourceEnum, SmartArtTextFontSizeModeEnum, SmartArtTopologyPointKindEnum } from './smart-art/smart-art-enum';
|
|
4
5
|
/**
|
|
5
6
|
* GdContext 用来计算 OOXML Shape 的 Geometry Definitions (gd)
|
|
6
7
|
* 包含:
|
|
@@ -640,6 +641,10 @@ export interface IShapeTextBodyBehavior {
|
|
|
640
641
|
* OOXML normAutofit lnSpcReduction.
|
|
641
642
|
*/
|
|
642
643
|
lineSpaceReduction?: number;
|
|
644
|
+
/** DrawingML text-body camera and lighting (`a:bodyPr/a:scene3d`). */
|
|
645
|
+
scene3d?: IShapeScene3D;
|
|
646
|
+
/** DrawingML text-glyph bevel, extrusion, contour, and material (`a:bodyPr/a:sp3d`). */
|
|
647
|
+
shape3d?: IShape3D;
|
|
643
648
|
}
|
|
644
649
|
export interface IShapeText extends IShapeTextAlign, IShapeTextBodyBehavior {
|
|
645
650
|
isRichText: false;
|
|
@@ -686,6 +691,207 @@ export interface IShapeFormulaBinding {
|
|
|
686
691
|
/** Last successful scalar value persisted with the Shape for stale-first reload rendering. */
|
|
687
692
|
lastValue?: IFormulaLastValue;
|
|
688
693
|
}
|
|
694
|
+
/** Rotation in degrees corresponding to DrawingML `<a:rot lat="..." lon="..." rev="...">`. */
|
|
695
|
+
export interface IShape3DRotation {
|
|
696
|
+
latitude?: number;
|
|
697
|
+
longitude?: number;
|
|
698
|
+
revolution?: number;
|
|
699
|
+
}
|
|
700
|
+
/** Normalized 2.5D projection resolved from a built-in camera or SmartArt style. */
|
|
701
|
+
export interface IShape3DCameraProjection {
|
|
702
|
+
rotation?: IShape3DRotation;
|
|
703
|
+
verticalOffsetRatio?: number;
|
|
704
|
+
verticalScale?: number;
|
|
705
|
+
}
|
|
706
|
+
/** A point/vector in the DrawingML 3D scene coordinate system. */
|
|
707
|
+
export interface IShape3DVector {
|
|
708
|
+
x: number;
|
|
709
|
+
y: number;
|
|
710
|
+
z: number;
|
|
711
|
+
}
|
|
712
|
+
/** Shape scene corresponding to DrawingML `<a:scene3d>`. */
|
|
713
|
+
export interface IShapeScene3D {
|
|
714
|
+
camera: {
|
|
715
|
+
preset: ShapeCameraPresetEnum;
|
|
716
|
+
fieldOfView?: number;
|
|
717
|
+
zoom?: number;
|
|
718
|
+
rotation?: IShape3DRotation;
|
|
719
|
+
/** Rendering semantics kept separate from the original DrawingML camera values. */
|
|
720
|
+
projection?: IShape3DCameraProjection;
|
|
721
|
+
};
|
|
722
|
+
lightRig: {
|
|
723
|
+
preset: ShapeLightRigPresetEnum;
|
|
724
|
+
direction: ShapeLightRigDirectionEnum;
|
|
725
|
+
rotation?: IShape3DRotation;
|
|
726
|
+
};
|
|
727
|
+
backdrop?: {
|
|
728
|
+
anchor: IShape3DVector;
|
|
729
|
+
normal: IShape3DVector;
|
|
730
|
+
upVector: IShape3DVector;
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
/** Bevel corresponding to DrawingML `<a:bevelT>` or `<a:bevelB>`. */
|
|
734
|
+
export interface IShapeBevel3D {
|
|
735
|
+
width?: number;
|
|
736
|
+
height?: number;
|
|
737
|
+
preset?: ShapeBevelPresetEnum;
|
|
738
|
+
}
|
|
739
|
+
/** Shape depth/material corresponding to DrawingML `<a:sp3d>`. */
|
|
740
|
+
export interface IShape3D {
|
|
741
|
+
z?: number;
|
|
742
|
+
extrusionHeight?: number;
|
|
743
|
+
contourWidth?: number;
|
|
744
|
+
material?: ShapeMaterialPresetEnum;
|
|
745
|
+
topBevel?: IShapeBevel3D;
|
|
746
|
+
bottomBevel?: IShapeBevel3D;
|
|
747
|
+
extrusionColor?: string;
|
|
748
|
+
contourColor?: string;
|
|
749
|
+
}
|
|
750
|
+
/** Reflection corresponding to DrawingML `<a:reflection>`. */
|
|
751
|
+
export interface IShapeReflectionEffect {
|
|
752
|
+
/** Blur radius in drawing points. */
|
|
753
|
+
blurRadius?: number;
|
|
754
|
+
/** Opacity at the reflection edge nearest the source, from 0 to 1. */
|
|
755
|
+
startAlpha?: number;
|
|
756
|
+
/** Opacity at the far edge of the reflection, from 0 to 1. */
|
|
757
|
+
endAlpha?: number;
|
|
758
|
+
/** Distance between the source and its reflection. */
|
|
759
|
+
distance?: number;
|
|
760
|
+
/** Reflection direction in degrees. */
|
|
761
|
+
direction?: number;
|
|
762
|
+
/** Vertical reflection scale; 1 means 100%. */
|
|
763
|
+
scaleY?: number;
|
|
764
|
+
}
|
|
765
|
+
/** Soft edge corresponding to DrawingML `<a:softEdge>`. */
|
|
766
|
+
export interface IShapeSoftEdgeEffect {
|
|
767
|
+
radius: number;
|
|
768
|
+
}
|
|
769
|
+
export interface ISmartArtTransform {
|
|
770
|
+
left: number;
|
|
771
|
+
top: number;
|
|
772
|
+
width: number;
|
|
773
|
+
height: number;
|
|
774
|
+
rotation?: number;
|
|
775
|
+
flipX?: boolean;
|
|
776
|
+
flipY?: boolean;
|
|
777
|
+
}
|
|
778
|
+
/** Logical content node edited through the SmartArt Text Pane. */
|
|
779
|
+
export interface ISmartArtDataNode {
|
|
780
|
+
id: string;
|
|
781
|
+
parentId?: string;
|
|
782
|
+
childIds: string[];
|
|
783
|
+
role: SmartArtNodeRoleEnum;
|
|
784
|
+
text: IShapeTextData;
|
|
785
|
+
/** Automatic nodes participate in their layout font-size group; manual nodes keep explicit user sizing. */
|
|
786
|
+
fontSizeMode?: SmartArtTextFontSizeModeEnum;
|
|
787
|
+
}
|
|
788
|
+
/** Maps one rendered SmartArt text paragraph to its logical Text Pane node. */
|
|
789
|
+
export interface ISmartArtPresentationTextBinding {
|
|
790
|
+
dataNodeId: string;
|
|
791
|
+
paragraphIndex: number;
|
|
792
|
+
}
|
|
793
|
+
/** One independently selectable ordinary Shape inside the SmartArt composite. */
|
|
794
|
+
export interface ISmartArtPresentationShape {
|
|
795
|
+
id: string;
|
|
796
|
+
name?: string;
|
|
797
|
+
role: SmartArtPresentationShapeRoleEnum;
|
|
798
|
+
dataNodeIds: string[];
|
|
799
|
+
transform: ISmartArtTransform;
|
|
800
|
+
shapeData: IBasicShapeData;
|
|
801
|
+
textSource?: SmartArtPresentationTextSourceEnum;
|
|
802
|
+
textBindings?: ISmartArtPresentationTextBinding[];
|
|
803
|
+
sourcePresentationShapeId?: string;
|
|
804
|
+
targetPresentationShapeId?: string;
|
|
805
|
+
}
|
|
806
|
+
/** Layout graph point retained as normalized SmartArt semantics, including non-content transition points. */
|
|
807
|
+
export interface ISmartArtTopologyPoint {
|
|
808
|
+
id: string;
|
|
809
|
+
kind: SmartArtTopologyPointKindEnum;
|
|
810
|
+
connectionId?: string;
|
|
811
|
+
properties: Record<string, string>;
|
|
812
|
+
layoutVariableOrder: string[];
|
|
813
|
+
layoutVariables: Record<string, Record<string, string>>;
|
|
814
|
+
propertyProgram?: ISmartArtDefinitionInstruction;
|
|
815
|
+
}
|
|
816
|
+
/** Directed relation in the complete layout graph. An omitted kind is a logical parent-child relation. */
|
|
817
|
+
export interface ISmartArtTopologyConnection {
|
|
818
|
+
id: string;
|
|
819
|
+
kind?: string;
|
|
820
|
+
sourceId: string;
|
|
821
|
+
destinationId: string;
|
|
822
|
+
sourceOrder: number;
|
|
823
|
+
destinationOrder: number;
|
|
824
|
+
presentationId?: string;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Complete semantic layout graph used by layout engines and exchange adapters.
|
|
828
|
+
* It is intentionally independent from XML nodes and includes transition/presentation points hidden by the Text Pane.
|
|
829
|
+
*/
|
|
830
|
+
export interface ISmartArtTopology {
|
|
831
|
+
pointOrder: string[];
|
|
832
|
+
points: Record<string, ISmartArtTopologyPoint>;
|
|
833
|
+
connectionOrder: string[];
|
|
834
|
+
connections: Record<string, ISmartArtTopologyConnection>;
|
|
835
|
+
}
|
|
836
|
+
export interface ISmartArtDefinitionParameter {
|
|
837
|
+
name: string;
|
|
838
|
+
scope?: SmartArtDefinitionScopeEnum;
|
|
839
|
+
value: string;
|
|
840
|
+
}
|
|
841
|
+
/** Namespace-neutral instruction in a SmartArt layout, quick-style, or color program. */
|
|
842
|
+
export interface ISmartArtDefinitionInstruction {
|
|
843
|
+
operation: string;
|
|
844
|
+
scope: SmartArtDefinitionScopeEnum;
|
|
845
|
+
parameters: ISmartArtDefinitionParameter[];
|
|
846
|
+
text?: string;
|
|
847
|
+
children: ISmartArtDefinitionInstruction[];
|
|
848
|
+
}
|
|
849
|
+
/** Univer semantic programs used both by the layout engine and OOXML adapters. */
|
|
850
|
+
export interface ISmartArtDefinitions {
|
|
851
|
+
layout?: ISmartArtDefinitionInstruction;
|
|
852
|
+
quickStyle?: ISmartArtDefinitionInstruction;
|
|
853
|
+
colorStyle?: ISmartArtDefinitionInstruction;
|
|
854
|
+
}
|
|
855
|
+
/** Structural edit limits normalized from the SmartArt layout definition (for example `chMax` and assistant branches). */
|
|
856
|
+
export interface ISmartArtEditCapabilities {
|
|
857
|
+
/** One-based depth. Omit when the layout accepts an arbitrary number of hierarchy levels. */
|
|
858
|
+
maxDepth?: number;
|
|
859
|
+
supportsAddAfter?: boolean;
|
|
860
|
+
supportsAssistant: boolean;
|
|
861
|
+
}
|
|
862
|
+
/** Univer's normalized SmartArt model. OOXML parts are mapped to and from this structure by exchange adapters. */
|
|
863
|
+
export interface ISmartArtData {
|
|
864
|
+
version: 1;
|
|
865
|
+
/** Stable layout coordinate space used to scale presentation Shapes with the outer SmartArt frame. */
|
|
866
|
+
viewport?: {
|
|
867
|
+
width: number;
|
|
868
|
+
height: number;
|
|
869
|
+
};
|
|
870
|
+
layout: {
|
|
871
|
+
id: string;
|
|
872
|
+
category: SmartArtCategoryEnum;
|
|
873
|
+
editCapabilities?: ISmartArtEditCapabilities;
|
|
874
|
+
};
|
|
875
|
+
style: {
|
|
876
|
+
quickStyleId?: string;
|
|
877
|
+
colorStyleId?: string;
|
|
878
|
+
};
|
|
879
|
+
direction: SmartArtDirectionEnum;
|
|
880
|
+
rootNodeIds: string[];
|
|
881
|
+
nodes: Record<string, ISmartArtDataNode>;
|
|
882
|
+
presentationShapeOrder: string[];
|
|
883
|
+
presentationShapes: Record<string, ISmartArtPresentationShape>;
|
|
884
|
+
topology?: ISmartArtTopology;
|
|
885
|
+
definitions?: ISmartArtDefinitions;
|
|
886
|
+
/** Imported data-model program retained for lossless OOXML round trips and GUID-stable text edits. */
|
|
887
|
+
dataProgram?: ISmartArtDefinitionInstruction;
|
|
888
|
+
/** The logical node text changed and must be synchronized into dataProgram during export. */
|
|
889
|
+
dataProgramTextDirty?: boolean;
|
|
890
|
+
/** The logical node tree changed and must be synchronized into dataProgram during export. */
|
|
891
|
+
dataProgramStructureDirty?: boolean;
|
|
892
|
+
/** Compiled presentation cache. Structural or presentation-Shape edits must invalidate it. */
|
|
893
|
+
presentationProgram?: ISmartArtDefinitionInstruction;
|
|
894
|
+
}
|
|
689
895
|
/**
|
|
690
896
|
* This interface defines the shape data structure , and this part will save in json
|
|
691
897
|
*/
|
|
@@ -758,6 +964,14 @@ export interface IBasicShapeData {
|
|
|
758
964
|
outerShadow?: IShadowEffect;
|
|
759
965
|
/** Glow applied around the rendered shape path. */
|
|
760
966
|
glow?: IGlowEffect;
|
|
967
|
+
/** Mirrored copy rendered behind the shape. */
|
|
968
|
+
reflection?: IShapeReflectionEffect;
|
|
969
|
+
/** Alpha-edge feathering radius. */
|
|
970
|
+
softEdge?: IShapeSoftEdgeEffect;
|
|
971
|
+
/** DrawingML scene camera, lighting, and backdrop (`a:scene3d`). */
|
|
972
|
+
scene3d?: IShapeScene3D;
|
|
973
|
+
/** DrawingML extrusion, bevel, contour, and material (`a:sp3d`). */
|
|
974
|
+
shape3d?: IShape3D;
|
|
761
975
|
shapeText?: IShapeTextData;
|
|
762
976
|
/**
|
|
763
977
|
* Text box inset used to calculate the editable/rendered text rect.
|
|
@@ -767,6 +981,11 @@ export interface IBasicShapeData {
|
|
|
767
981
|
/** Presence of this field identifies a formula shape. */
|
|
768
982
|
formulaBinding?: IShapeFormulaBinding;
|
|
769
983
|
}
|
|
984
|
+
/** SmartArt persists as one composite Shape while its presentation Shapes remain independently editable subentities. */
|
|
985
|
+
export interface ISmartArtShapeData extends IBasicShapeData {
|
|
986
|
+
shapeType: ShapeTypeEnum.SmartArt;
|
|
987
|
+
smartArt: ISmartArtData;
|
|
988
|
+
}
|
|
770
989
|
export interface ICxnShapeData extends IBasicShapeData {
|
|
771
990
|
points?: Array<{
|
|
772
991
|
x: number;
|
|
@@ -788,7 +1007,7 @@ export interface IGroupShapeData {
|
|
|
788
1007
|
childShapeIds: string[];
|
|
789
1008
|
shapeData?: Record<string, IShapeData>;
|
|
790
1009
|
}
|
|
791
|
-
export type IShapeData = IBasicShapeData | ICxnShapeData;
|
|
1010
|
+
export type IShapeData = IBasicShapeData | ICxnShapeData | ISmartArtShapeData;
|
|
792
1011
|
export interface IShapeJSONData {
|
|
793
1012
|
id: string;
|
|
794
1013
|
name?: string;
|
|
@@ -926,6 +1145,10 @@ export interface IShapeRenderParameters {
|
|
|
926
1145
|
angle?: number;
|
|
927
1146
|
oKey: string;
|
|
928
1147
|
image?: HTMLImageElement;
|
|
1148
|
+
/** Loaded picture fills keyed by SmartArt presentation Shape id. */
|
|
1149
|
+
smartArtImages?: ReadonlyMap<string, HTMLImageElement>;
|
|
1150
|
+
/** SmartArt owns one shared camera; child shapes keep scene lighting without re-projecting themselves. */
|
|
1151
|
+
skipShape3DCameraTransform?: boolean;
|
|
929
1152
|
}
|
|
930
1153
|
export interface IShapeRelationItem {
|
|
931
1154
|
shapeId: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ISmartArtData } from '../shape-type';
|
|
2
|
+
export type SmartArtColorStyleSection = 'theme' | 'colorful' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6';
|
|
3
|
+
export interface ISmartArtColorStyleCatalogItem {
|
|
4
|
+
id: string;
|
|
5
|
+
key: string;
|
|
6
|
+
section: SmartArtColorStyleSection;
|
|
7
|
+
colors: readonly string[];
|
|
8
|
+
variant: 'outline' | 'fill' | 'gradient' | 'cycle' | 'transparent';
|
|
9
|
+
}
|
|
10
|
+
export declare const SMART_ART_COLOR_STYLE_CATALOG: readonly ISmartArtColorStyleCatalogItem[];
|
|
11
|
+
export declare function applySmartArtColorStyle(data: ISmartArtData, colorStyleId: string): ISmartArtData;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare enum SmartArtCategoryEnum {
|
|
2
|
+
All = "all",
|
|
3
|
+
List = "list",
|
|
4
|
+
Process = "process",
|
|
5
|
+
Cycle = "cycle",
|
|
6
|
+
Hierarchy = "hierarchy",
|
|
7
|
+
Relationship = "relationship",
|
|
8
|
+
Matrix = "matrix",
|
|
9
|
+
Pyramid = "pyramid",
|
|
10
|
+
Picture = "picture",
|
|
11
|
+
Timeline = "timeline",
|
|
12
|
+
Team = "team",
|
|
13
|
+
TextCard = "textCard"
|
|
14
|
+
}
|
|
15
|
+
export declare enum SmartArtDirectionEnum {
|
|
16
|
+
LeftToRight = "leftToRight",
|
|
17
|
+
RightToLeft = "rightToLeft"
|
|
18
|
+
}
|
|
19
|
+
export declare enum SmartArtNodeRoleEnum {
|
|
20
|
+
Content = "content",
|
|
21
|
+
Assistant = "assistant"
|
|
22
|
+
}
|
|
23
|
+
export declare enum SmartArtTextFontSizeModeEnum {
|
|
24
|
+
Auto = "auto",
|
|
25
|
+
Manual = "manual"
|
|
26
|
+
}
|
|
27
|
+
export declare enum SmartArtPresentationShapeRoleEnum {
|
|
28
|
+
Node = "node",
|
|
29
|
+
Connector = "connector",
|
|
30
|
+
Background = "background",
|
|
31
|
+
Decoration = "decoration",
|
|
32
|
+
Image = "image",
|
|
33
|
+
Text = "text"
|
|
34
|
+
}
|
|
35
|
+
export declare enum SmartArtPresentationTextSourceEnum {
|
|
36
|
+
DataNode = "dataNode",
|
|
37
|
+
Presentation = "presentation"
|
|
38
|
+
}
|
|
39
|
+
export declare enum SmartArtTopologyPointKindEnum {
|
|
40
|
+
Document = "document",
|
|
41
|
+
Content = "content",
|
|
42
|
+
Assistant = "assistant",
|
|
43
|
+
ParentTransition = "parentTransition",
|
|
44
|
+
SiblingTransition = "siblingTransition",
|
|
45
|
+
Presentation = "presentation"
|
|
46
|
+
}
|
|
47
|
+
export declare enum SmartArtDefinitionScopeEnum {
|
|
48
|
+
Diagram = "diagram",
|
|
49
|
+
DiagramDrawing = "diagramDrawing",
|
|
50
|
+
Drawing = "drawing",
|
|
51
|
+
Relationships = "relationships"
|
|
52
|
+
}
|
|
53
|
+
export declare enum SmartArtInsertPositionEnum {
|
|
54
|
+
Before = "before",
|
|
55
|
+
After = "after",
|
|
56
|
+
Above = "above",
|
|
57
|
+
Below = "below",
|
|
58
|
+
Assistant = "assistant"
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ShapeTypeEnum } from '../shape-enum';
|
|
2
|
+
import type { IBasicShapeData, IShapeTextData, ISmartArtData, ISmartArtTransform } from '../shape-type';
|
|
3
|
+
import type { SmartArtCategoryEnum, SmartArtNodeRoleEnum, SmartArtPresentationShapeRoleEnum } from './smart-art-enum';
|
|
4
|
+
import { SmartArtDirectionEnum, SmartArtPresentationTextSourceEnum } from './smart-art-enum';
|
|
5
|
+
export interface ISmartArtLayoutTemplate {
|
|
6
|
+
layout: {
|
|
7
|
+
id: string;
|
|
8
|
+
category: SmartArtCategoryEnum;
|
|
9
|
+
};
|
|
10
|
+
direction: SmartArtDirectionEnum;
|
|
11
|
+
supportsAddAfter?: boolean;
|
|
12
|
+
nodes: Array<{
|
|
13
|
+
parentIndex: number;
|
|
14
|
+
role: SmartArtNodeRoleEnum;
|
|
15
|
+
}>;
|
|
16
|
+
presentationShapes: Array<{
|
|
17
|
+
role: SmartArtPresentationShapeRoleEnum;
|
|
18
|
+
nodeIndexes: number[];
|
|
19
|
+
textNodeIndexes?: number[];
|
|
20
|
+
transform: ISmartArtTransform;
|
|
21
|
+
shapeType: ShapeTypeEnum;
|
|
22
|
+
shapeData?: IBasicShapeData;
|
|
23
|
+
shapeText?: IShapeTextData;
|
|
24
|
+
textSource?: SmartArtPresentationTextSourceEnum;
|
|
25
|
+
}>;
|
|
26
|
+
variants?: Array<Pick<ISmartArtLayoutTemplate, 'nodes' | 'presentationShapes'>>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createSmartArtDataFromLayout(layoutId: string): ISmartArtData | null;
|
|
29
|
+
export declare function applySmartArtLayout(data: ISmartArtData, layoutId: string, options?: {
|
|
30
|
+
preservePresentationStyles?: boolean;
|
|
31
|
+
}): ISmartArtData;
|
|
32
|
+
export declare function reflowSmartArtDataToMatchingTemplate(data: ISmartArtData): ISmartArtData;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IBasicShapeData, IShapeData, IShapeTextData, ISmartArtData, ISmartArtDataNode, ISmartArtPresentationShape, ISmartArtPresentationTextBinding, ISmartArtShapeData } from '../shape-type';
|
|
2
|
+
import type { SmartArtCategoryEnum, SmartArtDirectionEnum } from './smart-art-enum';
|
|
3
|
+
import { SmartArtInsertPositionEnum, SmartArtPresentationShapeRoleEnum, SmartArtTextFontSizeModeEnum } from './smart-art-enum';
|
|
4
|
+
export interface IInsertSmartArtNodeOptions {
|
|
5
|
+
node: ISmartArtDataNode;
|
|
6
|
+
targetNodeId?: string;
|
|
7
|
+
position: SmartArtInsertPositionEnum;
|
|
8
|
+
}
|
|
9
|
+
export interface IMoveSmartArtNodeOptions {
|
|
10
|
+
nodeId: string;
|
|
11
|
+
targetNodeId: string;
|
|
12
|
+
position: Exclude<SmartArtInsertPositionEnum, SmartArtInsertPositionEnum.Assistant>;
|
|
13
|
+
}
|
|
14
|
+
export interface IUpdateSmartArtPresentationTextOptions {
|
|
15
|
+
fontSizeMode?: SmartArtTextFontSizeModeEnum;
|
|
16
|
+
fontSizeNodeId?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IConvertedSmartArtShape {
|
|
19
|
+
id: string;
|
|
20
|
+
transform: ISmartArtPresentationShape['transform'];
|
|
21
|
+
shapeData: ISmartArtPresentationShape['shapeData'];
|
|
22
|
+
}
|
|
23
|
+
export declare function isSmartArtShapeData(shapeData: IShapeData): shapeData is ISmartArtShapeData;
|
|
24
|
+
export declare function insertSmartArtNode(data: ISmartArtData, options: IInsertSmartArtNodeOptions): ISmartArtData;
|
|
25
|
+
export declare function deleteSmartArtNode(data: ISmartArtData, nodeId: string): ISmartArtData;
|
|
26
|
+
export declare function moveSmartArtNode(data: ISmartArtData, options: IMoveSmartArtNodeOptions): ISmartArtData;
|
|
27
|
+
export declare function promoteSmartArtNode(data: ISmartArtData, nodeId: string): ISmartArtData;
|
|
28
|
+
export declare function demoteSmartArtNode(data: ISmartArtData, nodeId: string): ISmartArtData;
|
|
29
|
+
export declare function updateSmartArtNode(data: ISmartArtData, nodeId: string, update: Partial<Pick<ISmartArtDataNode, 'fontSizeMode' | 'role' | 'text'>>): ISmartArtData;
|
|
30
|
+
export declare function readSmartArtTextContent(text: IShapeTextData): string;
|
|
31
|
+
export declare function resolveSmartArtPresentationTextBindings(data: ISmartArtData, presentationShapeId: string): ISmartArtPresentationTextBinding[];
|
|
32
|
+
export declare function resolveSmartArtPresentationShapeIdForNode(data: ISmartArtData, nodeId: string, preferredRole?: SmartArtPresentationShapeRoleEnum): string | undefined;
|
|
33
|
+
/** Resolves a character offset in a rendered presentation text Shape back to its logical Text Pane node. */
|
|
34
|
+
export declare function resolveSmartArtPresentationNodeIdAtTextOffset(data: ISmartArtData, presentationShapeId: string, textOffset: number): string | undefined;
|
|
35
|
+
export declare function updateSmartArtPresentationText(data: ISmartArtData, presentationShapeId: string, shapeText: IShapeTextData, options?: IUpdateSmartArtPresentationTextOptions): ISmartArtData;
|
|
36
|
+
export declare function resetSmartArtTextFontSizes(data: ISmartArtData): ISmartArtData;
|
|
37
|
+
export declare function replaceSmartArtTextContent(previous: IShapeTextData, nextText: string, documentId?: string): IShapeTextData;
|
|
38
|
+
export declare function setSmartArtDirection(data: ISmartArtData, direction: SmartArtDirectionEnum): ISmartArtData;
|
|
39
|
+
export declare function setSmartArtLayout(data: ISmartArtData, layout: {
|
|
40
|
+
id: string;
|
|
41
|
+
category: SmartArtCategoryEnum;
|
|
42
|
+
}): ISmartArtData;
|
|
43
|
+
export declare function updateSmartArtPresentationShape(data: ISmartArtData, presentationShapeId: string, update: Partial<Pick<ISmartArtPresentationShape, 'shapeData' | 'transform'>>): ISmartArtData;
|
|
44
|
+
export declare function resolveSmartArtPresentationShapeData(data: ISmartArtData, presentationShapeId: string, textScale?: number): IBasicShapeData | null;
|
|
45
|
+
export declare function convertSmartArtToShapes(data: ISmartArtData): IConvertedSmartArtShape[];
|
|
46
|
+
export declare function validateSmartArtData(data: ISmartArtData): string[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { IShapeTextData, ISmartArtData, ISmartArtDataNode, ISmartArtPresentationShape } from '../shape-type';
|
|
2
|
+
import type { SmartArtDirectionEnum } from './smart-art-enum';
|
|
3
|
+
import { SmartArtInsertPositionEnum } from './smart-art-enum';
|
|
4
|
+
export declare enum SmartArtOperationTypeEnum {
|
|
5
|
+
Replace = "replace",
|
|
6
|
+
InsertNode = "insertNode",
|
|
7
|
+
DeleteNode = "deleteNode",
|
|
8
|
+
MoveNode = "moveNode",
|
|
9
|
+
PromoteNode = "promoteNode",
|
|
10
|
+
DemoteNode = "demoteNode",
|
|
11
|
+
UpdateNode = "updateNode",
|
|
12
|
+
UpdateNodeText = "updateNodeText",
|
|
13
|
+
UpdatePresentationShape = "updatePresentationShape",
|
|
14
|
+
UpdatePresentationText = "updatePresentationText",
|
|
15
|
+
ReplacePresentationImage = "replacePresentationImage",
|
|
16
|
+
SetDirection = "setDirection",
|
|
17
|
+
SetLayout = "setLayout",
|
|
18
|
+
SetQuickStyle = "setQuickStyle",
|
|
19
|
+
SetColorStyle = "setColorStyle",
|
|
20
|
+
Reset = "reset"
|
|
21
|
+
}
|
|
22
|
+
export type SmartArtOperation = {
|
|
23
|
+
type: SmartArtOperationTypeEnum.Replace;
|
|
24
|
+
data: ISmartArtData;
|
|
25
|
+
} | {
|
|
26
|
+
type: SmartArtOperationTypeEnum.InsertNode;
|
|
27
|
+
nodeId: string;
|
|
28
|
+
node?: ISmartArtDataNode;
|
|
29
|
+
targetNodeId?: string;
|
|
30
|
+
position: SmartArtInsertPositionEnum;
|
|
31
|
+
} | {
|
|
32
|
+
type: SmartArtOperationTypeEnum.DeleteNode;
|
|
33
|
+
nodeId: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: SmartArtOperationTypeEnum.MoveNode;
|
|
36
|
+
nodeId: string;
|
|
37
|
+
targetNodeId: string;
|
|
38
|
+
position: Exclude<SmartArtInsertPositionEnum, SmartArtInsertPositionEnum.Assistant>;
|
|
39
|
+
} | {
|
|
40
|
+
type: SmartArtOperationTypeEnum.PromoteNode;
|
|
41
|
+
nodeId: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: SmartArtOperationTypeEnum.DemoteNode;
|
|
44
|
+
nodeId: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: SmartArtOperationTypeEnum.UpdateNode;
|
|
47
|
+
nodeId: string;
|
|
48
|
+
update: Partial<Pick<ISmartArtDataNode, 'fontSizeMode' | 'role' | 'text'>>;
|
|
49
|
+
} | {
|
|
50
|
+
type: SmartArtOperationTypeEnum.UpdateNodeText;
|
|
51
|
+
nodeId: string;
|
|
52
|
+
text: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: SmartArtOperationTypeEnum.UpdatePresentationShape;
|
|
55
|
+
presentationShapeId: string;
|
|
56
|
+
update: Partial<Pick<ISmartArtPresentationShape, 'shapeData' | 'transform'>>;
|
|
57
|
+
} | {
|
|
58
|
+
type: SmartArtOperationTypeEnum.UpdatePresentationText;
|
|
59
|
+
presentationShapeId: string;
|
|
60
|
+
shapeText: IShapeTextData;
|
|
61
|
+
fontSizeChanged?: boolean;
|
|
62
|
+
fontSizeNodeId?: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: SmartArtOperationTypeEnum.ReplacePresentationImage;
|
|
65
|
+
presentationShapeId: string;
|
|
66
|
+
source: string;
|
|
67
|
+
sourceType: NonNullable<ISmartArtPresentationShape['shapeData']['fill']>['fillImageSourceType'];
|
|
68
|
+
} | {
|
|
69
|
+
type: SmartArtOperationTypeEnum.SetDirection;
|
|
70
|
+
direction: SmartArtDirectionEnum;
|
|
71
|
+
} | {
|
|
72
|
+
type: SmartArtOperationTypeEnum.SetLayout;
|
|
73
|
+
layoutId: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: SmartArtOperationTypeEnum.SetQuickStyle;
|
|
76
|
+
quickStyleId: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: SmartArtOperationTypeEnum.SetColorStyle;
|
|
79
|
+
colorStyleId: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: SmartArtOperationTypeEnum.Reset;
|
|
82
|
+
};
|
|
83
|
+
export declare function applySmartArtOperation(data: ISmartArtData, operation: SmartArtOperation): ISmartArtData;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IBasicShapeData, ISmartArtData } from '../shape-type';
|
|
2
|
+
import { SmartArtPresentationShapeRoleEnum } from './smart-art-enum';
|
|
3
|
+
export type SmartArtQuickStyleSection = 'bestMatch' | 'threeDimensional';
|
|
4
|
+
export interface ISmartArtQuickStyleCatalogItem {
|
|
5
|
+
id: string;
|
|
6
|
+
key: string;
|
|
7
|
+
section: SmartArtQuickStyleSection;
|
|
8
|
+
preview: 'flat' | 'outline' | 'subtle' | 'moderate' | 'intense' | 'bevel' | 'inset' | 'cartoon' | 'powder' | 'brick' | 'flatScene' | 'metal' | 'sunset' | 'birdEye';
|
|
9
|
+
}
|
|
10
|
+
export declare const SMART_ART_QUICK_STYLE_CATALOG: readonly ISmartArtQuickStyleCatalogItem[];
|
|
11
|
+
export declare function resolveSmartArtQuickStyle3DShapeData(shapeData: IBasicShapeData, role: SmartArtPresentationShapeRoleEnum, quickStyleId?: string): IBasicShapeData;
|
|
12
|
+
export declare function applySmartArtQuickStyle(data: ISmartArtData, quickStyleId: string): ISmartArtData;
|