@univerjs-pro/engine-shape 1.0.0-beta.0 → 1.0.0-beta.2
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-text.d.ts +13 -4
- package/lib/types/facade/f-shape.d.ts +39 -1
- package/lib/types/index.d.ts +18 -4
- 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-default.d.ts +11 -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/types/util/shape-util.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
|
@@ -81,11 +81,19 @@ export declare class FShapeText {
|
|
|
81
81
|
constructor(_shapeRef: IShapeRef, _injector: Injector);
|
|
82
82
|
/**
|
|
83
83
|
* Returns the Shape text as a detached rich-text value.
|
|
84
|
+
*
|
|
85
|
+
* To edit existing Shape text, call `copy()` on the returned value, change the builder, and pass it to
|
|
86
|
+
* `setRichText()` to persist the result.
|
|
87
|
+
*
|
|
84
88
|
* @returns {RichTextValue | null} A rich-text value, or `null` when the Shape has no text.
|
|
85
89
|
* @example
|
|
86
90
|
* ```ts
|
|
87
|
-
* const richText = fShapeText.getRichText();
|
|
88
|
-
*
|
|
91
|
+
* const richText = fShapeText.getRichText()?.copy();
|
|
92
|
+
* const [link] = richText?.getLinks() ?? [];
|
|
93
|
+
* if (richText && link) {
|
|
94
|
+
* richText.updateLink(link.rangeId, 'https://univer.ai/docs');
|
|
95
|
+
* fShapeText.setRichText(richText);
|
|
96
|
+
* }
|
|
89
97
|
* ```
|
|
90
98
|
*/
|
|
91
99
|
getRichText(): RichTextValue | null;
|
|
@@ -104,8 +112,9 @@ export declare class FShapeText {
|
|
|
104
112
|
* @example
|
|
105
113
|
* ```ts
|
|
106
114
|
* const richText = univerAPI.newRichText()
|
|
107
|
-
* .text('
|
|
108
|
-
* .
|
|
115
|
+
* .text('Read ')
|
|
116
|
+
* .link('Univer documentation', 'https://docs.univer.ai')
|
|
117
|
+
* .text(' for details.');
|
|
109
118
|
* fShapeText.setRichText(richText);
|
|
110
119
|
* ```
|
|
111
120
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IBasicShapeData, ImageSourceTypeEnum, IPresetShapeConfig, IShapeAdjustItemResolved, IShapeData, IShapeHostAdapter, IShapeLineStyle, IShapePath, IShapeRef, IShapeRelationItem, IShapeSnapshot, IShapeTransform, IShapeUpdateInput, ShapeGradientTypeEnum, ShapeHostType, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
|
|
1
|
+
import type { IBasicShapeData, IInsertSmartArtNodeOptions, ImageSourceTypeEnum, IMoveSmartArtNodeOptions, IPresetShapeConfig, IShapeAdjustItemResolved, IShapeData, IShapeHostAdapter, IShapeLineStyle, IShapePath, IShapeRef, IShapeRelationItem, IShapeSnapshot, IShapeTransform, IShapeUpdateInput, ISmartArtData, ISmartArtDataNode, ISmartArtPresentationShape, ShapeGradientTypeEnum, ShapeHostType, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeTypeEnum, SmartArtDirectionEnum } from '@univerjs-pro/engine-shape';
|
|
2
2
|
import type { Injector } from '@univerjs/core';
|
|
3
3
|
import { IShapeHostAdapterRegistry, ShapeLineTypeEnum } from '@univerjs-pro/engine-shape';
|
|
4
4
|
import { ICommandService } from '@univerjs/core';
|
|
@@ -201,6 +201,32 @@ export declare class FShape extends FBase {
|
|
|
201
201
|
* ```
|
|
202
202
|
*/
|
|
203
203
|
getShapeData(): IShapeData | null;
|
|
204
|
+
/** Returns whether this Shape is a SmartArt composite. */
|
|
205
|
+
isSmartArt(): boolean;
|
|
206
|
+
/** Returns a detached copy of the normalized SmartArt structure. */
|
|
207
|
+
getSmartArtData(): ISmartArtData | null;
|
|
208
|
+
/** Replaces the complete normalized SmartArt structure through the host Shape command. */
|
|
209
|
+
setSmartArtData(data: ISmartArtData): this;
|
|
210
|
+
/** Inserts one logical node into the SmartArt tree. */
|
|
211
|
+
insertSmartArtNode(options: IInsertSmartArtNodeOptions): this;
|
|
212
|
+
/** Deletes a logical SmartArt node and its subtree. */
|
|
213
|
+
deleteSmartArtNode(nodeId: string): this;
|
|
214
|
+
/** Moves a logical SmartArt node without changing its stable identity. */
|
|
215
|
+
moveSmartArtNode(options: IMoveSmartArtNodeOptions): this;
|
|
216
|
+
/** Promotes a logical SmartArt node by one hierarchy level. */
|
|
217
|
+
promoteSmartArtNode(nodeId: string): this;
|
|
218
|
+
/** Demotes a logical SmartArt node below its preceding sibling. */
|
|
219
|
+
demoteSmartArtNode(nodeId: string): this;
|
|
220
|
+
/** Updates Text Pane content or the assistant/content role of one logical node. */
|
|
221
|
+
updateSmartArtNode(nodeId: string, update: Partial<Pick<ISmartArtDataNode, 'fontSizeMode' | 'role' | 'text'>>): this;
|
|
222
|
+
/** Sets the SmartArt left-to-right or right-to-left direction. */
|
|
223
|
+
setSmartArtDirection(direction: SmartArtDirectionEnum): this;
|
|
224
|
+
/** Switches the SmartArt layout while retaining the logical content tree. */
|
|
225
|
+
setSmartArtLayout(id: string): this;
|
|
226
|
+
/** Updates one independently editable presentation Shape inside the SmartArt composite. */
|
|
227
|
+
updateSmartArtPresentationShape(presentationShapeId: string, update: Partial<Pick<ISmartArtPresentationShape, 'shapeData' | 'transform'>>): this;
|
|
228
|
+
/** Converts SmartArt to host-native ordinary Shapes while preserving one undo step. */
|
|
229
|
+
convertSmartArtToShapes(): FShape[];
|
|
204
230
|
/**
|
|
205
231
|
* Returns a detached snapshot of the Shape and its host identity.
|
|
206
232
|
* @returns {IShapeSnapshot | null} A detached snapshot of the Shape and its host identity, or `null` when the Shape is unavailable.
|
|
@@ -731,8 +757,20 @@ export declare class FShape extends FBase {
|
|
|
731
757
|
* ```
|
|
732
758
|
*/
|
|
733
759
|
sendToBack(): this;
|
|
760
|
+
/**
|
|
761
|
+
* Moves the Shape to a zero-based index in its host's persisted drawing order.
|
|
762
|
+
* The host clamps an out-of-range index to its nearest valid position.
|
|
763
|
+
* @param {number} index The zero-based target order index.
|
|
764
|
+
* @returns {FShape} This Shape facade for chaining.
|
|
765
|
+
* @example
|
|
766
|
+
* ```ts
|
|
767
|
+
* fShape.setZOrder(2);
|
|
768
|
+
* ```
|
|
769
|
+
*/
|
|
770
|
+
setZOrder(index: number): this;
|
|
734
771
|
protected _getAdapter(): IShapeHostAdapter | null;
|
|
735
772
|
private _patchShapeData;
|
|
773
|
+
private _updateSmartArt;
|
|
736
774
|
private _patchStroke;
|
|
737
775
|
private _getSnapshot;
|
|
738
776
|
private _getGeometryModel;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
export { BasicShapeModel as ShapeModel } from '../src/models/shape-model';
|
|
2
2
|
export { BaseShapeRenderModel } from '../src/render-engine/shape-render-model';
|
|
3
|
-
export { ImageFillModeEnum, ImageSourceTypeEnum, ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeFillEnum, ShapeGradientTypeEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeOperatorEnum, ShapePresetShadowValEnum, ShapeRenderModeEnum, ShapeSketchTypeEnum, ShapeTypeEnum, } from '../src/shape-enum';
|
|
4
|
-
export type { IBasicShapeData, IConnectorLayoutResult, IConnectPointInfo, ICustomShapeTextData, ICxnShapeData, IDrawingRect, IGdContext, ILineType, IPathCommand, IPresetShapeConfig, IShapeAdjustItemResolved, IShapeData, IShapeFormulaBinding, IShapeJSONData, IShapeLineStyle, IShapePath, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeText, IShapeTextBodyBehavior, IShapeTextBoxOptions, IShapeTextData, IShapeTextDataModel, IShapeTextRectPadding, ShapeTextHorizontalAnchor, } from '../src/shape-type';
|
|
3
|
+
export { ImageFillModeEnum, ImageSourceTypeEnum, ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeBevelPresetEnum, ShapeCameraPresetEnum, ShapeFillEnum, ShapeGradientTypeEnum, ShapeLightRigDirectionEnum, ShapeLightRigPresetEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeMaterialPresetEnum, ShapeOperatorEnum, ShapePresetShadowValEnum, ShapeRenderModeEnum, ShapeSketchTypeEnum, ShapeTypeEnum, } from '../src/shape-enum';
|
|
4
|
+
export type { IBasicShapeData, IConnectorLayoutResult, IConnectPointInfo, ICustomShapeTextData, ICxnShapeData, IDrawingRect, IGdContext, ILineType, IPathCommand, IPresetShapeConfig, IShape3D, IShape3DRotation, IShape3DVector, IShapeAdjustItemResolved, IShapeData, IShapeFormulaBinding, IShapeJSONData, IShapeLineStyle, IShapePath, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeScene3D, IShapeText, IShapeTextBodyBehavior, IShapeTextBoxOptions, IShapeTextData, IShapeTextDataModel, IShapeTextRectPadding, ISmartArtData, ISmartArtDataNode, ISmartArtEditCapabilities, ISmartArtPresentationShape, ISmartArtPresentationTextBinding, ISmartArtShapeData, ISmartArtTransform, ShapeTextHorizontalAnchor, } from '../src/shape-type';
|
|
5
5
|
export { ShapeTextAutoFitType, ShapeTextDirection, ShapeTextWrapType } from '../src/shape-type';
|
|
6
6
|
export { applyShapeTextBoxOptions, resolveShapeTextBodyBehavior, resolveShapeTextBoxOptions, shouldUseFullShapeTextRectForAutoFit, } from '../src/utils/shape-text-behavior.util';
|
|
7
7
|
export type { IResolvedShapeTextBoxOptions } from '../src/utils/shape-text-behavior.util';
|
|
8
8
|
export { UniverShapePlugin } from './plugin';
|
|
9
9
|
export { computeConnectorRouteLayout, getBasicShapeRotateBound, routeConnectorLineShape, } from './render-engine/connector-points-util';
|
|
10
|
+
export { DEFAULT_SHAPE_BEVEL_EXTENT, getShape3DBounds, isShape3DProjectiveScene, projectShape3DPoint, projectShape3DRect, renderProjectedShapeRect, resolveShape3DGlyphRenderPlan, resolveShapeBevelExtent, shadeShape3DColor, } from './render-engine/shape-3d-renderer';
|
|
11
|
+
export type { IShape3DGlyphRenderPlan, IShape3DProjectedPoint, IShape3DProjectedQuad, } from './render-engine/shape-3d-renderer';
|
|
10
12
|
export { ConnectorShapeHostAdapter } from './services/connector-shape-host-adapter';
|
|
11
13
|
export { IConnectorShapeHostAdapter } from './services/connector-shape-host-adapter.service';
|
|
12
14
|
export type { IConnectorArrow, IConnectorEndpoint, IConnectorShapeSnapshot, } from './services/connector-shape-host-adapter.service';
|
|
13
15
|
export { canApplyShapeFormulaLastValue, IShapeHostAdapterRegistry, isShapeHostType, ShapeHostAdapterRegistry, } from './services/shape-host-adapter.service';
|
|
14
|
-
export type { IShapeCreateInput, IShapeFormulaLastValueGuard, IShapeHostAdapter, IShapeHostChange, IShapeHostChangeStream, IShapeRef, IShapeScope, IShapeSnapshot, IShapeTransform, IShapeUpdateInput, ShapeHostType, } from './services/shape-host-adapter.service';
|
|
15
|
-
export { ShapeDefaultConfig } from './shape-default';
|
|
16
|
+
export type { IShapeCreateInput, IShapeFormulaLastValueGuard, IShapeHostAdapter, IShapeHostAdapterRegistryChange, IShapeHostAdapterRegistryChangeStream, IShapeHostChange, IShapeHostChangeStream, IShapeRef, IShapeScope, IShapeSnapshot, IShapeTransform, IShapeUpdateInput, ShapeHostType, } from './services/shape-host-adapter.service';
|
|
17
|
+
export { createDefaultInsertedShapeData, DEFAULT_INSERTED_SHAPE_STYLE, ShapeDefaultConfig, } from './shape-default';
|
|
16
18
|
export { resolveShapeDefaultInsertSize } from './shape-default-size';
|
|
19
|
+
export { applySmartArtColorStyle, SMART_ART_COLOR_STYLE_CATALOG } from './smart-art/smart-art-color-style';
|
|
20
|
+
export type { ISmartArtColorStyleCatalogItem, SmartArtColorStyleSection } from './smart-art/smart-art-color-style';
|
|
21
|
+
export { SmartArtCategoryEnum, SmartArtDirectionEnum, SmartArtInsertPositionEnum, SmartArtNodeRoleEnum, SmartArtPresentationShapeRoleEnum, SmartArtPresentationTextSourceEnum, SmartArtTextFontSizeModeEnum, } from './smart-art/smart-art-enum';
|
|
22
|
+
export { applySmartArtLayout, createSmartArtDataFromLayout } from './smart-art/smart-art-layout-template';
|
|
23
|
+
export type { ISmartArtLayoutTemplate } from './smart-art/smart-art-layout-template';
|
|
24
|
+
export { convertSmartArtToShapes, deleteSmartArtNode, demoteSmartArtNode, insertSmartArtNode, isSmartArtShapeData, moveSmartArtNode, promoteSmartArtNode, readSmartArtTextContent, replaceSmartArtTextContent, resetSmartArtTextFontSizes, resolveSmartArtPresentationNodeIdAtTextOffset, resolveSmartArtPresentationShapeData, resolveSmartArtPresentationShapeIdForNode, resolveSmartArtPresentationTextBindings, setSmartArtDirection, setSmartArtLayout, updateSmartArtNode, updateSmartArtPresentationShape, updateSmartArtPresentationText, validateSmartArtData, } from './smart-art/smart-art-model';
|
|
25
|
+
export type { IConvertedSmartArtShape, IInsertSmartArtNodeOptions, IMoveSmartArtNodeOptions, IUpdateSmartArtPresentationTextOptions, } from './smart-art/smart-art-model';
|
|
26
|
+
export { applySmartArtOperation, SmartArtOperationTypeEnum } from './smart-art/smart-art-operation';
|
|
27
|
+
export type { SmartArtOperation } from './smart-art/smart-art-operation';
|
|
28
|
+
export { applySmartArtQuickStyle, SMART_ART_QUICK_STYLE_CATALOG } from './smart-art/smart-art-quick-style';
|
|
29
|
+
export type { ISmartArtQuickStyleCatalogItem, SmartArtQuickStyleSection } from './smart-art/smart-art-quick-style';
|
|
30
|
+
export { resolveSmartArtPresentationTransform } from './smart-art/smart-art-transform';
|
|
17
31
|
export { ConnectorCoordinateTransform } from './util/connector-transform';
|
|
18
32
|
export { createUniqueShapeName } from './util/shape-name';
|
|
19
33
|
export { isConnectorShape, isCurvedConnectorShape, } from './util/shape-util';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { IBoundRectNoAngle } from '@univerjs/engine-render';
|
|
2
|
-
import type { ShapeTypeEnum } from '../shape-enum';
|
|
3
2
|
import type { IGdContext, IPresetShapeConfig, IShapeAdjustItemResolved, IShapeContextOptions, IShapeData, IShapeJSONData, IShapeModel, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeRenderParameters, IShapeTextData } from '../shape-type';
|
|
4
|
-
import { BasicShapeEnum } from '../shape-enum';
|
|
5
|
-
export declare function deepMerge<T extends
|
|
3
|
+
import { BasicShapeEnum, ShapeTypeEnum } from '../shape-enum';
|
|
4
|
+
export declare function deepMerge<T extends object>(target: T, ...sources: Partial<T>[]): T;
|
|
6
5
|
export declare class BasicShapeModel implements IShapeModel {
|
|
7
6
|
protected _shapeType: ShapeTypeEnum;
|
|
8
7
|
private readonly _id;
|
|
@@ -135,4 +134,6 @@ export declare class BasicShapeModel implements IShapeModel {
|
|
|
135
134
|
toJSON(): IShapeJSONData;
|
|
136
135
|
fromJSON(json: IShapeJSONData): void;
|
|
137
136
|
private _createRenderModel;
|
|
137
|
+
private _renderSmartArtPresentationShapes;
|
|
138
|
+
private _getSmartArtDrawingBounds;
|
|
138
139
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { IBoundRectNoAngle } from '@univerjs/engine-render';
|
|
2
|
+
import type { IShape3D, IShapeData, IShapeRect, IShapeRenderParameters, IShapeScene3D } from '../shape-type';
|
|
3
|
+
import type { BaseShapeContext } from './base-shape-context';
|
|
4
|
+
import type { BaseShapeRenderModel } from './shape-render-model';
|
|
5
|
+
import { ShapeBevelPresetEnum, ShapeMaterialPresetEnum } from '../shape-enum';
|
|
6
|
+
/** PowerPoint's implicit bevel extent, stored in the public model as points for OOXML round-trips. */
|
|
7
|
+
export declare const DEFAULT_SHAPE_BEVEL_EXTENT = 6;
|
|
8
|
+
export declare function resolveShapeBevelExtent(preset: ShapeBevelPresetEnum | undefined, extent: number | undefined): number;
|
|
9
|
+
export declare function resolveProjectedFlatMaterialFactor(scene3d?: IShapeScene3D): number;
|
|
10
|
+
interface IShape3DProjection {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
14
|
+
interface IShapeBevelProfile {
|
|
15
|
+
/** Effective inset in units of the OOXML bevel width/height. */
|
|
16
|
+
widthScale: number;
|
|
17
|
+
heightScale: number;
|
|
18
|
+
top: number;
|
|
19
|
+
right: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
left: number;
|
|
22
|
+
inner?: number;
|
|
23
|
+
secondary?: number;
|
|
24
|
+
/** Fraction of the bevel occupied by the outer face in a compound profile. */
|
|
25
|
+
outerRatio?: number;
|
|
26
|
+
/** Reverses the inner face light response for concave profiles. */
|
|
27
|
+
innerTop?: number;
|
|
28
|
+
innerRight?: number;
|
|
29
|
+
innerBottom?: number;
|
|
30
|
+
innerLeft?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface IShape3DProjectedPoint {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
depth: number;
|
|
36
|
+
}
|
|
37
|
+
export interface IShape3DProjectedQuad {
|
|
38
|
+
topLeft: IShape3DProjectedPoint;
|
|
39
|
+
topRight: IShape3DProjectedPoint;
|
|
40
|
+
bottomRight: IShape3DProjectedPoint;
|
|
41
|
+
bottomLeft: IShape3DProjectedPoint;
|
|
42
|
+
}
|
|
43
|
+
export declare function applyShape3DCameraTransform(canvasContext: CanvasRenderingContext2D, rect: IShapeRect, scene3d?: IShapeScene3D): void;
|
|
44
|
+
/** Stable renderer-level signature used by regression tests and cached glyph render plans. */
|
|
45
|
+
export declare function resolveShapeBevelProfileSignature(preset?: ShapeBevelPresetEnum): string;
|
|
46
|
+
/**
|
|
47
|
+
* Stable, fill-independent description of a PowerPoint bevel's light response.
|
|
48
|
+
* Consumers apply these signed alpha values over the current fill; presets never
|
|
49
|
+
* carry a source color of their own.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveShapeBevelLightCurveSignature(preset?: ShapeBevelPresetEnum, scene3d?: IShapeScene3D, material?: ShapeMaterialPresetEnum): string;
|
|
52
|
+
export interface IShape3DGlyphRenderPlan {
|
|
53
|
+
projection: IShape3DProjection;
|
|
54
|
+
layerCount: number;
|
|
55
|
+
extrusionColor: string;
|
|
56
|
+
extrusionInheritsFill: boolean;
|
|
57
|
+
extrusionOpacity: number;
|
|
58
|
+
lightFactor: number;
|
|
59
|
+
lightAngle: number;
|
|
60
|
+
materialGradientStops: ReadonlyArray<readonly [number, string]>;
|
|
61
|
+
bevel?: IShapeBevelProfile & {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
contourWidth: number;
|
|
66
|
+
contourColor: string;
|
|
67
|
+
}
|
|
68
|
+
/** Resolves the Shape 2.5D semantics for a cached text-glyph alpha layer. */
|
|
69
|
+
export declare function resolveShape3DGlyphRenderPlan(scene3d: IShapeScene3D | undefined, shape3d: IShape3D | undefined, baseColor?: string, sceneRect?: IShapeRect): IShape3DGlyphRenderPlan | undefined;
|
|
70
|
+
export declare function shadeShape3DColor(color: string, factor: number): string;
|
|
71
|
+
export declare function getShape3DCameraTransformedBounds(bounds: IBoundRectNoAngle, sceneRect: IShapeRect, scene3d?: IShapeScene3D): IBoundRectNoAngle;
|
|
72
|
+
export declare function isShape3DProjectiveScene(scene3d?: IShapeScene3D): boolean;
|
|
73
|
+
export declare function projectShape3DPoint(point: {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
z?: number;
|
|
77
|
+
}, sceneRect: IShapeRect, scene3d: IShapeScene3D): IShape3DProjectedPoint;
|
|
78
|
+
export declare function projectShape3DRect(rect: IShapeRect, sceneRect: IShapeRect, scene3d: IShapeScene3D, z?: number): IShape3DProjectedQuad;
|
|
79
|
+
export declare function renderProjectedShapeRect(canvasContext: CanvasRenderingContext2D, sceneRect: IShapeRect, rect: IShapeRect, scene3d: IShapeScene3D, shapeData: IShapeData, image?: HTMLImageElement): void;
|
|
80
|
+
export declare function renderShape3D(canvasContext: CanvasRenderingContext2D, rect: IShapeRect, shapeContext: BaseShapeContext, shapeData: IShapeData, renderOption: IShapeRenderParameters, renderModel: BaseShapeRenderModel): void;
|
|
81
|
+
export declare function renderShape3DFrontBevel(canvasContext: CanvasRenderingContext2D, rect: IShapeRect, shapeContext: BaseShapeContext, shapeData: IShapeData, renderOption: IShapeRenderParameters, renderModel: BaseShapeRenderModel): void;
|
|
82
|
+
interface IMaterialSurfaceAdjustment {
|
|
83
|
+
add: number;
|
|
84
|
+
colorCurve?: readonly number[];
|
|
85
|
+
scale: number;
|
|
86
|
+
}
|
|
87
|
+
/** Continuous material response shared by preset and explicit DrawingML camera rotations. */
|
|
88
|
+
export declare function resolveProjectedMaterialSurfaceAdjustment(material: ShapeMaterialPresetEnum, scene3d?: IShapeScene3D, shape3d?: IShape3D): IMaterialSurfaceAdjustment;
|
|
89
|
+
export declare function getShape3DBounds(rect: IShapeRect, scene3d?: IShapeScene3D, shape3d?: IShape3D, sceneRect?: IShapeRect, strokeWidth?: number): IBoundRectNoAngle | undefined;
|
|
90
|
+
export declare const DEFAULT_SHAPE_3D_SCENE: IShapeScene3D;
|
|
91
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import type { IFormulaLastValue } from '@univerjs-pro/engine-formula';
|
|
|
2
2
|
import type { IAccessor, IDisposable, IMutationInfo } from '@univerjs/core';
|
|
3
3
|
import type { ShapeTypeEnum } from '../shape-enum';
|
|
4
4
|
import type { IShapeData } from '../shape-type';
|
|
5
|
+
import type { SmartArtOperation } from '../smart-art/smart-art-operation';
|
|
5
6
|
import { UniverInstanceType } from '@univerjs/core';
|
|
6
7
|
export type ShapeHostType = UniverInstanceType.UNIVER_SHEET | UniverInstanceType.UNIVER_DOC | UniverInstanceType.UNIVER_SLIDE | UniverInstanceType.UNIVER_BOARD;
|
|
7
8
|
export declare function isShapeHostType(type: UniverInstanceType): type is ShapeHostType;
|
|
@@ -26,6 +27,15 @@ export interface IShapeHostChangeStream {
|
|
|
26
27
|
unsubscribe(): void;
|
|
27
28
|
};
|
|
28
29
|
}
|
|
30
|
+
export interface IShapeHostAdapterRegistryChange {
|
|
31
|
+
type: 'registered' | 'unregistered';
|
|
32
|
+
adapter: IShapeHostAdapter;
|
|
33
|
+
}
|
|
34
|
+
export interface IShapeHostAdapterRegistryChangeStream {
|
|
35
|
+
subscribe(listener: (change: IShapeHostAdapterRegistryChange) => void): {
|
|
36
|
+
unsubscribe(): void;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
29
39
|
export interface IShapeTransform {
|
|
30
40
|
/** Horizontal position in host coordinates. */
|
|
31
41
|
left: number;
|
|
@@ -89,6 +99,8 @@ export interface IShapeUpdateInput {
|
|
|
89
99
|
visible?: boolean;
|
|
90
100
|
/** Canvas selectability to update. Omit to preserve the current value. */
|
|
91
101
|
selectable?: boolean;
|
|
102
|
+
/** Semantic SmartArt edits resolved by the host's undoable command. */
|
|
103
|
+
smartArtOperations?: readonly SmartArtOperation[];
|
|
92
104
|
}
|
|
93
105
|
/**
|
|
94
106
|
* Ephemeral compare-and-set guard carried by a derived Formula last-value mutation.
|
|
@@ -121,6 +133,8 @@ export interface IShapeHostAdapter {
|
|
|
121
133
|
*/
|
|
122
134
|
createShapes?(scope: IShapeScope, inputs: IShapeCreateInput[]): IShapeSnapshot[] | null;
|
|
123
135
|
updateShape(ref: IShapeRef, input: IShapeUpdateInput): boolean;
|
|
136
|
+
/** Replaces one SmartArt composite with host-native ordinary Shapes in one undoable command. */
|
|
137
|
+
convertSmartArtToShapes?(ref: IShapeRef): IShapeSnapshot[] | null;
|
|
124
138
|
/**
|
|
125
139
|
* Builds the Host's existing Shape mutation for a successful Formula result.
|
|
126
140
|
*
|
|
@@ -133,14 +147,21 @@ export interface IShapeHostAdapter {
|
|
|
133
147
|
bringForward(ref: IShapeRef): boolean;
|
|
134
148
|
sendBackward(ref: IShapeRef): boolean;
|
|
135
149
|
sendToBack(ref: IShapeRef): boolean;
|
|
150
|
+
setZOrder(ref: IShapeRef, index: number): boolean;
|
|
136
151
|
}
|
|
137
152
|
export interface IShapeHostAdapterRegistry {
|
|
153
|
+
readonly adapterChanged$: IShapeHostAdapterRegistryChangeStream;
|
|
138
154
|
register(adapter: IShapeHostAdapter): IDisposable;
|
|
139
155
|
get(hostType: UniverInstanceType): IShapeHostAdapter | null;
|
|
156
|
+
list(): readonly IShapeHostAdapter[];
|
|
140
157
|
}
|
|
141
158
|
export declare const IShapeHostAdapterRegistry: import("@wendellhu/redi").IdentifierDecorator<IShapeHostAdapterRegistry>;
|
|
142
159
|
export declare class ShapeHostAdapterRegistry implements IShapeHostAdapterRegistry {
|
|
143
160
|
private readonly _adapters;
|
|
161
|
+
private readonly _adapterChangedListeners;
|
|
162
|
+
readonly adapterChanged$: IShapeHostAdapterRegistryChangeStream;
|
|
144
163
|
register(adapter: IShapeHostAdapter): IDisposable;
|
|
145
164
|
get(hostType: UniverInstanceType): IShapeHostAdapter | null;
|
|
165
|
+
list(): readonly IShapeHostAdapter[];
|
|
166
|
+
private _emitAdapterChanged;
|
|
146
167
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import type { ShapeTypeEnum } from './shape-enum';
|
|
2
|
+
import type { IShapeData } from './shape-type';
|
|
1
3
|
import { ShapeFillEnum, ShapeGradientTypeEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeSketchTypeEnum } from './shape-enum';
|
|
4
|
+
export declare const DEFAULT_INSERTED_SHAPE_STYLE: {
|
|
5
|
+
readonly fillColor: "#4472C4";
|
|
6
|
+
readonly strokeColor: "#44546A";
|
|
7
|
+
readonly strokeWidth: 1.5;
|
|
8
|
+
readonly textColor: "#FFFFFF";
|
|
9
|
+
readonly textFontSize: 18;
|
|
10
|
+
};
|
|
11
|
+
/** Creates the shared default style for newly inserted non-connector Shapes. */
|
|
12
|
+
export declare function createDefaultInsertedShapeData(shapeType: ShapeTypeEnum): IShapeData;
|
|
2
13
|
export declare const ShapeDefaultConfig: {
|
|
3
14
|
fillType: ShapeFillEnum;
|
|
4
15
|
fill: string;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ImageSourceType } from '@univerjs/core';
|
|
2
|
+
export declare const ImageSourceTypeEnum: typeof ImageSourceType;
|
|
3
|
+
export type ImageSourceTypeEnum = ImageSourceType;
|
|
1
4
|
/**
|
|
2
5
|
* Basic shape types
|
|
3
6
|
*/
|
|
@@ -79,6 +82,145 @@ export declare enum ShapePresetShadowValEnum {
|
|
|
79
82
|
/** OOXML shdw20: Front Bottom Shadow, a front-facing shadow below the shape. */
|
|
80
83
|
Shdw20 = "shdw20"
|
|
81
84
|
}
|
|
85
|
+
/** OOXML ST_PresetCameraType values used by `<a:camera prst="...">`. */
|
|
86
|
+
export declare enum ShapeCameraPresetEnum {
|
|
87
|
+
LegacyObliqueTopLeft = "legacyObliqueTopLeft",
|
|
88
|
+
LegacyObliqueTop = "legacyObliqueTop",
|
|
89
|
+
LegacyObliqueTopRight = "legacyObliqueTopRight",
|
|
90
|
+
LegacyObliqueLeft = "legacyObliqueLeft",
|
|
91
|
+
LegacyObliqueFront = "legacyObliqueFront",
|
|
92
|
+
LegacyObliqueRight = "legacyObliqueRight",
|
|
93
|
+
LegacyObliqueBottomLeft = "legacyObliqueBottomLeft",
|
|
94
|
+
LegacyObliqueBottom = "legacyObliqueBottom",
|
|
95
|
+
LegacyObliqueBottomRight = "legacyObliqueBottomRight",
|
|
96
|
+
LegacyPerspectiveTopLeft = "legacyPerspectiveTopLeft",
|
|
97
|
+
LegacyPerspectiveTop = "legacyPerspectiveTop",
|
|
98
|
+
LegacyPerspectiveTopRight = "legacyPerspectiveTopRight",
|
|
99
|
+
LegacyPerspectiveLeft = "legacyPerspectiveLeft",
|
|
100
|
+
LegacyPerspectiveFront = "legacyPerspectiveFront",
|
|
101
|
+
LegacyPerspectiveRight = "legacyPerspectiveRight",
|
|
102
|
+
LegacyPerspectiveBottomLeft = "legacyPerspectiveBottomLeft",
|
|
103
|
+
LegacyPerspectiveBottom = "legacyPerspectiveBottom",
|
|
104
|
+
LegacyPerspectiveBottomRight = "legacyPerspectiveBottomRight",
|
|
105
|
+
OrthographicFront = "orthographicFront",
|
|
106
|
+
IsometricTopUp = "isometricTopUp",
|
|
107
|
+
IsometricTopDown = "isometricTopDown",
|
|
108
|
+
IsometricBottomUp = "isometricBottomUp",
|
|
109
|
+
IsometricBottomDown = "isometricBottomDown",
|
|
110
|
+
IsometricLeftUp = "isometricLeftUp",
|
|
111
|
+
IsometricLeftDown = "isometricLeftDown",
|
|
112
|
+
IsometricRightUp = "isometricRightUp",
|
|
113
|
+
IsometricRightDown = "isometricRightDown",
|
|
114
|
+
IsometricOffAxis1Left = "isometricOffAxis1Left",
|
|
115
|
+
IsometricOffAxis1Right = "isometricOffAxis1Right",
|
|
116
|
+
IsometricOffAxis1Top = "isometricOffAxis1Top",
|
|
117
|
+
IsometricOffAxis2Left = "isometricOffAxis2Left",
|
|
118
|
+
IsometricOffAxis2Right = "isometricOffAxis2Right",
|
|
119
|
+
IsometricOffAxis2Top = "isometricOffAxis2Top",
|
|
120
|
+
IsometricOffAxis3Left = "isometricOffAxis3Left",
|
|
121
|
+
IsometricOffAxis3Right = "isometricOffAxis3Right",
|
|
122
|
+
IsometricOffAxis3Bottom = "isometricOffAxis3Bottom",
|
|
123
|
+
IsometricOffAxis4Left = "isometricOffAxis4Left",
|
|
124
|
+
IsometricOffAxis4Right = "isometricOffAxis4Right",
|
|
125
|
+
IsometricOffAxis4Bottom = "isometricOffAxis4Bottom",
|
|
126
|
+
ObliqueTopLeft = "obliqueTopLeft",
|
|
127
|
+
ObliqueTop = "obliqueTop",
|
|
128
|
+
ObliqueTopRight = "obliqueTopRight",
|
|
129
|
+
ObliqueLeft = "obliqueLeft",
|
|
130
|
+
ObliqueRight = "obliqueRight",
|
|
131
|
+
ObliqueBottomLeft = "obliqueBottomLeft",
|
|
132
|
+
ObliqueBottom = "obliqueBottom",
|
|
133
|
+
ObliqueBottomRight = "obliqueBottomRight",
|
|
134
|
+
PerspectiveFront = "perspectiveFront",
|
|
135
|
+
PerspectiveLeft = "perspectiveLeft",
|
|
136
|
+
PerspectiveRight = "perspectiveRight",
|
|
137
|
+
PerspectiveAbove = "perspectiveAbove",
|
|
138
|
+
PerspectiveBelow = "perspectiveBelow",
|
|
139
|
+
PerspectiveAboveLeftFacing = "perspectiveAboveLeftFacing",
|
|
140
|
+
PerspectiveAboveRightFacing = "perspectiveAboveRightFacing",
|
|
141
|
+
PerspectiveContrastingLeftFacing = "perspectiveContrastingLeftFacing",
|
|
142
|
+
PerspectiveContrastingRightFacing = "perspectiveContrastingRightFacing",
|
|
143
|
+
PerspectiveHeroicLeftFacing = "perspectiveHeroicLeftFacing",
|
|
144
|
+
PerspectiveHeroicRightFacing = "perspectiveHeroicRightFacing",
|
|
145
|
+
PerspectiveHeroicExtremeLeftFacing = "perspectiveHeroicExtremeLeftFacing",
|
|
146
|
+
PerspectiveHeroicExtremeRightFacing = "perspectiveHeroicExtremeRightFacing",
|
|
147
|
+
PerspectiveRelaxed = "perspectiveRelaxed",
|
|
148
|
+
PerspectiveRelaxedModerately = "perspectiveRelaxedModerately"
|
|
149
|
+
}
|
|
150
|
+
/** OOXML ST_LightRigType values used by `<a:lightRig rig="...">`. */
|
|
151
|
+
export declare enum ShapeLightRigPresetEnum {
|
|
152
|
+
LegacyFlat1 = "legacyFlat1",
|
|
153
|
+
LegacyFlat2 = "legacyFlat2",
|
|
154
|
+
LegacyFlat3 = "legacyFlat3",
|
|
155
|
+
LegacyFlat4 = "legacyFlat4",
|
|
156
|
+
LegacyNormal1 = "legacyNormal1",
|
|
157
|
+
LegacyNormal2 = "legacyNormal2",
|
|
158
|
+
LegacyNormal3 = "legacyNormal3",
|
|
159
|
+
LegacyNormal4 = "legacyNormal4",
|
|
160
|
+
LegacyHarsh1 = "legacyHarsh1",
|
|
161
|
+
LegacyHarsh2 = "legacyHarsh2",
|
|
162
|
+
LegacyHarsh3 = "legacyHarsh3",
|
|
163
|
+
LegacyHarsh4 = "legacyHarsh4",
|
|
164
|
+
ThreePoint = "threePt",
|
|
165
|
+
Balanced = "balanced",
|
|
166
|
+
Soft = "soft",
|
|
167
|
+
Harsh = "harsh",
|
|
168
|
+
Flood = "flood",
|
|
169
|
+
Contrasting = "contrasting",
|
|
170
|
+
Morning = "morning",
|
|
171
|
+
Sunrise = "sunrise",
|
|
172
|
+
Sunset = "sunset",
|
|
173
|
+
Chilly = "chilly",
|
|
174
|
+
Freezing = "freezing",
|
|
175
|
+
Flat = "flat",
|
|
176
|
+
TwoPoint = "twoPt",
|
|
177
|
+
Glow = "glow",
|
|
178
|
+
BrightRoom = "brightRoom"
|
|
179
|
+
}
|
|
180
|
+
/** OOXML ST_LightRigDirection values. */
|
|
181
|
+
export declare enum ShapeLightRigDirectionEnum {
|
|
182
|
+
TopLeft = "tl",
|
|
183
|
+
Top = "t",
|
|
184
|
+
TopRight = "tr",
|
|
185
|
+
Left = "l",
|
|
186
|
+
Right = "r",
|
|
187
|
+
BottomLeft = "bl",
|
|
188
|
+
Bottom = "b",
|
|
189
|
+
BottomRight = "br"
|
|
190
|
+
}
|
|
191
|
+
/** OOXML ST_PresetMaterialType values used by `<a:sp3d prstMaterial="...">`. */
|
|
192
|
+
export declare enum ShapeMaterialPresetEnum {
|
|
193
|
+
LegacyMatte = "legacyMatte",
|
|
194
|
+
LegacyPlastic = "legacyPlastic",
|
|
195
|
+
LegacyMetal = "legacyMetal",
|
|
196
|
+
LegacyWireframe = "legacyWireframe",
|
|
197
|
+
Matte = "matte",
|
|
198
|
+
Plastic = "plastic",
|
|
199
|
+
Metal = "metal",
|
|
200
|
+
WarmMatte = "warmMatte",
|
|
201
|
+
TranslucentPowder = "translucentPowder",
|
|
202
|
+
Powder = "powder",
|
|
203
|
+
DarkEdge = "dkEdge",
|
|
204
|
+
SoftEdge = "softEdge",
|
|
205
|
+
Clear = "clear",
|
|
206
|
+
Flat = "flat",
|
|
207
|
+
SoftMetal = "softmetal"
|
|
208
|
+
}
|
|
209
|
+
/** OOXML ST_BevelPresetType values used by `<a:bevelT>` and `<a:bevelB>`. */
|
|
210
|
+
export declare enum ShapeBevelPresetEnum {
|
|
211
|
+
RelaxedInset = "relaxedInset",
|
|
212
|
+
Circle = "circle",
|
|
213
|
+
Slope = "slope",
|
|
214
|
+
Cross = "cross",
|
|
215
|
+
Angle = "angle",
|
|
216
|
+
SoftRound = "softRound",
|
|
217
|
+
Convex = "convex",
|
|
218
|
+
CoolSlant = "coolSlant",
|
|
219
|
+
Divot = "divot",
|
|
220
|
+
Riblet = "riblet",
|
|
221
|
+
HardEdge = "hardEdge",
|
|
222
|
+
ArtDeco = "artDeco"
|
|
223
|
+
}
|
|
82
224
|
/**
|
|
83
225
|
* Shape fill type enum
|
|
84
226
|
* Shape fill types supported by the renderer.
|
|
@@ -136,6 +278,8 @@ export declare enum ShapeOperatorEnum {
|
|
|
136
278
|
export declare enum ShapeTypeEnum {
|
|
137
279
|
/** No rendered geometry; reserve this value for an explicitly empty shape. */
|
|
138
280
|
None = "none",
|
|
281
|
+
/** SmartArt composite host. Its editable presentation shapes remain nested in `shapeData.smartArt`. */
|
|
282
|
+
SmartArt = "smartArt",
|
|
139
283
|
/** Rectangle for generic process steps, cards, and diagram nodes. */
|
|
140
284
|
Rect = "rect",
|
|
141
285
|
/** Rounded rectangle for friendly process steps, states, and cards. */
|
|
@@ -572,23 +716,6 @@ export declare enum ShapeSketchTypeEnum {
|
|
|
572
716
|
Freehand = 3,
|
|
573
717
|
HandDrawn = 4
|
|
574
718
|
}
|
|
575
|
-
/**
|
|
576
|
-
* The type of image data source
|
|
577
|
-
*/
|
|
578
|
-
export declare enum ImageSourceTypeEnum {
|
|
579
|
-
/**
|
|
580
|
-
* The image source is a URL, for example: https://avatars.githubusercontent.com/u/61444807?s=48&v=4
|
|
581
|
-
*/
|
|
582
|
-
URL = "URL",
|
|
583
|
-
/**
|
|
584
|
-
* The image source is a UUID, this ID is generated by the Univer image hosting service. For specific generation rules, please refer to the Univer image hosting service API documentation.
|
|
585
|
-
*/
|
|
586
|
-
UUID = "UUID",
|
|
587
|
-
/**
|
|
588
|
-
* The image source is BASE64, for example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB7ZJ...
|
|
589
|
-
*/
|
|
590
|
-
BASE64 = "BASE64"
|
|
591
|
-
}
|
|
592
719
|
/**
|
|
593
720
|
* The image fill mode when ShapeFillEnum is PictureFill
|
|
594
721
|
*/
|