@univerjs-pro/engine-shape 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
@@ -1,201 +1,24 @@
1
1
  export { BasicShapeModel as ShapeModel } from '../src/models/shape-model';
2
- export { LineShapeRenderModel } from '../src/render-engine/line-shape-render-model';
3
2
  export { BaseShapeRenderModel } from '../src/render-engine/shape-render-model';
4
- export { BasicShapeEnum, ImageFillModeEnum, ImageSourceTypeEnum, ShapeArrowSizeEnum, ShapeArrowTypeEnum, ShapeFillEnum, ShapeGradientTypeEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeOperatorEnum, ShapePresetShadowValEnum, ShapeRenderModeEnum, ShapeSketchTypeEnum, ShapeTypeEnum, } from '../src/shape-enum';
5
- export type { IBasicShapeData, IConnectorLayoutResult, IConnectorRouteLayoutResult, IConnectPointInfo, ICustomShapeTextData, ICxnShapeData, IDrawingRect, IGdContext, IGdContextBase, ILineType, IPathCommand, IPresetShapeConfig, IShapeAdjustItem, IShapeAdjustItemResolved, IShapeContextOptions, IShapeData, IShapeHitTestResult, IShapeJSONData, IShapeLineStyle, IShapeModel, IShapePath, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeRenderParameters, IShapeShadowEffect, IShapeText, IShapeTextRectPadding, ShapeAdjustHandleTypeEnum, ShapeHitTestHitTypeEnum, ShapeTextDirection, } from '../src/shape-type';
6
- export { AccentBorderCallout1Shape } from '../src/shapes/accent-border-callout1-shape';
7
- export { AccentBorderCallout2Shape } from '../src/shapes/accent-border-callout2-shape';
8
- export { AccentBorderCallout3Shape } from '../src/shapes/accent-border-callout3-shape';
9
- export { AccentCallout1Shape } from '../src/shapes/accent-callout1-shape';
10
- export { AccentCallout2Shape } from '../src/shapes/accent-callout2-shape';
11
- export { AccentCallout3Shape } from '../src/shapes/accent-callout3-shape';
12
- export { ActionButtonBackPreviousShape } from '../src/shapes/action-button-back-previous-shape';
13
- export { ActionButtonBeginningShape } from '../src/shapes/action-button-beginning-shape';
14
- export { ActionButtonBlankShape } from '../src/shapes/action-button-blank-shape';
15
- export { ActionButtonDocumentShape } from '../src/shapes/action-button-document-shape';
16
- export { ActionButtonEndShape } from '../src/shapes/action-button-end-shape';
17
- export { ActionButtonForwardNextShape } from '../src/shapes/action-button-forward-next-shape';
18
- export { ActionButtonHelpShape } from '../src/shapes/action-button-help-shape';
19
- export { ActionButtonHomeShape } from '../src/shapes/action-button-home-shape';
20
- export { ActionButtonInformationShape } from '../src/shapes/action-button-information-shape';
21
- export { ActionButtonMovieShape } from '../src/shapes/action-button-movie-shape';
22
- export { ActionButtonReturnShape } from '../src/shapes/action-button-return-shape';
23
- export { ActionButtonSoundShape } from '../src/shapes/action-button-sound-shape';
24
- export { ArcShape } from '../src/shapes/arc-shape';
25
- export { BentArrowShape } from '../src/shapes/bent-arrow-shape';
26
- export { BentConnector2Shape } from '../src/shapes/bent-connector2-shape';
27
- export { BentConnector3Shape } from '../src/shapes/bent-connector3-shape';
28
- export { BentConnector4Shape } from '../src/shapes/bent-connector4-shape';
29
- export { BentConnector5Shape } from '../src/shapes/bent-connector5-shape';
30
- export { BentUpArrowShape } from '../src/shapes/bent-up-arrow-shape';
31
- export { BevelShape } from '../src/shapes/bevel-shape';
32
- export { BlockArcShape } from '../src/shapes/block-arc-shape';
33
- export { BorderCallout1Shape } from '../src/shapes/border-callout1-shape';
34
- export { BorderCallout2Shape } from '../src/shapes/border-callout2-shape';
35
- export { BorderCallout3Shape } from '../src/shapes/border-callout3-shape';
36
- export { BracePairShape } from '../src/shapes/brace-pair-shape';
37
- export { BracketPairShape } from '../src/shapes/bracket-pair-shape';
38
- export { Callout1Shape } from '../src/shapes/callout1-shape';
39
- export { Callout2Shape } from '../src/shapes/callout2-shape';
40
- export { Callout3Shape } from '../src/shapes/callout3-shape';
41
- export { CanShape } from '../src/shapes/can-shape';
42
- export { ChartPlusShape } from '../src/shapes/chart-plus-shape';
43
- export { ChartStarShape } from '../src/shapes/chart-star-shape';
44
- export { ChartXShape } from '../src/shapes/chart-x-shape';
45
- export { ChevronShape } from '../src/shapes/chevron-shape';
46
- export { ChordShape } from '../src/shapes/chord-shape';
47
- export { CircleShape } from '../src/shapes/circle-shape';
48
- export { CircularArrowShape } from '../src/shapes/circular-arrow-shape';
49
- export { CloudCalloutShape } from '../src/shapes/cloud-callout-shape';
50
- export { CloudShape } from '../src/shapes/cloud-shape';
51
- export { CornerShape } from '../src/shapes/corner-shape';
52
- export { CornerTabsShape } from '../src/shapes/corner-tabs-shape';
53
- export { CubeShape } from '../src/shapes/cube-shape';
54
- export { CurvedConnector2Shape } from '../src/shapes/curved-connector2-shape';
55
- export { CurvedConnector3Shape } from '../src/shapes/curved-connector3-shape';
56
- export { CurvedConnector4Shape } from '../src/shapes/curved-connector4-shape';
57
- export { CurvedConnector5Shape } from '../src/shapes/curved-connector5-shape';
58
- export { CurvedDownArrowShape } from '../src/shapes/curved-down-arrow-shape';
59
- export { CurvedLeftArrowShape } from '../src/shapes/curved-left-arrow-shape';
60
- export { CurvedRightArrowShape } from '../src/shapes/curved-right-arrow-shape';
61
- export { CurvedUpArrowShape } from '../src/shapes/curved-up-arrow-shape';
62
- export { DecagonShape } from '../src/shapes/decagon-shape';
63
- export { DiagStripeShape } from '../src/shapes/diagonal-stripe-shape';
64
- export { DiamondShape } from '../src/shapes/diamond-shape';
65
- export { DodecagonShape } from '../src/shapes/dodecagon-shape';
66
- export { DonutShape } from '../src/shapes/donut-shape';
67
- export { DoubleWaveShape } from '../src/shapes/double-wave-shape';
68
- export { DownArrowCalloutShape } from '../src/shapes/down-arrow-callout-shape';
69
- export { DownArrowShape } from '../src/shapes/down-arrow-shape';
70
- export { EllipseRibbon2Shape } from '../src/shapes/ellipse-ribbon2-shape';
71
- export { EllipseRibbonShape } from '../src/shapes/ellipse-ribbon-shape';
72
- export { EllipseShape } from '../src/shapes/ellipse-shape';
73
- export { FlowChartOfflineStorageShape } from '../src/shapes/flow-chart-offline-storage-shape';
74
- export { FlowchartAlternateProcessShape } from '../src/shapes/flowchart-alternate-process-shape';
75
- export { FlowchartCollateShape } from '../src/shapes/flowchart-collate-shape';
76
- export { FlowchartConnectorShape } from '../src/shapes/flowchart-connector-shape';
77
- export { FlowChartInputOutputShape } from '../src/shapes/flowchart-data-shape';
78
- export { FlowchartDecisionShape } from '../src/shapes/flowchart-decision-shape';
79
- export { FlowchartDelayShape } from '../src/shapes/flowchart-delay-shape';
80
- export { FlowchartDisplayShape } from '../src/shapes/flowchart-display-shape';
81
- export { FlowchartDocumentShape } from '../src/shapes/flowchart-document-shape';
82
- export { FlowchartExtractShape } from '../src/shapes/flowchart-extract-shape';
83
- export { FlowchartInternalStorageShape } from '../src/shapes/flowchart-internal-storage-shape';
84
- export { FlowchartMagneticDiskShape } from '../src/shapes/flowchart-magnetic-disk-shape';
85
- export { FlowchartMagneticDrumShape } from '../src/shapes/flowchart-magnetic-drum-shape';
86
- export { FlowchartMagneticTapeShape } from '../src/shapes/flowchart-magnetic-tape-shape';
87
- export { FlowchartManualInputShape } from '../src/shapes/flowchart-manual-input-shape';
88
- export { FlowchartManualOperationShape } from '../src/shapes/flowchart-manual-operation-shape';
89
- export { FlowchartMergeShape } from '../src/shapes/flowchart-merge-shape';
90
- export { FlowchartMultiDocumentShape } from '../src/shapes/flowchart-multidocument-shape';
91
- export { FlowchartOffPageConnectorShape } from '../src/shapes/flowchart-offpage-connector-shape';
92
- export { FlowchartOnlineStorageShape } from '../src/shapes/flowchart-online-storage-shape';
93
- export { FlowchartOrShape } from '../src/shapes/flowchart-or-shape';
94
- export { FlowchartPredefinedProcessShape } from '../src/shapes/flowchart-predefined-process-shape';
95
- export { FlowchartPreparationShape } from '../src/shapes/flowchart-preparation-shape';
96
- export { FlowchartProcessShape } from '../src/shapes/flowchart-process-shape';
97
- export { FlowchartPunchedCardShape } from '../src/shapes/flowchart-punched-card-shape';
98
- export { FlowchartPunchedTapeShape } from '../src/shapes/flowchart-punched-tape-shape';
99
- export { FlowchartSortShape } from '../src/shapes/flowchart-sort-shape';
100
- export { FlowchartSummingJunctionShape } from '../src/shapes/flowchart-summing-junction-shape';
101
- export { FlowchartTerminatorShape } from '../src/shapes/flowchart-terminator-shape';
102
- export { FoldedCornerShape } from '../src/shapes/folded-corner-shape';
103
- export { FrameShape } from '../src/shapes/frame-shape';
104
- export { FunnelShape } from '../src/shapes/funnel-shape';
105
- export { Gear6Shape } from '../src/shapes/gear6-shape';
106
- export { Gear9Shape } from '../src/shapes/gear9-shape';
107
- export { HalfFrameShape } from '../src/shapes/half-frame-shape';
108
- export { HeartShape } from '../src/shapes/heart-shape';
109
- export { HeptagonShape } from '../src/shapes/heptagon-shape';
110
- export { HexagonShape } from '../src/shapes/hexagon-shape';
111
- export { HomePlateShape } from '../src/shapes/home-plate-shape';
112
- export { HorizontalScrollShape } from '../src/shapes/horizontal-scroll-shape';
113
- export { IrregularSeal1Shape } from '../src/shapes/irregular-seal1-shape';
114
- export { IrregularSeal2Shape } from '../src/shapes/irregular-seal2-shape';
115
- export { LeftArrowCalloutShape } from '../src/shapes/left-arrow-callout-shape';
116
- export { LeftArrowShape } from '../src/shapes/left-arrow-shape';
117
- export { LeftBraceShape } from '../src/shapes/left-brace-shape';
118
- export { LeftBracketShape } from '../src/shapes/left-bracket-shape';
119
- export { LeftCircularArrowShape } from '../src/shapes/left-circular-arrow-shape';
120
- export { LeftRightArrowCalloutShape } from '../src/shapes/left-right-arrow-callout-shape';
121
- export { LeftRightArrowShape } from '../src/shapes/left-right-arrow-shape';
122
- export { LeftRightCircularArrowShape } from '../src/shapes/left-right-circular-arrow-shape';
123
- export { LeftRightRibbonShape } from '../src/shapes/left-right-ribbon-shape';
124
- export { LeftRightUpArrowShape } from '../src/shapes/left-right-up-arrow-shape';
125
- export { LeftUpArrowShape } from '../src/shapes/left-up-arrow-shape';
126
- export { LightningBoltShape } from '../src/shapes/lightning-bolt-shape';
127
- export { LineInvShape } from '../src/shapes/line-lnv-shape';
128
- export { LineShape } from '../src/shapes/line-shape';
129
- export { MathDivideShape } from '../src/shapes/math-divide-shape';
130
- export { MathEqualShape } from '../src/shapes/math-equal-shape';
131
- export { MathMinusShape } from '../src/shapes/math-minus-shape';
132
- export { MathMultiplyShape } from '../src/shapes/math-multiply-shape';
133
- export { MathNotEqualShape } from '../src/shapes/math-not-equal-shape';
134
- export { MathPlusShape } from '../src/shapes/math-plus-shape';
135
- export { MoonShape } from '../src/shapes/moon-shape';
136
- export { NoSmokingShape } from '../src/shapes/no-smoking-shape';
137
- export { NonIsoscelesTrapezoidShape } from '../src/shapes/non-isosceles-trapezoid';
138
- export { NotchedRightArrowShape } from '../src/shapes/notched-right-arrow-shape';
139
- export { OctagonShape } from '../src/shapes/octagon-shape';
140
- export { ParallelogramShape } from '../src/shapes/parallelogram-shape';
141
- export { PentagonShape } from '../src/shapes/pentagon-shape';
142
- export { PieShape } from '../src/shapes/pie-shape';
143
- export { PieWedgeShape } from '../src/shapes/pie-wedge-shape';
144
- export { PlaqueShape } from '../src/shapes/plaque-shape';
145
- export { PlaqueTabsShape } from '../src/shapes/plaque-tabs-shape';
146
- export { PlusShape } from '../src/shapes/plus-shape';
147
- export { QuadArrowCalloutShape } from '../src/shapes/quad-arrow-callout-shape';
148
- export { QuadArrowShape } from '../src/shapes/quad-arrow-shape';
149
- export { RectangleShape } from '../src/shapes/rectangle-shape';
150
- export { Ribbon2Shape } from '../src/shapes/ribbon2-shape';
151
- export { RibbonShape } from '../src/shapes/ribbon-shape';
152
- export { RightArrowCalloutShape } from '../src/shapes/right-arrow-callout-shape';
153
- export { RightArrowShape } from '../src/shapes/right-arrow-shape';
154
- export { RightBraceShape } from '../src/shapes/right-brace-shape';
155
- export { RightBracketShape } from '../src/shapes/right-bracket-shape';
156
- export { RightTriangleShape } from '../src/shapes/right-triangle-shape';
157
- export { Round1RectShape } from '../src/shapes/round-rectangle1-shape';
158
- export { Round2DiagRectShape } from '../src/shapes/round-rectangle2-diagonal-shape';
159
- export { Round2SameRectShape } from '../src/shapes/round-rectangle2-shape';
160
- export { RoundRectangleShape } from '../src/shapes/round-rectangle-shape';
161
- export { SmileyFaceShape } from '../src/shapes/smiley-face-shape';
162
- export { SnipRectangle1Shape } from '../src/shapes/snip-rectangle1-shape';
163
- export { SnipRectangle2DiagonalShape } from '../src/shapes/snip-rectangle2-diagonal-shape';
164
- export { SnipRectangle2SameShape } from '../src/shapes/snip-rectangle2-same-shape';
165
- export { SnipRoundRectangle1Shape } from '../src/shapes/snip-round-rectangle1-shape';
166
- export { SquareTabsShape } from '../src/shapes/square-tabs-shape';
167
- export { Star4Shape } from '../src/shapes/star4-shape';
168
- export { Star5Shape } from '../src/shapes/star5-shape';
169
- export { Star6Shape } from '../src/shapes/star6-shape';
170
- export { Star7Shape } from '../src/shapes/star7-shape';
171
- export { Star8Shape } from '../src/shapes/star8-shape';
172
- export { Star10Shape } from '../src/shapes/star10-shape';
173
- export { Star12Shape } from '../src/shapes/star12-shape';
174
- export { Star16Shape } from '../src/shapes/star16-shape';
175
- export { Star24Shape } from '../src/shapes/star24-shape';
176
- export { Star32Shape } from '../src/shapes/star32-shape';
177
- export { StraightConnector1Shape } from '../src/shapes/straight-connector1-shape';
178
- export { StripedRightArrowShape } from '../src/shapes/striped-right-arrow-shape';
179
- export { SunShape } from '../src/shapes/sun-shape';
180
- export { SwooshArrowShape } from '../src/shapes/swoosh-arrow-shape';
181
- export { TeardropShape } from '../src/shapes/teardrop-shape';
182
- export { TextBoxShape } from '../src/shapes/text-box-shape';
183
- export { TrapezoidShape } from '../src/shapes/trapezoid-shape';
184
- export { TriangleShape } from '../src/shapes/triangle-shape';
185
- export { UpArrowCalloutShape } from '../src/shapes/up-arrow-callout-shape';
186
- export { UpArrowShape } from '../src/shapes/up-arrow-shape';
187
- export { UpDownArrowCalloutShape } from '../src/shapes/up-down-arrow-callout-shape';
188
- export { UpDownArrowShape } from '../src/shapes/up-down-arrow-shape';
189
- export { UturnArrowShape } from '../src/shapes/uturn-arrow-shape';
190
- export { VerticalScrollShape } from '../src/shapes/vertical-scroll-shape';
191
- export { WaveShape } from '../src/shapes/wave-shape';
192
- export { WedgeEllipseCalloutShape } from '../src/shapes/wedge-ellipse-callout-shape';
193
- export { WedgeRectCalloutShape } from '../src/shapes/wedge-rect-callout-shape';
194
- export { WedgeRoundRectCalloutShape } from '../src/shapes/wedge-round-rect-callout-shape';
195
- export { computeConnectorRouteLayout, getBasicShapeRotateBound, rotatePointAroundCenter, routeConnectorLineShape, } from './render-engine/connector-points-util';
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, IShapeJSONData, IShapeLineStyle, IShapePath, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeShadowEffect, IShapeText, IShapeTextBodyBehavior, IShapeTextBoxOptions, IShapeTextData, IShapeTextDataModel, IShapeTextRectPadding, ShapeShadowAlignment, ShapeTextHorizontalAnchor, } from '../src/shape-type';
5
+ export { ShapeTextAutoFitType, ShapeTextDirection, ShapeTextWrapType } from '../src/shape-type';
6
+ export type { IResolvedShapeShadow } from '../src/utils/shape-shadow.util';
7
+ export { resolveShapeShadow } from '../src/utils/shape-shadow.util';
8
+ export { applyShapeTextBoxOptions, resolveShapeTextBodyBehavior, resolveShapeTextBoxOptions, shouldUseFullShapeTextRectForAutoFit, } from '../src/utils/shape-text-behavior.util';
9
+ export type { IResolvedShapeTextBoxOptions } from '../src/utils/shape-text-behavior.util';
10
+ export { UniverShapePlugin } from './plugin';
11
+ export { computeConnectorRouteLayout, getBasicShapeRotateBound, routeConnectorLineShape, } from './render-engine/connector-points-util';
12
+ export { ConnectorShapeHostAdapter } from './services/connector-shape-host-adapter';
13
+ export { IConnectorShapeHostAdapter } from './services/connector-shape-host-adapter.service';
14
+ export type { IConnectorArrow, IConnectorEndpoint, IConnectorShapeSnapshot, } from './services/connector-shape-host-adapter.service';
15
+ export { IShapeHostAdapterRegistry, isShapeHostType, ShapeHostAdapterRegistry, } from './services/shape-host-adapter.service';
16
+ export type { IShapeCreateInput, IShapeHostAdapter, IShapeRef, IShapeScope, IShapeSnapshot, IShapeTransform, IShapeUpdateInput, ShapeHostType, } from './services/shape-host-adapter.service';
196
17
  export { ShapeDefaultConfig } from './shape-default';
197
- export { freeRouteBentConnectorLinePoints } from './util/connector-points-util';
198
- export type { IBentConnectorResult } from './util/connector-points-util';
18
+ export { resolveShapeDefaultInsertSize } from './shape-default-size';
199
19
  export { ConnectorCoordinateTransform } from './util/connector-transform';
200
20
  export { createUniqueShapeName } from './util/shape-name';
201
- export { isConnectorShape, isCurvedConnectorShape } from './util/shape-util';
21
+ export { isConnectorShape, isCurvedConnectorShape, } from './util/shape-util';
22
+ export { buildConnectorEndpointUpdate, buildConnectorRoutePointsUpdate, createFreeConnectorPointInfo, resolveConnectorRoutePoints, resolveShapeConnectionPoint, } from './utils/connector.util';
23
+ export { applyDocumentToShapeText, applyRichTextToShapeText, applyShapeTextAlignment, applyShapeTextStyle, applyTextToShapeText, normalizeShapeTextData, shapeTextToRichTextValue, } from './utils/shape-text-converter';
24
+ export type { IShapeTextAlignmentOptions } from './utils/shape-text-converter';
@@ -1,5 +1,5 @@
1
1
  import type { ShapeTypeEnum } from '../shape-enum';
2
- import type { ICustomShapeTextData, IGdContext, IPresetShapeConfig, IShapeAdjustItemResolved, IShapeContextOptions, IShapeData, IShapeJSONData, IShapeModel, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeRenderParameters, IShapeText } from '../shape-type';
2
+ import type { IGdContext, IPresetShapeConfig, IShapeAdjustItemResolved, IShapeContextOptions, IShapeData, IShapeJSONData, IShapeModel, IShapePoint, IShapePointWithAdjName, IShapeRect, IShapeRelation, IShapeRelationItem, IShapeRenderParameters, IShapeTextData } from '../shape-type';
3
3
  import { BasicShapeEnum } from '../shape-enum';
4
4
  export declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T;
5
5
  export declare class BasicShapeModel implements IShapeModel {
@@ -26,12 +26,12 @@ export declare class BasicShapeModel implements IShapeModel {
26
26
  * get shape text data
27
27
  * @returns The shape text data
28
28
  */
29
- getShapeTextData(): IShapeText | ICustomShapeTextData;
29
+ getShapeTextData(): IShapeTextData;
30
30
  /**
31
31
  * set shape text data
32
32
  * @param shapeText The shape text data
33
33
  */
34
- setShapeTextData(shapeText: IShapeText | ICustomShapeTextData): void;
34
+ setShapeTextData(shapeText: IShapeTextData): void;
35
35
  /**
36
36
  * get shape text rect, the shape text rect is defined in shape preset config, if not exist, return the whole shape rect, we will add padding in render model
37
37
  * @param rect The drawing rect, define the position and size of the shape
@@ -0,0 +1,13 @@
1
+ import type { IUniverEngineShapeConfig } from './config/config';
2
+ import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
+ export declare class UniverShapePlugin extends Plugin {
4
+ private readonly _config;
5
+ protected readonly _injector: Injector;
6
+ private readonly _configService;
7
+ static type: UniverInstanceType;
8
+ static pluginName: string;
9
+ static packageName: string;
10
+ static version: string;
11
+ constructor(_config: Partial<IUniverEngineShapeConfig> | undefined, _injector: Injector, _configService: IConfigService);
12
+ onStarting(): void;
13
+ }
@@ -24,7 +24,6 @@ export declare abstract class BaseShapeRenderModel {
24
24
  * @returns {IShapeRect} The text rectangle within the shape
25
25
  */
26
26
  getTextRect(rect: IShapeRect, gdRecord: Partial<IGdContext>, shapeData?: IShapeData): IShapeRect;
27
- private _hasExplicitTextRectPadding;
28
27
  private _getPaddedWholeRect;
29
28
  private _getTextRectPadding;
30
29
  /**
@@ -0,0 +1,40 @@
1
+ import type { ShapeArrowSizeEnum, ShapeArrowTypeEnum } from '../shape-enum';
2
+ import type { IShapePoint, IShapeRelationItem } from '../shape-type';
3
+ import type { IConnectorShapeHostAdapter, IConnectorShapeSnapshot } from './connector-shape-host-adapter.service';
4
+ import type { IShapeRef } from './shape-host-adapter.service';
5
+ import { IShapeHostAdapterRegistry } from './shape-host-adapter.service';
6
+ /**
7
+ * Host-neutral Connector service that resolves the owning host's common Shape
8
+ * adapter from `IShapeHostAdapterRegistry` for every operation.
9
+ */
10
+ export declare class ConnectorShapeHostAdapter implements IConnectorShapeHostAdapter {
11
+ private readonly _shapeAdapterRegistry;
12
+ constructor(_shapeAdapterRegistry: IShapeHostAdapterRegistry);
13
+ /** Returns a resolved Connector snapshot. */
14
+ getConnector(ref: IShapeRef): IConnectorShapeSnapshot | null;
15
+ /** Binds the start endpoint to a target Shape connection site. */
16
+ bindStart(ref: IShapeRef, target: IShapeRelationItem): boolean;
17
+ /** Binds the end endpoint to a target Shape connection site. */
18
+ bindEnd(ref: IShapeRef, target: IShapeRelationItem): boolean;
19
+ /** Unbinds the start endpoint while preserving its current visual position. */
20
+ unbindStart(ref: IShapeRef): boolean;
21
+ /** Unbinds the end endpoint while preserving its current visual position. */
22
+ unbindEnd(ref: IShapeRef): boolean;
23
+ /** Sets a free start point and removes the existing start binding. */
24
+ setStartPoint(ref: IShapeRef, point: IShapePoint): boolean;
25
+ /** Sets a free end point and removes the existing end binding. */
26
+ setEndPoint(ref: IShapeRef, point: IShapePoint): boolean;
27
+ /** Replaces the intermediate route points in document coordinates. */
28
+ setRoutePoints(ref: IShapeRef, points: IShapePoint[]): boolean;
29
+ /** Sets the start arrowhead type and optional size. */
30
+ setStartArrow(ref: IShapeRef, type: ShapeArrowTypeEnum, size?: ShapeArrowSizeEnum): boolean;
31
+ /** Sets the end arrowhead type and optional size. */
32
+ setEndArrow(ref: IShapeRef, type: ShapeArrowTypeEnum, size?: ShapeArrowSizeEnum): boolean;
33
+ private _updateEndpoint;
34
+ private _getConnectorSnapshot;
35
+ private _resolveBinding;
36
+ private _setArrow;
37
+ private _getShapeAdapter;
38
+ private _getConnectorShape;
39
+ private _getArrow;
40
+ }
@@ -0,0 +1,55 @@
1
+ import type { ShapeArrowSizeEnum, ShapeArrowTypeEnum } from '../shape-enum';
2
+ import type { IShapePoint, IShapeRelationItem } from '../shape-type';
3
+ import type { IShapeRef } from './shape-host-adapter.service';
4
+ export interface IConnectorEndpoint {
5
+ /** Resolved endpoint in the host's document coordinate system. */
6
+ point: IShapePoint;
7
+ /** Target Shape connection-site binding, or `null` for a free endpoint. */
8
+ binding: IShapeRelationItem | null;
9
+ }
10
+ export interface IConnectorArrow {
11
+ /** Arrowhead type. */
12
+ type: ShapeArrowTypeEnum;
13
+ /** Optional arrowhead size. */
14
+ size?: ShapeArrowSizeEnum;
15
+ }
16
+ export interface IConnectorShapeSnapshot {
17
+ /** Resolved start endpoint. */
18
+ start: IConnectorEndpoint;
19
+ /** Resolved end endpoint. */
20
+ end: IConnectorEndpoint;
21
+ /** Resolved Connector path in the host's document coordinate system. */
22
+ routePoints: IShapePoint[];
23
+ /** Start arrowhead, or `null` when none is configured. */
24
+ startArrow: IConnectorArrow | null;
25
+ /** End arrowhead, or `null` when none is configured. */
26
+ endArrow: IConnectorArrow | null;
27
+ }
28
+ /**
29
+ * Common service contract for Connector-specific Shape reads and mutations.
30
+ * Mutations delegate persistence to the owning host's common Shape adapter.
31
+ */
32
+ export interface IConnectorShapeHostAdapter {
33
+ /** Returns the resolved Connector snapshot, or `null` when it does not exist. */
34
+ getConnector(ref: IShapeRef): IConnectorShapeSnapshot | null;
35
+ /** Binds the start endpoint to a target Shape connection site. */
36
+ bindStart(ref: IShapeRef, target: IShapeRelationItem): boolean;
37
+ /** Binds the end endpoint to a target Shape connection site. */
38
+ bindEnd(ref: IShapeRef, target: IShapeRelationItem): boolean;
39
+ /** Unbinds the start endpoint while preserving its current visual position. */
40
+ unbindStart(ref: IShapeRef): boolean;
41
+ /** Unbinds the end endpoint while preserving its current visual position. */
42
+ unbindEnd(ref: IShapeRef): boolean;
43
+ /** Sets a free start point and removes any existing start binding. */
44
+ setStartPoint(ref: IShapeRef, point: IShapePoint): boolean;
45
+ /** Sets a free end point and removes any existing end binding. */
46
+ setEndPoint(ref: IShapeRef, point: IShapePoint): boolean;
47
+ /** Replaces the explicit Connector route points. */
48
+ setRoutePoints(ref: IShapeRef, points: IShapePoint[]): boolean;
49
+ /** Sets the start arrowhead type and optional size. */
50
+ setStartArrow(ref: IShapeRef, type: ShapeArrowTypeEnum, size?: ShapeArrowSizeEnum): boolean;
51
+ /** Sets the end arrowhead type and optional size. */
52
+ setEndArrow(ref: IShapeRef, type: ShapeArrowTypeEnum, size?: ShapeArrowSizeEnum): boolean;
53
+ }
54
+ /** Singleton Connector service backed by the registered common Shape adapters. */
55
+ export declare const IConnectorShapeHostAdapter: import("@wendellhu/redi").IdentifierDecorator<IConnectorShapeHostAdapter>;
@@ -0,0 +1,103 @@
1
+ import type { IDisposable, UniverInstanceType } from '@univerjs/core';
2
+ import type { ShapeTypeEnum } from '../shape-enum';
3
+ import type { IShapeData } from '../shape-type';
4
+ export type ShapeHostType = UniverInstanceType.UNIVER_SHEET | UniverInstanceType.UNIVER_DOC | UniverInstanceType.UNIVER_SLIDE | UniverInstanceType.UNIVER_BOARD;
5
+ export declare function isShapeHostType(type: UniverInstanceType): type is ShapeHostType;
6
+ export interface IShapeScope {
7
+ /** Univer host type that owns the Shape. */
8
+ hostType: ShapeHostType;
9
+ /** Host unit identifier, such as a workbook, document, presentation, or board id. */
10
+ unitId: string;
11
+ /** Host subunit identifier, such as a worksheet or slide id. */
12
+ subUnitId: string;
13
+ }
14
+ export interface IShapeRef extends IShapeScope {
15
+ /** Stable Shape identifier within the host subunit. */
16
+ shapeId: string;
17
+ }
18
+ export interface IShapeTransform {
19
+ /** Horizontal position in host coordinates. */
20
+ left: number;
21
+ /** Vertical position in host coordinates. */
22
+ top: number;
23
+ /** Shape width in host coordinates. */
24
+ width: number;
25
+ /** Shape height in host coordinates. */
26
+ height: number;
27
+ /** Clockwise rotation in degrees. */
28
+ rotation: number;
29
+ /** Whether the Shape is flipped horizontally. */
30
+ flipX: boolean;
31
+ /** Whether the Shape is flipped vertically. */
32
+ flipY: boolean;
33
+ }
34
+ export interface IShapeSnapshot extends IShapeRef {
35
+ /** Current preset Shape type. */
36
+ shapeType: ShapeTypeEnum;
37
+ /** Current host-neutral Shape data. */
38
+ shapeData: IShapeData;
39
+ /** Optional user-facing Shape name. */
40
+ name?: string;
41
+ /** Optional user-facing Shape description. */
42
+ description?: string;
43
+ /** Fully resolved Shape transform. */
44
+ transform: IShapeTransform;
45
+ /** Whether the Shape is rendered by its host. */
46
+ visible: boolean;
47
+ /** Whether the Shape can be selected from its host canvas. */
48
+ selectable: boolean;
49
+ }
50
+ export interface IShapeCreateInput {
51
+ /** Preset type of the Shape to create. */
52
+ shapeType: ShapeTypeEnum;
53
+ /** Partial transform. Omitted fields use defaults supplied by the target host. */
54
+ transform?: Partial<IShapeTransform>;
55
+ /** Initial host-neutral Shape data. */
56
+ shapeData?: IShapeData;
57
+ /** Initial user-facing Shape name. */
58
+ name?: string;
59
+ /** Initial user-facing Shape description. */
60
+ description?: string;
61
+ /** Initial visibility. Defaults to `true`. */
62
+ visible?: boolean;
63
+ /** Initial canvas selectability. Defaults to `true`. */
64
+ selectable?: boolean;
65
+ }
66
+ export interface IShapeUpdateInput {
67
+ /** Replacement preset Shape type. */
68
+ shapeType?: ShapeTypeEnum;
69
+ /** Transform fields to update. */
70
+ transform?: Partial<IShapeTransform>;
71
+ /** Replacement host-neutral Shape data. */
72
+ shapeData?: IShapeData;
73
+ /** User-facing Shape name. Pass `undefined` explicitly to clear it. */
74
+ name?: string;
75
+ /** User-facing Shape description. Pass `undefined` explicitly to clear it. */
76
+ description?: string;
77
+ /** Visibility to update. Omit to preserve the current value. */
78
+ visible?: boolean;
79
+ /** Canvas selectability to update. Omit to preserve the current value. */
80
+ selectable?: boolean;
81
+ }
82
+ export interface IShapeHostAdapter {
83
+ readonly hostType: ShapeHostType;
84
+ getShape(ref: IShapeRef): IShapeSnapshot | null;
85
+ listShapes(scope: IShapeScope): IShapeSnapshot[];
86
+ createShape(scope: IShapeScope, input: IShapeCreateInput): IShapeSnapshot | null;
87
+ updateShape(ref: IShapeRef, input: IShapeUpdateInput): boolean;
88
+ removeShape(ref: IShapeRef): boolean;
89
+ bringToFront(ref: IShapeRef): boolean;
90
+ bringForward(ref: IShapeRef): boolean;
91
+ sendBackward(ref: IShapeRef): boolean;
92
+ sendToBack(ref: IShapeRef): boolean;
93
+ }
94
+ export interface IShapeHostAdapterRegistry {
95
+ register(adapter: IShapeHostAdapter): IDisposable;
96
+ get(hostType: UniverInstanceType): IShapeHostAdapter | null;
97
+ }
98
+ export declare const IShapeHostAdapterRegistry: import("@wendellhu/redi").IdentifierDecorator<IShapeHostAdapterRegistry>;
99
+ export declare class ShapeHostAdapterRegistry implements IShapeHostAdapterRegistry {
100
+ private readonly _adapters;
101
+ register(adapter: IShapeHostAdapter): IDisposable;
102
+ get(hostType: UniverInstanceType): IShapeHostAdapter | null;
103
+ }
@@ -0,0 +1,9 @@
1
+ import { ShapeTypeEnum } from './shape-enum';
2
+ export declare const SHAPE_DEFAULT_INSERT_BASE_SIZE = 100;
3
+ export interface IShapeDefaultInsertSize {
4
+ width: number;
5
+ height: number;
6
+ }
7
+ export declare const SHAPE_DEFAULT_INSERT_SIZE: Record<ShapeTypeEnum, IShapeDefaultInsertSize>;
8
+ export declare function resolveShapeDefaultAspectRatio(shapeType: ShapeTypeEnum | string | null | undefined): number | undefined;
9
+ export declare function resolveShapeDefaultInsertSize(shapeType: ShapeTypeEnum | string | null | undefined, baseSize?: number): IShapeDefaultInsertSize | undefined;
@@ -1,8 +1,17 @@
1
- import { ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum } from './shape-enum';
1
+ import { ShapeFillEnum, ShapeGradientTypeEnum, ShapeLineCapEnum, ShapeLineDashEnum, ShapeLineJoinEnum, ShapeLineTypeEnum, ShapeSketchTypeEnum } from './shape-enum';
2
2
  export declare const ShapeDefaultConfig: {
3
+ fillType: ShapeFillEnum;
3
4
  fill: string;
5
+ fillOpacity: number;
6
+ gradientType: ShapeGradientTypeEnum;
7
+ gradientAngle: number;
8
+ gradientEndColor: string;
9
+ lineType: ShapeLineTypeEnum;
4
10
  stroke: string;
5
11
  strokeWidth: number;
12
+ strokeOpacity: number;
13
+ cornerRadius: number;
14
+ sketchType: ShapeSketchTypeEnum;
6
15
  cxnPointRadius: number;
7
16
  cxnPointFill: string;
8
17
  cxnPointStroke: string;
@@ -19,7 +28,6 @@ export declare const ShapeDefaultConfig: {
19
28
  fontSize: number;
20
29
  fontFamily: string;
21
30
  color: string;
22
- isRichText: boolean;
23
31
  bold: boolean;
24
32
  italic: boolean;
25
33
  underline: boolean;