/
types.ts
399 lines (342 loc) 路 9.21 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
import { FontStyle } from './struct'
import { Route } from './route'
import { Perimeter } from './perimeter'
export type Dialect = 'svg' | 'html'
export type Align = 'left' | 'center' | 'right'
export type VAlign = 'top' | 'middle' | 'bottom'
export type LabelPosition = 'left' | 'center' | 'right'
export type LabelVerticalPosition = 'top' | 'middle' | 'bottom'
export type Direction = 'north' | 'south' | 'east' | 'west'
export type LineCap = 'butt' | 'round' | 'square'
export type LineJoin = 'miter' | 'round' | 'bevel'
export type WritingDirection = '' | 'auto' | 'ltr' | 'rtl'
export interface Size {
width: number
height: number
}
export interface Margin {
top: number
right: number
bottom: number
left: number
}
interface ShapeStyle {
shape?: string
className?: string
pointerEvents?: boolean
cursor?: string
opacity?: number
rotation?: number
fill?: string
fillOpacity?: number
gradientColor?: string
gradientDirection?: Direction
stroke?: string
strokeWidth?: number
strokeOpacity?: number
dashed?: boolean
dashPattern?: string
fixDash?: boolean
flipH?: boolean
flipV?: boolean
glass?: boolean
shadow?: boolean
/**
* This specifies if the aspect ratio of the cell will be
* maintained when resizing.
*/
aspect?: boolean
/**
* This style specifies if a only the background of a cell
* should be painted when it is highlighted.
*/
backgroundOutline?: boolean
}
interface LabelStyle {
label?: false | string | HTMLElement
htmlLabel?: boolean
horizontal?: boolean
fontSize?: number
fontColor?: string
fontStyle?: FontStyle
fontFamily?: string
textOpacity?: number
textDirection?: WritingDirection
align?: Align
verticalAlign?: VAlign
overflow?: 'fill' | 'width' | 'visible' | 'hidden'
whiteSpace?: 'nowrap' | 'wrap'
labelBackgroundColor?: string
labelBorderColor?: string
labelClassName?: string
labelWidth?: number
spacing?: number
spacingTop?: number
spacingRight?: number
spacingBottom?: number
spacingLeft?: number
/**
* The horizontal label position of vertices. Possible values are
* `left`, `center`, `right`.
*
* Default is `center`.
*
* `left` means the entire label bounds is placed completely just
* to the left of the node, `right` means adjust to the right and
* `center` means the label bounds are vertically aligned with the
* bounds of the node.
*
* Note this style doesn't affect the positioning of label within the
* label bounds, to move the label horizontally within the label bounds,
* use `align` style.
*/
labelPosition?: LabelPosition
/**
* The vertical label position of vertices. Possible values are
* `top`, `middle`, `bottom`.
*
* Default is `middle`.
*
* `top` means the entire label bounds is placed completely just
* on the top of the node, `bottom` means adjust on the bottom
* and `middle` means the label bounds are horizontally aligned
* with the bounds of the vertex.
*
* Note this value doesn't affect the positioning of label within the
* label bounds, to move the label vertically within the label bounds,
* use `verticalAlign` style.
*/
labelVerticalPosition?: LabelVerticalPosition
}
interface EdgeStyle {
edge?: string | Route.Router | null
perimeter?: string | Perimeter.PerimeterFunction | null
/**
* If this is true then no edge style is applied for a given edge.
*/
noEdgeStyle?: boolean
sourcePort?: string
targetPort?: string
/**
* The direction(s) that edges are allowed to connect to cells in.
*/
portConstraint?: string
/**
* Whether port constraint directions are rotated with node rotation.
*/
portConstraintRotatable?: boolean
/**
* The direction(s) that edges are allowed to connect to sources in.
*/
sourcePortConstraint?: string
/**
* The direction(s) that edges are allowed to connect to targets in.
*/
targetPortConstraint?: string
perimeterSpacing?: number
sourcePerimeterSpacing?: number
targetPerimeterSpacing?: number
/**
* The horizontal relative coordinate connection point of an edge with
* its source terminal.
*/
exitX?: number
/**
* The vertical relative coordinate connection point of an edge with
* its source terminal.
*/
exitY?: number
/**
* The horizontal offset of the connection point of an edge with its
* source terminal.
*/
exitDx?: number
/**
* The vertical offset of the connection point of an edge with its
* source terminal.
*/
exitDy?: number
/**
* The horizontal relative coordinate connection point of an edge with
* its target terminal.
*/
entryX?: number
/**
* The vertical relative coordinate connection point of an edge with
* its target terminal.
*/
entryY?: number
/**
* The horizontal offset of the connection point of an edge with its
* target terminal.
*/
entryDx?: number
/**
* The vertical offset of the connection point of an edge with its
* target terminal.
*/
entryDy?: number
/**
* Defines if the perimeter should be used to find the exact entry point
* along the perimeter of the source.
*
* Default is `true`.
*/
exitPerimeter?: boolean
/**
* Defines if the perimeter should be used to find the exact entry point
* along the perimeter of the target.
*
* Default is `true`.
*/
entryPerimeter?: boolean
/**
* Defines if the connection points on either end of the edge should be
* computed so that the edge is vertical or horizontal if possible and
* if the point is not at a fixed location.
*/
orthogonal?: boolean
/**
* This style defines how the three segment orthogonal edge style
* leaves its terminal vertices. The vertical style leaves the
* terminal vertices at the top and bottom sides.
*/
elbow?: 'horizontal' | 'vertical'
segment?: number
endSize?: number
endArrow?: string
endFilled?: boolean
startSize?: number
startArrow?: string
startFilled?: boolean
}
interface ImageStyle {
image?: string
imageWidth?: number
imageHeight?: number
imageBackgroundColor?: string
imageBorderColor?: string
imageAlign?: Align
imageVerticalAlign?: VAlign
imageFlipH?: boolean
imageFlipV?: boolean
/**
* Specify whether keep image aspect or not.
*/
imageAspect?: boolean
}
interface IndicatorStyle {
indicatorShape?: string
indicatorImage?: string
indicatorColor?: string
indicatorStrokeColor?: string
indicatorGradientColor?: string
indicatorSpacing?: number
indicatorWidth?: number
indicatorHeight?: number
indicatorDirection?: Direction
}
interface HTMLShapeStyle {
html?: string | HTMLElement
css?: {
[selector: string]: Partial<CSSStyleDeclaration>
}
}
interface CustomStyle {
[key: string]: any
}
export interface Style
extends ShapeStyle,
LabelStyle,
EdgeStyle,
ImageStyle,
IndicatorStyle,
HTMLShapeStyle,
CustomStyle {
direction?: Direction
/**
* This style specifies whether the line between the title
* regio of a swimlane should be visible.
*/
swimlaneLine?: boolean
swimlaneFillColor?: string
separatorColor?: string
margin?: number
rounded?: boolean
curved?: boolean
arcSize?: number
absoluteArcSize?: boolean
/**
* This style defines if the direction style should be taken into
* account when computing the fixed point location for connected edges.
*/
anchorPointDirection?: boolean
locked?: boolean
/**
* This specifies if a cell should be resized automatically if
* the value has changed.
*/
autosize?: boolean
/**
* This style specifies if a cell is foldable using a folding icon.
*/
foldable?: boolean
/**
* This style specifies if the value of a cell can be edited
* using the in-place editor.
*/
editable?: boolean
/**
* This style specifies if the control points of an edge can be moved.
*/
bendable?: boolean
/**
* This style specifies if a cell can be moved.
*/
movable?: boolean
/**
* This style specifies if a cell can be rotated.
*/
rotatable?: boolean
/**
* This style specifies if a cell can be cloned.
*/
cloneable?: boolean
/**
* This style specifies if a cell can be connected.
*/
connectable?: boolean
/**
* This style specifies if a cell can be deleted.
*/
deletable?: boolean
/**
* This style specifies if a cell can be resized.
*/
resizable?: boolean
/**
* This style specifies if a cell's width is resized if the parent is
* resized. If this is `true` then the width will be resized even if
* the cell's geometry is relative. If this is `false` then the cell's
* width will not be resized.
*/
resizeWidth?: boolean
/**
* This style specifies if a cell's height if resize if the parent is
* resized. If this is `true` then the height will be resized even if
* the cell's geometry is relative. If this is `false` then the cell's
* height will not be resized.
*/
resizeHeight?: boolean
/**
* Jetty size is the minimum length of the orthogonal segment
* before it attaches to a shape.
*/
jettySize?: number | 'auto'
sourceJettySize?: number | 'auto'
targetJettySize?: number | 'auto'
loopStyle?: string
orthogonalLoop?: boolean
routingCenterX?: number
routingCenterY?: number
}